FairRoot/PandaRoot
plot_eta_c_stt.C
Go to the documentation of this file.
1 {
2  bool saveHistos=false;
3  TString inFile="etac_histo_stt.root";
4 
5  TFile *f = TFile::Open(inFile);
6 
7  TH1F *h_etac_nocut=(TH1F *)f->Get("h_etac_nocut");
8  TH1F *h_etac_pid=(TH1F *)f->Get("h_etac_pid");
9  TH1F *h_etac_vtx=(TH1F *)f->Get("h_etac_vtx");
10  TH1F *h_etac_4c=(TH1F *)f->Get("h_etac_4c");
11  TH1F *h_etac_phimass_4c=(TH1F *)f->Get("h_etac_phimass_4c");
12  TH1F *h_etac_phimass_vtx=(TH1F *)f->Get("h_etac_phimass_vtx");
13 
14  TH1F *h_mphi_nocuts=(TH1F *)f->Get("h_mphi_nocuts");
15  TH1F *h_mphi_pid=(TH1F *)f->Get("h_mphi_pid");
16  TH1F *h_mphi_vtx=(TH1F *)f->Get("h_mphi_vtx");
17  TH1F *h_mphi_4c=(TH1F *)f->Get("h_mphi_4c");
18  TH1F *h_mphi_final_4c=(TH1F *)f->Get("h_mphi_final_4c");
19  TH1F *h_mphi_final_vtx=(TH1F *)f->Get("h_mphi_final_vtx");
20 
21  TH1F *h_etac_phimass_vtx_2=(TH1F *)f->Get("h_etac_phimass_vtx_2");
22  TH1F *h_mphi_vtx_2=(TH1F *)f->Get("h_mphi_vtx_2");
23  TH1F *h_mphi_final_vtx_2=(TH1F *)f->Get("h_mphi_final_vtx_2");
24 
25  TH1F *n_etac_vtx_2=(TH1F *)f->Get("n_etac_vtx_2");
26  TH1F *h_chi2_prefit=(TH1F *)f->Get("h_chi2_prefit");
27 
28  TH1F *nc=(TH1F *)f->Get("nc");
29 
30  TH1F *h_chi2_4c=(TH1F *)f->Get("h_chi2_4c");
31  TH1F *h_chi2b_4c=(TH1F *)f->Get("h_chi2b_4c");
32 
33  TH1F *h_chi2_vtx=(TH1F *)f->Get("h_chi2_vtx");
34  TH1F *h_chi2b_vtx=(TH1F *)f->Get("h_chi2b_vtx");
35  TH1F *hvzpos=(TH1F *)f->Get("hvzpos");
36  TH2F *hvpos=(TH2F *)f->Get("hvpos");
37 
38  TH1F *hvtxresX=(TH1F *)f->Get("hvtxresX");
39  TH1F *hvtxresY=(TH1F *)f->Get("hvtxresY");
40  TH1F *hvtxresZ=(TH1F *)f->Get("hvtxresZ");
41 
42  TH1F *n_etac_4c=(TH1F *)f->Get("n_etac_4c");
43  TH1F *n_etac_vtx=(TH1F *)f->Get("n_etac_vtx");
44  TH1F *n_events=(TH1F *)f->Get("n_events");
45 
46  double eff1=n_etac_4c->GetBinContent(1)/n_events->GetBinContent(1);
47  std::cout<<"Efficiency (4C-fit) = "<<eff1<<std::endl;
48  double eff2=n_etac_vtx->GetBinContent(1)/n_events->GetBinContent(1);
49  std::cout<<"Efficiency (vertex fit) = "<<eff2<<std::endl;
50 
51  double eff3=n_etac_vtx_2->GetBinContent(1)/n_events->GetBinContent(1);
52  std::cout<<"Efficiency (vertex fit, prefit selection) = "<<eff3<<std::endl;
53 
54  // Max efficiency
55  // Numebr of events with >=4 reconstructed tracks
56  std::cout<<"Max efficiency="<<nc->Integral(5,20)/nc->GetEntries()<<std::endl;
57 
58  TCanvas *c1=new TCanvas("c1","N charged",600,600);
59  nc->Draw();
60  if (saveHistos) c1->SaveAs("n_charged_stt.png");
61 
62  TCanvas *c2=new TCanvas("c2","No cuts",600,600);
63  c2->Divide(1,2);
64  c2->cd(1);
65  h_mphi_nocuts->SetTitleSize(18);
66  h_mphi_nocuts->GetXaxis()->SetTitleSize(0.05);
67  h_mphi_nocuts->GetXaxis()->SetLabelSize(0.06);
68  h_mphi_nocuts->GetXaxis()->SetTitleSize(0.05);
69  h_mphi_nocuts->GetYaxis()->SetLabelSize(0.06);
70  h_mphi_nocuts->Draw();
71  TLine *l1=new TLine(1.12,0,1.12,35000);
72  l1->SetLineColor(2);
73  l1->SetLineWidth(2);
74  l1->Draw();
75 
76  c2->cd(2);
77  h_etac_nocut->SetTitleSize(18);
78  h_etac_nocut->GetXaxis()->SetTitleSize(0.05);
79  h_etac_nocut->GetXaxis()->SetLabelSize(0.06);
80  h_etac_nocut->GetXaxis()->SetTitleSize(0.05);
81  h_etac_nocut->GetYaxis()->SetLabelSize(0.06);
82  h_etac_nocut->Draw();
83  if (saveHistos) c2->SaveAs("m_nocuts_stt.png");
84 
85  TCanvas *c3=new TCanvas("c3","MC PID",600,600);
86  c3->Divide(1,2);
87  c3->cd(1);
88  h_mphi_pid->SetTitleSize(18);
89  h_mphi_pid->GetXaxis()->SetTitleSize(0.05);
90  h_mphi_pid->GetXaxis()->SetLabelSize(0.06);
91  h_mphi_pid->GetXaxis()->SetTitleSize(0.05);
92  h_mphi_pid->GetYaxis()->SetLabelSize(0.06);
93  h_mphi_pid->Draw();
94 
95  TLine *l2=new TLine(1.12,0,1.12,35000);
96  l2->SetLineColor(2);
97  l2->SetLineWidth(2);
98  l2->Draw();
99 
100  c3->cd(2);
101  h_etac_pid->SetTitleSize(18);
102  h_etac_pid->GetXaxis()->SetTitleSize(0.05);
103  h_etac_pid->GetXaxis()->SetLabelSize(0.06);
104  h_etac_pid->GetXaxis()->SetTitleSize(0.05);
105  h_etac_pid->GetYaxis()->SetLabelSize(0.06);
106  h_etac_pid->Draw();
107  if (saveHistos) c3->SaveAs("m_pid_stt.png");
108 
110 // TCanvas *c4=new TCanvas("c4","chi2 (4C-fit)",600,600);
111 // c4->Divide(2,1);
112 // c4->cd(1);
113 // h_chi2_4c->Draw();
114 // c4->cd(2);
115 // h_chi2b_4c->Draw();
116 // if (saveHistos) c4->SaveAs("chi2_4c_stt.png");
117 //
118 // TCanvas *c5=new TCanvas("c5","m (4C-fit)",600,600);
119 // c5->Divide(1,2);
120 // c5->cd(1);
121 // h_mphi_4c->Draw();
122 // c5->cd(2);
123 // h_etac_4c->Draw();
124 // if (saveHistos) c5->SaveAs("m_4c_stt.png");
125 
127  TCanvas *c6=new TCanvas("c6","Vertex position",600,600);
128  c6->Divide(2,1);
129  c6->cd(1);
130  hvpos->Draw();
131  c6->cd(2);
132  hvzpos->Draw();
133  if (saveHistos) c6->SaveAs("vertex_pos_stt.png");
134 
135 // TCanvas *c7=new TCanvas("c7","Vertex fit chi2",600,600);
136 // c7->Divide(2,1);
137 // c7->cd(1);
138 // h_chi2_vtx->Draw();
139 // c7->cd(2);
140 // h_chi2b_vtx->Draw();
141 // if (saveHistos) c7->SaveAs("chi2_vtx_stt.png");
142 
143  TCanvas *c8=new TCanvas("c8","Vertex resolution",600,600);
144  c8->Divide(2,2);
145  c8->cd(1);
146  hvtxresX->Draw();
147 
148  TF1 *f1_vtxx= new TF1("f1_vtxx","gaus",-1.,1.);
149  hvtxresX->Fit(f1_vtxx,"R","",-1,1.);
150  double mean_x=f1_vtxx->GetParameter(1);
151  double sigma_x=f1_vtxx->GetParameter(2);
152  TF1 *f2_vtxx= new TF1("f2_vtxx","gaus",-1.,1.);
153  hvtxresX->Fit(f2_vtxx,"R","",mean_x-1.6*sigma_x,mean_x+1.6*sigma_x);
154  double mean_x2=f2_vtxx->GetParameter(1);
155  double sigma_x2=f2_vtxx->GetParameter(2);
156  std::cout<<"!!!!!!!!!! vertex x resolution = "<<sigma_x2<<std::endl;
157 
158  c8->cd(2);
159  hvtxresY->Draw();
160  TF1 *f1_vtxy= new TF1("f1_vtxy","gaus",-1.,1.);
161  hvtxresY->Fit(f1_vtxy,"R","",-1,1.);
162  double mean_y=f1_vtxy->GetParameter(1);
163  double sigma_y=f1_vtxy->GetParameter(2);
164  TF1 *f2_vtxy= new TF1("f2_vtxy","gaus",-1.,1.);
165  hvtxresY->Fit(f2_vtxy,"R","",mean_y-1.6*sigma_y,mean_y+1.6*sigma_y);
166  double mean_y2=f2_vtxy->GetParameter(1);
167  double sigma_y2=f2_vtxy->GetParameter(2);
168  std::cout<<"!!!!!!!!!! vertex y resolution = "<<sigma_y2<<std::endl;
169 
170  c8->cd(3);
171  hvtxresZ->Draw();
172  TF1 *f1_vtxz= new TF1("f1_vtxz","gaus",-1.,1.);
173  hvtxresZ->Fit(f1_vtxz,"R","",-1,1.);
174  double mean_z=f1_vtxz->GetParameter(1);
175  double sigma_z=f1_vtxz->GetParameter(2);
176  TF1 *f2_vtxz= new TF1("f2_vtxz","gaus",-1.,1.);
177  hvtxresZ->Fit(f2_vtxz,"R","",mean_z-1.6*sigma_z,mean_z+1.6*sigma_z);
178  double mean_z2=f2_vtxz->GetParameter(1);
179  double sigma_z2=f2_vtxz->GetParameter(2);
180  std::cout<<"!!!!!!!!!! vertex z resolution = "<<sigma_z2<<std::endl;
181 
182 
183  if (saveHistos) c8->SaveAs("vertex_res_stt.png");
184 
185  TCanvas *c9=new TCanvas("c9","m vertex",600,600);
186  c9->Divide(1,2);
187  c9->cd(1);
188  h_mphi_vtx->SetTitleSize(18);
189  h_mphi_vtx->GetXaxis()->SetTitleSize(0.05);
190  h_mphi_vtx->GetXaxis()->SetLabelSize(0.06);
191  h_mphi_vtx->GetXaxis()->SetTitleSize(0.05);
192  h_mphi_vtx->GetYaxis()->SetLabelSize(0.06);
193  h_mphi_vtx->Draw();
194  c9->cd(2);
195  h_etac_vtx->SetTitleSize(18);
196  h_etac_vtx->GetXaxis()->SetTitleSize(0.05);
197  h_etac_vtx->GetXaxis()->SetLabelSize(0.06);
198  h_etac_vtx->GetXaxis()->SetTitleSize(0.05);
199  h_etac_vtx->GetYaxis()->SetLabelSize(0.06);
200  h_etac_vtx->Draw();
201  if (saveHistos) c9->SaveAs("m_vtx_stt.png");
202 
203 
204  double mean_phi, range_phi, sigma1_phi, mean1_phi, sigma2_phi, mean_etac, range_etac;
205  double sigma1, mean1, sigma2;
206 
208 // TCanvas *c10=new TCanvas("c10","Mass final (4C-fit)",600,600);
209 // c10->Divide(1,2);
210 // c10->cd(1);
211 // h_mphi_final_4c->Draw();
212 //
213 // mean_phi=1.02;
214 // range_phi=0.02;
215 //
216 // TF1 *f1_phi_4c = new TF1("f1_phi_4c","gaus",0.9,1.1);
217 // h_mphi_final_4c->Fit(f1_phi_4c,"R","",mean_phi-range_phi,mean_phi+range_phi);
218 //
219 // sigma1_phi=f1_phi_4c->GetParameter(2);
220 // mean1_phi=f1_phi_4c->GetParameter(1);
221 //
222 // TF1 *f2_phi_4c = new TF1("f2_phi_4c","gaus",0.9,1.1);
223 // h_mphi_final_4c->Fit(f2_phi_4c,"R","",mean1_phi-1.6*sigma1_phi,mean1_phi+1.6*sigma1_phi);
224 //
225 // sigma2_phi=f2_phi_4c->GetParameter(2);
226 // std::cout<<"!!!!!!!!!!!!!!!! sigma phi (4c-fit)="<<sigma2_phi<<std::endl;
227 //
228 // c10->cd(2);
229 // h_etac_phimass_4c->Draw();
230 // // fit eta_c
231 // mean_etac=2.98;
232 // range_etac=0.1;
233 //
234 // TF1 *f1_4c = new TF1("f1_4c","gaus",2.8,3.2);
235 // h_etac_phimass_4c->Fit(f1_4c,"R","",mean_etac-range_etac,mean_etac+range_etac);
236 //
237 // sigma1=f1_4c->GetParameter(2);
238 // mean1=f1_4c->GetParameter(1);
239 //
240 // TF1 *f2_4c = new TF1("f2_4c","gaus",2.8,3.2);
241 // h_etac_phimass_4c->Fit(f2_4c,"R","",mean1-1.6*sigma1,mean1+1.6*sigma1);
242 //
243 // sigma2=f2_4c->GetParameter(2);
244 // std::cout<<"!!!!!!!!!!!!! sigma eta_c (4c-fit) ="<<sigma2<<std::endl;
245 //
246 // if (saveHistos) c10->SaveAs("m_final_4c_stt.png");
247 
249  TCanvas *c11=new TCanvas("c11","Mass final (Vertex fit)",600,600);
250  c11->Divide(1,2);
251  c11->cd(1);
252  h_mphi_final_vtx->SetTitleSize(18);
253  h_mphi_final_vtx->GetXaxis()->SetTitleSize(0.05);
254  h_mphi_final_vtx->GetXaxis()->SetLabelSize(0.06);
255  h_mphi_final_vtx->GetXaxis()->SetTitleSize(0.05);
256  h_mphi_final_vtx->GetYaxis()->SetLabelSize(0.06);
257 
258  h_mphi_final_vtx->Draw();
259 
260  mean_phi=1.02;
261  range_phi=0.02;
262 
263  TF1 *f1_phi_vtx = new TF1("f1_phi_vtx","gaus",0.9,1.1);
264  h_mphi_final_vtx->Fit(f1_phi_vtx,"R","",mean_phi-range_phi,mean_phi+range_phi);
265 
266  sigma1_phi=f1_phi_vtx->GetParameter(2);
267  mean1_phi=f1_phi_vtx->GetParameter(1);
268 
269  TF1 *f2_phi_vtx = new TF1("f2_phi_vtx","gaus",0.9,1.1);
270  h_mphi_final_vtx->Fit(f2_phi_vtx,"R","",mean1_phi-1.6*sigma1_phi,mean1_phi+1.6*sigma1_phi);
271 
272  sigma2_phi=f2_phi_vtx->GetParameter(2);
273  std::cout<<"!!!!!!!!!!!! sigma phi (vertex fit)="<<sigma2_phi<<std::endl;
274 
275  TLine *l3=new TLine(1.0,0,1.0,7000);
276  l3->SetLineColor(4);
277  l3->SetLineWidth(2);
278  l3->Draw();
279 
280  TLine *l4=new TLine(1.04,0,1.04,7000);
281  l4->SetLineColor(4);
282  l4->SetLineWidth(2);
283  l4->Draw();
284 
285 
286  c11->cd(2);
287  h_etac_phimass_vtx->SetTitleSize(18);
288  h_etac_phimass_vtx->GetXaxis()->SetTitleSize(0.05);
289  h_etac_phimass_vtx->GetXaxis()->SetLabelSize(0.06);
290  h_etac_phimass_vtx->GetXaxis()->SetTitleSize(0.05);
291  h_etac_phimass_vtx->GetYaxis()->SetLabelSize(0.06);
292 
293  h_etac_phimass_vtx->Draw();
294  // fit eta_c
295  mean_etac=2.98;
296  range_etac=0.1;
297 
298  TF1 *f1_vtx = new TF1("f1_vtx","gaus",2.8,3.2);
299  h_etac_phimass_vtx->Fit(f1_vtx,"R","",mean_etac-range_etac,mean_etac+range_etac);
300 
301  sigma1=f1_vtx->GetParameter(2);
302  mean1=f1_vtx->GetParameter(1);
303 
304  TF1 *f2_vtx = new TF1("f2_vtx","gaus",2.8,3.2);
305  h_etac_phimass_vtx->Fit(f2_vtx,"R","",mean1-1.6*sigma1,mean1+1.6*sigma1);
306 
307  sigma2=f2_vtx->GetParameter(2);
308  std::cout<<"!!!!!!!!!!!!!!! sigma eta_c (vertex fit) ="<<sigma2<<std::endl;
309 
310  TLine *l5=new TLine(2.9,0,2.9,1200);
311  l5->SetLineColor(4);
312  l5->SetLineWidth(2);
313  l5->Draw();
314 
315  TLine *l6=new TLine(3.06,0,3.06,1200);
316  l6->SetLineColor(4);
317  l6->SetLineWidth(2);
318  l6->Draw();
319 
320  if (saveHistos) c11->SaveAs("m_final_vtx_stt.png");
321 
324 // TCanvas *c54=new TCanvas("c54","chi2 (prefit selection)",600,600);
325 // h_chi2_prefit->Draw();
326 //
327 // TCanvas *c51=new TCanvas("c51","Mass final (Vertex fit)",600,600);
328 // c51->Divide(1,2);
329 // c51->cd(1);
330 // h_mphi_final_vtx_2->SetTitleSize(18);
331 // h_mphi_final_vtx_2->GetXaxis()->SetTitleSize(0.05);
332 // h_mphi_final_vtx_2->GetXaxis()->SetLabelSize(0.06);
333 // h_mphi_final_vtx_2->GetXaxis()->SetTitleSize(0.05);
334 // h_mphi_final_vtx_2->GetYaxis()->SetLabelSize(0.06);
335 //
336 // h_mphi_final_vtx_2->Draw();
337 //
338 // mean_phi=1.02;
339 // range_phi=0.02;
340 //
341 // TF1 *f1_phi_vtx_2 = new TF1("f1_phi_vtx_2","gaus",0.9,1.1);
342 // h_mphi_final_vtx_2->Fit(f1_phi_vtx_2,"R","",mean_phi-range_phi,mean_phi+range_phi);
343 //
344 // sigma1_phi=f1_phi_vtx_2->GetParameter(2);
345 // mean1_phi=f1_phi_vtx_2->GetParameter(1);
346 //
347 // TF1 *f2_phi_vtx_2 = new TF1("f2_phi_vtx_2","gaus",0.9,1.1);
348 // h_mphi_final_vtx_2->Fit(f2_phi_vtx_2,"R","",mean1_phi-1.6*sigma1_phi,mean1_phi+1.6*sigma1_phi);
349 //
350 // sigma2_phi=f2_phi_vtx_2->GetParameter(2);
351 // std::cout<<"!!!!!!!!!!!! sigma phi (vertex fit)="<<sigma2_phi<<std::endl;
352 //
353 // TLine *l3=new TLine(1.0,0,1.0,7000);
354 // l3->SetLineColor(4);
355 // l3->SetLineWidth(2);
356 // l3->Draw();
357 //
358 // TLine *l4=new TLine(1.04,0,1.04,7000);
359 // l4->SetLineColor(4);
360 // l4->SetLineWidth(2);
361 // l4->Draw();
362 //
363 //
364 // c51->cd(2);
365 // h_etac_phimass_vtx_2->SetTitleSize(18);
366 // h_etac_phimass_vtx_2->GetXaxis()->SetTitleSize(0.05);
367 // h_etac_phimass_vtx_2->GetXaxis()->SetLabelSize(0.06);
368 // h_etac_phimass_vtx_2->GetXaxis()->SetTitleSize(0.05);
369 // h_etac_phimass_vtx_2->GetYaxis()->SetLabelSize(0.06);
370 //
371 // h_etac_phimass_vtx_2->Draw();
372 // // fit eta_c
373 // mean_etac=2.98;
374 // range_etac=0.1;
375 //
376 // TF1 *f1_vtx_2 = new TF1("f1_vtx_2","gaus",2.8,3.2);
377 // h_etac_phimass_vtx_2->Fit(f1_vtx_2,"R","",mean_etac-range_etac,mean_etac+range_etac);
378 //
379 // sigma1=f1_vtx_2->GetParameter(2);
380 // mean1=f1_vtx_2->GetParameter(1);
381 //
382 // TF1 *f2_vtx_2 = new TF1("f2_vtx_2","gaus",2.8,3.2);
383 // h_etac_phimass_vtx_2->Fit(f2_vtx_2,"R","",mean1-1.6*sigma1,mean1+1.6*sigma1);
384 //
385 // sigma2=f2_vtx_2->GetParameter(2);
386 // std::cout<<"!!!!!!!!!!!!!!! sigma eta_c (vertex fit) ="<<sigma2<<std::endl;
387 //
388 // TLine *l5=new TLine(2.9,0,2.9,1200);
389 // l5->SetLineColor(4);
390 // l5->SetLineWidth(2);
391 // l5->Draw();
392 //
393 // TLine *l6=new TLine(3.06,0,3.06,1200);
394 // l6->SetLineColor(4);
395 // l6->SetLineWidth(2);
396 // l6->Draw();
397 
398 
399 }
TH1F * h_mphi_final_vtx_2
double mean1_phi
Definition: plot_eta_c.C:86
TH1F * h_etac_4c
Definition: plot_eta_c.C:24
TCanvas * c11
TH1F * h_etac_pid
Definition: plot_eta_c.C:18
TH1F * hvtxresX
TH1F * h_mphi_nocuts
Definition: plot_eta_c.C:27
TH1F * nc
Definition: plot_eta_c.C:38
TH1F * h_chi2_prefit
TH2F * hvpos
Definition: plot_eta_c.C:47
double eff1
c2
Definition: plot_dirc.C:39
TH1F * h_etac_phimass_4c
TH1F * h_mphi_final_4c
TH1F * h_mphi_4c
Definition: plot_eta_c.C:33
TH1F * n_etac_vtx
TH1F * h_mphi_pid
Definition: plot_eta_c.C:29
TString inFile
Definition: hit_dirc.C:8
double mean_phi
Definition: plot_eta_c.C:79
TH1F * h_mphi_final_vtx
TH1F * h_chi2_vtx
Definition: plot_eta_c.C:43
TH1F * h_chi2_4c
Definition: plot_eta_c.C:41
double mean1
Definition: plot_eta_c.C:104
TH1F * h_chi2b_4c
double sigma2
Definition: plot_eta_c.C:109
TH1F * hvzpos
Definition: plot_eta_c.C:45
TH1F * h_etac_phimass_vtx
TFile * f
Definition: bump_analys.C:12
TH1F * h_etac_nocut
Definition: plot_eta_c.C:16
TH1F * h_etac_phimass_vtx_2
c1
Definition: plot_dirc.C:35
c3
Definition: plot_dirc.C:50
double sigma1_phi
Definition: plot_eta_c.C:85
TVectorD * n_events
Definition: plot_eta_c.C:14
TH1F * h_mphi_vtx_2
double sigma1
Definition: reco_analys2.C:57
TH1F * n_etac_vtx_2
TH1F * hvtxresZ
double sigma2_phi
Definition: plot_eta_c.C:91
TH1F * h_mphi_vtx
Definition: plot_eta_c.C:31
TH1F * h_chi2b_vtx
TH1F * h_etac_vtx
Definition: plot_eta_c.C:22
TCanvas * c8
TH1F * n_etac_4c
TH1F * hvtxresY