From 733768bf730c380a3d8c2bb8199b7c5ae69014df Mon Sep 17 00:00:00 2001
From: Philip Adsley <padsley@gmail.com>
Date: Mon, 10 Oct 2016 08:43:04 +0200
Subject: [PATCH] Fix logic error in W1 strip matching

The condition was:

 if (m_PreTreatedData->GetFrontTStripNbr(couple[i].X()) == m_PreTreatedData->GetFrontTStripNbr(t) ||
                m_PreTreatedData->GetFrontTDetectorNbr(couple[i].X()) == m_PreTreatedData->GetFrontTDetectorNbr(t))

i.e., if the strip number is the same or the detector number is the same.

This has been modified to:

 if (m_PreTreatedData->GetFrontTStripNbr(couple[i].X()) == m_PreTreatedData->GetFrontTStripNbr(t) &&
                m_PreTreatedData->GetFrontTDetectorNbr(couple[i].X()) == m_PreTreatedData->GetFrontTDetectorNbr(t))

i.e. the strip number and detector number should both be the same.
---
 NPLib/Detectors/W1/TW1Physics.cxx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/NPLib/Detectors/W1/TW1Physics.cxx b/NPLib/Detectors/W1/TW1Physics.cxx
index 333ff7647..452169120 100644
--- a/NPLib/Detectors/W1/TW1Physics.cxx
+++ b/NPLib/Detectors/W1/TW1Physics.cxx
@@ -560,7 +560,7 @@ void TW1Physics::BuildSimplePhysicalEvent()
          // Front
          Double_t TimeFront = -1000;
          for (UShort_t t = 0; t < m_PreTreatedData->GetFrontTMult(); t++) {
-            if (m_PreTreatedData->GetFrontTStripNbr(couple[i].X()) == m_PreTreatedData->GetFrontTStripNbr(t) ||
+            if (m_PreTreatedData->GetFrontTStripNbr(couple[i].X()) == m_PreTreatedData->GetFrontTStripNbr(t) &&
                 m_PreTreatedData->GetFrontTDetectorNbr(couple[i].X()) == m_PreTreatedData->GetFrontTDetectorNbr(t)) {
                TimeFront = m_PreTreatedData->GetFrontTTime(t);
                m_Counter[4] = 1;
@@ -569,7 +569,7 @@ void TW1Physics::BuildSimplePhysicalEvent()
          // Back
          Double_t TimeBack = -1000;
          for (UShort_t t = 0; t < m_PreTreatedData->GetBackTMult(); t++) {
-            if (m_PreTreatedData->GetBackTStripNbr(couple[i].Y()) == m_PreTreatedData->GetBackTStripNbr(t) ||
+            if (m_PreTreatedData->GetBackTStripNbr(couple[i].Y()) == m_PreTreatedData->GetBackTStripNbr(t) &&
                 m_PreTreatedData->GetBackTDetectorNbr(couple[i].Y()) == m_PreTreatedData->GetBackTDetectorNbr(t))
                TimeBack = m_PreTreatedData->GetBackTTime(t);
          }
-- 
GitLab