34 B2DEBUG(20,
"EventT0 object not created, cannot do EventT0 combination");
44 if (
m_eventT0->getTemporaryEventT0s().empty()) {
45 B2DEBUG(20,
"No temporary EventT0s available, can't chose the best one.");
54 B2DEBUG(20,
"EventT0 already based on SVD information, nothing to do.");
65 if (
m_eventT0->hasTemporaryEventT0(Const::SVD)) {
66 const auto& bestSVDT0 =
m_eventT0->getBestSVDTemporaryEventT0();
68 B2DEBUG(20,
"EventT0 is set to SVD EventT0.");
82 const auto& bestCDCT0 =
m_eventT0->getBestCDCTemporaryEventT0();
83 if ((*bestCDCT0).algorithm ==
"chi2") {
84 B2DEBUG(20,
"Using CDC chi2 EventT0.");
92 B2DEBUG(20,
"Current EventT0 is based on CDC, but it's not the chi2 value. Continue Search.");
98 const auto& bestECLT0 =
m_eventT0->getBestECLTemporaryEventT0();
99 const auto& cdcT0Candidates =
m_eventT0->getTemporaryEventT0s(Const::CDC);
100 const auto& hitBasedCDCT0Candidate = std::find_if(cdcT0Candidates.begin(), cdcT0Candidates.end(), [](
const auto & a) { return a.algorithm ==
"hit based";});
108 if (bestECLT0 and hitBasedCDCT0Candidate != cdcT0Candidates.end()) {
109 B2DEBUG(20,
"Combining ECL EventT0 and CDC hit based EventT0.");
119 }
else if (bestECLT0 and hitBasedCDCT0Candidate == cdcT0Candidates.end()) {
120 B2DEBUG(20,
"Using ECL EventT0, as CDC hit based EventT0 is not available.");
128 }
else if (hitBasedCDCT0Candidate != cdcT0Candidates.end() and not bestECLT0) {
129 B2DEBUG(20,
"Using CDC hit based EventT0, as ECL EventT0 is not available.");
130 m_eventT0->setEventT0(*hitBasedCDCT0Candidate);
138 B2DEBUG(20,
"There is no EventT0 from neither \n" \
139 " * the SVD based algorithm\n" \
140 " * the CDC based chi^2 algorithm\n" \
141 " * the CDC based hit-based algorithm\n" \
142 " * the ECL algorithm.\n" \
143 "Thus, no EventT0 value can be calculated.");
152 if (measurements.size() == 0) {
153 B2FATAL(
"Need at least one EvenT0 Measurement to do a sensible combination.");
156 double eventT0 = 0.0f;
157 double preFactor = 0.0f;
161 for (
auto const& meas : measurements) {
162 usedDetectorSet += meas.detectorSet;
163 const double oneOverUncertaintySquared = 1.0f / std::pow(meas.eventT0Uncertainty, 2.0);
164 eventT0 += meas.eventT0 * oneOverUncertaintySquared;
165 preFactor += oneOverUncertaintySquared;
168 eventT0 /= preFactor;
169 const auto eventT0unc = std::sqrt(1.0f / preFactor);