47 TFile openedRootFile(filename.c_str(),
"RECREATE");
48 TTree weightTTree(
"weightTree",
"A tree with the weights of the box items.");
49 TTree eventTTree(
"eventTree",
"A tree with event information.");
51 double lowerX, upperX, lowerY, upperY, weight, level;
52 weightTTree.Branch(
"lowerX", &lowerX);
53 weightTTree.Branch(
"upperY", &upperY);
54 weightTTree.Branch(
"lowerY", &lowerY);
55 weightTTree.Branch(
"upperX", &upperX);
56 weightTTree.Branch(
"weight", &weight);
57 weightTTree.Branch(
"level", &level);
64 eventTTree.Branch(
"lowerLimX", &lowerLimX);
65 eventTTree.Branch(
"upperLimX", &upperLimX);
66 eventTTree.Branch(
"lowerLimY", &lowerLimY);
67 eventTTree.Branch(
"upperLimY", &upperLimY);
68 eventTTree.Branch(
"maxLevel", &maxLevel);
72 auto walker = [&](
const typename Super::Node * node) ->
bool {
73 lowerX = node->getLowerX();
74 upperX = node->getUpperX();
75 upperY = node->getUpperY();
76 weight = node->getWeight();
77 level = node->getLevel();
87 openedRootFile.Write();
88 openedRootFile.Close();
92 static void drawDebugPlot(
const std::vector<TrackingUtilities::CDCRecoHit3D>& allHits,
93 const std::vector<TrackingUtilities::CDCRecoHit3D>& foundHits,
94 const typename AInBoxAlgorithm::HoughBox& node)
96 TGraph* allHitsGraph =
new TGraph();
97 allHitsGraph->SetLineWidth(2);
98 allHitsGraph->SetLineColor(9);
101 const ROOT::Math::XYZVector& recoPos3D = recoHit3D.getRecoPos3D();
102 const double R = std::sqrt(recoPos3D.x() * recoPos3D.x() + recoPos3D.y() * recoPos3D.y());
103 const double Z = recoPos3D.z();
104 allHitsGraph->SetPoint(allHitsGraph->GetN(),
R, Z);
107 static int nevent(0);
108 TCanvas canv(
"trackCanvas",
"CDC stereo hits in an event", 0, 0, 1600, 1200);
110 allHitsGraph->Draw(
"APL*");
111 allHitsGraph->GetXaxis()->SetLimits(0, 120);
112 allHitsGraph->GetYaxis()->SetRangeUser(-180, 180);
114 TGraph* foundHitsGraph =
new TGraph();
115 foundHitsGraph->SetMarkerStyle(8);
116 foundHitsGraph->SetMarkerColor(2);
119 const ROOT::Math::XYZVector& recoPos3D = recoHit3D.getRecoPos3D();
120 const double R = std::sqrt(recoPos3D.x() * recoPos3D.x() + recoPos3D.y() * recoPos3D.y());
121 const double Z = recoPos3D.z();
122 foundHitsGraph->SetPoint(foundHitsGraph->GetN(),
R, Z);
124 foundHitsGraph->Draw(
"P");
126 const double xMean = (node.getLowerX() + node.getUpperX()) / 2.0;
127 const double yMean = (node.getLowerY() + node.getUpperY()) / 2.0;
128 const double xLow = node.getLowerX();
129 const double yLow = node.getLowerY();
130 const double xHigh = node.getUpperX();
131 const double yHigh = node.getUpperY();
133 TF1* candidateLL =
new TF1(
"candLL", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
134 TF1* candidateLH =
new TF1(
"candLH", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
135 TF1* candidateHL =
new TF1(
"candHL", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
136 TF1* candidateHH =
new TF1(
"candHH", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
137 TF1* candidateMean =
new TF1(
"candMean", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
139 candidateLL->SetParameters(xLow, yLow);
140 candidateLH->SetParameters(xLow, yHigh);
141 candidateHL->SetParameters(xHigh, yLow);
142 candidateHH->SetParameters(xHigh, yHigh);
143 candidateMean->SetParameters(xMean, yMean);
145 candidateLL->SetLineColor(9);
146 candidateLH->SetLineColor(30);
147 candidateHL->SetLineColor(46);
148 candidateHH->SetLineColor(41);
149 candidateMean->SetLineColor(2);
151 candidateLL->Draw(
"same");
152 candidateHL->Draw(
"same");
153 candidateLH->Draw(
"same");
154 candidateHH->Draw(
"same");
155 candidateMean->Draw(
"same");
156 canv.SaveAs(Form(
"CDCRLHits_%i.png", nevent));