10#include <tracking/eventTimeExtraction/findlets/GridEventTimeExtractor.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 const double eventT0Delta = (m_param_maximalT0Value - m_param_minimalT0Value) /
static_cast<double>(m_param_gridSteps);
39 for (
unsigned int gridIndex = 0; gridIndex <= m_param_gridSteps; gridIndex++) {
40 const double eventT0Hypothesis = eventT0Delta *
static_cast<double>(gridIndex) + m_param_minimalT0Value;
45 for (
unsigned int iteration = 0; iteration < m_param_iterations; iteration++) {
47 m_findlet.apply(recoTracks);
49 if (m_findlet.wasSuccessful()) {
51 }
else if (m_param_abortOnUnsuccessfulStep) {
52 B2DEBUG(25,
"Aborting because time extraction was not successful.");
58 if (not m_eventT0WithQuality.empty()) {
59 m_wasSuccessful =
true;
61 const auto& bestChi2 = std::max_element(m_eventT0WithQuality.begin(), m_eventT0WithQuality.end(),
62 [](
const auto & lhs,
const auto & rhs) {
63 return lhs.quality < rhs.quality;
65 m_eventT0->setEventT0(*bestChi2);
72 template <
class AFindlet>
75 Super::exposeParameters(moduleParamList, prefix);
77 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"iterations"),
79 "How many iterations should be done?",
81 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"abortOnUnsuccessfulStep"),
82 m_param_abortOnUnsuccessfulStep,
83 "Abort on a single unsuccessful step. Otherwise, the success is defined by the last step",
84 m_param_abortOnUnsuccessfulStep);
85 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"maximalT0Value"),
86 m_param_maximalT0Value,
87 "Maximal Grid Value of the T0 extraction",
88 m_param_maximalT0Value);
89 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"minimalT0Value"),
90 m_param_minimalT0Value,
91 "Maximal Grid Value of the T0 extraction",
92 m_param_minimalT0Value);
93 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"gridSteps"),
95 "Number of steps in the grid",
98 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.
GridEventTimeExtractor()
Add the subfindlet as listener.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override final
Expose the parameters.
void apply(std::vector< RecoTrack * > &recoTracks) override final
Timing extraction for this findlet.
Abstract base class for different kinds of events.
Structure for storing the extracted event t0s together with its detector and its uncertainty.