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