16 #include "THaGlobals.h"
23 #define SUPPRESSMISSINGADCREFTIMEMESSAGES 1
66 const char *hitclass,
Int_t maxhits,
68 cout <<
"InitHitList: " << hitclass <<
" RefTimeCuts: " << tdcref_cut <<
" " << adcref_cut << endl;
89 for(
Int_t i=0;i<maxhits;i++) {
107 THaDetMap::Module* d =
fdMap->GetModule(i);
108 if(d->plane >= 1000) {
109 Int_t refindex = d->signal;
124 THaDetMap::Module* d =
fdMap->GetModule(i);
125 if(d->plane >= 1000) {
126 Int_t refindex = d->signal;
133 cout <<
"Hitlist: Invalid refindex mapping" << endl;
140 THaDetMap::Module* d =
fdMap->GetModule(i);
141 Int_t refindex = d->refindex;
142 if(d->plane < 1000) {
143 if(d->signal >= fNSignals) {
144 cout <<
"Invalid signal " << d->signal <<
" for " <<
145 " (" << d->crate <<
", " << d->slot <<
146 ", " << d->lo <<
")" << endl;
150 cout <<
"Refindex " << refindex <<
" not defined for " <<
151 " (" << d->crate <<
", " << d->slot <<
152 ", " << d->lo <<
")" << endl;
159 TObjLink *lnk = gHaEvtHandlers->FirstLink();
169 cout <<
"THcHitList::InitHitList : Prestart event 125 not found." << endl;
195 cout <<
"Got the Crate map" << endl;
198 THaDetMap::Module* d =
fdMap->GetModule(i);
202 for(
UInt_t slot=0;slot<Decoder::MAXSLOT;slot++) {
206 cout <<
"TI Slot = " <<
fTISlot << endl;
212 for(
UInt_t slot=0;slot<Decoder::MAXSLOT;slot++) {
231 TI_TRIGGER_TIME_FOUND =
kTRUE;
257 if(
fTISlot>0 && TI_TRIGGER_TIME_FOUND) {
262 =
fFADCSlotMap[fRefIndexMaps[i].slot]->GetTriggerTime() - titime;
272 for(
UInt_t ihit=0; ihit<nrefhits; ihit++) {
275 reftime += 64*timeshift;
276 if (ihit != 0) difftime=reftime-prevtime;
299 for(
Int_t ihit=0; ihit<nrefhits; ihit++) {
302 if( ihit != 0) difftime=reftime-prevtime;
318 THaDetMap::Module* d =
fdMap->GetModule(i);
322 Int_t plane = d->plane;
323 if (plane >= 1000)
continue;
334 if( chan < d->lo || chan > d->hi )
continue;
338 Int_t counter = d->reverse ? d->first + d->hi - chan : d->first + chan - d->lo;
346 if (plane == rawhit->
fPlane
365 for (
UInt_t mhit = 0; mhit < nMHits; mhit++) {
371 if(d->refchan >= 0) {
377 for(
UInt_t ihit=0; ihit<nrefhits; ihit++) {
378 reftime = evdata.
GetData(d->crate, d->slot, d->refchan, ihit);
379 if (ihit != 0 ) difftime=reftime-prevtime;
391 }
else if (!suppresswarnings) {
392 cout <<
"HitList(event=" << evdata.
GetEvNum() <<
"): refchan " << d->refchan <<
393 " missing for (" << d->crate <<
", " << d->slot <<
394 ", " << chan <<
")" << endl;
398 if(d->refindex >=0 && d->refindex < fNRefIndex) {
403 if(!suppresswarnings) {
404 cout <<
"HitList(event=" << evdata.
GetEvNum() <<
"): refindex " << d->refindex <<
408 " missing for (" << d->crate <<
", " << d->slot <<
409 ", " << chan <<
")" << endl;
433 for (
UInt_t isamp=0;isamp<nsamples;isamp++) {
441 if(
fTISlot>0 && TI_TRIGGER_TIME_FOUND) {
451 for (
UInt_t ipulse=0;ipulse<npulses;ipulse++) {
459 if(d->refchan >= 0) {
461 d->crate, d->slot, d->refchan);
467 if(
fTISlot>0 && TI_TRIGGER_TIME_FOUND) {
477 for(
UInt_t ihit=0; ihit<nrefhits; ihit++) {
479 reftime += 64*timeshift;
480 if (ihit != 0) difftime=reftime-prevtime;
492 }
else if (!suppresswarnings) {
493 #ifndef SUPPRESSMISSINGADCREFTIMEMESSAGES
494 cout <<
"HitList(event=" << evdata.
GetEvNum() <<
"): refchan " << d->refchan <<
495 " missing for (" << d->crate <<
", " << d->slot <<
496 ", " << chan <<
")" << endl;
501 if(d->refindex >=0 && d->refindex < fNRefIndex) {
506 if(!suppresswarnings) {
507 #ifndef SUPPRESSMISSINGADCREFTIMEMESSAGES
508 cout <<
"HitList(event=" << evdata.
GetEvNum() <<
"): refindex " << d->refindex <<
512 " missing for (" << d->crate <<
", " << d->slot <<
513 ", " << chan <<
")" << endl;
524 if(
fTISlot>0 && TI_TRIGGER_TIME_FOUND) {
526 map<Int_t, Int_t>::iterator it;
528 if(it->second < -3 || it->second > 3) {
529 cout <<
"Big ADC Trigger Time Shift, ROC " <<
fTICrate << endl;
530 cout << it->first <<
" " << it->second << endl;
533 }
else if (
fTISlot>0 && !TI_TRIGGER_TIME_FOUND) {
534 cout <<
"TI Trigger Time Not found for event type = " << evdata.
GetEvType() <<
" event num = " << evdata.
GetEvNum() <<
" TI Crate = " <<
fTICrate <<
" TI Slot = " <<
fTISlot<< endl;
553 cout <<
"Defining " <<
Form(
"%s_tdcref_miss", prefix) <<
" and " <<
Form(
"%s_adcref_miss", prefix) << endl;
Bool_t IsMultifunction(UInt_t crate, UInt_t slot) const
virtual Decoder::Module * GetModule(UInt_t roc, UInt_t slot) const
virtual Int_t GetNSA(Int_t crate)
virtual void SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED)
void MissReport(const char *name)
virtual ESignalType GetSignalType(Int_t signal)
Builds a Hall C ENGINE style list of raw hits from raw data.
TClonesArray * fRawHitList
TObject * ConstructedAt(Int_t idx)
Decoder::THaCrateMap * GetCrateMap() const
virtual Int_t GetNSignals()
std::vector< RefIndexMap > fRefIndexMaps
THcConfigEvtHandler * fPSE125
virtual void SetReferenceDiff(Int_t signal, Int_t reference)
virtual void Clear(Option_t *option="")
void InitHitList(THaDetMap *detmap, const char *hitclass, Int_t maxhits, Int_t tdcref_cut=0, Int_t adcref_cut=0)
Save the electronics module to detector mapping and initialize a hit array of hits of class hitclass...
UInt_t GetNumHits(UInt_t crate, UInt_t slot, UInt_t chan) const
virtual const char * ClassName() const
TObject * GetObject() const
Analyze Hall C Configuration events. (Event type 125).
char * Form(const char *fmt,...)
void CreateMissReportParms(const char *prefix)
virtual void SetReference(Int_t signal, Int_t reference)
UInt_t GetData(UInt_t crate, UInt_t slot, UInt_t chan, UInt_t hit) const
virtual Int_t GetNSB(Int_t crate)
Base class detector specific raw hit that go into hit lists.
UInt_t GetNumEvents(Decoder::EModuleType type, UInt_t crate, UInt_t slot, UInt_t chan) const
Int_t getModel(UInt_t crate, UInt_t slot) const
virtual Int_t GetNPED(Int_t crate)
TClass * GetClass() const
std::map< Int_t, Int_t > fTrigTimeShiftMap
Decoder::THaCrateMap * fMap
virtual void SetSample(Int_t signal, Int_t data)
ClassImp(THcDCLookupTTDConv) THcDCLookupTTDConv
UInt_t GetNextChan(UInt_t crate, UInt_t slot, UInt_t index) const
virtual void Sort(Int_t upto=kMaxInt)
UInt_t GetNumChan(UInt_t crate, UInt_t slot) const
THcRawHit::ESignalType * fSignalTypes
R__EXTERN class THcParmList * gHcParms
virtual void SetData(Int_t signal, Int_t data)
virtual Int_t DecodeToHitList(const THaEvData &evdata, Bool_t suppress=kFALSE)
Populate the hitlist from the raw event data.
virtual void SetDataTimePedestalPeak(Int_t signal, Int_t data, Int_t time, Int_t pedestal, Int_t peak)
Double_t fDisableSlipCorrection
std::map< Int_t, Decoder::Fadc250Module * > fFADCSlotMap