|
19 | 19 | using RVecS = ROOT::VecOps::RVec<string>; |
20 | 20 | using RNode = ROOT::RDF::RNode; |
21 | 21 |
|
22 | | -int beamlineAnalysis( TString inFile = "/scratch/EIC/G4out/beamline/beamlineTest.edm4hep.root", |
| 22 | +int beamlineAnalysis( TString inFile = "/home/simong/EIC/detector_benchmarks_anl/sim_output/beamline/acceptanceTestXS3.edm4hep.root", |
23 | 23 | TString outFile = "output.root", |
24 | 24 | std::string compactName = "/home/simong/EIC/epic/install/share/epic/epic_ip6_extended.xml", |
25 | 25 | TString beamspotCanvasName = "beamspot_canvas.png", |
@@ -79,6 +79,13 @@ int beamlineAnalysis( TString inFile = "/scratch/EIC/G4out/beamline/b |
79 | 79 | } |
80 | 80 | return radii; |
81 | 81 | }, {"pipeParameters"}) |
| 82 | + .Define("isConeSegment",[](const ROOT::VecOps::RVec<volParams>& params) { |
| 83 | + ROOT::VecOps::RVec<bool> cones; |
| 84 | + for (const auto& param : params) { |
| 85 | + cones.push_back(param.isConeSegment); |
| 86 | + } |
| 87 | + return cones; |
| 88 | + }, {"pipeParameters"}) |
82 | 89 | .Define("xdet",[](const ROOT::VecOps::RVec<volParams>& params) { |
83 | 90 | ROOT::VecOps::RVec<double> xPos; |
84 | 91 | for (const auto& param : params) { |
@@ -170,6 +177,7 @@ int beamlineAnalysis( TString inFile = "/scratch/EIC/G4out/beamline/b |
170 | 177 | std::map<TString,double> pipeXPos; |
171 | 178 | std::map<TString,double> pipeZPos; |
172 | 179 | std::map<TString,double> pipeRotation; |
| 180 | + std::map<TString,bool> pipeIsConeSegment; |
173 | 181 |
|
174 | 182 | // Queue up all actions |
175 | 183 | auto xmin_ptr = d1.Min("xpos"); |
@@ -201,6 +209,7 @@ int beamlineAnalysis( TString inFile = "/scratch/EIC/G4out/beamline/b |
201 | 209 | .Define("xmomf","xmom[pipeID=="+std::to_string(i)+"]") |
202 | 210 | .Define("ymomf","ymom[pipeID=="+std::to_string(i)+"]") |
203 | 211 | .Define("pipeRadiusf","pipeRadius[pipeID=="+std::to_string(i)+"]") |
| 212 | + .Define("isConeSegmentf","isConeSegment[pipeID=="+std::to_string(i)+"]") |
204 | 213 | .Define("xdetf","xdet[pipeID=="+std::to_string(i)+"]") |
205 | 214 | .Define("zdetf","zdet[pipeID=="+std::to_string(i)+"]") |
206 | 215 | .Define("rotationf","rotation[pipeID=="+std::to_string(i)+"]"); |
@@ -273,6 +282,7 @@ int beamlineAnalysis( TString inFile = "/scratch/EIC/G4out/beamline/b |
273 | 282 | pipeXPos[name] = filterDF.Max("xdetf").GetValue(); |
274 | 283 | pipeZPos[name] = filterDF.Max("zdetf").GetValue(); |
275 | 284 | pipeRotation[name] = filterDF.Max("rotationf").GetValue(); |
| 285 | + pipeIsConeSegment[name] = filterDF.Max("isConeSegmentf").GetValue(); |
276 | 286 |
|
277 | 287 | //Fit gaussian to the x, y, px and py distributions |
278 | 288 | auto xhist = hHistsxy[name]->ProjectionX(); |
@@ -325,12 +335,15 @@ int beamlineAnalysis( TString inFile = "/scratch/EIC/G4out/beamline/b |
325 | 335 | cXY->cd(i++); |
326 | 336 |
|
327 | 337 | h->Draw("col"); |
328 | | - //Draw cicle |
329 | | - TEllipse *circle = new TEllipse(0,0,pipeRadius); |
330 | | - circle->SetLineColor(kRed); |
331 | | - circle->SetLineWidth(2); |
332 | | - circle->SetFillStyle(0); |
333 | | - circle->Draw("same"); |
| 338 | + |
| 339 | + // Only draw circle overlay if the shape is a cone segment |
| 340 | + if (pipeIsConeSegment[name] && pipeRadius > 0) { |
| 341 | + TEllipse *circle = new TEllipse(0,0,pipeRadius); |
| 342 | + circle->SetLineColor(kRed); |
| 343 | + circle->SetLineWidth(2); |
| 344 | + circle->SetFillStyle(0); |
| 345 | + circle->Draw("same"); |
| 346 | + } |
334 | 347 |
|
335 | 348 | // Add zoomed version in the top-right corner |
336 | 349 | TPad *pad = new TPad("zoomPad", "Zoomed View", 0.65, 0.65, 1.0, 1.0); |
|
0 commit comments