Belle II Software development
FullGridChi2TrackTimeExtractor.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <tracking/eventTimeExtraction/findlets/FullGridChi2TrackTimeExtractor.h>
9#include <tracking/eventTimeExtraction/findlets/BaseEventTimeExtractor.icc.h>
10#include <tracking/eventTimeExtraction/findlets/GridEventTimeExtractor.icc.h>
11#include <tracking/eventTimeExtraction/findlets/IterativeEventTimeExtractor.icc.h>
12#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
13#include <tracking/dataobjects/RecoTrack.h>
14#include <framework/core/ModuleParamList.templateDetails.h>
15
16using namespace Belle2;
17using namespace TrackFindingCDC;
18
20
22{
25}
26
28void FullGridChi2TrackTimeExtractor::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
29{
30 m_gridExtractor.exposeParameters(moduleParamList, prefixed("Grid", prefix));
31 m_finalExtractor.exposeParameters(moduleParamList, prefixed("Refiner", prefix));
32
33 moduleParamList->getParameter<unsigned int>("GridIterations").setDefaultValue(1);
34 moduleParamList->getParameter<bool>("RefinerUseLastEventT0").setDefaultValue(true);
35
36 moduleParamList->addParameter(prefixed(prefix, "skipIfSVDEventT0Present"),
38 "Skip execution of the time consuming FullGridChi2 algorithm if a valid SVD based EventT0 estimate is present. " \
39 "If set to true, this module is only used to get an CDC based EventT0 in the few events where no sufficient SVD information is available to estimate EventT0.",
41}
42
44void FullGridChi2TrackTimeExtractor::apply(std::vector<RecoTrack*>& recoTracks)
45{
46 // Don't execute this time consuming algorithm if a valid SVD based EventT0 estimate is present
47 if (m_skipIfSVDEventT0Present and m_eventT0->hasTemporaryEventT0(Const::EDetector::SVD)) {
48 return;
49 }
50
51 const auto& temporaryT0Extractions = m_eventT0->getTemporaryEventT0s(Const::CDC);
52 B2ASSERT("There should only be a single or none extraction at this stage!", temporaryT0Extractions.size() <= 1);
53
54 if (temporaryT0Extractions.empty()) {
55 m_gridExtractor.apply(recoTracks);
56 // if neither the hit based nor the grid based extraction finds something, we can not do anything
57 if (not m_gridExtractor.wasSuccessful()) {
58 m_wasSuccessful = false;
59 return;
60 }
61 } else {
62 // Make sure to actually use the temporary hit based extraction result
63 m_eventT0->setEventT0(temporaryT0Extractions[0]);
64 }
65
66 m_finalExtractor.apply(recoTracks);
68
69 if (not wasSuccessful()) {
70 B2DEBUG(25, "Resetting the event t0 as the final extraction was not successful.");
72 }
73}
StoreObjPtr< EventT0 > m_eventT0
Pointer to the storage of the eventwise T0 estimation in the data store.
bool m_wasSuccessful
Variable to show that the execution was successful.
IterativeChi2BasedEventTimeExtractor m_finalExtractor
Refining extractor in the end.
void apply(std::vector< RecoTrack * > &) override final
Timing extraction for this findlet.
bool m_skipIfSVDEventT0Present
Skip FullGrid EventT0 extraction if SVD EventT0 is present.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override final
Copy the parameters.
GridEventTimeExtractor< Chi2BasedEventTimeExtractor > m_gridExtractor
Slow grid based extractor.
Generic findlet applying a certain time extractor multiple times.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override final
Expose our parameters to the super module.
The Module parameter list class.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
ModuleParam< T > & getParameter(const std::string &name) const
Returns a reference to a parameter.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
void apply(std::vector< RecoTrack * > &recoTracks) override final
Timing extraction for this findlet.
bool wasSuccessful() const
Returns true if the last run t0 extraction was successful.
void resetEventT0() const
Reset the t0 value to cached value if it exists or clear it otherwise.
Abstract base class for different kinds of events.