TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGPP / TPC / macros / drawPerformanceTPCQAMatch.C
1 int drawPerformanceTPCQAMatch(const char* inFile = "perf.root") {
2   //
3   // Draw control histograms 
4   // and generate output pictures
5   //
6
7   gSystem->Load("libSTAT");
8   gSystem->Load("libANALYSIS");
9   gSystem->Load("libANALYSISalice");
10   gSystem->Load("libANALYSIScalib");
11   gSystem->Load("libCORRFW");
12   gSystem->Load("libTPCcalib");
13   gSystem->Load("libTRDcalib");
14   gSystem->Load("libT0calib");
15   gSystem->Load("libTOFcalib");
16   gSystem->Load("libANALYSISalice.so");
17   gSystem->Load("libANALYSIScalib.so");
18   gSystem->Load("libTender.so");
19   gSystem->Load("libPWGPP.so");
20                     
21   gROOT->Reset();
22   gROOT->SetStyle("Plain");
23   gStyle->SetPalette(1);
24   gStyle->SetOptStat(0);    
25   gStyle->SetTitleSize(0.025);
26   TH1::AddDirectory(kFALSE);
27
28   //
29   // set criteria
30   //
31   Float_t mineta = -0.8;
32   Float_t maxeta = 0.799;
33   Float_t minNclust = 70.0;
34   Double_t ptMax = 10;
35   //
36   // open input file
37   //
38   TFile *file = TFile::Open(inFile);
39   if(!file)
40     return -9;
41   cout<<"QA file opened"<<endl;
42   file->cd();
43   // get the TPC list
44   if(gROOT->FindObject("TPC_PerformanceQA")) TPC_PerformanceQA->cd();
45   cout<<"TPC_PerformanceQA opened"<<endl;
46   TList *TPC = (TList*)gROOT->FindObject("TPCQA");
47   if(TPC==NULL) TPC = (TList*)gROOT->FindObject("TPCQA_v0_c0");
48   if(TPC==NULL) TPC = (TList*)gROOT->FindObject("TPCQA_v0_c30");
49   if(TPC==NULL) TPC = (TList*)gROOT->FindObject("TPCQA_v0_c70");
50   if(TPC==NULL) TPC = (TList*)gROOT->FindObject("TPC");
51   if(TPC==NULL) return(0);
52   cout<<"TPCQA list found"<<endl;
53   // get TPC performance object
54   AliPerformanceTPC *obj = (AliPerformanceTPC*)TPC->FindObject("AliPerformanceTPC");
55   if(obj==NULL) return(0);
56   cout<<"what about here after obj  "<<endl;
57   // get folder with histograms
58   TFolder *fold = obj->GetAnalysisFolder();
59   if(!fold) return(0);
60   cout<<"what about here after folder  "<<endl;
61   //
62   // get the HLT list
63   //    file->cd();
64   //    if(gROOT->FindObject("HLT_PerformanceQA")) HLT_PerformanceQA->cd();
65   //    TList *HLT = (TList*)gROOT->FindObject("HLTQA");
66
67
68   //
69   // Draw histograms
70   //
71
72   //
73   // event level
74   //
75
76   TH1 *h1D = 0;
77   TH2 *h2D = 0;
78   TH3 *h3D = 0;
79
80   h1D = (TH1*)fold->FindObject("h_tpc_event_1");
81   Double_t NEvents = h1D->GetEntries();
82
83   cout<<"number of events    "<<NEvents<<endl;
84
85   TCanvas *can1 = new TCanvas("can1","TPC event information",1200,800); 
86   can1->Divide(3,2);
87
88   can1->cd(1);
89   fold->FindObject("h_tpc_event_6")->Draw("histe");
90
91   can1->cd(2);
92   gPad->SetLogy();
93   h1D = (TH1*)fold->FindObject("h_tpc_event_recvertex_0");
94   h1D->GetXaxis()->SetRangeUser(-1.,1.);
95   h1D->Draw("histe");
96
97   can1->cd(3);
98   gPad->SetLogy();
99   h1D = (TH1*)fold->FindObject("h_tpc_event_recvertex_1");
100   h1D->GetXaxis()->SetRangeUser(-1.,1.);
101   h1D->Draw("histe");
102
103   can1->cd(4);
104   gPad->SetLogy();
105   fold->FindObject("h_tpc_event_recvertex_2")->Draw("histe");
106
107   can1->cd(5);
108   gPad->SetLogy();
109   TH1 *hp = fold->FindObject("h_tpc_event_recvertex_3");
110   hp->SetTitle("Track.Multi., ncl>70, |dcar|<3 cm, |dcaz|<3 cm");
111   hp->Draw("histe");
112
113   can1->cd(6);
114   gPad->SetLogy();
115   hp = (TH1*)fold->FindObject("h_tpc_event_recvertex_4");
116   hp->SetTitle("Pos/neg(red) Track.Multi. ncl>70, |dcar|<3 cm, |dcaz|<3 cm");
117   hp->Draw("histe");
118   TH1* he = fold->FindObject("h_tpc_event_recvertex_5");
119   he->SetLineColor(kRed);
120   he->Draw("histesame");
121
122   can1->SaveAs("TPC_event_info.png");
123
124
125   TCanvas *can2 = new TCanvas("can2","#eta , #phi and p_{t}",1200,800); 
126
127   can2->Divide(3,2);
128
129   can2->cd(1);
130   h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_0_5_6");
131   h3D->GetXaxis()->SetRangeUser(minNclust,160);
132   h3D->Project3D("yz")->Draw("colz");
133   h3D->Project3D("yz")->SetTitle("#eta vs #phi, positive tracks");
134   can2->Update();
135
136   can2->cd(4);
137   h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_0_5_6");
138   h3D->GetXaxis()->SetRangeUser(minNclust,160);
139   h3D->Project3D("yz")->Draw("colz");
140   h3D->Project3D("yz")->SetTitle("#eta vs #phi, negative tracks");
141   can2->Update();
142
143   can2->cd(2);
144   h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_0_5_6");
145   h3D->GetXaxis()->SetRangeUser(minNclust,160);
146   h1D = h3D->Project3D("y");
147   h1D->SetTitle("#eta of pos/neg(red) charged tracks, ncl>70");
148   h1D->Draw("histe");
149
150   h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_0_5_6");
151   h3D->GetXaxis()->SetRangeUser(minNclust,160);
152   h1D = h3D->Project3D("y");
153   h1D->SetLineColor(kRed);
154   h1D->Draw("histesame");
155
156   can2->cd(5);
157   gPad->SetLogy();
158   h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_0_5_7");
159   h3D->GetXaxis()->SetRangeUser(minNclust,160);
160   h3D->GetYaxis()->SetRangeUser(mineta,maxeta);
161   h1D = h3D->Project3D("z");
162   h1D->Scale(1,"width");
163   h1D->SetTitle("p_{T} of pos/neg(red) charged tracks, ncl>70, |#eta|<0.8");
164   h1D->Draw("histe");
165
166   h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_0_5_7");
167   h3D->GetXaxis()->SetRangeUser(minNclust,160);
168   h3D->GetYaxis()->SetRangeUser(mineta,maxeta);
169   h1D = h3D->Project3D("z");
170   h1D->Scale(1,"width");
171   h1D->SetLineColor(kRed);
172   h1D->Draw("histesame");
173
174   can2->cd(3);
175   h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_5_6_7");
176   h3D->GetZaxis()->SetRangeUser(2,20);
177   h3D->GetXaxis()->SetRangeUser(mineta,-0.00001);
178   TH1 *h1D = h3D->Project3D("y");
179   h1D->SetTitle("#phi of pos/neg(red) charged tracks, pt>1GeV/c, -0.8<#eta<0.0");
180   h1D->Draw("histe");
181
182   h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_5_6_7");
183   h3D->GetZaxis()->SetRangeUser(2,20);
184   h3D->GetXaxis()->SetRangeUser(mineta,-0.00001);
185   h1D = h3D->Project3D("y");
186   h1D->SetLineColor(kRed);
187   h1D->Draw("histesame");
188
189   can2->cd(6);
190   h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_5_6_7");
191   TH3 *h3D1 = h3D->Clone("h3D1");
192   h3D1->GetXaxis()->SetRangeUser(0.0,maxeta);
193   h3D1->GetZaxis()->SetRangeUser(2,20);
194   h1D = h3D1->Project3D("y");
195   h1D->SetTitle("#phi of pos/neg(red) charged tracks, pt>1GeV/c, 0.0<#eta<0.8");
196   h1D->Draw("histe");
197
198   h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_5_6_7");
199   TH3 *h3D2 = h3D->Clone("h3D2");
200   h3D2->GetXaxis()->SetRangeUser(0.0,maxeta);
201   h3D2->GetZaxis()->SetRangeUser(2,20);
202   h1D = h3D2->Project3D("y");
203   h1D->SetLineColor(kRed);
204   h1D->Draw("histesame");
205
206   can2->SaveAs("eta_phi_pt.png");
207
208   TCanvas *can3 = new TCanvas("can3","Cluster Occupancy",700,700); 
209   can3->Divide(1,2);
210
211   can3->cd(1); 
212   TH3 *h3D_1 = (TH3*)fold->FindObject("h_tpc_clust_0_1_2");
213   TH3 *h3D_2 = (TH3*) h3D_1->Clone("h3D_2");
214   h3D_1->GetZaxis()->SetRangeUser(0,0.99);
215   h3D_1->Project3D("xy")->Draw("colz");
216   h3D_1->Project3D("xy")->SetTitle("Cluster Occupancy A Side");
217   if(NEvents > 0)
218     h3D_1->Project3D("xy")->Scale(1.0/NEvents);
219   can3->Update();
220
221   can3->cd(2);  
222   h3D_2->GetZaxis()->SetRangeUser(1,2) ;
223   h3D_2->Project3D("xy")->Draw("colz");
224   h3D_2->Project3D("xy")->SetTitle("Cluster Occupancy C Side");
225   if(NEvents>0) 
226     h3D_2->Project3D("xy")->Scale(1.0/NEvents);
227
228   can3->SaveAs("cluster_occupancy.png");
229
230   TObjArray *arr1 = new TObjArray();
231   TObjArray *arr2 = new TObjArray();
232   TObjArray *arr3 = new TObjArray();
233   TObjArray *arr4 = new TObjArray();
234   TObjArray *arr5 = new TObjArray();
235   TObjArray *arr6 = new TObjArray();
236
237   TCanvas *can4 = new TCanvas("can4","Clusters in Detail",1200,800);
238   can4->Divide(3,2);
239
240   can4->cd(1);
241   h3D = (TH3*)fold->FindObject("h_tpc_track_all_recvertex_0_5_7");
242   h2D = (TH2*)h3D->Project3D("xy");
243   h2D->SetTitle("nCluster vs #eta, |dcar|<3 cm, |dcaz|<3 cm");
244   h2D->FitSlicesY(0,0,-1,0,"QNR",arr1);
245   h2D->Draw("colz");
246   arr1->At(1)->Draw("same");
247
248   can4->cd(4);
249   h3D = (TH3*)fold->FindObject("h_tpc_track_all_recvertex_2_5_7");
250   h2D = (TH2*)h3D->Project3D("xy");
251   h2D->SetTitle("Findable clusters, |dcar|<3 cm, |dcaz|<3 cm");
252   h2D->FitSlicesY(0,0,-1,0,"QNR",arr2);
253   h2D->Draw("colz");
254   arr2->At(1)->Draw("same");
255
256   can4->cd(2);
257   h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_0_5_6");
258   TH3 *h3D11 = h3D->Clone("h3D11");
259   h3D11->Add(((TH3*)fold->FindObject("h_tpc_track_neg_recvertex_0_5_6")),1);
260   h3D11->GetYaxis()->SetRangeUser(mineta,-0.00001);
261   h2D = (TH2*)h3D11->Project3D("xz");
262   h2D->SetTitle("nCluster vs #phi, -0.8<#eta<0.0, |dcar|<3 cm, |dcaz|<3 cm");
263   h2D->FitSlicesY(0,0,-1,0,"QNR",arr3);
264   h2D->Draw("colz");
265   arr3->At(1)->Draw("same");
266
267   can4->cd(5);
268   h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_0_5_6");
269   TH3 *h3D22 = h3D->Clone("h3D22");
270   h3D22->Add(((TH3*)fold->FindObject("h_tpc_track_neg_recvertex_0_5_6")),1);
271   h3D22->GetYaxis()->SetRangeUser(0.0,maxeta);
272   h2D = (TH2*)h3D22->Project3D("xz");
273   h2D->SetTitle("nCluster vs #phi, 0.0<#eta<0.8, |dcar|<3 cm, |dcaz|<3 cm");
274   h2D->FitSlicesY(0,0,-1,0,"QNR",arr4);
275   h2D->Draw("colz");
276   arr4->At(1)->Draw("same");
277
278   can4->cd(3);
279   h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_2_5_6");
280   TH3 *h3D33 = h3D->Clone("h3D33");
281   h3D33->Add(((TH3*)fold->FindObject("h_tpc_track_neg_recvertex_2_5_6")),1);
282   h3D33->GetYaxis()->SetRangeUser(mineta,-0.00001);
283   h2D = (TH2*)h3D33->Project3D("xz");
284   h2D->SetTitle("Findable clusters vs #phi, -0.8<#eta<0.0, |dcar|<3 cm, |dcaz|<3 cm");
285   h2D->FitSlicesY(0,0,-1,0,"QNR",arr5);
286   h2D->Draw("colz");
287   arr5->At(1)->Draw("same");
288
289   can4->cd(6);
290   h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_2_5_6");
291   TH3 *h3D44 = h3D->Clone("h3D44");
292   h3D44->Add(((TH3*)fold->FindObject("h_tpc_track_neg_recvertex_2_5_6")),1);
293   h3D44->GetYaxis()->SetRangeUser(0.0,maxeta);
294   h2D = (TH2*)h3D44->Project3D("xz");
295   h2D->SetTitle("Findalbe clusters vs #phi, 0.0<#eta<0.8, |dcar|<3 cm, |dcaz|<3 cm");
296   h2D->FitSlicesY(0,0,-1,0,"QNR",arr6);
297   h2D->Draw("colz");
298   arr6->At(1)->Draw("same");
299
300   can4->SaveAs("cluster_in_detail.png");
301   can4->Update();
302
303   TObjArray *arr7 = new TObjArray();
304   TObjArray *arr8 = new TObjArray();
305
306   TCanvas *can5 = new TCanvas("can5","DCA In Detail",1200,800); 
307   can5->Divide(3,2);
308
309   can5->cd(1);
310   h3D = (TH3*)fold->FindObject("h_tpc_track_all_recvertex_3_5_7");
311   h3D->GetYaxis()->SetRangeUser(-1,1);
312   h2D = (TH2*)h3D->Project3D("xy");
313   h2D->FitSlicesY(0,0,-1,0,"QNR",arr7);
314   h2D->SetTitle("DCAR vs #eta");
315   h2D->Draw("colz");
316   arr7->At(1)->Draw("same");
317
318   can5->cd(2);
319   h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_3_5_7");
320   h3D->GetYaxis()->SetRangeUser(-1,1);
321   h3D->Project3D("xy")->Draw("colz");
322   h3D->Project3D("xy")->SetTitle("DCAR vs #eta of pos. charged tracks");
323
324   can5->cd(3);
325   h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_3_5_7");
326   h3D->GetYaxis()->SetRangeUser(-1,1);
327   h3D->Project3D("xy")->Draw("colz");
328   h3D->Project3D("xy")->SetTitle("DCAR vs #eta of neg. charged tracks");
329
330   can5->cd(4);
331   h3D = (TH3*)fold->FindObject("h_tpc_track_all_recvertex_4_5_7");
332   h3D->GetYaxis()->SetRangeUser(-1,1);
333   h2D = (TH2*)h3D->Project3D("xy");
334   h2D->FitSlicesY(0,0,-1,0,"QNR",arr8);
335   h2D->SetTitle("DCAZ vs #eta");
336   h2D->Draw("colz");
337   arr8->At(1)->Draw("same");
338
339   can5->cd(5);
340   h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_4_5_7");
341   h3D->GetYaxis()->SetRangeUser(-1,1);
342   h3D->Project3D("xy")->Draw("colz");
343   h3D->Project3D("xy")->SetTitle("DCAZ vs #eta of pos. charged tracks");
344
345   can5->cd(6);
346   h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_4_5_7");
347   h3D->GetYaxis()->SetRangeUser(-1,1);
348   h3D->Project3D("xy")->Draw("colz");
349   h3D->Project3D("xy")->SetTitle("DCAZ vs #eta of neg. charged tracks");
350
351   can5->SaveAs("dca_in_detail.png");
352
353   TCanvas *can51 = new TCanvas("can51","DCAr versus pT",700,800); 
354   can51->Divide(2,2);
355
356   TObjArray *arr9 = new TObjArray();
357   TObjArray *arr10 = new TObjArray();
358   TObjArray *arr11 = new TObjArray();
359   TObjArray *arr12 = new TObjArray();
360
361   can51->cd(1);
362   h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_3_5_7");
363   TH3 *h3Dp = h3D->Clone("h3Dp");
364   h3D->SetAxisRange(0.25,ptMax,"Z");
365   h3D->GetYaxis()->SetRangeUser(0.0,maxeta);
366   h2D  = (TH2*)h3D->Project3D("xz");
367   h2D->Draw("colz");
368   h2D->SetTitle("DCAR vs pT of pos. charged tracks(A Side)");
369   h2D->FitSlicesY(0,0,-1,0,"QNR",arr9);
370   TH1 *width1 = (TH1*)arr9->At(2);
371   width1->Draw("same");
372   width1->SetLineColor(2);
373   arr9->At(1)->Draw("same");
374
375   can51->cd(2);
376   //h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_3_5_7");
377   h3Dp->SetAxisRange(0.25,ptMax,"Z");
378   h3Dp->GetYaxis()->SetRangeUser(mineta,-0.00001);
379   h2D  = (TH2*)h3Dp->Project3D("xz");
380   h2D->Draw("colz");
381   h2D->SetTitle("DCAR vs pT of pos. charged tracks(C Side)");
382   h2D->FitSlicesY(0,0,-1,0,"QNR",arr10);
383   TH1 *width2 = (TH1*)arr10->At(2);
384   width2->Draw("same");
385   width2->SetLineColor(2);
386   arr10->At(1)->Draw("same");
387
388   can51->cd(3);
389   h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_3_5_7");
390   TH3 *h3Dn = h3D->Clone("h3Dn");
391   h3D->SetAxisRange(0.25,ptMax,"Z");
392   h3D->GetYaxis()->SetRangeUser(0.0,maxeta);
393   h2D  = (TH2*)h3D->Project3D("xz");
394   h2D->Draw("colz");
395   h2D->SetTitle("DCAR vs pT of neg. charged tracks(A Side)");
396   h2D->FitSlicesY(0,0,-1,0,"QNR",arr11);
397   TH1 *width3 = (TH1*)arr11->At(2);
398   width3->Draw("same");
399   width3->SetLineColor(2);
400   arr11->At(1)->Draw("same");
401
402   can51->cd(4);
403   //h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_3_5_7");
404   h3Dn->SetAxisRange(0.25,ptMax,"Z");
405   h3Dn->GetYaxis()->SetRangeUser(mineta,-0.00001);
406   h2D  = (TH2*)h3Dn->Project3D("xz");
407   h2D->Draw("colz");
408   h2D->SetTitle("DCAR vs pT of neg. charged tracks(C Side)");
409   h2D->FitSlicesY(0,0,-1,0,"QNR",arr12);
410   TH1 *width4 = (TH1*)arr12->At(2);
411   width4->Draw("same");
412   width4->SetLineColor(2);
413   arr12->At(1)->Draw("same");
414
415   can51->SaveAs("dcar_pT.png");
416
417   // get TPC dEdx performance object
418   AliPerformanceDEdx *obj1 = TPC->FindObject("AliPerformanceDEdxTPCInner");
419   if(obj1==NULL) return(0);
420
421   // get folder with histograms
422   TFolder *fold1 = obj1->GetAnalysisFolder();
423   if(!fold1) return(0);
424
425   TCanvas *can6 = new TCanvas("can6","TPC dEdX",1200,800); 
426   can6->Divide(3,2);
427
428   can6->cd(1);
429   gPad->SetLogz();
430   fold1->FindObject("h_tpc_dedx_0_1")->Draw("colz");
431
432   can6->cd(2);
433   gPad->SetLogz();
434   fold1->FindObject("h_tpc_dedx_0_5")->Draw("colz");
435
436   can6->cd(3);
437   gPad->SetLogz();
438   fold1->FindObject("h_tpc_dedx_0_6")->Draw("colz");
439
440   can6->cd(4);
441   gPad->SetLogx();
442   gPad->SetLogz();
443   TH2 *h2 = fold1->FindObject("h_tpc_dedx_0_7");
444   h2->GetXaxis()->SetRangeUser(0.1,10);
445   h2->Draw("colz");
446   ////////////////////////////////////////////////////////////////////
447   can6->cd(5);
448   gPad->SetLogz();
449   //fold1->FindObject("h_tpc_dedx_mips_a_0_1")->Draw("colz");
450   TH2 *htest = fold1->FindObject("h_tpc_dedx_mips_a_0_1"); 
451   htest->GetYaxis()->SetRangeUser(30,60);
452   htest->Draw("colz");
453   can6->cd(6);
454   gPad->SetLogz();
455   //fold1->FindObject("h_tpc_dedx_mips_c_0_1")->Draw("colz");
456   TH2 *htest1 = fold1->FindObject("h_tpc_dedx_mips_c_0_1");
457   htest1->GetYaxis()->SetRangeUser(30,60);
458   htest1->Draw("colz");
459
460   /////////////////////////////////////////////////////////////////////
461   can6->SaveAs("TPC_dEdx_track_info.png");
462
463   TObjArray *arr9 = new TObjArray();
464   TObjArray *arr10 = new TObjArray();
465
466   TCanvas *can7 = new TCanvas("can7","DCA vs #phi",1200,800); 
467   can7->Divide(4,2);
468
469   can7->cd(1);
470   h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_3_5_6");
471   TH3 *h3D71 = h3D->Clone("h3D71");
472   h3D->GetYaxis()->SetRangeUser(0.0,maxeta);
473   h3D->Project3D("xz")->Draw("colz");
474   h3D->Project3D("xz")->SetTitle("DCAR vs #phi of pos. charged tracks(A)");
475
476   can7->cd(2);
477   h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_3_5_6");
478   TH3 *h3D72 = h3D->Clone("h3D72");
479   h3D->GetYaxis()->SetRangeUser(0.0,maxeta);
480   h3D->Project3D("xz")->Draw("colz");
481   h3D->Project3D("xz")->SetTitle("DCAR vs #phi of neg. charged tracks(A)");
482
483   can7->cd(3);
484   h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_4_5_6");
485   TH3 *h3D73 = h3D->Clone("h3D73");
486   h3D->GetYaxis()->SetRangeUser(0.0,maxeta);
487   h3D->Project3D("xz")->Draw("colz");
488   h3D->Project3D("xz")->SetTitle("DCAZ vs #phi of pos. charged tracks(A)");
489
490   can7->cd(4);
491   h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_4_5_6");
492   TH3 *h3D74 = h3D->Clone("h3D74");
493   h3D->GetYaxis()->SetRangeUser(0.0,maxeta);
494   h3D->Project3D("xz")->Draw("colz");
495   h3D->Project3D("xz")->SetTitle("DCAZ vs #phi of neg. charged tracks(A)");
496
497   can7->cd(5);
498   //h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_3_5_6");
499   h3D71->GetYaxis()->SetRangeUser(mineta,-0.00001);
500   h3D71->Project3D("xz")->Draw("colz");
501   h3D71->Project3D("xz")->SetTitle("DCAR vs #phi of pos. charged tracks(C)");
502
503   can7->cd(6);
504   //h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_3_5_6");
505   h3D72->GetYaxis()->SetRangeUser(mineta,-0.00001);
506   h3D72->Project3D("xz")->Draw("colz");
507   h3D72->Project3D("xz")->SetTitle("DCAR vs #phi of neg. charged tracks(C)");
508
509   can7->cd(7);
510   //h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_4_5_6");
511   h3D73->GetYaxis()->SetRangeUser(mineta,-0.00001);
512   h3D73->Project3D("xz")->Draw("colz");
513   h3D73->Project3D("xz")->SetTitle("DCAZ vs #phi of pos. charged tracks(C)");
514
515   can7->cd(8);
516   //h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_4_5_6");
517   h3D74->GetYaxis()->SetRangeUser(mineta,-0.00001);
518   h3D74->Project3D("xz")->Draw("colz");
519   h3D74->Project3D("xz")->SetTitle("DCAZ vs #phi of neg. charged tracks(C)");
520
521
522   can7->SaveAs("dca_and_phi.png");
523
524
525   AliPerformanceMatch *obj2 = (AliPerformanceMatch*)TPC->FindObject("AliPerformanceMatchTPCITS");
526   TFolder *pMatch = obj2->GetAnalysisFolder(); 
527
528   AliPerformanceMatch *obj3 = (AliPerformanceMatch*)TPC->FindObject("AliPerformanceMatchITSTPC");
529   TFolder *pPull = obj3->GetAnalysisFolder();
530
531   //
532   // event level
533   //
534
535   TH1 *h1D = 0;
536   TH1 *h1D1 = 0;
537   TH1 *h1D2 = 0;
538   TH1 *h1D3 = 0;
539   TH2 *h2D = 0;
540   TH2 *h2D1 = 0;
541
542   TCanvas *can8 = new TCanvas("can8","TPC-ITS Matching Efficiency",800,800); 
543   can8->Divide(2,2);
544
545   can8->cd(1);
546   h2D = (TH2*)(pMatch->FindObject("h_tpc_match_trackingeff_all_2_3"));
547   h2D1 = (TH2*)(pMatch->FindObject("h_tpc_match_trackingeff_tpc_2_3"));
548   TH2 *h2D2 = h2D->Clone("h2D2");
549   TH2 *h2D3 = h2D1->Clone("h2D3");
550
551   h2D->GetXaxis()->SetRangeUser(0,1.5);
552   h2D1->GetXaxis()->SetRangeUser(0,1.5);
553   h1D = h2D->ProjectionY();
554   h1D1 = h2D1->ProjectionY();
555   h1D1->Divide(h1D);
556   h1D1->SetTitle("TPC-ITS Matching Efficiency (A)");
557   h1D1->Draw("e0");
558
559   can8->cd(2);
560   h2D2->GetXaxis()->SetRangeUser(-1.5,0);
561   h2D3->GetXaxis()->SetRangeUser(-1.5,0);
562   h1D2 = h2D2->ProjectionY();
563   h1D3 = h2D3->ProjectionY();
564   h1D3->Divide(h1D2);
565   h1D3->SetLineColor(2);
566   h1D3->SetTitle("TPC-ITS Matching Efficiency (C)");
567   h1D3->Draw("e0");
568
569   can8->cd(3);
570   h2D = (TH2*)(pMatch->FindObject("h_tpc_match_trackingeff_all_1_3"));
571   h2D1 = (TH2*)(pMatch->FindObject("h_tpc_match_trackingeff_tpc_1_3"));
572   TH2 *h2D4 = h2D->Clone("h2D4");
573   TH2 *h2D5 = h2D1->Clone("h2D5");
574
575   h2D->GetXaxis()->SetRangeUser(0,1.5);
576   h2D1->GetXaxis()->SetRangeUser(0,1.5);
577   h1D = h2D->ProjectionY();
578   h1D1 = h2D1->ProjectionY();
579   h1D1->Divide(h1D);
580   h1D1->SetTitle("TPC-ITS Matching Efficiency (A)");
581   h1D1->Draw("e0");
582
583   can8->cd(4);
584   h2D4->GetXaxis()->SetRangeUser(-1.5,0);
585   h2D5->GetXaxis()->SetRangeUser(-1.5,0);
586   h1D2 = h2D4->ProjectionY();
587   h1D3 = h2D5->ProjectionY();
588   h1D3->Divide(h1D2);
589   h1D3->SetLineColor(2);
590   h1D3->SetTitle("TPC-ITS Matching Efficiency (C)");
591   h1D3->Draw("e0");
592
593   can8->SaveAs("TPC-ITS.png");
594   //  TH2 *h2D = 0;
595
596   TCanvas *can9 = new TCanvas("can9","Pulls of TPC Tracks vs 1/pT",1200,800); 
597   can9->Divide(3,2);
598
599   TObjArray *arr1 = new TObjArray();
600   TObjArray *arr2 = new TObjArray();
601   TObjArray *arr3 = new TObjArray();
602   TObjArray *arr4 = new TObjArray();
603   TObjArray *arr5 = new TObjArray();
604
605   can9->cd(1);
606   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_0_7"));
607   h2D->FitSlicesY(0,0,-1,0,"QNR",arr1);
608   h2D->Draw("colz");
609   arr1->At(1)->Draw("same");
610
611   can9->cd(2);
612   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_1_7"));
613   h2D->FitSlicesY(0,0,-1,0,"QNR",arr2);
614   h2D->Draw("colz");
615   arr2->At(1)->Draw("same");
616
617   can9->cd(3);
618   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_2_7"));
619   h2D->FitSlicesY(0,0,-1,0,"QNR",arr3);
620   h2D->Draw("colz");
621   arr3->At(1)->Draw("same");
622
623   can9->cd(4);
624   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_3_7"));
625   h2D->FitSlicesY(0,0,-1,0,"QNR",arr4);
626   h2D->Draw("colz");
627   arr4->At(1)->Draw("same");
628
629   can9->cd(5);
630   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_4_7"));
631   h2D->FitSlicesY(0,0,-1,0,"QNR",arr5);
632   h2D->Draw("colz");
633   arr5->At(1)->Draw("same");
634   
635   can9->SaveAs("pull-pt.png");
636
637   TCanvas *can10 = new TCanvas("can10","Pulls of TPC Tracks vs Eta",1200,800); 
638   can10->Divide(3,2);
639
640   TObjArray *arr6 = new TObjArray();
641   TObjArray *arr7 = new TObjArray();
642   TObjArray *arr8 = new TObjArray();
643   TObjArray *arr9 = new TObjArray();
644   TObjArray *arr10 = new TObjArray();
645
646   can10->cd(1);
647   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_0_6"));
648   h2D->FitSlicesY(0,0,-1,0,"QNR",arr6);
649   h2D->Draw("colz");
650   arr6->At(1)->Draw("same");
651
652   can10->cd(2);
653   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_1_6"));
654   h2D->FitSlicesY(0,0,-1,0,"QNR",arr7);
655   h2D->Draw("colz");
656   arr7->At(1)->Draw("same");
657
658   can10->cd(3);
659   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_2_6"));
660   h2D->FitSlicesY(0,0,-1,0,"QNR",arr8);
661   h2D->Draw("colz");
662   arr8->At(1)->Draw("same");
663
664   can10->cd(4);
665   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_3_6"));
666   h2D->FitSlicesY(0,0,-1,0,"QNR",arr9);
667   h2D->Draw("colz");
668   arr9->At(1)->Draw("same");
669
670   can10->cd(5);
671   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_4_6"));
672   h2D->FitSlicesY(0,0,-1,0,"QNR",arr10);
673   h2D->Draw("colz");
674   arr10->At(1)->Draw("same");
675   
676   can10->SaveAs("pull-eta.png");
677
678   TCanvas *can11 = new TCanvas("can11","Pulls of TPC Tracks vs Phi",1200,800); 
679   can11->Divide(3,2);
680
681   TObjArray *arr11 = new TObjArray();
682   TObjArray *arr12 = new TObjArray();
683   TObjArray *arr13 = new TObjArray();
684   TObjArray *arr14 = new TObjArray();
685   TObjArray *arr15 = new TObjArray();
686
687   can11->cd(1);
688   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_0_5"));
689   h2D->FitSlicesY(0,0,-1,0,"QNR",arr11);
690   h2D->Draw("colz");
691   arr11->At(1)->Draw("same");
692
693   can11->cd(2);
694   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_1_5"));
695   h2D->FitSlicesY(0,0,-1,0,"QNR",arr12);
696   h2D->Draw("colz");
697   arr12->At(1)->Draw("same");
698
699   can11->cd(3);
700   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_2_5"));
701   h2D->FitSlicesY(0,0,-1,0,"QNR",arr13);
702   h2D->Draw("colz");
703   arr13->At(1)->Draw("same");
704
705   can11->cd(4);
706   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_3_5"));
707   h2D->FitSlicesY(0,0,-1,0,"QNR",arr14);
708   h2D->Draw("colz");
709   arr14->At(1)->Draw("same");
710
711   can11->cd(5);
712   h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_4_5"));
713   h2D->FitSlicesY(0,0,-1,0,"QNR",arr15);
714   h2D->Draw("colz");
715   arr15->At(1)->Draw("same");
716   
717   can11->SaveAs("pull-phi.png");
718
719   AliPerformanceMatch *obj4 = (AliPerformanceMatch*)TPC->FindObject("AliPerformanceMatchTPCConstrain");
720   TFolder *pConstrain = obj4->GetAnalysisFolder();
721
722   TCanvas *can12 = new TCanvas("can12","#delta_{sin#phi}/#sigma_{sin#phi}",800,800); 
723   can12->Divide(2,2);
724
725   h3D = (TH3*)pConstrain->FindObject("h_tpc_constrain_tpc_0_2_3");
726   TH3 *h31 = h3D->Clone("h31");  
727
728   can12->cd(1);
729   h3D->GetZaxis()->SetRangeUser(0,maxeta);
730   //  h3D->GetYaxis()->SetRangeUser(0.25,10);
731   h2D = (TH2*)h3D->Project3D("xy");
732   h2D->Draw("colz");
733   h2D->SetTitle("A Side");
734   h2D->SetYTitle("(sin#phi_{TPC} - sin#phi_{Global})/#sigma");
735   h2D->FitSlicesY(0,0,-1,0,"QNR",arr11);
736   arr11->At(1)->Draw("same");  
737   TH1 *width1 = (TH1*)arr11->At(2);
738   width1->Draw("same");
739   width1->SetLineColor(2);
740
741   /*  h3D->Project3D("xy")->Draw("colz");
742       h3D->Project3D("xy")->SetTitle("A Side");
743       h3D->Project3D("xy")->SetYTitle("#delta_{sin#phi}/#sigma_{sin#phi}");
744       h3D->Project3D("xy")->FitSlicesY(0,0,-1,0,"QNR",arr11);
745       arr11->At(1)->Draw("same");  */
746
747   can12->cd(2);
748   h31->GetZaxis()->SetRangeUser(mineta,-0.001);
749   //  h31->GetYaxis()->SetRangeUser(0.25,10);
750   h2D = (TH2*)h31->Project3D("xy");
751   h2D->Draw("colz");
752   h2D->SetTitle("C Side");
753   h2D->SetYTitle("(sin#phi_{TPC} - sin#phi_{Global})/#sigma");
754   h2D->FitSlicesY(0,0,-1,0,"QNR",arr12);
755   arr12->At(1)->Draw("same");  
756   TH1 *width2 = (TH1*)arr12->At(2);
757   width2->Draw("same");
758   width2->SetLineColor(2);
759
760   /*  h31->Project3D("xy")->Draw("colz");
761       h31->Project3D("xy")->SetTitle("C Side");
762       h31->Project3D("xy")->SetYTitle("#delta_{sin#phi}/#sigma_{sin#phi}");
763       h31->Project3D("xy")->FitSlicesY(0,0,-1,0,"QNR",arr12);
764       arr12->At(1)->Draw("same");  */
765
766   can12->cd(3);
767   h3D = (TH3*)pConstrain->FindObject("h_tpc_constrain_tpc_0_1_3");
768   h3D->GetZaxis()->SetRangeUser(0,maxeta);
769   TH3 *h32 = h3D->Clone("h32");  
770   h2D = (TH2*)h3D->Project3D("xy");
771   h2D->Draw("colz");
772   h2D->SetTitle("A Side");
773   h2D->SetYTitle("(sin#phi_{TPC} - sin#phi_{Global})/#sigma");
774   h2D->FitSlicesY(0,0,-1,0,"QNR",arr13);
775   arr13->At(1)->Draw("same");  
776   TH1 *width3 = (TH1*)arr13->At(2);
777   width3->Draw("same");
778   width3->SetLineColor(2);
779
780   /*  h3D->Project3D("xy")->Draw("colz");
781       h3D->Project3D("xy")->SetTitle("A Side");
782       h3D->Project3D("xy")->SetYTitle("#delta_{sin#phi}/#sigma_{sin#phi}");
783       h3D->Project3D("xy")->FitSlicesY(0,0,-1,0,"QNR",arr13);
784       arr13->At(1)->Draw("same");  */
785
786   can12->cd(4);
787   h32->GetZaxis()->SetRangeUser(mineta,-0.001);
788   h2D = (TH2*)h32->Project3D("xy");
789   h2D->Draw("colz");
790   h2D->SetTitle("C Side");
791   h2D->SetYTitle("(sin#phi_{TPC} - sin#phi_{Global})/#sigma");
792   h2D->FitSlicesY(0,0,-1,0,"QNR",arr14);
793   arr14->At(1)->Draw("same");  
794   TH1 *width4 = (TH1*)arr14->At(2);
795   width4->Draw("same");
796   width4->SetLineColor(2);
797
798   /*  h32->Project3D("xy")->Draw("colz");
799       h32->Project3D("xy")->SetTitle("C Side");
800       h32->Project3D("xy")->SetYTitle("#delta_{sin#phi}/#sigma_{sin#phi}");
801       h32->Project3D("xy")->FitSlicesY(0,0,-1,0,"QNR",arr14);
802       arr14->At(1)->Draw("same");  */
803
804   can12->SaveAs("pullPhiConstrain.png");
805
806   //
807   // resolution and efficiency plots from David - added by Patrick
808   //
809   /*
810      AliPerformanceRes *objPerfRes = (AliPerformanceRes*) TPC->FindObject("AliPerformanceRes");
811      if (objPerfRes == NULL) {printf("Error getting AliPerformanceRes\n");}
812      TFolder *folderRes = objPerfRes->GetAnalysisFolder();
813      TH1F* h_resPt_vs_Pt       = (TH1F*)folderRes->FindObject("h_res_4_vs_9");
814      TH1F* h_mean_resPt_vs_Pt  = (TH1F*)folderRes->FindObject("h_mean_res_4_vs_9");
815      TH1F* h_pullPt_vs_Pt      = (TH1F*)folderRes->FindObject("h_pull_4_vs_9");
816      TH1F* h_mean_pullPt_vs_Pt = (TH1F*)folderRes->FindObject("h_mean_pull_4_vs_9");
817
818      TCanvas *can13 = new TCanvas("can13","Resolution p_{T}",800,800);
819      can13->Divide(2,2);
820      can13->cd(1);
821      h_resPt_vs_Pt      ->Draw();
822      can13->cd(2);
823      h_mean_resPt_vs_Pt ->Draw();
824      can13->cd(3);
825      h_pullPt_vs_Pt     ->Draw();
826      can13->cd(4);
827      h_mean_pullPt_vs_Pt->Draw();
828
829      can13->SaveAs("res_pT_1overpT.png");       
830
831      AliPerformanceEff *objPerfEff = (AliPerformanceEff*) TPC->FindObject("AliPerformanceEff");
832      if (objPerfEff == NULL) {printf("Error getting AliPerformanceEff\n");}
833      TFolder *folderEff = objPerfEff->GetAnalysisFolder();
834      TH1F* eta_all              = (TH1F*)folderEff->FindObject("etaRecEff");
835      TH1F* eta_all_neg          = (TH1F*)folderEff->FindObject("etaRecEffNeg");
836      TH1F* eta_all_pos          = (TH1F*)folderEff->FindObject("etaRecEffPos");
837      TH1F* phi_all              = (TH1F*)folderEff->FindObject("phiRecEff");
838      TH1F* phi_all_neg          = (TH1F*)folderEff->FindObject("phiRecEffNeg");
839      TH1F* phi_all_pos          = (TH1F*)folderEff->FindObject("phiRecEffPos");
840      TH1F* pt_all               = (TH1F*)folderEff->FindObject("ptRecEff");
841      TH1F* pt_all_neg           = (TH1F*)folderEff->FindObject("ptRecEffNeg");
842      TH1F* pt_all_pos           = (TH1F*)folderEff->FindObject("ptRecEffPos");
843      TH1F* eta_all_findable     = (TH1F*)folderEff->FindObject("etaRecEffF");
844      TH1F* eta_all_findable_neg = (TH1F*)folderEff->FindObject("etaRecEffFNeg");
845      TH1F* eta_all_findable_pos = (TH1F*)folderEff->FindObject("etaRecEffFPos");
846      TH1F* phi_all_findable     = (TH1F*)folderEff->FindObject("phiRecEffF");
847      TH1F* phi_all_findable_neg = (TH1F*)folderEff->FindObject("phiRecEffFNeg");
848      TH1F* phi_all_findable_pos = (TH1F*)folderEff->FindObject("phiRecEffFPos");
849      TH1F* pt_all_findable      = (TH1F*)folderEff->FindObject("ptRecEffF");
850      TH1F* pt_all_findable_neg  = (TH1F*)folderEff->FindObject("ptRecEffFNeg");
851      TH1F* pt_all_findable_pos  = (TH1F*)folderEff->FindObject("ptRecEffFPos");
852      TH1F* eta_Pi               = (TH1F*)folderEff->FindObject("etaRecEffPi");
853      TH1F* eta_Pi_neg           = (TH1F*)folderEff->FindObject("etaRecEffPiNeg");
854      TH1F* eta_Pi_pos           = (TH1F*)folderEff->FindObject("etaRecEffPiPos");
855      TH1F* phi_Pi               = (TH1F*)folderEff->FindObject("phiRecEffPi");
856      TH1F* phi_Pi_neg           = (TH1F*)folderEff->FindObject("phiRecEffPiNeg");
857      TH1F* phi_Pi_pos           = (TH1F*)folderEff->FindObject("phiRecEffPiPos");
858      TH1F* pt_Pi                = (TH1F*)folderEff->FindObject("ptRecEffPi");
859      TH1F* pt_Pi_neg            = (TH1F*)folderEff->FindObject("ptRecEffPiNeg");
860      TH1F* pt_Pi_pos            = (TH1F*)folderEff->FindObject("ptRecEffPiPos");
861      TH1F* eta_K                = (TH1F*)folderEff->FindObject("etaRecEffK");
862      TH1F* eta_K_neg            = (TH1F*)folderEff->FindObject("etaRecEffKNeg");
863      TH1F* eta_K_pos            = (TH1F*)folderEff->FindObject("etaRecEffKPos");
864      TH1F* phi_K                = (TH1F*)folderEff->FindObject("phiRecEffK");
865      TH1F* phi_K_neg            = (TH1F*)folderEff->FindObject("phiRecEffKNeg");
866      TH1F* phi_K_pos            = (TH1F*)folderEff->FindObject("phiRecEffKPos");
867      TH1F* pt_K                 = (TH1F*)folderEff->FindObject("ptRecEffK");
868      TH1F* pt_K_neg             = (TH1F*)folderEff->FindObject("ptRecEffKNeg");
869      TH1F* pt_K_pos             = (TH1F*)folderEff->FindObject("ptRecEffKPos");
870      TH1F* eta_P                = (TH1F*)folderEff->FindObject("etaRecEffP");
871      TH1F* eta_P_neg            = (TH1F*)folderEff->FindObject("etaRecEffPNeg");
872      TH1F* eta_P_pos            = (TH1F*)folderEff->FindObject("etaRecEffPPos");
873      TH1F* phi_P                = (TH1F*)folderEff->FindObject("phiRecEffP");
874      TH1F* phi_P_neg            = (TH1F*)folderEff->FindObject("phiRecEffPNeg");
875      TH1F* phi_P_pos            = (TH1F*)folderEff->FindObject("phiRecEffPPos");
876      TH1F* pt_P                 = (TH1F*)folderEff->FindObject("ptRecEffP");
877      TH1F* pt_P_neg             = (TH1F*)folderEff->FindObject("ptRecEffPNeg");
878      TH1F* pt_P_pos             = (TH1F*)folderEff->FindObject("ptRecEffPPos");
879      eta_all             ->SetLineWidth(2);
880   eta_all_neg         ->SetLineColor(kRed);
881   eta_all_pos         ->SetLineColor(kBlue);
882   phi_all             ->SetLineWidth(2);
883   phi_all_neg         ->SetLineColor(kRed);
884   phi_all_pos         ->SetLineColor(kBlue);
885   pt_all              ->SetLineWidth(2);
886   pt_all_neg          ->SetLineColor(kRed);
887   pt_all_pos          ->SetLineColor(kBlue);
888   eta_all_findable    ->SetLineWidth(2);
889   eta_all_findable_neg->SetLineColor(kRed);
890   eta_all_findable_pos->SetLineColor(kBlue);
891   phi_all_findable    ->SetLineWidth(2);
892   phi_all_findable_neg->SetLineColor(kRed);
893   phi_all_findable_pos->SetLineColor(kBlue);
894   pt_all_findable     ->SetLineWidth(2);
895   pt_all_findable_neg ->SetLineColor(kRed);
896   pt_all_findable_pos ->SetLineColor(kBlue);
897   eta_Pi              ->SetLineWidth(2);
898   eta_Pi_neg          ->SetLineColor(kRed);
899   eta_Pi_pos          ->SetLineColor(kBlue);
900   phi_Pi              ->SetLineWidth(2);
901   phi_Pi_neg          ->SetLineColor(kRed);
902   phi_Pi_pos          ->SetLineColor(kBlue);
903   pt_Pi               ->SetLineWidth(2);
904   pt_Pi_neg           ->SetLineColor(kRed);
905   pt_Pi_pos           ->SetLineColor(kBlue);
906   eta_K               ->SetLineWidth(2);
907   eta_K_neg           ->SetLineColor(kRed);
908   eta_K_pos           ->SetLineColor(kBlue);
909   phi_K               ->SetLineWidth(2);
910   phi_K_neg           ->SetLineColor(kRed);
911   phi_K_pos           ->SetLineColor(kBlue);
912   pt_K                ->SetLineWidth(2);
913   pt_K_neg            ->SetLineColor(kRed);
914   pt_K_pos            ->SetLineColor(kBlue);
915   eta_P               ->SetLineWidth(2);
916   eta_P_neg           ->SetLineColor(kRed);
917   eta_P_pos           ->SetLineColor(kBlue);
918   phi_P               ->SetLineWidth(2);
919   phi_P_neg           ->SetLineColor(kRed);
920   phi_P_pos           ->SetLineColor(kBlue);
921   pt_P                ->SetLineWidth(2);
922   pt_P_neg            ->SetLineColor(kRed);
923   pt_P_pos            ->SetLineColor(kBlue);
924
925   TCanvas *can14 = new TCanvas("can14","Efficiency All",1000,800);
926   can14->Divide(3, 2);
927   can14->cd(1);
928   eta_all             ->Draw();
929   eta_all_neg         ->Draw("same");
930   eta_all_pos         ->Draw("same");
931   can14->cd(2);
932   phi_all             ->Draw();
933   phi_all_neg         ->Draw("same");
934   phi_all_pos         ->Draw("same");
935   can14->cd(3);
936   pt_all              ->Draw();
937   pt_all_neg          ->Draw("same");
938   pt_all_pos          ->Draw("same");
939   can14->cd(4);
940   eta_all_findable    ->Draw();
941   eta_all_findable_neg->Draw("same");
942   eta_all_findable_pos->Draw("same");
943   can14->cd(5);
944   phi_all_findable    ->Draw();
945   phi_all_findable_neg->Draw("same");
946   phi_all_findable_pos->Draw("same");
947   can14->cd(6);
948   pt_all_findable     ->Draw();
949   pt_all_findable_neg ->Draw("same");
950   pt_all_findable_pos ->Draw("same");
951
952   can14->SaveAs("eff_all+all_findable.png");    
953
954   TCanvas *can15 = new TCanvas("can15","Efficiency Pi K P",1000,1000);
955   can15->Divide(3, 3);
956   can15->cd(1);
957   eta_Pi              ->Draw();
958   eta_Pi_neg          ->Draw("same");
959   eta_Pi_pos          ->Draw("same");
960   can15->cd(2);
961   phi_Pi              ->Draw();
962   phi_Pi_neg          ->Draw("same");
963   phi_Pi_pos          ->Draw("same");
964   can15->cd(3);
965   pt_Pi               ->Draw();
966   pt_Pi_neg           ->Draw("same");
967   pt_Pi_pos           ->Draw("same");
968   can15->cd(4);
969   eta_K               ->Draw();
970   eta_K_neg           ->Draw("same");
971   eta_K_pos           ->Draw("same");
972   can15->cd(5);
973   phi_K               ->Draw();
974   phi_K_neg           ->Draw("same");
975   phi_K_pos           ->Draw("same");
976   can15->cd(6);
977   pt_K                ->Draw();
978   pt_K_neg            ->Draw("same");
979   pt_K_pos            ->Draw("same");
980   can15->cd(7);
981   eta_P               ->Draw();
982   eta_P_neg           ->Draw("same");
983   eta_P_pos           ->Draw("same");
984   can15->cd(8);
985   phi_P               ->Draw();
986   phi_P_neg           ->Draw("same");
987   phi_P_pos           ->Draw("same");
988   can15->cd(9);
989   pt_P                ->Draw();
990   pt_P_neg            ->Draw("same");
991   pt_P_pos            ->Draw("same");
992
993   can15->SaveAs("eff_Pi_K_P.png");      
994
995   //get more histos from THnSparse...
996   THnSparseF* EffHisto = (THnSparseF*) objPerfEff->GetEffHisto();
997   //mceta:mcphi:mcpt:pid:recStatus:findable:charge:nclones:nfakes
998   //pid:e-=0,mu-=1,pi+=2,K+=3,p+=4
999   TH1* h_pid    = (TH1*) EffHisto->Projection(3);
1000   TH1* h_charge = (TH1*) EffHisto->Projection(6);
1001   //TH1* h_find  = (TH1*) EffHisto->Projection(5);
1002   //TH1* eta_All = (TH1*) EffHisto->Projection(0);
1003
1004   cout<<"before setrange"<<endl;
1005   EffHisto->GetAxis(5)->SetRangeUser(1, 1.999); //set findable
1006   EffHisto->GetAxis(3)->SetRangeUser(2, 2.999); //set pion
1007   cout<<"after setrange"<<endl;
1008   TH1* h_charge_sel = (TH1*) EffHisto->Projection(6);
1009   cout<<"after projection"<<endl;
1010   EffHisto->GetAxis(6)->UnZoom(); //set all charges
1011   TH1* eta_Pi_findable = (TH1*) EffHisto->Projection(0);
1012   TH1* phi_Pi_findable = (TH1*) EffHisto->Projection(1);
1013   TH1* pt_Pi_findable  = (TH1*) EffHisto->Projection(2);
1014   EffHisto->GetAxis(6)->SetRangeUser(-1.5, -0.499); //set negative
1015   TH1* eta_Pi_findable_neg = (TH1*) EffHisto->Projection(0);
1016   TH1* phi_Pi_findable_neg = (TH1*) EffHisto->Projection(1);
1017   TH1* pt_Pi_findable_neg  = (TH1*) EffHisto->Projection(2);
1018   EffHisto->GetAxis(6)->SetRangeUser(0.5, 1.499); //set positive
1019   TH1* eta_Pi_findable_pos = (TH1*) EffHisto->Projection(0);
1020   TH1* phi_Pi_findable_pos = (TH1*) EffHisto->Projection(1);
1021   TH1* pt_Pi_findable_pos  = (TH1*) EffHisto->Projection(2);
1022   //EffHisto->GetAxis(3)->SetRangeUser(3, 3.999); //set kaon
1023   //EffHisto->GetAxis(6)->UnZoom(); //set all charges
1024
1025   //EffHisto->GetAxis(3)->SetRangeUser(4, 4.999); //set proton
1026
1027   eta_Pi_findable     ->SetLineWidth(2);
1028   eta_Pi_findable_neg ->SetLineColor(kRed);
1029   eta_Pi_findable_pos ->SetLineColor(kBlue);
1030   phi_Pi_findable     ->SetLineWidth(2);
1031   phi_Pi_findable_neg ->SetLineColor(kRed);
1032   phi_Pi_findable_pos ->SetLineColor(kBlue);
1033   pt_Pi_findable      ->SetLineWidth(2);
1034   pt_Pi_findable_neg  ->SetLineColor(kRed);
1035   pt_Pi_findable_pos  ->SetLineColor(kBlue);
1036   //eta_K_findable      ->SetLineWidth(2);
1037   //eta_K_findable_neg  ->SetLineColor(kRed);
1038   //eta_K_findable_pos  ->SetLineColor(kBlue);
1039   //phi_K_findable      ->SetLineWidth(2);
1040   //phi_K_findable_neg  ->SetLineColor(kRed);
1041   //phi_K_findable_pos  ->SetLineColor(kBlue);
1042   //pt_K_findable       ->SetLineWidth(2);
1043   //pt_K_findable_neg   ->SetLineColor(kRed);
1044   //pt_K_findable_pos   ->SetLineColor(kBlue);
1045   //eta_P_findable      ->SetLineWidth(2);
1046   //eta_P_findable_neg  ->SetLineColor(kRed);
1047   //eta_P_findable_pos  ->SetLineColor(kBlue);
1048   //phi_P_findable      ->SetLineWidth(2);
1049   //phi_P_findable_neg  ->SetLineColor(kRed);
1050   //phi_P_findable_pos  ->SetLineColor(kBlue);
1051   //pt_P_findable       ->SetLineWidth(2);
1052   //pt_P_findable_neg   ->SetLineColor(kRed);
1053   //pt_P_findable_pos   ->SetLineColor(kBlue);
1054
1055   TCanvas *can16 = new TCanvas("can16","Efficiency Pi K P findable",1000,1000);
1056   can16->Divide(3,3);
1057   can16->cd(7);
1058   h_pid->Draw();
1059   can16->cd(8);
1060   h_charge->Draw();
1061   can16->cd(9);
1062   h_charge_sel->Draw();
1063   can16->cd(1);
1064   eta_Pi_findable->Draw(); 
1065   eta_Pi_findable_neg->Draw("same"); 
1066   eta_Pi_findable_pos->Draw("same"); 
1067   can16->cd(2);
1068   phi_Pi_findable->Draw(); 
1069   phi_Pi_findable_neg->Draw("same"); 
1070   phi_Pi_findable_pos->Draw("same"); 
1071   can16->cd(3);
1072   pt_Pi_findable->Draw(); 
1073   pt_Pi_findable_neg->Draw("same"); 
1074   pt_Pi_findable_pos->Draw("same"); 
1075
1076   can16->SaveAs("eff_Pi_K_P_findable.png");     
1077   */
1078
1079     ofstream fout("runqa_exist");
1080   //if(NEvents>0)
1081   fout.precision(10);
1082   fout<<NEvents<<endl;
1083   fout.close();
1084
1085 }