]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/macros/tpcQA.C
- Coverity fixes
[u/mrichter/AliRoot.git] / PWGPP / macros / tpcQA.C
1 /*
2   //Analysis of the output of AliTPCtaskPID.
3   //3 6D histograms  - THnSparse created in the task:
4   //TPC raw dEdx
5   //TPC normalized dEdx (dEdx_rec/dNdx_mc)
6   //TPC PID probabilities
7   //
8   //The values are binned in following variables:
9   // Some of them are correlated - but THnSpase handle it  
10   //                               ~ 14 MBy per object needed
11   //
12
13
14   .x ~/NimStyle.C
15   .x ~/UliStyle.C
16   .L $ALICE_ROOT/PWGPP/Macros/tpcQA.C+
17   Init();
18   
19   // 0 - chi2
20   // 1 - number of clusters
21   // 2 - number of findable clusters
22   // 3 - number of clusters/ findable clusters  
23   // 4 - pt          - at the entrance of the TPC
24   // 5 - eta         - at the entrance of the TPC
25   // 6 - phi         - at the entrance of the TPC
26   GetProjection(fTPCqa,0,4,  0,10, -1,1, -3.14,3.14)  ->ProfileX()->Draw();
27   //
28   MakeReport();
29   
30  
31 */
32 #include "TFile.h"
33 #include "THnSparse.h"
34 #include "TH1F.h"
35 #include "TH2F.h"
36 #include "TProfile.h"
37 #include "TF1.h"
38
39 #include "TLegend.h"
40 #include "TCanvas.h"
41
42 #include "AliPID.h"
43
44 Int_t kmicolors[10]={1,2,3,4,6,7,8,9,10,11};
45 Int_t kmimarkers[10]={21,22,23,24,25,26,27,28,29,30};
46
47
48
49 THnSparse * fTPCqa     = 0;
50 TString selName;
51 Int_t version=0;
52
53 void Init(){
54   TFile *f = new TFile("OutputQA.root");
55   TObjArray *array= (TObjArray*)f->Get("tpcTaskQA");
56   delete f;
57   new TCanvas("dEdx study");
58   fTPCqa = (THnSparse*)array->At(0);
59 }
60
61
62 TH2F* GetProjection(THnSparse*his, Int_t i0, Int_t i1,  Float_t p0, Float_t p1, Float_t eta0, Float_t eta1, Float_t phi0, Float_t phi1){
63
64   his->GetAxis(4)->SetRangeUser(p0,p1);
65   his->GetAxis(5)->SetRangeUser(eta0,eta1);
66   his->GetAxis(6)->SetRangeUser(phi0,phi1);
67   TH2F * res = (TH2F*) his->Projection(i0,i1);
68   res->SetXTitle(his->GetAxis(i1)->GetTitle());
69   res->SetYTitle(his->GetAxis(i0)->GetTitle());
70   return res;
71 }
72
73 TH1F* GetProjection(THnSparse*his, Int_t i0,  Float_t p0, Float_t p1, Float_t eta0, Float_t eta1, Float_t phi0, Float_t phi1){
74   
75   his->GetAxis(4)->SetRangeUser(p0,p1);
76   his->GetAxis(5)->SetRangeUser(eta0,eta1);
77   his->GetAxis(6)->SetRangeUser(phi0,phi1);
78   TH1F * res = (TH1F*) his->Projection(i0);
79   res->SetXTitle(his->GetAxis(i0)->GetTitle());
80   return res;
81 }
82
83
84 void DrawChi2(){
85   //
86   //
87   //
88   TCanvas *canvas= new TCanvas("Chi2","Chi2");
89   canvas->Divide(2,2);
90   //
91   canvas->cd(1);
92   TH1 *hischi2  =  GetProjection(fTPCqa,0,  0,10, -0.9,0.9, -3.14,3.14); 
93   hischi2->SetXTitle("#chi^{2}/N_{cl}");
94   hischi2->Draw();
95   canvas->cd(2)->SetLogx(kTRUE);
96   TH1 *hischi2Pt  =  GetProjection(fTPCqa,0,4,  0,10, -0.9,0.9, -3.14,3.14)->ProfileX(); 
97   hischi2Pt->SetXTitle("p_{t} (GeV/c)");
98   hischi2Pt->SetYTitle("#chi^{2}/N_{cl}");
99   hischi2Pt->SetMinimum(0);
100   hischi2Pt->SetMaximum(4);
101   hischi2Pt->Draw();
102   //
103   canvas->cd(3)->SetLogx(kFALSE);
104   TH1 *hischi2Eta  =  GetProjection(fTPCqa,0,5,  0,10, -0.9,0.9, -3.14,3.14)->ProfileX(); 
105   hischi2Eta->SetXTitle("#eta");
106   hischi2Eta->SetYTitle("#chi^{2}/N_{cl}"); 
107   hischi2Eta->SetMinimum(0);
108   hischi2Eta->SetMaximum(4);
109   hischi2Eta->Draw();
110   
111   canvas->cd(4)->SetLogx(kFALSE);
112   TH1 *hischi2Phi  =  GetProjection(fTPCqa,0,6,  0,10, -0.9,0.9, -3.14,3.14)->ProfileX(); 
113   hischi2Phi->SetXTitle("#phi");
114   hischi2Phi->SetYTitle("#chi^{2}/N_{cl}");  
115   hischi2Phi->SetMinimum(0);
116   hischi2Phi->SetMaximum(4);
117   hischi2Phi->Draw();
118   
119   canvas->SaveAs("pic/chi2.eps");
120   canvas->SaveAs("pic/chi2.gif");
121 }
122
123
124
125 void DrawNclRatio(){
126   //
127   //
128   //
129   TCanvas *canvas= new TCanvas("Ncl_Nclf","Ncl_Nclf");
130   canvas->Divide(2,2);
131   //
132   canvas->cd(1);
133   TH1 *hischi2  =  GetProjection(fTPCqa,3,  0,10, -0.9,0.9, -3.14,3.14); 
134   hischi2->SetXTitle("N_{cl}/N_{f}");
135   hischi2->Draw();
136   canvas->cd(2)->SetLogx(kTRUE);
137   TH1 *hischi2Pt  =  GetProjection(fTPCqa,3,4,  0,10, -0.9,0.9, -3.14,3.14)->ProfileX(); 
138   hischi2Pt->SetXTitle("p_{t} (GeV/c)");
139   hischi2Pt->SetYTitle("N_{cl}/N_{f}");
140   hischi2Pt->SetMinimum(0.6);
141   hischi2Pt->SetMaximum(1.1);
142   hischi2Pt->Draw();
143   //
144   canvas->cd(3)->SetLogx(kFALSE);
145   TH1 *hischi2Eta  =  GetProjection(fTPCqa,3,5,  0,10, -0.9,0.9, -3.14,3.14)->ProfileX(); 
146   hischi2Eta->SetXTitle("#eta");
147   hischi2Eta->SetYTitle("N_{cl}/N_{f}"); 
148   hischi2Eta->SetMinimum(0.6);
149   hischi2Eta->SetMaximum(1.1);
150   hischi2Eta->Draw();
151   
152   canvas->cd(4)->SetLogx(kFALSE);
153   TH1 *hischi2Phi  =  GetProjection(fTPCqa,3,6,  0,10, -0.9,0.9, -3.14,3.14)->ProfileX(); 
154   hischi2Phi->SetXTitle("#phi");
155   hischi2Phi->SetYTitle("N_{cl}/N_{f}");  
156   hischi2Phi->SetMinimum(0.6);
157   hischi2Phi->SetMaximum(1.1);
158   hischi2Phi->Draw();
159   
160   canvas->SaveAs("pic/nclratio.eps");
161   canvas->SaveAs("pic/nclratio.gif");
162 }
163
164
165 void DrawNcl(){
166   //
167   //
168   //
169   TCanvas *canvas= new TCanvas("Ncl","Ncl");
170   canvas->Divide(2,2);
171   //
172   canvas->cd(1);
173   TH1 *hischi2  =  GetProjection(fTPCqa,1,  0.5,10, -0.9,0.9, -3.14,3.14); 
174   hischi2->SetXTitle("N_{cl}");
175   hischi2->Draw();
176   canvas->cd(2)->SetLogx(kTRUE);
177   TH1 *hischi2Pt  =  GetProjection(fTPCqa,1,4,  0.5,10, -0.9,0.9, -3.14,3.14)->ProfileX(); 
178   hischi2Pt->SetXTitle("p_{t} (GeV/c)");
179   hischi2Pt->SetYTitle("N_{cl}");
180   hischi2Pt->SetMinimum(50);
181   hischi2Pt->SetMaximum(160);
182   hischi2Pt->Draw();
183   //
184   canvas->cd(3)->SetLogx(kFALSE);
185   TH1 *hischi2Eta  =  GetProjection(fTPCqa,1,5,  0.5,10, -0.9,0.9, -3.14,3.14)->ProfileX(); 
186   hischi2Eta->SetXTitle("#eta");
187   hischi2Eta->SetYTitle("N_{cl}"); 
188   hischi2Eta->SetMinimum(50);
189   hischi2Eta->SetMaximum(160);
190   hischi2Eta->Draw();
191   
192   canvas->cd(4)->SetLogx(kFALSE);
193   TH1 *hischi2Phi  =  GetProjection(fTPCqa,1,6,  0.5,10, -0.9,0.9, -3.14,3.14)->ProfileX(); 
194   hischi2Phi->SetXTitle("#phi");
195   hischi2Phi->SetYTitle("N_{cl}");  
196   hischi2Phi->SetMinimum(50);
197   hischi2Phi->SetMaximum(160);
198   hischi2Phi->Draw();
199
200   canvas->SaveAs("pic/ncl.eps");
201   canvas->SaveAs("pic/ncl.gif");
202 }
203
204 void MakeReport(){
205   DrawNcl();
206   DrawNclRatio();
207   DrawChi2();
208 }