From 7ae7987769c7904ffb429f163ebf31deea35c274 Mon Sep 17 00:00:00 2001
From: "Stephen A. Wood" <saw@jlab.org>
Date: Thu, 29 Sep 2016 14:54:17 -0400
Subject: [PATCH] Reference time fixes:   Fix bad Addmodule argument (refchan) 
  Print warning if expected reference time is missing      (Probably means
 event is bad)

---
 src/THcDetectorMap.cxx | 4 ++--
 src/THcHitList.cxx     | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/THcDetectorMap.cxx b/src/THcDetectorMap.cxx
index 1f93b1c..9b83623 100644
--- a/src/THcDetectorMap.cxx
+++ b/src/THcDetectorMap.cxx
@@ -176,8 +176,8 @@ Int_t THcDetectorMap::FillMap(THaDetMap *detmap, const char *detectorname)
     }
     detmap->AddModule((UShort_t)roc, (UShort_t)slot,
 		      (UShort_t)first_chan, (UShort_t)last_chan,
-		      (UInt_t) first_counter, model, (Int_t) 0,
-		      (Int_t) last_refindex, (UInt_t)last_plane, (UInt_t)last_signal);
+		      (UInt_t) first_counter, model, (Int_t) last_refindex,
+		      (Int_t) last_refchan, (UInt_t)last_plane, (UInt_t)last_signal);
   }
 
   return(0);
diff --git a/src/THcHitList.cxx b/src/THcHitList.cxx
index 9363cbe..e0a26fd 100644
--- a/src/THcHitList.cxx
+++ b/src/THcHitList.cxx
@@ -173,6 +173,10 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) {
 	if( evdata.GetNumHits(d->crate,d->slot,d->refchan) > 0) {
 	  Int_t reftime = evdata.GetData(d->crate, d->slot, d->refchan, 0);
 	  rawhit->SetReference(signal, reftime);
+	} else {
+	  cout << "HitList: refchan " << d->refindex <<
+	      " missing for (" << d->crate << ", " << d->slot <<
+	      ", " << chan << ")" << endl;
 	}
       } else {
 	if(d->refindex >=0 && d->refindex < fNRefIndex) {
-- 
GitLab