Belle II Software  release-08-01-10
AxialTrackFinderLegendre.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/combined/AxialTrackFinderLegendre.h>
9 
10 #include <tracking/trackFindingCDC/processing/AxialTrackUtil.h>
11 
12 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
13 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
14 
15 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
16 
17 using namespace Belle2;
18 using namespace TrackFindingCDC;
19 
21 {
27 }
28 
30 {
31  return "Performs the pattern recognition in the CDC with the legendre hough finder";
32 }
33 
35  const std::string& prefix)
36 {
37  m_axialTrackHitMigrator.exposeParameters(moduleParamList, prefix);
38  m_axialTrackMerger.exposeParameters(moduleParamList, prefixed("merge", prefix));
39  // No parameters exposed for the legendre passes
40 }
41 
42 void AxialTrackFinderLegendre::apply(const std::vector<CDCWireHit>& wireHits,
43  std::vector<CDCTrack>& tracks)
44 {
45  B2DEBUG(25, "********** CDCTrackingModule ************");
46 
47  // Acquire the axial hits
48  std::vector<const CDCWireHit*> axialWireHits;
49  axialWireHits.reserve(wireHits.size());
50  for (const CDCWireHit& wireHit : wireHits) {
51  wireHit->unsetTemporaryFlags();
52  wireHit->unsetMaskedFlag();
53  if (not wireHit.isAxial()) continue;
54  if (wireHit->hasBackgroundFlag()) continue;
55  axialWireHits.emplace_back(&wireHit);
56  }
57 
58  // First legendre pass
59  m_nonCurlerAxialTrackCreatorHitLegendre.apply(axialWireHits, tracks);
60 
61  // Assign new hits to the tracks
62  m_axialTrackHitMigrator.apply(axialWireHits, tracks);
63 
64  // Second legendre pass
66 
67  // Assign new hits to the tracks
68  m_axialTrackHitMigrator.apply(axialWireHits, tracks);
69 
70  // Iterate the last finding pass until no track is found anymore
71 
72  // Loop counter to guard against infinit loop
73  for (int iPass = 0; iPass < 20; ++iPass) {
74  int nCandsAdded = tracks.size();
75 
76  // Third legendre pass
77  m_fullRangeAxialTrackCreatorHitLegendre.apply(axialWireHits, tracks);
78 
79  // Assign new hits to the tracks
80  m_axialTrackHitMigrator.apply(axialWireHits, tracks);
81 
82  nCandsAdded = tracks.size() - nCandsAdded;
83 
84  if (iPass == 19) B2WARNING("Reached maximal number of legendre search passes");
85  if (nCandsAdded == 0) break;
86  }
87 
88  // Merge found tracks
89  m_axialTrackMerger.apply(tracks, axialWireHits);
90 
91  // Assign new hits to the tracks
92  m_axialTrackHitMigrator.apply(axialWireHits, tracks);
93 
95 }
The Module parameter list class.
void apply(const std::vector< const CDCWireHit * > &axialWireHits, std::vector< CDCTrack > &tracks) final
Execute one pass over a quad tree.
AxialTrackCreatorHitLegendre m_fullRangeAxialTrackCreatorHitLegendre
Findlet for the full range legendre pass.
AxialTrackCreatorHitLegendre m_nonCurlerAxialTrackCreatorHitLegendre
Findlet for the non-curler legendre pass.
std::string getDescription() final
Short description of the findlet.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
AxialTrackCreatorHitLegendre m_nonCurlersWithIncreasingThresholdAxialTrackCreatorHitLegendre
Findlet for the non-curler with increased threshold legendre pass.
AxialTrackMerger m_axialTrackMerger
Findlet to merge the tracks after the legendre finder.
AxialTrackHitMigrator m_axialTrackHitMigrator
Findlet to exchange hits between tracks based on their proximity to the respective trajectory.
void apply(const std::vector< CDCWireHit > &wireHits, std::vector< CDCTrack > &tracks)
Main method to apply the track finding.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
void apply(const std::vector< const CDCWireHit * > &axialWireHits, std::vector< CDCTrack > &axialTracks) final
Do the hit migration.
void apply(std::vector< CDCTrack > &axialTracks, const std::vector< const CDCWireHit * > &axialWireHits) final
Merge tracks together. Allows for axial hits to be added as it may see fit.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:55
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
Abstract base class for different kinds of events.
static void deleteShortTracks(std::vector< CDCTrack > &axialTracks, double minimal_size=5)
Remove tracks that are shorter than the given number of hits.