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>
19 using namespace TrackFindingCDC;
20 using 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;
74 std::string svgFileName =
"phi0_curv_tanl_hits.svg";
76 Helix lowerCurvOriginHelix(0.015, 2.52033, 0, 1, 0);
77 Helix higherCurvOriginHelix(0.020, 3.0718, 0, -0.2, 0);
82 simulate({lowerCurvOriginHelix, higherCurvOriginHelix});
83 saveDisplay(svgFileName);
85 using SimpleRLTaggedWireHitPhi0CurvHough =
87 SimpleRLTaggedWireHitPhi0CurvHough houghTree(maxLevel, curlCurv);
88 using HoughBox = SimpleRLTaggedWireHitPhi0CurvHough::HoughBox;
90 const double minWeight = 50.0;
98 houghTree.assignArray<
ContinuousTanL>({{minTanL, maxTanL}}, tanLBinsSpec.getOverlap());
100 houghTree.initialize();
103 std::vector< std::pair<HoughBox, std::vector<CDCRLWireHit> > > candidates;
109 houghTree.seed(m_wireHits);
112 candidates = houghTree.findBest(minWeight, maxCurvAcceptance);
114 ASSERT_EQ(m_mcTracks.size(), candidates.size());
117 for (
size_t iCand = 0; iCand < candidates.size(); ++iCand) {
118 EXPECT_GE(candidates[iCand].second.size(), 30);
123 std::size_t nNodes = houghTree.getTree()->getNNodes();
124 B2DEBUG(100,
"Tree generated " << nNodes <<
" nodes");
129 for (std::pair<HoughBox, std::vector<CDCRLWireHit> >& candidate : candidates) {
130 const HoughBox& houghBox = candidate.first;
131 const std::vector<CDCRLWireHit>& taggedHits = candidate.second;
133 B2DEBUG(100,
"Candidate");
134 B2DEBUG(100,
"size " << taggedHits.size());
136 B2DEBUG(100,
"Lower Phi0 " << houghBox.getLowerBound<
DiscretePhi0>()->phi());
137 B2DEBUG(100,
"Upper Phi0 " << houghBox.getUpperBound<
DiscretePhi0>()->phi());
140 B2DEBUG(100,
"Lower TanL " << houghBox.getLowerBound<
ContinuousTanL>());
141 B2DEBUG(100,
"Upper TanL " << houghBox.getUpperBound<
ContinuousTanL>());
142 B2DEBUG(100,
"Tags of the hits");
143 for (
const CDCRLWireHit& rlTaggedWireHit : taggedHits) {
145 "rl = " <<
static_cast<int>(rlTaggedWireHit.getRLInfo()) <<
" " <<
146 "dl = " << rlTaggedWireHit.getRefDriftLength());
149 for (
const CDCRLWireHit& rlTaggedWireHit : taggedHits) {
150 const CDCWireHit& wireHit = rlTaggedWireHit.getWireHit();
151 std::string color =
"blue";
152 if (rlTaggedWireHit.getRLInfo() == ERightLeft::c_Right) {
154 }
else if (rlTaggedWireHit.getRLInfo() == ERightLeft::c_Left) {
159 draw(wireHit, strokeAttr);
164 saveDisplay(svgFileName);
171 std::string svgFileName =
"phi0_curv_tanl_segments.svg";
173 Helix lowerCurvOriginHelix(0.015, 2.52033, 0, 1, 0);
174 Helix higherCurvOriginHelix(0.020, 3.0718, 0, -0.2, 0);
176 simulate({lowerCurvOriginHelix, higherCurvOriginHelix});
177 saveDisplay(svgFileName);
179 using SimpleSegmentPhi0CurvHoughTree =
181 SimpleSegmentPhi0CurvHoughTree houghTree(maxLevel, curlCurv);
182 using HoughBox = SimpleSegmentPhi0CurvHoughTree::HoughBox;
184 const double minWeight = 50.0;
190 houghTree.assignArray<
ContinuousTanL>({{minTanL, maxTanL}}, tanLBinsSpec.getOverlap());
191 houghTree.initialize();
194 std::vector<const CDCSegment2D*> m_ptrSegment2Ds;
195 m_ptrSegment2Ds.reserve(m_mcSegment2Ds.size());
197 m_ptrSegment2Ds.push_back(&segment2D);
201 std::vector< std::pair<HoughBox, std::vector<const CDCSegment2D*> > > candidates;
207 houghTree.seed(m_ptrSegment2Ds);
210 candidates = houghTree.findBest(minWeight, maxCurvAcceptance);
212 ASSERT_EQ(m_mcTracks.size(), candidates.size());
216 for (
size_t iCand = 0; iCand < candidates.size(); ++iCand) {
217 EXPECT_GE(candidates[iCand].second.size(), 4);
222 int nNodes = houghTree.getTree()->getNNodes();
223 B2INFO(
"Tree generated " << nNodes <<
" nodes");
228 for (std::pair<HoughBox, std::vector<const CDCSegment2D*> >& candidate : candidates) {
229 const HoughBox& houghBox = candidate.first;
230 const std::vector<const CDCSegment2D*>& segments = candidate.second;
232 B2DEBUG(100,
"Candidate");
233 B2DEBUG(100,
"size " << segments.size());
234 B2DEBUG(100,
"Lower Phi0 " << houghBox.getLowerBound<
DiscretePhi0>()->phi());
235 B2DEBUG(100,
"Upper Phi0 " << houghBox.getUpperBound<
DiscretePhi0>()->phi());
238 B2DEBUG(100,
"Lower TanL " << houghBox.getLowerBound<
ContinuousTanL>());
239 B2DEBUG(100,
"Upper TanL " << houghBox.getUpperBound<
ContinuousTanL>());
242 draw(*segment2D, strokeAttr);
246 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 curv points from discrete overlap specifications.
DiscreteCurvWithArcLength2DCache::Array constructCacheArray() const
Constuct the array of discrete curv 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 Attributre 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
Constuct 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.
TEST_F(GlobalLabelTest, LargeNumberOfTimeDependentParameters)
Test large number of time-dep params for registration and retrieval.
Abstract base class for different kinds of events.