Belle II Software  release-08-01-10
CKFToSVDSeedFindlet.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 
9 #include <tracking/ckf/svd/findlets/CKFToSVDSeedFindlet.h>
10 
11 #include <tracking/ckf/general/findlets/StateCreator.icc.h>
12 #include <tracking/ckf/general/findlets/TreeSearcher.icc.h>
13 #include <tracking/ckf/general/findlets/StateRejecter.icc.h>
14 #include <tracking/ckf/general/findlets/StateCreatorWithReversal.icc.h>
15 
16 #include <tracking/trackFindingCDC/utilities/ParameterVariant.h>
17 
18 #include <framework/core/ModuleParamList.h>
19 
20 using namespace Belle2;
21 using namespace TrackFindingCDC;
22 
24 
26 {
27  addProcessingSignalListener(&m_dataHandler);
28  addProcessingSignalListener(&m_hitsLoader);
29  addProcessingSignalListener(&m_stateCreatorFromTracks);
30  addProcessingSignalListener(&m_stateCreatorFromHits);
31  addProcessingSignalListener(&m_relationCreator);
32  addProcessingSignalListener(&m_treeSearchFindlet);
33  addProcessingSignalListener(&m_recoTrackRelator);
34  addProcessingSignalListener(&m_bestMatchSelector);
35  addProcessingSignalListener(&m_relationApplier);
36 }
37 
38 void CKFToSVDSeedFindlet::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
39 {
40  Super::exposeParameters(moduleParamList, prefix);
41 
42  m_dataHandler.exposeParameters(moduleParamList, prefix);
43  m_hitsLoader.exposeParameters(moduleParamList, prefix);
44  m_stateCreatorFromTracks.exposeParameters(moduleParamList, prefix);
45  m_stateCreatorFromHits.exposeParameters(moduleParamList, prefix);
46  m_relationCreator.exposeParameters(moduleParamList, prefix);
47  m_treeSearchFindlet.exposeParameters(moduleParamList, prefix);
48  m_bestMatchSelector.exposeParameters(moduleParamList, prefix);
49  m_recoTrackRelator.exposeParameters(moduleParamList, prefix);
50  m_relationApplier.exposeParameters(moduleParamList, prefix);
51 
52  moduleParamList->addParameter("minimalHitRequirement", m_param_minimalHitRequirement,
53  "Minimal Hit requirement for the results (counted in space points)",
54  m_param_minimalHitRequirement);
55 
56  moduleParamList->getParameter<std::string>("firstHighFilter").setDefaultValue("non_ip_crossing");
57  moduleParamList->getParameter<std::string>("advanceHighFilter").setDefaultValue("advance");
58  moduleParamList->getParameter<std::string>("secondHighFilter").setDefaultValue("all");
59  moduleParamList->getParameter<std::string>("updateHighFilter").setDefaultValue("fit");
60  moduleParamList->getParameter<std::string>("thirdHighFilter").setDefaultValue("all");
61 
62  moduleParamList->getParameter<std::string>("hitsSpacePointsStoreArrayName").setDefaultValue("SVDSpacePoints");
63 
64  moduleParamList->getParameter<bool>("endEarly").setDefaultValue(false);
65 }
66 
68 {
69  Super::beginEvent();
70 
71  m_cdcRecoTrackVector.clear();
72  m_spacePointVector.clear();
73 
74  m_seedStates.clear();
75  m_states.clear();
76  m_relations.clear();
77 
78  m_results.clear();
79 
80  m_relationsCDCToSVD.clear();
81 }
82 
84 {
85  m_dataHandler.apply(m_cdcRecoTrackVector);
86  m_hitsLoader.apply(m_spacePointVector);
87 
88  if (m_spacePointVector.empty() or m_cdcRecoTrackVector.empty()) {
89  return;
90  }
91 
92  m_stateCreatorFromTracks.apply(m_cdcRecoTrackVector, m_seedStates);
93  m_stateCreatorFromHits.apply(m_spacePointVector, m_states);
94 
95  m_relationCreator.apply(m_seedStates, m_states, m_relations);
96  B2DEBUG(29, "Created " << m_relations.size() << " relations.");
97 
98  m_treeSearchFindlet.apply(m_seedStates, m_states, m_relations, m_results);
99  B2DEBUG(29, "Having found " << m_results.size() << " results before overlap check");
100 
101  const auto hasLowHitNumber = [this](const CKFResult<RecoTrack, SpacePoint>& result) {
102  return result.getHits().size() < m_param_minimalHitRequirement;
103  };
104  TrackFindingCDC::erase_remove_if(m_results, hasLowHitNumber);
105  B2DEBUG(29, "After filtering: Having found " << m_results.size() << " results before overlap check");
106 
107  m_recoTrackRelator.apply(m_results, m_relationsCDCToSVD);
108  m_bestMatchSelector.apply(m_relationsCDCToSVD);
109  m_relationApplier.apply(m_relationsCDCToSVD);
110 }
~CKFToSVDSeedFindlet()
Default desctructor.
CKFToSVDSeedFindlet()
Constructor, for setting module description and parameters.
void beginEvent() override
Clear the object pools.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters (also of the sub findlets).
void apply() override
Do the track merging.
The Module parameter list class.
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.
Abstract base class for different kinds of events.