Belle II Software  release-05-01-25
AxialTrackFinderHough.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/findlets/combined/AxialTrackFinderHough.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 #include <framework/core/ModuleParamList.templateDetails.h>
18 #include <framework/core/ModuleParam.h>
19 
20 using namespace Belle2;
21 using namespace TrackFindingCDC;
22 
24  : Super()
25 {
30 
31  // Set default parameters of the hough spaces
33 
34  ModuleParamList moduleParamList;
35  const std::string prefix = "";
36  this->exposeParameters(&moduleParamList, prefix);
37 
38  // Setup the default parameters of the fine hough space
39  moduleParamList.getParameter<int>("fineGranularityLevel").setDefaultValue(12);
40  moduleParamList.getParameter<int>("fineSectorLevelSkip").setDefaultValue(2);
41  // moduleParamList.getParameter<std::vector<double>>("fineCurvBounds").setDefaultValue({ -0.018, 0.75});
42  moduleParamList.getParameter<std::vector<float>>("fineCurvBounds").setDefaultValue({{ -0.02, 0.14}});
43  moduleParamList.getParameter<int>("fineDiscretePhi0Width").setDefaultValue(19);
44  moduleParamList.getParameter<int>("fineDiscretePhi0Overlap").setDefaultValue(5);
45  moduleParamList.getParameter<int>("fineDiscreteCurvWidth").setDefaultValue(1);
46  moduleParamList.getParameter<int>("fineDiscreteCurvOverlap").setDefaultValue(-1);
47  moduleParamList.getParameter<std::vector<ParameterVariantMap>>("fineRelaxationSchedule")
48  .setDefaultValue(getDefaultFineRelaxationSchedule());
49 
50  // Setup the default parameters of the rough hough space
51  moduleParamList.getParameter<int>("roughGranularityLevel").setDefaultValue(10);
52  moduleParamList.getParameter<int>("roughSectorLevelSkip").setDefaultValue(0);
53  moduleParamList.getParameter<std::vector<float>>("roughCurvBounds").setDefaultValue({{ 0.0, 0.30}});
54  moduleParamList.getParameter<int>("roughDiscretePhi0Width").setDefaultValue(19);
55  moduleParamList.getParameter<int>("roughDiscretePhi0Overlap").setDefaultValue(5);
56  moduleParamList.getParameter<int>("roughDiscreteCurvWidth").setDefaultValue(1);
57  moduleParamList.getParameter<int>("roughDiscreteCurvOverlap").setDefaultValue(-1);
58  moduleParamList.getParameter<std::vector<ParameterVariantMap>>("roughRelaxationSchedule")
59  .setDefaultValue(getDefaultRoughRelaxationSchedule());
60 }
61 
63 {
64  return "Generates axial tracks from hits using several increasingly relaxed hough space search over phi0 and curvature.";
65 }
66 
68  const std::string& prefix)
69 {
70  m_fineHoughSearch.exposeParameters(moduleParamList, prefixed("fine", prefix));
71  m_roughHoughSearch.exposeParameters(moduleParamList, prefixed("rough", prefix));
72  m_axialTrackHitMigrator.exposeParameters(moduleParamList, prefix);
73  m_axialTrackMerger.exposeParameters(moduleParamList, prefixed("merge", prefix));
74 }
75 
76 void AxialTrackFinderHough::apply(const std::vector<CDCWireHit>& wireHits,
77  std::vector<CDCTrack>& tracks)
78 {
79  // Acquire the axial hits
80  std::vector<const CDCWireHit*> axialWireHits;
81  axialWireHits.reserve(wireHits.size());
82  for (const CDCWireHit& wireHit : wireHits) {
83  wireHit->unsetTemporaryFlags();
84  wireHit->unsetMaskedFlag();
85  if (not wireHit.isAxial()) continue;
86  if (wireHit->hasBackgroundFlag()) continue;
87  axialWireHits.emplace_back(&wireHit);
88  }
89 
90  // Fine hough search
91  m_fineHoughSearch.apply(axialWireHits, tracks);
92 
93  // One step of migrating hits between the already found tracks
94  m_axialTrackHitMigrator.apply(axialWireHits, tracks);
95 
96  // Rough hough search
97  m_roughHoughSearch.apply(axialWireHits, tracks);
98 
99  // One step of migrating hits between the already found tracks
100  m_axialTrackHitMigrator.apply(axialWireHits, tracks);
101 
102  // Do track merging and finalization steps
103  m_axialTrackMerger.apply(tracks, axialWireHits);
104 
105  // Last step of migrating hits between the already found tracks
106  m_axialTrackHitMigrator.apply(axialWireHits, tracks);
107 
108 }
109 
110 std::vector<ParameterVariantMap>
112 {
113  std::vector<ParameterVariantMap> result;
114  // Relaxation schedule of the original hough implemenation
115  // Augmented by the road search parameters
116  // Note: distinction between integer and double literals is essential
117  // For the record: the setting seem a bit non-sensical, but work kind of well, experimentation needed.
118 
119  // NonCurler pass
120  result.push_back(ParameterVariantMap{
121  {"maxLevel", 10},
122  {"minWeight", 50.0},
123  {"maxCurv", 1.0 * 0.02},
124  {"curvResolution", std::string("origin")},
125  {"nRoadSearches", 1},
126  {"roadLevel", 1},
127  });
128 
129  result.push_back(ParameterVariantMap{
130  {"maxLevel", 10},
131  {"minWeight", 70.0},
132  {"maxCurv", 2.0 * 0.02},
133  {"curvResolution", std::string("origin")},
134  {"nRoadSearches", 1},
135  {"roadLevel", 1},
136  });
137 
138  for (double minWeight = 50.0; minWeight > 10.0; minWeight *= 0.75) {
139  result.push_back(ParameterVariantMap{
140  {"maxLevel", 10},
141  {"minWeight", minWeight},
142  {"maxCurv", 0.07},
143  {"curvResolution", std::string("origin")},
144  {"nRoadSearches", 1},
145  {"roadLevel", 1},
146  });
147  }
148 
149  // NonCurlerWithIncreasedThreshold pass
150  result.push_back(ParameterVariantMap{
151  {"maxLevel", 8},
152  {"minWeight", 50.0},
153  {"maxCurv", 1.0 * 0.02},
154  {"curvResolution", std::string("nonOrigin")},
155  {"nRoadSearches", 2},
156  {"roadLevel", 1},
157  });
158 
159  result.push_back(ParameterVariantMap{
160  {"maxLevel", 8},
161  {"minWeight", 70.0},
162  {"maxCurv", 2.0 * 0.02},
163  {"curvResolution", std::string("nonOrigin")},
164  {"nRoadSearches", 2},
165  {"roadLevel", 1},
166  });
167 
168  result.push_back(ParameterVariantMap{
169  {"maxLevel", 8},
170  {"minWeight", 50.0},
171  {"maxCurv", 0.07},
172  {"curvResolution", std::string("nonOrigin")},
173  {"nRoadSearches", 2},
174  {"roadLevel", 1},
175  });
176 
177  for (double minWeight = 37.5; minWeight > 10.0; minWeight *= 0.75) {
178  result.push_back(ParameterVariantMap{
179  {"maxLevel", 8},
180  {"minWeight", minWeight},
181  {"maxCurv", m_maxCurvAcceptance},
182  {"curvResolution", std::string("nonOrigin")},
183  {"nRoadSearches", 2},
184  {"roadLevel", 1},
185  });
186  }
187 
188  return result;
189 }
190 
191 std::vector<ParameterVariantMap>
193 {
194  std::vector<ParameterVariantMap> result;
195 
196  // FullRange pass
197  result.push_back(ParameterVariantMap{
198  {"maxLevel", 10},
199  {"minWeight", 50.0},
200  {"maxCurv", 1.0 * 0.02},
201  {"curvResolution", std::string("nonOrigin")},
202  {"nRoadSearches", 3},
203  {"roadLevel", 0},
204  });
205 
206  result.push_back(ParameterVariantMap{
207  {"maxLevel", 10},
208  {"minWeight", 70.0},
209  {"maxCurv", 2.0 * 0.02},
210  {"curvResolution", std::string("nonOrigin")},
211  {"nRoadSearches", 3},
212  {"roadLevel", 0},
213  });
214 
215  for (double minWeight = 30.0; minWeight > 10.0; minWeight *= 0.75) {
216  result.push_back(ParameterVariantMap{
217  {"maxLevel", 10},
218  {"minWeight", minWeight},
219  {"maxCurv", 0.15},
220  {"curvResolution", std::string("nonOrigin")},
221  {"nRoadSearches", 3},
222  {"roadLevel", 0},
223  });
224  }
225 
226  return result;
227 }
Belle2::TrackFindingCDC::AxialTrackCreatorHitHough::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Definition: AxialTrackCreatorHitHough.cc:64
Belle2::TrackFindingCDC::AxialTrackFinderHough::m_fineHoughSearch
AxialTrackCreatorHitHough m_fineHoughSearch
First hough search over a fine hough grid.
Definition: AxialTrackFinderHough.h:75
Belle2::TrackFindingCDC::AxialTrackFinderHough::getDefaultRoughRelaxationSchedule
std::vector< ParameterVariantMap > getDefaultRoughRelaxationSchedule() const
Get a series of parameters to be set for each pass over the rough hough space.
Definition: AxialTrackFinderHough.cc:192
Belle2::TrackFindingCDC::Findlet< const CDCWireHit, CDCTrack >
Belle2::ModuleParamList::getParameter
ModuleParam< T > & getParameter(const std::string &name) const
Returns a reference to a parameter.
Definition: ModuleParamList.templateDetails.h:90
Belle2::TrackFindingCDC::AxialTrackMerger::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Definition: AxialTrackMerger.cc:34
Belle2::TrackFindingCDC::AxialTrackFinderHough::AxialTrackFinderHough
AxialTrackFinderHough()
Constructor.
Definition: AxialTrackFinderHough.cc:23
Belle2::TrackFindingCDC::CompositeProcessingSignalListener::addProcessingSignalListener
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
Definition: CompositeProcessingSignalListener.cc:57
Belle2::TrackFindingCDC::AxialTrackHitMigrator::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Definition: AxialTrackHitMigrator.cc:30
Belle2::TrackFindingCDC::AxialTrackFinderHough::m_axialTrackHitMigrator
AxialTrackHitMigrator m_axialTrackHitMigrator
Findlet to exchange hits between tracks based on their proximity to the respective trajectory.
Definition: AxialTrackFinderHough.h:81
Belle2::TrackFindingCDC::AxialTrackFinderHough::m_axialTrackMerger
AxialTrackMerger m_axialTrackMerger
Findlet to merge the tracks after the hough finder.
Definition: AxialTrackFinderHough.h:84
Belle2::TrackFindingCDC::AxialTrackFinderHough::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Definition: AxialTrackFinderHough.cc:67
Belle2::TrackFindingCDC::AxialTrackHitMigrator::apply
void apply(const std::vector< const CDCWireHit * > &axialWireHits, std::vector< CDCTrack > &axialTracks) final
Do the hit migration.
Definition: AxialTrackHitMigrator.cc:44
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::AxialTrackFinderHough::m_maxCurvAcceptance
const double m_maxCurvAcceptance
Maximal curvature acceptance of the CDC.
Definition: AxialTrackFinderHough.h:71
Belle2::TrackFindingCDC::AxialTrackFinderHough::getDefaultFineRelaxationSchedule
std::vector< ParameterVariantMap > getDefaultFineRelaxationSchedule() const
Get a series of parameters to be set for each pass over the fine hough space.
Definition: AxialTrackFinderHough.cc:111
Belle2::TrackFindingCDC::CDCWireHit
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:65
Belle2::ModuleParamList
The Module parameter list class.
Definition: ModuleParamList.h:46
Belle2::TrackFindingCDC::AxialTrackFinderHough::m_roughHoughSearch
AxialTrackCreatorHitHough m_roughHoughSearch
Second hough search over a fine hough grid.
Definition: AxialTrackFinderHough.h:78
Belle2::TrackFindingCDC::AxialTrackCreatorHitHough::apply
void apply(const std::vector< const CDCWireHit * > &axialWireHits, std::vector< CDCTrack > &tracks) final
Generates the tracks from the given segments into the output argument.
Definition: AxialTrackCreatorHitHough.cc:151
Belle2::TrackFindingCDC::AxialTrackFinderHough::getDescription
std::string getDescription() final
Short description of the findlet.
Definition: AxialTrackFinderHough.cc:62
Belle2::TrackFindingCDC::AxialTrackFinderHough::apply
void apply(const std::vector< CDCWireHit > &wireHits, std::vector< CDCTrack > &tracks) final
Generates the tracks from the given segments into the output argument.
Definition: AxialTrackFinderHough.cc:76
Belle2::TrackFindingCDC::AxialTrackMerger::apply
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.
Definition: AxialTrackMerger.cc:43