Belle II Software development
CKFToSVDFindlet.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/CKFToSVDFindlet.h>
10
11#include <tracking/ckf/general/findlets/SpacePointTagger.icc.h>
12#include <tracking/ckf/general/findlets/StateCreatorWithReversal.icc.h>
13#include <tracking/ckf/general/findlets/StateCreator.icc.h>
14#include <tracking/ckf/general/findlets/CKFRelationCreator.icc.h>
15#include <tracking/ckf/general/findlets/TreeSearcher.icc.h>
16#include <tracking/ckf/general/findlets/OverlapResolver.icc.h>
17#include <tracking/ckf/general/findlets/StateRejecter.icc.h>
18#include <tracking/ckf/general/findlets/ResultStorer.icc.h>
19#include <tracking/ckf/general/utilities/Helpers.h>
20
21#include <tracking/trackFindingCDC/filters/base/ChooseableFilter.icc.h>
22#include <tracking/ckf/svd/filters/relations/LayerSVDRelationFilter.icc.h>
23
24#include <framework/core/ModuleParamList.h>
25
26using namespace Belle2;
27using namespace TrackFindingCDC;
28
30
32{
42}
43
44void CKFToSVDFindlet::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
45{
46 Super::exposeParameters(moduleParamList, prefix);
47
48 m_dataHandler.exposeParameters(moduleParamList, prefix);
49 m_hitsLoader.exposeParameters(moduleParamList, prefix);
50 m_stateCreatorFromTracks.exposeParameters(moduleParamList, prefix);
51 m_stateCreatorFromHits.exposeParameters(moduleParamList, prefix);
52 m_relationCreator.exposeParameters(moduleParamList, prefix);
53 m_treeSearchFindlet.exposeParameters(moduleParamList, prefix);
54 m_overlapResolver.exposeParameters(moduleParamList, prefix);
55 m_spacePointTagger.exposeParameters(moduleParamList, prefix);
56 m_resultStorer.exposeParameters(moduleParamList, prefix);
57
58 moduleParamList->addParameter("minimalHitRequirement", m_param_minimalHitRequirement,
59 "Minimal Hit requirement for the results (counted in space points)",
61
62 moduleParamList->getParameter<std::string>("firstHighFilter").setDefaultValue("mva_with_direction_check");
63 moduleParamList->getParameter<std::string>("advanceHighFilter").setDefaultValue("advance");
64 moduleParamList->getParameter<std::string>("secondHighFilter").setDefaultValue("mva");
65 moduleParamList->getParameter<std::string>("updateHighFilter").setDefaultValue("fit");
66 moduleParamList->getParameter<std::string>("thirdHighFilter").setDefaultValue("mva");
67
68 moduleParamList->getParameter<std::string>("filter").setDefaultValue("mva");
69
70 moduleParamList->getParameter<std::string>("hitFilter").setDefaultValue("sensor");
71 moduleParamList->getParameter<std::string>("seedFilter").setDefaultValue("all");
72 moduleParamList->getParameter<std::string>("preSeedFilter").setDefaultValue("loose");
73 moduleParamList->getParameter<std::string>("preHitFilter").setDefaultValue("loose");
74
75 moduleParamList->getParameter<std::string>("hitsSpacePointsStoreArrayName").setDefaultValue("SVDSpacePoints");
76
77 moduleParamList->getParameter<bool>("useAssignedHits").setDefaultValue(false);
78}
79
81{
83
84 // If the capacity of a std::vector is very large without being used, it just allocates RAM for no reason, increasing the RAM
85 // usage unnecessarily. In this case, start with a fresh one.
86 // Since std::vector.shrink() or std::vector.shrink_to_fit() not necessarily reduce the capacity in the desired way, create a
87 // temporary vector of the same type, swap them to use the vector at the new location afterwards, and clear the tempoary vector.
89 checkResizeClear<const SpacePoint*>(m_spacePointVector, 40000);
90
91 m_seedStates.clear();
92 checkResizeClear<CKFToSVDState>(m_states, 40000);
93
94 checkResizeClear<TrackFindingCDC::WeightedRelation<CKFToSVDState>>(m_relations, 100000);
95
96 m_results.clear();
97 m_filteredResults.clear();
98}
99
101{
104
105 B2DEBUG(29, "Now have " << m_spacePointVector.size() << " hits.");
106
107 if (m_spacePointVector.empty() or m_cdcRecoTrackVector.empty()) {
108 return;
109 }
110
114
115 B2DEBUG(29, "Created " << m_relations.size() << " relations.");
117
118 B2DEBUG(29, "Having found " << m_results.size() << " results before overlap check");
119
120 const auto hasLowHitNumber = [this](const CKFResult<RecoTrack, SpacePoint>& result) {
121 return result.getHits().size() < m_param_minimalHitRequirement;
122 };
123 TrackFindingCDC::erase_remove_if(m_results, hasLowHitNumber);
124
126
127 B2DEBUG(29, "Having found " << m_filteredResults.size() << " results");
128
131}
Object for temporary storage of a CKF tree search result.
Definition: CKFResult.h:30
std::vector< CKFToSVDResult > m_filteredResults
Vector for storing the filtered results.
unsigned int m_param_minimalHitRequirement
Minimal hit requirement for the results (counted in number of space points)
ResultStorer< CKFToSVDResult > m_resultStorer
Findlet for storing the results.
SpacePointTagger< CKFToSVDResult, SVDCluster > m_spacePointTagger
Findlet for tagging the used space points.
std::vector< CKFToSVDState > m_states
States for the hits.
TrackLoader m_dataHandler
Findlet for retrieving the cdc tracks and writing the result out.
std::vector< const SpacePoint * > m_spacePointVector
Pointers to the (const) SpacePoints as a vector.
TreeSearcher< CKFToSVDState, SVDStateRejecter, CKFToSVDResult > m_treeSearchFindlet
Findlet doing the main work: the tree finding.
StateCreatorWithReversal< CKFToSVDState > m_stateCreatorFromTracks
Findlet for creating states out of tracks.
~CKFToSVDFindlet() override
Default destructor.
SpacePointLoader m_hitsLoader
Findlet for loading the space points.
std::vector< RecoTrack * > m_cdcRecoTrackVector
Pointers to the CDC Reco tracks as a vector.
OverlapResolver< ChooseableSVDResultFilter > m_overlapResolver
Findlet for resolving overlaps.
std::vector< CKFToSVDResult > m_results
Vector for storing the results.
CKFRelationCreator< CKFToSVDState, ChooseableSVDRelationFilter > m_relationCreator
Findlet for creating relations between states.
void beginEvent() override
Clear the object pools.
std::vector< CKFToSVDState > m_seedStates
States for the tracks.
CKFToSVDFindlet()
Constructor, for setting module description and parameters.
StateCreator< const SpacePoint, CKFToSVDState > m_stateCreatorFromHits
Findlet for creating states out of hits.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
void apply() override
Do the track/hit finding/merging.
std::vector< TrackFindingCDC::WeightedRelation< CKFToSVDState > > m_relations
Relations between states.
The Module parameter list class.
void apply(std::vector< const SpacePoint * > &spacePoints) final
Do the space point retrieval.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
void beginEvent() override
Receive and dispatch signal for the start of a new event.
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Forward prefixed parameters of this findlet to the module parameter list.
Definition: Findlet.h:69
void apply(std::vector< RecoTrack * > &seeds) override
Load in the reco tracks and the hits.
Definition: TrackLoader.cc:68
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
Definition: TrackLoader.cc:24
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.