16 #include <TPolyLine.h>
22 #include <TLorentzVector.h>
23 #include <TEfficiency.h>
24 #include <TGraphAsymmErrors.h>
36 gROOT->SetStyle(
"Plain");
37 gStyle->SetOptStat(0);
39 gStyle->SetOptTitle(1);
40 gStyle->SetStatW(0.3);
41 gStyle->SetStatH(0.3);
50 int n_maps_layers = 3;
51 int n_intt_layers = 6;
53 int n_tpc_layers_inner = 16;
54 int n_tpc_layers_mid = 16;
55 int n_tpc_layers_outer = 16;
56 int n_tpc_layers = n_tpc_layers_inner + n_tpc_layers_mid + n_tpc_layers_outer;;
58 int nlayers = n_maps_layers+n_intt_layers+n_tpc_layers;
69 cout <<
"Reading ntuple " << endl;
71 TH2D *rphi =
new TH2D(
"rphi",
"Cluster map",2000, -79.0, 79.0, 2000, -79.0, 79.0);
72 rphi->GetYaxis()->SetTitle(
"Y (cm)");
73 rphi->GetXaxis()->SetTitle(
"X (cm)");
75 TH2D *
zphi =
new TH2D(
"zphi",
"Cluster z-phi map",120, -120.0, 120.0, 500, -2.0, 5.0);
76 zphi->GetYaxis()->SetTitle(
"#phi");
77 zphi->GetXaxis()->SetTitle(
"Z (cm)");
79 TH2D *delta_rphi =
new TH2D(
"delta_rphi",
"cluster r#phi errors by layer",60.0, 0.0, 60.0, 2000, -0.1, 0.1);
80 delta_rphi->GetYaxis()->SetTitle(
"Cluster r#phi Error (cm)");
81 delta_rphi->GetXaxis()->SetTitle(
"Tracking Layer");
83 TH2D *
delta_phi =
new TH2D(
"delta_phi",
"cluster #phi errors by layer",60.0, 0.0, 60.0, 2000, -0.002, 0.002);
84 delta_phi->GetYaxis()->SetTitle(
"Cluster #phi Error (rad)");
85 delta_phi->GetXaxis()->SetTitle(
"Tracking Layer");
87 TH2D *delta_phi_gphi =
new TH2D(
"delta_phi_gphi",
"cluster #phi errors by gphi",2000.0, -0.1, 0.1, 2000, -0.002, 0.002);
88 delta_phi_gphi->GetYaxis()->SetTitle(
"Cluster #phi Error (rad)");
89 delta_phi_gphi->GetXaxis()->SetTitle(
"Truth #phi");
91 TH2D *delta_z =
new TH2D(
"delta_z",
"cluster Z errors by layer",60.0, 0.0, 60.0, 20000, -1.0, 1.0);
92 delta_z->GetYaxis()->SetTitle(
"Cluster Z Error (cm)");
93 delta_z->GetXaxis()->SetTitle(
"Tracking Layer");
95 TH2D *cluster_size =
new TH2D(
"cluster_size",
"cluster size by layer",60.0, 0.0, 60.0, 200, 0.0, 15.0);
96 cluster_size->GetYaxis()->SetTitle(
"Cluster Size (hits)");
97 cluster_size->GetXaxis()->SetTitle(
"Tracking Layer");
99 TH2D *clusters_layer =
new TH2D(
"clusters_layer",
"cluster eta by layer",50.0, 0.0, 50.0, 200, -3.0, 3.0);
100 clusters_layer->GetYaxis()->SetTitle(
"Cluster eta");
101 clusters_layer->GetXaxis()->SetTitle(
"Tracking Layer");
103 TH2D *hzsize =
new TH2D(
"hzsize",
"cluster Z size vs nparticles",100, 0.0, 6.0, 200, 0.0, 7.0);
104 hzsize->GetXaxis()->SetTitle(
"Cluster Z Size (cm)");
105 hzsize->GetYaxis()->SetTitle(
"nparticles");
109 double nclusters = 0;
112 for(
int i=0;
i <100;
i++)
115 TChain *ntp_vertex =
new TChain(
"ntp_vertex",
"clusters");
116 TChain *ntp_cluster =
new TChain(
"ntp_cluster",
"clusters");
117 TChain *
ntp_gtrack =
new TChain(
"ntp_gtrack",
"clusters");
118 TChain *ntp_track =
new TChain(
"ntp_track",
"clusters");
119 TChain *ntp_g4hit =
new TChain(
"ntp_g4hit",
"clusters");
125 sprintf(name,
"/sphenix/user/frawley/cluster_efficiency/macros/macros/g4simulations/screwed_up_tracks_out/g4svtx_eval_%i.root_g4svtx_eval.root",
i);
129 cout <<
"Enter file loop with name = " << name << endl;
136 ntp_vertex->Add(name);
138 for(
int cl=0;cl<ntp_vertex->GetEntries();cl++)
140 ntp_vertex->GetEntry(cl);
146 cout <<
" -- bad reco event vertex in one of the events, skip this file. vz = " <<
evz <<
" gvz = " <<
egvz << endl;
152 ntp_cluster->Add(name);
155 cout <<
" ntp_cluster entries = " << ntp_cluster->GetEntries() << endl;
158 for(
int p=0;
p < ntp_cluster->GetEntries();
p++)
160 ntp_cluster->GetEntry(
p);
172 double drphi =
r *
dphi;
179 delta_rphi->Fill( (
double)
layer, drphi);
180 delta_phi->Fill( (
double) layer, dphi);
181 delta_z->Fill( (
double) layer, dz);
182 if(layer > 38) delta_phi_gphi->Fill(tphi,dphi);
194 TF1 *
fg =
new TF1(
"fg",
"gaus(0)",-0.05,0.05);
195 fg->SetLineColor(kRed);
196 fg->SetParameter(0, 100.0);
197 fg->SetParameter(1, 0.0);
198 fg->SetParameter(2, 2
e-02);
201 TCanvas *c7 =
new TCanvas(
"c7",
"c7",50,50,1200,800);
205 gPad->SetLeftMargin(0.12);
206 gPad->SetRightMargin(0.01);
207 TH1D *hpy3 =
new TH1D(
"hpy3",
"TPC inner clusters",2000,-0.10, 0.10);
208 delta_rphi->ProjectionY(
"hpy3",n_maps_layers+n_intt_layers+1,n_maps_layers+n_intt_layers+n_tpc_layers_inner);
209 hpy3->GetXaxis()->SetRangeUser(-0.04, 0.04);
210 hpy3->GetXaxis()->SetNdivisions(506);
211 hpy3->GetXaxis()->SetTitle(
"r#phi cluster error (cm)");
212 hpy3->GetXaxis()->SetTitleOffset(1.1);
213 hpy3->GetXaxis()->SetTitleSize(0.05);
214 hpy3->GetXaxis()->SetLabelSize(0.06);
215 hpy3->GetYaxis()->SetLabelSize(0.06);
220 double rms3 = fg->GetParameter(2) * 10000.0;
221 double rms3_err = fg->GetParError(2) * 10000.0;
222 sprintf(label,
"RMS %.1f #pm %.1f #mu m",rms3, rms3_err);
223 TLatex *l3 =
new TLatex(0.45,0.92,label);
228 gPad->SetLeftMargin(0.12);
229 gPad->SetRightMargin(0.01);
230 TH1D *hpy4 =
new TH1D(
"hpy4",
"TPC mid clusters",2000,-0.10, 0.10);
231 delta_rphi->ProjectionY(
"hpy4",n_maps_layers+n_intt_layers+n_tpc_layers_inner+1,n_maps_layers+n_intt_layers+n_tpc_layers_inner+n_tpc_layers_mid);
232 hpy4->GetXaxis()->SetRangeUser(-0.04, 04);
233 hpy4->GetXaxis()->SetNdivisions(506);
234 hpy4->GetXaxis()->SetTitle(
"r#phi cluster error (cm)");
235 hpy4->GetXaxis()->SetTitleOffset(1.1);
236 hpy4->GetXaxis()->SetTitleSize(0.05);
237 hpy4->GetXaxis()->SetLabelSize(0.06);
238 hpy4->GetYaxis()->SetLabelSize(0.06);
243 double rms4 = fg->GetParameter(2) * 10000.0;
244 double rms4_err = fg->GetParError(2) * 10000.0;
245 sprintf(label,
"RMS %.1f #pm %.1f #mu m",rms4, rms4_err);
246 TLatex *l4 =
new TLatex(0.45,0.92,label);
251 gPad->SetLeftMargin(0.12);
252 gPad->SetRightMargin(0.01);
253 TH1D *hpy5 =
new TH1D(
"hpy5",
"TPC outer clusters",2000,-0.10, 0.10);
254 delta_rphi->ProjectionY(
"hpy5",n_maps_layers+n_intt_layers+n_tpc_layers_inner+n_tpc_layers_mid+1,n_maps_layers+n_intt_layers+n_tpc_layers_inner+n_tpc_layers_mid+n_tpc_layers_outer);
256 hpy5->GetXaxis()->SetNdivisions(506);
257 hpy5->GetXaxis()->SetTitle(
"r#phi cluster error (cm)");
258 hpy5->GetXaxis()->SetTitleOffset(1.1);
259 hpy5->GetXaxis()->SetTitleSize(0.05);
260 hpy5->GetXaxis()->SetLabelSize(0.06);
261 hpy5->GetYaxis()->SetLabelSize(0.06);
266 double rms5 = fg->GetParameter(2) * 10000.0;
267 double rms5_err = fg->GetParError(2) * 10000.0;
268 sprintf(label,
"RMS %.1f #pm %.1f #mu m",rms5, rms5_err);
269 TLatex *l5 =
new TLatex(0.45,0.92,label);
274 TCanvas *c27 =
new TCanvas(
"c27",
"c27",50,50,1200,800);
278 gPad->SetLeftMargin(0.12);
279 gPad->SetRightMargin(0.01);
280 TH1D *hpz1 =
new TH1D(
"hpz1",
"MVTX clusters Z",500, -1.0, 1.0);
281 delta_z->ProjectionY(
"hpz1",1, n_maps_layers);
282 hpz1->GetXaxis()->SetTitle(
"Z cluster error (cm)");
283 hpz1->SetTitleOffset(0.1,
"X");
284 hpz1->GetXaxis()->SetTitleSize(0.05);
285 hpz1->GetXaxis()->SetLabelSize(0.06);
286 hpz1->GetYaxis()->SetLabelSize(0.06);
287 hpz1->GetXaxis()->SetNdivisions(506);
288 hpz1->GetXaxis()->SetTitleOffset(1.1);
289 hpz1->GetXaxis()->SetRangeUser(-0.0016, 0.0016);
291 double zrms1 = 10000.0 * hpz1->GetRMS();
293 sprintf(label,
"RMS %.1f #mu m",zrms1);
294 TLatex *lz1 =
new TLatex(0.55,0.92,label);
299 gPad->SetLeftMargin(0.12);
300 gPad->SetRightMargin(0.01);
302 TH1D *hpz2 =
new TH1D(
"hpz2",
"INTT clusters Z",500, -0.020, 0.020);
303 delta_z->ProjectionY(
"hpz2",n_maps_layers+1,n_maps_layers+1);
304 hpz2->GetXaxis()->SetRangeUser(-0.02, 0.02);
305 hpz2->GetXaxis()->SetTitle(
"Z cluster error (cm)");
306 hpz2->GetXaxis()->SetTitleOffset(0.6);
307 hpz2->GetXaxis()->SetTitleSize(0.05);
308 hpz2->GetXaxis()->SetLabelSize(0.06);
309 hpz2->GetYaxis()->SetLabelSize(0.06);
310 hpz2->GetXaxis()->SetNdivisions(506);
311 hpz2->GetXaxis()->SetTitleOffset(1.1);
313 double zrms2 = 10000 * hpz2->GetRMS();
314 sprintf(label,
"RMS %.1f #mu m",zrms2);
315 TLatex *lz2 =
new TLatex(0.55,0.92,label);
320 gPad->SetLeftMargin(0.12);
321 gPad->SetRightMargin(0.01);
322 TH1D *hpz3 =
new TH1D(
"hpz3",
"TPC inner clusters Z",500,-0.2, 0.2);
323 delta_z->ProjectionY(
"hpz3",n_maps_layers+n_intt_layers+1, n_maps_layers+n_intt_layers+n_tpc_layers_inner);
324 hpz3->GetXaxis()->SetNdivisions(506);
325 hpz3->GetXaxis()->SetTitle(
"Z cluster error (cm)");
326 hpz3->GetXaxis()->SetTitleOffset(1.1);
327 hpz3->GetXaxis()->SetTitleSize(0.05);
328 hpz3->GetXaxis()->SetLabelSize(0.06);
329 hpz3->GetYaxis()->SetLabelSize(0.06);
330 hpz3->GetXaxis()->SetRangeUser(-0.2, 0.2);
332 double zrms3 = 10000 * hpz3->GetRMS();
333 sprintf(label,
"RMS %.1f #mu m",zrms3);
334 TLatex *lz3 =
new TLatex(0.55,0.92,label);
339 gPad->SetLeftMargin(0.12);
340 gPad->SetRightMargin(0.01);
341 TH1D *hpz4 =
new TH1D(
"hpz4",
"TPC mid clusters Z",500,-0.2, 0.2);
342 delta_z->ProjectionY(
"hpz4",n_maps_layers+n_intt_layers+n_tpc_layers_inner+1, n_maps_layers+n_intt_layers+n_tpc_layers_inner+n_tpc_layers_mid);
343 hpz4->GetXaxis()->SetNdivisions(506);
344 hpz4->GetXaxis()->SetTitle(
"Z cluster error (cm)");
345 hpz4->GetXaxis()->SetTitleOffset(1.1);
346 hpz4->GetXaxis()->SetTitleSize(0.05);
347 hpz4->GetXaxis()->SetLabelSize(0.06);
348 hpz4->GetYaxis()->SetLabelSize(0.06);
349 hpz4->GetXaxis()->SetRangeUser(-0.2, 0.2);
351 double zrms4 = 10000 * hpz4->GetRMS();
352 sprintf(label,
"RMS %.1f #mu m",zrms4);
353 TLatex *lz4 =
new TLatex(0.55,0.92,label);
358 gPad->SetLeftMargin(0.12);
359 gPad->SetRightMargin(0.01);
360 TH1D *hpz5 =
new TH1D(
"hpz5",
"TPC outer clusters Z",500,-0.2, 0.2);
361 delta_z->ProjectionY(
"hpz5",n_maps_layers+n_intt_layers+n_tpc_layers_inner+n_tpc_layers_mid+1, n_maps_layers+n_intt_layers+n_tpc_layers_inner+n_tpc_layers_mid+n_tpc_layers_outer);
362 hpz5->GetXaxis()->SetNdivisions(506);
363 hpz5->GetXaxis()->SetTitle(
"Z cluster error (cm)");
364 hpz5->GetXaxis()->SetTitleOffset(1.1);
365 hpz5->GetXaxis()->SetTitleSize(0.05);
366 hpz5->GetXaxis()->SetLabelSize(0.06);
367 hpz5->GetYaxis()->SetLabelSize(0.06);
368 hpz5->GetXaxis()->SetRangeUser(-0.2, 0.2);
370 double zrms5 = 10000 * hpz5->GetRMS();
371 sprintf(label,
"RMS %.1f #mu m",zrms5);
372 TLatex *lz5 =
new TLatex(0.55,0.92,label);
378 TCanvas *c6 =
new TCanvas(
"c6",
"c6",50,50,1200,800);
381 gPad->SetLeftMargin(0.12);
382 gPad->SetRightMargin(0.01);
383 TH1D *hpy1 =
new TH1D(
"hpy1",
"MVTX clusters",2000, -0.05, 0.05);
384 delta_rphi->ProjectionY(
"hpy1",1,n_maps_layers);
387 hpy1->GetXaxis()->SetRangeUser(-0.002, 0.002);
388 hpy1->GetXaxis()->SetTitle(
"r#phi cluster error (cm)");
389 hpy1->SetTitleOffset(0.1,
"X");
390 hpy1->GetXaxis()->SetTitleSize(0.05);
391 hpy1->GetXaxis()->SetLabelSize(0.06);
392 hpy1->GetYaxis()->SetLabelSize(0.06);
393 hpy1->GetXaxis()->SetNdivisions(506);
394 hpy1->GetXaxis()->SetTitleOffset(1.1);
396 double rms1 = 10000.0 * hpy1->GetRMS();
397 sprintf(label,
"RMS %.1f #mu m",rms1);
398 TLatex *
l1 =
new TLatex(0.55,0.92,label);
405 gPad->SetLeftMargin(0.12);
406 gPad->SetRightMargin(0.01);
407 TH1D *hpy2 =
new TH1D(
"hpy2",
"INTT clusters (type 1)",2000, -0.05, 0.05);
408 delta_rphi->ProjectionY(
"hpy2",n_maps_layers+2,n_maps_layers + n_intt_layers);
409 hpy2->GetXaxis()->SetRangeUser(-0.011, 0.011);
410 hpy2->GetXaxis()->SetTitle(
"r#phi cluster error (cm)");
411 hpy2->GetXaxis()->SetTitleOffset(0.6);
412 hpy2->GetXaxis()->SetTitleSize(0.05);
413 hpy2->GetXaxis()->SetLabelSize(0.06);
414 hpy2->GetYaxis()->SetLabelSize(0.06);
415 hpy2->GetXaxis()->SetNdivisions(506);
416 hpy2->GetXaxis()->SetTitleOffset(1.1);
418 double rms2 = 10000 * hpy2->GetRMS();
419 sprintf(label,
"RMS %.1f #mu m",rms2);
420 TLatex *
l2 =
new TLatex(0.55,0.92,label);