]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/SPECTRA/macros/drawProtonResults.C
dE/dx slices in P
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / macros / drawProtonResults.C
1 void drawProtonResults(const char* analysisOutput = 0x0,
2                        Bool_t kShowResults = kTRUE,
3                        Bool_t kShowQAPlots = kFALSE,
4                        Bool_t kMC = kFALSE) {
5   //Macro to visualize the proton ratio results
6   //It also visualizes the QA plots
7   gStyle->SetPalette(1,0);
8   if(!analysisOutput)
9     Error("drawProtonResults::The analysis output was not defined!!!");
10   if(kShowResults) drawResults(analysisOutput);
11   if(kShowQAPlots) drawQAPlots(analysisOutput, kMC);
12 }
13
14 //___________________________________________________//
15 void drawResults(const char* analysisOutput) {
16   //Draws the main results from the ratio analysis
17   gSystem->Load("libANALYSIS.so");
18   gSystem->Load("libANALYSISalice.so");
19   gSystem->Load("libCORRFW.so");
20   gSystem->Load("libPWG2spectra.so");
21
22   //Create the AliProtonAnalysis object
23   AliProtonAnalysis *analysis = new AliProtonAnalysis();
24   analysis->ReadFromFile(analysisOutput);
25   TH1F *gHistEventStats = dynamic_cast<TH1F *>(analysis->GetEventStatistics());
26   TH2D *gHistYPtProtons = dynamic_cast<TH2D *>(analysis->GetProtonYPtHistogram());
27   TH2D *gHistYPtAntiProtons = dynamic_cast<TH2D *>(analysis->GetAntiProtonYPtHistogram());
28   TH1D *gHistYProtons = dynamic_cast<TH1D *>(analysis->GetProtonYHistogram());
29   TH1D *gHistYAntiProtons = dynamic_cast<TH1D *>(analysis->GetAntiProtonYHistogram());
30   TH1D *gHistPtProtons = dynamic_cast<TH1D *>(analysis->GetProtonPtHistogram());
31   TH1D *gHistPtAntiProtons = dynamic_cast<TH1D *>(analysis->GetAntiProtonPtHistogram());
32   TH1D *gHistYRatio = dynamic_cast<TH1D *>(analysis->GetYRatioHistogram());
33   TH1D *gHistPtRatio = dynamic_cast<TH1D *>(analysis->GetPtRatioHistogram());
34
35   //==================================================================//
36   TH2F *hEmptyRatio = new TH2F("hEmptyRatio",";;#bar{p}/p",100,-1.1,1.1,100,0.1,1.1);
37   hEmptyRatio->SetStats(kFALSE);
38   hEmptyRatio->GetXaxis()->SetNdivisions(10);
39   hEmptyRatio->GetYaxis()->SetNdivisions(10);
40
41   TLatex *latex = new TLatex();
42   latex->SetTextSize(0.04);
43   latex->SetTextColor(2);
44
45   TF1 *fFitFunction = new TF1("fFitFunction","[0]",-0.5,0.5);
46   fFitFunction->SetParameter(0,0.7);
47
48   TCanvas *c2D = new TCanvas("c2D","eta-pT (anti)protons",0,0,700,400);
49   c2D->SetFillColor(10); c2D->SetHighLightColor(10); c2D->Divide(2,1);
50   c2D->cd(1); gHistYPtProtons->Draw("col");
51   c2D->cd(2); gHistYPtAntiProtons->Draw("col");
52
53   TCanvas *cEventStats = new TCanvas("cEventStats","Event statistics",
54                                      0,0,500,500);
55   cEventStats->SetFillColor(10); cEventStats->SetHighLightColor(10);
56   gHistEventStats->Draw();
57
58   TCanvas *cEta = new TCanvas("cEta","Eta",100,0,600,400);
59   cEta->SetFillColor(10); cEta->SetHighLightColor(10); cEta->Divide(2,1);
60   cEta->cd(1); gHistYProtons->Draw("E"); PrintYields(gHistYProtons);
61   cEta->cd(2); gHistYAntiProtons->Draw("E"); PrintYields(gHistYAntiProtons);
62
63   TCanvas *cPt = new TCanvas("cPt","Pt",100,200,600,400);
64   cPt->SetFillColor(10); cPt->SetHighLightColor(10); cPt->Divide(2,1);
65   cPt->cd(1)->SetLogy(); gHistPtProtons->Draw("E");
66   cPt->cd(2)->SetLogy(); gHistPtAntiProtons->Draw("E");
67
68   TCanvas *cRatio = new TCanvas("cRatio","Ratio",300,0,600,400);
69   cRatio->SetFillColor(10); cRatio->SetHighLightColor(10); cRatio->Divide(2,1);
70   cRatio->cd(1); hEmptyRatio->GetXaxis()->SetTitle("eta"); 
71   hEmptyRatio->GetXaxis()->SetRangeUser(-1.0,1.0); 
72   hEmptyRatio->DrawCopy(); gHistYRatio->Draw("ESAME");
73   gHistYRatio->Fit("fFitFunction","N");
74   latex->DrawLatex(-0.1,0.45,"ALICE PRELIMINARY");
75   latex->DrawLatex(-0.1,0.4,"p-p: #sqrt{s} = 900 GeV");
76   cRatio->cd(2);  hEmptyRatio->GetXaxis()->SetTitle("P_{T} [GeV/c]"); 
77   hEmptyRatio->GetXaxis()->SetRangeUser(0.3,1.1); 
78   hEmptyRatio->DrawCopy(); gHistPtRatio->Draw("ESAME");
79   latex->DrawLatex(0.6,0.45,"ALICE PRELIMINARY");
80   latex->DrawLatex(0.6,0.4,"p-p: #sqrt{s} = 900 GeV");
81
82
83   Printf("==========================================");
84   for(Int_t iBin = 1; iBin <= gHistYRatio->GetNbinsX(); iBin++)
85     Printf("Eta: %lf - Ratio: %lf - Error: %lf",
86            gHistYRatio->GetBinCenter(iBin),
87            gHistYRatio->GetBinContent(iBin),
88            gHistYRatio->GetBinError(iBin));
89   Printf("==========================================");
90
91   Printf("Fit result: %lf - %lf",fFitFunction->GetParameter(0),fFitFunction->GetParError(0));
92   analysis->PrintMean(gHistYRatio,0.5);
93   Printf("==========================================");
94 }
95
96 //___________________________________________________//
97 void drawQAPlots(const char* analysisOutput,
98                  Bool_t kMC) {
99   //Draws the QA plots from the output of the analysis
100   //=========================================================//
101   //List of cuts
102   TFile *fCutFile = TFile::Open("ListOfCuts.root");
103   TCanvas *cListOfCuts = dynamic_cast<TCanvas *>(fCutFile->Get("cListOfCuts"));
104   cListOfCuts->Draw();
105
106   //=========================================================//
107   //QA plots
108   TFile *f = TFile::Open(analysisOutput);
109   TList *listQA = dynamic_cast<TList *>(f->Get("outputQAList"));
110   TList *gListGlobalQA = dynamic_cast<TList *>(listQA->At(0));
111
112   //================QA plots================//
113   TList *fQA2DList = dynamic_cast<TList *>(gListGlobalQA->At(0));
114   //2D de/dx vs P
115   TH2F *gHistdEdxP = dynamic_cast<TH2F *>(fQA2DList->At(0));
116   gHistdEdxP->SetStats(kFALSE);
117   drawdEdx(gHistdEdxP);
118   TH2F *gHistProtonsdEdxP = dynamic_cast<TH2F *>(fQA2DList->At(1));
119   gHistProtonsdEdxP->SetStats(kFALSE);
120
121   //Theoretical Bethe-Bloch
122   Double_t fAlephParameters[5];
123   if(kMC) {
124     fAlephParameters[0] = 2.15898e+00/50.;
125     fAlephParameters[1] = 1.75295e+01;
126     fAlephParameters[2] = 3.40030e-09;
127     fAlephParameters[3] = 1.96178e+00;
128     fAlephParameters[4] = 3.91720e+00;
129   }
130   else {
131     fAlephParameters[0] = 0.0283086;
132     fAlephParameters[1] = 2.63394e+01;
133     fAlephParameters[2] = 5.04114e-11;
134     fAlephParameters[3] = 2.12543e+00;
135     fAlephParameters[4] = 4.88663e+00;
136   }
137
138   AliTPCPIDResponse *tpcResponse = new AliTPCPIDResponse();
139   tpcResponse->SetBetheBlochParameters(fAlephParameters[0],
140                                        fAlephParameters[1],
141                                        fAlephParameters[2],
142                                        fAlephParameters[3],
143                                        fAlephParameters[4]);
144   const Int_t nEntries = 10000;
145   Double_t mom[nEntries];
146   Double_t dEdxElectrons[nEntries];
147   Double_t dEdxMuons[nEntries];
148   Double_t dEdxPions[nEntries];
149   Double_t dEdxKaons[nEntries];
150   Double_t dEdxProtons[nEntries];
151   for(Int_t i = 0; i < nEntries; i++) {
152     mom[i] = 0.01 + 0.01*i;
153     dEdxElectrons[i] = tpcResponse->GetExpectedSignal(mom[i],0);
154     dEdxMuons[i] = tpcResponse->GetExpectedSignal(mom[i],1);
155     dEdxPions[i] = tpcResponse->GetExpectedSignal(mom[i],2);
156     dEdxKaons[i] = tpcResponse->GetExpectedSignal(mom[i],3);
157     dEdxProtons[i] = tpcResponse->GetExpectedSignal(mom[i],4);
158   }
159
160   TGraph *grElectrons = new TGraph(nEntries,mom,dEdxElectrons);
161   grElectrons->SetName("grElectrons");
162   grElectrons->SetLineColor(6); grElectrons->SetLineWidth(2);
163   TGraph *grMuons = new TGraph(nEntries,mom,dEdxMuons);
164   grMuons->SetLineColor(3); grMuons->SetLineWidth(2);
165   grMuons->SetName("grMuons");
166   TGraph *grPions = new TGraph(nEntries,mom,dEdxPions);
167   grPions->SetLineColor(1); grPions->SetLineWidth(2);
168   grPions->SetName("grPions");
169   TGraph *grKaons = new TGraph(nEntries,mom,dEdxKaons);
170   grKaons->SetLineColor(2); grKaons->SetLineWidth(2);
171   grKaons->SetName("grKaons");
172   TGraph *grProtons = new TGraph(nEntries,mom,dEdxProtons);
173   grProtons->SetLineColor(4); grProtons->SetLineWidth(2);
174   grProtons->SetName("grProtons");
175
176   //3D eta-phi-NPoints(dEdx)
177   TH3F *gHistEtaPhiTPCdEdxNPoints = dynamic_cast<TH3F *>(fQA2DList->At(2));
178   TH2D *gHistEtaPhi = dynamic_cast<TH2D *>gHistEtaPhiTPCdEdxNPoints->Project3D("yx");
179   gHistEtaPhi->SetStats(kFALSE);
180   TH2D *gHistEtaTPCdEdxNPoints = dynamic_cast<TH2D *>gHistEtaPhiTPCdEdxNPoints->Project3D("zx");
181   gHistEtaTPCdEdxNPoints->SetStats(kFALSE);
182   TH2D *gHistPhiTPCdEdxNPoints = dynamic_cast<TH2D *>gHistEtaPhiTPCdEdxNPoints->Project3D("zy");
183   gHistPhiTPCdEdxNPoints->SetStats(kFALSE);
184
185   //3D eta-phi-NPoints(dEdx): protons
186   TH3F *gHistProtonsEtaPhiTPCdEdxNPoints = dynamic_cast<TH3F *>(fQA2DList->At(3));
187   TH2D *gHistProtonsEtaPhi = dynamic_cast<TH2D *>gHistProtonsEtaPhiTPCdEdxNPoints->Project3D("yx");
188   gHistProtonsEtaPhi->SetStats(kFALSE);
189   TH2D *gHistProtonsEtaTPCdEdxNPoints = dynamic_cast<TH2D *>gHistProtonsEtaPhiTPCdEdxNPoints->Project3D("zx");
190   gHistProtonsEtaTPCdEdxNPoints->SetStats(kFALSE);
191   TH2D *gHistProtonsPhiTPCdEdxNPoints = dynamic_cast<TH2D *>gHistProtonsEtaPhiTPCdEdxNPoints->Project3D("zy");
192   gHistProtonsPhiTPCdEdxNPoints->SetStats(kFALSE);
193
194   //3D eta-phi-NPoints
195   TH3F *gHistEtaPhiTPCNPoints = dynamic_cast<TH3F *>(fQA2DList->At(4));
196   TH2D *gHistEtaPhi = dynamic_cast<TH2D *>gHistEtaPhiTPCNPoints->Project3D("yx");
197   gHistEtaPhi->SetStats(kFALSE);
198   TH2D *gHistEtaTPCNPoints = dynamic_cast<TH2D *>gHistEtaPhiTPCNPoints->Project3D("zx");
199   gHistEtaTPCNPoints->SetStats(kFALSE);
200   TH2D *gHistPhiTPCNPoints = dynamic_cast<TH2D *>gHistEtaPhiTPCNPoints->Project3D("zy");
201   gHistPhiTPCNPoints->SetStats(kFALSE);
202
203   //3D eta-phi-NPoints: protons
204   TH3F *gHistProtonsEtaPhiTPCNPoints = dynamic_cast<TH3F *>(fQA2DList->At(5));
205   TH2D *gHistProtonsEtaPhi = dynamic_cast<TH2D *>gHistProtonsEtaPhiTPCNPoints->Project3D("yx");
206   gHistProtonsEtaPhi->SetStats(kFALSE);
207   TH2D *gHistProtonsEtaTPCNPoints = dynamic_cast<TH2D *>gHistProtonsEtaPhiTPCNPoints->Project3D("zx");
208   gHistProtonsEtaTPCNPoints->SetStats(kFALSE);
209   TH2D *gHistProtonsPhiTPCNPoints = dynamic_cast<TH2D *>gHistProtonsEtaPhiTPCNPoints->Project3D("zy");
210   gHistProtonsPhiTPCNPoints->SetStats(kFALSE);
211
212   //3D pt-phi-NPoints(dEdx)
213   TH3F *gHistPtPhiTPCdEdxNPoints = dynamic_cast<TH3F *>(fQA2DList->At(6));
214   TH2D *gHistPtPhi = dynamic_cast<TH2D *>gHistPtPhiTPCdEdxNPoints->Project3D("yx");
215   gHistPtPhi->SetStats(kFALSE);
216   TH2D *gHistPtTPCdEdxNPoints = dynamic_cast<TH2D *>gHistPtPhiTPCdEdxNPoints->Project3D("zx");
217   gHistPtTPCdEdxNPoints->SetStats(kFALSE);
218   TH2D *gHistPhiTPCdEdxNPoints = dynamic_cast<TH2D *>gHistPtPhiTPCdEdxNPoints->Project3D("zy");
219   gHistPhiTPCdEdxNPoints->SetStats(kFALSE);
220
221   //3D pt-phi-NPoints(dEdx): protons
222   TH3F *gHistProtonsPtPhiTPCdEdxNPoints = dynamic_cast<TH3F *>(fQA2DList->At(7));
223   TH2D *gHistProtonsPtPhi = dynamic_cast<TH2D *>gHistProtonsPtPhiTPCdEdxNPoints->Project3D("yx");
224   gHistProtonsPtPhi->SetStats(kFALSE);
225   TH2D *gHistProtonsPtTPCdEdxNPoints = dynamic_cast<TH2D *>gHistProtonsPtPhiTPCdEdxNPoints->Project3D("zx");
226   gHistProtonsPtTPCdEdxNPoints->SetStats(kFALSE);
227   TH2D *gHistProtonsPhiTPCdEdxNPoints = dynamic_cast<TH2D *>gHistProtonsPtPhiTPCdEdxNPoints->Project3D("zy");
228   gHistProtonsPhiTPCdEdxNPoints->SetStats(kFALSE);
229
230   //3D pt-phi-NPoints
231   TH3F *gHistPtPhiTPCNPoints = dynamic_cast<TH3F *>(fQA2DList->At(8));
232   TH2D *gHistPtPhi = dynamic_cast<TH2D *>gHistPtPhiTPCNPoints->Project3D("yx");
233   gHistPtPhi->SetStats(kFALSE);
234   TH2D *gHistPtTPCNPoints = dynamic_cast<TH2D *>gHistPtPhiTPCNPoints->Project3D("zx");
235   gHistPtTPCNPoints->SetStats(kFALSE);
236   TH2D *gHistPhiTPCNPoints = dynamic_cast<TH2D *>gHistPtPhiTPCNPoints->Project3D("zy");
237   gHistPhiTPCNPoints->SetStats(kFALSE);
238
239   //3D pt-phi-NPoints: protons
240   TH3F *gHistProtonsPtPhiTPCNPoints = dynamic_cast<TH3F *>(fQA2DList->At(9));
241   TH2D *gHistProtonsPtPhi = dynamic_cast<TH2D *>gHistProtonsPtPhiTPCNPoints->Project3D("yx");
242   gHistProtonsPtPhi->SetStats(kFALSE);
243   TH2D *gHistProtonsPtTPCNPoints = dynamic_cast<TH2D *>gHistProtonsPtPhiTPCNPoints->Project3D("zx");
244   gHistProtonsPtTPCNPoints->SetStats(kFALSE);
245   TH2D *gHistProtonsPhiTPCNPoints = dynamic_cast<TH2D *>gHistProtonsPtPhiTPCNPoints->Project3D("zy");
246   gHistProtonsPhiTPCNPoints->SetStats(kFALSE);
247
248   //2D eta-phi- accepted protons & antiprotons
249   TH2F *gHistEtaPhiProtons = dynamic_cast<TH2F *>(fQA2DList->At(10));
250   gHistEtaPhiProtons->SetStats(kFALSE);
251   TH2F *gHistEtaPhiAntiProtons = dynamic_cast<TH2F *>(fQA2DList->At(11));
252   gHistEtaPhiAntiProtons->SetStats(kFALSE);
253
254   //2D dca vs pT - accepted protons & antiprotons
255   TH2F *gHistDCAxyPtProtons = dynamic_cast<TH2F *>(fQA2DList->At(12));
256   gHistDCAxyPtProtons->SetStats(kFALSE);
257   TH2F *gHistDCAzPtProtons = dynamic_cast<TH2F *>(fQA2DList->At(13));
258   gHistDCAzPtProtons->SetStats(kFALSE);
259   TH2F *gHistDCAxyPtAntiProtons = dynamic_cast<TH2F *>(fQA2DList->At(14));
260   gHistDCAxyPtAntiProtons->SetStats(kFALSE);
261   TH2F *gHistDCAzPtAntiProtons = dynamic_cast<TH2F *>(fQA2DList->At(15));
262   gHistDCAzPtAntiProtons->SetStats(kFALSE);
263
264   //__________________________________________________//
265   TH2F *hEmptydEdx = new TH2F("hEmptydEdx",
266                               "TPC dE/dx parametrization;P[GeV/c];dE/dx [a.u]",
267                               100,0.01,110.,100,30,1000);
268   hEmptydEdx->SetStats(kFALSE);
269
270   TLatex *latex = new TLatex();
271   latex->SetTextSize(0.035);
272
273   TCanvas *cdEdx = new TCanvas("cdEdx","dE/dx (TPC)",0,0,700,400);
274   cdEdx->SetFillColor(10); cdEdx->SetHighLightColor(10); cdEdx->Divide(2,1);
275   cdEdx->cd(1)->SetLogx(); hEmptydEdx->DrawCopy();
276   gHistdEdxP->Draw("colsame");
277   grElectrons->Draw("LSAME"); latex->SetTextColor(6); latex->DrawLatex(0.02,55,"e");
278   grMuons->Draw("LSAME"); latex->SetTextColor(3); latex->DrawLatex(0.02,400,"#mu");
279   grPions->Draw("LSAME"); latex->SetTextColor(1); latex->DrawLatex(0.05,400,"#pi");
280   grKaons->Draw("LSAME"); latex->SetTextColor(2); latex->DrawLatex(0.17,400,"K");
281   grProtons->Draw("LSAME"); latex->SetTextColor(4); latex->DrawLatex(0.35,400,"p");
282   
283   cdEdx->cd(2)->SetLogx(); gHistProtonsdEdxP->Draw("col");
284
285   TCanvas *cEtaPhi = new TCanvas("cEtaPhi",
286                                  "eta-phi",
287                                  0,0,700,400);
288   cEtaPhi->SetFillColor(10); 
289   cEtaPhi->SetHighLightColor(10); cEtaPhi->Divide(2,1);
290   cEtaPhi->cd(1); 
291   gHistEtaPhiProtons->SetTitle("Accepted protons - eta vs phi");
292   gHistEtaPhiProtons->Draw("colz");
293   cEtaPhi->cd(2); 
294   gHistEtaPhiAntiProtons->SetTitle("Accepted antiprotons - eta vs phi");
295   gHistEtaPhiAntiProtons->Draw("colz");
296
297   TCanvas *cDCAPt = new TCanvas("cDCAPt","pT-dca",0,0,700,700);
298   cDCAPt->SetFillColor(10); 
299   cDCAPt->SetHighLightColor(10); cDCAPt->Divide(2,2);
300   cDCAPt->cd(1); 
301   gHistDCAxyPtProtons->SetTitle("Accepted protons - dca(xy) vs Pt");
302   gHistDCAxyPtProtons->Draw("colz");
303   cDCAPt->cd(2); 
304   gHistDCAzPtProtons->SetTitle("Accepted protons - dca(z) vs Pt");
305   gHistDCAzPtProtons->Draw("colz");
306   cDCAPt->cd(3); 
307   gHistDCAxyPtAntiProtons->SetTitle("Accepted antiprotons - dca(xy) vs Pt");
308   gHistDCAxyPtAntiProtons->Draw("colz");
309   cDCAPt->cd(4); 
310   gHistDCAzPtAntiProtons->SetTitle("Accepted antiprotons - dca(z) vs Pt");
311   gHistDCAzPtAntiProtons->Draw("colz");
312
313   /*TCanvas *cEtaPhiNPointsdEdx = new TCanvas("cEtaPhiNPointsdEdx",
314                                             "eta-phi-NPoints(dE/dx)",
315                                             0,0,900,600);
316   cEtaPhiNPointsdEdx->SetFillColor(10); 
317   cEtaPhiNPointsdEdx->SetHighLightColor(10); cEtaPhiNPointsdEdx->Divide(3,2);
318   cEtaPhiNPointsdEdx->cd(1); gHistEtaPhi->Draw("col");
319   cEtaPhiNPointsdEdx->cd(2); gHistEtaTPCdEdxNPoints->Draw("col");
320   cEtaPhiNPointsdEdx->cd(3); gHistPhiTPCdEdxNPoints->Draw("col");
321   cEtaPhiNPointsdEdx->cd(4); gHistProtonsEtaPhi->Draw("col");
322   cEtaPhiNPointsdEdx->cd(5); gHistProtonsEtaTPCdEdxNPoints->Draw("col");
323   cEtaPhiNPointsdEdx->cd(6); gHistProtonsPhiTPCdEdxNPoints->Draw("col");
324
325   TCanvas *cEtaPhiNPoints = new TCanvas("cEtaPhiNPoints",
326                                         "eta-phi-NPoints",
327                                         0,0,900,600);
328   cEtaPhiNPoints->SetFillColor(10); 
329   cEtaPhiNPoints->SetHighLightColor(10); cEtaPhiNPoints->Divide(3,2);
330   cEtaPhiNPoints->cd(1); gHistEtaPhi->Draw("col");
331   cEtaPhiNPoints->cd(2); gHistEtaTPCNPoints->Draw("col");
332   cEtaPhiNPoints->cd(3); gHistPhiTPCNPoints->Draw("col");
333   cEtaPhiNPoints->cd(4); gHistProtonsEtaPhi->Draw("col");
334   cEtaPhiNPoints->cd(5); gHistProtonsEtaTPCNPoints->Draw("col");
335   cEtaPhiNPoints->cd(6); gHistProtonsPhiTPCNPoints->Draw("col");
336
337   TCanvas *cPtPhiNPointsdEdx = new TCanvas("cPtPhiNPointsdEdx",
338                                            "pt-phi-NPoints(dE/dx)",
339                                            0,0,900,600);
340   cPtPhiNPointsdEdx->SetFillColor(10); 
341   cPtPhiNPointsdEdx->SetHighLightColor(10); cPtPhiNPointsdEdx->Divide(3,2);
342   cPtPhiNPointsdEdx->cd(1); gHistPtPhi->Draw("col");
343   cPtPhiNPointsdEdx->cd(2); gHistPtTPCdEdxNPoints->Draw("col");
344   cPtPhiNPointsdEdx->cd(3); gHistPhiTPCdEdxNPoints->Draw("col");
345   cPtPhiNPointsdEdx->cd(4); gHistProtonsPtPhi->Draw("col");
346   cPtPhiNPointsdEdx->cd(5); gHistProtonsPtTPCdEdxNPoints->Draw("col");
347   cPtPhiNPointsdEdx->cd(6); gHistProtonsPhiTPCdEdxNPoints->Draw("col");
348
349   TCanvas *cPtPhiNPoints = new TCanvas("cPtPhiNPoints",
350                                        "pt-phi-NPoints",
351                                        0,0,900,600);
352   cPtPhiNPoints->SetFillColor(10); 
353   cPtPhiNPoints->SetHighLightColor(10); cPtPhiNPoints->Divide(3,2);
354   cPtPhiNPoints->cd(1); gHistPtPhi->Draw("col");
355   cPtPhiNPoints->cd(2); gHistPtTPCNPoints->Draw("col");
356   cPtPhiNPoints->cd(3); gHistPhiTPCNPoints->Draw("col");
357   cPtPhiNPoints->cd(4); gHistProtonsPtPhi->Draw("col");
358   cPtPhiNPoints->cd(5); gHistProtonsPtTPCNPoints->Draw("col");
359   cPtPhiNPoints->cd(6); gHistProtonsPhiTPCNPoints->Draw("col");*/
360
361   //Accepted protons
362   TList *fQAProtonsAcceptedList = dynamic_cast<TList *>(gListGlobalQA->At(1));
363   TH1F *gProtonsITSClustersPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(0));
364   TH1F *gProtonsChi2PerClusterITSPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(1));
365   TH1F *gProtonsTPCClustersPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(2));
366   TH1F *gProtonsChi2PerClusterTPCPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(3));
367   TH1F *gProtonsExtCov11Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(4));
368   TH1F *gProtonsExtCov22Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(5));
369   TH1F *gProtonsExtCov33Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(6));
370   TH1F *gProtonsExtCov44Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(7));
371   TH1F *gProtonsExtCov55Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(8));
372   TH1F *gProtonsSigmaToVertexPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(9));
373   TH1F *gProtonsSigmaToVertexTPCPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(10));
374   TH1F *gProtonsDCAXYPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(11));
375   TH1F *gProtonsDCAXYTPCPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(12));
376   TH1F *gProtonsDCAZPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(13));
377   TH1F *gProtonsDCAZTPCPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(14));
378   TH1F *gProtonsConstrainChi2Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(15));
379   TH1F *gProtonsITSRefitPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(16));
380   TH1F *gProtonsTPCRefitPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(17));
381   TH1F *gProtonsESDpidPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(18));
382   TH1F *gProtonsTPCpidPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(19));
383   TH1F *gProtonsPointOnITSLayer1Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(20));
384   TH1F *gProtonsPointOnITSLayer2Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(21));
385   TH1F *gProtonsPointOnITSLayer3Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(22));
386   TH1F *gProtonsPointOnITSLayer4Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(23));
387   TH1F *gProtonsPointOnITSLayer5Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(24));
388   TH1F *gProtonsPointOnITSLayer6Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(25));
389   TH1F *gProtonsNumberOfTPCdEdxPointsPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(26));
390
391   //Rejected protons
392   TList *fQAProtonsRejectedList = dynamic_cast<TList *>(gListGlobalQA->At(2));
393   TH1F *gProtonsITSClustersReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(0));
394   TH1F *gProtonsChi2PerClusterITSReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(1));
395   TH1F *gProtonsTPCClustersReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(2));
396   TH1F *gProtonsChi2PerClusterTPCReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(3));
397   TH1F *gProtonsExtCov11Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(4));
398   TH1F *gProtonsExtCov22Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(5));
399   TH1F *gProtonsExtCov33Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(6));
400   TH1F *gProtonsExtCov44Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(7));
401   TH1F *gProtonsExtCov55Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(8));
402   TH1F *gProtonsSigmaToVertexReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(9));
403   TH1F *gProtonsSigmaToVertexTPCReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(10));
404   TH1F *gProtonsDCAXYReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(11));
405   TH1F *gProtonsDCAXYTPCReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(12));
406   TH1F *gProtonsDCAZReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(13));
407   TH1F *gProtonsDCAZTPCReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(14));
408   TH1F *gProtonsConstrainChi2Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(15));
409   TH1F *gProtonsITSRefitReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(16));
410   TH1F *gProtonsTPCRefitReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(17));
411   TH1F *gProtonsESDpidReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(18));
412   TH1F *gProtonsTPCpidReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(19));
413   TH1F *gProtonsPointOnITSLayer1Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(20));
414   TH1F *gProtonsPointOnITSLayer2Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(21));
415   TH1F *gProtonsPointOnITSLayer3Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(22));
416   TH1F *gProtonsPointOnITSLayer4Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(23));
417   TH1F *gProtonsPointOnITSLayer5Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(24));
418   TH1F *gProtonsPointOnITSLayer6Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(25));
419   TH1F *gProtonsNumberOfTPCdEdxPointsReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(26));
420
421   //Accepted antiprotons
422   TList *fQAAntiProtonsAcceptedList = dynamic_cast<TList *>(gListGlobalQA->At(3));
423   TH1F *gAntiProtonsITSClustersPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(0));
424   TH1F *gAntiProtonsChi2PerClusterITSPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(1));
425   TH1F *gAntiProtonsTPCClustersPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(2));
426   TH1F *gAntiProtonsChi2PerClusterTPCPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(3));
427   TH1F *gAntiProtonsExtCov11Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(4));
428   TH1F *gAntiProtonsExtCov22Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(5));
429   TH1F *gAntiProtonsExtCov33Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(6));
430   TH1F *gAntiProtonsExtCov44Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(7));
431   TH1F *gAntiProtonsExtCov55Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(8));
432   TH1F *gAntiProtonsSigmaToVertexPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(9));
433   TH1F *gAntiProtonsSigmaToVertexTPCPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(10));
434   TH1F *gAntiProtonsDCAXYPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(11));
435   TH1F *gAntiProtonsDCAXYTPCPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(12));
436   TH1F *gAntiProtonsDCAZPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(13));
437   TH1F *gAntiProtonsDCAZTPCPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(14));
438   TH1F *gAntiProtonsConstrainChi2Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(15));
439   TH1F *gAntiProtonsITSRefitPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(16));
440   TH1F *gAntiProtonsTPCRefitPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(17));
441   TH1F *gAntiProtonsESDpidPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(18));
442   TH1F *gAntiProtonsTPCpidPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(19));
443   TH1F *gAntiProtonsPointOnITSLayer1Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(20));
444   TH1F *gAntiProtonsPointOnITSLayer2Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(21));
445   TH1F *gAntiProtonsPointOnITSLayer3Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(22));
446   TH1F *gAntiProtonsPointOnITSLayer4Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(23));
447   TH1F *gAntiProtonsPointOnITSLayer5Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(24));
448   TH1F *gAntiProtonsPointOnITSLayer6Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(25));
449   TH1F *gAntiProtonsNumberOfTPCdEdxPointsPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(26));
450
451   //Rejected antiprotons
452   TList *fQAAntiProtonsRejectedList = dynamic_cast<TList *>(gListGlobalQA->At(4));
453   TH1F *gAntiProtonsITSClustersReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(0));
454   TH1F *gAntiProtonsChi2PerClusterITSReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(1));
455   TH1F *gAntiProtonsTPCClustersReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(2));
456   TH1F *gAntiProtonsChi2PerClusterTPCReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(3));
457   TH1F *gAntiProtonsExtCov11Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(4));
458   TH1F *gAntiProtonsExtCov22Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(5));
459   TH1F *gAntiProtonsExtCov33Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(6));
460   TH1F *gAntiProtonsExtCov44Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(7));
461   TH1F *gAntiProtonsExtCov55Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(8));
462   TH1F *gAntiProtonsSigmaToVertexReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(9));
463   TH1F *gAntiProtonsSigmaToVertexTPCReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(10));
464   TH1F *gAntiProtonsDCAXYReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(11));
465   TH1F *gAntiProtonsDCAXYTPCReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(12));
466   TH1F *gAntiProtonsDCAZReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(13));
467   TH1F *gAntiProtonsDCAZTPCReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(14));
468   TH1F *gAntiProtonsConstrainChi2Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(15));
469   TH1F *gAntiProtonsITSRefitReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(16));
470   TH1F *gAntiProtonsTPCRefitReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(17));
471   TH1F *gAntiProtonsESDpidReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(18));
472   TH1F *gAntiProtonsTPCpidReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(19));
473   TH1F *gAntiProtonsPointOnITSLayer1Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(20));
474   TH1F *gAntiProtonsPointOnITSLayer2Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(21));
475   TH1F *gAntiProtonsPointOnITSLayer3Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(22));
476   TH1F *gAntiProtonsPointOnITSLayer4Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(23));
477   TH1F *gAntiProtonsPointOnITSLayer5Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(24));
478   TH1F *gAntiProtonsPointOnITSLayer6Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(25));
479   TH1F *gAntiProtonsNumberOfTPCdEdxPointsReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(26));
480
481   //__________________________________________________//
482   TCanvas *c1 = new TCanvas("c1","ITS clusters",0,0,600,400);
483   c1->SetFillColor(10); c1->SetHighLightColor(10);
484   c1->Divide(2,1);
485   c1->cd(1); gProtonsITSClustersPass->Draw(); 
486   gProtonsITSClustersReject->Draw("same");
487   c1->cd(2); gAntiProtonsITSClustersPass->Draw(); 
488   gAntiProtonsITSClustersReject->Draw("same");
489
490   TCanvas *c2 = new TCanvas("c2","chi^2 per ITS cluster",0,100,600,400);
491   c2->SetFillColor(10); c2->SetHighLightColor(10);
492   c2->Divide(2,1);
493   c2->cd(1); gProtonsChi2PerClusterITSPass->Draw(); 
494   gProtonsChi2PerClusterITSReject->Draw("same");
495   c2->cd(2); gAntiProtonsChi2PerClusterITSPass->Draw(); 
496   gAntiProtonsChi2PerClusterITSReject->Draw("same");
497
498   TCanvas *c3 = new TCanvas("c3","TPC clusters",0,200,600,400);
499   c3->SetFillColor(10); c3->SetHighLightColor(10);
500   c3->Divide(2,1);
501   c3->cd(1); gProtonsTPCClustersPass->Draw();
502   gProtonsTPCClustersReject->Draw("same");
503   c3->cd(2); gAntiProtonsTPCClustersPass->Draw();
504   gAntiProtonsTPCClustersReject->Draw("same");
505
506   TCanvas *c4 = new TCanvas("c4","chi^2 per TPC cluster",0,300,600,400);
507   c4->SetFillColor(10); c4->SetHighLightColor(10);
508   c4->Divide(2,1);
509   c4->cd(1); gProtonsChi2PerClusterTPCPass->Draw(); 
510   gProtonsChi2PerClusterTPCReject->Draw("same");
511   c4->cd(2); gAntiProtonsChi2PerClusterTPCPass->Draw(); 
512   gAntiProtonsChi2PerClusterTPCReject->Draw("same");
513
514   if(gProtonsExtCov11Pass->GetEntries() != 0) {
515     TCanvas *c5 = new TCanvas("c5","Cov11",0,400,600,400);
516     c5->SetFillColor(10); c5->SetHighLightColor(10);
517     c5->Divide(2,1);
518     c5->cd(1)->SetLogy(); gProtonsExtCov11Pass->Draw(); 
519     gProtonsExtCov11Reject->Draw("same");
520     c5->cd(2)->SetLogy(); gAntiProtonsExtCov11Pass->Draw(); 
521     gAntiProtonsExtCov11Reject->Draw("same");
522   }
523
524   if(gProtonsExtCov11Pass->GetEntries() != 0) {
525     TCanvas *c6 = new TCanvas("c6","Cov22",0,500,600,400);
526     c6->SetFillColor(10); c6->SetHighLightColor(10);
527     c6->Divide(2,1);
528     c6->cd(1)->SetLogy(); gProtonsExtCov22Pass->Draw(); 
529     gProtonsExtCov22Reject->Draw("same");
530     c6->cd(2)->SetLogy(); gAntiProtonsExtCov22Pass->Draw(); 
531     gAntiProtonsExtCov22Reject->Draw("same");
532   }
533
534   if(gProtonsExtCov11Pass->GetEntries() != 0) {
535     TCanvas *c7 = new TCanvas("c7","Cov33",600,0,600,400);
536     c7->SetFillColor(10); c7->SetHighLightColor(10);
537     c7->Divide(2,1);
538     c7->cd(1)->SetLogy(); gProtonsExtCov33Pass->Draw(); 
539     gProtonsExtCov33Reject->Draw("same");
540     c7->cd(2)->SetLogy(); gAntiProtonsExtCov33Pass->Draw(); 
541     gAntiProtonsExtCov33Reject->Draw("same");
542   }
543
544   if(gProtonsExtCov11Pass->GetEntries() != 0) {
545     TCanvas *c8 = new TCanvas("c8","Cov44",600,100,600,400);
546     c8->SetFillColor(10); c8->SetHighLightColor(10);
547     c8->Divide(2,1);
548     c8->cd(1)->SetLogy(); gProtonsExtCov44Pass->Draw(); 
549     gProtonsExtCov44Reject->Draw("same");
550     c8->cd(2)->SetLogy(); gAntiProtonsExtCov44Pass->Draw(); 
551     gAntiProtonsExtCov44Reject->Draw("same");
552   }
553
554   if(gProtonsExtCov11Pass->GetEntries() != 0) {
555     TCanvas *c9 = new TCanvas("c9","Cov55",600,200,600,400);
556     c9->SetFillColor(10); c9->SetHighLightColor(10);
557     c9->Divide(2,1);
558     c9->cd(1)->SetLogy(); gProtonsExtCov55Pass->Draw(); 
559     gProtonsExtCov55Reject->Draw("same");
560     c9->cd(2)->SetLogy(); gAntiProtonsExtCov55Pass->Draw(); 
561     gAntiProtonsExtCov55Reject->Draw("same");
562   }
563
564   if(gProtonsSigmaToVertexPass->GetEntries() != 0) {
565     TCanvas *c10 = new TCanvas("c10","N-sigma to Vertex",600,300,600,400);
566     c10->SetFillColor(10); c10->SetHighLightColor(10);
567     c10->Divide(2,1);
568     c10->cd(1)->SetLogy(); gProtonsSigmaToVertexPass->Draw(); 
569     gProtonsSigmaToVertexReject->Draw("same");
570     c10->cd(2)->SetLogy(); gAntiProtonsSigmaToVertexPass->Draw(); 
571     gAntiProtonsSigmaToVertexReject->Draw("same");
572   }
573
574   if(gProtonsSigmaToVertexTPCPass->GetEntries() != 0) {
575     TCanvas *c11 = new TCanvas("c11","N-sigma to Vertex (TPC)",600,400,600,400);
576     c11->SetFillColor(10); c11->SetHighLightColor(10);
577     c11->Divide(2,1);
578     c11->cd(1)->SetLogy(); gProtonsSigmaToVertexTPCPass->Draw(); 
579     gProtonsSigmaToVertexTPCReject->Draw("same");
580     c11->cd(2)->SetLogy(); gAntiProtonsSigmaToVertexTPCPass->Draw(); 
581     gAntiProtonsSigmaToVertexTPCReject->Draw("same");
582   }
583
584   if(gProtonsDCAXYPass->GetEntries() != 0) {
585     TCanvas *c12 = new TCanvas("c12","dca(xy)",600,500,600,400);
586     c12->SetFillColor(10); c12->SetHighLightColor(10);
587     c12->Divide(2,1);
588     c12->cd(1)->SetLogy(); gProtonsDCAXYPass->Draw(); 
589     gProtonsDCAXYReject->Draw("same");
590     c12->cd(2)->SetLogy(); gAntiProtonsDCAXYPass->Draw(); 
591     gAntiProtonsDCAXYReject->Draw("same");
592   }
593
594   if(gProtonsDCAXYTPCPass->GetEntries() != 0) {
595     TCanvas *c13 = new TCanvas("c13","dca(xy - TPC)",1200,0,600,400);
596     c13->SetFillColor(10); c13->SetHighLightColor(10);
597     c13->Divide(2,1);
598     c13->cd(1)->SetLogy(); gProtonsDCAXYTPCPass->Draw(); 
599     gProtonsDCAXYTPCReject->Draw("same");
600     c13->cd(2)->SetLogy(); gAntiProtonsDCAXYTPCPass->Draw(); 
601     gAntiProtonsDCAXYTPCReject->Draw("same");
602   }
603
604   if(gProtonsDCAZPass->GetEntries() != 0) {
605     TCanvas *c14 = new TCanvas("c14","dca(z)",1200,100,600,400);
606     c14->SetFillColor(10); c14->SetHighLightColor(10);
607     c14->Divide(2,1);
608     c14->cd(1)->SetLogy(); gProtonsDCAZPass->Draw(); 
609     gProtonsDCAZReject->Draw("same");
610     c14->cd(2)->SetLogy(); gAntiProtonsDCAZPass->Draw(); 
611     gAntiProtonsDCAZReject->Draw("same");
612   }
613
614   if(gProtonsDCAZTPCPass->GetEntries() != 0) {
615     TCanvas *c15 = new TCanvas("c15","dca(z - TPC)",1200,200,600,400);
616     c15->SetFillColor(10); c15->SetHighLightColor(10);
617     c15->Divide(2,1);
618     c15->cd(1)->SetLogy(); gProtonsDCAZTPCPass->Draw(); 
619     gProtonsDCAZTPCReject->Draw("same");
620     c15->cd(2)->SetLogy(); gAntiProtonsDCAZTPCPass->Draw(); 
621     gAntiProtonsDCAZTPCReject->Draw("same");
622   }
623
624   TCanvas *c16 = new TCanvas("c16","TPC clusters (dE/dx)",1200,300,600,400);
625   c16->SetFillColor(10); c16->SetHighLightColor(10);
626   c16->Divide(2,1);
627   c16->cd(1); gProtonsNumberOfTPCdEdxPointsPass->Draw(); 
628   gProtonsNumberOfTPCdEdxPointsReject->Draw("same");
629   c16->cd(2); gAntiProtonsNumberOfTPCdEdxPointsPass->Draw(); 
630   gAntiProtonsNumberOfTPCdEdxPointsReject->Draw("same");
631
632   //================Vertex QA================//
633   TList *gListVertexQA = dynamic_cast<TList *>(listQA->At(1));
634   TH1F *gHistVx = dynamic_cast<TH1F *>(gListVertexQA->At(0));
635   TH1F *gHistVxAccepted = dynamic_cast<TH1F *>(gListVertexQA->At(1));
636   gHistVxAccepted->SetFillColor(10);
637   TH1F *gHistVy = dynamic_cast<TH1F *>(gListVertexQA->At(2));
638   TH1F *gHistVyAccepted = dynamic_cast<TH1F *>(gListVertexQA->At(3));
639   gHistVyAccepted->SetFillColor(10);
640   TH1F *gHistVz = dynamic_cast<TH1F *>(gListVertexQA->At(4));
641   TH1F *gHistVzAccepted = dynamic_cast<TH1F *>(gListVertexQA->At(5));
642   gHistVzAccepted->SetFillColor(10);
643   TH1F *gHistNumberOfContributors = dynamic_cast<TH1F *>(gListVertexQA->At(6));
644   gHistNumberOfContributors->SetFillColor(10);
645
646   TCanvas *cVertex = new TCanvas("cVertex","Vertex QA",0,0,900,400);
647   cVertex->SetFillColor(10); cVertex->SetHighLightColor(10);
648   cVertex->Divide(3,1);
649   cVertex->cd(1)->SetLogy(); gHistVx->Draw(); gHistVxAccepted->Draw("same");
650   cVertex->cd(2)->SetLogy(); gHistVy->Draw(); gHistVyAccepted->Draw("same");
651   cVertex->cd(3)->SetLogy(); gHistVz->Draw(); gHistVzAccepted->Draw("same");
652
653   TCanvas *cVertexNContributors = new TCanvas("cVertexNContributors",
654                                               "Vertex QA",0,0,400,400);
655   gHistNumberOfContributors->Draw();
656 }
657
658 //________________________________________________________//
659 void PrintYields(TH1 *h) {
660   Double_t sum = 0.0, error = 0.0;
661   for(Int_t iBin = 1; iBin <= h->GetNbinsX(); iBin++) {
662     sum += h->GetBinContent(iBin);
663     error += TMath::Power(h->GetBinError(iBin),2);
664   }
665   error = TMath::Sqrt(error);
666
667   Printf("==================================");
668   Printf("Histogram: %s",h->GetName());
669   Printf("Yields: %lf - %lf",sum,error);
670   Printf("==================================");
671 }
672
673 //___________________________________________________//
674 void drawdEdx(TH2F *gHistdEdxP) {
675   //Draws the dE/dx distributions for the different momentum bins
676   TString title;
677   TH1D *gHist[100];
678   Int_t iCounter = 0;
679   Double_t binMin = gHistdEdxP->GetXaxis()->GetXmin();
680   Double_t binMax = gHistdEdxP->GetXaxis()->GetXmin() + 
681     (gHistdEdxP->GetXaxis()->GetXmax() - gHistdEdxP->GetXaxis()->GetXmin())/gHistdEdxP->GetNbinsX();
682
683   TCanvas *c[100];
684
685   for(Int_t iBin = 1; iBin <= gHistdEdxP->GetNbinsX(); iBin++) {
686     if((binMax > 0.41)&&(binMin < 0.91)) {
687       title = "P: "; title += binMin; title += " - "; 
688       title += binMax; title += "GeV/c";
689       c[iCounter] = new TCanvas(title.Data(),title.Data(),0,0,500,500);
690       c[iCounter]->SetFillColor(10); c[iCounter]->SetHighLightColor(10); 
691       gHist[iCounter] = gHistdEdxP->ProjectionY(title.Data(),iBin,iBin);
692       gHist[iCounter]->SetTitle(title.Data());
693       gHist[iCounter]->SetStats(kFALSE);
694       if(gHist[iCounter]->GetEntries() != 0)
695         c[iCounter]->SetLogy();
696       gHist[iCounter]->Draw();
697       Printf("Bin: %d - Pmin: %lf - Pmax: %lf : %s",iBin,binMin,binMax,title.Data());
698       iCounter += 1;
699     }
700     binMin += (gHistdEdxP->GetXaxis()->GetXmax() - gHistdEdxP->GetXaxis()->GetXmin())/gHistdEdxP->GetNbinsX();
701     binMax += (gHistdEdxP->GetXaxis()->GetXmax() - gHistdEdxP->GetXaxis()->GetXmin())/gHistdEdxP->GetNbinsX();
702   }
703   
704 }