From 565468e9ff48a99fd8448e1c40985050fab964ba Mon Sep 17 00:00:00 2001
From: "Stephen A. Wood" <saw@jlab.org>
Date: Wed, 23 Nov 2016 10:00:14 -0500
Subject: [PATCH] Fix setup of reference time list in InitHitList

---
 src/THcHitList.cxx | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/THcHitList.cxx b/src/THcHitList.cxx
index e0a26fd..d467ee8 100644
--- a/src/THcHitList.cxx
+++ b/src/THcHitList.cxx
@@ -74,20 +74,19 @@ void THcHitList::InitHitList(THaDetMap* detmap,
       }
     }
   }
-  // Should add another loop over fdMap and check that all detector
-  // channels that have a refindex, use a defined index
+  // Loop to check that requested refindex's are defined
   for (Int_t i=0; i < fdMap->GetSize(); i++) {
     THaDetMap::Module* d = fdMap->GetModule(i);
-    if(d->plane < 1000) {
-      Int_t refindex = d->refindex;
+    Int_t refindex = d->refindex;
+    if(d->plane < 1000 && refindex >= 0) {
       if(!fRefIndexMaps[refindex].defined) {
 	cout << "Refindex " << refindex << " not defined for " <<
-		" (" << d->crate << ", " << d->slot <<
-		", " << d->lo << ")" << endl;
+	  " (" << d->crate << ", " << d->slot <<
+	  ", " << d->lo << ")" << endl;
       }
     }
   }
-	  
+
 }
 
 Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) {
-- 
GitLab