automatically write MC info into the trees when MC available
[u/mrichter/AliRoot.git] / PWGPP / macros / plotSparseGamma.C
1 {
2
3 TFile f("output/pp-trunk010709-pdc1-00XXX.root");
4 //TFile f("results_V0QA_v416rev08_090709.root");
5
6 THnSparseF* sparseV0;
7
8 sparseV0=(THnSparseF*)(outputTRD->FindObject("sparseV0"));
9
10 sparseV0->GetAxis(5)->SetRangeUser(0.,3.9);
11 sparseV0->GetAxis(9)->SetRangeUser(0.,3.9);
12
13
14 TH1* ptgeantPPhys=sparseV0->Projection(5);
15 TH1* etageantPPhys=sparseV0->Projection(6);
16 TH1* phigeantPPhys=sparseV0->Projection(7);
17
18 TH1* ptResSinglePPhys=sparseV0->Projection(13);
19 TH1* etasinglePPhys=sparseV0->Projection(14);
20 TH1* phisinglePPhys=sparseV0->Projection(15);
21
22
23 TH1* ptgeantNPhys=sparseV0->Projection(9);
24 TH1* etageantNPhys=sparseV0->Projection(10);
25 TH1* phigeantNPhys=sparseV0->Projection(11);
26
27 TH1* ptResSingleNPhys=sparseV0->Projection(21);
28 TH1* etasingleNPhys=sparseV0->Projection(22);
29 TH1* phisingleNPhys=sparseV0->Projection(23);
30
31 TH1* efiEtaSingPPhys=(TH1*) etageantPPhys->Clone();
32 efiEtaSingPPhys->Sumw2();
33 efiEtaSingPPhys->Divide(etasinglePPhys,etageantPPhys);
34 efiEtaSingPPhys->SetMinimum(0.);
35 efiEtaSingPPhys->SetMaximum(1.2);
36 efiEtaSingPPhys->SetAxisRange(-1.5,1.5);
37 efiEtaSingPPhys->SetMarkerStyle(20);
38 efiEtaSingPPhys->SetMarkerColor(2);
39
40
41
42 TH1* efiEtaSingNPhys=(TH1*) etageantNPhys->Clone();
43 efiEtaSingNPhys->Sumw2();
44 efiEtaSingNPhys->Divide(etasingleNPhys,etageantNPhys);
45 efiEtaSingNPhys->SetMinimum(0.);
46 efiEtaSingNPhys->SetMaximum(1.2);
47 efiEtaSingNPhys->SetAxisRange(-1.5,1.5);
48 efiEtaSingNPhys->SetMarkerStyle(20);
49 efiEtaSingNPhys->SetMarkerColor(2);
50
51
52
53 TH1* efiPhiSingPPhys=(TH1*) phigeantPPhys->Clone();
54 efiPhiSingPPhys->Sumw2();
55 efiPhiSingPPhys->Divide(phisinglePPhys,phigeantPPhys);
56 efiPhiSingPPhys->SetMinimum(0.);
57 efiPhiSingPPhys->SetMaximum(1.2);
58 efiPhiSingPPhys->SetAxisRange(-TMath::Pi(),TMath::Pi());
59 efiPhiSingPPhys->SetMarkerStyle(20);
60 efiPhiSingPPhys->SetMarkerColor(2);
61
62
63 TH1* efiPhiSingNPhys=(TH1*) phigeantNPhys->Clone();
64 efiPhiSingNPhys->Sumw2();
65 efiPhiSingNPhys->Divide(phisingleNPhys,phigeantNPhys);
66 efiPhiSingNPhys->SetMinimum(0.);
67 efiPhiSingNPhys->SetMaximum(1.2);
68 efiPhiSingNPhys->SetAxisRange(-TMath::Pi(),TMath::Pi());
69 efiPhiSingNPhys->SetMarkerStyle(20);
70 efiPhiSingNPhys->SetMarkerColor(2);
71
72
73 // Reconstructable tracks
74
75 // track Lenght
76 sparseV0->GetAxis(8)->SetRangeUser(50,200);
77 sparseV0->GetAxis(12)->SetRangeUser(50,200);
78 // momentum
79 sparseV0->GetAxis(5)->SetRangeUser(0.,3.9);
80 sparseV0->GetAxis(9)->SetRangeUser(0.,3.9);
81
82
83 TH1* rgeantTrk=sparseV0->Projection(3);
84 TH1* ptgeantPTrk=sparseV0->Projection(5);
85 TH1* etageantPTrk=sparseV0->Projection(6);
86 TH1* phigeantPTrk=sparseV0->Projection(7);
87
88
89 TH1* ptgeantNTrk=sparseV0->Projection(9);
90 TH1* etageantNTrk=sparseV0->Projection(10);
91 TH1* phigeantNTrk=sparseV0->Projection(11);
92
93 // Status of the single track reconstruction. "1" means reconstructed,"-1" not reconstructed
94
95 sparseV0->GetAxis(20)->SetRangeUser(0,2.);
96 sparseV0->GetAxis(28)->SetRangeUser(0,2.);
97
98 TH1* rsingleTrk=sparseV0->Projection(3);
99 TH1* ptsinglePTrk=sparseV0->Projection(5);
100 TH1* etasinglePTrk=sparseV0->Projection(6);
101 TH1* phisinglePTrk=sparseV0->Projection(7);
102
103 TH1* ptsingleNTrk=sparseV0->Projection(9);
104 TH1* etasingleNTrk=sparseV0->Projection(10);
105 TH1* phisingleNTrk=sparseV0->Projection(11);
106
107 //Status of the V0 track reconstruction.  "1" means reconstructed,"-1" not reconstructed
108
109 sparseV0->GetAxis(32)->SetRangeUser(0,2.);
110 sparseV0->GetAxis(36)->SetRangeUser(0,2.);
111
112 TH1* rV0Trk=sparseV0->Projection(3);
113 TH1* ptV0PTrk=sparseV0->Projection(5);
114 TH1* etaV0PTrk=sparseV0->Projection(6);
115 TH1* phiV0PTrk=sparseV0->Projection(7);
116
117
118
119 TH1* ptV0NTrk=sparseV0->Projection(9);
120 TH1* etaV0NTrk=sparseV0->Projection(10);
121 TH1* phiV0NTrk=sparseV0->Projection(11);
122
123
124 TH1* efiSingPPhys=(TH1*) ptgeantPPhys->Clone();
125 efiSingPPhys->Sumw2();
126 efiSingPPhys->Divide(ptgeantPTrk,ptgeantPPhys);
127 efiSingPPhys->SetAxisRange(0.,5);
128 efiSingPPhys->SetMinimum(0.);
129 efiSingPPhys->SetMaximum(1.2);
130 efiSingPPhys->SetMarkerStyle(20);
131 efiSingPPhys->SetMarkerColor(2);
132
133
134 TH1* efiSingNPhys=(TH1*) ptgeantNPhys->Clone();
135 efiSingNPhys->Sumw2();
136 efiSingNPhys->Divide(ptgeantNTrk,ptgeantNPhys);
137 efiSingNPhys->SetAxisRange(0.,5);
138 efiSingNPhys->SetMinimum(0.);
139 efiSingNPhys->SetMaximum(1.2);
140 efiSingNPhys->SetMarkerStyle(20);
141 efiSingNPhys->SetMarkerColor(2);
142
143
144
145
146 TH1* efiSingPTrk=(TH1*) ptgeantPTrk->Clone();
147 efiSingPTrk->Sumw2();
148 efiSingPTrk->Divide(ptsinglePTrk,ptgeantPTrk);
149 efiSingPTrk->SetAxisRange(0.,5);
150 efiSingPTrk->SetMinimum(0.);
151 efiSingPTrk->SetMaximum(1.2);
152 efiSingPTrk->SetMarkerStyle(21);
153 efiSingPTrk->SetMarkerColor(4);
154
155
156 TH1* efiSingNTrk=(TH1*) ptgeantNTrk->Clone();
157 efiSingNTrk->Sumw2();
158 efiSingNTrk->Divide(ptsingleNTrk,ptgeantNTrk);
159 efiSingNTrk->SetAxisRange(0.,5);
160 efiSingNTrk->SetMinimum(0.);
161 efiSingNTrk->SetMaximum(1.2);
162 efiSingNTrk->SetMarkerStyle(21);
163 efiSingNTrk->SetMarkerColor(4);
164
165
166 TH1* efiV0PTrk=(TH1*) ptsinglePTrk->Clone();
167 efiV0PTrk->Sumw2();
168 efiV0PTrk->Divide(ptV0PTrk,ptsinglePTrk);
169 efiV0PTrk->SetAxisRange(0.,5);
170 efiV0PTrk->SetMinimum(0.);
171 efiV0PTrk->SetMaximum(1.2);
172 efiV0PTrk->SetMarkerStyle(21);
173 efiV0PTrk->SetMarkerColor(3);
174
175
176
177 TH1* efiV0NTrk=(TH1*) ptsingleNTrk->Clone();
178 efiV0NTrk->Sumw2();
179 efiV0NTrk->Divide(ptV0NTrk,ptsingleNTrk);
180 efiV0NTrk->SetAxisRange(0.,5);
181 efiV0NTrk->SetMinimum(0.);
182 efiV0NTrk->SetMaximum(1.2);
183 efiV0NTrk->SetMarkerStyle(21);
184 efiV0NTrk->SetMarkerColor(3);
185
186
187
188 TH1* efiEtaSingPTrk=(TH1*) etageantPTrk->Clone();
189 efiEtaSingPTrk->Sumw2();
190 efiEtaSingPTrk->Divide(etasinglePTrk,etageantPTrk);
191 efiEtaSingPTrk->SetMinimum(0.);
192 efiEtaSingPTrk->SetMaximum(1.2);
193 efiEtaSingPTrk->SetAxisRange(-1.5,1.5);
194 efiEtaSingPTrk->SetMarkerStyle(21);
195 efiEtaSingPTrk->SetMarkerColor(4);
196
197
198 TH1* efiEtaSingNTrk=(TH1*) etageantNTrk->Clone();
199 efiEtaSingNTrk->Sumw2();
200 efiEtaSingNTrk->Divide(etasingleNTrk,etageantNTrk);
201 efiEtaSingNTrk->SetMinimum(0.);
202 efiEtaSingNTrk->SetMaximum(1.2);
203 efiEtaSingNTrk->SetAxisRange(-1.5,1.5);
204 efiEtaSingNTrk->SetMarkerStyle(21);
205 efiEtaSingNTrk->SetMarkerColor(4);
206
207
208 TH1* efiEtaV0PTrk=(TH1*) etasinglePTrk->Clone();
209 efiEtaV0PTrk->Sumw2();
210 efiEtaV0PTrk->Divide(etaV0PTrk,etasinglePTrk);
211 efiEtaV0PTrk->SetMinimum(0.);
212 efiEtaV0PTrk->SetMaximum(1.2);
213 efiEtaV0PTrk->SetMarkerStyle(21);
214 efiEtaV0PTrk->SetMarkerColor(3);
215
216
217 TH1* efiEtaV0NTrk=(TH1*) etasingleNTrk->Clone();
218 efiEtaV0NTrk->Sumw2();
219 efiEtaV0NTrk->Divide(etaV0NTrk,etasingleNTrk);
220 efiEtaV0NTrk->SetMinimum(0.);
221 efiEtaV0NTrk->SetMaximum(1.2);
222 efiEtaV0NTrk->SetMarkerStyle(21);
223 efiEtaV0NTrk->SetMarkerColor(3);
224
225
226
227 TH1* efiPhiSingPTrk=(TH1*) phigeantPTrk->Clone();
228 efiPhiSingPTrk->Sumw2();
229 efiPhiSingPTrk->Divide(phisinglePTrk,phigeantPTrk);
230 efiPhiSingPTrk->SetMinimum(0.);
231 efiPhiSingPTrk->SetMaximum(1.2);
232 efiPhiSingPTrk->SetAxisRange(-TMath::Pi(),TMath::Pi());
233 efiPhiSingPTrk->SetMarkerStyle(20);
234 efiPhiSingPTrk->SetMarkerColor(4);
235
236
237 TH1* efiPhiSingNTrk=(TH1*) phigeantNTrk->Clone();
238 efiPhiSingNTrk->Sumw2();
239 efiPhiSingNTrk->Divide(phisingleNTrk,phigeantNTrk);
240 efiPhiSingNTrk->SetMinimum(0.);
241 efiPhiSingNTrk->SetMaximum(1.2);
242 efiPhiSingNTrk->SetAxisRange(-TMath::Pi(),TMath::Pi());
243 efiPhiSingNTrk->SetMarkerStyle(20);
244 efiPhiSingNTrk->SetMarkerColor(4);
245
246 TH1* efiPhiV0PTrk=(TH1*) phisinglePTrk->Clone();
247 efiPhiV0PTrk->Sumw2();
248 efiPhiV0PTrk->Divide(phiV0PTrk,phisinglePTrk);
249 efiPhiV0PTrk->SetMinimum(0.);
250 efiPhiV0PTrk->SetMaximum(1.2);
251 efiPhiV0PTrk->SetMarkerStyle(21);
252 efiPhiV0PTrk->SetMarkerColor(3);
253
254
255 TH1* efiPhiV0NTrk=(TH1*) phisingleNTrk->Clone();
256 efiPhiV0NTrk->Sumw2();
257 efiPhiV0NTrk->Divide(phiV0NTrk,phisingleNTrk);
258 efiPhiV0NTrk->SetMinimum(0.);
259 efiPhiV0NTrk->SetMaximum(1.2);
260 efiPhiV0NTrk->SetMarkerStyle(21);
261 efiPhiV0NTrk->SetMarkerColor(3);
262
263
264
265 sparseV0->GetAxis(32)->SetRangeUser(-2,0.);
266 sparseV0->GetAxis(36)->SetRangeUser(-2,0.);
267
268 TH1* sigbXYZEPlusRecSingle=sparseV0->Projection(17);
269 TH1* sigbXYZEMinusRecSingle=sparseV0->Projection(25);
270
271 TH1* ptsinglePTrkNo=sparseV0->Projection(5);
272 TH1* etasinglePTrkNo=sparseV0->Projection(6);
273 TH1* phisinglePTrkNo=sparseV0->Projection(7);
274
275 TH1* ptsingleNTrkNo=sparseV0->Projection(9);
276 TH1* etasingleNTrkNo=sparseV0->Projection(10);
277 TH1* phisingleNTrkNo=sparseV0->Projection(11);
278
279
280
281
282
283 TH1* efiV0PTrkNo=(TH1*) ptsinglePTrkNo->Clone();
284 efiV0PTrkNo->Sumw2();
285 efiV0PTrkNo->Divide(ptsinglePTrkNo,ptsinglePTrk);
286 efiV0PTrkNo->SetAxisRange(0.,5);
287 efiV0PTrkNo->SetMinimum(0.);
288 efiV0PTrkNo->SetMaximum(1.2);
289 efiV0PTrkNo->SetMarkerStyle(21);
290 efiV0PTrkNo->SetMarkerColor(6);
291
292
293
294 TH1* efiV0NTrkNo=(TH1*) ptsingleNTrkNo->Clone();
295 efiV0NTrkNo->Sumw2();
296 efiV0NTrkNo->Divide(ptsingleNTrkNo,ptsingleNTrk);
297 efiV0NTrkNo->SetAxisRange(0.,5);
298 efiV0NTrkNo->SetMinimum(0.);
299 efiV0NTrkNo->SetMaximum(1.2);
300 efiV0NTrkNo->SetMarkerStyle(21);
301 efiV0NTrkNo->SetMarkerColor(6);
302
303
304 TH1* efiEtaV0PTrkNo=(TH1*) etasinglePTrkNo->Clone();
305 efiEtaV0PTrkNo->Sumw2();
306 efiEtaV0PTrkNo->Divide(etasinglePTrkNo,etasinglePTrk);
307 efiEtaV0PTrkNo->SetAxisRange(-1.5,1.5);
308 efiEtaV0PTrkNo->SetMinimum(0.);
309 efiEtaV0PTrkNo->SetMaximum(1.2);
310 efiEtaV0PTrkNo->SetMarkerStyle(21);
311 efiEtaV0PTrkNo->SetMarkerColor(6);
312
313
314
315 TH1* efiEtaV0NTrkNo=(TH1*) etasingleNTrkNo->Clone();
316 efiEtaV0NTrkNo->Sumw2();
317 efiEtaV0NTrkNo->Divide(etasingleNTrkNo,etasingleNTrk);
318 efiEtaV0NTrkNo->SetAxisRange(-1.5,1.5);
319 efiEtaV0NTrkNo->SetMinimum(0.);
320 efiEtaV0NTrkNo->SetMaximum(1.2);
321 efiEtaV0NTrkNo->SetMarkerStyle(21);
322 efiEtaV0NTrkNo->SetMarkerColor(6);
323
324
325 TH1* efiPhiV0PTrkNo=(TH1*) phisinglePTrkNo->Clone();
326 efiPhiV0PTrkNo->Sumw2();
327 efiPhiV0PTrkNo->Divide(phisinglePTrkNo,phisinglePTrk);
328 efiPhiV0PTrkNo->SetAxisRange(-3.5,3.5);
329 efiPhiV0PTrkNo->SetMinimum(0.);
330 efiPhiV0PTrkNo->SetMaximum(1.2);
331 efiPhiV0PTrkNo->SetMarkerStyle(21);
332 efiPhiV0PTrkNo->SetMarkerColor(6);
333
334
335
336 TH1* efiPhiV0NTrkNo=(TH1*) phisingleNTrkNo->Clone();
337 efiPhiV0NTrkNo->Sumw2();
338 efiPhiV0NTrkNo->Divide(phisingleNTrkNo,phisingleNTrk);
339 efiPhiV0NTrkNo->SetAxisRange(-3.5,3.5);
340 efiPhiV0NTrkNo->SetMinimum(0.);
341 efiPhiV0NTrkNo->SetMaximum(1.2);
342 efiPhiV0NTrkNo->SetMarkerStyle(21);
343 efiPhiV0NTrkNo->SetMarkerColor(6);
344
345
346 TCanvas* c1 = new TCanvas("c1","MC Info",200,10,700,900);
347 c1->Divide(2,4);
348 c1->SetFillColor(0);
349 c1->GetFrame()->SetFillColor(0);
350 c1->SetBorderMode(0);
351 TPad *c1_1 = (TPad*)(c1->GetPrimitive("c1_1"));
352 TPad *c1_2 = (TPad*)(c1->GetPrimitive("c1_2"));
353 TPad *c1_3 = (TPad*)(c1->GetPrimitive("c1_3"));
354 TPad *c1_4 = (TPad*)(c1->GetPrimitive("c1_4"));
355 TPad *c1_5 = (TPad*)(c1->GetPrimitive("c1_5"));
356 TPad *c1_6 = (TPad*)(c1->GetPrimitive("c1_6"));
357
358
359  c1_1->SetGridx(1);
360  c1_3->SetGridx(1);
361  c1_2->SetGridx(1);
362  c1_4->SetGridx(1);
363  c1_5->SetGridx(1);
364  c1_6->SetGridx(1);
365
366  c1_1->SetGridy(1);
367  c1_3->SetGridy(1);
368  c1_2->SetGridy(1);
369  c1_4->SetGridy(1);
370  c1_5->SetGridy(1);
371  c1_6->SetGridy(1);
372
373
374 c1->cd(1);
375 efiSingPTrk->Draw();
376 efiSingPTrk->SetXTitle("1/sqrt(pt) pos (sqrt(GeV))");
377 efiSingPPhys->Draw("same");
378 efiV0PTrk->Draw("same");
379 efiV0PTrkNo->Draw("same");
380
381 TLegend *leg1 = new TLegend(0.6,0.75,0.9,0.9);
382 leg1->AddEntry(efiSingPTrk,"Single tracking eff");
383 leg1->AddEntry(efiV0PTrk,"V0 tracking eff");
384 leg1->AddEntry(efiV0PTrkNo,"V0 tracking ineff");
385 leg1->Draw();
386 c1->cd(2);
387 efiSingNTrk->Draw();
388 efiSingNTrk->SetXTitle("1/sqrt(pt) neg (sqrt(GeV))");
389 efiSingNPhys->Draw("same");
390 efiV0NTrk->Draw("same");
391 efiV0NTrkNo->Draw("same");
392
393 c1->cd(3);
394 efiEtaSingPTrk->Draw();
395 //efiEtaSingPPhys->Draw("same");
396 efiEtaV0PTrk->Draw("same");
397 efiEtaV0PTrkNo->Draw("same");
398
399 c1->cd(4);
400 efiEtaSingNTrk->Draw();
401 //efiEtaSingNPhys->Draw("same");
402 efiEtaV0NTrk->Draw("same");
403 efiEtaV0NTrkNo->Draw("same");
404
405 c1->cd(5);
406 efiPhiSingPTrk->Draw();
407 //efiPhiSingPPhys->Draw("same");
408 efiPhiV0PTrk->Draw("same");
409 efiPhiV0PTrkNo->Draw("same");
410
411 c1->cd(6);
412 efiPhiSingNTrk->Draw();
413 //efiPhiSingNPhys->Draw("same");
414 efiPhiV0NTrk->Draw("same");
415 efiPhiV0NTrkNo->Draw("same");
416
417 c1->cd(7);
418 TH1* efiRSingTrk=(TH1*) rgeantTrk->Clone();
419 efiRSingTrk->Sumw2();
420 efiRSingTrk->Divide(rsingleTrk,rgeantTrk);
421
422 //efiRSingTrk->SetAxisRange(0.,5);
423 efiRSingTrk->SetMinimum(0.);
424 efiRSingTrk->SetMaximum(1.2);
425 efiRSingTrk->SetMarkerStyle(21);
426 efiRSingTrk->SetMarkerColor(4);
427
428 efiRSingTrk->Draw();
429
430 TH1* efiRV0Trk=(TH1*) rgeantTrk->Clone();
431 efiRV0Trk->Sumw2();
432 efiRV0Trk->Divide(rV0Trk,rsingleTrk);
433
434
435 efiRV0Trk->SetMinimum(0.);
436 efiRV0Trk->SetMaximum(1.2);
437 efiRV0Trk->SetMarkerStyle(21);
438 efiRV0Trk->SetMarkerColor(3);
439 efiRV0Trk->Draw("same");
440
441
442 c1->Print("Effi-norefit-trunk010709.ps"); 
443 //c1->Print("Effi-norefit-v416rev08-090709.ps"); 
444
445 }