Belle II Software  release-08-01-10
FullGridDriftLengthTrackTimeExtractor.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/FullGridDriftLengthTrackTimeExtractor.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 
15 #include <framework/core/ModuleParamList.templateDetails.h>
16 
17 using namespace Belle2;
18 using namespace TrackFindingCDC;
19 
21 
23 {
24  addProcessingSignalListener(&m_finalExtractor);
25  addProcessingSignalListener(&m_gridExtractor);
26 }
27 
29 void FullGridDriftLengthTrackTimeExtractor::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
30 {
31  m_gridExtractor.exposeParameters(moduleParamList, prefixed("Grid", prefix));
32  m_finalExtractor.exposeParameters(moduleParamList, prefixed("Refiner", prefix));
33 
34  moduleParamList->getParameter<unsigned int>("GridIterations").setDefaultValue(1);
35  moduleParamList->getParameter<bool>("RefinerUseLastEventT0").setDefaultValue(true);
36 }
37 
39 void FullGridDriftLengthTrackTimeExtractor::apply(std::vector<RecoTrack*>& recoTracks)
40 {
41  const auto& temporaryT0Extractions = m_eventT0->getTemporaryEventT0s(Const::CDC);
42  B2ASSERT("There should only be a single or none extraction at this stage!", temporaryT0Extractions.size() <= 1);
43 
44  if (temporaryT0Extractions.empty()) {
45  m_gridExtractor.apply(recoTracks);
46  // if neither the hit based nor the grid based extraction finds something, we can not do anything
47  if (not m_gridExtractor.wasSuccessful()) {
48  m_wasSuccessful = false;
49  return;
50  }
51  } else {
52  // Make sure to actually use the temporary hit based extraction result
53  m_eventT0->setEventT0(temporaryT0Extractions[0]);
54  }
55 
56  m_finalExtractor.apply(recoTracks);
57  m_wasSuccessful = m_finalExtractor.wasSuccessful();
58 
59  if (not wasSuccessful()) {
60  B2DEBUG(25, "Resetting the event t0 as the final extraction was not successful.");
61  resetEventT0();
62  }
63 }
void apply(std::vector< RecoTrack * > &) override final
Timing extraction for this findlet.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override final
Copy the parameters.
Generic findlet applying a certain time extractor multiple times.
The Module parameter list class.
ModuleParam< T > & getParameter(const std::string &name) const
Returns a reference to a parameter.
Abstract base class for different kinds of events.