Belle II Software  release-08-01-10
TrackFinder.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/trackFindingCDC/findlets/complete/TrackFinder.h>
9 
10 #include <framework/core/ModuleParamList.templateDetails.h>
11 #include <framework/core/ModuleParam.h>
12 
13 #include <vector>
14 
15 using namespace Belle2;
16 using namespace TrackFindingCDC;
17 
19 {
23 
26 
29 
32 
36 
37  const std::string prefix = "";
38  // Setup m_wireHitPreparer
39  {
40  ModuleParamList moduleParamList;
41  m_wireHitPreparer.exposeParameters(&moduleParamList, prefix);
42 
43  moduleParamList.getParameter<std::string>("flightTimeEstimation").setDefaultValue("outwards");
44  }
45 
46  // Setup m_trackQualityAsserter
47  {
48  ModuleParamList moduleParamList;
49  m_trackQualityAsserter.exposeParameters(&moduleParamList, prefix);
50 
51  std::vector<std::string> corrections({"B2B"});
52  moduleParamList.getParameter<std::vector<std::string>>("corrections")
53  .setDefaultValue(corrections);
54  }
55 
56  // Setup m_finalTrackQualityAsserter
57  {
58  ModuleParamList moduleParamList;
59  m_finalTrackQualityAsserter.exposeParameters(&moduleParamList, prefix);
60 
61  std::vector<std::string> corrections({"LayerBreak", "OneSuperlayer", "Small"});
62  moduleParamList.getParameter<std::vector<std::string>>("corrections")
63  .setDefaultValue(corrections);
64  }
65 }
66 
68 {
69  return "Combined track finder using the global legendre finder as well as the cellular automaton "
70  "track finder.";
71 }
72 
73 void TrackFinder::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
74 {
75  // Expose a selection of the parameters
76  m_wireHitPreparer.exposeParameters(moduleParamList, prefix);
77  m_trackExporter.exposeParameters(moduleParamList, prefix);
78 
79  moduleParamList->addParameter("withCA",
81  "Also run the segment linking track finder and combine results.",
83 }
84 
86 {
87  // Reserve some space for the created objects.
88  std::vector<CDCWireHit> m_wireHits;
89  std::vector<CDCWireHitCluster> m_clusters;
90  std::vector<CDCWireHitCluster> m_superClusters;
91  std::vector<CDCSegment2D> m_segments;
92  std::vector<CDCTrack> m_axialTracks;
93  std::vector<CDCTrack> m_tracks;
94  m_wireHits.reserve(2000);
95  m_clusters.reserve(200);
96  m_superClusters.reserve(100);
97  m_segments.reserve(200);
98  m_axialTracks.reserve(30);
99  m_tracks.reserve(30);
100 
101  m_wireHitPreparer.apply(m_wireHits);
102  m_clusterPreparer.apply(m_wireHits, m_clusters, m_superClusters);
103  m_segmentFinderFacetAutomaton.apply(m_clusters, m_segments);
104 
105  m_axialTrackFinderLegendre.apply(m_wireHits, m_axialTracks);
106  m_trackQualityAsserter.apply(m_axialTracks);
107 
108  m_stereoHitFinder.apply(m_wireHits, m_axialTracks);
109  m_segmentTrackCombiner.apply(m_segments, m_axialTracks);
110 
111  if (m_param_withCA) {
112  m_trackFinderSegmentPairAutomaton.apply(m_segments, m_tracks);
113  m_trackCombiner.apply(m_axialTracks, m_tracks, m_tracks);
114  } else {
115  m_tracks.swap(m_axialTracks);
116  }
117 
119 
120  if (m_param_withCA) {
121  m_trackCreatorSingleSegments.apply(m_segments, m_tracks);
122  }
123 
124  m_trackExporter.apply(m_tracks);
125 }
The Module parameter list class.
void apply(const std::vector< CDCWireHit > &wireHits, std::vector< CDCTrack > &tracks)
Main method to apply the track finding.
void apply(std::vector< CDCWireHit > &inputWireHits, std::vector< CDCWireHitCluster > &clusters, std::vector< CDCWireHitCluster > &superClusters) final
Generates the segment from wire hits.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
void apply(std::vector< CDCWireHitCluster > &clusters, std::vector< CDCSegment2D > &outputSegments) final
Generates the segment from wire hits.
void apply(std::vector< CDCSegment2D > &segments, std::vector< CDCTrack > &tracks) override
Try to combine the segments and the tracks.
void apply(std::vector< CDCWireHit > &inputWireHits, std::vector< CDCTrack > &tracks) final
Generates the segment from wire hits.
void apply(const std::vector< CDCTrack > &inputTracks, const std::vector< CDCTrack > &secondInputTracks, std::vector< CDCTrack > &tracks) final
Main algorithm.
void apply(const std::vector< CDCSegment2D > &segments, std::vector< CDCTrack > &tracks) final
Main algorithm.
void apply(std::vector< CDCTrack > &tracks) final
Write give tracks into track store array.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
void apply(const std::vector< CDCSegment2D > &inputSegments, std::vector< CDCTrack > &tracks) final
Generates the tracks from segments.
SegmentFinderFacetAutomaton m_segmentFinderFacetAutomaton
First stage cellular automaton segment finder.
Definition: TrackFinder.h:67
TrackExporter m_trackExporter
Exports the generated CDCTracks as RecoTracks.
Definition: TrackFinder.h:94
TrackFinder()
Constructor registering the subordinary findlets to the processing signal distribution machinery.
Definition: TrackFinder.cc:18
WireHitPreparer m_wireHitPreparer
Preparation findlet creating the wire hits from the packed CDCHits.
Definition: TrackFinder.h:61
SegmentTrackCombiner m_segmentTrackCombiner
Join the matching segments into the tracks.
Definition: TrackFinder.h:79
std::string getDescription() override
Short description of the findlet.
Definition: TrackFinder.cc:67
TrackCreatorSingleSegments m_trackCreatorSingleSegments
Add tracks from the first super layer that are contained with in the first super layer.
Definition: TrackFinder.h:91
AxialTrackFinderLegendre m_axialTrackFinderLegendre
Axial track finder.
Definition: TrackFinder.h:70
TrackCombiner m_trackCombiner
Combine the tracks from the global search with the tracks from the local search.
Definition: TrackFinder.h:85
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Definition: TrackFinder.cc:73
TrackFinderSegmentPairAutomaton m_trackFinderSegmentPairAutomaton
Second stage cellular automaton track finder from segments.
Definition: TrackFinder.h:82
TrackQualityAsserter m_trackQualityAsserter
Improve the quality of the axial tracks.
Definition: TrackFinder.h:73
void apply() final
Execute the findlet.
Definition: TrackFinder.cc:85
ClusterPreparer m_clusterPreparer
Preparation findlet creating the clusters wire hits forming locally connected groups.
Definition: TrackFinder.h:64
bool m_param_withCA
Parameter: Activate the combination of the local segment linking.
Definition: TrackFinder.h:56
TrackQualityAsserter m_finalTrackQualityAsserter
Final track quality assertions.
Definition: TrackFinder.h:88
StereoHitFinder m_stereoHitFinder
Assoziate the stereo hits that best match to the axial tracks.
Definition: TrackFinder.h:76
void apply(std::vector< CDCTrack > &tracks) final
Main function to clean up the tracks.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
void apply(std::vector< CDCWireHit > &outputWireHits) final
Main function preparing the wire hits.
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.