32 B2DEBUG(20,
"EventT0 object not created, cannot do EventT0 combination");
42 if (
m_eventT0->getTemporaryEventT0s().empty()) {
43 B2DEBUG(20,
"No temporary EventT0s available, can't chose the best one.");
52 B2DEBUG(20,
"EventT0 already based on SVD information, nothing to do.");
63 if (
m_eventT0->hasTemporaryEventT0(Const::SVD)) {
64 const auto& bestSVDT0 =
m_eventT0->getBestSVDTemporaryEventT0();
66 B2DEBUG(20,
"EventT0 is set to SVD EventT0.");
80 const auto& bestCDCT0 =
m_eventT0->getBestCDCTemporaryEventT0();
81 if ((*bestCDCT0).algorithm ==
"chi2") {
82 B2DEBUG(20,
"Using CDC chi2 EventT0.");
90 B2DEBUG(20,
"Current EventT0 is based on CDC, but it's not the chi2 value. Continue Search.");
96 const auto& bestECLT0 =
m_eventT0->getBestECLTemporaryEventT0();
97 const auto& cdcT0Candidates =
m_eventT0->getTemporaryEventT0s(Const::CDC);
98 const auto& hitBasedCDCT0Candidate = std::find_if(cdcT0Candidates.begin(), cdcT0Candidates.end(), [](
const auto & a) { return a.algorithm ==
"hit based";});
106 if (bestECLT0 and hitBasedCDCT0Candidate != cdcT0Candidates.end()) {
107 B2DEBUG(20,
"Combining ECL EventT0 and CDC hit based EventT0.");
117 }
else if (bestECLT0 and hitBasedCDCT0Candidate == cdcT0Candidates.end()) {
118 B2DEBUG(20,
"Using ECL EventT0, as CDC hit based EventT0 is not available.");
126 }
else if (hitBasedCDCT0Candidate != cdcT0Candidates.end() and not bestECLT0) {
127 B2DEBUG(20,
"Using CDC hit based EventT0, as ECL EventT0 is not available.");
128 m_eventT0->setEventT0(*hitBasedCDCT0Candidate);
136 B2DEBUG(20,
"There is no EventT0 from neither \n" \
137 " * the SVD based algorithm\n" \
138 " * the CDC based chi^2 algorithm\n" \
139 " * the CDC based hit-based algorithm\n" \
140 " * the ECL algorithm.\n" \
141 "Thus, no EventT0 value can be calculated.");
150 if (measurements.size() == 0) {
151 B2FATAL(
"Need at least one EvenT0 Measurement to do a sensible combination.");
154 double eventT0 = 0.0f;
155 double preFactor = 0.0f;
159 for (
auto const& meas : measurements) {
160 usedDetectorSet += meas.detectorSet;
161 const double oneOverUncertaintySquared = 1.0f / std::pow(meas.eventT0Uncertainty, 2.0);
162 eventT0 += meas.eventT0 * oneOverUncertaintySquared;
163 preFactor += oneOverUncertaintySquared;
166 eventT0 /= preFactor;
167 const auto eventT0unc = std::sqrt(1.0f / preFactor);