8#include <tracking/trackFindingCDC/testFixtures/TrackFindingCDCTestWithSimpleSimulation.h>
10#include <tracking/trackFindingCDC/hough/perigee/SimpleRLTaggedWireHitHoughTree.h>
11#include <tracking/trackFindingCDC/hough/perigee/SimpleSegmentHoughTree.h>
13#include <tracking/trackFindingCDC/hough/algorithms/InPhi0TanLBox.h>
15#include <tracking/trackFindingCDC/hough/perigee/Phi0Rep.h>
16#include <tracking/trackFindingCDC/hough/axes/StandardAxes.h>
17#include <tracking/trackFindingCDC/hough/perigee/ImpactRep.h>
22using namespace TrackFindingCDC;
53 const int maxLevel = 13;
54 const int phi0Divisions = 2;
55 const int tanLDivisions = 2;
57 const int discretePhi0Overlap = 4;
58 const int discretePhi0Width = 5;
60 const int nPhi0Bins = std::pow(phi0Divisions, maxLevel);
65 const double maxTanL = 3.27;
66 const double minTanL = -1.73;
68 const int discreteTanLOverlap = 1;
69 const int discreteTanLWidth = 2;
70 const int nTanLBins = std::pow(tanLDivisions, maxLevel);
77 const double curlCurv = 0.018;
82 std::string svgFileName =
"phi0_tanl_on_hits.svg";
84 Helix originLine0(0.0, -1.0, 0, 0.2, 0);
85 Helix originLine1(0.0, 1.0, 0, -0.5, 0);
87 simulate({originLine0, originLine1});
88 saveDisplay(svgFileName);
90 using SimpleRLTaggedWireHitPhi0TanLHoughTree =
93 SimpleRLTaggedWireHitPhi0TanLHoughTree houghTree(maxLevel, 0.018);
94 using HoughBox = SimpleRLTaggedWireHitPhi0TanLHoughTree::HoughBox;
96 houghTree.assignArray<
ContinuousTanL>({{minTanL, maxTanL}}, tanLBinsSpec.getOverlap());
99 houghTree.initialize();
101 std::vector<CDCRLWireHit> mcTaggedWireHits;
102 for (
const CDCTrack& mcTrack : m_mcTracks) {
104 const CDCWireHit& wireHit = recoHit3D.getWireHit();
105 mcTaggedWireHits.emplace_back(&wireHit);
106 mcTaggedWireHits.back().setRLInfo(recoHit3D.getRLInfo());
111 std::vector< std::pair<HoughBox, std::vector<CDCRLWireHit> > > candidates;
118 houghTree.seed(mcTaggedWireHits);
120 const double minWeight = 50.0;
122 candidates = houghTree.findBest(minWeight);
124 ASSERT_EQ(m_mcTracks.size(), candidates.size());
127 for (
size_t iCand = 0; iCand < candidates.size(); ++iCand) {
128 EXPECT_GE(candidates[iCand].second.size(), 30);
132 std::size_t nNodes = houghTree.getTree()->getNNodes();
133 B2INFO(
"Tree generated " << nNodes <<
" nodes");
139 for (std::pair<HoughBox, std::vector<CDCRLWireHit> >& candidate : candidates) {
140 const HoughBox& houghBox = candidate.first;
141 const std::vector<CDCRLWireHit>& taggedHits = candidate.second;
143 B2DEBUG(100,
"Candidate");
144 B2DEBUG(100,
"size " << taggedHits.size());
145 B2DEBUG(100,
"Lower Phi0 " << houghBox.getLowerBound<
DiscretePhi0>()->phi());
146 B2DEBUG(100,
"Upper Phi0 " << houghBox.getUpperBound<
DiscretePhi0>()->phi());
147 B2DEBUG(100,
"Lower TanL " << houghBox.getLowerBound<
ContinuousTanL>());
148 B2DEBUG(100,
"Upper TanL " << houghBox.getUpperBound<
ContinuousTanL>());
151 B2DEBUG(100,
"Tags of the hits");
152 for (
const CDCRLWireHit& rlTaggedWireHit : taggedHits) {
154 "rl = " <<
static_cast<int>(rlTaggedWireHit.getRLInfo()) <<
" " <<
155 "dl = " << rlTaggedWireHit.getRefDriftLength());
158 for (
const CDCRLWireHit& rlTaggedWireHit : taggedHits) {
159 const CDCWireHit& wireHit = rlTaggedWireHit.getWireHit();
160 std::string color =
"blue";
161 if (rlTaggedWireHit.getRLInfo() == ERightLeft::c_Right) {
163 }
else if (rlTaggedWireHit.getRLInfo() == ERightLeft::c_Left) {
168 draw(wireHit, strokeAttr);
172 saveDisplay(svgFileName);
179 std::string svgFileName =
"phi0_tanl_on_segments.svg";
181 Helix originLine0(0.0, -1.0, 0, 0.2, 0);
182 Helix originLine1(0.0, 1.0, 0, -0.5, 0);
184 simulate({originLine0, originLine1});
185 saveDisplay(svgFileName);
187 using SimpleSegmentPhi0TanLHoughTree =
190 SimpleSegmentPhi0TanLHoughTree houghTree(maxLevel, curlCurv);
191 using HoughBox = SimpleSegmentPhi0TanLHoughTree::HoughBox;
193 houghTree.assignArray<
ContinuousTanL>({{minTanL, maxTanL}}, tanLBinsSpec.getOverlap());
196 houghTree.initialize();
199 std::vector<const CDCSegment2D*> m_ptrSegment2Ds;
200 m_ptrSegment2Ds.reserve(m_mcSegment2Ds.size());
202 m_ptrSegment2Ds.push_back(&segment2D);
206 std::vector< std::pair<HoughBox, std::vector<const CDCSegment2D*> > > candidates;
212 houghTree.seed(m_ptrSegment2Ds);
214 const double minWeight = 50.0;
216 candidates = houghTree.findBest(minWeight);
218 ASSERT_EQ(m_mcTracks.size(), candidates.size());
222 for (
size_t iCand = 0; iCand < candidates.size(); ++iCand) {
223 EXPECT_GE(candidates[iCand].second.size(), 7);
228 std::size_t nNodes = houghTree.getTree()->getNNodes();
229 B2INFO(
"Tree generated " << nNodes <<
" nodes");
234 for (std::pair<HoughBox, std::vector<const CDCSegment2D*> >& candidate : candidates) {
235 const HoughBox& houghBox = candidate.first;
236 const std::vector<const CDCSegment2D*>& segments = candidate.second;
238 B2DEBUG(100,
"Candidate");
239 B2DEBUG(100,
"size " << segments.size());
240 B2DEBUG(100,
"Lower Phi0 " << houghBox.getLowerBound<
DiscretePhi0>()->phi());
241 B2DEBUG(100,
"Upper Phi0 " << houghBox.getUpperBound<
DiscretePhi0>()->phi());
242 B2DEBUG(100,
"Lower TanL " << houghBox.getLowerBound<
ContinuousTanL>());
243 B2DEBUG(100,
"Upper TanL " << houghBox.getUpperBound<
ContinuousTanL>());
247 draw(*segment2D, strokeAttr);
251 saveDisplay(svgFileName);
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Class representing a three dimensional reconstructed hit.
A reconstructed sequence of two dimensional hits in one super layer.
Class representing a sequence of three dimensional reconstructed hits.
Class representing a hit wire in the central drift chamber.
Type to have values not based on discrete positions from an array.
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.