10#include <tracking/eventTimeExtraction/findlets/IterativeEventTimeExtractor.dcl.h>
11#include <tracking/eventTimeExtraction/findlets/BaseEventTimeExtractor.icc.h>
12#include <tracking/eventTimeExtraction/utilities/TimeExtractionUtils.h>
13#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
14#include <framework/core/ModuleParamList.h>
15#include <framework/logging/Logger.h>
22 template <
class AFindlet>
25 Super::addProcessingSignalListener(&m_findlet);
28 template <
class AFindlet>
31 m_wasSuccessful =
false;
33 m_eventT0WithQuality.clear();
37 unsigned int iteration = 0;
38 for (; iteration < m_param_maxIterations; iteration++) {
40 m_findlet.apply(recoTracks);
42 bool breakLoop =
false;
43 if (m_findlet.wasSuccessful()) {
45 if (not m_eventT0WithQuality.empty()) {
46 const double deltaT0 = std::abs(m_eventT0->getEventT0() - m_eventT0WithQuality.back().eventT0);
47 if (deltaT0 < m_param_minimalDeltaT0 and iteration >= m_param_minIterations) {
52 }
else if (m_param_abortOnUnsuccessfulStep) {
53 B2DEBUG(25,
"Aborting because time extraction was not successful.");
62 if (not m_eventT0WithQuality.empty() and iteration != m_param_maxIterations) {
63 if (m_param_useLastEventT0) {
64 m_eventT0->addTemporaryEventT0(m_eventT0WithQuality.back());
65 m_eventT0->setEventT0(m_eventT0WithQuality.back());
68 const auto& bestEventT0 = std::max_element(m_eventT0WithQuality.begin(), m_eventT0WithQuality.end(),
69 [](
const auto & lhs,
const auto & rhs) {
70 return lhs.quality < rhs.quality;
72 m_eventT0->setEventT0(*bestEventT0);
74 m_wasSuccessful =
true;
78 template <
class AFindlet>
81 Super::exposeParameters(moduleParamList, prefix);
83 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"maxIterations"),
84 m_param_maxIterations,
85 "How many iterations should be done maximally?",
86 m_param_maxIterations);
87 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"minIterations"),
88 m_param_minIterations,
89 "How many iterations should be done minimally?",
90 m_param_minIterations);
91 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"minimalDeltaT0"),
92 m_param_minimalDeltaT0,
93 "What is the final precision?",
94 m_param_minimalDeltaT0);
95 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"useLastEventT0"),
96 m_param_useLastEventT0,
97 "Use the last event t0 instead of the best one.",
98 m_param_useLastEventT0);
99 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"abortOnUnsuccessfulStep"),
100 m_param_abortOnUnsuccessfulStep,
101 "Abort on a single unsuccessful step. Otherwise, the success is defined by the last step",
102 m_param_abortOnUnsuccessfulStep);
104 m_findlet.exposeParameters(moduleParamList, TrackFindingCDC::prefixed(
"sub", prefix));
The Module parameter list class.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters.
IterativeEventTimeExtractor()
Add the subfindlet as listener.
void apply(std::vector< RecoTrack * > &recoTracks) override final
Timing extraction for this findlet.
Abstract base class for different kinds of events.