Implementing better the kSigma2 approach - dEdx(measured)/dEdx(theory)
[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   TList *gYRatioInPtBinsList = dynamic_cast<TList *>(analysis->GetYRatioHistogramsInPtBins());
35   drawRatioInPtBins(gYRatioInPtBinsList);
36
37   //==================================================================//
38   TH2F *hEmptyRatio = new TH2F("hEmptyRatio",";;#bar{p}/p",100,-1.1,1.1,100,0.1,1.1);
39   hEmptyRatio->SetStats(kFALSE);
40   hEmptyRatio->GetXaxis()->SetNdivisions(10);
41   hEmptyRatio->GetYaxis()->SetNdivisions(10);
42
43   TLatex *latex = new TLatex();
44   latex->SetTextSize(0.04);
45   latex->SetTextColor(2);
46
47   TF1 *fFitFunction = new TF1("fFitFunction","[0]",-0.5,0.5);
48   fFitFunction->SetParameter(0,0.7);
49
50   TCanvas *c2D = new TCanvas("c2D","eta-pT (anti)protons",0,0,700,400);
51   c2D->SetFillColor(10); c2D->SetHighLightColor(10); c2D->Divide(2,1);
52   c2D->cd(1); gHistYPtProtons->Draw("col");
53   c2D->cd(2); gHistYPtAntiProtons->Draw("col");
54
55   TCanvas *cEventStats = new TCanvas("cEventStats","Event statistics",
56                                      0,0,500,500);
57   cEventStats->SetFillColor(10); cEventStats->SetHighLightColor(10);
58   gHistEventStats->Draw();
59
60   TCanvas *cEta = new TCanvas("cEta","Eta",100,0,600,400);
61   cEta->SetFillColor(10); cEta->SetHighLightColor(10); cEta->Divide(2,1);
62   cEta->cd(1); gHistYProtons->Draw("E"); PrintYields(gHistYProtons);
63   cEta->cd(2); gHistYAntiProtons->Draw("E"); PrintYields(gHistYAntiProtons);
64
65   TCanvas *cPt = new TCanvas("cPt","Pt",100,200,600,400);
66   cPt->SetFillColor(10); cPt->SetHighLightColor(10); cPt->Divide(2,1);
67   cPt->cd(1)->SetLogy(); gHistPtProtons->Draw("E");
68   cPt->cd(2)->SetLogy(); gHistPtAntiProtons->Draw("E");
69
70   TCanvas *cRatio = new TCanvas("cRatio","Ratio",300,0,600,400);
71   cRatio->SetFillColor(10); cRatio->SetHighLightColor(10); cRatio->Divide(2,1);
72   cRatio->cd(1); hEmptyRatio->GetXaxis()->SetTitle("#eta"); 
73   hEmptyRatio->GetXaxis()->SetRangeUser(-1.0,1.0); 
74   hEmptyRatio->DrawCopy(); gHistYRatio->Draw("ESAME");
75   gHistYRatio->Fit("fFitFunction","N");
76   latex->DrawLatex(-0.1,0.45,"ALICE PRELIMINARY");
77   latex->DrawLatex(-0.1,0.4,"p-p: #sqrt{s} = 900 GeV");
78   cRatio->cd(2);  hEmptyRatio->GetXaxis()->SetTitle("P_{T} [GeV/c]"); 
79   hEmptyRatio->GetXaxis()->SetRangeUser(0.3,1.1); 
80   hEmptyRatio->DrawCopy(); gHistPtRatio->Draw("ESAME");
81   latex->DrawLatex(0.6,0.45,"ALICE PRELIMINARY");
82   latex->DrawLatex(0.6,0.4,"p-p: #sqrt{s} = 900 GeV");
83
84
85   Printf("==========================================");
86   for(Int_t iBin = 1; iBin <= gHistYRatio->GetNbinsX(); iBin++)
87     Printf("Eta: %lf - Ratio: %lf - Error: %lf",
88            gHistYRatio->GetBinCenter(iBin),
89            gHistYRatio->GetBinContent(iBin),
90            gHistYRatio->GetBinError(iBin));
91   Printf("==========================================");
92
93   Printf("Fit result: %lf - %lf",fFitFunction->GetParameter(0),fFitFunction->GetParError(0));
94   analysis->PrintMean(gHistYRatio,0.5);
95   Printf("==========================================");
96 }
97
98 //___________________________________________________//
99 void drawRatioInPtBins(TList *gYRatioInPtBinsList) {
100   Printf("drawRatioInPtBins:: %d entries",gYRatioInPtBinsList->GetEntries());
101   static const Int_t nEntries = gYRatioInPtBinsList->GetEntries();
102   TCanvas *cRatioInPtBins[100];
103   TH1D *gHistRatioInPtBins[100];
104   TString title;
105   for(Int_t iEntry = 0; iEntry < gYRatioInPtBinsList->GetEntries(); iEntry++) {
106     title = "ratioPtBin"; title += iEntry+1;
107     cRatioInPtBins[iEntry] = new TCanvas(title.Data(),
108                                          title.Data(),
109                                          0,0,400,400);
110     cRatioInPtBins[iEntry]->SetFillColor(10);
111     cRatioInPtBins[iEntry]->SetHighLightColor(10);
112     gHistRatioInPtBins[iEntry] = dynamic_cast<TH1D *>(gYRatioInPtBinsList->At(iEntry));
113     gHistRatioInPtBins[iEntry]->SetStats(kFALSE);
114     gHistRatioInPtBins[iEntry]->SetMarkerStyle(20);
115     gHistRatioInPtBins[iEntry]->SetMarkerColor(4);
116     gHistRatioInPtBins[iEntry]->GetYaxis()->SetRangeUser(0.0,1.4);
117     gHistRatioInPtBins[iEntry]->DrawCopy("E");
118   }
119 }
120
121 //___________________________________________________//
122 void drawQAPlots(const char* analysisOutput,
123                  Bool_t kMC) {
124   //Draws the QA plots from the output of the analysis
125   //=========================================================//
126   //List of cuts
127   TFile *fCutFile = TFile::Open("ListOfCuts.root");
128   TCanvas *cListOfCuts = dynamic_cast<TCanvas *>(fCutFile->Get("cListOfCuts"));
129   cListOfCuts->Draw();
130
131   //=========================================================//
132   //QA plots
133   TFile *f = TFile::Open(analysisOutput);
134   TList *listQA = dynamic_cast<TList *>(f->Get("outputQAList"));
135   TList *gListGlobalQA = dynamic_cast<TList *>(listQA->At(0));
136
137   //================QA plots================//
138   TList *fQA2DList = dynamic_cast<TList *>(gListGlobalQA->At(0));
139   //2D de/dx vs P
140   TH2F *gHistdEdxP = dynamic_cast<TH2F *>(fQA2DList->At(0));
141   gHistdEdxP->SetStats(kFALSE);
142   drawdEdx(gHistdEdxP,0);
143   TH2F *gHistProtonsdEdxP = dynamic_cast<TH2F *>(fQA2DList->At(1));
144   gHistProtonsdEdxP->SetStats(kFALSE);
145
146   //Theoretical Bethe-Bloch
147   Double_t fAlephParameters[5];
148   if(kMC) {
149     fAlephParameters[0] = 2.15898e+00/50.;
150     fAlephParameters[1] = 1.75295e+01;
151     fAlephParameters[2] = 3.40030e-09;
152     fAlephParameters[3] = 1.96178e+00;
153     fAlephParameters[4] = 3.91720e+00;
154   }
155   else {
156     fAlephParameters[0] = 0.0283086;
157     fAlephParameters[1] = 2.63394e+01;
158     fAlephParameters[2] = 5.04114e-11;
159     fAlephParameters[3] = 2.12543e+00;
160     fAlephParameters[4] = 4.88663e+00;
161   }
162
163   AliTPCPIDResponse *tpcResponse = new AliTPCPIDResponse();
164   tpcResponse->SetBetheBlochParameters(fAlephParameters[0],
165                                        fAlephParameters[1],
166                                        fAlephParameters[2],
167                                        fAlephParameters[3],
168                                        fAlephParameters[4]);
169   const Int_t nEntries = 10000;
170   Double_t mom[nEntries];
171   Double_t dEdxElectrons[nEntries];
172   Double_t dEdxMuons[nEntries];
173   Double_t dEdxPions[nEntries];
174   Double_t dEdxKaons[nEntries];
175   Double_t dEdxProtons[nEntries];
176   for(Int_t i = 0; i < nEntries; i++) {
177     mom[i] = 0.01 + 0.01*i;
178     dEdxElectrons[i] = tpcResponse->GetExpectedSignal(mom[i],0);
179     dEdxMuons[i] = tpcResponse->GetExpectedSignal(mom[i],1);
180     dEdxPions[i] = tpcResponse->GetExpectedSignal(mom[i],2);
181     dEdxKaons[i] = tpcResponse->GetExpectedSignal(mom[i],3);
182     dEdxProtons[i] = tpcResponse->GetExpectedSignal(mom[i],4);
183   }
184
185   TGraph *grElectrons = new TGraph(nEntries,mom,dEdxElectrons);
186   grElectrons->SetName("grElectrons");
187   grElectrons->SetLineColor(6); grElectrons->SetLineWidth(2);
188   TGraph *grMuons = new TGraph(nEntries,mom,dEdxMuons);
189   grMuons->SetLineColor(3); grMuons->SetLineWidth(2);
190   grMuons->SetName("grMuons");
191   TGraph *grPions = new TGraph(nEntries,mom,dEdxPions);
192   grPions->SetLineColor(1); grPions->SetLineWidth(2);
193   grPions->SetName("grPions");
194   TGraph *grKaons = new TGraph(nEntries,mom,dEdxKaons);
195   grKaons->SetLineColor(2); grKaons->SetLineWidth(2);
196   grKaons->SetName("grKaons");
197   TGraph *grProtons = new TGraph(nEntries,mom,dEdxProtons);
198   grProtons->SetLineColor(4); grProtons->SetLineWidth(2);
199   grProtons->SetName("grProtons");
200
201   //2D de/dx vs P
202   TH2F *gHistZP = dynamic_cast<TH2F *>(fQA2DList->At(2));
203   gHistZP->SetStats(kFALSE);
204   drawdEdx(gHistZP,1);
205   TH2F *gHistProtonsZP = dynamic_cast<TH2F *>(fQA2DList->At(3));
206   gHistProtonsZP->SetStats(kFALSE);
207
208   //3D eta-phi-NPoints(dEdx)
209   TH3F *gHistEtaPhiTPCdEdxNPoints = dynamic_cast<TH3F *>(fQA2DList->At(4));
210   TH2D *gHistEtaPhi = dynamic_cast<TH2D *>gHistEtaPhiTPCdEdxNPoints->Project3D("yx");
211   gHistEtaPhi->SetStats(kFALSE);
212   TH2D *gHistEtaTPCdEdxNPoints = dynamic_cast<TH2D *>gHistEtaPhiTPCdEdxNPoints->Project3D("zx");
213   gHistEtaTPCdEdxNPoints->SetStats(kFALSE);
214   TH2D *gHistPhiTPCdEdxNPoints = dynamic_cast<TH2D *>gHistEtaPhiTPCdEdxNPoints->Project3D("zy");
215   gHistPhiTPCdEdxNPoints->SetStats(kFALSE);
216
217   //3D eta-phi-NPoints(dEdx): protons
218   TH3F *gHistProtonsEtaPhiTPCdEdxNPoints = dynamic_cast<TH3F *>(fQA2DList->At(5));
219   TH2D *gHistProtonsEtaPhi = dynamic_cast<TH2D *>gHistProtonsEtaPhiTPCdEdxNPoints->Project3D("yx");
220   gHistProtonsEtaPhi->SetStats(kFALSE);
221   TH2D *gHistProtonsEtaTPCdEdxNPoints = dynamic_cast<TH2D *>gHistProtonsEtaPhiTPCdEdxNPoints->Project3D("zx");
222   gHistProtonsEtaTPCdEdxNPoints->SetStats(kFALSE);
223   TH2D *gHistProtonsPhiTPCdEdxNPoints = dynamic_cast<TH2D *>gHistProtonsEtaPhiTPCdEdxNPoints->Project3D("zy");
224   gHistProtonsPhiTPCdEdxNPoints->SetStats(kFALSE);
225
226   //3D eta-phi-NPoints
227   TH3F *gHistEtaPhiTPCNPoints = dynamic_cast<TH3F *>(fQA2DList->At(6));
228   TH2D *gHistEtaPhi = dynamic_cast<TH2D *>gHistEtaPhiTPCNPoints->Project3D("yx");
229   gHistEtaPhi->SetStats(kFALSE);
230   TH2D *gHistEtaTPCNPoints = dynamic_cast<TH2D *>gHistEtaPhiTPCNPoints->Project3D("zx");
231   gHistEtaTPCNPoints->SetStats(kFALSE);
232   TH2D *gHistPhiTPCNPoints = dynamic_cast<TH2D *>gHistEtaPhiTPCNPoints->Project3D("zy");
233   gHistPhiTPCNPoints->SetStats(kFALSE);
234
235   //3D eta-phi-NPoints: protons
236   TH3F *gHistProtonsEtaPhiTPCNPoints = dynamic_cast<TH3F *>(fQA2DList->At(7));
237   TH2D *gHistProtonsEtaPhi = dynamic_cast<TH2D *>gHistProtonsEtaPhiTPCNPoints->Project3D("yx");
238   gHistProtonsEtaPhi->SetStats(kFALSE);
239   TH2D *gHistProtonsEtaTPCNPoints = dynamic_cast<TH2D *>gHistProtonsEtaPhiTPCNPoints->Project3D("zx");
240   gHistProtonsEtaTPCNPoints->SetStats(kFALSE);
241   TH2D *gHistProtonsPhiTPCNPoints = dynamic_cast<TH2D *>gHistProtonsEtaPhiTPCNPoints->Project3D("zy");
242   gHistProtonsPhiTPCNPoints->SetStats(kFALSE);
243
244   //3D pt-phi-NPoints(dEdx)
245   TH3F *gHistPtPhiTPCdEdxNPoints = dynamic_cast<TH3F *>(fQA2DList->At(8));
246   TH2D *gHistPtPhi = dynamic_cast<TH2D *>gHistPtPhiTPCdEdxNPoints->Project3D("yx");
247   gHistPtPhi->SetStats(kFALSE);
248   TH2D *gHistPtTPCdEdxNPoints = dynamic_cast<TH2D *>gHistPtPhiTPCdEdxNPoints->Project3D("zx");
249   gHistPtTPCdEdxNPoints->SetStats(kFALSE);
250   TH2D *gHistPhiTPCdEdxNPoints = dynamic_cast<TH2D *>gHistPtPhiTPCdEdxNPoints->Project3D("zy");
251   gHistPhiTPCdEdxNPoints->SetStats(kFALSE);
252
253   //3D pt-phi-NPoints(dEdx): protons
254   TH3F *gHistProtonsPtPhiTPCdEdxNPoints = dynamic_cast<TH3F *>(fQA2DList->At(9));
255   TH2D *gHistProtonsPtPhi = dynamic_cast<TH2D *>gHistProtonsPtPhiTPCdEdxNPoints->Project3D("yx");
256   gHistProtonsPtPhi->SetStats(kFALSE);
257   TH2D *gHistProtonsPtTPCdEdxNPoints = dynamic_cast<TH2D *>gHistProtonsPtPhiTPCdEdxNPoints->Project3D("zx");
258   gHistProtonsPtTPCdEdxNPoints->SetStats(kFALSE);
259   TH2D *gHistProtonsPhiTPCdEdxNPoints = dynamic_cast<TH2D *>gHistProtonsPtPhiTPCdEdxNPoints->Project3D("zy");
260   gHistProtonsPhiTPCdEdxNPoints->SetStats(kFALSE);
261
262   //3D pt-phi-NPoints
263   TH3F *gHistPtPhiTPCNPoints = dynamic_cast<TH3F *>(fQA2DList->At(10));
264   TH2D *gHistPtPhi = dynamic_cast<TH2D *>gHistPtPhiTPCNPoints->Project3D("yx");
265   gHistPtPhi->SetStats(kFALSE);
266   TH2D *gHistPtTPCNPoints = dynamic_cast<TH2D *>gHistPtPhiTPCNPoints->Project3D("zx");
267   gHistPtTPCNPoints->SetStats(kFALSE);
268   TH2D *gHistPhiTPCNPoints = dynamic_cast<TH2D *>gHistPtPhiTPCNPoints->Project3D("zy");
269   gHistPhiTPCNPoints->SetStats(kFALSE);
270
271   //3D pt-phi-NPoints: protons
272   TH3F *gHistProtonsPtPhiTPCNPoints = dynamic_cast<TH3F *>(fQA2DList->At(11));
273   TH2D *gHistProtonsPtPhi = dynamic_cast<TH2D *>gHistProtonsPtPhiTPCNPoints->Project3D("yx");
274   gHistProtonsPtPhi->SetStats(kFALSE);
275   TH2D *gHistProtonsPtTPCNPoints = dynamic_cast<TH2D *>gHistProtonsPtPhiTPCNPoints->Project3D("zx");
276   gHistProtonsPtTPCNPoints->SetStats(kFALSE);
277   TH2D *gHistProtonsPhiTPCNPoints = dynamic_cast<TH2D *>gHistProtonsPtPhiTPCNPoints->Project3D("zy");
278   gHistProtonsPhiTPCNPoints->SetStats(kFALSE);
279
280   //2D eta-phi- accepted protons & antiprotons
281   TH2F *gHistEtaPhiProtons = dynamic_cast<TH2F *>(fQA2DList->At(12));
282   gHistEtaPhiProtons->SetStats(kFALSE);
283   TH2F *gHistEtaPhiAntiProtons = dynamic_cast<TH2F *>(fQA2DList->At(13));
284   gHistEtaPhiAntiProtons->SetStats(kFALSE);
285
286   //2D dca vs pT - accepted protons & antiprotons
287   TH2F *gHistDCAxyPtProtons = dynamic_cast<TH2F *>(fQA2DList->At(14));
288   gHistDCAxyPtProtons->SetStats(kFALSE);
289   TH2F *gHistDCAzPtProtons = dynamic_cast<TH2F *>(fQA2DList->At(15));
290   gHistDCAzPtProtons->SetStats(kFALSE);
291   TH2F *gHistDCAxyPtAntiProtons = dynamic_cast<TH2F *>(fQA2DList->At(16));
292   gHistDCAxyPtAntiProtons->SetStats(kFALSE);
293   TH2F *gHistDCAzPtAntiProtons = dynamic_cast<TH2F *>(fQA2DList->At(17));
294   gHistDCAzPtAntiProtons->SetStats(kFALSE);
295
296   //__________________________________________________//
297   TH2F *hEmptydEdx = new TH2F("hEmptydEdx",
298                               "TPC dE/dx parametrization;P[GeV/c];dE/dx [a.u]",
299                               100,0.01,110.,100,30,1000);
300   hEmptydEdx->SetStats(kFALSE);
301
302   TLatex *latex = new TLatex();
303   latex->SetTextSize(0.035);
304
305   TCanvas *cdEdx = new TCanvas("cdEdx","dE/dx (TPC)",0,0,700,400);
306   cdEdx->SetFillColor(10); cdEdx->SetHighLightColor(10); cdEdx->Divide(2,1);
307   cdEdx->cd(1)->SetLogx(); cdEdx->cd(1)->SetLogy(); hEmptydEdx->DrawCopy();
308   gHistdEdxP->Draw("colsame");
309   grElectrons->Draw("LSAME"); latex->SetTextColor(6); latex->DrawLatex(0.02,55,"e");
310   grMuons->Draw("LSAME"); latex->SetTextColor(3); latex->DrawLatex(0.02,400,"#mu");
311   grPions->Draw("LSAME"); latex->SetTextColor(1); latex->DrawLatex(0.05,400,"#pi");
312   grKaons->Draw("LSAME"); latex->SetTextColor(2); latex->DrawLatex(0.17,400,"K");
313   grProtons->Draw("LSAME"); latex->SetTextColor(4); latex->DrawLatex(0.35,400,"p");
314   
315   cdEdx->cd(2)->SetLogx(); gHistProtonsdEdxP->Draw("col");
316
317   TCanvas *cZdEdx = new TCanvas("cZdEdx","Normalized dE/dx (TPC)",500,0,700,400);
318   cZdEdx->SetFillColor(10); cZdEdx->SetHighLightColor(10); cZdEdx->Divide(2,1);
319   cZdEdx->cd(1); gHistZP->Draw("col");
320   cZdEdx->cd(2); gHistProtonsZP->Draw("col");
321
322   TCanvas *cEtaPhi = new TCanvas("cEtaPhi",
323                                  "eta-phi",
324                                  0,0,700,400);
325   cEtaPhi->SetFillColor(10); 
326   cEtaPhi->SetHighLightColor(10); cEtaPhi->Divide(2,1);
327   cEtaPhi->cd(1); 
328   gHistEtaPhiProtons->SetTitle("Accepted protons - eta vs phi");
329   gHistEtaPhiProtons->Draw("colz");
330   cEtaPhi->cd(2); 
331   gHistEtaPhiAntiProtons->SetTitle("Accepted antiprotons - eta vs phi");
332   gHistEtaPhiAntiProtons->Draw("colz");
333
334   TCanvas *cDCAPt = new TCanvas("cDCAPt","pT-dca",0,0,700,700);
335   cDCAPt->SetFillColor(10); 
336   cDCAPt->SetHighLightColor(10); cDCAPt->Divide(2,2);
337   cDCAPt->cd(1); 
338   gHistDCAxyPtProtons->SetTitle("Accepted protons - dca(xy) vs Pt");
339   gHistDCAxyPtProtons->Draw("colz");
340   cDCAPt->cd(2); 
341   gHistDCAzPtProtons->SetTitle("Accepted protons - dca(z) vs Pt");
342   gHistDCAzPtProtons->Draw("colz");
343   cDCAPt->cd(3); 
344   gHistDCAxyPtAntiProtons->SetTitle("Accepted antiprotons - dca(xy) vs Pt");
345   gHistDCAxyPtAntiProtons->Draw("colz");
346   cDCAPt->cd(4); 
347   gHistDCAzPtAntiProtons->SetTitle("Accepted antiprotons - dca(z) vs Pt");
348   gHistDCAzPtAntiProtons->Draw("colz");
349
350   /*TCanvas *cEtaPhiNPointsdEdx = new TCanvas("cEtaPhiNPointsdEdx",
351                                             "eta-phi-NPoints(dE/dx)",
352                                             0,0,900,600);
353   cEtaPhiNPointsdEdx->SetFillColor(10); 
354   cEtaPhiNPointsdEdx->SetHighLightColor(10); cEtaPhiNPointsdEdx->Divide(3,2);
355   cEtaPhiNPointsdEdx->cd(1); gHistEtaPhi->Draw("col");
356   cEtaPhiNPointsdEdx->cd(2); gHistEtaTPCdEdxNPoints->Draw("col");
357   cEtaPhiNPointsdEdx->cd(3); gHistPhiTPCdEdxNPoints->Draw("col");
358   cEtaPhiNPointsdEdx->cd(4); gHistProtonsEtaPhi->Draw("col");
359   cEtaPhiNPointsdEdx->cd(5); gHistProtonsEtaTPCdEdxNPoints->Draw("col");
360   cEtaPhiNPointsdEdx->cd(6); gHistProtonsPhiTPCdEdxNPoints->Draw("col");
361
362   TCanvas *cEtaPhiNPoints = new TCanvas("cEtaPhiNPoints",
363                                         "eta-phi-NPoints",
364                                         0,0,900,600);
365   cEtaPhiNPoints->SetFillColor(10); 
366   cEtaPhiNPoints->SetHighLightColor(10); cEtaPhiNPoints->Divide(3,2);
367   cEtaPhiNPoints->cd(1); gHistEtaPhi->Draw("col");
368   cEtaPhiNPoints->cd(2); gHistEtaTPCNPoints->Draw("col");
369   cEtaPhiNPoints->cd(3); gHistPhiTPCNPoints->Draw("col");
370   cEtaPhiNPoints->cd(4); gHistProtonsEtaPhi->Draw("col");
371   cEtaPhiNPoints->cd(5); gHistProtonsEtaTPCNPoints->Draw("col");
372   cEtaPhiNPoints->cd(6); gHistProtonsPhiTPCNPoints->Draw("col");
373
374   TCanvas *cPtPhiNPointsdEdx = new TCanvas("cPtPhiNPointsdEdx",
375                                            "pt-phi-NPoints(dE/dx)",
376                                            0,0,900,600);
377   cPtPhiNPointsdEdx->SetFillColor(10); 
378   cPtPhiNPointsdEdx->SetHighLightColor(10); cPtPhiNPointsdEdx->Divide(3,2);
379   cPtPhiNPointsdEdx->cd(1); gHistPtPhi->Draw("col");
380   cPtPhiNPointsdEdx->cd(2); gHistPtTPCdEdxNPoints->Draw("col");
381   cPtPhiNPointsdEdx->cd(3); gHistPhiTPCdEdxNPoints->Draw("col");
382   cPtPhiNPointsdEdx->cd(4); gHistProtonsPtPhi->Draw("col");
383   cPtPhiNPointsdEdx->cd(5); gHistProtonsPtTPCdEdxNPoints->Draw("col");
384   cPtPhiNPointsdEdx->cd(6); gHistProtonsPhiTPCdEdxNPoints->Draw("col");
385
386   TCanvas *cPtPhiNPoints = new TCanvas("cPtPhiNPoints",
387                                        "pt-phi-NPoints",
388                                        0,0,900,600);
389   cPtPhiNPoints->SetFillColor(10); 
390   cPtPhiNPoints->SetHighLightColor(10); cPtPhiNPoints->Divide(3,2);
391   cPtPhiNPoints->cd(1); gHistPtPhi->Draw("col");
392   cPtPhiNPoints->cd(2); gHistPtTPCNPoints->Draw("col");
393   cPtPhiNPoints->cd(3); gHistPhiTPCNPoints->Draw("col");
394   cPtPhiNPoints->cd(4); gHistProtonsPtPhi->Draw("col");
395   cPtPhiNPoints->cd(5); gHistProtonsPtTPCNPoints->Draw("col");
396   cPtPhiNPoints->cd(6); gHistProtonsPhiTPCNPoints->Draw("col");*/
397
398   //Accepted protons
399   TList *fQAProtonsAcceptedList = dynamic_cast<TList *>(gListGlobalQA->At(1));
400   TH1F *gProtonsITSClustersPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(0));
401   TH1F *gProtonsChi2PerClusterITSPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(1));
402   TH1F *gProtonsTPCClustersPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(2));
403   TH1F *gProtonsChi2PerClusterTPCPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(3));
404   TH1F *gProtonsExtCov11Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(4));
405   TH1F *gProtonsExtCov22Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(5));
406   TH1F *gProtonsExtCov33Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(6));
407   TH1F *gProtonsExtCov44Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(7));
408   TH1F *gProtonsExtCov55Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(8));
409   TH1F *gProtonsSigmaToVertexPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(9));
410   TH1F *gProtonsSigmaToVertexTPCPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(10));
411   TH1F *gProtonsDCAXYPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(11));
412   TH1F *gProtonsDCAXYTPCPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(12));
413   TH1F *gProtonsDCAZPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(13));
414   TH1F *gProtonsDCAZTPCPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(14));
415   TH1F *gProtonsConstrainChi2Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(15));
416   TH1F *gProtonsITSRefitPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(16));
417   TH1F *gProtonsTPCRefitPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(17));
418   TH1F *gProtonsESDpidPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(18));
419   TH1F *gProtonsTPCpidPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(19));
420   TH1F *gProtonsPointOnITSLayer1Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(20));
421   TH1F *gProtonsPointOnITSLayer2Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(21));
422   TH1F *gProtonsPointOnITSLayer3Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(22));
423   TH1F *gProtonsPointOnITSLayer4Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(23));
424   TH1F *gProtonsPointOnITSLayer5Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(24));
425   TH1F *gProtonsPointOnITSLayer6Pass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(25));
426   TH1F *gProtonsNumberOfTPCdEdxPointsPass = dynamic_cast<TH1F *>(fQAProtonsAcceptedList->At(26));
427
428   //Rejected protons
429   TList *fQAProtonsRejectedList = dynamic_cast<TList *>(gListGlobalQA->At(2));
430   TH1F *gProtonsITSClustersReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(0));
431   TH1F *gProtonsChi2PerClusterITSReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(1));
432   TH1F *gProtonsTPCClustersReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(2));
433   TH1F *gProtonsChi2PerClusterTPCReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(3));
434   TH1F *gProtonsExtCov11Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(4));
435   TH1F *gProtonsExtCov22Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(5));
436   TH1F *gProtonsExtCov33Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(6));
437   TH1F *gProtonsExtCov44Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(7));
438   TH1F *gProtonsExtCov55Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(8));
439   TH1F *gProtonsSigmaToVertexReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(9));
440   TH1F *gProtonsSigmaToVertexTPCReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(10));
441   TH1F *gProtonsDCAXYReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(11));
442   TH1F *gProtonsDCAXYTPCReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(12));
443   TH1F *gProtonsDCAZReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(13));
444   TH1F *gProtonsDCAZTPCReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(14));
445   TH1F *gProtonsConstrainChi2Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(15));
446   TH1F *gProtonsITSRefitReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(16));
447   TH1F *gProtonsTPCRefitReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(17));
448   TH1F *gProtonsESDpidReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(18));
449   TH1F *gProtonsTPCpidReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(19));
450   TH1F *gProtonsPointOnITSLayer1Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(20));
451   TH1F *gProtonsPointOnITSLayer2Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(21));
452   TH1F *gProtonsPointOnITSLayer3Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(22));
453   TH1F *gProtonsPointOnITSLayer4Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(23));
454   TH1F *gProtonsPointOnITSLayer5Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(24));
455   TH1F *gProtonsPointOnITSLayer6Reject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(25));
456   TH1F *gProtonsNumberOfTPCdEdxPointsReject = dynamic_cast<TH1F *>(fQAProtonsRejectedList->At(26));
457
458   //Accepted antiprotons
459   TList *fQAAntiProtonsAcceptedList = dynamic_cast<TList *>(gListGlobalQA->At(3));
460   TH1F *gAntiProtonsITSClustersPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(0));
461   TH1F *gAntiProtonsChi2PerClusterITSPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(1));
462   TH1F *gAntiProtonsTPCClustersPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(2));
463   TH1F *gAntiProtonsChi2PerClusterTPCPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(3));
464   TH1F *gAntiProtonsExtCov11Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(4));
465   TH1F *gAntiProtonsExtCov22Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(5));
466   TH1F *gAntiProtonsExtCov33Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(6));
467   TH1F *gAntiProtonsExtCov44Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(7));
468   TH1F *gAntiProtonsExtCov55Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(8));
469   TH1F *gAntiProtonsSigmaToVertexPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(9));
470   TH1F *gAntiProtonsSigmaToVertexTPCPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(10));
471   TH1F *gAntiProtonsDCAXYPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(11));
472   TH1F *gAntiProtonsDCAXYTPCPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(12));
473   TH1F *gAntiProtonsDCAZPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(13));
474   TH1F *gAntiProtonsDCAZTPCPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(14));
475   TH1F *gAntiProtonsConstrainChi2Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(15));
476   TH1F *gAntiProtonsITSRefitPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(16));
477   TH1F *gAntiProtonsTPCRefitPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(17));
478   TH1F *gAntiProtonsESDpidPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(18));
479   TH1F *gAntiProtonsTPCpidPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(19));
480   TH1F *gAntiProtonsPointOnITSLayer1Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(20));
481   TH1F *gAntiProtonsPointOnITSLayer2Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(21));
482   TH1F *gAntiProtonsPointOnITSLayer3Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(22));
483   TH1F *gAntiProtonsPointOnITSLayer4Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(23));
484   TH1F *gAntiProtonsPointOnITSLayer5Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(24));
485   TH1F *gAntiProtonsPointOnITSLayer6Pass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(25));
486   TH1F *gAntiProtonsNumberOfTPCdEdxPointsPass = dynamic_cast<TH1F *>(fQAAntiProtonsAcceptedList->At(26));
487
488   //Rejected antiprotons
489   TList *fQAAntiProtonsRejectedList = dynamic_cast<TList *>(gListGlobalQA->At(4));
490   TH1F *gAntiProtonsITSClustersReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(0));
491   TH1F *gAntiProtonsChi2PerClusterITSReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(1));
492   TH1F *gAntiProtonsTPCClustersReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(2));
493   TH1F *gAntiProtonsChi2PerClusterTPCReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(3));
494   TH1F *gAntiProtonsExtCov11Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(4));
495   TH1F *gAntiProtonsExtCov22Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(5));
496   TH1F *gAntiProtonsExtCov33Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(6));
497   TH1F *gAntiProtonsExtCov44Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(7));
498   TH1F *gAntiProtonsExtCov55Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(8));
499   TH1F *gAntiProtonsSigmaToVertexReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(9));
500   TH1F *gAntiProtonsSigmaToVertexTPCReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(10));
501   TH1F *gAntiProtonsDCAXYReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(11));
502   TH1F *gAntiProtonsDCAXYTPCReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(12));
503   TH1F *gAntiProtonsDCAZReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(13));
504   TH1F *gAntiProtonsDCAZTPCReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(14));
505   TH1F *gAntiProtonsConstrainChi2Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(15));
506   TH1F *gAntiProtonsITSRefitReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(16));
507   TH1F *gAntiProtonsTPCRefitReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(17));
508   TH1F *gAntiProtonsESDpidReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(18));
509   TH1F *gAntiProtonsTPCpidReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(19));
510   TH1F *gAntiProtonsPointOnITSLayer1Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(20));
511   TH1F *gAntiProtonsPointOnITSLayer2Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(21));
512   TH1F *gAntiProtonsPointOnITSLayer3Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(22));
513   TH1F *gAntiProtonsPointOnITSLayer4Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(23));
514   TH1F *gAntiProtonsPointOnITSLayer5Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(24));
515   TH1F *gAntiProtonsPointOnITSLayer6Reject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(25));
516   TH1F *gAntiProtonsNumberOfTPCdEdxPointsReject = dynamic_cast<TH1F *>(fQAAntiProtonsRejectedList->At(26));
517
518   //__________________________________________________//
519   TCanvas *c1 = new TCanvas("c1","ITS clusters",0,0,600,400);
520   c1->SetFillColor(10); c1->SetHighLightColor(10);
521   c1->Divide(2,1);
522   c1->cd(1); gProtonsITSClustersPass->Draw(); 
523   gProtonsITSClustersReject->Draw("same");
524   c1->cd(2); gAntiProtonsITSClustersPass->Draw(); 
525   gAntiProtonsITSClustersReject->Draw("same");
526
527   TCanvas *c2 = new TCanvas("c2","chi^2 per ITS cluster",0,100,600,400);
528   c2->SetFillColor(10); c2->SetHighLightColor(10);
529   c2->Divide(2,1);
530   c2->cd(1); gProtonsChi2PerClusterITSPass->Draw(); 
531   gProtonsChi2PerClusterITSReject->Draw("same");
532   c2->cd(2); gAntiProtonsChi2PerClusterITSPass->Draw(); 
533   gAntiProtonsChi2PerClusterITSReject->Draw("same");
534
535   TCanvas *c3 = new TCanvas("c3","TPC clusters",0,200,600,400);
536   c3->SetFillColor(10); c3->SetHighLightColor(10);
537   c3->Divide(2,1);
538   c3->cd(1); gProtonsTPCClustersPass->Draw();
539   gProtonsTPCClustersReject->Draw("same");
540   c3->cd(2); gAntiProtonsTPCClustersPass->Draw();
541   gAntiProtonsTPCClustersReject->Draw("same");
542
543   TCanvas *c4 = new TCanvas("c4","chi^2 per TPC cluster",0,300,600,400);
544   c4->SetFillColor(10); c4->SetHighLightColor(10);
545   c4->Divide(2,1);
546   c4->cd(1); gProtonsChi2PerClusterTPCPass->Draw(); 
547   gProtonsChi2PerClusterTPCReject->Draw("same");
548   c4->cd(2); gAntiProtonsChi2PerClusterTPCPass->Draw(); 
549   gAntiProtonsChi2PerClusterTPCReject->Draw("same");
550
551   if(gProtonsExtCov11Pass->GetEntries() != 0) {
552     TCanvas *c5 = new TCanvas("c5","Cov11",0,400,600,400);
553     c5->SetFillColor(10); c5->SetHighLightColor(10);
554     c5->Divide(2,1);
555     c5->cd(1)->SetLogy(); gProtonsExtCov11Pass->Draw(); 
556     gProtonsExtCov11Reject->Draw("same");
557     c5->cd(2)->SetLogy(); gAntiProtonsExtCov11Pass->Draw(); 
558     gAntiProtonsExtCov11Reject->Draw("same");
559   }
560
561   if(gProtonsExtCov11Pass->GetEntries() != 0) {
562     TCanvas *c6 = new TCanvas("c6","Cov22",0,500,600,400);
563     c6->SetFillColor(10); c6->SetHighLightColor(10);
564     c6->Divide(2,1);
565     c6->cd(1)->SetLogy(); gProtonsExtCov22Pass->Draw(); 
566     gProtonsExtCov22Reject->Draw("same");
567     c6->cd(2)->SetLogy(); gAntiProtonsExtCov22Pass->Draw(); 
568     gAntiProtonsExtCov22Reject->Draw("same");
569   }
570
571   if(gProtonsExtCov11Pass->GetEntries() != 0) {
572     TCanvas *c7 = new TCanvas("c7","Cov33",600,0,600,400);
573     c7->SetFillColor(10); c7->SetHighLightColor(10);
574     c7->Divide(2,1);
575     c7->cd(1)->SetLogy(); gProtonsExtCov33Pass->Draw(); 
576     gProtonsExtCov33Reject->Draw("same");
577     c7->cd(2)->SetLogy(); gAntiProtonsExtCov33Pass->Draw(); 
578     gAntiProtonsExtCov33Reject->Draw("same");
579   }
580
581   if(gProtonsExtCov11Pass->GetEntries() != 0) {
582     TCanvas *c8 = new TCanvas("c8","Cov44",600,100,600,400);
583     c8->SetFillColor(10); c8->SetHighLightColor(10);
584     c8->Divide(2,1);
585     c8->cd(1)->SetLogy(); gProtonsExtCov44Pass->Draw(); 
586     gProtonsExtCov44Reject->Draw("same");
587     c8->cd(2)->SetLogy(); gAntiProtonsExtCov44Pass->Draw(); 
588     gAntiProtonsExtCov44Reject->Draw("same");
589   }
590
591   if(gProtonsExtCov11Pass->GetEntries() != 0) {
592     TCanvas *c9 = new TCanvas("c9","Cov55",600,200,600,400);
593     c9->SetFillColor(10); c9->SetHighLightColor(10);
594     c9->Divide(2,1);
595     c9->cd(1)->SetLogy(); gProtonsExtCov55Pass->Draw(); 
596     gProtonsExtCov55Reject->Draw("same");
597     c9->cd(2)->SetLogy(); gAntiProtonsExtCov55Pass->Draw(); 
598     gAntiProtonsExtCov55Reject->Draw("same");
599   }
600
601   if(gProtonsSigmaToVertexPass->GetEntries() != 0) {
602     TCanvas *c10 = new TCanvas("c10","N-sigma to Vertex",600,300,600,400);
603     c10->SetFillColor(10); c10->SetHighLightColor(10);
604     c10->Divide(2,1);
605     c10->cd(1)->SetLogy(); gProtonsSigmaToVertexPass->Draw(); 
606     gProtonsSigmaToVertexReject->Draw("same");
607     c10->cd(2)->SetLogy(); gAntiProtonsSigmaToVertexPass->Draw(); 
608     gAntiProtonsSigmaToVertexReject->Draw("same");
609   }
610
611   if(gProtonsSigmaToVertexTPCPass->GetEntries() != 0) {
612     TCanvas *c11 = new TCanvas("c11","N-sigma to Vertex (TPC)",600,400,600,400);
613     c11->SetFillColor(10); c11->SetHighLightColor(10);
614     c11->Divide(2,1);
615     c11->cd(1)->SetLogy(); gProtonsSigmaToVertexTPCPass->Draw(); 
616     gProtonsSigmaToVertexTPCReject->Draw("same");
617     c11->cd(2)->SetLogy(); gAntiProtonsSigmaToVertexTPCPass->Draw(); 
618     gAntiProtonsSigmaToVertexTPCReject->Draw("same");
619   }
620
621   if(gProtonsDCAXYPass->GetEntries() != 0) {
622     TCanvas *c12 = new TCanvas("c12","dca(xy)",600,500,600,400);
623     c12->SetFillColor(10); c12->SetHighLightColor(10);
624     c12->Divide(2,1);
625     c12->cd(1)->SetLogy(); gProtonsDCAXYPass->Draw(); 
626     gProtonsDCAXYReject->Draw("same");
627     c12->cd(2)->SetLogy(); gAntiProtonsDCAXYPass->Draw(); 
628     gAntiProtonsDCAXYReject->Draw("same");
629   }
630
631   if(gProtonsDCAXYTPCPass->GetEntries() != 0) {
632     TCanvas *c13 = new TCanvas("c13","dca(xy - TPC)",1200,0,600,400);
633     c13->SetFillColor(10); c13->SetHighLightColor(10);
634     c13->Divide(2,1);
635     c13->cd(1)->SetLogy(); gProtonsDCAXYTPCPass->Draw(); 
636     gProtonsDCAXYTPCReject->Draw("same");
637     c13->cd(2)->SetLogy(); gAntiProtonsDCAXYTPCPass->Draw(); 
638     gAntiProtonsDCAXYTPCReject->Draw("same");
639   }
640
641   if(gProtonsDCAZPass->GetEntries() != 0) {
642     TCanvas *c14 = new TCanvas("c14","dca(z)",1200,100,600,400);
643     c14->SetFillColor(10); c14->SetHighLightColor(10);
644     c14->Divide(2,1);
645     c14->cd(1)->SetLogy(); gProtonsDCAZPass->Draw(); 
646     gProtonsDCAZReject->Draw("same");
647     c14->cd(2)->SetLogy(); gAntiProtonsDCAZPass->Draw(); 
648     gAntiProtonsDCAZReject->Draw("same");
649   }
650
651   if(gProtonsDCAZTPCPass->GetEntries() != 0) {
652     TCanvas *c15 = new TCanvas("c15","dca(z - TPC)",1200,200,600,400);
653     c15->SetFillColor(10); c15->SetHighLightColor(10);
654     c15->Divide(2,1);
655     c15->cd(1)->SetLogy(); gProtonsDCAZTPCPass->Draw(); 
656     gProtonsDCAZTPCReject->Draw("same");
657     c15->cd(2)->SetLogy(); gAntiProtonsDCAZTPCPass->Draw(); 
658     gAntiProtonsDCAZTPCReject->Draw("same");
659   }
660
661   TCanvas *c16 = new TCanvas("c16","TPC clusters (dE/dx)",1200,300,600,400);
662   c16->SetFillColor(10); c16->SetHighLightColor(10);
663   c16->Divide(2,1);
664   c16->cd(1); gProtonsNumberOfTPCdEdxPointsPass->Draw(); 
665   gProtonsNumberOfTPCdEdxPointsReject->Draw("same");
666   c16->cd(2); gAntiProtonsNumberOfTPCdEdxPointsPass->Draw(); 
667   gAntiProtonsNumberOfTPCdEdxPointsReject->Draw("same");
668
669   //================Vertex QA================//
670   TList *gListVertexQA = dynamic_cast<TList *>(listQA->At(1));
671   TH1F *gHistVx = dynamic_cast<TH1F *>(gListVertexQA->At(0));
672   TH1F *gHistVxAccepted = dynamic_cast<TH1F *>(gListVertexQA->At(1));
673   gHistVxAccepted->SetFillColor(10);
674   TH1F *gHistVy = dynamic_cast<TH1F *>(gListVertexQA->At(2));
675   TH1F *gHistVyAccepted = dynamic_cast<TH1F *>(gListVertexQA->At(3));
676   gHistVyAccepted->SetFillColor(10);
677   TH1F *gHistVz = dynamic_cast<TH1F *>(gListVertexQA->At(4));
678   TH1F *gHistVzAccepted = dynamic_cast<TH1F *>(gListVertexQA->At(5));
679   gHistVzAccepted->SetFillColor(10);
680   TH1F *gHistNumberOfContributors = dynamic_cast<TH1F *>(gListVertexQA->At(6));
681   gHistNumberOfContributors->SetFillColor(10);
682
683   TCanvas *cVertex = new TCanvas("cVertex","Vertex QA",0,0,900,400);
684   cVertex->SetFillColor(10); cVertex->SetHighLightColor(10);
685   cVertex->Divide(3,1);
686   cVertex->cd(1)->SetLogy(); gHistVx->Draw(); gHistVxAccepted->Draw("same");
687   cVertex->cd(2)->SetLogy(); gHistVy->Draw(); gHistVyAccepted->Draw("same");
688   cVertex->cd(3)->SetLogy(); gHistVz->Draw(); gHistVzAccepted->Draw("same");
689
690   TCanvas *cVertexNContributors = new TCanvas("cVertexNContributors",
691                                               "Vertex QA",0,0,400,400);
692   gHistNumberOfContributors->Draw();
693 }
694
695 //________________________________________________________//
696 void PrintYields(TH1 *h) {
697   Double_t sum = 0.0, error = 0.0;
698   for(Int_t iBin = 1; iBin <= h->GetNbinsX(); iBin++) {
699     sum += h->GetBinContent(iBin);
700     error += TMath::Power(h->GetBinError(iBin),2);
701   }
702   error = TMath::Sqrt(error);
703
704   Printf("==================================");
705   Printf("Histogram: %s",h->GetName());
706   Printf("Yields: %lf - %lf",sum,error);
707   Printf("==================================");
708 }
709
710 //___________________________________________________//
711 void drawdEdx(TH2F *gHistdEdxP, Int_t iMode) {
712   //Draws the dE/dx distributions for the different momentum bins
713   //iMode == 0: dEdx vs P
714   //iMode == 1: normalized(dEdx) vs P
715   TString title;
716   TH1D *gHist[100];
717   Int_t iCounter = 0;
718   Double_t binMin = gHistdEdxP->GetXaxis()->GetXmin();
719   Double_t binMax = gHistdEdxP->GetXaxis()->GetXmin() + 
720     (gHistdEdxP->GetXaxis()->GetXmax() - gHistdEdxP->GetXaxis()->GetXmin())/gHistdEdxP->GetNbinsX();
721
722   TCanvas *c[100];
723   TString canvasTitle;
724
725   for(Int_t iBin = 1; iBin <= gHistdEdxP->GetNbinsX(); iBin++) {
726     if((binMax > 0.41)&&(binMin < 1.01)) {
727       if(iMode == 0) {
728         title = "(dEdx)P: "; title += binMin; title += " - "; 
729         title += binMax; title += "GeV/c";
730         canvasTitle = "dedxMomentumSlice."; canvasTitle += iCounter;
731         canvasTitle += ".gif";
732         c[iCounter] = new TCanvas(title.Data(),title.Data(),0,0,500,500);
733       }
734       if(iMode == 1) {
735         title = "(normdEdx)P: "; title += binMin; title += " - "; 
736         title += binMax; title += "GeV/c";
737         canvasTitle = "normdedxMomentumSlice."; canvasTitle += iCounter;
738         canvasTitle += ".gif";
739         c[iCounter] = new TCanvas(title.Data(),title.Data(),500,0,500,500);
740       }
741       c[iCounter]->SetFillColor(10); c[iCounter]->SetHighLightColor(10); 
742       gHist[iCounter] = gHistdEdxP->ProjectionY(title.Data(),iBin,iBin+1);
743       gHist[iCounter]->SetTitle(title.Data());
744       gHist[iCounter]->SetStats(kFALSE);
745       if(iMode == 0)
746         gHist[iCounter]->GetXaxis()->SetRangeUser(0.0,300.);
747       if(iMode == 1)
748         gHist[iCounter]->GetXaxis()->SetRangeUser(-2.0,2.0);
749       if(gHist[iCounter]->GetEntries() != 0)
750         c[iCounter]->SetLogy();
751       gHist[iCounter]->Draw();
752       c[iCounter]->SaveAs(canvasTitle.Data());
753       //Printf("Bin: %d - Pmin: %lf - Pmax: %lf : %s",iBin,binMin,binMax,title.Data());
754       iCounter += 1;
755     }
756     binMin += (gHistdEdxP->GetXaxis()->GetXmax() - gHistdEdxP->GetXaxis()->GetXmin())/gHistdEdxP->GetNbinsX();
757     binMax += (gHistdEdxP->GetXaxis()->GetXmax() - gHistdEdxP->GetXaxis()->GetXmin())/gHistdEdxP->GetNbinsX();
758   }
759   
760 }
761
762 //___________________________________________________//
763 void drawMCvsData(const char* analysisOutputMC,
764                   const char* analysisOutputData) {
765   //Draws the QA plots from the output of the analysis
766   //=========================================================//
767   gStyle->SetPalette(1,0);
768
769   //=========================================================//
770   //QA MC plots
771   TFile *fMC = TFile::Open(analysisOutputMC);
772   TList *listQAMC = dynamic_cast<TList *>(fMC->Get("outputQAList"));
773   TList *gListGlobalQAMC = dynamic_cast<TList *>(listQAMC->At(0));
774
775   //================QA plots================//
776   TList *fQAMC2DList = dynamic_cast<TList *>(gListGlobalQAMC->At(0));
777
778   //Rejected protons
779   TList *fQAMCProtonsRejectedList = dynamic_cast<TList *>(gListGlobalQAMC->At(2));
780   TH1F *gMCProtonsITSClustersReject = dynamic_cast<TH1F *>(fQAMCProtonsRejectedList->At(0));
781   TH1F *gMCProtonsTPCClustersReject = dynamic_cast<TH1F *>(fQAMCProtonsRejectedList->At(2));
782   TH1F *gMCProtonsChi2PerClusterTPCReject = dynamic_cast<TH1F *>(fQAMCProtonsRejectedList->At(3));
783   TH1F *gMCProtonsExtCov11Reject = dynamic_cast<TH1F *>(fQAMCProtonsRejectedList->At(4));
784   TH1F *gMCProtonsExtCov22Reject = dynamic_cast<TH1F *>(fQAMCProtonsRejectedList->At(5));
785   TH1F *gMCProtonsExtCov33Reject = dynamic_cast<TH1F *>(fQAMCProtonsRejectedList->At(6));
786   TH1F *gMCProtonsExtCov44Reject = dynamic_cast<TH1F *>(fQAMCProtonsRejectedList->At(7));
787   TH1F *gMCProtonsExtCov55Reject = dynamic_cast<TH1F *>(fQAMCProtonsRejectedList->At(8));
788   TH1F *gMCProtonsDCAXYReject = dynamic_cast<TH1F *>(fQAMCProtonsRejectedList->At(11));
789   TH1F *gMCProtonsDCAZReject = dynamic_cast<TH1F *>(fQAMCProtonsRejectedList->At(13));
790   TH1F *gMCProtonsNumberOfTPCdEdxPointsReject = dynamic_cast<TH1F *>(fQAMCProtonsRejectedList->At(26));
791
792   //Accepted protons
793   TList *fQAMCProtonsAcceptedList = dynamic_cast<TList *>(gListGlobalQAMC->At(1));
794   TH1F *gMCProtonsITSClustersPass = dynamic_cast<TH1F *>(fQAMCProtonsAcceptedList->At(0));
795   gMCProtonsITSClustersPass->SetStats(kFALSE);
796   gMCProtonsITSClustersPass->Add(gMCProtonsITSClustersReject);
797   gMCProtonsITSClustersPass->Sumw2();
798   gMCProtonsITSClustersPass->Scale(1./gMCProtonsITSClustersPass->Integral(1,gMCProtonsITSClustersPass->GetNbinsX()));
799   gMCProtonsITSClustersPass->SetMarkerStyle(20);
800   TH1F *gMCProtonsTPCClustersPass = dynamic_cast<TH1F *>(fQAMCProtonsAcceptedList->At(2));
801   gMCProtonsTPCClustersPass->SetStats(kFALSE);
802   gMCProtonsTPCClustersPass->Add(gMCProtonsTPCClustersReject);
803   gMCProtonsTPCClustersPass->Sumw2();
804   gMCProtonsTPCClustersPass->Scale(1./gMCProtonsTPCClustersPass->Integral(1,gMCProtonsTPCClustersPass->GetNbinsX()));
805   gMCProtonsTPCClustersPass->SetMarkerStyle(20);
806   TH1F *gMCProtonsChi2PerClusterTPCPass = dynamic_cast<TH1F *>(fQAMCProtonsAcceptedList->At(3));
807   gMCProtonsChi2PerClusterTPCPass->SetStats(kFALSE);
808   gMCProtonsChi2PerClusterTPCPass->Add(gMCProtonsChi2PerClusterTPCReject);
809   gMCProtonsChi2PerClusterTPCPass->Sumw2();
810   gMCProtonsChi2PerClusterTPCPass->Scale(1./gMCProtonsChi2PerClusterTPCPass->Integral(1,gMCProtonsChi2PerClusterTPCPass->GetNbinsX()));
811   gMCProtonsChi2PerClusterTPCPass->SetMarkerStyle(20);
812   TH1F *gMCProtonsExtCov11Pass = dynamic_cast<TH1F *>(fQAMCProtonsAcceptedList->At(4));
813   gMCProtonsExtCov11Pass->SetStats(kFALSE);
814   gMCProtonsExtCov11Pass->Add(gMCProtonsExtCov11Reject);
815   gMCProtonsExtCov11Pass->Sumw2();
816   gMCProtonsExtCov11Pass->Scale(1./gMCProtonsExtCov11Pass->Integral(1,gMCProtonsExtCov11Pass->GetNbinsX()));
817   gMCProtonsExtCov11Pass->SetMarkerStyle(20);
818   TH1F *gMCProtonsExtCov22Pass = dynamic_cast<TH1F *>(fQAMCProtonsAcceptedList->At(5));
819   gMCProtonsExtCov22Pass->SetStats(kFALSE);
820   gMCProtonsExtCov22Pass->Add(gMCProtonsExtCov22Reject);
821   gMCProtonsExtCov22Pass->Sumw2();
822   gMCProtonsExtCov22Pass->Scale(1./gMCProtonsExtCov22Pass->Integral(1,gMCProtonsExtCov22Pass->GetNbinsX()));
823   gMCProtonsExtCov22Pass->SetMarkerStyle(20);
824   TH1F *gMCProtonsExtCov33Pass = dynamic_cast<TH1F *>(fQAMCProtonsAcceptedList->At(6));
825   gMCProtonsExtCov33Pass->SetStats(kFALSE);
826   gMCProtonsExtCov33Pass->Add(gMCProtonsExtCov33Reject);
827   gMCProtonsExtCov33Pass->Sumw2();
828   gMCProtonsExtCov33Pass->Scale(1./gMCProtonsExtCov33Pass->Integral(1,gMCProtonsExtCov33Pass->GetNbinsX()));
829   gMCProtonsExtCov33Pass->SetMarkerStyle(20);
830   TH1F *gMCProtonsExtCov44Pass = dynamic_cast<TH1F *>(fQAMCProtonsAcceptedList->At(7));
831   gMCProtonsExtCov44Pass->SetStats(kFALSE);
832   gMCProtonsExtCov44Pass->Add(gMCProtonsExtCov44Reject);
833   gMCProtonsExtCov44Pass->Sumw2();
834   gMCProtonsExtCov44Pass->Scale(1./gMCProtonsExtCov44Pass->Integral(1,gMCProtonsExtCov44Pass->GetNbinsX()));
835   gMCProtonsExtCov44Pass->SetMarkerStyle(20);
836   TH1F *gMCProtonsExtCov55Pass = dynamic_cast<TH1F *>(fQAMCProtonsAcceptedList->At(8));
837   gMCProtonsExtCov55Pass->SetStats(kFALSE);
838   gMCProtonsExtCov55Pass->Add(gMCProtonsExtCov55Reject);
839   gMCProtonsExtCov55Pass->Sumw2();
840   gMCProtonsExtCov55Pass->Scale(1./gMCProtonsExtCov55Pass->Integral(1,gMCProtonsExtCov55Pass->GetNbinsX()));
841   gMCProtonsExtCov55Pass->SetMarkerStyle(20);
842   TH1F *gMCProtonsDCAXYPass = dynamic_cast<TH1F *>(fQAMCProtonsAcceptedList->At(11));
843   gMCProtonsDCAXYPass->SetStats(kFALSE);  
844   gMCProtonsDCAXYPass->Add(gMCProtonsDCAXYReject);
845   gMCProtonsDCAXYPass->Sumw2();
846   gMCProtonsDCAXYPass->Scale(1./gMCProtonsDCAXYPass->Integral(1,gMCProtonsDCAXYPass->GetNbinsX()));
847   gMCProtonsDCAXYPass->SetMarkerStyle(20);
848   TH1F *gMCProtonsDCAZPass = dynamic_cast<TH1F *>(fQAMCProtonsAcceptedList->At(13));
849   gMCProtonsDCAZPass->SetStats(kFALSE);  
850   gMCProtonsDCAZPass->Add(gMCProtonsDCAZReject);
851   gMCProtonsDCAZPass->Sumw2();
852   gMCProtonsDCAZPass->Scale(1./gMCProtonsDCAZPass->Integral(1,gMCProtonsDCAZPass->GetNbinsX()));
853   gMCProtonsDCAZPass->SetMarkerStyle(20);
854   TH1F *gMCProtonsNumberOfTPCdEdxPointsPass = dynamic_cast<TH1F *>(fQAMCProtonsAcceptedList->At(26));
855   gMCProtonsNumberOfTPCdEdxPointsPass->SetStats(kFALSE);  
856   gMCProtonsNumberOfTPCdEdxPointsPass->Add(gMCProtonsNumberOfTPCdEdxPointsReject);
857   gMCProtonsNumberOfTPCdEdxPointsPass->Sumw2();
858   gMCProtonsNumberOfTPCdEdxPointsPass->Scale(1./gMCProtonsNumberOfTPCdEdxPointsPass->Integral(1,gMCProtonsNumberOfTPCdEdxPointsPass->GetNbinsX()));
859   gMCProtonsNumberOfTPCdEdxPointsPass->SetMarkerStyle(20);
860
861   //Rejected antiprotons
862   TList *fQAMCAntiProtonsRejectedList = dynamic_cast<TList *>(gListGlobalQAMC->At(4));
863   TH1F *gMCAntiProtonsITSClustersReject = dynamic_cast<TH1F *>(fQAMCAntiProtonsRejectedList->At(0));
864   TH1F *gMCAntiProtonsTPCClustersReject = dynamic_cast<TH1F *>(fQAMCAntiProtonsRejectedList->At(2));
865   TH1F *gMCAntiProtonsChi2PerClusterTPCReject = dynamic_cast<TH1F *>(fQAMCAntiProtonsRejectedList->At(3));
866   TH1F *gMCAntiProtonsExtCov11Reject = dynamic_cast<TH1F *>(fQAMCAntiProtonsRejectedList->At(4));
867   TH1F *gMCAntiProtonsExtCov22Reject = dynamic_cast<TH1F *>(fQAMCAntiProtonsRejectedList->At(5));
868   TH1F *gMCAntiProtonsExtCov33Reject = dynamic_cast<TH1F *>(fQAMCAntiProtonsRejectedList->At(6));
869   TH1F *gMCAntiProtonsExtCov44Reject = dynamic_cast<TH1F *>(fQAMCAntiProtonsRejectedList->At(7));
870   TH1F *gMCAntiProtonsExtCov55Reject = dynamic_cast<TH1F *>(fQAMCAntiProtonsRejectedList->At(8));
871   TH1F *gMCAntiProtonsDCAXYReject = dynamic_cast<TH1F *>(fQAMCAntiProtonsRejectedList->At(11));
872   TH1F *gMCAntiProtonsDCAZReject = dynamic_cast<TH1F *>(fQAMCAntiProtonsRejectedList->At(13));
873   TH1F *gMCAntiProtonsNumberOfTPCdEdxPointsReject = dynamic_cast<TH1F *>(fQAMCAntiProtonsRejectedList->At(26));
874
875   //Accepted protons
876   TList *fQAMCAntiProtonsAcceptedList = dynamic_cast<TList *>(gListGlobalQAMC->At(3));
877   TH1F *gMCAntiProtonsITSClustersPass = dynamic_cast<TH1F *>(fQAMCAntiProtonsAcceptedList->At(0));
878   gMCAntiProtonsITSClustersPass->SetStats(kFALSE);
879   gMCAntiProtonsITSClustersPass->Add(gMCAntiProtonsITSClustersReject);
880   gMCAntiProtonsITSClustersPass->Sumw2();
881   gMCAntiProtonsITSClustersPass->Scale(1./gMCAntiProtonsITSClustersPass->Integral(1,gMCAntiProtonsITSClustersPass->GetNbinsX()));
882   gMCAntiProtonsITSClustersPass->SetMarkerStyle(20);
883   TH1F *gMCAntiProtonsTPCClustersPass = dynamic_cast<TH1F *>(fQAMCAntiProtonsAcceptedList->At(2));
884   gMCAntiProtonsTPCClustersPass->SetStats(kFALSE);
885   gMCAntiProtonsTPCClustersPass->Add(gMCAntiProtonsTPCClustersReject);
886   gMCAntiProtonsTPCClustersPass->Sumw2();
887   gMCAntiProtonsTPCClustersPass->Scale(1./gMCAntiProtonsTPCClustersPass->Integral(1,gMCAntiProtonsTPCClustersPass->GetNbinsX()));
888   gMCAntiProtonsTPCClustersPass->SetMarkerStyle(20);
889   TH1F *gMCAntiProtonsChi2PerClusterTPCPass = dynamic_cast<TH1F *>(fQAMCAntiProtonsAcceptedList->At(3));
890   gMCAntiProtonsChi2PerClusterTPCPass->SetStats(kFALSE);
891   gMCAntiProtonsChi2PerClusterTPCPass->Add(gMCAntiProtonsChi2PerClusterTPCReject);
892   gMCAntiProtonsChi2PerClusterTPCPass->Sumw2();
893   gMCAntiProtonsChi2PerClusterTPCPass->Scale(1./gMCAntiProtonsChi2PerClusterTPCPass->Integral(1,gMCAntiProtonsChi2PerClusterTPCPass->GetNbinsX()));
894   gMCAntiProtonsChi2PerClusterTPCPass->SetMarkerStyle(20);
895   TH1F *gMCAntiProtonsExtCov11Pass = dynamic_cast<TH1F *>(fQAMCAntiProtonsAcceptedList->At(4));
896   gMCAntiProtonsExtCov11Pass->SetStats(kFALSE);
897   gMCAntiProtonsExtCov11Pass->Add(gMCAntiProtonsExtCov11Reject);
898   gMCAntiProtonsExtCov11Pass->Sumw2();
899   gMCAntiProtonsExtCov11Pass->Scale(1./gMCAntiProtonsExtCov11Pass->Integral(1,gMCAntiProtonsExtCov11Pass->GetNbinsX()));
900   gMCAntiProtonsExtCov11Pass->SetMarkerStyle(20);
901   TH1F *gMCAntiProtonsExtCov22Pass = dynamic_cast<TH1F *>(fQAMCAntiProtonsAcceptedList->At(5));
902   gMCAntiProtonsExtCov22Pass->SetStats(kFALSE);
903   gMCAntiProtonsExtCov22Pass->Add(gMCAntiProtonsExtCov22Reject);
904   gMCAntiProtonsExtCov22Pass->Sumw2();
905   gMCAntiProtonsExtCov22Pass->Scale(1./gMCAntiProtonsExtCov22Pass->Integral(1,gMCAntiProtonsExtCov22Pass->GetNbinsX()));
906   gMCAntiProtonsExtCov22Pass->SetMarkerStyle(20);
907   TH1F *gMCAntiProtonsExtCov33Pass = dynamic_cast<TH1F *>(fQAMCAntiProtonsAcceptedList->At(6));
908   gMCAntiProtonsExtCov33Pass->SetStats(kFALSE);
909   gMCAntiProtonsExtCov33Pass->Add(gMCAntiProtonsExtCov33Reject);
910   gMCAntiProtonsExtCov33Pass->Sumw2();
911   gMCAntiProtonsExtCov33Pass->Scale(1./gMCAntiProtonsExtCov33Pass->Integral(1,gMCAntiProtonsExtCov33Pass->GetNbinsX()));
912   gMCAntiProtonsExtCov33Pass->SetMarkerStyle(20);
913   TH1F *gMCAntiProtonsExtCov44Pass = dynamic_cast<TH1F *>(fQAMCAntiProtonsAcceptedList->At(7));
914   gMCAntiProtonsExtCov44Pass->SetStats(kFALSE);
915   gMCAntiProtonsExtCov44Pass->Add(gMCAntiProtonsExtCov44Reject);
916   gMCAntiProtonsExtCov44Pass->Sumw2();
917   gMCAntiProtonsExtCov44Pass->Scale(1./gMCAntiProtonsExtCov44Pass->Integral(1,gMCAntiProtonsExtCov44Pass->GetNbinsX()));
918   gMCAntiProtonsExtCov44Pass->SetMarkerStyle(20);
919   TH1F *gMCAntiProtonsExtCov55Pass = dynamic_cast<TH1F *>(fQAMCAntiProtonsAcceptedList->At(8));
920   gMCAntiProtonsExtCov55Pass->SetStats(kFALSE);
921   gMCAntiProtonsExtCov55Pass->Add(gMCAntiProtonsExtCov55Reject);
922   gMCAntiProtonsExtCov55Pass->Sumw2();
923   gMCAntiProtonsExtCov55Pass->Scale(1./gMCAntiProtonsExtCov55Pass->Integral(1,gMCAntiProtonsExtCov55Pass->GetNbinsX()));
924   gMCAntiProtonsExtCov55Pass->SetMarkerStyle(20);
925   TH1F *gMCAntiProtonsDCAXYPass = dynamic_cast<TH1F *>(fQAMCAntiProtonsAcceptedList->At(11));
926   gMCAntiProtonsDCAXYPass->SetStats(kFALSE);  
927   gMCAntiProtonsDCAXYPass->Add(gMCAntiProtonsDCAXYReject);
928   gMCAntiProtonsDCAXYPass->Sumw2();
929   gMCAntiProtonsDCAXYPass->Scale(1./gMCAntiProtonsDCAXYPass->Integral(1,gMCAntiProtonsDCAXYPass->GetNbinsX()));
930   gMCAntiProtonsDCAXYPass->SetMarkerStyle(20);
931   TH1F *gMCAntiProtonsDCAZPass = dynamic_cast<TH1F *>(fQAMCAntiProtonsAcceptedList->At(13));
932   gMCAntiProtonsDCAZPass->SetStats(kFALSE);  
933   gMCAntiProtonsDCAZPass->Add(gMCAntiProtonsDCAZReject);
934   gMCAntiProtonsDCAZPass->Sumw2();
935   gMCAntiProtonsDCAZPass->Scale(1./gMCAntiProtonsDCAZPass->Integral(1,gMCAntiProtonsDCAZPass->GetNbinsX()));
936   gMCAntiProtonsDCAZPass->SetMarkerStyle(20);
937   TH1F *gMCAntiProtonsNumberOfTPCdEdxPointsPass = dynamic_cast<TH1F *>(fQAMCAntiProtonsAcceptedList->At(26));
938   gMCAntiProtonsNumberOfTPCdEdxPointsPass->SetStats(kFALSE);  
939   gMCAntiProtonsNumberOfTPCdEdxPointsPass->Add(gMCAntiProtonsNumberOfTPCdEdxPointsReject);
940   gMCAntiProtonsNumberOfTPCdEdxPointsPass->Sumw2();
941   gMCAntiProtonsNumberOfTPCdEdxPointsPass->Scale(1./gMCAntiProtonsNumberOfTPCdEdxPointsPass->Integral(1,gMCAntiProtonsNumberOfTPCdEdxPointsPass->GetNbinsX()));
942   gMCAntiProtonsNumberOfTPCdEdxPointsPass->SetMarkerStyle(20);
943
944   //=========================================================//
945   //QA data plots
946   TFile *fData = TFile::Open(analysisOutputData);
947   TList *listQAData = dynamic_cast<TList *>(fData->Get("outputQAList"));
948   TList *gListGlobalQAData = dynamic_cast<TList *>(listQAData->At(0));
949
950   //================QA plots================//
951   TList *fQAData2DList = dynamic_cast<TList *>(gListGlobalQAData->At(0));
952
953   //Rejected protons
954   TList *fQADataProtonsRejectedList = dynamic_cast<TList *>(gListGlobalQAData->At(2));
955   TH1F *gDataProtonsITSClustersReject = dynamic_cast<TH1F *>(fQADataProtonsRejectedList->At(0));
956   TH1F *gDataProtonsTPCClustersReject = dynamic_cast<TH1F *>(fQADataProtonsRejectedList->At(2));
957   TH1F *gDataProtonsChi2PerClusterTPCReject = dynamic_cast<TH1F *>(fQADataProtonsRejectedList->At(3));
958   TH1F *gDataProtonsExtCov11Reject = dynamic_cast<TH1F *>(fQADataProtonsRejectedList->At(4));
959   TH1F *gDataProtonsExtCov22Reject = dynamic_cast<TH1F *>(fQADataProtonsRejectedList->At(5));
960   TH1F *gDataProtonsExtCov33Reject = dynamic_cast<TH1F *>(fQADataProtonsRejectedList->At(6));
961   TH1F *gDataProtonsExtCov44Reject = dynamic_cast<TH1F *>(fQADataProtonsRejectedList->At(7));
962   TH1F *gDataProtonsExtCov55Reject = dynamic_cast<TH1F *>(fQADataProtonsRejectedList->At(8));
963   TH1F *gDataProtonsDCAXYReject = dynamic_cast<TH1F *>(fQADataProtonsRejectedList->At(11));
964   TH1F *gDataProtonsDCAZReject = dynamic_cast<TH1F *>(fQADataProtonsRejectedList->At(13));
965   TH1F *gDataProtonsNumberOfTPCdEdxPointsReject = dynamic_cast<TH1F *>(fQADataProtonsRejectedList->At(26));
966
967   //Accepted protons
968   TList *fQADataProtonsAcceptedList = dynamic_cast<TList *>(gListGlobalQAData->At(1));
969   TH1F *gDataProtonsITSClustersPass = dynamic_cast<TH1F *>(fQADataProtonsAcceptedList->At(0));
970   gDataProtonsITSClustersPass->SetStats(kFALSE);
971   gDataProtonsITSClustersPass->Add(gDataProtonsITSClustersReject);
972   gDataProtonsITSClustersPass->Sumw2();
973   gDataProtonsITSClustersPass->Scale(1./gDataProtonsITSClustersPass->Integral(1,gDataProtonsITSClustersPass->GetNbinsX()));
974   gDataProtonsITSClustersPass->SetMarkerStyle(1);
975   TH1F *gDataProtonsTPCClustersPass = dynamic_cast<TH1F *>(fQADataProtonsAcceptedList->At(2));
976   gDataProtonsTPCClustersPass->SetStats(kFALSE);
977   gDataProtonsTPCClustersPass->Add(gDataProtonsTPCClustersReject);
978   gDataProtonsTPCClustersPass->Sumw2();
979   gDataProtonsTPCClustersPass->Scale(1./gDataProtonsTPCClustersPass->Integral(1,gDataProtonsTPCClustersPass->GetNbinsX()));
980   gDataProtonsTPCClustersPass->SetMarkerStyle(1);
981   TH1F *gDataProtonsChi2PerClusterTPCPass = dynamic_cast<TH1F *>(fQADataProtonsAcceptedList->At(3));
982   gDataProtonsChi2PerClusterTPCPass->SetStats(kFALSE);
983   gDataProtonsChi2PerClusterTPCPass->Add(gDataProtonsChi2PerClusterTPCReject);
984   gDataProtonsChi2PerClusterTPCPass->Sumw2();
985   gDataProtonsChi2PerClusterTPCPass->Scale(1./gDataProtonsChi2PerClusterTPCPass->Integral(1,gDataProtonsChi2PerClusterTPCPass->GetNbinsX()));
986   gDataProtonsChi2PerClusterTPCPass->SetMarkerStyle(1);
987   TH1F *gDataProtonsExtCov11Pass = dynamic_cast<TH1F *>(fQADataProtonsAcceptedList->At(4));
988   gDataProtonsExtCov11Pass->SetStats(kFALSE);
989   gDataProtonsExtCov11Pass->Add(gDataProtonsExtCov11Reject);
990   gDataProtonsExtCov11Pass->Sumw2();
991   gDataProtonsExtCov11Pass->Scale(1./gDataProtonsExtCov11Pass->Integral(1,gDataProtonsExtCov11Pass->GetNbinsX()));
992   gDataProtonsExtCov11Pass->SetMarkerStyle(1);
993   TH1F *gDataProtonsExtCov22Pass = dynamic_cast<TH1F *>(fQADataProtonsAcceptedList->At(5));
994   gDataProtonsExtCov22Pass->SetStats(kFALSE);
995   gDataProtonsExtCov22Pass->Add(gDataProtonsExtCov22Reject);
996   gDataProtonsExtCov22Pass->Sumw2();
997   gDataProtonsExtCov22Pass->Scale(1./gDataProtonsExtCov22Pass->Integral(1,gDataProtonsExtCov22Pass->GetNbinsX()));
998   gDataProtonsExtCov22Pass->SetMarkerStyle(1);
999   TH1F *gDataProtonsExtCov33Pass = dynamic_cast<TH1F *>(fQADataProtonsAcceptedList->At(6));
1000   gDataProtonsExtCov33Pass->SetStats(kFALSE);
1001   gDataProtonsExtCov33Pass->Add(gDataProtonsExtCov33Reject);
1002   gDataProtonsExtCov33Pass->Sumw2();
1003   gDataProtonsExtCov33Pass->Scale(1./gDataProtonsExtCov33Pass->Integral(1,gDataProtonsExtCov33Pass->GetNbinsX()));
1004   gDataProtonsExtCov33Pass->SetMarkerStyle(1);
1005   TH1F *gDataProtonsExtCov44Pass = dynamic_cast<TH1F *>(fQADataProtonsAcceptedList->At(7));
1006   gDataProtonsExtCov44Pass->SetStats(kFALSE);
1007   gDataProtonsExtCov44Pass->Add(gDataProtonsExtCov44Reject);
1008   gDataProtonsExtCov44Pass->Sumw2();
1009   gDataProtonsExtCov44Pass->Scale(1./gDataProtonsExtCov44Pass->Integral(1,gDataProtonsExtCov44Pass->GetNbinsX()));
1010   gDataProtonsExtCov44Pass->SetMarkerStyle(1);
1011   TH1F *gDataProtonsExtCov55Pass = dynamic_cast<TH1F *>(fQADataProtonsAcceptedList->At(8));
1012   gDataProtonsExtCov55Pass->SetStats(kFALSE);
1013   gDataProtonsExtCov55Pass->Add(gDataProtonsExtCov55Reject);
1014   gDataProtonsExtCov55Pass->Sumw2();
1015   gDataProtonsExtCov55Pass->Scale(1./gDataProtonsExtCov55Pass->Integral(1,gDataProtonsExtCov55Pass->GetNbinsX()));
1016   gDataProtonsExtCov55Pass->SetMarkerStyle(1);
1017   TH1F *gDataProtonsDCAXYPass = dynamic_cast<TH1F *>(fQADataProtonsAcceptedList->At(11));
1018   gDataProtonsDCAXYPass->SetStats(kFALSE);  
1019   gDataProtonsDCAXYPass->Add(gDataProtonsDCAXYReject);
1020   gDataProtonsDCAXYPass->Sumw2();
1021   gDataProtonsDCAXYPass->Scale(1./gDataProtonsDCAXYPass->Integral(1,gDataProtonsDCAXYPass->GetNbinsX()));
1022   gDataProtonsDCAXYPass->SetMarkerStyle(1);
1023   TH1F *gDataProtonsDCAZPass = dynamic_cast<TH1F *>(fQADataProtonsAcceptedList->At(13));
1024   gDataProtonsDCAZPass->SetStats(kFALSE);  
1025   gDataProtonsDCAZPass->Add(gDataProtonsDCAZReject);
1026   gDataProtonsDCAZPass->Sumw2();
1027   gDataProtonsDCAZPass->Scale(1./gDataProtonsDCAZPass->Integral(1,gDataProtonsDCAZPass->GetNbinsX()));
1028   gDataProtonsDCAZPass->SetMarkerStyle(1);
1029   TH1F *gDataProtonsNumberOfTPCdEdxPointsPass = dynamic_cast<TH1F *>(fQADataProtonsAcceptedList->At(26));
1030   gDataProtonsNumberOfTPCdEdxPointsPass->SetStats(kFALSE);  
1031   gDataProtonsNumberOfTPCdEdxPointsPass->Add(gDataProtonsNumberOfTPCdEdxPointsReject);
1032   gDataProtonsNumberOfTPCdEdxPointsPass->Sumw2();
1033   gDataProtonsNumberOfTPCdEdxPointsPass->Scale(1./gDataProtonsNumberOfTPCdEdxPointsPass->Integral(1,gDataProtonsNumberOfTPCdEdxPointsPass->GetNbinsX()));
1034   gDataProtonsNumberOfTPCdEdxPointsPass->SetMarkerStyle(1);
1035
1036   //Rejected antiprotons
1037   TList *fQADataAntiProtonsRejectedList = dynamic_cast<TList *>(gListGlobalQAData->At(4));
1038   TH1F *gDataAntiProtonsITSClustersReject = dynamic_cast<TH1F *>(fQADataAntiProtonsRejectedList->At(0));
1039   TH1F *gDataAntiProtonsTPCClustersReject = dynamic_cast<TH1F *>(fQADataAntiProtonsRejectedList->At(2));
1040   TH1F *gDataAntiProtonsChi2PerClusterTPCReject = dynamic_cast<TH1F *>(fQADataAntiProtonsRejectedList->At(3));
1041   TH1F *gDataAntiProtonsExtCov11Reject = dynamic_cast<TH1F *>(fQADataAntiProtonsRejectedList->At(4));
1042   TH1F *gDataAntiProtonsExtCov22Reject = dynamic_cast<TH1F *>(fQADataAntiProtonsRejectedList->At(5));
1043   TH1F *gDataAntiProtonsExtCov33Reject = dynamic_cast<TH1F *>(fQADataAntiProtonsRejectedList->At(6));
1044   TH1F *gDataAntiProtonsExtCov44Reject = dynamic_cast<TH1F *>(fQADataAntiProtonsRejectedList->At(7));
1045   TH1F *gDataAntiProtonsExtCov55Reject = dynamic_cast<TH1F *>(fQADataAntiProtonsRejectedList->At(8));
1046   TH1F *gDataAntiProtonsDCAXYReject = dynamic_cast<TH1F *>(fQADataAntiProtonsRejectedList->At(11));
1047   TH1F *gDataAntiProtonsDCAZReject = dynamic_cast<TH1F *>(fQADataAntiProtonsRejectedList->At(13));
1048   TH1F *gDataAntiProtonsNumberOfTPCdEdxPointsReject = dynamic_cast<TH1F *>(fQADataAntiProtonsRejectedList->At(26));
1049
1050   //Accepted protons
1051   TList *fQADataAntiProtonsAcceptedList = dynamic_cast<TList *>(gListGlobalQAData->At(3));
1052   TH1F *gDataAntiProtonsITSClustersPass = dynamic_cast<TH1F *>(fQADataAntiProtonsAcceptedList->At(0));
1053   gDataAntiProtonsITSClustersPass->SetStats(kFALSE);
1054   gDataAntiProtonsITSClustersPass->Add(gDataAntiProtonsITSClustersReject);
1055   gDataAntiProtonsITSClustersPass->Sumw2();
1056   gDataAntiProtonsITSClustersPass->Scale(1./gDataAntiProtonsITSClustersPass->Integral(1,gDataAntiProtonsITSClustersPass->GetNbinsX()));
1057   gDataAntiProtonsITSClustersPass->SetMarkerStyle(1);
1058   TH1F *gDataAntiProtonsTPCClustersPass = dynamic_cast<TH1F *>(fQADataAntiProtonsAcceptedList->At(2));
1059   gDataAntiProtonsTPCClustersPass->SetStats(kFALSE);
1060   gDataAntiProtonsTPCClustersPass->Add(gDataAntiProtonsTPCClustersReject);
1061   gDataAntiProtonsTPCClustersPass->Sumw2();
1062   gDataAntiProtonsTPCClustersPass->Scale(1./gDataAntiProtonsTPCClustersPass->Integral(1,gDataAntiProtonsTPCClustersPass->GetNbinsX()));
1063   gDataAntiProtonsTPCClustersPass->SetMarkerStyle(1);
1064   TH1F *gDataAntiProtonsChi2PerClusterTPCPass = dynamic_cast<TH1F *>(fQADataAntiProtonsAcceptedList->At(3));
1065   gDataAntiProtonsChi2PerClusterTPCPass->SetStats(kFALSE);
1066   gDataAntiProtonsChi2PerClusterTPCPass->Add(gDataAntiProtonsChi2PerClusterTPCReject);
1067   gDataAntiProtonsChi2PerClusterTPCPass->Sumw2();
1068   gDataAntiProtonsChi2PerClusterTPCPass->Scale(1./gDataAntiProtonsChi2PerClusterTPCPass->Integral(1,gDataAntiProtonsChi2PerClusterTPCPass->GetNbinsX()));
1069   gDataAntiProtonsChi2PerClusterTPCPass->SetMarkerStyle(1);
1070   TH1F *gDataAntiProtonsExtCov11Pass = dynamic_cast<TH1F *>(fQADataAntiProtonsAcceptedList->At(4));
1071   gDataAntiProtonsExtCov11Pass->SetStats(kFALSE);
1072   gDataAntiProtonsExtCov11Pass->Add(gDataAntiProtonsExtCov11Reject);
1073   gDataAntiProtonsExtCov11Pass->Sumw2();
1074   gDataAntiProtonsExtCov11Pass->Scale(1./gDataAntiProtonsExtCov11Pass->Integral(1,gDataAntiProtonsExtCov11Pass->GetNbinsX()));
1075   gDataAntiProtonsExtCov11Pass->SetMarkerStyle(1);
1076   TH1F *gDataAntiProtonsExtCov22Pass = dynamic_cast<TH1F *>(fQADataAntiProtonsAcceptedList->At(5));
1077   gDataAntiProtonsExtCov22Pass->SetStats(kFALSE);
1078   gDataAntiProtonsExtCov22Pass->Add(gDataAntiProtonsExtCov22Reject);
1079   gDataAntiProtonsExtCov22Pass->Sumw2();
1080   gDataAntiProtonsExtCov22Pass->Scale(1./gDataAntiProtonsExtCov22Pass->Integral(1,gDataAntiProtonsExtCov22Pass->GetNbinsX()));
1081   gDataAntiProtonsExtCov22Pass->SetMarkerStyle(1);
1082   TH1F *gDataAntiProtonsExtCov33Pass = dynamic_cast<TH1F *>(fQADataAntiProtonsAcceptedList->At(6));
1083   gDataAntiProtonsExtCov33Pass->SetStats(kFALSE);
1084   gDataAntiProtonsExtCov33Pass->Add(gDataAntiProtonsExtCov33Reject);
1085   gDataAntiProtonsExtCov33Pass->Sumw2();
1086   gDataAntiProtonsExtCov33Pass->Scale(1./gDataAntiProtonsExtCov33Pass->Integral(1,gDataAntiProtonsExtCov33Pass->GetNbinsX()));
1087   gDataAntiProtonsExtCov33Pass->SetMarkerStyle(1);
1088   TH1F *gDataAntiProtonsExtCov44Pass = dynamic_cast<TH1F *>(fQADataAntiProtonsAcceptedList->At(7));
1089   gDataAntiProtonsExtCov44Pass->SetStats(kFALSE);
1090   gDataAntiProtonsExtCov44Pass->Add(gDataAntiProtonsExtCov44Reject);
1091   gDataAntiProtonsExtCov44Pass->Sumw2();
1092   gDataAntiProtonsExtCov44Pass->Scale(1./gDataAntiProtonsExtCov44Pass->Integral(1,gDataAntiProtonsExtCov44Pass->GetNbinsX()));
1093   gDataAntiProtonsExtCov44Pass->SetMarkerStyle(1);
1094   TH1F *gDataAntiProtonsExtCov55Pass = dynamic_cast<TH1F *>(fQADataAntiProtonsAcceptedList->At(8));
1095   gDataAntiProtonsExtCov55Pass->SetStats(kFALSE);
1096   gDataAntiProtonsExtCov55Pass->Add(gDataAntiProtonsExtCov55Reject);
1097   gDataAntiProtonsExtCov55Pass->Sumw2();
1098   gDataAntiProtonsExtCov55Pass->Scale(1./gDataAntiProtonsExtCov55Pass->Integral(1,gDataAntiProtonsExtCov55Pass->GetNbinsX()));
1099   gDataAntiProtonsExtCov55Pass->SetMarkerStyle(1);
1100   TH1F *gDataAntiProtonsDCAXYPass = dynamic_cast<TH1F *>(fQADataAntiProtonsAcceptedList->At(11));
1101   gDataAntiProtonsDCAXYPass->SetStats(kFALSE);  
1102   gDataAntiProtonsDCAXYPass->Add(gDataAntiProtonsDCAXYReject);
1103   gDataAntiProtonsDCAXYPass->Sumw2();
1104   gDataAntiProtonsDCAXYPass->Scale(1./gDataAntiProtonsDCAXYPass->Integral(1,gDataAntiProtonsDCAXYPass->GetNbinsX()));
1105   gDataAntiProtonsDCAXYPass->SetMarkerStyle(1);
1106   TH1F *gDataAntiProtonsDCAZPass = dynamic_cast<TH1F *>(fQADataAntiProtonsAcceptedList->At(13));
1107   gDataAntiProtonsDCAZPass->SetStats(kFALSE);  
1108   gDataAntiProtonsDCAZPass->Add(gDataAntiProtonsDCAZReject);
1109   gDataAntiProtonsDCAZPass->Sumw2();
1110   gDataAntiProtonsDCAZPass->Scale(1./gDataAntiProtonsDCAZPass->Integral(1,gDataAntiProtonsDCAZPass->GetNbinsX()));
1111   gDataAntiProtonsDCAZPass->SetMarkerStyle(1);
1112   TH1F *gDataAntiProtonsNumberOfTPCdEdxPointsPass = dynamic_cast<TH1F *>(fQADataAntiProtonsAcceptedList->At(26));
1113   gDataAntiProtonsNumberOfTPCdEdxPointsPass->SetStats(kFALSE);  
1114   gDataAntiProtonsNumberOfTPCdEdxPointsPass->Add(gDataAntiProtonsNumberOfTPCdEdxPointsReject);
1115   gDataAntiProtonsNumberOfTPCdEdxPointsPass->Sumw2();
1116   gDataAntiProtonsNumberOfTPCdEdxPointsPass->Scale(1./gDataAntiProtonsNumberOfTPCdEdxPointsPass->Integral(1,gDataAntiProtonsNumberOfTPCdEdxPointsPass->GetNbinsX()));
1117   gDataAntiProtonsNumberOfTPCdEdxPointsPass->SetMarkerStyle(1);
1118
1119
1120   //__________________________________________________//
1121   TCanvas *c1 = new TCanvas("c1","ITS clusters",0,0,600,400);
1122   c1->SetFillColor(10); c1->SetHighLightColor(10);
1123   c1->Divide(2,1);
1124   c1->cd(1); gDataProtonsITSClustersPass->Divide(gMCProtonsITSClustersPass);
1125   gDataProtonsITSClustersPass->SetTitle("Protons");
1126   gDataProtonsITSClustersPass->GetYaxis()->SetTitle("Data/MC");
1127   gDataProtonsITSClustersPass->Draw("E"); 
1128   //gMCProtonsITSClustersPass->Draw("ESAME"); 
1129   c1->cd(2); 
1130   gDataAntiProtonsITSClustersPass->Divide(gMCAntiProtonsITSClustersPass);
1131   gDataAntiProtonsITSClustersPass->SetTitle("Antiprotons");
1132   gDataAntiProtonsITSClustersPass->GetYaxis()->SetTitle("Data/MC");
1133   gDataAntiProtonsITSClustersPass->Draw("E"); 
1134   //gMCAntiProtonsITSClustersPass->Draw("ESAME"); 
1135
1136   TCanvas *c3 = new TCanvas("c3","TPC clusters",0,200,600,400);
1137   c3->SetFillColor(10); c3->SetHighLightColor(10);
1138   c3->Divide(2,1);
1139   c3->cd(1); gDataProtonsTPCClustersPass->Divide(gMCProtonsTPCClustersPass);
1140   gDataProtonsTPCClustersPass->SetTitle("Protons");
1141   gDataProtonsTPCClustersPass->GetYaxis()->SetTitle("Data/MC");
1142   gDataProtonsTPCClustersPass->Draw("E");
1143   //gMCProtonsTPCClustersPass->Draw("ESAME");
1144   c3->cd(2); 
1145   gDataAntiProtonsTPCClustersPass->Divide(gMCAntiProtonsTPCClustersPass);
1146   gDataAntiProtonsTPCClustersPass->SetTitle("Antirotons");
1147   gDataAntiProtonsTPCClustersPass->GetYaxis()->SetTitle("Data/MC");
1148   gDataAntiProtonsTPCClustersPass->Draw("E");
1149   //gMCAntiProtonsTPCClustersPass->Draw("ESAME");
1150
1151   TCanvas *c4 = new TCanvas("c4","chi^2 per TPC cluster",0,300,600,400);
1152   c4->SetFillColor(10); c4->SetHighLightColor(10);
1153   c4->Divide(2,1);
1154   c4->cd(1); 
1155   gDataProtonsChi2PerClusterTPCPass->Divide(gMCProtonsChi2PerClusterTPCPass);
1156   gDataProtonsChi2PerClusterTPCPass->SetTitle("Protons");
1157   gDataProtonsChi2PerClusterTPCPass->GetYaxis()->SetTitle("Data/MC");
1158   gDataProtonsChi2PerClusterTPCPass->Draw("E"); 
1159   //gMCProtonsChi2PerClusterTPCPass->Draw("ESAME"); 
1160   c4->cd(2); 
1161   gDataAntiProtonsChi2PerClusterTPCPass->Divide(gMCAntiProtonsChi2PerClusterTPCPass);
1162   gDataAntiProtonsChi2PerClusterTPCPass->SetTitle("Antirotons");
1163   gDataAntiProtonsChi2PerClusterTPCPass->GetYaxis()->SetTitle("Data/MC");
1164   gDataAntiProtonsChi2PerClusterTPCPass->Draw("E"); 
1165   //gMCAntiProtonsChi2PerClusterTPCPass->Draw("ESAME"); 
1166
1167   if(gMCProtonsExtCov11Pass->GetEntries() != 0) {
1168     TCanvas *c5 = new TCanvas("c5","Cov11",0,400,600,400);
1169     c5->SetFillColor(10); c5->SetHighLightColor(10);
1170     c5->Divide(2,1);
1171     c5->cd(1); 
1172     gDataProtonsExtCov11Pass->Divide(gMCProtonsExtCov11Pass);
1173     gDataProtonsExtCov11Pass->SetTitle("Protons");
1174     gDataProtonsExtCov11Pass->GetYaxis()->SetTitle("Data/MC");
1175     gDataProtonsExtCov11Pass->Draw("E"); 
1176     //gMCProtonsExtCov11Pass->Draw("ESAME"); 
1177     c5->cd(2); 
1178     gDataAntiProtonsExtCov11Pass->Divide(gMCAntiProtonsExtCov11Pass);
1179     gDataAntiProtonsExtCov11Pass->SetTitle("Antiprotons");
1180     gDataAntiProtonsExtCov11Pass->GetYaxis()->SetTitle("Data/MC");
1181     gDataAntiProtonsExtCov11Pass->Draw("E"); 
1182     //gMCAntiProtonsExtCov11Pass->Draw("ESAME"); 
1183   }
1184
1185   if(gMCProtonsExtCov22Pass->GetEntries() != 0) {
1186     TCanvas *c6 = new TCanvas("c6","Cov22",0,500,600,400);
1187     c6->SetFillColor(10); c6->SetHighLightColor(10);
1188     c6->Divide(2,1);
1189     c6->cd(1); 
1190     gDataProtonsExtCov22Pass->Divide(gMCProtonsExtCov11Pass);
1191     gDataProtonsExtCov22Pass->SetTitle("Protons");
1192     gDataProtonsExtCov22Pass->GetYaxis()->SetTitle("Data/MC");
1193     gDataProtonsExtCov22Pass->Draw("E"); 
1194     //gMCProtonsExtCov22Pass->Draw("ESAME"); 
1195     c6->cd(2); 
1196     gDataAntiProtonsExtCov22Pass->Divide(gMCAntiProtonsExtCov22Pass);
1197     gDataAntiProtonsExtCov22Pass->SetTitle("Antiprotons");
1198     gDataAntiProtonsExtCov22Pass->GetYaxis()->SetTitle("Data/MC");
1199     gDataAntiProtonsExtCov22Pass->Draw("E"); 
1200     //gMCAntiProtonsExtCov22Pass->Draw("ESAME"); 
1201   }
1202
1203   if(gMCProtonsExtCov33Pass->GetEntries() != 0) {
1204     TCanvas *c7 = new TCanvas("c7","Cov33",600,0,600,400);
1205     c7->SetFillColor(10); c7->SetHighLightColor(10);
1206     c7->Divide(2,1);
1207     c7->cd(1); 
1208     gDataProtonsExtCov33Pass->Divide(gMCProtonsExtCov33Pass);
1209     gDataProtonsExtCov33Pass->SetTitle("Protons");
1210     gDataProtonsExtCov33Pass->GetYaxis()->SetTitle("Data/MC");
1211     gDataProtonsExtCov33Pass->Draw("E"); 
1212     //gMCProtonsExtCov33Pass->Draw("ESAME"); 
1213     c7->cd(2); 
1214     gDataAntiProtonsExtCov33Pass->Divide(gMCAntiProtonsExtCov33Pass);
1215     gDataAntiProtonsExtCov33Pass->SetTitle("Antiprotons");
1216     gDataAntiProtonsExtCov33Pass->GetYaxis()->SetTitle("Data/MC");
1217     gDataAntiProtonsExtCov33Pass->Draw("E"); 
1218     //gMCAntiProtonsExtCov33Pass->Draw("ESAME"); 
1219   }
1220
1221   if(gMCProtonsExtCov44Pass->GetEntries() != 0) {
1222     TCanvas *c8 = new TCanvas("c8","Cov44",600,100,600,400);
1223     c8->SetFillColor(10); c8->SetHighLightColor(10);
1224     c8->Divide(2,1);
1225     c8->cd(1); 
1226     gDataProtonsExtCov44Pass->Divide(gMCProtonsExtCov44Pass);
1227     gDataProtonsExtCov44Pass->SetTitle("Protons");
1228     gDataProtonsExtCov44Pass->GetYaxis()->SetTitle("Data/MC");
1229     gDataProtonsExtCov44Pass->Draw("E"); 
1230     //gMCProtonsExtCov44Pass->Draw("ESAME"); 
1231     c8->cd(2); 
1232     gDataAntiProtonsExtCov44Pass->Divide(gMCAntiProtonsExtCov44Pass);
1233     gDataAntiProtonsExtCov44Pass->SetTitle("Antiprotons");
1234     gDataAntiProtonsExtCov44Pass->GetYaxis()->SetTitle("Data/MC");
1235     gDataAntiProtonsExtCov44Pass->Draw("E"); 
1236     //gMCAntiProtonsExtCov44Pass->Draw("ESAME"); 
1237   }
1238
1239   if(gMCProtonsExtCov55Pass->GetEntries() != 0) {
1240     TCanvas *c9 = new TCanvas("c9","Cov55",600,200,600,400);
1241     c9->SetFillColor(10); c9->SetHighLightColor(10);
1242     c9->Divide(2,1);
1243     c9->cd(1); 
1244     gDataProtonsExtCov55Pass->Divide(gMCProtonsExtCov55Pass);
1245     gDataProtonsExtCov55Pass->SetTitle("Protons");
1246     gDataProtonsExtCov55Pass->GetYaxis()->SetTitle("Data/MC");
1247     gDataProtonsExtCov55Pass->Draw("E"); 
1248     //gMCProtonsExtCov55Pass->Draw("ESAME"); 
1249     c9->cd(2); 
1250     gDataAntiProtonsExtCov55Pass->Divide(gMCAntiProtonsExtCov55Pass);
1251     gDataAntiProtonsExtCov55Pass->SetTitle("Antiprotons");
1252     gDataAntiProtonsExtCov55Pass->GetYaxis()->SetTitle("Data/MC");
1253     gDataAntiProtonsExtCov55Pass->Draw("E"); 
1254     //gMCAntiProtonsExtCov55Pass->Draw("ESAME"); 
1255   }
1256
1257   if(gMCProtonsDCAXYPass->GetEntries() != 0) {
1258     TCanvas *c12 = new TCanvas("c12","dca(xy)",600,500,600,400);
1259     c12->SetFillColor(10); c12->SetHighLightColor(10);
1260     c12->Divide(2,1);
1261     c12->cd(1); 
1262     gDataProtonsDCAXYPass->Divide(gMCProtonsDCAXYPass);
1263     gDataProtonsDCAXYPass->SetTitle("Protons");
1264     gDataProtonsDCAXYPass->GetYaxis()->SetTitle("Data/MC");
1265     gDataProtonsDCAXYPass->Draw("E"); 
1266     //gMCProtonsDCAXYPass->Draw("ESAME"); 
1267     c12->cd(2); 
1268     gDataAntiProtonsDCAXYPass->Divide(gMCAntiProtonsDCAXYPass);
1269     gDataAntiProtonsDCAXYPass->SetTitle("Antiprotons");
1270     gDataAntiProtonsDCAXYPass->GetYaxis()->SetTitle("Data/MC");
1271     gDataAntiProtonsDCAXYPass->Draw("E"); 
1272     //gMCAntiProtonsDCAXYPass->Draw("ESAME"); 
1273   }
1274
1275   if(gMCProtonsDCAZPass->GetEntries() != 0) {
1276     TCanvas *c14 = new TCanvas("c14","dca(z)",1200,100,600,400);
1277     c14->SetFillColor(10); c14->SetHighLightColor(10);
1278     c14->Divide(2,1);
1279     c14->cd(1); 
1280     gDataProtonsDCAZPass->Divide(gMCProtonsDCAZPass);
1281     gDataProtonsDCAZPass->SetTitle("Protons");
1282     gDataProtonsDCAZPass->GetYaxis()->SetTitle("Data/MC");
1283     gDataProtonsDCAZPass->Draw("E"); 
1284     //gMCProtonsDCAZPass->Draw("ESAME"); 
1285     c14->cd(2); 
1286     gDataAntiProtonsDCAZPass->Divide(gMCAntiProtonsDCAZPass);
1287     gDataAntiProtonsDCAZPass->SetTitle("Antiprotons");
1288     gDataAntiProtonsDCAZPass->GetYaxis()->SetTitle("Data/MC");
1289     gDataAntiProtonsDCAZPass->Draw("E"); 
1290     //gMCAntiProtonsDCAZPass->Draw("ESAME"); 
1291   }
1292
1293   TCanvas *c16 = new TCanvas("c16","TPC clusters (dE/dx)",1200,300,600,400);
1294   c16->SetFillColor(10); c16->SetHighLightColor(10);
1295   c16->Divide(2,1);
1296   c16->cd(1); 
1297   gDataProtonsNumberOfTPCdEdxPointsPass->Divide(gMCProtonsNumberOfTPCdEdxPointsPass);
1298   gDataProtonsNumberOfTPCdEdxPointsPass->SetTitle("Protons");
1299   gDataProtonsNumberOfTPCdEdxPointsPass->GetYaxis()->SetTitle("Data/MC");
1300   gDataProtonsNumberOfTPCdEdxPointsPass->Draw("E"); 
1301   //gMCProtonsNumberOfTPCdEdxPointsPass->Draw("ESAME"); 
1302   c16->cd(2); 
1303   gDataAntiProtonsNumberOfTPCdEdxPointsPass->Divide(gMCAntiProtonsNumberOfTPCdEdxPointsPass);
1304   gDataAntiProtonsNumberOfTPCdEdxPointsPass->SetTitle("Antiprotons");
1305   gDataAntiProtonsNumberOfTPCdEdxPointsPass->GetYaxis()->SetTitle("Data/MC");
1306   gDataAntiProtonsNumberOfTPCdEdxPointsPass->Draw("E"); 
1307   //gMCAntiProtonsNumberOfTPCdEdxPointsPass->Draw("ESAME"); 
1308 }
1309