11 #include <tracking/trackFindingCDC/hough/trees/BoxDivisionHoughTree.h>
12 #include <tracking/trackFindingCDC/eventdata/hits/CDCRecoHit3D.h>
24 namespace TrackFindingCDC {
28 template<
class AHitPtr,
class AInBoxAlgorithm,
size_t divisionX,
size_t divisionY,
size_t divisionZ>
29 class SimpleBoxDivisionHoughTree3D :
public
30 BoxDivisionHoughTree<AHitPtr, typename AInBoxAlgorithm::HoughBox, divisionX, divisionY, divisionZ> {
34 using Super = BoxDivisionHoughTree<AHitPtr, typename AInBoxAlgorithm::HoughBox, divisionX, divisionY, divisionZ>;
37 using HoughBox =
typename AInBoxAlgorithm::HoughBox;
72 std::vector<std::pair<HoughBox, std::vector<AHitPtr>>>
75 AInBoxAlgorithm inBoxAlgorithm;
76 auto skipLowWeightNode = [minWeight](
const typename Super::Node * node) {
77 return not(node->getWeight() >= minWeight);
81 std::vector<std::pair<HoughBox, std::vector<AHitPtr>>> result;
84 result.push_back(std::move(*found));
101 const std::vector<CDCRecoHit3D>& foundHits,
102 const typename AInBoxAlgorithm::HoughBox& node)
104 TGraph* allHitsGraph =
new TGraph();
105 allHitsGraph->SetLineWidth(2);
106 allHitsGraph->SetLineColor(9);
109 const Vector3D& recoPos3D = recoHit3D.getRecoPos3D();
110 const double R = std::sqrt(recoPos3D.
x() * recoPos3D.
x() + recoPos3D.
y() * recoPos3D.
y());
111 const double Z = recoPos3D.
z();
112 allHitsGraph->SetPoint(allHitsGraph->GetN(), R, Z);
115 static int nevent(0);
116 TCanvas canv(
"trackCanvas",
"CDC stereo hits in an event", 0, 0, 1600, 1200);
118 allHitsGraph->Draw(
"APL*");
119 allHitsGraph->GetXaxis()->SetLimits(0, 120);
120 allHitsGraph->GetYaxis()->SetRangeUser(-180, 180);
122 TGraph* foundHitsGraph =
new TGraph();
123 foundHitsGraph->SetMarkerStyle(8);
124 foundHitsGraph->SetMarkerColor(2);
127 const Vector3D& recoPos3D = recoHit3D.getRecoPos3D();
128 const double R = std::sqrt(recoPos3D.
x() * recoPos3D.
x() + recoPos3D.
y() * recoPos3D.
y());
129 const double Z = recoPos3D.
z();
130 foundHitsGraph->SetPoint(foundHitsGraph->GetN(), R, Z);
132 foundHitsGraph->Draw(
"P");
134 const double centerX = (AInBoxAlgorithm::BoxAlgorithm::centerX(node));
135 const double deltaX = (AInBoxAlgorithm::BoxAlgorithm::deltaX(node));
136 const double centerY = (AInBoxAlgorithm::BoxAlgorithm::centerY(node));
137 const double centerZ = (AInBoxAlgorithm::BoxAlgorithm::centerZ(node));
139 TF1* candidateL =
new TF1(
"candL", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
140 TF1* candidateH =
new TF1(
"candH", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
141 TF1* candidateMean =
new TF1(
"candMean", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
143 candidateL->SetParameters(centerX - deltaX, centerY, centerZ - 100.0 * deltaX);
144 candidateH->SetParameters(centerX + deltaX, centerY, centerZ + 100.0 * deltaX);
145 candidateMean->SetParameters(centerX, centerY, centerZ);
147 candidateL->SetLineColor(9);
148 candidateH->SetLineColor(41);
149 candidateMean->SetLineColor(2);
151 candidateL->Draw(
"same");
152 candidateH->Draw(
"same");
153 candidateMean->Draw(
"same");
154 canv.SaveAs(Form(
"CDCRLHits_%i.png", nevent));