From 625606ab731ac2ee0c03a665f30c45db558e0d48 Mon Sep 17 00:00:00 2001
From: Nicolas de Sereville <deserevi@ipno.in2p3.fr>
Date: Fri, 27 Nov 2015 10:00:41 +0100
Subject: [PATCH] + Fix bug concerning strip numbering in BuildPhysicalEvent()
 method

---
 NPLib/CATS/TCATSPhysics.cxx | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/NPLib/CATS/TCATSPhysics.cxx b/NPLib/CATS/TCATSPhysics.cxx
index 8804899bf..d32630c3f 100644
--- a/NPLib/CATS/TCATSPhysics.cxx
+++ b/NPLib/CATS/TCATSPhysics.cxx
@@ -197,12 +197,18 @@ void TCATSPhysics::BuildPhysicalEvent(){
 
   for(unsigned int i  = 0 ; i < NumberOfCATSHit ; i++ ){       
     // Return the position in strip unit
+     // Convention: the collected charge is atrributed to the center of the strip
+     // (histogram convention) so that a reconstructed position for a single strip
+     // goes from strip index -0.5 to strip index +0.5
     double PosX =  ReconstructionFunctionX[DetMaxX[i]-1](Buffer_X_Q[i],StripMaxX[i]);
     double PosY =  ReconstructionFunctionY[DetMaxY[i]-1](Buffer_Y_Q[i],StripMaxY[i]);
     StripNumberX.push_back(PosX);
     StripNumberY.push_back(PosY);   
 
-    // Convert in mm by doing a linear interpolation
+    // a shift - -1 is made to have PosX in between -0.5 and 27.5
+    // for the following calculation of the position in the lab.
+    PosX = PosX -1;
+    PosY = PosY -1;
 
     // sx and sy are the X and Y strip number between which the PosX and PosY are
     int sx0 = (int) PosX;
-- 
GitLab