From 142d35a98317fca9690f9d7e3a7961ee1050c82c Mon Sep 17 00:00:00 2001
From: hallc-online <hallconline@gmail.com>
Date: Sat, 28 Apr 2018 15:21:58 -0400
Subject: [PATCH] Modify THcHodoEff

In Process add if statement to be sure that hitcounter is
  greater than zero and less than total number of paddles
  in the plane.
---
 src/THcHodoEff.cxx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/THcHodoEff.cxx b/src/THcHodoEff.cxx
index 79c5769..2cbc877 100644
--- a/src/THcHodoEff.cxx
+++ b/src/THcHodoEff.cxx
@@ -377,6 +377,8 @@ Int_t THcHodoEff::Process( const THaEvData& evdata )
 
   for(Int_t ip=0;ip<fNPlanes;ip++) {
     Int_t hitcounter = hitCounter[ip];
+    if (hitcounter>=fNCounters[ip]) hitcounter=fNCounters[ip]-1;
+    if (hitcounter<0) hitcounter=0;    
     Double_t dist = hitDistance[ip];
     Int_t nphits=fPlanes[ip]->GetNScinHits();
     TClonesArray* hodoHits = fPlanes[ip]->GetHits();
@@ -387,7 +389,6 @@ Int_t THcHodoEff::Process( const THaEvData& evdata )
       Bool_t onTrack, goodScinTime, goodTdcNeg, goodTdcPos;
       fHod->GetFlags(trackIndex,ip,ihit,
 		     onTrack, goodScinTime, goodTdcNeg, goodTdcPos);
-
       if(TMath::Abs(dist) <= fStatSlop &&
 	 TMath::Abs(hitcounter-counter) <= checkHit[ip] &&
 	 fHitPlane[ip] == 0 &&
-- 
GitLab