Belle II Software  release-05-01-25
FullGridDriftLengthTrackTimeExtractor.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015-2016 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Tobias Schlüter, Thomas Hauth, Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/eventTimeExtraction/findlets/FullGridDriftLengthTrackTimeExtractor.h>
11 #include <tracking/eventTimeExtraction/findlets/BaseEventTimeExtractor.icc.h>
12 #include <tracking/eventTimeExtraction/findlets/GridEventTimeExtractor.icc.h>
13 #include <tracking/eventTimeExtraction/findlets/IterativeEventTimeExtractor.icc.h>
14 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
15 #include <tracking/dataobjects/RecoTrack.h>
16 
17 #include <framework/core/ModuleParamList.templateDetails.h>
18 
19 using namespace Belle2;
20 using namespace TrackFindingCDC;
21 
23 
25 {
26  addProcessingSignalListener(&m_finalExtractor);
27  addProcessingSignalListener(&m_gridExtractor);
28 }
29 
31 void FullGridDriftLengthTrackTimeExtractor::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
32 {
33  m_gridExtractor.exposeParameters(moduleParamList, prefixed("Grid", prefix));
34  m_finalExtractor.exposeParameters(moduleParamList, prefixed("Refiner", prefix));
35 
36  moduleParamList->getParameter<unsigned int>("GridIterations").setDefaultValue(1);
37  moduleParamList->getParameter<bool>("RefinerUseLastEventT0").setDefaultValue(true);
38 }
39 
41 void FullGridDriftLengthTrackTimeExtractor::apply(std::vector<RecoTrack*>& recoTracks)
42 {
43  const auto& temporaryT0Extractions = m_eventT0->getTemporaryEventT0s(Const::CDC);
44  B2ASSERT("There should only be a single or none extraction at this stage!", temporaryT0Extractions.size() <= 1);
45 
46  if (temporaryT0Extractions.empty()) {
47  m_gridExtractor.apply(recoTracks);
48  // if neither the hit based nor the grid based extraction finds something, we can not do anything
49  if (not m_gridExtractor.wasSuccessful()) {
50  m_wasSuccessful = false;
51  return;
52  }
53  } else {
54  // Make sure to actually use the temporary hit based extraction result
55  m_eventT0->setEventT0(temporaryT0Extractions[0]);
56  }
57 
58  m_finalExtractor.apply(recoTracks);
59  m_wasSuccessful = m_finalExtractor.wasSuccessful();
60 
61  if (not wasSuccessful()) {
62  B2DEBUG(50, "Resetting the event t0 as the final extraction was not successful.");
63  resetEventT0();
64  }
65 }
Belle2::FullGridDriftLengthTrackTimeExtractor::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override final
Copy the parameters.
Definition: FullGridDriftLengthTrackTimeExtractor.cc:31
Belle2::ModuleParamList::getParameter
ModuleParam< T > & getParameter(const std::string &name) const
Returns a reference to a parameter.
Definition: ModuleParamList.templateDetails.h:90
Belle2::FullGridDriftLengthTrackTimeExtractor::apply
void apply(std::vector< RecoTrack * > &) override final
Timing extraction for this findlet.
Definition: FullGridDriftLengthTrackTimeExtractor.cc:41
Belle2::GridEventTimeExtractor
Generic findlet applying a certain time extractor multiple times.
Definition: GridEventTimeExtractor.dcl.h:37
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::FullGridDriftLengthTrackTimeExtractor::FullGridDriftLengthTrackTimeExtractor
FullGridDriftLengthTrackTimeExtractor()
Constructor.
Definition: FullGridDriftLengthTrackTimeExtractor.cc:24
Belle2::ModuleParamList
The Module parameter list class.
Definition: ModuleParamList.h:46