10 #include <tracking/trackFindingCDC/testFixtures/TrackFindingCDCTestWithSimpleSimulation.h>
12 #include <tracking/trackFindingCDC/hough/perigee/SimpleRLTaggedWireHitHoughTree.h>
13 #include <tracking/trackFindingCDC/hough/perigee/SimpleSegmentHoughTree.h>
14 #include <tracking/trackFindingCDC/hough/perigee/StandardBinSpec.h>
16 #include <tracking/trackFindingCDC/hough/algorithms/InPhi0ImpactCurvBox.h>
21 using namespace TrackFindingCDC;
22 using namespace PerigeeBinSpec;
26 TEST_F(TrackFindingCDCTestWithSimpleSimulation, hough_perigee_SimpleHitBasedHough_phi0_impact_curv_onHits)
28 std::string svgFileName =
"phi0_impact_curv_on_hits.svg";
30 Helix lowerCurvHelix(0.015, 2.52033, -20, 0, 0);
31 Helix higherCurvHelix(0.027, 3.0718, 20, 0, 0);
37 simulate({lowerCurvHelix, higherCurvHelix});
38 saveDisplay(svgFileName);
40 using SimpleWireHitPhi0ImpactCurvHoughTree =
41 SimpleRLTaggedWireHitHoughTree<InPhi0ImpactCurvBox, phi0Divisions, impactDivisions, curvDivisions>;
43 SimpleWireHitPhi0ImpactCurvHoughTree houghTree(maxLevel, curlCurv);
44 using HoughBox = SimpleWireHitPhi0ImpactCurvHoughTree::HoughBox;
46 const double minWeight = 70.0;
50 houghTree.assignArray<ContinuousImpact>({{minImpact, maxImpact}}, impactBinsSpec.
getOverlap());
52 houghTree.initialize();
55 std::vector< std::pair<HoughBox, std::vector<CDCRLWireHit> > > candidates;
58 TimeItResult timeItResult = timeIt(100,
true, [&]() {
60 houghTree.seed(m_axialWireHits);
62 candidates = houghTree.find(minWeight, maxCurvAcceptance);
65 ASSERT_EQ(m_mcTracks.size(), candidates.size());
68 for (
size_t iCand = 0; iCand < candidates.size(); ++iCand) {
69 EXPECT_GE(candidates[iCand].second.size(), 30);
73 std::size_t nNodes = houghTree.getTree()->getNNodes();
74 B2INFO(
"Tree generated " << nNodes <<
" nodes");
80 for (std::pair<HoughBox, std::vector<CDCRLWireHit> >& candidate : candidates) {
81 const HoughBox& houghBox = candidate.first;
82 const std::vector<CDCRLWireHit>& taggedHits = candidate.second;
84 B2DEBUG(100,
"Candidate");
85 B2DEBUG(100,
"size " << taggedHits.size());
86 B2DEBUG(100,
"Phi0 " << houghBox.getLowerBound<DiscretePhi0>()->phi());
87 B2DEBUG(100,
"Curv " << houghBox.getLowerBound<DiscreteCurv>());
88 B2DEBUG(100,
"Impact " << houghBox.getLowerBound<ContinuousImpact>());
90 B2DEBUG(100,
"Tags of the hits");
91 for (
const CDCRLWireHit& rlTaggedWireHit : taggedHits) {
93 "rl = " <<
static_cast<int>(rlTaggedWireHit.getRLInfo()) <<
" " <<
94 "dl = " << rlTaggedWireHit.getRefDriftLength());
97 for (
const CDCRLWireHit& rlTaggedWireHit : taggedHits) {
98 const CDCWireHit& wireHit = rlTaggedWireHit.getWireHit();
99 std::string color =
"blue";
100 if (rlTaggedWireHit.getRLInfo() == ERightLeft::c_Right) {
102 }
else if (rlTaggedWireHit.getRLInfo() == ERightLeft::c_Left) {
107 draw(wireHit, strokeAttr);
111 saveDisplay(svgFileName);
113 timeItResult.printSummary();
118 TEST_F(TrackFindingCDCTestWithSimpleSimulation, hough_perigee_SimpleHitBasedHough_phi0_impact_curv_onSegment)
120 std::string svgFileName =
"phi0_impact_curv_on_segments.svg";
122 Helix lowerCurvHelix(0.015, 2.52033, -20, 0, 0);
123 Helix higherCurvHelix(0.027, 3.0718, 20, 0, 0);
125 simulate({lowerCurvHelix, higherCurvHelix});
126 saveDisplay(svgFileName);
128 using SimpleSegmentPhi0ImpactCurvHoughTree =
129 SimpleSegmentHoughTree<InPhi0ImpactCurvBox, phi0Divisions, impactDivisions, curvDivisions>;
131 SimpleSegmentPhi0ImpactCurvHoughTree houghTree(maxLevel, curlCurv);
132 using HoughBox = SimpleSegmentPhi0ImpactCurvHoughTree::HoughBox;
134 const double minWeight = 70.0;
138 houghTree.assignArray<ContinuousImpact>({{minImpact, maxImpact}}, impactBinsSpec.
getOverlap());
140 houghTree.initialize();
143 std::vector< std::pair<HoughBox, std::vector<const CDCSegment2D*> > > candidates;
146 TimeItResult timeItResult = timeIt(100,
true, [&]() {
150 houghTree.seed(m_mcAxialSegment2Ds);
152 candidates = houghTree.find(minWeight, maxCurvAcceptance);
155 ASSERT_EQ(m_mcTracks.size(), candidates.size());
159 for (
size_t iCand = 0; iCand < candidates.size(); ++iCand) {
160 EXPECT_GE(candidates[iCand].second.size(), 4);
165 std::size_t nNodes = houghTree.getTree()->getNNodes();
166 B2INFO(
"Tree generated " << nNodes <<
" nodes");
171 for (std::pair<HoughBox, std::vector<const CDCSegment2D*> >& candidate : candidates) {
172 const HoughBox& houghBox = candidate.first;
173 const std::vector<const CDCSegment2D*>& segments = candidate.second;
175 B2DEBUG(100,
"Candidate");
176 B2DEBUG(100,
"size " << segments.size());
177 B2DEBUG(100,
"Phi0 " << houghBox.getLowerBound<DiscretePhi0>()->phi());
178 B2DEBUG(100,
"Curv " << houghBox.getLowerBound<DiscreteCurv>());
179 B2DEBUG(100,
"Impact " << houghBox.getLowerBound<ContinuousImpact>());
181 for (
const CDCSegment2D* segment2D : segments) {
183 draw(*segment2D, strokeAttr);
187 saveDisplay(svgFileName);
188 timeItResult.printSummary();
192 TEST_F(TrackFindingCDCTestWithSimpleSimulation, hough_perigee_phi0_impact_curv_prepared_event_segments)
194 std::string svgFileName =
"phi0_impact_curv_on_prepared_event_segments.svg";
196 saveDisplay(svgFileName);
198 using SimpleSegmentPhi0ImpactCurvHoughTree =
199 SimpleSegmentHoughTree<InPhi0ImpactCurvBox, phi0Divisions, impactDivisions, curvDivisions>;
201 using HoughBox = SimpleSegmentPhi0ImpactCurvHoughTree::HoughBox;
202 SimpleSegmentPhi0ImpactCurvHoughTree houghTree(maxLevel);
204 houghTree.assignArray<DiscretePhi0>(phi0BinsSpec.
constructArray(),
206 houghTree.assignArray<ContinuousImpact>({{minImpact, maxImpact}},
208 houghTree.assignArray<DiscreteCurv>(curvBinsSpec.
constructArray(),
211 houghTree.initialize();
212 const double minWeight = 30.0;
215 std::vector< std::pair<HoughBox, std::vector<const CDCSegment2D*> > > candidates;
218 TimeItResult timeItResult = timeIt(1,
true, [&]() {
221 houghTree.seed(m_mcAxialSegment2Ds);
224 candidates = houghTree.findBest(minWeight, maxCurvAcceptance);
226 ASSERT_EQ(m_mcTracks.size(), candidates.size());
229 for (
size_t iCand = 0; iCand < candidates.size(); ++iCand) {
230 EXPECT_GE(candidates[iCand].second.size(), 3);
235 std::size_t nNodes = houghTree.getTree()->getNNodes();
236 B2DEBUG(100,
"Tree generated " << nNodes <<
" nodes");
241 for (std::pair<HoughBox, std::vector<const CDCSegment2D*> >& candidate : candidates) {
242 const HoughBox& houghBox = candidate.first;
243 const std::vector<const CDCSegment2D*>& segments = candidate.second;
245 B2DEBUG(100,
"Candidate");
246 B2DEBUG(100,
"size " << segments.size());
247 B2DEBUG(100,
"Phi0 " << houghBox.getLowerBound<DiscretePhi0>()->phi());
248 B2DEBUG(100,
"Curv " << houghBox.getLowerBound<DiscreteCurv>());
249 B2DEBUG(100,
"Impact " << houghBox.getLowerBound<ContinuousImpact>());
251 for (
const CDCSegment2D* segment2D : segments) {
253 draw(*segment2D, strokeAttr);
257 saveDisplay(svgFileName);
258 timeItResult.printSummary();