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 {
74 lowerX = node->getLowerX();
76 upperX = node->getUpperX();
78 lowerY = node->getLowerY();
80 upperY = node->getUpperY();
82 weight = node->getWeight();
84 level = node->getLevel();
94 openedRootFile.Write();
95 openedRootFile.Close();
99 void drawDebugPlot(
const std::vector<TrackingUtilities::CDCRecoHit3D>& allHits,
100 const std::vector<TrackingUtilities::CDCRecoHit3D>& foundHits,
101 const typename AInBoxAlgorithm::HoughBox& node)
103 TGraph* allHitsGraph =
new TGraph();
104 allHitsGraph->SetLineWidth(2);
105 allHitsGraph->SetLineColor(9);
108 const ROOT::Math::XYZVector& recoPos3D = recoHit3D.getRecoPos3D();
109 const double R = std::sqrt(recoPos3D.x() * recoPos3D.x() + recoPos3D.y() * recoPos3D.y());
110 const double Z = recoPos3D.z();
111 allHitsGraph->SetPoint(allHitsGraph->GetN(),
R, Z);
114 static int nevent(0);
115 TCanvas canv(
"trackCanvas",
"CDC stereo hits in an event", 0, 0, 1600, 1200);
117 allHitsGraph->Draw(
"APL*");
118 allHitsGraph->GetXaxis()->SetLimits(0, 120);
119 allHitsGraph->GetYaxis()->SetRangeUser(-180, 180);
121 TGraph* foundHitsGraph =
new TGraph();
122 foundHitsGraph->SetMarkerStyle(8);
123 foundHitsGraph->SetMarkerColor(2);
126 const ROOT::Math::XYZVector& recoPos3D = recoHit3D.getRecoPos3D();
127 const double R = std::sqrt(recoPos3D.x() * recoPos3D.x() + recoPos3D.y() * recoPos3D.y());
128 const double Z = recoPos3D.z();
129 foundHitsGraph->SetPoint(foundHitsGraph->GetN(),
R, Z);
131 foundHitsGraph->Draw(
"P");
133 const double xMean = (node.getLowerX() + node.getUpperX()) / 2.0;
134 const double yMean = (node.getLowerY() + node.getUpperY()) / 2.0;
135 const double xLow = node.getLowerX();
136 const double yLow = node.getLowerY();
137 const double xHigh = node.getUpperX();
138 const double yHigh = node.getUpperY();
140 TF1* candidateLL =
new TF1(
"candLL", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
141 TF1* candidateLH =
new TF1(
"candLH", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
142 TF1* candidateHL =
new TF1(
"candHL", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
143 TF1* candidateHH =
new TF1(
"candHH", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
144 TF1* candidateMean =
new TF1(
"candMean", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
146 candidateLL->SetParameters(xLow, yLow);
147 candidateLH->SetParameters(xLow, yHigh);
148 candidateHL->SetParameters(xHigh, yLow);
149 candidateHH->SetParameters(xHigh, yHigh);
150 candidateMean->SetParameters(xMean, yMean);
152 candidateLL->SetLineColor(9);
153 candidateLH->SetLineColor(30);
154 candidateHL->SetLineColor(46);
155 candidateHH->SetLineColor(41);
156 candidateMean->SetLineColor(2);
158 candidateLL->Draw(
"same");
159 candidateHL->Draw(
"same");
160 candidateLH->Draw(
"same");
161 candidateHH->Draw(
"same");
162 candidateMean->Draw(
"same");
163 canv.SaveAs(Form(
"CDCRLHits_%i.png", nevent));