13 inline float build_rechit_time(
const float weightedEnergySum,
14 const float weightedSum,
17 const float valueIfNothingWorks,
18 bool* resultComesFromTDC) {
19 if (weightedEnergySum > 0.
f) {
20 *resultComesFromTDC =
true;
21 return weightedSum / weightedEnergySum;
23 *resultComesFromTDC =
true;
26 *resultComesFromTDC =
false;
27 return valueIfNothingWorks;
34 const unsigned i_soiPhase,
35 const float i_timeShift,
36 const float i_triseIfNoTDC,
37 const float i_tfallIfNoTDC,
38 const float i_minChargeForUndershoot,
39 const float i_minChargeForOvershoot,
42 : soiPhase_(i_soiPhase),
43 timeShift_(i_timeShift),
44 triseIfNoTDC_(i_triseIfNoTDC),
45 tfallIfNoTDC_(i_tfallIfNoTDC),
46 minChargeForUndershoot_(i_minChargeForUndershoot),
47 minChargeForOvershoot_(i_minChargeForOvershoot),
74 eStates[0] = states[0];
75 eStates[1] = states[1];
77 for (
unsigned i = 0;
i < 2; ++
i)
90 const bool flaggedBadInDB[2],
91 const bool expectSingleAnodePMT) {
96 if (expectSingleAnodePMT)
99 bool isTimingReliable[2] = {
true,
true};
100 for (
unsigned ianode = 0; ianode < 2; ++ianode) {
101 if (flaggedBadInDB[ianode])
112 if (lookupInd != UINT_MAX) {
117 float energy = 0.f, tfallWeightedEnergySum = 0.f, triseWeightedEnergySum = 0.f;
118 float tfallWeightedSum = 0.f, triseWeightedSum = 0.f;
119 float tfallSum = 0.f, triseSum = 0.f;
120 unsigned tfallCount = 0, triseCount = 0;
122 for (
unsigned ianode = 0; ianode < 2; ++ianode) {
124 if (anodeInfo &&
weights[ianode] > 0.
f) {
125 const float weightedEnergy =
weights[ianode] * anodeInfo->
energy();
134 if (weightedEnergy > 0.
f) {
135 triseWeightedSum += trise * weightedEnergy;
136 triseWeightedEnergySum += weightedEnergy;
145 if (weightedEnergy > 0.
f) {
146 tfallWeightedSum += tfall * weightedEnergy;
147 tfallWeightedEnergySum += weightedEnergy;
154 bool triseFromTDC =
false;
156 build_rechit_time(triseWeightedEnergySum, triseWeightedSum, triseSum, triseCount,
triseIfNoTDC_, &triseFromTDC);
158 bool tfallFromTDC =
false;
160 build_rechit_time(tfallWeightedEnergySum, tfallWeightedSum, tfallSum, tfallCount,
tfallIfNoTDC_, &tfallFromTDC);
166 const uint32_t
flag = triseFromTDC ? 1
U : 0
U;