8#include <tracking/trackFindingCDC/testFixtures/TrackFindingCDCTestWithSimpleSimulation.h>
10#include <tracking/trackFindingCDC/hough/perigee/SimpleRLTaggedWireHitHoughTree.h>
11#include <tracking/trackFindingCDC/hough/perigee/SimpleSegmentHoughTree.h>
12#include <tracking/trackFindingCDC/hough/perigee/StandardBinSpec.h>
14#include <tracking/trackFindingCDC/hough/algorithms/InPhi0CurvTanLBox.h>
19using namespace TrackFindingCDC;
20using namespace PerigeeBinSpec;
25 const int maxLevel = 13;
29 const int phi0Divisions = 2;
30 const int discretePhi0Overlap = 4;
31 const int discretePhi0Width = 5;
32 const int nPhi0Bins = std::pow(phi0Divisions, maxLevel);
40 const int curvDivisions = 2;
41 const double maxCurv = 0.13;
42 const double minCurv = -0.018;
43 const double maxCurvAcceptance = 0.13;
45 const int discreteCurvOverlap = 4;
46 const int discreteCurvWidth = 5;
47 const int nCurvBins = std::pow(curvDivisions, maxLevel);
57 const int tanLDivisions = 2;
58 const double maxTanL = 3.27;
59 const double minTanL = -1.73;
61 const int discreteTanLOverlap = 1;
62 const int discreteTanLWidth = 2;
63 const int nTanLBins = std::pow(tanLDivisions, maxLevel);
70 const double curlCurv = 0.018;
75 std::string svgFileName =
"phi0_curv_tanl_hits.svg";
77 Helix lowerCurvOriginHelix(0.015, 2.52033, 0, 1, 0);
78 Helix higherCurvOriginHelix(0.020, 3.0718, 0, -0.2, 0);
83 simulate({lowerCurvOriginHelix, higherCurvOriginHelix});
84 saveDisplay(svgFileName);
86 using SimpleRLTaggedWireHitPhi0CurvHough =
88 SimpleRLTaggedWireHitPhi0CurvHough houghTree(maxLevel, curlCurv);
89 using HoughBox = SimpleRLTaggedWireHitPhi0CurvHough::HoughBox;
91 const double minWeight = 50.0;
99 houghTree.assignArray<
ContinuousTanL>({{minTanL, maxTanL}}, tanLBinsSpec.getOverlap());
101 houghTree.initialize();
104 std::vector< std::pair<HoughBox, std::vector<CDCRLWireHit> > > candidates;
110 houghTree.seed(m_wireHits);
113 candidates = houghTree.findBest(minWeight, maxCurvAcceptance);
115 ASSERT_EQ(m_mcTracks.size(), candidates.size());
118 for (
size_t iCand = 0; iCand < candidates.size(); ++iCand) {
119 EXPECT_GE(candidates[iCand].second.size(), 30);
124 std::size_t nNodes = houghTree.getTree()->getNNodes();
125 B2DEBUG(100,
"Tree generated " << nNodes <<
" nodes");
130 for (std::pair<HoughBox, std::vector<CDCRLWireHit> >& candidate : candidates) {
131 const HoughBox& houghBox = candidate.first;
132 const std::vector<CDCRLWireHit>& taggedHits = candidate.second;
134 B2DEBUG(100,
"Candidate");
135 B2DEBUG(100,
"size " << taggedHits.size());
137 B2DEBUG(100,
"Lower Phi0 " << houghBox.getLowerBound<
DiscretePhi0>()->phi());
138 B2DEBUG(100,
"Upper Phi0 " << houghBox.getUpperBound<
DiscretePhi0>()->phi());
141 B2DEBUG(100,
"Lower TanL " << houghBox.getLowerBound<
ContinuousTanL>());
142 B2DEBUG(100,
"Upper TanL " << houghBox.getUpperBound<
ContinuousTanL>());
143 B2DEBUG(100,
"Tags of the hits");
144 for (
const CDCRLWireHit& rlTaggedWireHit : taggedHits) {
146 "rl = " <<
static_cast<int>(rlTaggedWireHit.getRLInfo()) <<
" " <<
147 "dl = " << rlTaggedWireHit.getRefDriftLength());
150 for (
const CDCRLWireHit& rlTaggedWireHit : taggedHits) {
151 const CDCWireHit& wireHit = rlTaggedWireHit.getWireHit();
152 std::string color =
"blue";
153 if (rlTaggedWireHit.getRLInfo() == ERightLeft::c_Right) {
155 }
else if (rlTaggedWireHit.getRLInfo() == ERightLeft::c_Left) {
160 draw(wireHit, strokeAttr);
165 saveDisplay(svgFileName);
172 std::string svgFileName =
"phi0_curv_tanl_segments.svg";
174 Helix lowerCurvOriginHelix(0.015, 2.52033, 0, 1, 0);
175 Helix higherCurvOriginHelix(0.020, 3.0718, 0, -0.2, 0);
177 simulate({lowerCurvOriginHelix, higherCurvOriginHelix});
178 saveDisplay(svgFileName);
180 using SimpleSegmentPhi0CurvHoughTree =
182 SimpleSegmentPhi0CurvHoughTree houghTree(maxLevel, curlCurv);
183 using HoughBox = SimpleSegmentPhi0CurvHoughTree::HoughBox;
185 const double minWeight = 50.0;
191 houghTree.assignArray<
ContinuousTanL>({{minTanL, maxTanL}}, tanLBinsSpec.getOverlap());
192 houghTree.initialize();
195 std::vector<const CDCSegment2D*> m_ptrSegment2Ds;
196 m_ptrSegment2Ds.reserve(m_mcSegment2Ds.size());
198 m_ptrSegment2Ds.push_back(&segment2D);
202 std::vector< std::pair<HoughBox, std::vector<const CDCSegment2D*> > > candidates;
208 houghTree.seed(m_ptrSegment2Ds);
211 candidates = houghTree.findBest(minWeight, maxCurvAcceptance);
213 ASSERT_EQ(m_mcTracks.size(), candidates.size());
217 for (
size_t iCand = 0; iCand < candidates.size(); ++iCand) {
218 EXPECT_GE(candidates[iCand].second.size(), 4);
223 int nNodes = houghTree.getTree()->getNNodes();
224 B2INFO(
"Tree generated " << nNodes <<
" nodes");
229 for (std::pair<HoughBox, std::vector<const CDCSegment2D*> >& candidate : candidates) {
230 const HoughBox& houghBox = candidate.first;
231 const std::vector<const CDCSegment2D*>& segments = candidate.second;
233 B2DEBUG(100,
"Candidate");
234 B2DEBUG(100,
"size " << segments.size());
235 B2DEBUG(100,
"Lower Phi0 " << houghBox.getLowerBound<
DiscretePhi0>()->phi());
236 B2DEBUG(100,
"Upper Phi0 " << houghBox.getUpperBound<
DiscretePhi0>()->phi());
239 B2DEBUG(100,
"Lower TanL " << houghBox.getLowerBound<
ContinuousTanL>());
240 B2DEBUG(100,
"Upper TanL " << houghBox.getUpperBound<
ContinuousTanL>());
243 draw(*segment2D, strokeAttr);
247 saveDisplay(svgFileName);
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
A reconstructed sequence of two dimensional hits in one super layer.
Class representing a hit wire in the central drift chamber.
Type to have values not based on discrete positions from an array.
Strategy to construct discrete curve points from discrete overlap specifications.
DiscreteCurvWithArcLength2DCache::Array constructCacheArray() const
Construct the array of discrete curve positions including cache for the two dimensional arc length.
int getNOverlap() const
Getter for the overlap in discrete number of positions.
Representation for a discrete position in an array of discrete positions.
PrimitivePlotter::AttributeMap AttributeMap
Forward the Attribute map from the primitive plotter.
Strategy to construct discrete impact points from discrete overlap specifications.
Strategy to construct discrete phi0 points from discrete overlap specifications.
DiscretePhi0::Array constructArray() const
Construct the array of discrete phi0 positions.
int getNOverlap() const
Getter for the overlap in discrete number of positions.
A convenience class based on a BoxDivisionHoughTree for "hit-like" classes.
Class to capture the time a repeated execution took.
void printSummary() const
Print a summary of the collected time to the console.
Abstract base class for different kinds of events.