246 TI_TRIGGER_TIME_FOUND =
kTRUE;
248 if( titime >= FUDGE )
251 Warning(Here(
"DecodeToHitList"),
252 "Invalid TI time %u - %u < 0 for crate/slot = %d/%d",
276 if(
fTISlot > 0 && TI_TRIGGER_TIME_FOUND ) {
282 static_cast<Int_t>(ifadc->second->GetTriggerTime() - titime);
285 timeshift = ishift->second;
295 theMap.crate, theMap.slot, theMap.channel);
296 for(
UInt_t ihit = 0; ihit < nrefhits; ihit++ ) {
298 theMap.slot, theMap.channel, ihit);
299 reftime += 64 * timeshift;
301 difftime = reftime - prevtime;
310 theMap.crate, theMap.slot, theMap.channel);
311 if( nrefhits == 0 && nrefsamples > 0 ) {
319 if( ref_fNSA == -1 ) ref_fNSA = 26;
320 if( ref_fNSB == -1 ) ref_fNSB = 3;
321 if( ref_fNPED == -1 ) ref_fNPED = 4;
329 refrawhit->SetF250Params(ref_fNSA, ref_fNSB, ref_fNPED);
330 for(
UInt_t isamp = 0; isamp < nrefsamples; isamp++ ) {
331 refrawhit->SetSample(
333 theMap.crate, theMap.slot, theMap.channel, isamp));
335 refrawhit->SetSampThreshold(20.);
336 refrawhit->SetSampIntTimePedestalPeak();
337 UInt_t NRefSampPulses = refrawhit->GetNSampPulses();
338 for(
UInt_t ihit = 0; ihit < NRefSampPulses; ihit++ ) {
339 reftime = refrawhit->GetSampPulseTimeRaw(ihit);
340 reftime += 64 * timeshift;
342 difftime = reftime - prevtime;
353 theMap.reftime = reftime;
354 theMap.refdifftime = difftime;
355 theMap.hashit =
kTRUE;
361 UInt_t nrefhits = evdata.
GetNumHits(theMap.crate, theMap.slot, theMap.channel);
369 for(
UInt_t ihit = 0; ihit < nrefhits; ihit++ ) {
370 reftime = evdata.
GetData(theMap.crate, theMap.slot, theMap.channel, ihit);
372 difftime = reftime - prevtime;
380 theMap.reftime = reftime;
381 theMap.refdifftime = difftime;
382 theMap.hashit =
kTRUE;
387 map<ULong64_t, THcRawHit*> hitlookup;
389 return (
static_cast<ULong64_t>(plane) << 32) + counter;
399 auto plane =
static_cast<Int_t>(
d->plane);
402 auto signal =
static_cast<Int_t>(
d->signal);
408 if( chan < d->lo ||
chan >
d->hi )
413 Int_t counter =
d->reverse
420 auto found = hitlookup.find(lookupkey(plane, counter));
421 if( found != hitlookup.end() )
422 rawhit = found->second;
428 hitlookup.emplace(lookupkey(plane, counter), rawhit);
432 if( prev_rawhit && prev_rawhit->
Compare(rawhit) >= 0 )
435 prev_rawhit = rawhit;
443 for(
UInt_t mhit = 0; mhit < nMHits; mhit++ ) {
449 if(
d->refchan >= 0 ) {
455 for(
UInt_t ihit = 0; ihit < nrefhits; ihit++ ) {
456 reftime = evdata.
GetData(
d->crate,
d->slot,
d->refchan, ihit);
457 if( ihit != 0 ) difftime = reftime - prevtime;
469 }
else if( !suppresswarnings ) {
470 cout <<
"HitList(event=" << evdata.
GetEvNum() <<
"): refchan " <<
d->refchan <<
471 " missing for (" <<
d->crate <<
", " <<
d->slot <<
472 ", " <<
chan <<
")" << endl;
478 if( theMap.hashit ) {
482 if( !suppresswarnings ) {
483 cout <<
"HitList(event=" << evdata.
GetEvNum() <<
"): refindex " <<
d->refindex <<
484 " (" << theMap.crate <<
485 ", " << theMap.slot <<
486 ", " << theMap.channel <<
")" <<
487 " missing for (" <<
d->crate <<
", " <<
d->slot <<
488 ", " <<
chan <<
")" << endl;
519 for(
UInt_t isamp = 0; isamp < nsamples; isamp++ ) {
527 if(
fTISlot > 0 && TI_TRIGGER_TIME_FOUND ) {
533 static_cast<Int_t>(ifadc->second->GetTriggerTime() - titime);
536 timeshift = ishift->second;
539 for(
UInt_t ipulse = 0; ipulse < npulses; ipulse++ ) {
550 if(
d->refchan >= 0 ) {
552 d->crate,
d->slot,
d->refchan);
557 if(
fTISlot > 0 && TI_TRIGGER_TIME_FOUND ) {
563 static_cast<Int_t>(ifadc->second->GetTriggerTime() - titime);
566 timeshift = ishift->second;
570 for(
UInt_t ihit = 0; ihit < nrefhits; ihit++ ) {
572 reftime += 64 * timeshift;
573 if( ihit != 0 ) difftime = reftime - prevtime;
582 if( nrefhits == 0 && nrefsamples > 0 ) {
584 for(
UInt_t isamp = 0; isamp < nrefsamples; isamp++ ) {
587 refrawhit->SetSampThreshold(20.);
588 refrawhit->SetSampIntTimePedestalPeak();
589 UInt_t NRefSampPulses = refrawhit->GetNSampPulses();
590 for(
UInt_t ihit = 0; ihit < NRefSampPulses; ihit++ ) {
591 reftime = refrawhit->GetSampPulseTimeRaw(ihit);
592 reftime += 64 * timeshift;
594 difftime = reftime - prevtime;
609 }
else if( !suppresswarnings ) {
610#ifndef SUPPRESSMISSINGADCREFTIMEMESSAGES
611 cout <<
"HitList(event=" << evdata.
GetEvNum() <<
"): refchan " <<
d->refchan <<
612 " missing for (" <<
d->crate <<
", " <<
d->slot <<
613 ", " <<
chan <<
")" << endl;
620 if( theMap.hashit ) {
624 if( !suppresswarnings ) {
625#ifndef SUPPRESSMISSINGADCREFTIMEMESSAGES
626 cout <<
"HitList(event=" << evdata.
GetEvNum() <<
"): refindex " <<
d->refindex <<
627 " (" << theMap.crate <<
628 ", " << theMap.slot <<
629 ", " << theMap.channel <<
")" <<
630 " missing for (" <<
d->crate <<
", " <<
d->slot <<
631 ", " <<
chan <<
")" << endl;
642 if(
fTISlot > 0 && TI_TRIGGER_TIME_FOUND ) {
645 if( it.second < -3 || it.second > 3 ) {
646 cout <<
"Big ADC Trigger Time Shift, ROC " <<
fTICrate << endl;
647 cout << it.first <<
" " << it.second << endl;
650 }
else if(
fTISlot > 0 && !TI_TRIGGER_TIME_FOUND ) {