12 #include <tracking/eventTimeExtraction/findlets/IterativeEventTimeExtractor.dcl.h>
13 #include <tracking/eventTimeExtraction/findlets/BaseEventTimeExtractor.icc.h>
14 #include <tracking/eventTimeExtraction/utilities/TimeExtractionUtils.h>
15 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
16 #include <framework/core/ModuleParamList.h>
17 #include <framework/logging/Logger.h>
24 template <
class AFindlet>
27 Super::addProcessingSignalListener(&m_findlet);
30 template <
class AFindlet>
33 m_wasSuccessful =
false;
35 m_eventT0WithQuality.clear();
39 unsigned int iteration = 0;
40 for (; iteration < m_param_maxIterations; iteration++) {
42 m_findlet.apply(recoTracks);
44 bool breakLoop =
false;
45 if (m_findlet.wasSuccessful()) {
47 if (not m_eventT0WithQuality.empty()) {
48 const double deltaT0 = std::abs(m_eventT0->getEventT0() - m_eventT0WithQuality.back().eventT0);
49 if (deltaT0 < m_param_minimalDeltaT0 and iteration >= m_param_minIterations) {
54 }
else if (m_param_abortOnUnsuccessfulStep) {
55 B2DEBUG(50,
"Aborting because time extraction was not successful.");
64 if (not m_eventT0WithQuality.empty() and iteration != m_param_maxIterations) {
65 if (m_param_useLastEventT0) {
66 m_eventT0->addTemporaryEventT0(m_eventT0WithQuality.back());
67 m_eventT0->setEventT0(m_eventT0WithQuality.back());
70 const auto& bestEventT0 = std::max_element(m_eventT0WithQuality.begin(), m_eventT0WithQuality.end(),
71 [](
const auto & lhs,
const auto & rhs) {
72 return lhs.quality < rhs.quality;
74 m_eventT0->setEventT0(*bestEventT0);
76 m_wasSuccessful =
true;
80 template <
class AFindlet>
83 Super::exposeParameters(moduleParamList, prefix);
85 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix,
"maxIterations"),
86 m_param_maxIterations,
87 "How many iterations should be done maximally?",
88 m_param_maxIterations);
89 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix,
"minIterations"),
90 m_param_minIterations,
91 "How many iterations should be done minimally?",
92 m_param_minIterations);
93 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix,
"minimalDeltaT0"),
94 m_param_minimalDeltaT0,
95 "What is the final precision?",
96 m_param_minimalDeltaT0);
97 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix,
"useLastEventT0"),
98 m_param_useLastEventT0,
99 "Use the last event t0 instead of the best one.",
100 m_param_useLastEventT0);
101 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix,
"abortOnUnsuccessfulStep"),
102 m_param_abortOnUnsuccessfulStep,
103 "Abort on a single unsuccessful step. Otherwise, the success is defined by the last step",
104 m_param_abortOnUnsuccessfulStep);
106 m_findlet.exposeParameters(moduleParamList, TrackFindingCDC::prefixed(
"sub", prefix));