10 #include <tracking/trackFindingCDC/findlets/minimal/AxialTrackCreatorHitHough.h>
12 #include <tracking/trackFindingCDC/hough/perigee/AxialLegendreLeafProcessor.h>
13 #include <tracking/trackFindingCDC/hough/perigee/AxialLegendreLeafProcessor.icc.h>
14 #include <tracking/trackFindingCDC/hough/perigee/StandardBinSpec.h>
16 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
17 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
19 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
21 #include <framework/core/ModuleParamList.templateDetails.h>
24 using namespace TrackFindingCDC;
28 void saveBounds(std::vector<float> bounds,
const std::string& fileName)
30 std::ofstream boundsFile;
31 boundsFile.open(fileName);
32 for (
float bound : bounds) {
39 std::vector<float> loadBounds(
const std::string& fileName)
41 std::vector<float> bounds;
42 std::ifstream boundsFile;
43 std::string boundLine;
44 boundsFile.open(fileName);
45 if (boundsFile.is_open()) {
46 while (std::getline(boundsFile, boundLine)) {
47 float bound = stof(boundLine);
48 bounds.push_back(bound);
52 B2ERROR(
"Could not read bounds file");
61 return "Generates axial tracks from hits using several increasingly relaxed hough space search over phi0 and curvature.";
65 const std::string& prefix)
68 moduleParamList->
addParameter(prefixed(prefix,
"granularityLevel"),
70 "Level of divisions in the hough space.",
73 moduleParamList->
addParameter(prefixed(prefix,
"sectorLevelSkip"),
75 "Number of levels to be skipped in the hough "
76 "space on the first level to form sectors",
79 moduleParamList->
addParameter(prefixed(prefix,
"curvBounds"),
81 "Curvature bounds of the hough space. Either 2 or all discrete bounds",
84 moduleParamList->
addParameter(prefixed(prefix,
"discretePhi0Width"),
86 "Width of the phi0 bins at the lowest level of the hough space.",
89 moduleParamList->
addParameter(prefixed(prefix,
"discretePhi0Overlap"),
91 "Overlap of the phi0 bins at the lowest level of the hough space.",
94 moduleParamList->
addParameter(prefixed(prefix,
"discreteCurvWidth"),
96 "Width of the curvature bins at the lowest level of the hough space.",
99 moduleParamList->
addParameter(prefixed(prefix,
"discreteCurvOverlap"),
101 "Overlap of the curvature bins at the lowest level of the hough space.",
105 moduleParamList->
addParameter(prefixed(prefix,
"relaxationSchedule"),
107 "Relaxation schedule for the leaf processor in the hough tree. "
108 "For content of the individual parameter maps consider the parameters of the "
109 "AxialLegendreLeafProcessor",
152 std::vector<CDCTrack>& tracks)
155 std::vector<const CDCWireHit*> unusedAxialWireHits;
156 for (
const CDCWireHit* wireHit : axialWireHits) {
157 (*wireHit)->setMaskedFlag(
false);
158 if ((*wireHit)->hasTakenFlag())
continue;
159 unusedAxialWireHits.push_back(wireHit);
168 const std::string prefix =
"";
181 const std::vector<CDCTrack>& foundTracks = leafProcessor.
getTracks();
182 tracks.insert(tracks.end(), foundTracks.begin(), foundTracks.end());
194 using BinSpan = std::array<float, 2>;
195 using BinSpans = std::vector<BinSpan>;
196 std::vector<BinSpans> binSpansByLevel(granularityLevel + 1);
197 binSpansByLevel[0].push_back(BinSpan({curvSpan[0], curvSpan[1]}));
199 for (
int level = 1; level <= granularityLevel; ++level) {
200 for (
const BinSpan& binSpan : binSpansByLevel[level - 1]) {
201 const float subBinWidth = std::fabs(binSpan[1] - binSpan[0]) / 2;
202 const float middle = binSpan[0] + (binSpan[1] - binSpan[0]) / 2.0;
210 const float extension = [&]() {
211 if ((level + 7 <= granularityLevel)
213 or (std::fabs(middle) <= 0.005)) {
215 }
else if (level + 5 < granularityLevel) {
216 return subBinWidth / 4.0;
218 return subBinWidth / 8.0;
222 const float lower1 = binSpan[0] - extension;
223 const float upper1 = middle + extension;
225 const float lower2 = middle - extension;
226 const float upper2 = binSpan[1] + extension;
228 binSpansByLevel[level].push_back({lower1, upper1});
229 binSpansByLevel[level].push_back({lower2, upper2});
234 std::vector<float> result;
236 for (BinSpan& binSpan : binSpansByLevel[granularityLevel]) {
237 result.push_back(binSpan[0]);
238 result.push_back(binSpan[1]);