30 gPARMS->SetDefaultParameter(
"TAGHHit:MERGE_DOUBLES", MERGE_DOUBLES,
31 "Merge double hits?");
32 DELTA_T_DOUBLES_MAX = 1.0;
33 gPARMS->SetDefaultParameter(
"TAGHHit:DELTA_T_DOUBLES_MAX", DELTA_T_DOUBLES_MAX,
34 "Maximum time difference in ns between hits in adjacent counters"
35 " for them to be merged into a single hit");
36 DELTA_ID_DOUBLES_MAX = 1;
37 gPARMS->SetDefaultParameter(
"TAGHHit:DELTA_ID_DOUBLES_MAX", DELTA_ID_DOUBLES_MAX,
38 "Maximum counter id difference of merged hits");
40 gPARMS->SetDefaultParameter(
"TAGHHit:ID_DOUBLES_MAX", ID_DOUBLES_MAX,
41 "Maximum counter id of a double hit");
42 USE_SIDEBAND_DOUBLES =
false;
43 gPARMS->SetDefaultParameter(
"TAGHHit:USE_SIDEBAND_DOUBLES", USE_SIDEBAND_DOUBLES,
44 "Use sideband to estimate accidental coincidences between neighbors?");
47 SetFactoryFlag(NOT_OBJECT_OWNER);
58 vector<double> locBeamPeriodVector;
59 eventLoop->GetCalib(
"PHOTON_BEAM/RF/beam_period", locBeamPeriodVector);
60 dBeamBunchPeriod = locBeamPeriodVector[0];
78 vector<const DTAGHHit*> hits;
79 loop->Get(hits,
"Calib");
84 for (
size_t i = 0; i < hits.size(); i++) {
88 if (!MERGE_DOUBLES || hit1->
counter_id > ID_DOUBLES_MAX) {
89 _data.push_back(hit1);
94 for (
size_t j = i+1; j < hits.size(); j++) {
100 if (d > DELTA_ID_DOUBLES_MAX)
break;
102 if (IsDoubleHit(hit2->
t-hit1->
t)) {
107 _data.push_back(hit1);
115 if (!USE_SIDEBAND_DOUBLES) {
116 return fabs(tdiff) < DELTA_T_DOUBLES_MAX;
118 return (tdiff > -DELTA_T_DOUBLES_MAX - dBeamBunchPeriod)
119 && (tdiff < DELTA_T_DOUBLES_MAX - dBeamBunchPeriod);
jerror_t fini(void)
Called after last event of last event source has been processed.
bool IsDoubleHit(double tdiff)
jerror_t erun(void)
Called everytime run number changes, if brun has been called.
jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
bool DTAGHHit_SortByID(const DTAGHHit *h1, const DTAGHHit *h2)
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
jerror_t init(void)
Called once at program start.