From 46d8767a033bb285171e9050402e2dad5d53f5ac Mon Sep 17 00:00:00 2001
From: Jure Bericic <jure.bericic@gmail.com>
Date: Sat, 18 Feb 2017 23:01:22 -0500
Subject: [PATCH] Fixed a weird bug.

There was a weird bug in the code, that only triggered for some runs.
It turns out, in the `THcHodoscope::FineProcess` the hits in each plane
were created only for number of paddles in first plane. SHMS, however,
has 13 paddles in first plane and 14 and 21 paddles in last two planes.

The problem is fixed now, but part of that code should be rewritten for
efficiency.
---
 src/THcHodoscope.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx
index 2c476fb..0a397c9 100644
--- a/src/THcHodoscope.cxx
+++ b/src/THcHodoscope.cxx
@@ -1357,7 +1357,7 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks )
     std::vector<Double_t> scin_temp;
     fScinHitPaddle.push_back(scin_temp); // Create array of hits per plane
 
-    for (UInt_t ipaddle = 0; ipaddle < fNPaddle[0]; ipaddle++ ){
+    for (UInt_t ipaddle = 0; ipaddle < fNPaddle[ip]; ipaddle++ ){
 	  fScinHitPaddle[ip].push_back(0.0);
 	  fScinHitPaddle[ip][ipaddle] = 0.0;
     }
-- 
GitLab