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