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/InPhi0ImpactBox.h>
21 using namespace TrackFindingCDC;
22 using namespace PerigeeBinSpec;
26 TEST_F(TrackFindingCDCTestWithSimpleSimulation, hough_perigee_SimpleHitBasedHough_phi0_impact_onHits)
28 std::string svgFileName =
"phi0_impact_on_hits.svg";
30 Helix lowerHelix(0.00, 2.52033, -20, 0, 0);
31 Helix higherHelix(0.00, 3.0718, 20, 0, 0);
33 simulate({lowerHelix, higherHelix});
34 saveDisplay(svgFileName);
36 using SimpleRLTaggedWireHitHoughTree =
37 SimpleRLTaggedWireHitHoughTree<InPhi0ImpactBox, phi0Divisions, impactDivisions>;
39 SimpleRLTaggedWireHitHoughTree houghTree(maxLevel);
44 houghTree.assignArray<ContinuousImpact>({{minImpact, maxImpact}}, impactBinsSpec.
getOverlap());
45 houghTree.initialize();
48 std::vector< std::pair<HoughBox, std::vector<CDCRLWireHit> > > candidates;
51 TimeItResult timeItResult = timeIt(100,
true, [&]() {
53 houghTree.seed(m_axialWireHits);
55 const double minWeight = 30.0;
56 candidates = houghTree.find(minWeight);
59 ASSERT_EQ(m_mcTracks.size(), candidates.size());
62 for (
size_t iCand = 0; iCand < candidates.size(); ++iCand) {
63 EXPECT_GE(candidates[iCand].second.size(), 30);
67 std::size_t nNodes = houghTree.getTree()->getNNodes();
68 B2INFO(
"Tree generated " << nNodes <<
" nodes");
74 for (std::pair<HoughBox, std::vector<CDCRLWireHit> >& candidate : candidates) {
75 const HoughBox& houghBox = candidate.first;
76 const std::vector<CDCRLWireHit>& taggedHits = candidate.second;
78 B2DEBUG(100,
"Candidate");
79 B2DEBUG(100,
"size " << taggedHits.size());
80 B2DEBUG(100,
"Phi0 " << houghBox.getLowerBound<DiscretePhi0>()->phi());
81 B2DEBUG(100,
"Impact " << houghBox.getLowerBound<ContinuousImpact>());
83 B2DEBUG(100,
"Tags of the hits");
84 for (
const CDCRLWireHit& rlTaggedWireHit : taggedHits) {
86 "rl = " <<
static_cast<int>(rlTaggedWireHit.getRLInfo()) <<
" " <<
87 "dl = " << rlTaggedWireHit.getRefDriftLength());
90 for (
const CDCRLWireHit& rlTaggedWireHit : taggedHits) {
91 const CDCWireHit& wireHit = rlTaggedWireHit.getWireHit();
92 std::string color =
"blue";
93 if (rlTaggedWireHit.getRLInfo() == ERightLeft::c_Right) {
95 }
else if (rlTaggedWireHit.getRLInfo() == ERightLeft::c_Left) {
100 draw(wireHit, strokeAttr);
104 saveDisplay(svgFileName);
106 timeItResult.printSummary();
112 TEST_F(TrackFindingCDCTestWithSimpleSimulation, hough_perigee_SimpleHitBasedHough_phi0_impact_onSegment)
114 std::string svgFileName =
"phi0_impact_on_segments.svg";
116 Helix lowerHelix(0.00, 2.52033, -20, 0, 0);
117 Helix higherHelix(0.00, 3.0718, 20, 0, 0);
119 simulate({lowerHelix, higherHelix});
120 saveDisplay(svgFileName);
122 using SimpleSegmentPhi0ImpactHoughTree =
123 SimpleSegmentHoughTree<InPhi0ImpactBox, phi0Divisions, impactDivisions>;
124 SimpleSegmentPhi0ImpactHoughTree houghTree(maxLevel);
126 using HoughBox = SimpleSegmentPhi0ImpactHoughTree::HoughBox;
131 houghTree.assignArray<ContinuousImpact>({{minImpact, maxImpact}}, impactBinsSpec.
getOverlap());
132 houghTree.initialize();
135 std::vector< std::pair<HoughBox, std::vector<const CDCSegment2D*> > > candidates;
138 TimeItResult timeItResult = timeIt(100,
true, [&]() {
142 houghTree.seed(m_mcAxialSegment2Ds);
144 const double minWeight = 40.0;
145 candidates = houghTree.find(minWeight);
148 ASSERT_EQ(m_mcTracks.size(), candidates.size());
152 for (
size_t iCand = 0; iCand < candidates.size(); ++iCand) {
153 EXPECT_GE(candidates[iCand].second.size(), 4);
158 std::size_t nNodes = houghTree.getTree()->getNNodes();
159 B2INFO(
"Tree generated " << nNodes <<
" nodes");
164 for (std::pair<HoughBox, std::vector<const CDCSegment2D*> >& candidate : candidates) {
165 const HoughBox& houghBox = candidate.first;
166 const std::vector<const CDCSegment2D*>& segments = candidate.second;
168 B2DEBUG(100,
"Candidate");
169 B2DEBUG(100,
"size " << segments.size());
170 B2DEBUG(100,
"Phi0 " << houghBox.getLowerBound<DiscretePhi0>()->phi());
171 B2DEBUG(100,
"Impact " << houghBox.getLowerBound<ContinuousImpact>());
173 for (
const CDCSegment2D* segment2D : segments) {
175 draw(*segment2D, strokeAttr);
179 saveDisplay(svgFileName);
180 timeItResult.printSummary();