]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/SPECTRA/AliProtonAnalysis.cxx
added ration ITS global/TPC
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / AliProtonAnalysis.cxx
1 /**************************************************************************
2  * Author: Panos Christakoglou.                                           *
3  * Contributors are mentioned in the code where appropriate.              *
4  *                                                                        *
5  * Permission to use, copy, modify and distribute this software and its   *
6  * documentation strictly for non-commercial purposes is hereby granted   *
7  * without fee, provided that the above copyright notice appears in all   *
8  * copies and that both the copyright notice and this permission notice   *
9  * appear in the supporting documentation. The authors make no claims     *
10  * about the suitability of this software for any purpose. It is          *
11  * provided "as is" without express or implied warranty.                  *
12  **************************************************************************/
13
14 /* $Id$ */
15
16 //-----------------------------------------------------------------
17 //                 AliProtonAnalysis class
18 //   This is the class to deal with the proton analysis
19 //   Origin: Panos Christakoglou | Panos.Christakoglou@cern.ch
20 //-----------------------------------------------------------------
21 #include <Riostream.h>
22 #include <TFile.h>
23 #include <TSystem.h>
24 #include <TF1.h>
25 #include <TH3F.h>
26 #include <TH2D.h>
27 #include <TH1D.h>
28 #include <TH1I.h>
29 #include <TParticle.h>
30 #include <TList.h>
31
32 #include <AliExternalTrackParam.h>
33 #include <AliAODEvent.h>
34 #include <AliESDEvent.h>
35 //#include <AliLog.h>
36 #include <AliPID.h>
37 #include <AliStack.h>
38 #include <AliCFContainer.h>
39 #include <AliCFEffGrid.h>
40 #include <AliCFDataGrid.h>
41 #include <AliTPCPIDResponse.h>
42 #include <AliESDpid.h>
43 class AliLog;
44 class AliESDVertex;
45
46 #include "AliProtonAnalysis.h"
47 #include "AliProtonAnalysisBase.h"
48
49 ClassImp(AliProtonAnalysis)
50
51 //____________________________________________________________________//
52 AliProtonAnalysis::AliProtonAnalysis() : 
53   TObject(), fProtonAnalysisBase(0),
54   fNBinsY(0), fMinY(0), fMaxY(0),
55   fNBinsPt(0), fMinPt(0), fMaxPt(0),
56   fProtonContainer(0), fAntiProtonContainer(0),
57   fHistEvents(0), fHistYPtProtons(0), fHistYPtAntiProtons(0),
58   fHistYPtProtonsCorrected(0), fHistYPtAntiProtonsCorrected(0), 
59   fHistEventStats(0), fYRatioInPtBinsList(0),
60   fEffGridListProtons(0), fCorrectionListProtons2D(0), 
61   fEfficiencyListProtons1D(0), fCorrectionListProtons1D(0),
62   fEffGridListAntiProtons(0), fCorrectionListAntiProtons2D(0), 
63   fEfficiencyListAntiProtons1D(0), fCorrectionListAntiProtons1D(0),
64   fCorrectProtons(0), fCorrectAntiProtons(0),
65   fHistEfficiencyYPtProtons(0), fHistEfficiencyYPtAntiProtons(0),
66   fHistCorrectionForCrossSectionYPtProtons(0),
67   fHistCorrectionForCrossSectionYPtAntiProtons(0),
68   fHistCorrectionForCrossSectionFlag(kFALSE),
69   fHistYPtCorrectionForCutsProtons(0), fHistYPtCorrectionForCutsAntiProtons(0),
70   fCorrectForCutsFlag(kFALSE),
71   fHistYPtCorrectionForTrackingProtons(0), 
72   fHistYPtCorrectionForTrackingAntiProtons(0),
73   fCorrectForTrackingFlag(kFALSE),
74   fHistYPtCorrectionForFeedDownProtons(0), 
75   fHistYPtCorrectionForFeedDownAntiProtons(0),
76   fCorrectForFeedDownFlag(kFALSE),
77   fHistYPtCorrectionForSecondaries(0), fCorrectForSecondariesFlag(kFALSE),
78   fGlobalQAList(0), fQA2DList(0),
79   fQAProtonsAcceptedList(0), fQAProtonsRejectedList(0),
80   fQAAntiProtonsAcceptedList(0), fQAAntiProtonsRejectedList(0) {
81   //Default constructor
82 }
83
84 //____________________________________________________________________//
85 AliProtonAnalysis::AliProtonAnalysis(Int_t nbinsY, 
86                                      Float_t fLowY, Float_t fHighY,
87                                      Int_t nbinsPt, 
88                                      Float_t fLowPt, Float_t fHighPt) : 
89   TObject(), fProtonAnalysisBase(0),
90   fNBinsY(nbinsY), fMinY(fLowY), fMaxY(fHighY),
91   fNBinsPt(nbinsPt), fMinPt(fLowPt), fMaxPt(fHighPt),
92   fProtonContainer(0), fAntiProtonContainer(0),
93   fHistEvents(0), fHistYPtProtons(0), fHistYPtAntiProtons(0), 
94   fHistYPtProtonsCorrected(0), fHistYPtAntiProtonsCorrected(0), 
95   fHistEventStats(0), fYRatioInPtBinsList(0),
96   fEffGridListProtons(0), fCorrectionListProtons2D(0), 
97   fEfficiencyListProtons1D(0), fCorrectionListProtons1D(0),
98   fEffGridListAntiProtons(0), fCorrectionListAntiProtons2D(0), 
99   fEfficiencyListAntiProtons1D(0), fCorrectionListAntiProtons1D(0),
100   fCorrectProtons(0), fCorrectAntiProtons(0),
101   fHistEfficiencyYPtProtons(0), fHistEfficiencyYPtAntiProtons(0),
102   fHistCorrectionForCrossSectionYPtProtons(0),
103   fHistCorrectionForCrossSectionYPtAntiProtons(0),
104   fHistCorrectionForCrossSectionFlag(kFALSE),
105   fHistYPtCorrectionForCutsProtons(0), fHistYPtCorrectionForCutsAntiProtons(0),
106   fCorrectForCutsFlag(kFALSE),
107   fHistYPtCorrectionForTrackingProtons(0), 
108   fHistYPtCorrectionForTrackingAntiProtons(0),
109   fCorrectForTrackingFlag(kFALSE),
110   fHistYPtCorrectionForFeedDownProtons(0), 
111   fHistYPtCorrectionForFeedDownAntiProtons(0),
112   fCorrectForFeedDownFlag(kFALSE),
113   fHistYPtCorrectionForSecondaries(0), fCorrectForSecondariesFlag(kFALSE),
114   fGlobalQAList(0), fQA2DList(0),
115   fQAProtonsAcceptedList(0), fQAProtonsRejectedList(0),
116   fQAAntiProtonsAcceptedList(0), fQAAntiProtonsRejectedList(0) {
117   //Default constructor
118   fHistEvents = new TH1I("fHistEvents","Analyzed events",2,0.5,2.5);
119   fHistEvents->GetXaxis()->SetBinLabel(1,"Analyzed events");
120   fHistEvents->GetXaxis()->SetBinLabel(2,"Events with (anti)protons");
121
122   fHistYPtProtons = new TH2D("fHistYPtProtons","Protons",
123                              fNBinsY,fMinY,fMaxY,
124                              fNBinsPt,fMinPt,fMaxPt);
125   fHistYPtProtons->SetStats(kTRUE);
126   fHistYPtProtons->GetYaxis()->SetTitle("P_{T} [GeV/c]");
127   if(fProtonAnalysisBase->GetEtaMode())
128     fHistYPtProtons->GetXaxis()->SetTitle("#eta");
129   else
130     fHistYPtProtons->GetXaxis()->SetTitle("y");
131   fHistYPtProtons->GetXaxis()->SetTitleColor(1);
132
133   fHistYPtAntiProtons = new TH2D("fHistYPtAntiProtons","Antiprotons",
134                                  fNBinsY,fMinY,fMaxY,
135                                  fNBinsPt,fMinPt,fMaxPt);
136   fHistYPtAntiProtons->SetStats(kTRUE);
137   fHistYPtAntiProtons->GetYaxis()->SetTitle("P_{T} [GeV/c]");
138   if(fProtonAnalysisBase->GetEtaMode())
139     fHistYPtAntiProtons->GetXaxis()->SetTitle("#eta");
140   else
141     fHistYPtAntiProtons->GetXaxis()->SetTitle("y");
142   fHistYPtAntiProtons->GetXaxis()->SetTitleColor(1);
143
144   fHistYPtProtonsCorrected = new TH2D("fHistYPtProtonsCorrected","Protons",
145                                       fNBinsY,fMinY,fMaxY,
146                                       fNBinsPt,fMinPt,fMaxPt);
147   fHistYPtProtonsCorrected->SetStats(kTRUE);
148   fHistYPtProtonsCorrected->GetYaxis()->SetTitle("P_{T} [GeV/c]");
149   if(fProtonAnalysisBase->GetEtaMode())
150     fHistYPtProtonsCorrected->GetXaxis()->SetTitle("#eta");
151   else
152     fHistYPtProtonsCorrected->GetXaxis()->SetTitle("y");
153   fHistYPtProtonsCorrected->GetXaxis()->SetTitleColor(1);
154
155   fHistYPtAntiProtonsCorrected = new TH2D("fHistYPtAntiProtonsCorrected",
156                                           "Antiprotons",
157                                           fNBinsY,fMinY,fMaxY,
158                                           fNBinsPt,fMinPt,fMaxPt);
159   fHistYPtAntiProtonsCorrected->SetStats(kTRUE);
160   fHistYPtAntiProtonsCorrected->GetYaxis()->SetTitle("P_{T} [GeV/c]");
161   if(fProtonAnalysisBase->GetEtaMode())
162     fHistYPtAntiProtonsCorrected->GetXaxis()->SetTitle("#eta");
163   else
164     fHistYPtAntiProtonsCorrected->GetXaxis()->SetTitle("y");
165   fHistYPtAntiProtonsCorrected->GetXaxis()->SetTitleColor(1);
166
167   //setting up the containers
168   Int_t iBin[2];
169   iBin[0] = nbinsY;
170   iBin[1] = nbinsPt;
171   Double_t *binLimY = new Double_t[nbinsY+1];
172   Double_t *binLimPt = new Double_t[nbinsPt+1];
173   //values for bin lower bounds
174   for(Int_t i = 0; i <= nbinsY; i++) 
175     binLimY[i]=(Double_t)fLowY  + (fHighY - fLowY)  /nbinsY*(Double_t)i;
176   for(Int_t i = 0; i <= nbinsPt; i++) 
177     binLimPt[i]=(Double_t)fLowPt  + (fHighPt - fLowPt)  /nbinsPt*(Double_t)i;
178
179   fProtonContainer = new AliCFContainer("containerProtons",
180                                         "container for protons",
181                                         kNSteps,2,iBin);
182   fProtonContainer->SetBinLimits(0,binLimY); //rapidity or eta
183   fProtonContainer->SetBinLimits(1,binLimPt); //pT
184   fAntiProtonContainer = new AliCFContainer("containerAntiProtons",
185                                             "container for antiprotons",
186                                             kNSteps,2,iBin);
187   fAntiProtonContainer->SetBinLimits(0,binLimY); //rapidity or eta
188   fAntiProtonContainer->SetBinLimits(1,binLimPt); //pT
189
190   //Initialize the QA
191   if(fProtonAnalysisBase->IsQARun()) InitQA();
192
193
194 //____________________________________________________________________//
195 AliProtonAnalysis::AliProtonAnalysis(Int_t nbinsY, Double_t *gY,
196                                      Int_t nbinsPt,Double_t *gPt) : 
197   TObject(), fProtonAnalysisBase(0),
198   fNBinsY(nbinsY), fMinY(gY[0]), fMaxY(gY[nbinsY]),
199   fNBinsPt(nbinsPt), fMinPt(gPt[0]), fMaxPt(gPt[nbinsPt]),
200   fProtonContainer(0), fAntiProtonContainer(0),
201   fHistEvents(0), fHistYPtProtons(0), fHistYPtAntiProtons(0), 
202   fHistYPtProtonsCorrected(0), fHistYPtAntiProtonsCorrected(0), 
203   fHistEventStats(0), fYRatioInPtBinsList(0),
204   fEffGridListProtons(0), fCorrectionListProtons2D(0), 
205   fEfficiencyListProtons1D(0), fCorrectionListProtons1D(0),
206   fEffGridListAntiProtons(0), fCorrectionListAntiProtons2D(0), 
207   fEfficiencyListAntiProtons1D(0), fCorrectionListAntiProtons1D(0),
208   fCorrectProtons(0), fCorrectAntiProtons(0),
209   fHistEfficiencyYPtProtons(0), fHistEfficiencyYPtAntiProtons(0),
210   fHistCorrectionForCrossSectionYPtProtons(0),
211   fHistCorrectionForCrossSectionYPtAntiProtons(0),
212   fHistCorrectionForCrossSectionFlag(kFALSE),
213   fHistYPtCorrectionForCutsProtons(0), fHistYPtCorrectionForCutsAntiProtons(0),
214   fCorrectForCutsFlag(kFALSE),
215   fHistYPtCorrectionForTrackingProtons(0), 
216   fHistYPtCorrectionForTrackingAntiProtons(0),
217   fCorrectForTrackingFlag(kFALSE),
218   fHistYPtCorrectionForFeedDownProtons(0), 
219   fHistYPtCorrectionForFeedDownAntiProtons(0),
220   fCorrectForFeedDownFlag(kFALSE),
221   fHistYPtCorrectionForSecondaries(0), fCorrectForSecondariesFlag(kFALSE),
222   fGlobalQAList(0), fQA2DList(0),
223   fQAProtonsAcceptedList(0), fQAProtonsRejectedList(0),
224   fQAAntiProtonsAcceptedList(0), fQAAntiProtonsRejectedList(0) {
225   //Default constructor
226   fHistEvents = new TH1I("fHistEvents","Analyzed events",2,0.5,2.5);
227   fHistEvents->GetXaxis()->SetBinLabel(1,"Analyzed events");
228   fHistEvents->GetXaxis()->SetBinLabel(2,"Events with (anti)protons");
229
230   fHistYPtProtons = new TH2D("fHistYPtProtons","Protons",
231                              fNBinsY,gY,fNBinsPt,gPt);
232   fHistYPtProtons->SetStats(kTRUE);
233   fHistYPtProtons->GetYaxis()->SetTitle("P_{T} [GeV/c]");
234   if(fProtonAnalysisBase->GetEtaMode())
235     fHistYPtProtons->GetXaxis()->SetTitle("#eta");
236   else
237     fHistYPtProtons->GetXaxis()->SetTitle("y");
238   fHistYPtProtons->GetXaxis()->SetTitleColor(1);
239
240   fHistYPtAntiProtons = new TH2D("fHistYPtAntiProtons","Antiprotons",
241                                  fNBinsY,gY,fNBinsPt,gPt);
242   fHistYPtAntiProtons->SetStats(kTRUE);
243   fHistYPtAntiProtons->GetYaxis()->SetTitle("P_{T} [GeV/c]");
244   if(fProtonAnalysisBase->GetEtaMode())
245     fHistYPtAntiProtons->GetXaxis()->SetTitle("#eta");
246   else
247     fHistYPtAntiProtons->GetXaxis()->SetTitle("y");
248   fHistYPtAntiProtons->GetXaxis()->SetTitleColor(1);
249
250   fHistYPtProtonsCorrected = new TH2D("fHistYPtProtonsCorrected","Protons",
251                                       fNBinsY,fMinY,fMaxY,
252                                       fNBinsPt,fMinPt,fMaxPt);
253   fHistYPtProtonsCorrected->SetStats(kTRUE);
254   fHistYPtProtonsCorrected->GetYaxis()->SetTitle("P_{T} [GeV/c]");
255   if(fProtonAnalysisBase->GetEtaMode())
256     fHistYPtProtonsCorrected->GetXaxis()->SetTitle("#eta");
257   else
258     fHistYPtProtonsCorrected->GetXaxis()->SetTitle("y");
259   fHistYPtProtonsCorrected->GetXaxis()->SetTitleColor(1);
260
261   fHistYPtAntiProtonsCorrected = new TH2D("fHistYPtAntiProtonsCorrected",
262                                           "Antiprotons",
263                                           fNBinsY,fMinY,fMaxY,
264                                           fNBinsPt,fMinPt,fMaxPt);
265   fHistYPtAntiProtonsCorrected->SetStats(kTRUE);
266   fHistYPtAntiProtonsCorrected->GetYaxis()->SetTitle("P_{T} [GeV/c]");
267   if(fProtonAnalysisBase->GetEtaMode())
268     fHistYPtAntiProtonsCorrected->GetXaxis()->SetTitle("#eta");
269   else
270     fHistYPtAntiProtonsCorrected->GetXaxis()->SetTitle("y");
271   fHistYPtAntiProtonsCorrected->GetXaxis()->SetTitleColor(1);
272
273   //setting up the containers
274   Int_t iBin[2];
275   iBin[0] = nbinsY;
276   iBin[1] = nbinsPt;
277   fProtonContainer = new AliCFContainer("containerProtons",
278                                         "container for protons",
279                                         kNSteps,2,iBin);
280   fProtonContainer->SetBinLimits(0,gY); //rapidity or eta
281   fProtonContainer->SetBinLimits(1,gPt); //pT
282   fAntiProtonContainer = new AliCFContainer("containerAntiProtons",
283                                             "container for antiprotons",
284                                             kNSteps,2,iBin);
285   fAntiProtonContainer->SetBinLimits(0,gY); //rapidity or eta
286   fAntiProtonContainer->SetBinLimits(1,gPt); //pT
287
288   //Initialize the QA
289   if(fProtonAnalysisBase->IsQARun()) InitQA();
290
291
292 //____________________________________________________________________//
293 AliProtonAnalysis::~AliProtonAnalysis() {
294   //Default destructor
295   if(fProtonAnalysisBase) delete fProtonAnalysisBase;
296
297   if(fHistEvents) delete fHistEvents;
298   if(fHistYPtProtons) delete fHistYPtProtons;
299   if(fHistYPtAntiProtons) delete fHistYPtAntiProtons;
300   if(fHistYPtProtonsCorrected) delete fHistYPtProtonsCorrected;
301   if(fHistYPtAntiProtonsCorrected) delete fHistYPtAntiProtonsCorrected;
302   if(fHistEventStats) delete fHistEventStats;
303   if(fYRatioInPtBinsList) delete fYRatioInPtBinsList;
304
305   if(fProtonContainer) delete fProtonContainer;
306   if(fAntiProtonContainer) delete fAntiProtonContainer;
307
308   if(fEffGridListProtons) delete fEffGridListProtons;
309   if(fCorrectionListProtons2D) delete fCorrectionListProtons2D;
310   if(fEfficiencyListProtons1D) delete fEfficiencyListProtons1D;
311   if(fCorrectionListProtons1D) delete fCorrectionListProtons1D;
312   if(fEffGridListAntiProtons) delete fEffGridListAntiProtons;
313   if(fCorrectionListAntiProtons2D) delete fCorrectionListAntiProtons2D;
314   if(fEfficiencyListAntiProtons1D) delete fEfficiencyListAntiProtons1D;
315   if(fCorrectionListAntiProtons1D) delete fCorrectionListAntiProtons1D;
316   if(fCorrectProtons) delete fCorrectProtons;
317   if(fCorrectAntiProtons) delete fCorrectAntiProtons;
318   if(fHistEfficiencyYPtProtons) delete fHistEfficiencyYPtProtons;
319   if(fHistEfficiencyYPtAntiProtons) delete fHistEfficiencyYPtAntiProtons;
320   if(fHistCorrectionForCrossSectionYPtProtons) delete fHistCorrectionForCrossSectionYPtProtons;
321   if(fHistCorrectionForCrossSectionYPtAntiProtons) delete fHistCorrectionForCrossSectionYPtAntiProtons;
322   if(fHistYPtCorrectionForCutsProtons) delete fHistYPtCorrectionForCutsProtons;
323   if(fHistYPtCorrectionForCutsAntiProtons) delete fHistYPtCorrectionForCutsAntiProtons;
324   if(fHistYPtCorrectionForTrackingProtons) delete fHistYPtCorrectionForTrackingProtons;
325   if(fHistYPtCorrectionForTrackingAntiProtons) delete fHistYPtCorrectionForTrackingAntiProtons;
326   if(fHistYPtCorrectionForFeedDownProtons) delete fHistYPtCorrectionForFeedDownProtons;
327   if(fHistYPtCorrectionForFeedDownAntiProtons) delete fHistYPtCorrectionForFeedDownAntiProtons;
328   if(fHistYPtCorrectionForSecondaries) delete fHistYPtCorrectionForSecondaries;
329
330   //QA lists
331   if(fGlobalQAList) delete fGlobalQAList;
332   if(fQA2DList) delete fQA2DList;
333   if(fQAProtonsAcceptedList) delete fQAProtonsAcceptedList; 
334   if(fQAProtonsRejectedList) delete fQAProtonsRejectedList;
335   if(fQAAntiProtonsAcceptedList) delete fQAAntiProtonsAcceptedList; 
336   if(fQAAntiProtonsRejectedList) delete fQAAntiProtonsRejectedList;
337 }
338
339 //____________________________________________________________________//
340 void AliProtonAnalysis::InitAnalysisHistograms(Int_t nbinsY, 
341                                                Float_t fLowY, Float_t fHighY, 
342                                                Int_t nbinsPt, 
343                                                Float_t fLowPt, Float_t fHighPt) {
344   //Initializes the histograms
345   fNBinsY = nbinsY;
346   fMinY = fLowY;
347   fMaxY = fHighY;
348   fNBinsPt = nbinsPt;
349   fMinPt = fLowPt;
350   fMaxPt = fHighPt;
351
352   fHistEvents = new TH1I("fHistEvents","Analyzed events",2,0.5,2.5);
353   fHistEvents->GetXaxis()->SetBinLabel(1,"Analyzed events");
354   fHistEvents->GetXaxis()->SetBinLabel(2,"Events with (anti)protons");
355
356   fHistYPtProtons = new TH2D("fHistYPtProtons","Protons",
357                              fNBinsY,fMinY,fMaxY,
358                              fNBinsPt,fMinPt,fMaxPt);
359   fHistYPtProtons->SetStats(kTRUE);
360   fHistYPtProtons->GetYaxis()->SetTitle("P_{T} [GeV/c]");
361   if(fProtonAnalysisBase->GetEtaMode())
362     fHistYPtProtons->GetXaxis()->SetTitle("#eta");
363   else
364     fHistYPtProtons->GetXaxis()->SetTitle("y");
365   fHistYPtProtons->GetXaxis()->SetTitleColor(1);
366
367   fHistYPtAntiProtons = new TH2D("fHistYPtAntiProtons","Antiprotons",
368                                  fNBinsY,fMinY,fMaxY,
369                                  fNBinsPt,fMinPt,fMaxPt);
370   fHistYPtAntiProtons->SetStats(kTRUE);
371   fHistYPtAntiProtons->GetYaxis()->SetTitle("P_{T} [GeV/c]");
372   if(fProtonAnalysisBase->GetEtaMode())
373     fHistYPtAntiProtons->GetXaxis()->SetTitle("#eta");
374   else
375     fHistYPtAntiProtons->GetXaxis()->SetTitle("y");
376   fHistYPtAntiProtons->GetXaxis()->SetTitleColor(1);
377
378   fHistYPtProtonsCorrected = new TH2D("fHistYPtProtonsCorrected","Protons",
379                                       fNBinsY,fMinY,fMaxY,
380                                       fNBinsPt,fMinPt,fMaxPt);
381   fHistYPtProtonsCorrected->SetStats(kTRUE);
382   fHistYPtProtonsCorrected->GetYaxis()->SetTitle("P_{T} [GeV/c]");
383   if(fProtonAnalysisBase->GetEtaMode())
384     fHistYPtProtonsCorrected->GetXaxis()->SetTitle("#eta");
385   else
386     fHistYPtProtonsCorrected->GetXaxis()->SetTitle("y");
387   fHistYPtProtonsCorrected->GetXaxis()->SetTitleColor(1);
388
389   fHistYPtAntiProtonsCorrected = new TH2D("fHistYPtAntiProtonsCorrected",
390                                           "Antiprotons",
391                                           fNBinsY,fMinY,fMaxY,
392                                           fNBinsPt,fMinPt,fMaxPt);
393   fHistYPtAntiProtonsCorrected->SetStats(kTRUE);
394   fHistYPtAntiProtonsCorrected->GetYaxis()->SetTitle("P_{T} [GeV/c]");
395   if(fProtonAnalysisBase->GetEtaMode())
396     fHistYPtAntiProtonsCorrected->GetXaxis()->SetTitle("#eta");
397   else
398     fHistYPtAntiProtonsCorrected->GetXaxis()->SetTitle("y");
399   fHistYPtAntiProtonsCorrected->GetXaxis()->SetTitleColor(1);
400
401   //setting up the containers
402   Int_t iBin[2];
403   iBin[0] = nbinsY;
404   iBin[1] = nbinsPt;
405   Double_t *binLimY = new Double_t[nbinsY+1];
406   Double_t *binLimPt = new Double_t[nbinsPt+1];
407   //values for bin lower bounds
408   for(Int_t i = 0; i <= nbinsY; i++) 
409     binLimY[i]=(Double_t)fLowY  + (fHighY - fLowY)  /nbinsY*(Double_t)i;
410   for(Int_t i = 0; i <= nbinsPt; i++) 
411     binLimPt[i]=(Double_t)fLowPt  + (fHighPt - fLowPt)  /nbinsPt*(Double_t)i;
412
413   fProtonContainer = new AliCFContainer("containerProtons",
414                                         "container for protons",
415                                         kNSteps,2,iBin);
416   fProtonContainer->SetBinLimits(0,binLimY); //rapidity
417   fProtonContainer->SetBinLimits(1,binLimPt); //pT
418   fAntiProtonContainer = new AliCFContainer("containerAntiProtons",
419                                             "container for antiprotons",
420                                             kNSteps,2,iBin);
421   fAntiProtonContainer->SetBinLimits(0,binLimY); //rapidity
422   fAntiProtonContainer->SetBinLimits(1,binLimPt); //pT
423
424   delete [] binLimY;
425   delete [] binLimPt;
426
427   //Initialize the QA
428   if(fProtonAnalysisBase->IsQARun()) InitQA();
429 }
430
431 //____________________________________________________________________//
432 void AliProtonAnalysis::InitAnalysisHistograms(Int_t nbinsY, Double_t *gY, 
433                                                Int_t nbinsPt, Double_t *gPt) {
434   //Initializes the histograms using asymmetric values - global tracking
435   fNBinsY = nbinsY;
436   fMinY = gY[0];
437   fMaxY = gY[nbinsY];
438   fNBinsPt = nbinsPt;
439   fMinPt = gPt[0];
440   fMaxPt = gPt[nbinsPt];
441
442   fHistEvents = new TH1I("fHistEvents","Analyzed events",2,0.5,2.5);
443   fHistEvents->GetXaxis()->SetBinLabel(1,"Analyzed events");
444   fHistEvents->GetXaxis()->SetBinLabel(2,"Events with (anti)protons");
445
446   fHistYPtProtons = new TH2D("fHistYPtProtons","Protons",
447                              fNBinsY,gY,fNBinsPt,gPt);
448   fHistYPtProtons->SetStats(kTRUE);
449   fHistYPtProtons->GetYaxis()->SetTitle("P_{T} [GeV/c]");
450   if(fProtonAnalysisBase->GetEtaMode())
451     fHistYPtProtons->GetXaxis()->SetTitle("#eta");
452   else
453     fHistYPtProtons->GetXaxis()->SetTitle("y");
454   fHistYPtProtons->GetXaxis()->SetTitleColor(1);
455
456   fHistYPtAntiProtons = new TH2D("fHistYPtAntiProtons","Antiprotons",
457                                  fNBinsY,gY,fNBinsPt,gPt);
458   fHistYPtAntiProtons->SetStats(kTRUE);
459   fHistYPtAntiProtons->GetYaxis()->SetTitle("P_{T} [GeV/c]");
460   if(fProtonAnalysisBase->GetEtaMode())
461     fHistYPtAntiProtons->GetXaxis()->SetTitle("#eta");
462   else
463     fHistYPtAntiProtons->GetXaxis()->SetTitle("y");
464   fHistYPtAntiProtons->GetXaxis()->SetTitleColor(1);
465
466   fHistYPtProtonsCorrected = new TH2D("fHistYPtProtonsCorrected","Protons",
467                                       fNBinsY,gY,fNBinsPt,gPt);
468   fHistYPtProtonsCorrected->SetStats(kTRUE);
469   fHistYPtProtonsCorrected->GetYaxis()->SetTitle("P_{T} [GeV/c]");
470   if(fProtonAnalysisBase->GetEtaMode())
471     fHistYPtProtonsCorrected->GetXaxis()->SetTitle("#eta");
472   else
473     fHistYPtProtonsCorrected->GetXaxis()->SetTitle("y");
474   fHistYPtProtonsCorrected->GetXaxis()->SetTitleColor(1);
475
476   fHistYPtAntiProtonsCorrected = new TH2D("fHistYPtAntiProtonsCorrected",
477                                           "Antiprotons",
478                                           fNBinsY,gY,fNBinsPt,gPt);
479   fHistYPtAntiProtonsCorrected->SetStats(kTRUE);
480   fHistYPtAntiProtonsCorrected->GetYaxis()->SetTitle("P_{T} [GeV/c]");
481   if(fProtonAnalysisBase->GetEtaMode())
482     fHistYPtAntiProtonsCorrected->GetXaxis()->SetTitle("#eta");
483   else
484     fHistYPtAntiProtonsCorrected->GetXaxis()->SetTitle("y");
485   fHistYPtAntiProtonsCorrected->GetXaxis()->SetTitleColor(1);
486
487   //setting up the containers
488   Int_t iBin[2];
489   iBin[0] = nbinsY;
490   iBin[1] = nbinsPt;
491
492   fProtonContainer = new AliCFContainer("containerProtons",
493                                         "container for protons",
494                                         kNSteps,2,iBin);
495   fProtonContainer->SetBinLimits(0,gY); //rapidity
496   fProtonContainer->SetBinLimits(1,gPt); //pT
497   fAntiProtonContainer = new AliCFContainer("containerAntiProtons",
498                                             "container for antiprotons",
499                                             kNSteps,2,iBin);
500   fAntiProtonContainer->SetBinLimits(0,gY); //rapidity
501   fAntiProtonContainer->SetBinLimits(1,gPt); //pT
502
503   //Initialize the QA
504   if(fProtonAnalysisBase->IsQARun()) InitQA();
505 }
506
507 //____________________________________________________________________//
508 Bool_t AliProtonAnalysis::ReadFromFile(const char* filename) {
509   //Read the containers from the existing file
510   Bool_t status = kTRUE;
511
512   TFile *file = TFile::Open(filename);
513   if(!file) {
514     cout<<"Could not find the input file "<<filename<<endl;
515     status = kFALSE;
516   }
517
518   TList *list = (TList *)file->Get("outputList");
519   if(list) {
520     cout<<"Retrieving objects from the list "<<list->GetName()<<"..."<<endl; 
521     fHistYPtProtons = (TH2D *)list->At(0);
522     fHistYPtAntiProtons = (TH2D *)list->At(1);
523     fHistEvents = (TH1I *)list->At(2);
524     fProtonContainer = (AliCFContainer *)list->At(3);
525     fAntiProtonContainer = (AliCFContainer *)list->At(4);
526     fHistEventStats = (TH1F *)list->At(5);
527   }
528   else if(!list) {
529     cout<<"Retrieving objects from the file... "<<endl;
530     fHistYPtProtons = (TH2D *)file->Get("fHistYPtProtons");
531     fHistYPtAntiProtons = (TH2D *)file->Get("fHistYPtAntiProtons");
532     fHistEvents = (TH1I *)file->Get("fHistEvents");
533     fProtonContainer = (AliCFContainer *)file->Get("containerProtons");
534     fAntiProtonContainer = (AliCFContainer *)file->Get("containerAntiProtons");
535     fHistEventStats = (TH1F *)file->Get("fHistEventStats");
536   }
537   if((!fHistYPtProtons)||(!fHistYPtAntiProtons)||(!fHistEvents)
538      ||(!fProtonContainer)||(!fAntiProtonContainer)||(!fHistEventStats)) {
539     cout<<"Input containers were not found!!!"<<endl;
540     status = kFALSE;
541   }
542   else {
543     //fHistYPtProtons = fProtonContainer->ShowProjection(0,1,0);
544     //fHistYPtAntiProtons = fAntiProtonContainer->ShowProjection(0,1,0);
545     fHistYPtProtons->Sumw2();
546     fHistYPtAntiProtons->Sumw2();
547   }
548
549   return status;
550 }
551
552 //____________________________________________________________________//
553 TList *AliProtonAnalysis::GetYRatioHistogramsInPtBins() {
554   //Returns a TList obkect with the eta (or y) dependent ratios for each 
555   //pT bin taken from the 2D histograms (not from the containers)
556   fYRatioInPtBinsList = new TList();
557   
558   //Protons
559   TH1D *gHistYProtons[100];
560   TString title;
561   for(Int_t iBin = 1; iBin <= fHistYPtProtons->GetNbinsY(); iBin++) {
562     title = "gHistYProtons_PtBin"; title += iBin;
563     gHistYProtons[iBin] = (TH1D *)fHistYPtProtons->ProjectionX(title.Data(),
564                                                                iBin,
565                                                                iBin,"b");
566     gHistYProtons[iBin]->Sumw2();
567   }
568
569   //Antiprotons
570   TH1D *gHistYAntiProtons[100];
571   for(Int_t iBin = 1; iBin <= fHistYPtAntiProtons->GetNbinsY(); iBin++) {
572     title = "gHistYAntiProtons_PtBin"; title += iBin;
573     gHistYAntiProtons[iBin] = (TH1D *)fHistYPtAntiProtons->ProjectionX(title.Data(),
574                                                                        iBin,
575                                                                        iBin,"b");
576     gHistYAntiProtons[iBin]->Sumw2();
577   }
578
579   Double_t pTmin = fHistYPtProtons->GetYaxis()->GetXmin();
580   Double_t pTStep = (fHistYPtProtons->GetYaxis()->GetXmax() - fHistYPtProtons->GetYaxis()->GetXmin())/fHistYPtProtons->GetNbinsY();
581   Double_t pTmax = pTmin + pTStep;
582   //Ratio
583   TH1D *gHistYRatio[100];
584   for(Int_t iBin = 1; iBin <= fHistYPtProtons->GetNbinsY(); iBin++) {
585     title = "gHistYRatio_PtBin"; title += iBin;
586     gHistYRatio[iBin] = new TH1D(title.Data(),"",
587                                  fHistYPtProtons->GetNbinsX(),
588                                  fHistYPtProtons->GetXaxis()->GetXmin(),
589                                  fHistYPtProtons->GetXaxis()->GetXmax());
590     title = "Pt: "; title += pTmin; title += " - "; title += pTmax;
591     gHistYRatio[iBin]->SetTitle(title.Data());
592     gHistYRatio[iBin]->GetYaxis()->SetTitle("#bar{p}/p");
593     gHistYRatio[iBin]->GetXaxis()->SetTitle(fHistYPtProtons->GetXaxis()->GetTitle());
594     gHistYRatio[iBin]->Divide(gHistYAntiProtons[iBin],
595                               gHistYProtons[iBin],1.0,1.0,"b");
596     fYRatioInPtBinsList->Add(gHistYRatio[iBin]);
597     pTmin += pTStep;
598     pTmax += pTStep;
599   }
600   
601   return fYRatioInPtBinsList;
602 }
603
604 //____________________________________________________________________//
605 TH1D *AliProtonAnalysis::GetProtonYHistogram() {
606   //Get the y histogram for protons
607   Int_t nAnalyzedEvents = GetNumberOfAnalyzedEvents();
608
609   //TH1D *fYProtons = (TH1D *)fHistYPtProtons->ProjectionX("fYProtons",0,fHistYPtProtons->GetYaxis()->GetNbins(),"");
610   TH1D *fYProtons = fProtonContainer->ShowProjection(0,kStepInPhaseSpace); //variable-step
611    
612   fYProtons->SetStats(kFALSE);
613   fYProtons->GetYaxis()->SetTitle("(1/N_{events})(dN/dy)");
614   fYProtons->SetTitle("dN/dy protons");
615   fYProtons->SetMarkerStyle(kFullCircle);
616   fYProtons->SetMarkerColor(4);
617   if(nAnalyzedEvents > 0)
618   fYProtons->Scale(1./nAnalyzedEvents);
619   
620   return fYProtons;
621 }
622
623 //____________________________________________________________________//
624 TH1D *AliProtonAnalysis::GetAntiProtonYHistogram() {
625   //Get the y histogram for antiprotons
626   Int_t nAnalyzedEvents = GetNumberOfAnalyzedEvents();
627   
628   //TH1D *fYAntiProtons = (TH1D *)fHistYPtAntiProtons->ProjectionX("fYAntiProtons",0,fHistYPtAntiProtons->GetYaxis()->GetNbins(),"");
629   TH1D *fYAntiProtons = fAntiProtonContainer->ShowProjection(0,kStepInPhaseSpace);//variable-step 
630  
631   fYAntiProtons->SetStats(kFALSE);
632   fYAntiProtons->GetYaxis()->SetTitle("(1/N_{events})(dN/dy)");
633   fYAntiProtons->SetTitle("dN/dy antiprotons");
634   fYAntiProtons->SetMarkerStyle(kFullCircle);
635   fYAntiProtons->SetMarkerColor(4);
636   if(nAnalyzedEvents > 0)
637     fYAntiProtons->Scale(1./nAnalyzedEvents);
638
639   return fYAntiProtons;
640 }
641
642 //____________________________________________________________________//
643 TH1D *AliProtonAnalysis::GetProtonPtHistogram() {
644   //Get the Pt histogram for protons
645   Int_t nAnalyzedEvents = GetNumberOfAnalyzedEvents();
646   
647   //TH1D *fPtProtons = (TH1D *)fHistYPtProtons->ProjectionY("fPtProtons",0,fHistYPtProtons->GetXaxis()->GetNbins(),""); 
648   TH1D *fPtProtons = fProtonContainer->ShowProjection(1,kStepInPhaseSpace); //variable-step
649
650   fPtProtons->SetStats(kFALSE);
651   fPtProtons->GetYaxis()->SetTitle("(1/N_{events})(dN/dP_{T})");
652   fPtProtons->SetTitle("dN/dPt protons");
653   fPtProtons->SetMarkerStyle(kFullCircle);
654   fPtProtons->SetMarkerColor(4);
655   if(nAnalyzedEvents > 0)
656     fPtProtons->Scale(1./nAnalyzedEvents);
657
658   return fPtProtons;
659 }
660
661 //____________________________________________________________________//
662 TH1D *AliProtonAnalysis::GetAntiProtonPtHistogram() {
663   //Get the Pt histogram for antiprotons
664   Int_t nAnalyzedEvents = GetNumberOfAnalyzedEvents();
665   
666   //TH1D *fPtAntiProtons = (TH1D *)fHistYPtAntiProtons->ProjectionY("fPtAntiProtons",0,fHistYPtProtons->GetXaxis()->GetNbins(),""); 
667   TH1D *fPtAntiProtons = fAntiProtonContainer->ShowProjection(1,kStepInPhaseSpace); //variable-step
668
669   fPtAntiProtons->SetStats(kFALSE);
670   fPtAntiProtons->GetYaxis()->SetTitle("(1/N_{events})(dN/dP_{T})");
671   fPtAntiProtons->SetTitle("dN/dPt antiprotons");
672   fPtAntiProtons->SetMarkerStyle(kFullCircle);
673   fPtAntiProtons->SetMarkerColor(4);
674   if(nAnalyzedEvents > 0)
675     fPtAntiProtons->Scale(1./nAnalyzedEvents);
676
677   return fPtAntiProtons;
678 }
679
680 //____________________________________________________________________//
681 TH1D *AliProtonAnalysis::GetProtonCorrectedYHistogram() {
682   //Get the corrected y histogram for protons
683   Int_t nAnalyzedEvents = GetNumberOfAnalyzedEvents();
684
685   TH1D *fYProtons = (TH1D *)fHistYPtProtonsCorrected->ProjectionX("fYProtons",1,fHistYPtProtons->GetYaxis()->GetNbins(),"e");
686   //TH1D *fYProtons = fCorrectProtons->Project(0); //0: rapidity
687    
688   fYProtons->SetStats(kFALSE);
689   fYProtons->GetYaxis()->SetTitle("(1/N_{events})(dN/dy)");
690   fYProtons->GetXaxis()->SetTitle("y");
691   fYProtons->SetTitle("dN/dy protons");
692   fYProtons->SetMarkerStyle(kFullCircle);
693   fYProtons->SetMarkerColor(4);
694   if(nAnalyzedEvents > 0)
695     fYProtons->Scale(1./nAnalyzedEvents);
696   
697   return fYProtons;
698 }
699
700 //____________________________________________________________________//
701 TH1D *AliProtonAnalysis::GetAntiProtonCorrectedYHistogram() {
702   //Get the corrected y histogram for antiprotons
703   Int_t nAnalyzedEvents = GetNumberOfAnalyzedEvents();
704   
705   TH1D *fYAntiProtons = (TH1D *)fHistYPtAntiProtonsCorrected->ProjectionX("fYAntiProtons",1,fHistYPtAntiProtons->GetYaxis()->GetNbins(),"e");
706   //TH1D *fYAntiProtons = fCorrectAntiProtons->Project(0); //0: rapidity
707    
708   fYAntiProtons->SetStats(kFALSE);
709   fYAntiProtons->GetYaxis()->SetTitle("(1/N_{events})(dN/dy)");
710   fYAntiProtons->GetXaxis()->SetTitle("y");
711   fYAntiProtons->SetTitle("dN/dy protons");
712   fYAntiProtons->SetMarkerStyle(kFullCircle);
713   fYAntiProtons->SetMarkerColor(4);
714   if(nAnalyzedEvents > 0)
715     fYAntiProtons->Scale(1./nAnalyzedEvents);
716   
717   return fYAntiProtons;
718 }
719
720 //____________________________________________________________________//
721 TH1D *AliProtonAnalysis::GetProtonCorrectedPtHistogram() {
722   //Get the corrected Pt histogram for protons
723   Int_t nAnalyzedEvents = GetNumberOfAnalyzedEvents();
724
725   //TH1D *fPtProtons = (TH1D *)fHistYPtProtonsCorrected->ProjectionY("fPtProtons",2,fHistYPtProtons->GetXaxis()->GetNbins()-1,"e");
726   TH1D *fPtProtons = (TH1D *)fHistYPtProtonsCorrected->ProjectionY("fPtProtons",3,7,"e"); //3,7: |y| < 0.5
727   //TH1D *fPtProtons = fCorrectProtons->Project(0); //0: rapidity
728    
729   fPtProtons->SetStats(kFALSE);
730   fPtProtons->GetYaxis()->SetTitle("(1/N_{events})(dN/dP_{T})");
731   fPtProtons->GetXaxis()->SetTitle("P_{T} [GeV/c]");
732   fPtProtons->SetTitle("dN/dPt protons");
733   fPtProtons->SetMarkerStyle(kFullCircle);
734   fPtProtons->SetMarkerColor(4);
735   if(nAnalyzedEvents > 0)
736     fPtProtons->Scale(1./nAnalyzedEvents);
737   
738   return fPtProtons;
739 }
740
741 //____________________________________________________________________//
742 TH1D *AliProtonAnalysis::GetAntiProtonCorrectedPtHistogram() {
743   //Get the corrected Pt histogram for antiprotons
744   Int_t nAnalyzedEvents = GetNumberOfAnalyzedEvents();
745
746   //TH1D *fPtAntiProtons = (TH1D *)fHistYPtAntiProtonsCorrected->ProjectionY("fPtAntiProtons",2,fHistYPtAntiProtons->GetXaxis()->GetNbins()-1,"e");
747   TH1D *fPtAntiProtons = (TH1D *)fHistYPtAntiProtonsCorrected->ProjectionY("fPtAntiProtons",3,7,"e"); //3,7: |y| < 0.5
748 //TH1D *fPtAntiProtons = fCorrectAntiProtons->Project(0); //0: rapidity
749    
750   fPtAntiProtons->SetStats(kFALSE);
751   fPtAntiProtons->GetYaxis()->SetTitle("(1/N_{events})(dN/dP_{T})");
752   fPtAntiProtons->GetXaxis()->SetTitle("P_{T} [GeV/c]");
753   fPtAntiProtons->SetTitle("dN/dPt antiprotons");
754   fPtAntiProtons->SetMarkerStyle(kFullCircle);
755   fPtAntiProtons->SetMarkerColor(4);
756   if(nAnalyzedEvents > 0)
757     fPtAntiProtons->Scale(1./nAnalyzedEvents);
758   
759   return fPtAntiProtons;
760 }
761
762 //____________________________________________________________________//
763 TH1D *AliProtonAnalysis::GetYRatioHistogram() {
764   //Returns the rapidity dependence of the ratio (uncorrected)
765   TH1D *fYProtons = GetProtonYHistogram();
766   TH1D *fYAntiProtons = GetAntiProtonYHistogram();
767   
768   TH1D *hRatioY = new TH1D("hRatioY","",fYProtons->GetNbinsX(),fYProtons->GetXaxis()->GetXmin(),fYProtons->GetXaxis()->GetXmax());
769   hRatioY->Divide(fYAntiProtons,fYProtons,1.0,1.0,"e");
770   hRatioY->SetMarkerStyle(kFullCircle);
771   hRatioY->SetMarkerColor(4);
772   hRatioY->GetYaxis()->SetTitle("#bar{p}/p");
773   hRatioY->GetYaxis()->SetTitleOffset(1.4);
774   hRatioY->GetXaxis()->SetTitle("y");
775   hRatioY->GetXaxis()->SetTitleColor(1);
776   hRatioY->SetStats(kFALSE);
777
778   return hRatioY;
779 }
780
781 //____________________________________________________________________//
782 TH1D *AliProtonAnalysis::GetYRatioCorrectedHistogram() {
783 //TH2D *gCorrectionProtons, 
784 //TH2D *gCorrectionAntiProtons) {
785   //Returns the rapidity dependence of the ratio (corrected)
786   //fHistYPtProtons->Multiply(gCorrectionProtons);
787   TH1D *fYProtons = GetProtonCorrectedYHistogram();
788   //fHistYPtAntiProtons->Multiply(gCorrectionAntiProtons);
789   TH1D *fYAntiProtons = GetAntiProtonCorrectedYHistogram();
790   
791   TH1D *hRatioY = new TH1D("hRatioY","",fYProtons->GetNbinsX(),fYProtons->GetXaxis()->GetXmin(),fYProtons->GetXaxis()->GetXmax());
792   hRatioY->Divide(fYAntiProtons,fYProtons,1.0,1.0,"e");
793   hRatioY->SetMarkerStyle(kFullCircle);
794   hRatioY->SetMarkerColor(4);
795   hRatioY->GetYaxis()->SetTitle("#bar{p}/p");
796   hRatioY->GetYaxis()->SetTitleOffset(1.4);
797   hRatioY->GetXaxis()->SetTitle("y");
798   hRatioY->GetXaxis()->SetTitleColor(1);
799   hRatioY->SetStats(kFALSE);
800
801   return hRatioY;
802 }
803
804 //____________________________________________________________________//
805 TH1D *AliProtonAnalysis::GetPtRatioHistogram() {
806   //Returns the pT dependence of the ratio (uncorrected)
807   TH1D *fPtProtons = GetProtonPtHistogram();
808   TH1D *fPtAntiProtons = GetAntiProtonPtHistogram();
809   
810   TH1D *hRatioPt = new TH1D("hRatioPt","",fPtProtons->GetNbinsX(),fPtProtons->GetXaxis()->GetXmin(),fPtProtons->GetXaxis()->GetXmax());
811   hRatioPt->Divide(fPtAntiProtons,fPtProtons,1.0,1.0,"e");
812   hRatioPt->SetMarkerStyle(kFullCircle);
813   hRatioPt->SetMarkerColor(4);
814   hRatioPt->GetYaxis()->SetTitle("#bar{p}/p");
815   hRatioPt->GetYaxis()->SetTitleOffset(1.4);
816   hRatioPt->GetXaxis()->SetTitle("P_{T} [GeV/c]");
817   hRatioPt->GetXaxis()->SetTitleColor(1);
818   hRatioPt->SetStats(kFALSE);
819
820   return hRatioPt;
821 }
822
823 //____________________________________________________________________//
824 TH1D *AliProtonAnalysis::GetPtRatioCorrectedHistogram() {
825   //TH2D *gCorrectionProtons, 
826   //TH2D *gCorrectionAntiProtons) {
827   //Returns the Pt dependence of the ratio (corrected)
828   //fHistYPtProtons->Multiply(gCorrectionProtons);
829   TH1D *fPtProtons = GetProtonCorrectedPtHistogram();
830   //fHistYPtAntiProtons->Multiply(gCorrectionAntiProtons);
831   TH1D *fPtAntiProtons = GetAntiProtonCorrectedPtHistogram();
832   
833   TH1D *hRatioPt = new TH1D("hRatioPt","",fPtProtons->GetNbinsX(),fPtProtons->GetXaxis()->GetXmin(),fPtProtons->GetXaxis()->GetXmax());
834   hRatioPt->Divide(fPtAntiProtons,fPtProtons,1.0,1.0,"e");
835   hRatioPt->SetMarkerStyle(kFullCircle);
836   hRatioPt->SetMarkerColor(4);
837   hRatioPt->GetYaxis()->SetTitle("#bar{p}/p");
838   hRatioPt->GetYaxis()->SetTitleOffset(1.4);
839   hRatioPt->GetXaxis()->SetTitle("y");
840   hRatioPt->GetXaxis()->SetTitleColor(1);
841   hRatioPt->SetStats(kFALSE);
842
843   return hRatioPt;
844 }
845
846 //____________________________________________________________________//
847 TH1D *AliProtonAnalysis::GetYAsymmetryHistogram() {
848   //Returns the rapidity dependence of the asymmetry (uncorrected)
849   TH1D *fYProtons = GetProtonYHistogram();
850   TH1D *fYAntiProtons = GetAntiProtonYHistogram();
851   
852   TH1D *hsum = new TH1D("hsumY","",fYProtons->GetNbinsX(),fYProtons->GetXaxis()->GetXmin(),fYProtons->GetXaxis()->GetXmax());
853   hsum->Add(fYProtons,fYAntiProtons,1.0,1.0);
854
855   TH1D *hdiff = new TH1D("hdiffY","",fYProtons->GetNbinsX(),fYProtons->GetXaxis()->GetXmin(),fYProtons->GetXaxis()->GetXmax());
856   hdiff->Add(fYProtons,fYAntiProtons,1.0,-1.0);
857
858   TH1D *hAsymmetryY = new TH1D("hAsymmetryY","",fYProtons->GetNbinsX(),fYProtons->GetXaxis()->GetXmin(),fYProtons->GetXaxis()->GetXmax());
859   hAsymmetryY->Divide(hdiff,hsum,2.0,1.,"e");
860   hAsymmetryY->SetMarkerStyle(kFullCircle);
861   hAsymmetryY->SetMarkerColor(4);
862   hAsymmetryY->GetYaxis()->SetTitle("A_{p}");
863   hAsymmetryY->GetYaxis()->SetTitleOffset(1.4);
864   hAsymmetryY->GetXaxis()->SetTitle("y");
865   hAsymmetryY->GetXaxis()->SetTitleColor(1);
866   hAsymmetryY->SetStats(kFALSE);
867
868   return hAsymmetryY;
869 }
870
871 //____________________________________________________________________//
872 TH1D *AliProtonAnalysis::GetPtAsymmetryHistogram() {
873   //Returns the pT dependence of the asymmetry (uncorrected)
874   TH1D *fPtProtons = GetProtonPtHistogram();
875   TH1D *fPtAntiProtons = GetAntiProtonPtHistogram();
876   
877   TH1D *hsum = new TH1D("hsumPt","",fPtProtons->GetNbinsX(),fPtProtons->GetXaxis()->GetXmin(),fPtProtons->GetXaxis()->GetXmax());
878   hsum->Add(fPtProtons,fPtAntiProtons,1.0,1.0);
879
880   TH1D *hdiff = new TH1D("hdiffPt","",fPtProtons->GetNbinsX(),fPtProtons->GetXaxis()->GetXmin(),fPtProtons->GetXaxis()->GetXmax());
881   hdiff->Add(fPtProtons,fPtAntiProtons,1.0,-1.0);
882
883   TH1D *hAsymmetryPt = new TH1D("hAsymmetryPt","",fPtProtons->GetNbinsX(),fPtProtons->GetXaxis()->GetXmin(),fPtProtons->GetXaxis()->GetXmax());
884   hAsymmetryPt->Divide(hdiff,hsum,2.0,1.,"e");
885   hAsymmetryPt->SetMarkerStyle(kFullCircle);
886   hAsymmetryPt->SetMarkerColor(4);
887   hAsymmetryPt->GetYaxis()->SetTitle("A_{p}");
888   hAsymmetryPt->GetYaxis()->SetTitleOffset(1.4);
889   hAsymmetryPt->GetXaxis()->SetTitle("P_{T} [GeV/c]");
890   hAsymmetryPt->GetXaxis()->SetTitleColor(1);
891   hAsymmetryPt->SetStats(kFALSE);
892
893   return hAsymmetryPt;
894 }
895
896 //____________________________________________________________________//
897 void AliProtonAnalysis::Analyze(AliESDEvent* esd,
898                                 const AliESDVertex *vertex) {
899   //Main analysis part - ESD
900   Int_t nTracks = 0;
901   Int_t nIdentifiedProtons = 0, nIdentifiedAntiProtons = 0;
902   Int_t nSurvivedProtons = 0, nSurvivedAntiProtons = 0;
903   
904   //=========================================//
905   //Aleph parametrization
906   Double_t fAlephParameters[5];
907   if(fProtonAnalysisBase->GetMCAnalysisMode()) {
908     fAlephParameters[0] = 2.15898e+00/50.;
909     fAlephParameters[1] = 1.75295e+01;
910     fAlephParameters[2] = 3.40030e-09;
911     fAlephParameters[3] = 1.96178e+00;
912     fAlephParameters[4] = 3.91720e+00;
913   }
914   else {
915     fAlephParameters[0] = 0.0283086;
916     fAlephParameters[1] = 2.63394e+01;
917     fAlephParameters[2] = 5.04114e-11;
918     fAlephParameters[3] = 2.12543e+00;
919     fAlephParameters[4] = 4.88663e+00;
920   }
921
922   AliTPCPIDResponse *tpcResponse = new AliTPCPIDResponse();
923   tpcResponse->SetBetheBlochParameters(fAlephParameters[0],fAlephParameters[1],fAlephParameters[2],fAlephParameters[3],fAlephParameters[4]);
924   //=========================================//  
925
926   fHistEvents->Fill(1); //number of analyzed events
927   Double_t containerInput[2] ;
928   Double_t gPt = 0.0, gP = 0.0;
929   Float_t dcaXY = 0.0, dcaZ = 0.0;
930
931   nTracks = esd->GetNumberOfTracks();
932   for(Int_t iTracks = 0; iTracks < nTracks; iTracks++) {
933     AliESDtrack* track = esd->GetTrack(iTracks);
934     AliESDtrack trackTPC;
935
936     Int_t nClustersTPC = track->GetTPCclusters(0x0);
937     Int_t npointsTPCdEdx = track->GetTPCsignalN();
938     Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0};  //The impact parameters and their covariance.
939     Double_t dca3D = 0.0;
940
941     if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
942       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
943       if(!tpcTrack) continue;
944       gPt = tpcTrack->Pt();
945       gP = track->GetInnerParam()->P();
946       tpcTrack->PropagateToDCA(vertex,
947                                esd->GetMagneticField(),
948                                100.,dca,cov);
949       dca3D = TMath::Sqrt(TMath::Power(dca[0],2) +
950                           TMath::Power(dca[1],2));
951
952       if(fProtonAnalysisBase->GetEtaMode())
953         containerInput[0] = tpcTrack->Eta();
954       else
955         containerInput[0] = fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
956                                                           tpcTrack->Py(),
957                                                           tpcTrack->Pz());
958       containerInput[1] = gPt;
959
960        //Step: kStepSurvived
961       if(fProtonAnalysisBase->IsAccepted(track)) {
962         if(fProtonAnalysisBase->IsQARun()) {
963           ((TH2F *)(fQA2DList->At(1)))->Fill(gP,track->GetTPCsignal());
964           ((TH2F *)(fQA2DList->At(3)))->Fill(gP,TMath::Log(track->GetTPCsignal()/tpcResponse->GetExpectedSignal(gP,AliPID::kProton)));
965           ((TH3F *)(fQA2DList->At(5)))->Fill(tpcTrack->Eta(),
966                                              tpcTrack->Phi()*180./TMath::Pi(),
967                                              npointsTPCdEdx);
968           ((TH3F *)(fQA2DList->At(7)))->Fill(tpcTrack->Eta(),
969                                              tpcTrack->Phi()*180./TMath::Pi(),
970                                              nClustersTPC);
971           ((TH3F *)(fQA2DList->At(9)))->Fill(gPt,
972                                              tpcTrack->Phi()*180./TMath::Pi(),
973                                              npointsTPCdEdx);
974           ((TH3F *)(fQA2DList->At(11)))->Fill(gPt,
975                                               tpcTrack->Phi()*180./TMath::Pi(),
976                                               nClustersTPC);
977         }//run the qa
978         
979         if(tpcTrack->Charge() > 0) {
980           fProtonContainer->Fill(containerInput,kStepSurvived);   
981           if(fProtonAnalysisBase->IsQARun()) {
982             ((TH2F *)(fQA2DList->At(12)))->Fill(tpcTrack->Eta(),
983                                                 tpcTrack->Phi()*180./TMath::Pi());
984             if(fProtonAnalysisBase->GetEtaMode()) {
985               ((TH3F *)(fQA2DList->At(14)))->Fill(tpcTrack->Eta(),
986                                                   tpcTrack->Pt(),
987                                                   dca[0]);
988               ((TH3F *)(fQA2DList->At(15)))->Fill(tpcTrack->Eta(),
989                                                   tpcTrack->Pt(),
990                                                   dca[1]);
991               ((TH3F *)(fQA2DList->At(18)))->Fill(tpcTrack->Eta(),
992                                                   tpcTrack->Pt(),
993                                                   TMath::Abs(dca3D));
994             }
995             else {
996               ((TH3F *)(fQA2DList->At(14)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
997                                                   tpcTrack->Pt(),
998                                                   dca[0]);
999               ((TH3F *)(fQA2DList->At(15)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1000                                                   tpcTrack->Pt(),
1001                                                   dca[1]);
1002               ((TH3F *)(fQA2DList->At(18)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1003                                                   tpcTrack->Pt(),
1004                                                   TMath::Abs(dca3D));
1005             }
1006           }//run the qa
1007         }//protons
1008         else if(tpcTrack->Charge() < 0) {
1009           fAntiProtonContainer->Fill(containerInput,kStepSurvived);   
1010           if(fProtonAnalysisBase->IsQARun()) {
1011             ((TH2F *)(fQA2DList->At(13)))->Fill(tpcTrack->Eta(),
1012                                                 tpcTrack->Phi()*180./TMath::Pi());
1013             if(fProtonAnalysisBase->GetEtaMode()) {
1014               ((TH3F *)(fQA2DList->At(16)))->Fill(tpcTrack->Eta(),
1015                                                   tpcTrack->Pt(),
1016                                                   dca[0]);
1017               ((TH3F *)(fQA2DList->At(17)))->Fill(tpcTrack->Eta(),
1018                                                   tpcTrack->Pt(),
1019                                                   dca[1]);
1020               ((TH3F *)(fQA2DList->At(19)))->Fill(tpcTrack->Eta(),
1021                                                   tpcTrack->Pt(),
1022                                                   TMath::Abs(dca3D));
1023             }
1024             else {
1025               ((TH3F *)(fQA2DList->At(16)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1026                                                   tpcTrack->Pt(),
1027                                                   dca[0]);
1028               ((TH3F *)(fQA2DList->At(17)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1029                                                   tpcTrack->Pt(),
1030                                                   dca[1]);
1031               ((TH3F *)(fQA2DList->At(19)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1032                                                   tpcTrack->Pt(),
1033                                                   TMath::Abs(dca3D));
1034             }
1035           }//run the qa
1036         }//antiprotons
1037
1038         //Step: kStepIsPrimary
1039         if(fProtonAnalysisBase->IsPrimary(esd,vertex,track)) {
1040           if(tpcTrack->Charge() > 0)
1041             fProtonContainer->Fill(containerInput,kStepIsPrimary);   
1042           else if(tpcTrack->Charge() < 0) 
1043             fAntiProtonContainer->Fill(containerInput,kStepIsPrimary);   
1044           
1045           if(fProtonAnalysisBase->IsQARun()) {
1046             ((TH2F *)(fQA2DList->At(0)))->Fill(gP,track->GetTPCsignal());
1047             ((TH2F *)(fQA2DList->At(2)))->Fill(gP,TMath::Log(track->GetTPCsignal()/tpcResponse->GetExpectedSignal(gP,AliPID::kProton)));
1048             ((TH3F *)(fQA2DList->At(4)))->Fill(tpcTrack->Eta(),
1049                                                tpcTrack->Phi()*180./TMath::Pi(),
1050                                                npointsTPCdEdx);
1051             ((TH3F *)(fQA2DList->At(6)))->Fill(tpcTrack->Eta(),
1052                                                tpcTrack->Phi()*180./TMath::Pi(),
1053                                                nClustersTPC);
1054             ((TH3F *)(fQA2DList->At(8)))->Fill(gPt,
1055                                                tpcTrack->Phi()*180./TMath::Pi(),
1056                                                npointsTPCdEdx);
1057             ((TH3F *)(fQA2DList->At(10)))->Fill(gPt,
1058                                                 tpcTrack->Phi()*180./TMath::Pi(),
1059                                                 nClustersTPC);  
1060             if(track->Charge() > 0)
1061               ((TH2F *)(fQA2DList->At(20)))->Fill(gP,track->GetTPCsignal());
1062             if(track->Charge() < 0)
1063               ((TH2F *)(fQA2DList->At(21)))->Fill(gP,track->GetTPCsignal());
1064           }//run the qa
1065
1066           //Step: kStepIdentified         
1067           if(fProtonAnalysisBase->IsProton(track)) {
1068             if(tpcTrack->Charge() > 0) {
1069               nIdentifiedProtons += 1;
1070               fProtonContainer->Fill(containerInput,kStepIdentified);
1071             }//protons
1072             else if(tpcTrack->Charge() < 0) {
1073               nIdentifiedAntiProtons += 1;
1074               fAntiProtonContainer->Fill(containerInput,kStepIdentified);
1075             }//protons
1076         
1077             if(fProtonAnalysisBase->IsQARun()) FillQA(esd,vertex,track);
1078             
1079             //Step: kStepInPhaseSpace
1080             if(fProtonAnalysisBase->IsInPhaseSpace(track)) {
1081               if(tpcTrack->Charge() > 0) {
1082                 nSurvivedProtons += 1;
1083                 fHistYPtProtons->Fill(containerInput[0],
1084                                       containerInput[1]);
1085                 fProtonContainer->Fill(containerInput,kStepInPhaseSpace);   
1086               }//protons
1087               else if(tpcTrack->Charge() < 0) {
1088                 nSurvivedAntiProtons += 1;
1089                 fHistYPtAntiProtons->Fill(containerInput[0],
1090                                           containerInput[1]);
1091                 fAntiProtonContainer->Fill(containerInput,kStepInPhaseSpace);
1092               }//antiprotons
1093             }//Step: kStepInPhaseSpace
1094           }//Step: kStepIdentified
1095         }//Step: kStepIsPrimary
1096       }//Step: kStepSurvived
1097     }//TPC only tracks
1098     if(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kFullHybrid) {
1099       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
1100       if(!tpcTrack) continue;
1101
1102       AliExternalTrackParam cParam;
1103       gPt = tpcTrack->Pt();
1104       gP = track->GetInnerParam()->P();
1105       track->RelateToVertex(vertex,
1106                             esd->GetMagneticField(),
1107                             100.,&cParam);
1108       track->GetImpactParameters(dcaXY,dcaZ);
1109       dca[0] = dcaXY; dca[1] = dcaZ;
1110       dca3D = TMath::Sqrt(TMath::Power(dca[0],2) +
1111                           TMath::Power(dca[1],2));
1112       if(fProtonAnalysisBase->GetEtaMode())
1113         containerInput[0] = tpcTrack->Eta();
1114       else
1115         containerInput[0] = fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
1116                                                           tpcTrack->Py(),
1117                                                           tpcTrack->Pz());
1118       containerInput[1] = gPt;
1119             
1120       //Step: kStepSurvived
1121       if(fProtonAnalysisBase->IsAccepted(track)) {
1122         if(fProtonAnalysisBase->IsQARun()) {
1123           ((TH2F *)(fQA2DList->At(1)))->Fill(gP,track->GetTPCsignal());
1124           ((TH2F *)(fQA2DList->At(3)))->Fill(gP,TMath::Log(track->GetTPCsignal()/tpcResponse->GetExpectedSignal(gP,AliPID::kProton)));
1125           ((TH3F *)(fQA2DList->At(5)))->Fill(tpcTrack->Eta(),
1126                                              tpcTrack->Phi()*180./TMath::Pi(),
1127                                              npointsTPCdEdx);
1128           ((TH3F *)(fQA2DList->At(7)))->Fill(tpcTrack->Eta(),
1129                                              tpcTrack->Phi()*180./TMath::Pi(),
1130                                              nClustersTPC);
1131           ((TH3F *)(fQA2DList->At(9)))->Fill(gPt,
1132                                              tpcTrack->Phi()*180./TMath::Pi(),
1133                                              npointsTPCdEdx);
1134           ((TH3F *)(fQA2DList->At(11)))->Fill(gPt,
1135                                               tpcTrack->Phi()*180./TMath::Pi(),
1136                                               nClustersTPC);
1137         }//run the qa
1138         if(tpcTrack->Charge() > 0) {
1139           fProtonContainer->Fill(containerInput,kStepSurvived);   
1140           if(fProtonAnalysisBase->IsQARun()) {
1141             ((TH2F *)(fQA2DList->At(12)))->Fill(tpcTrack->Eta(),
1142                                                 tpcTrack->Phi()*180./TMath::Pi());
1143             if(fProtonAnalysisBase->GetEtaMode()) {
1144               ((TH3F *)(fQA2DList->At(14)))->Fill(tpcTrack->Eta(),
1145                                                   tpcTrack->Pt(),
1146                                                   dca[0]);
1147               ((TH3F *)(fQA2DList->At(15)))->Fill(tpcTrack->Eta(),
1148                                                   tpcTrack->Pt(),
1149                                                   dca[1]);
1150               ((TH3F *)(fQA2DList->At(18)))->Fill(tpcTrack->Eta(),
1151                                                   tpcTrack->Pt(),
1152                                                   TMath::Abs(dca3D));
1153             }
1154             else {
1155               ((TH3F *)(fQA2DList->At(14)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1156                                                   tpcTrack->Pt(),
1157                                                   dca[0]);
1158               ((TH3F *)(fQA2DList->At(15)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1159                                                   tpcTrack->Pt(),
1160                                                   dca[1]);
1161               ((TH3F *)(fQA2DList->At(18)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1162                                                   tpcTrack->Pt(),
1163                                                   TMath::Abs(dca3D));
1164             }
1165           }//run the qa
1166         }//protons
1167         else if(tpcTrack->Charge() < 0) {
1168           fAntiProtonContainer->Fill(containerInput,kStepSurvived);   
1169           if(fProtonAnalysisBase->IsQARun()) {
1170             ((TH2F *)(fQA2DList->At(13)))->Fill(tpcTrack->Eta(),
1171                                                 tpcTrack->Phi()*180./TMath::Pi());
1172             if(fProtonAnalysisBase->GetEtaMode()) {
1173               ((TH3F *)(fQA2DList->At(16)))->Fill(tpcTrack->Eta(),
1174                                                   tpcTrack->Pt(),
1175                                                   dca[0]);
1176               ((TH3F *)(fQA2DList->At(17)))->Fill(tpcTrack->Eta(),
1177                                                   tpcTrack->Pt(),
1178                                                   dca[1]);
1179               ((TH3F *)(fQA2DList->At(19)))->Fill(tpcTrack->Eta(),
1180                                                   tpcTrack->Pt(),
1181                                                   TMath::Abs(dca3D));
1182             }
1183             else {
1184               ((TH3F *)(fQA2DList->At(16)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1185                                                   tpcTrack->Pt(),
1186                                                   dca[0]);
1187               ((TH3F *)(fQA2DList->At(17)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1188                                                   tpcTrack->Pt(),
1189                                                   dca[1]);
1190               ((TH3F *)(fQA2DList->At(19)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1191                                                   tpcTrack->Pt(),
1192                                                   TMath::Abs(dca3D));
1193             }
1194           }//run the qa
1195         }//antiprotons
1196
1197         //Step: kStepIsPrimary
1198         if(fProtonAnalysisBase->IsPrimary(esd,vertex,track)) {
1199           if(tpcTrack->Charge() > 0)
1200             fProtonContainer->Fill(containerInput,kStepIsPrimary);   
1201           else if(tpcTrack->Charge() < 0) 
1202             fAntiProtonContainer->Fill(containerInput,kStepIsPrimary);   
1203           
1204           if(fProtonAnalysisBase->IsQARun()) {
1205             ((TH2F *)(fQA2DList->At(0)))->Fill(gP,track->GetTPCsignal());
1206             ((TH2F *)(fQA2DList->At(2)))->Fill(gP,TMath::Log(track->GetTPCsignal()/tpcResponse->GetExpectedSignal(gP,AliPID::kProton)));
1207             ((TH3F *)(fQA2DList->At(4)))->Fill(tpcTrack->Eta(),
1208                                                tpcTrack->Phi()*180./TMath::Pi(),
1209                                                npointsTPCdEdx);
1210             ((TH3F *)(fQA2DList->At(6)))->Fill(tpcTrack->Eta(),
1211                                                tpcTrack->Phi()*180./TMath::Pi(),
1212                                                nClustersTPC);
1213             ((TH3F *)(fQA2DList->At(8)))->Fill(gPt,
1214                                                tpcTrack->Phi()*180./TMath::Pi(),
1215                                                npointsTPCdEdx);
1216             ((TH3F *)(fQA2DList->At(10)))->Fill(gPt,
1217                                                 tpcTrack->Phi()*180./TMath::Pi(),
1218                                                 nClustersTPC);  
1219             if(track->Charge() > 0)
1220               ((TH2F *)(fQA2DList->At(20)))->Fill(gP,track->GetTPCsignal());
1221             if(track->Charge() < 0)
1222               ((TH2F *)(fQA2DList->At(21)))->Fill(gP,track->GetTPCsignal());
1223           }//run the qa
1224           
1225           //Step: kStepIdentified
1226           if(fProtonAnalysisBase->IsProton(track)) {
1227             if(tpcTrack->Charge() > 0) {
1228               nIdentifiedProtons += 1;
1229               fProtonContainer->Fill(containerInput,kStepIdentified);
1230             }//protons
1231             else if(tpcTrack->Charge() < 0) {
1232               nIdentifiedAntiProtons += 1;
1233               fAntiProtonContainer->Fill(containerInput,kStepIdentified);
1234             }//protons
1235             
1236             if(fProtonAnalysisBase->IsQARun()) FillQA(esd,vertex,track);
1237    
1238             //Step: kStepInPhaseSpace
1239             if(fProtonAnalysisBase->IsInPhaseSpace(track)) {
1240               if(tpcTrack->Charge() > 0) {
1241                 nSurvivedProtons += 1;
1242                 fHistYPtProtons->Fill(containerInput[0],
1243                                       containerInput[1]);
1244                 fProtonContainer->Fill(containerInput,kStepInPhaseSpace);   
1245               }//protons
1246               else if(tpcTrack->Charge() < 0) {
1247                 nSurvivedAntiProtons += 1;
1248                 fHistYPtAntiProtons->Fill(containerInput[0],
1249                                           containerInput[1]);
1250                 fAntiProtonContainer->Fill(containerInput,kStepInPhaseSpace);
1251               }//antiprotons
1252             }//Step: kStepInPhaseSpace
1253           }//Step: kStepIdentified
1254         }//Step: kStepIsPrimary
1255       }//Step: kStepSurvived
1256     }//Full hybrid
1257     else if(fProtonAnalysisBase->GetAnalysisMode() == AliProtonAnalysisBase::kGlobal) {
1258       gPt = track->Pt();
1259       gP = track->GetInnerParam()->P();
1260
1261       track->PropagateToDCA(vertex,
1262                             esd->GetMagneticField(),
1263                             100.,dca,cov);
1264       dca3D = TMath::Sqrt(TMath::Power(dca[0],2) +
1265                           TMath::Power(dca[1],2));
1266
1267       if(fProtonAnalysisBase->GetEtaMode())
1268         containerInput[0] = track->Eta();
1269       else
1270         containerInput[0] = fProtonAnalysisBase->Rapidity(track->Px(),
1271                                                           track->Py(),
1272                                                           track->Pz());
1273       containerInput[1] = gPt;
1274       
1275       //Step: kStepSurvived
1276       if(fProtonAnalysisBase->IsAccepted(track)) {
1277         if(fProtonAnalysisBase->IsQARun()) {
1278           ((TH2F *)(fQA2DList->At(1)))->Fill(gP,track->GetTPCsignal());
1279           ((TH2F *)(fQA2DList->At(3)))->Fill(gP,TMath::Log(track->GetTPCsignal()/tpcResponse->GetExpectedSignal(gP,AliPID::kProton)));
1280           ((TH3F *)(fQA2DList->At(5)))->Fill(track->Eta(),
1281                                              track->Phi()*180./TMath::Pi(),
1282                                              npointsTPCdEdx);
1283           ((TH3F *)(fQA2DList->At(7)))->Fill(track->Eta(),
1284                                              track->Phi()*180./TMath::Pi(),
1285                                              nClustersTPC);
1286           ((TH3F *)(fQA2DList->At(9)))->Fill(gPt,
1287                                              track->Phi()*180./TMath::Pi(),
1288                                              npointsTPCdEdx);
1289           ((TH3F *)(fQA2DList->At(11)))->Fill(gPt,
1290                                               track->Phi()*180./TMath::Pi(),
1291                                               nClustersTPC);
1292         }//run the qa
1293         if(track->Charge() > 0) {
1294           fProtonContainer->Fill(containerInput,kStepSurvived);   
1295           if(fProtonAnalysisBase->IsQARun()) {
1296             ((TH2F *)(fQA2DList->At(12)))->Fill(track->Eta(),
1297                                                 track->Phi()*180./TMath::Pi());
1298             if(fProtonAnalysisBase->GetEtaMode()) {
1299               ((TH3F *)(fQA2DList->At(14)))->Fill(track->Eta(),
1300                                                   track->Pt(),
1301                                                   dca[0]);
1302               ((TH3F *)(fQA2DList->At(15)))->Fill(track->Eta(),
1303                                                   track->Pt(),
1304                                                   dca[1]);
1305               ((TH3F *)(fQA2DList->At(18)))->Fill(track->Eta(),
1306                                                   track->Pt(),
1307                                                   TMath::Abs(dca3D));
1308             }
1309             else {
1310               ((TH3F *)(fQA2DList->At(14)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz()),
1311                                                   track->Pt(),
1312                                                   dca[0]);
1313               ((TH3F *)(fQA2DList->At(15)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz()),
1314                                                   track->Pt(),
1315                                                   dca[1]);
1316               ((TH3F *)(fQA2DList->At(18)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz()),
1317                                                   track->Pt(),
1318                                                   TMath::Abs(dca3D));
1319             }
1320           }//run the qa
1321         }//protons
1322         else if(track->Charge() < 0) {
1323           fAntiProtonContainer->Fill(containerInput,kStepSurvived);   
1324           if(fProtonAnalysisBase->IsQARun()) {
1325             ((TH2F *)(fQA2DList->At(13)))->Fill(track->Eta(),
1326                                                 track->Phi()*180./TMath::Pi());
1327             if(fProtonAnalysisBase->GetEtaMode()) {
1328               ((TH3F *)(fQA2DList->At(16)))->Fill(track->Eta(),
1329                                                   track->Pt(),
1330                                                   dca[0]);
1331               ((TH3F *)(fQA2DList->At(17)))->Fill(track->Eta(),
1332                                                   track->Pt(),
1333                                                   dca[1]);
1334               ((TH3F *)(fQA2DList->At(19)))->Fill(track->Eta(),
1335                                                   track->Pt(),
1336                                                   TMath::Abs(dca3D));
1337             }
1338             else {
1339               ((TH3F *)(fQA2DList->At(16)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz()),
1340                                                   track->Pt(),
1341                                                   dca[0]);
1342               ((TH3F *)(fQA2DList->At(17)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz()),
1343                                                   track->Pt(),
1344                                                   dca[1]);
1345               ((TH3F *)(fQA2DList->At(19)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz()),
1346                                                   track->Pt(),
1347                                                   TMath::Abs(dca3D));
1348             }
1349           }//run the qa
1350         }//antiprotons
1351         
1352         //Step: kStepIsPrimary
1353         if(fProtonAnalysisBase->IsPrimary(esd,vertex,track)) {
1354           if(track->Charge() > 0)
1355             fProtonContainer->Fill(containerInput,kStepIsPrimary);   
1356           else if(track->Charge() < 0) 
1357             fAntiProtonContainer->Fill(containerInput,kStepIsPrimary);   
1358           
1359           if(fProtonAnalysisBase->IsQARun()) {
1360             ((TH2F *)(fQA2DList->At(0)))->Fill(gP,track->GetTPCsignal());
1361             ((TH2F *)(fQA2DList->At(2)))->Fill(gP,TMath::Log(track->GetTPCsignal()/tpcResponse->GetExpectedSignal(gP,AliPID::kProton)));
1362             ((TH3F *)(fQA2DList->At(4)))->Fill(track->Eta(),
1363                                                track->Phi()*180./TMath::Pi(),
1364                                                npointsTPCdEdx);
1365             ((TH3F *)(fQA2DList->At(6)))->Fill(track->Eta(),
1366                                                track->Phi()*180./TMath::Pi(),
1367                                                nClustersTPC);
1368             ((TH3F *)(fQA2DList->At(8)))->Fill(gPt,
1369                                                track->Phi()*180./TMath::Pi(),
1370                                                npointsTPCdEdx);
1371             ((TH3F *)(fQA2DList->At(10)))->Fill(gPt,
1372                                                 track->Phi()*180./TMath::Pi(),
1373                                                 nClustersTPC);  
1374             if(track->Charge() > 0)
1375               ((TH2F *)(fQA2DList->At(20)))->Fill(gP,track->GetTPCsignal());
1376             if(track->Charge() < 0)
1377               ((TH2F *)(fQA2DList->At(21)))->Fill(gP,track->GetTPCsignal());
1378           }//run the qa
1379
1380           //Step: kStepIdentified
1381           if(fProtonAnalysisBase->IsProton(track)) {
1382             if(track->Charge() > 0) {
1383               nIdentifiedProtons += 1;
1384               fProtonContainer->Fill(containerInput,kStepIdentified);
1385             }//protons
1386             else if(track->Charge() < 0) {
1387               nIdentifiedAntiProtons += 1;
1388               fAntiProtonContainer->Fill(containerInput,kStepIdentified);
1389             }//protons
1390             
1391             if(fProtonAnalysisBase->IsQARun()) FillQA(esd,vertex,track);
1392             
1393             //Step: kStepInPhaseSpace
1394             if(fProtonAnalysisBase->IsInPhaseSpace(track)) {
1395               if(track->Charge() > 0) {
1396                 nSurvivedProtons += 1;
1397                 fHistYPtProtons->Fill(containerInput[0],
1398                                       containerInput[1]);
1399                 fProtonContainer->Fill(containerInput,kStepInPhaseSpace);   
1400               }//protons
1401               else if(track->Charge() < 0) {
1402                 nSurvivedAntiProtons += 1;
1403                 fHistYPtAntiProtons->Fill(containerInput[0],
1404                                           containerInput[1]);
1405                 fAntiProtonContainer->Fill(containerInput,kStepInPhaseSpace);
1406               }//antiprotons
1407             }//Step: kStepInPhaseSpace
1408           }//Step: kStepIdentified
1409         }//Step: kStepIsPrimary
1410       }//Step: kStepSurvived
1411     }//Global tracking
1412   }//track loop 
1413   
1414   delete tpcResponse;
1415   
1416   if((nIdentifiedProtons > 0)||(nIdentifiedAntiProtons > 0))
1417     fHistEvents->Fill(2); //number of analyzed events with at least one (anti)proton
1418   
1419   if(fProtonAnalysisBase->GetDebugMode())
1420     Printf("Initial number of tracks: %d | Identified (anti)protons: %d - %d | Survived (anti)protons: %d - %d",nTracks,nIdentifiedProtons,nIdentifiedAntiProtons,nSurvivedProtons,nSurvivedAntiProtons);
1421 }
1422
1423 //____________________________________________________________________//
1424 void AliProtonAnalysis::Analyze(AliAODEvent* const fAOD) {
1425   //Main analysis part - AOD
1426   fHistEvents->Fill(1); //number of analyzed events
1427   Int_t nTracks = fAOD->GetNumberOfTracks();
1428   for(Int_t iTracks = 0; iTracks < nTracks; iTracks++) {
1429     AliAODTrack* track = fAOD->GetTrack(iTracks);
1430     Double_t gPt = track->Pt();
1431     Double_t gP = track->P();
1432     
1433     //pid
1434     Double_t probability[10];
1435     track->GetPID(probability);
1436     Double_t rcc = 0.0;
1437     for(Int_t i = 0; i < AliPID::kSPECIESN; i++) rcc += probability[i]*fProtonAnalysisBase->GetParticleFraction(i,gP);
1438     if(rcc == 0.0) continue;
1439     Double_t w[10];
1440     for(Int_t i = 0; i < AliPID::kSPECIESN; i++) w[i] = probability[i]*fProtonAnalysisBase->GetParticleFraction(i,gP)/rcc;
1441     Long64_t fParticleType = TMath::LocMax(AliPID::kSPECIESN,w);
1442     if(fParticleType == 4) {
1443       if(track->Charge() > 0) 
1444         fHistYPtProtons->Fill(track->Y(fParticleType),gPt);
1445       else if(track->Charge() < 0) 
1446         fHistYPtAntiProtons->Fill(track->Y(fParticleType),gPt);
1447     }//proton check
1448   }//track loop 
1449 }
1450
1451 //____________________________________________________________________//
1452 void AliProtonAnalysis::Analyze(AliStack* const stack, 
1453                                 Bool_t iInclusive) {
1454   //Main analysis part - MC
1455   fHistEvents->Fill(1); //number of analyzed events
1456
1457   Int_t nParticles = 0;
1458   //inclusive protons - 
1459   if(iInclusive) nParticles = stack->GetNtrack();
1460   else nParticles = stack->GetNprimary();
1461
1462   for(Int_t i = 0; i < nParticles; i++) {
1463     TParticle *particle = stack->Particle(i);
1464     if(!particle) continue;
1465
1466     //in case of inclusive protons reject the secondaries from hadronic inter.
1467     if(particle->GetUniqueID() == 13) continue;
1468
1469     if(TMath::Abs(particle->Eta()) > 1.0) continue;
1470     if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
1471     if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
1472
1473     Int_t pdgcode = particle->GetPdgCode();
1474     if(pdgcode == 2212) fHistYPtProtons->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
1475                                                                             particle->Py(),
1476                                                                             particle->Pz()),
1477                                               particle->Pt());
1478     if(pdgcode == -2212) fHistYPtAntiProtons->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
1479                                                                                  particle->Py(),
1480                                                                                  particle->Pz()),
1481                                                    particle->Pt());
1482   }//particle loop
1483 }
1484
1485 //____________________________________________________________________//
1486 Bool_t AliProtonAnalysis::PrintMean(TH1 *hist, Double_t edge) {
1487   //calculates the mean value of the ratio/asymmetry within \pm edge
1488   Double_t sum = 0.0, sumError = 0.0;
1489   Int_t nentries = 0;
1490   //calculate the mean
1491   for(Int_t i = 1; i <= hist->GetXaxis()->GetNbins(); i++) {
1492     Double_t x = hist->GetBinCenter(i);
1493     Double_t y = hist->GetBinContent(i);
1494     if(TMath::Abs(x) < edge) {
1495       sum += y;
1496       sumError += TMath::Power(hist->GetBinError(i),2);
1497       nentries += 1;
1498     }
1499     //Printf("eta: %lf - sum: %lf - sumError: %lf - counter: %d",
1500     //TMath::Abs(x),sum,sumError,nentries);
1501   }
1502   Double_t mean = 0.0;
1503   Double_t error = 0.0;
1504   if(nentries != 0) {
1505     mean = sum/nentries;
1506     error =  TMath::Sqrt(sumError)/nentries;
1507   }
1508
1509   //calculate the error
1510     /*for(Int_t i = 1; i <= hist->GetXaxis()->GetNbins(); i++) {
1511     Double_t x = hist->GetBinCenter(i);
1512     Double_t y = hist->GetBinContent(i);
1513     if(TMath::Abs(x) < edge) {
1514       sum += TMath::Power((mean - y),2);
1515       nentries += 1;
1516     }
1517     }*/
1518
1519
1520   cout<<"========================================="<<endl;
1521   cout<<"Input distribution: "<<hist->GetName()<<endl;
1522   cout<<"Interval used: -"<<edge<<" -> "<<edge<<endl;
1523   cout<<"Mean value :"<<mean<<endl;
1524   cout<<"Error: "<<error<<endl;
1525   cout<<"========================================="<<endl;
1526
1527   return 0;
1528 }
1529
1530 //____________________________________________________________________//
1531 Bool_t AliProtonAnalysis::PrintYields(TH1 *hist, Double_t edge) {
1532   //calculates the (anti)proton yields within the \pm edge
1533   Double_t sum = 0.0, sumerror = 0.0;
1534   Double_t error = 0.0;
1535   for(Int_t i = 0; i < hist->GetXaxis()->GetNbins(); i++) {
1536     Double_t x = hist->GetBinCenter(i+1);
1537     Double_t y = hist->GetBinContent(i+1);
1538     if(TMath::Abs(x) < edge) {
1539       sum += y;
1540       sumerror += TMath::Power(hist->GetBinError(i+1),2); 
1541     }
1542   }
1543
1544   error = TMath::Sqrt(sumerror);
1545
1546   cout<<"========================================="<<endl;
1547   cout<<"Input distribution: "<<hist->GetName()<<endl;
1548   cout<<"Interval used: -"<<edge<<" -> "<<edge<<endl;
1549   cout<<"Yields :"<<sum<<endl;
1550   cout<<"Error: "<<error<<endl;
1551   cout<<"========================================="<<endl;
1552
1553   return 0;
1554 }
1555
1556 //____________________________________________________________________//
1557 void AliProtonAnalysis::SetCorrectionMapForCuts(const char* filename) {
1558   //Reads the file with the correction maps for the cut efficiency
1559   TFile *gCorrectionForCuts = TFile::Open(filename);
1560   if(!gCorrectionForCuts) {
1561     Printf("The TFile object is not valid!!!");
1562     return;
1563   }
1564   if(!gCorrectionForCuts->IsOpen()) {
1565     Printf("The file is not found!!!");
1566     return;
1567   }
1568   fHistYPtCorrectionForCutsProtons = dynamic_cast<TH2D *>(gCorrectionForCuts->Get("gHistCorrectionForCutsProtons"));
1569   fHistYPtCorrectionForCutsAntiProtons = dynamic_cast<TH2D *>(gCorrectionForCuts->Get("gHistCorrectionForCutsAntiProtons"));
1570   fCorrectForCutsFlag = kTRUE;
1571 }
1572
1573 //____________________________________________________________________//
1574 void AliProtonAnalysis::SetCorrectionMapForTracking(const char* filename) {
1575   //Reads the file with the correction maps for the tracking efficiency
1576   TFile *gCorrectionForTracking = TFile::Open(filename);
1577   if(!gCorrectionForTracking) {
1578     Printf("The TFile object is not valid!!!");
1579     return;
1580   }
1581   if(!gCorrectionForTracking->IsOpen()) {
1582     Printf("The file is not found!!!");
1583     return;
1584   }
1585   fHistYPtCorrectionForTrackingProtons = dynamic_cast<TH2D *>(gCorrectionForTracking->Get("gHistCorrectionForTrackingProtons"));
1586   fHistYPtCorrectionForTrackingAntiProtons = dynamic_cast<TH2D *>(gCorrectionForTracking->Get("gHistCorrectionForTrackingAntiProtons"));
1587   fCorrectForTrackingFlag = kTRUE;
1588 }
1589
1590 //____________________________________________________________________//
1591 void AliProtonAnalysis::SetCorrectionMapForFeedDown(const char* filename) {
1592   //Reads the file with the correction maps for the feed-down contamination
1593   TFile *gCorrectionForFeedDown = TFile::Open(filename);
1594   if(!gCorrectionForFeedDown) {
1595     Printf("The TFile object is not valid!!!");
1596     return;
1597   }
1598   if(!gCorrectionForFeedDown->IsOpen()) {
1599     Printf("The file is not found!!!");
1600     return;
1601   }
1602   fHistYPtCorrectionForFeedDownProtons = dynamic_cast<TH2D *>(gCorrectionForFeedDown->Get("gHistCorrectionForFeedDownProtons"));
1603   fHistYPtCorrectionForFeedDownAntiProtons = dynamic_cast<TH2D *>(gCorrectionForFeedDown->Get("gHistCorrectionForFeedDownAntiProtons"));
1604   fCorrectForFeedDownFlag = kTRUE;
1605 }
1606
1607 //____________________________________________________________________//
1608 void AliProtonAnalysis::SetCorrectionMapForSecondaries(const char* filename) {
1609   //Reads the file with the correction maps for the secondaries
1610   TFile *gCorrectionForSecondaries = TFile::Open(filename);
1611   if(!gCorrectionForSecondaries) {
1612     Printf("The TFile object is not valid!!!");
1613     return;
1614   }
1615   if(!gCorrectionForSecondaries->IsOpen()) {
1616     Printf("The file is not found!!!");
1617     return;
1618   }
1619
1620   fHistYPtCorrectionForSecondaries = dynamic_cast<TH2D *>(gCorrectionForSecondaries->Get("gHistCorrectionForSecondaries"));
1621   fCorrectForSecondariesFlag = kTRUE;
1622 }
1623
1624 //____________________________________________________________________//
1625 void AliProtonAnalysis::SetCorrectionMapForCrossSection(const char* filename) {
1626   //Reads the file with the correction maps for the proper x-section
1627   TFile *gCorrectionForXSection = TFile::Open(filename);
1628   if(!gCorrectionForXSection) {
1629     Printf("The TFile object is not valid!!!");
1630     return;
1631   }
1632   if(!gCorrectionForXSection->IsOpen()) {
1633     Printf("The file is not found!!!");
1634     return;
1635   }
1636
1637   fHistCorrectionForCrossSectionYPtProtons = dynamic_cast<TH2D *>(gCorrectionForXSection->Get("gHistCorrectionForCrossSectionProtons"));
1638   fHistCorrectionForCrossSectionYPtAntiProtons = dynamic_cast<TH2D *>(gCorrectionForXSection->Get("gHistCorrectionForCrossSectionAntiProtons"));
1639   fHistCorrectionForCrossSectionFlag = kTRUE;
1640 }
1641
1642 //____________________________________________________________________//
1643 void AliProtonAnalysis::Correct() {
1644   //Apply the corrections: Fast & dirty way for the absorption corrections
1645   //Correct the protons for the efficiency
1646   fHistYPtProtonsCorrected = fProtonContainer->ShowProjection(0,1,kStepInPhaseSpace);
1647   fHistYPtProtonsCorrected->Divide(fHistEfficiencyYPtProtons);
1648   //Correct the protons for proper cross-section
1649   if(fHistCorrectionForCrossSectionFlag)
1650     fHistYPtProtonsCorrected->Multiply(fHistCorrectionForCrossSectionYPtProtons);
1651   //Correct the protons for secondaries
1652   if(fCorrectForSecondariesFlag)
1653     fHistYPtProtonsCorrected->Divide(fHistYPtCorrectionForSecondaries);
1654   //Correct the protons for feed-down
1655   if(fCorrectForFeedDownFlag)
1656     fHistYPtProtonsCorrected->Divide(fHistYPtCorrectionForFeedDownProtons);
1657   //Correct the protons for the cut efficiency
1658   if(fCorrectForCutsFlag)
1659     fHistYPtProtonsCorrected->Multiply(fHistYPtCorrectionForCutsProtons);
1660   //Correct the protons for the tracking efficiency
1661   if(fCorrectForTrackingFlag)
1662     fHistYPtProtonsCorrected->Multiply(fHistYPtCorrectionForTrackingProtons);
1663  
1664   //Correct the antiprotons for the efficiency
1665   fHistYPtAntiProtonsCorrected = fAntiProtonContainer->ShowProjection(0,1,kStepInPhaseSpace);
1666   fHistYPtAntiProtonsCorrected->Divide(fHistEfficiencyYPtAntiProtons);
1667   //Correct the antiprotons for proper cross-section
1668   if(fHistCorrectionForCrossSectionFlag)
1669     fHistYPtAntiProtonsCorrected->Multiply(fHistCorrectionForCrossSectionYPtAntiProtons);
1670   //Correct the antiprotons for feed-down
1671   if(fCorrectForFeedDownFlag)
1672     fHistYPtAntiProtonsCorrected->Divide(fHistYPtCorrectionForFeedDownAntiProtons);
1673   //Correct the antiprotons for the cut efficiency
1674    if(fCorrectForCutsFlag)
1675      fHistYPtAntiProtonsCorrected->Multiply(fHistYPtCorrectionForCutsAntiProtons);
1676   //Correct the antiprotons for the tracking efficiency
1677    if(fCorrectForTrackingFlag)
1678      fHistYPtAntiProtonsCorrected->Multiply(fHistYPtCorrectionForTrackingAntiProtons);
1679 }
1680
1681 //____________________________________________________________________//
1682 void AliProtonAnalysis::Correct(Int_t step) {
1683   //Applies the correction maps to the initial containers
1684   fCorrectProtons = new AliCFDataGrid("correctProtons",
1685                                       "corrected data",
1686                                       *fProtonContainer);
1687   fCorrectProtons->SetMeasured(0);
1688   fCorrectProtons->ApplyEffCorrection(*(AliCFEffGrid *)fEffGridListProtons->At(step));
1689
1690   fCorrectAntiProtons = new AliCFDataGrid("correctAntiProtons",
1691                                           "corrected data",
1692                                           *fAntiProtonContainer);
1693   fCorrectAntiProtons->SetMeasured(0);
1694   fCorrectAntiProtons->ApplyEffCorrection(*(AliCFEffGrid *)fEffGridListAntiProtons->At(step));
1695 }
1696
1697 //____________________________________________________________________//
1698 Bool_t AliProtonAnalysis::ReadCorrectionContainer(const char* filename) {
1699   // Reads the outout of the correction framework task
1700   // Creates the correction maps
1701   // Puts the results in the different TList objects
1702   Bool_t status = kTRUE;
1703
1704   TFile *file = TFile::Open(filename);
1705   if(!file) {
1706     cout<<"Could not find the input CORRFW file "<<filename<<endl;
1707     status = kFALSE;
1708   }
1709   TList *list = dynamic_cast<TList *>(file->Get("outputList"));
1710   Int_t iRap = 0, iPt = 1;
1711
1712   //Calculation of efficiency/correction: Protons
1713   AliCFContainer *gProtonContainer = dynamic_cast<AliCFContainer *>(list->At(0));
1714   AliCFEffGrid *effProtonsStep0Step2 = new AliCFEffGrid("eff20",
1715                                                         "effProtonsStep0Step2",
1716                                                         *gProtonContainer);
1717   effProtonsStep0Step2->CalculateEfficiency(2,0); 
1718   fHistEfficiencyYPtProtons = effProtonsStep0Step2->Project(iRap,iPt);
1719   fHistEfficiencyYPtProtons->Sumw2();
1720
1721   //Calculation of efficiency/correction: Protons
1722   AliCFContainer *gAntiProtonContainer = dynamic_cast<AliCFContainer *>(list->At(1));
1723   AliCFEffGrid *effAntiProtonsStep0Step2 = new AliCFEffGrid("eff20",
1724                                                             "effAntiProtonsStep0Step2",
1725                                                             *gAntiProtonContainer);
1726   effAntiProtonsStep0Step2->CalculateEfficiency(2,0); 
1727   fHistEfficiencyYPtAntiProtons = effAntiProtonsStep0Step2->Project(iRap,iPt);
1728   fHistEfficiencyYPtAntiProtons->Sumw2();
1729
1730   Correct();
1731
1732   return status;
1733 }
1734
1735 //____________________________________________________________________//
1736 /*Bool_t AliProtonAnalysis::ReadCorrectionContainer(const char* filename) {
1737   // Reads the outout of the correction framework task
1738   // Creates the correction maps
1739   // Puts the results in the different TList objects
1740   Bool_t status = kTRUE;
1741
1742   TFile *file = TFile::Open(filename);
1743   if(!file) {
1744     cout<<"Could not find the input CORRFW file "<<filename<<endl;
1745     status = kFALSE;
1746   }
1747
1748   //________________________________________//
1749   //Protons
1750   fEffGridListProtons = new TList();
1751   fCorrectionListProtons2D = new TList(); 
1752   fEfficiencyListProtons1D = new TList(); 
1753   fCorrectionListProtons1D = new TList();
1754   
1755   AliCFContainer *corrfwContainerProtons = (AliCFContainer*) (file->Get("containerProtons"));
1756   if(!corrfwContainerProtons) {
1757     cout<<"CORRFW container for protons not found!"<<endl;
1758     status = kFALSE;
1759   }
1760   
1761   Int_t nSteps = corrfwContainerProtons->GetNStep();
1762   TH2D *gYPt[4];
1763   //currently the GRID is formed by the y-pT parameters
1764   //Add Vz as a next step
1765   Int_t iRap = 0, iPt = 1;
1766   AliCFEffGrid *effProtonsStep0Step1 = new AliCFEffGrid("eff10",
1767                                          "effProtonsStep0Step1",
1768                                          *corrfwContainerProtons);
1769   effProtonsStep0Step1->CalculateEfficiency(1,0); //eff= step1/step0
1770   fEffGridListProtons->Add(effProtonsStep0Step1);
1771   gYPt[0] = effProtonsStep0Step1->Project(iRap,iPt);
1772   fCorrectionListProtons2D->Add(gYPt[0]);
1773   
1774   AliCFEffGrid *effProtonsStep0Step2 = new AliCFEffGrid("eff20",
1775                                          "effProtonsStep0Step2",
1776                                          *corrfwContainerProtons);
1777   effProtonsStep0Step2->CalculateEfficiency(2,0); //eff= step2/step0
1778   fEffGridListProtons->Add(effProtonsStep0Step2);
1779   gYPt[1] = effProtonsStep0Step2->Project(iRap,iPt);
1780   fCorrectionListProtons2D->Add(gYPt[1]);
1781
1782   AliCFEffGrid *effProtonsStep0Step3 = new AliCFEffGrid("eff30",
1783                                          "effProtonsStep0Step3",
1784                                          *corrfwContainerProtons);
1785   effProtonsStep0Step3->CalculateEfficiency(3,0); //eff= step1/step0
1786   fEffGridListProtons->Add(effProtonsStep0Step3);
1787   gYPt[2] = effProtonsStep0Step3->Project(iRap,iPt);
1788   fCorrectionListProtons2D->Add(gYPt[2]);
1789
1790   TH1D *gEfficiency[2][3]; //efficiency as a function of pT and of y (raws-[2])
1791   TH1D *gCorrection[2][3]; //efficiency as a function of pT and of y (raws-[2])
1792   TString gTitle;
1793   //Get the projection of the efficiency maps
1794   for(Int_t iParameter = 0; iParameter < 2; iParameter++) {
1795     gEfficiency[iParameter][0] = effProtonsStep0Step1->Project(iParameter);
1796     gTitle = "ProtonsEfficiency_Parameter"; gTitle += iParameter+1;
1797     gTitle += "_Step0_Step1"; 
1798     gEfficiency[iParameter][0]->SetName(gTitle.Data());
1799     fEfficiencyListProtons1D->Add(gEfficiency[iParameter][0]);  
1800     gTitle = "ProtonsCorrection_Parameter"; gTitle += iParameter+1;
1801     gTitle += "_Step0_Step1"; 
1802     gCorrection[iParameter][0] = new TH1D(gTitle.Data(),
1803                                           gTitle.Data(),
1804                                           gEfficiency[iParameter][0]->GetNbinsX(),
1805                                           gEfficiency[iParameter][0]->GetXaxis()->GetXmin(),
1806                                           gEfficiency[iParameter][0]->GetXaxis()->GetXmax());
1807     //initialisation of the correction
1808     for(Int_t iBin = 1; iBin <= gEfficiency[iParameter][0]->GetNbinsX(); iBin++)
1809       gCorrection[iParameter][0]->SetBinContent(iBin,1.0);
1810
1811     gEfficiency[iParameter][1] = effProtonsStep0Step2->Project(iParameter);
1812     gTitle = "ProtonsEfficiency_Parameter"; gTitle += iParameter+1;
1813     gTitle += "_Step0_Step2"; 
1814     gEfficiency[iParameter][1]->SetName(gTitle.Data());
1815     fEfficiencyListProtons1D->Add(gEfficiency[iParameter][1]);  
1816     gTitle = "ProtonsCorrection_Parameter"; gTitle += iParameter+1;
1817     gTitle += "_Step0_Step2"; 
1818     gCorrection[iParameter][1] = new TH1D(gTitle.Data(),
1819                                           gTitle.Data(),
1820                                           gEfficiency[iParameter][1]->GetNbinsX(),
1821                                           gEfficiency[iParameter][1]->GetXaxis()->GetXmin(),
1822                                           gEfficiency[iParameter][1]->GetXaxis()->GetXmax());
1823     //initialisation of the correction
1824     for(Int_t iBin = 1; iBin <= gEfficiency[iParameter][1]->GetNbinsX(); iBin++)
1825       gCorrection[iParameter][1]->SetBinContent(iBin,1.0);
1826
1827     gEfficiency[iParameter][2] = effProtonsStep0Step3->Project(iParameter);
1828     gTitle = "ProtonsEfficiency_Parameter"; gTitle += iParameter+1;
1829     gTitle += "_Step0_Step3"; 
1830     gEfficiency[iParameter][2]->SetName(gTitle.Data());
1831     fEfficiencyListProtons1D->Add(gEfficiency[iParameter][2]);  
1832     gTitle = "ProtonsCorrection_Parameter"; gTitle += iParameter+1;
1833     gTitle += "_Step0_Step3"; 
1834     gCorrection[iParameter][2] = new TH1D(gTitle.Data(),
1835                                           gTitle.Data(),
1836                                           gEfficiency[iParameter][2]->GetNbinsX(),
1837                                           gEfficiency[iParameter][2]->GetXaxis()->GetXmin(),
1838                                           gEfficiency[iParameter][2]->GetXaxis()->GetXmax());
1839     //initialisation of the correction
1840     for(Int_t iBin = 1; iBin <= gEfficiency[iParameter][2]->GetNbinsX(); iBin++)
1841       gCorrection[iParameter][2]->SetBinContent(iBin,1.0);
1842   }//parameter loop
1843   //Calculate the 1D correction parameters as a function of y and pT
1844   for(Int_t iParameter = 0; iParameter < 2; iParameter++) { 
1845     for(Int_t iStep = 1; iStep < nSteps; iStep++) { 
1846       gCorrection[iParameter][iStep-1]->Divide(gEfficiency[iParameter][iStep-1]);
1847       fCorrectionListProtons1D->Add(gCorrection[iParameter][iStep-1]);  
1848     }
1849   }
1850
1851   //________________________________________//
1852   //AntiProtons
1853   fEffGridListAntiProtons = new TList();
1854   fCorrectionListAntiProtons2D = new TList(); 
1855   fEfficiencyListAntiProtons1D = new TList(); 
1856   fCorrectionListAntiProtons1D = new TList();
1857   
1858   AliCFContainer *corrfwContainerAntiProtons = (AliCFContainer*) (file->Get("containerAntiProtons"));
1859   if(!corrfwContainerAntiProtons) {
1860     cout<<"CORRFW container for antiprotons not found!"<<endl;
1861     status = kFALSE;
1862   }
1863   
1864   nSteps = corrfwContainerAntiProtons->GetNStep();
1865   //currently the GRID is formed by the y-pT parameters
1866   //Add Vz as a next step
1867   AliCFEffGrid *effAntiProtonsStep0Step1 = new AliCFEffGrid("eff10",
1868                                          "effAntiProtonsStep0Step1",
1869                                          *corrfwContainerAntiProtons);
1870   effAntiProtonsStep0Step1->CalculateEfficiency(1,0); //eff= step1/step0
1871   fEffGridListAntiProtons->Add(effAntiProtonsStep0Step1);
1872   gYPt[0] = effAntiProtonsStep0Step1->Project(iRap,iPt);
1873   fCorrectionListAntiProtons2D->Add(gYPt[0]);
1874   
1875   AliCFEffGrid *effAntiProtonsStep0Step2 = new AliCFEffGrid("eff20",
1876                                          "effAntiProtonsStep0Step2",
1877                                          *corrfwContainerAntiProtons);
1878   effAntiProtonsStep0Step2->CalculateEfficiency(2,0); //eff= step2/step0
1879   fEffGridListAntiProtons->Add(effAntiProtonsStep0Step2);
1880   gYPt[1] = effAntiProtonsStep0Step2->Project(iRap,iPt);
1881   fCorrectionListAntiProtons2D->Add(gYPt[1]);
1882
1883   AliCFEffGrid *effAntiProtonsStep0Step3 = new AliCFEffGrid("eff30",
1884                                          "effAntiProtonsStep0Step3",
1885                                          *corrfwContainerAntiProtons);
1886   effAntiProtonsStep0Step3->CalculateEfficiency(3,0); //eff= step1/step0
1887   fEffGridListAntiProtons->Add(effAntiProtonsStep0Step3);
1888   gYPt[2] = effAntiProtonsStep0Step3->Project(iRap,iPt);
1889   fCorrectionListAntiProtons2D->Add(gYPt[2]);
1890
1891   //Get the projection of the efficiency maps
1892   for(Int_t iParameter = 0; iParameter < 2; iParameter++) {
1893     gEfficiency[iParameter][0] = effAntiProtonsStep0Step1->Project(iParameter);
1894     gTitle = "AntiProtonsEfficiency_Parameter"; gTitle += iParameter+1;
1895     gTitle += "_Step0_Step1"; 
1896     gEfficiency[iParameter][0]->SetName(gTitle.Data());
1897     fEfficiencyListAntiProtons1D->Add(gEfficiency[iParameter][0]);  
1898     gTitle = "AntiProtonsCorrection_Parameter"; gTitle += iParameter+1;
1899     gTitle += "_Step0_Step1"; 
1900     gCorrection[iParameter][0] = new TH1D(gTitle.Data(),
1901                                           gTitle.Data(),
1902                                           gEfficiency[iParameter][0]->GetNbinsX(),
1903                                           gEfficiency[iParameter][0]->GetXaxis()->GetXmin(),
1904                                           gEfficiency[iParameter][0]->GetXaxis()->GetXmax());
1905     //initialisation of the correction
1906     for(Int_t iBin = 1; iBin <= gEfficiency[iParameter][0]->GetNbinsX(); iBin++)
1907       gCorrection[iParameter][0]->SetBinContent(iBin,1.0);
1908
1909     gEfficiency[iParameter][1] = effAntiProtonsStep0Step2->Project(iParameter);
1910     gTitle = "AntiProtonsEfficiency_Parameter"; gTitle += iParameter+1;
1911     gTitle += "_Step0_Step2"; 
1912     gEfficiency[iParameter][1]->SetName(gTitle.Data());
1913     fEfficiencyListAntiProtons1D->Add(gEfficiency[iParameter][1]);  
1914     gTitle = "AntiProtonsCorrection_Parameter"; gTitle += iParameter+1;
1915     gTitle += "_Step0_Step2"; 
1916     gCorrection[iParameter][1] = new TH1D(gTitle.Data(),
1917                                           gTitle.Data(),
1918                                           gEfficiency[iParameter][1]->GetNbinsX(),
1919                                           gEfficiency[iParameter][1]->GetXaxis()->GetXmin(),
1920                                           gEfficiency[iParameter][1]->GetXaxis()->GetXmax());
1921     //initialisation of the correction
1922     for(Int_t iBin = 1; iBin <= gEfficiency[iParameter][1]->GetNbinsX(); iBin++)
1923       gCorrection[iParameter][1]->SetBinContent(iBin,1.0);
1924
1925     gEfficiency[iParameter][2] = effAntiProtonsStep0Step3->Project(iParameter);
1926     gTitle = "AntiProtonsEfficiency_Parameter"; gTitle += iParameter+1;
1927     gTitle += "_Step0_Step3"; 
1928     gEfficiency[iParameter][2]->SetName(gTitle.Data());
1929     fEfficiencyListAntiProtons1D->Add(gEfficiency[iParameter][2]);  
1930     gTitle = "AntiProtonsCorrection_Parameter"; gTitle += iParameter+1;
1931     gTitle += "_Step0_Step3"; 
1932     gCorrection[iParameter][2] = new TH1D(gTitle.Data(),
1933                                           gTitle.Data(),
1934                                           gEfficiency[iParameter][2]->GetNbinsX(),
1935                                           gEfficiency[iParameter][2]->GetXaxis()->GetXmin(),
1936                                           gEfficiency[iParameter][2]->GetXaxis()->GetXmax());
1937     //initialisation of the correction
1938     for(Int_t iBin = 1; iBin <= gEfficiency[iParameter][2]->GetNbinsX(); iBin++)
1939       gCorrection[iParameter][2]->SetBinContent(iBin,1.0);
1940   }//parameter loop
1941   //Calculate the 1D correction parameters as a function of y and pT
1942   for(Int_t iParameter = 0; iParameter < 2; iParameter++) { 
1943     for(Int_t iStep = 1; iStep < nSteps; iStep++) { 
1944       gCorrection[iParameter][iStep-1]->Divide(gEfficiency[iParameter][iStep-1]);
1945       fCorrectionListAntiProtons1D->Add(gCorrection[iParameter][iStep-1]);  
1946     }
1947   }
1948
1949   return status;
1950   }*/
1951  
1952 //____________________________________________________________________//
1953 void AliProtonAnalysis::InitQA() {
1954   //Applies the correction maps to the initial containers
1955   fGlobalQAList = new TList();
1956   fGlobalQAList->SetName("fGlobalQAList");
1957
1958   //========================================================//
1959   fQA2DList = new TList();
1960   fQA2DList->SetName("fQA2DList");
1961   fGlobalQAList->Add(fQA2DList);
1962
1963   //dEdx plots
1964   TH2F *gHistdEdxP = new TH2F("gHistdEdxP","dE/dx (TPC); P [GeV/c]; dE/dx [a.u]",1000,0.05,20.05,600,0,600);
1965   fQA2DList->Add(gHistdEdxP);
1966   TH2F *gHistProtonsdEdxP = new TH2F("gHistProtonsdEdxP","Accepted protons dE/dx (TPC); P [GeV/c]; dE/dx [a.u]",1000,0.05,20.05,600,0,600);
1967   fQA2DList->Add(gHistProtonsdEdxP);
1968
1969   //normalized dEdx plots
1970   TH2F *gHistZP = new TH2F("gHistZP","Normalized dE/dx (TPC); P [GeV/c]; ln[(dE/dx)_{exp.}/(dE/dx)_{BB}] ",1000,0.05,20.05,100,-2.0,2.0);
1971   fQA2DList->Add(gHistZP);
1972   TH2F *gHistProtonsZP = new TH2F("gHistProtonsZP","Normalized dE/dx (TPC); P [GeV/c]; ln[(dE/dx)_{exp.}/(dE/dx)_{BB}] ",1000,0.05,20.05,100,-2.0,2.0);
1973   fQA2DList->Add(gHistProtonsZP);
1974
1975   //eta-phi-Npoints(dEdx)
1976   TH3F *gHistEtaPhiTPCdEdxNPoints = new TH3F("gHistEtaPhiTPCdEdxNPoints",
1977                                              ";#eta;#phi;N_{points}(TPC)",
1978                                              18,-0.9,0.9,
1979                                              180,0,360,
1980                                              100,0,200);
1981   gHistEtaPhiTPCdEdxNPoints->SetStats(kTRUE);
1982   fQA2DList->Add(gHistEtaPhiTPCdEdxNPoints);
1983   TH3F *gHistProtonsEtaPhiTPCdEdxNPoints = new TH3F("gHistProtonsEtaPhiTPCdEdxNPoints",
1984                                                     ";#eta;#phi;N_{points}(TPC)",
1985                                                     18,-0.9,0.9,
1986                                                     180,0,360,
1987                                                     100,0,200);
1988   gHistProtonsEtaPhiTPCdEdxNPoints->SetStats(kTRUE);
1989   fQA2DList->Add(gHistProtonsEtaPhiTPCdEdxNPoints);
1990
1991   //eta-phi-Npoints
1992   TH3F *gHistEtaPhiTPCNPoints = new TH3F("gHistEtaPhiTPCNPoints",
1993                                          ";#eta;#phi;N_{points}(TPC)",
1994                                          18,-0.9,0.9,
1995                                          180,0,360,
1996                                          100,0,200);
1997   gHistEtaPhiTPCNPoints->SetStats(kTRUE);
1998   fQA2DList->Add(gHistEtaPhiTPCNPoints);
1999   TH3F *gHistProtonsEtaPhiTPCNPoints = new TH3F("gHistProtonsEtaPhiTPCNPoints",
2000                                                 ";#eta;#phi;N_{points}(TPC)",
2001                                                 18,-0.9,0.9,
2002                                                 180,0,360,
2003                                                 100,0,200);
2004   gHistProtonsEtaPhiTPCNPoints->SetStats(kTRUE);
2005   fQA2DList->Add(gHistProtonsEtaPhiTPCNPoints);
2006
2007   //pt-phi-Npoints(dEdx)
2008   TH3F *gHistPtPhiTPCdEdxNPoints = new TH3F("gHistPtPhiTPCdEdxNPoints",
2009                                             ";P_{T} [GeV/c];#phi;N_{points}(TPC)",
2010                                             fNBinsPt,fMinPt,fMaxPt,
2011                                             180,0,360,
2012                                             100,0,200);
2013   gHistPtPhiTPCdEdxNPoints->SetStats(kTRUE);
2014   fQA2DList->Add(gHistPtPhiTPCdEdxNPoints);
2015   TH3F *gHistProtonsPtPhiTPCdEdxNPoints = new TH3F("gHistProtonsPtPhiTPCdEdxNPoints",
2016                                                     ";P_{T} [GeV/c];#phi;N_{points}(TPC)",
2017                                                     fNBinsPt,fMinPt,fMaxPt,
2018                                                     180,0,360,
2019                                                     100,0,200);
2020   gHistProtonsPtPhiTPCdEdxNPoints->SetStats(kTRUE);
2021   fQA2DList->Add(gHistProtonsPtPhiTPCdEdxNPoints);
2022
2023   //pt-phi-Npoints
2024   TH3F *gHistPtPhiTPCNPoints = new TH3F("gHistPtPhiTPCNPoints",
2025                                         ";P_{T} [GeV/c];#phi;N_{points}(TPC)",
2026                                         fNBinsPt,fMinPt,fMaxPt,
2027                                         180,0,360,
2028                                         100,0,200);
2029   gHistPtPhiTPCNPoints->SetStats(kTRUE);
2030   fQA2DList->Add(gHistPtPhiTPCNPoints);
2031   TH3F *gHistProtonsPtPhiTPCNPoints = new TH3F("gHistProtonsPtPhiTPCNPoints",
2032                                                ";P_{T} [GeV/c];#phi;N_{points}(TPC)",
2033                                                fNBinsPt,fMinPt,fMaxPt,
2034                                                180,0,360,
2035                                                100,0,200);
2036   gHistProtonsPtPhiTPCNPoints->SetStats(kTRUE);
2037   fQA2DList->Add(gHistProtonsPtPhiTPCNPoints);
2038
2039   //eta-phi for protons & antiprotons
2040   TH2F *gHistProtonsEtaPhi = new TH2F("gHistProtonsEtaPhi",
2041                                       ";#eta;#phi",
2042                                       18,-0.9,0.9,
2043                                       180,0,360);
2044   gHistProtonsEtaPhi->SetStats(kTRUE);
2045   fQA2DList->Add(gHistProtonsEtaPhi);
2046   TH2F *gHistAntiProtonsEtaPhi = new TH2F("gHistAntiProtonsEtaPhi",
2047                                           ";#eta;#phi",
2048                                           18,-0.9,0.9,
2049                                           180,0,360);
2050   gHistAntiProtonsEtaPhi->SetStats(kTRUE);
2051   fQA2DList->Add(gHistAntiProtonsEtaPhi);
2052
2053   const Int_t nBinsdca = 1000;
2054   Double_t dcaBins[nBinsdca+1];
2055   Double_t dcamin = -5., dcamax = 5.;
2056   Double_t dca = -5.;
2057   Double_t dcaStepSmall = 0.01;
2058   Int_t iCounter = 0;
2059   while(dca <= 5.) {
2060     dcaBins[iCounter] = dcamin;
2061     dcamax = dcamin + dcaStepSmall;
2062     dca = dcamax;
2063     dcamin = dcamax;
2064     iCounter += 1;
2065   }
2066
2067   const Int_t nBinsY = 9;
2068   const Int_t nBinsPt = 6;
2069   Double_t gY[nBinsY+1] = {-0.9,-0.7,-0.5,-0.3,-0.1,0.1,0.3,0.5,0.7,0.9};
2070   Double_t gPt[nBinsPt+1] = {0.45,0.55,0.65,0.75,0.85,0.95,1.05};
2071
2072   //dca vs pT for protons & antiprotons
2073   TH3F *gHistProtonsDCAxyEtaPt = new TH3F("gHistProtonsDCAxyEtaPt",
2074                                           ";P_{T} [GeV/c];dca_{xy} [cm]",
2075                                           nBinsY,gY,nBinsPt,gPt,
2076                                           nBinsdca,dcaBins);
2077   if(fProtonAnalysisBase->GetEtaMode())
2078     gHistProtonsDCAxyEtaPt->GetXaxis()->SetTitle("#eta");
2079   else
2080     gHistProtonsDCAxyEtaPt->GetXaxis()->SetTitle("y");
2081   gHistProtonsDCAxyEtaPt->SetStats(kTRUE);
2082   fQA2DList->Add(gHistProtonsDCAxyEtaPt);
2083   TH3F *gHistProtonsDCAzEtaPt = new TH3F("gHistProtonsDCAzEtaPt",
2084                                          ";P_{T} [GeV/c];dca_{z} [cm]",
2085                                          nBinsY,gY,nBinsPt,gPt,
2086                                          nBinsdca,dcaBins);
2087   if(fProtonAnalysisBase->GetEtaMode())
2088     gHistProtonsDCAzEtaPt->GetXaxis()->SetTitle("#eta");
2089   else
2090     gHistProtonsDCAzEtaPt->GetXaxis()->SetTitle("y");
2091   gHistProtonsDCAzEtaPt->SetStats(kTRUE);
2092   fQA2DList->Add(gHistProtonsDCAzEtaPt);
2093   TH3F *gHistAntiProtonsDCAxyEtaPt = new TH3F("gHistAntiProtonsDCAxyEtaPt",
2094                                               ";P_{T} [GeV/c];dca_{xy} [cm]",
2095                                               nBinsY,gY,nBinsPt,gPt,
2096                                               nBinsdca,dcaBins);
2097   if(fProtonAnalysisBase->GetEtaMode())
2098     gHistAntiProtonsDCAxyEtaPt->GetXaxis()->SetTitle("#eta");
2099   else
2100     gHistAntiProtonsDCAxyEtaPt->GetXaxis()->SetTitle("y");
2101   gHistAntiProtonsDCAxyEtaPt->SetStats(kTRUE);
2102   fQA2DList->Add(gHistAntiProtonsDCAxyEtaPt);
2103   TH3F *gHistAntiProtonsDCAzEtaPt = new TH3F("gHistAntiProtonsDCAzEtaPt",
2104                                              ";P_{T} [GeV/c];dca_{z} [cm]",
2105                                              nBinsY,gY,nBinsPt,gPt,
2106                                              nBinsdca,dcaBins);
2107   if(fProtonAnalysisBase->GetEtaMode())
2108     gHistAntiProtonsDCAzEtaPt->GetXaxis()->SetTitle("#eta");
2109   else
2110     gHistAntiProtonsDCAzEtaPt->GetXaxis()->SetTitle("y");
2111   gHistAntiProtonsDCAzEtaPt->SetStats(kTRUE);
2112   fQA2DList->Add(gHistAntiProtonsDCAzEtaPt);
2113
2114   TH3F *gHistProtonsDCA3DEtaPt = new TH3F("gHistProtonsDCA3DEtaPt",
2115                                           ";P_{T} [GeV/c];dca [cm]",
2116                                           fNBinsY,fMinY,fMaxY,
2117                                           fNBinsPt,fMinPt,fMaxPt,
2118                                           100,0,20);
2119   if(fProtonAnalysisBase->GetEtaMode())
2120     gHistProtonsDCA3DEtaPt->GetXaxis()->SetTitle("#eta");
2121   else
2122     gHistProtonsDCA3DEtaPt->GetXaxis()->SetTitle("y");
2123   gHistProtonsDCA3DEtaPt->SetStats(kTRUE);
2124   fQA2DList->Add(gHistProtonsDCA3DEtaPt);
2125   TH3F *gHistAntiProtonsDCA3DEtaPt = new TH3F("gHistAntiProtonsDCA3DEtaPt",
2126                                               ";P_{T} [GeV/c];dca [cm]",
2127                                               fNBinsY,fMinY,fMaxY,
2128                                               fNBinsPt,fMinPt,fMaxPt,
2129                                               100,0,20);
2130   if(fProtonAnalysisBase->GetEtaMode())
2131     gHistAntiProtonsDCA3DEtaPt->GetXaxis()->SetTitle("#eta");
2132   else
2133     gHistAntiProtonsDCA3DEtaPt->GetXaxis()->SetTitle("y");
2134   gHistAntiProtonsDCA3DEtaPt->SetStats(kTRUE);
2135   fQA2DList->Add(gHistAntiProtonsDCA3DEtaPt);
2136
2137   TH2F *gHistPosdEdxP = new TH2F("gHistPosdEdxP","dE/dx (TPC); P [GeV/c]; dE/dx [a.u]",1000,0.05,20.05,600,0,600);
2138   fQA2DList->Add(gHistPosdEdxP);
2139   TH2F *gHistNegdEdxP = new TH2F("gHistNegdEdxP","dE/dx (TPC); P [GeV/c]; dE/dx [a.u]",1000,0.05,20.05,600,0,600);
2140   fQA2DList->Add(gHistNegdEdxP);
2141
2142   //========================================================//
2143   fQAProtonsAcceptedList = new TList();
2144   fQAProtonsAcceptedList->SetName("fQAProtonsAcceptedList");
2145   fGlobalQAList->Add(fQAProtonsAcceptedList);
2146   //Accepted protons
2147   TH1F *gProtonsITSClustersPass = new TH1F("gProtonsITSClustersPass",
2148                                             ";N_{clusters} (ITS);Entries",
2149                                             7,0,7);
2150   fQAProtonsAcceptedList->Add(gProtonsITSClustersPass);
2151   TH1F *gProtonsChi2PerClusterITSPass = new TH1F("gProtonsChi2PerClusterITSPass",
2152                                                  ";x^{2}/N_{clusters} (ITS);Entries",
2153                                                  100,0,4);
2154   fQAProtonsAcceptedList->Add(gProtonsChi2PerClusterITSPass);
2155   TH1F *gProtonsTPCClustersPass = new TH1F("gProtonsTPCClustersPass",
2156                                            ";N_{clusters} (TPC);Entries",
2157                                            100,0,200);
2158   fQAProtonsAcceptedList->Add(gProtonsTPCClustersPass);
2159   TH1F *gProtonsChi2PerClusterTPCPass = new TH1F("gProtonsChi2PerClusterTPCPass",
2160                                                  ";x^{2}/N_{clusters} (TPC);Entries",
2161                                                  100,0,4);
2162   fQAProtonsAcceptedList->Add(gProtonsChi2PerClusterTPCPass);
2163   TH1F *gProtonsExtCov11Pass = new TH1F("gProtonsExtCov11Pass",
2164                                         ";#sigma_{y} [cm];Entries",
2165                                         100,0,4);
2166   fQAProtonsAcceptedList->Add(gProtonsExtCov11Pass);
2167   TH1F *gProtonsExtCov22Pass = new TH1F("gProtonsExtCov22Pass",
2168                                         ";#sigma_{z} [cm];Entries",
2169                                         100,0,4);
2170   fQAProtonsAcceptedList->Add(gProtonsExtCov22Pass);
2171   TH1F *gProtonsExtCov33Pass = new TH1F("gProtonsExtCov33Pass",
2172                                         ";#sigma_{sin(#phi)};Entries",
2173                                         100,0,4);
2174   fQAProtonsAcceptedList->Add(gProtonsExtCov33Pass);
2175   TH1F *gProtonsExtCov44Pass = new TH1F("gProtonsExtCov44Pass",
2176                                         ";#sigma_{tan(#lambda)};Entries",
2177                                         100,0,4);
2178   fQAProtonsAcceptedList->Add(gProtonsExtCov44Pass);
2179   TH1F *gProtonsExtCov55Pass = new TH1F("gProtonsExtCov55Pass",
2180                                         ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2181                                         100,0,4);
2182   fQAProtonsAcceptedList->Add(gProtonsExtCov55Pass);
2183   TH1F *gProtonsSigmaToVertexPass = new TH1F("gProtonsSigmaToVertexPass",
2184                                              ";#sigma_{Vertex};Entries",
2185                                              100,0.,10.);
2186   fQAProtonsAcceptedList->Add(gProtonsSigmaToVertexPass);
2187   TH1F *gProtonsSigmaToVertexTPCPass = new TH1F("gProtonsSigmaToVertexTPCPass",
2188                                                 ";#sigma_{Vertex};Entries",
2189                                                 100,0.,10.);
2190   fQAProtonsAcceptedList->Add(gProtonsSigmaToVertexTPCPass);
2191   TH1F *gProtonsDCAXYPass = new TH1F("gProtonsDCAXYPass",
2192                                      ";DCA_{xy} [cm];Entries",
2193                                      100,0,20);
2194   fQAProtonsAcceptedList->Add(gProtonsDCAXYPass);
2195   TH1F *gProtonsDCAXYTPCPass = new TH1F("gProtonsDCAXYTPCPass",
2196                                         ";DCA_{xy} [cm];Entries",
2197                                         100,0,20);
2198   fQAProtonsAcceptedList->Add(gProtonsDCAXYTPCPass);
2199   TH1F *gProtonsDCAZPass = new TH1F("gProtonsDCAZPass",
2200                                     ";DCA_{z} [cm];Entries",
2201                                     100,0,20);
2202   fQAProtonsAcceptedList->Add(gProtonsDCAZPass);
2203   TH1F *gProtonsDCAZTPCPass = new TH1F("gProtonsDCAZTPCPass",
2204                                        ";DCA_{z} [cm];Entries",
2205                                        100,0,20);
2206   fQAProtonsAcceptedList->Add(gProtonsDCAZTPCPass);
2207   TH1F *gProtonsConstrainChi2Pass = new TH1F("gProtonsConstrainChi2Pass",
2208                                              ";Log_{10}(#chi^{2});Entries",
2209                                              100,-10,10);
2210   fQAProtonsAcceptedList->Add(gProtonsConstrainChi2Pass);
2211   TH1F *gProtonsITSRefitPass = new TH1F("gProtonsITSRefitPass",
2212                                         "",10,-1,1);
2213   fQAProtonsAcceptedList->Add(gProtonsITSRefitPass);
2214   TH1F *gProtonsTPCRefitPass = new TH1F("gProtonsTPCRefitPass",
2215                                         "",10,-1,1);
2216   fQAProtonsAcceptedList->Add(gProtonsTPCRefitPass);
2217   TH1F *gProtonsESDpidPass = new TH1F("gProtonsESDpidPass",
2218                                       "",10,-1,1);
2219   fQAProtonsAcceptedList->Add(gProtonsESDpidPass);
2220   TH1F *gProtonsTPCpidPass = new TH1F("gProtonsTPCpidPass",
2221                                       "",10,-1,1);
2222   fQAProtonsAcceptedList->Add(gProtonsTPCpidPass);
2223   TH1F *gProtonsPointOnITSLayer1Pass = new TH1F("gProtonsPointOnITSLayer1Pass",
2224                                                 "",10,-1,1);
2225   fQAProtonsAcceptedList->Add(gProtonsPointOnITSLayer1Pass);
2226   TH1F *gProtonsPointOnITSLayer2Pass = new TH1F("gProtonsPointOnITSLayer2Pass",
2227                                                 "",10,-1,1);
2228   fQAProtonsAcceptedList->Add(gProtonsPointOnITSLayer2Pass);
2229   TH1F *gProtonsPointOnITSLayer3Pass = new TH1F("gProtonsPointOnITSLayer3Pass",
2230                                                 "",10,-1,1);
2231   fQAProtonsAcceptedList->Add(gProtonsPointOnITSLayer3Pass);
2232   TH1F *gProtonsPointOnITSLayer4Pass = new TH1F("gProtonsPointOnITSLayer4Pass",
2233                                                 "",10,-1,1);
2234   fQAProtonsAcceptedList->Add(gProtonsPointOnITSLayer4Pass);
2235   TH1F *gProtonsPointOnITSLayer5Pass = new TH1F("gProtonsPointOnITSLayer5Pass",
2236                                                 "",10,-1,1);
2237   fQAProtonsAcceptedList->Add(gProtonsPointOnITSLayer5Pass);
2238   TH1F *gProtonsPointOnITSLayer6Pass = new TH1F("gProtonsPointOnITSLayer6Pass",
2239                                                 "",10,-1,1);
2240   fQAProtonsAcceptedList->Add(gProtonsPointOnITSLayer6Pass);
2241   TH1F *gProtonsNumberOfTPCdEdxPointsPass = new TH1F("gProtonsNumberOfTPCdEdxPointsPass","",100,0,200);
2242   fQAProtonsAcceptedList->Add(gProtonsNumberOfTPCdEdxPointsPass);
2243   TH1F *gProtonsITSClusterMapPass = new TH1F("gProtonsITSClusterMapPass",";ITS Layer;Entries",6,0.5,6.5);
2244   fQAProtonsAcceptedList->Add(gProtonsITSClusterMapPass);
2245   TH1F *gProtonsDCA3DPass = new TH1F("gProtonsDCA3DPass",
2246                                      ";dca [cm];Entries",
2247                                      100,0,20);
2248   fQAProtonsAcceptedList->Add(gProtonsDCA3DPass);
2249
2250   //========================================================//  
2251   fQAProtonsRejectedList = new TList();
2252   fQAProtonsRejectedList->SetName("fQAProtonsRejectedList");
2253   fGlobalQAList->Add(fQAProtonsRejectedList);
2254   //Rejected protons
2255   TH1F *gProtonsITSClustersReject = new TH1F("gProtonsITSClustersReject",
2256                                              ";N_{clusters} (ITS);Entries",
2257                                              7,0,7);
2258   gProtonsITSClustersReject->SetFillColor(kRed-2);
2259   fQAProtonsRejectedList->Add(gProtonsITSClustersReject);
2260   TH1F *gProtonsChi2PerClusterITSReject = new TH1F("gProtonsChi2PerClusterITSReject",
2261                                                    ";x^{2}/N_{clusters} (ITS);Entries",
2262                                                    100,0,4);
2263   gProtonsChi2PerClusterITSReject->SetFillColor(kRed-2);
2264   fQAProtonsRejectedList->Add(gProtonsChi2PerClusterITSReject);
2265   TH1F *gProtonsTPCClustersReject = new TH1F("gProtonsTPCClustersReject",
2266                                              ";N_{clusters} (TPC);Entries",
2267                                              100,0,200);
2268   gProtonsTPCClustersReject->SetFillColor(kRed-2);
2269   fQAProtonsRejectedList->Add(gProtonsTPCClustersReject);
2270   TH1F *gProtonsChi2PerClusterTPCReject = new TH1F("gProtonsChi2PerClusterTPCReject",
2271                                                    ";x^{2}/N_{clusters} (TPC);Entries",
2272                                                    100,0,4);
2273   gProtonsChi2PerClusterTPCReject->SetFillColor(kRed-2);
2274   fQAProtonsRejectedList->Add(gProtonsChi2PerClusterTPCReject);
2275   TH1F *gProtonsExtCov11Reject = new TH1F("gProtonsExtCov11Reject",
2276                                           ";#sigma_{y} [cm];Entries",
2277                                           100,0,4);
2278   gProtonsExtCov11Reject->SetFillColor(kRed-2);
2279   fQAProtonsRejectedList->Add(gProtonsExtCov11Reject);
2280   TH1F *gProtonsExtCov22Reject = new TH1F("gProtonsExtCov22Reject",
2281                                           ";#sigma_{z} [cm];Entries",
2282                                           100,0,4);
2283   gProtonsExtCov22Reject->SetFillColor(kRed-2);
2284   fQAProtonsRejectedList->Add(gProtonsExtCov22Reject);
2285   TH1F *gProtonsExtCov33Reject = new TH1F("gProtonsExtCov33Reject",
2286                                           ";#sigma_{sin(#phi)};Entries",
2287                                           100,0,4);
2288   gProtonsExtCov33Reject->SetFillColor(kRed-2);
2289   fQAProtonsRejectedList->Add(gProtonsExtCov33Reject);
2290   TH1F *gProtonsExtCov44Reject = new TH1F("gProtonsExtCov44Reject",
2291                                           ";#sigma_{tan(#lambda)};Entries",
2292                                           100,0,4);
2293   gProtonsExtCov44Reject->SetFillColor(kRed-2);
2294   fQAProtonsRejectedList->Add(gProtonsExtCov44Reject);
2295   TH1F *gProtonsExtCov55Reject = new TH1F("gProtonsExtCov55Reject",
2296                                           ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2297                                           100,0,4);
2298   gProtonsExtCov55Reject->SetFillColor(kRed-2);
2299   fQAProtonsRejectedList->Add(gProtonsExtCov55Reject);
2300   TH1F *gProtonsSigmaToVertexReject = new TH1F("gProtonsSigmaToVertexReject",
2301                                                ";#sigma_{Vertex};Entries",
2302                                                100,0,10);
2303   gProtonsSigmaToVertexReject->SetFillColor(kRed-2);
2304   fQAProtonsRejectedList->Add(gProtonsSigmaToVertexReject);
2305   TH1F *gProtonsSigmaToVertexTPCReject = new TH1F("gProtonsSigmaToVertexTPCReject",
2306                                                   ";#sigma_{Vertex};Entries",
2307                                                   100,0,10);
2308   gProtonsSigmaToVertexTPCReject->SetFillColor(kRed-2);
2309   fQAProtonsRejectedList->Add(gProtonsSigmaToVertexTPCReject);
2310   TH1F *gProtonsDCAXYReject = new TH1F("gProtonsDCAXYReject",
2311                                        ";DCA_{xy} [cm];Entries",
2312                                        100,0,20);
2313   gProtonsDCAXYReject->SetFillColor(kRed-2);
2314   fQAProtonsRejectedList->Add(gProtonsDCAXYReject);
2315   TH1F *gProtonsDCAXYTPCReject = new TH1F("gProtonsDCAXYTPCReject",
2316                                           ";DCA_{xy} [cm];Entries",
2317                                           100,0,20);
2318   gProtonsDCAXYTPCReject->SetFillColor(kRed-2);
2319   fQAProtonsRejectedList->Add(gProtonsDCAXYTPCReject);
2320   TH1F *gProtonsDCAZReject = new TH1F("gProtonsDCAZReject",
2321                                       ";DCA_{z} [cm];Entries",
2322                                       100,0,20);
2323   gProtonsDCAZReject->SetFillColor(kRed-2);
2324   fQAProtonsRejectedList->Add(gProtonsDCAZReject);
2325   TH1F *gProtonsDCAZTPCReject = new TH1F("gProtonsDCAZTPCReject",
2326                                          ";DCA_{z} [cm];Entries",
2327                                          100,0,20);
2328   gProtonsDCAZTPCReject->SetFillColor(kRed-2);
2329   fQAProtonsRejectedList->Add(gProtonsDCAZTPCReject);
2330   TH1F *gProtonsConstrainChi2Reject = new TH1F("gProtonsConstrainChi2Reject",
2331                                                ";Log_{10}(#chi^{2});Entries",
2332                                                100,-10,10);
2333   gProtonsConstrainChi2Reject->SetFillColor(kRed-2);
2334   fQAProtonsRejectedList->Add(gProtonsConstrainChi2Reject);
2335   TH1F *gProtonsITSRefitReject = new TH1F("gProtonsITSRefitReject",
2336                                           "",10,-1,1);
2337   gProtonsITSRefitReject->SetFillColor(kRed-2);
2338   fQAProtonsRejectedList->Add(gProtonsITSRefitReject);
2339   TH1F *gProtonsTPCRefitReject = new TH1F("gProtonsTPCRefitReject",
2340                                           "",10,-1,1);
2341   gProtonsTPCRefitReject->SetFillColor(kRed-2);
2342   fQAProtonsRejectedList->Add(gProtonsTPCRefitReject);
2343   TH1F *gProtonsESDpidReject = new TH1F("gProtonsESDpidReject",
2344                                         "",10,-1,1);
2345   gProtonsESDpidReject->SetFillColor(kRed-2);
2346   fQAProtonsRejectedList->Add(gProtonsESDpidReject);
2347   TH1F *gProtonsTPCpidReject = new TH1F("gProtonsTPCpidReject",
2348                                         "",10,-1,1);
2349   gProtonsTPCpidReject->SetFillColor(kRed-2);
2350   fQAProtonsRejectedList->Add(gProtonsTPCpidReject);
2351   TH1F *gProtonsPointOnITSLayer1Reject = new TH1F("gProtonsPointOnITSLayer1Reject",
2352                                                   "",10,-1,1);
2353   gProtonsPointOnITSLayer1Reject->SetFillColor(kRed-2);
2354   fQAProtonsRejectedList->Add(gProtonsPointOnITSLayer1Reject);
2355   TH1F *gProtonsPointOnITSLayer2Reject = new TH1F("gProtonsPointOnITSLayer2Reject",
2356                                                   "",10,-1,1);
2357   gProtonsPointOnITSLayer2Reject->SetFillColor(kRed-2);
2358   fQAProtonsRejectedList->Add(gProtonsPointOnITSLayer2Reject);
2359   TH1F *gProtonsPointOnITSLayer3Reject = new TH1F("gProtonsPointOnITSLayer3Reject",
2360                                                   "",10,-1,1);
2361   gProtonsPointOnITSLayer3Reject->SetFillColor(kRed-2);
2362   fQAProtonsRejectedList->Add(gProtonsPointOnITSLayer3Reject);
2363   TH1F *gProtonsPointOnITSLayer4Reject = new TH1F("gProtonsPointOnITSLayer4Reject",
2364                                                   "",10,-1,1);
2365   gProtonsPointOnITSLayer4Reject->SetFillColor(kRed-2);
2366   fQAProtonsRejectedList->Add(gProtonsPointOnITSLayer4Reject);
2367   TH1F *gProtonsPointOnITSLayer5Reject = new TH1F("gProtonsPointOnITSLayer5Reject",
2368                                                   "",10,-1,1);
2369   gProtonsPointOnITSLayer5Reject->SetFillColor(kRed-2);
2370   fQAProtonsRejectedList->Add(gProtonsPointOnITSLayer5Reject);
2371   TH1F *gProtonsPointOnITSLayer6Reject = new TH1F("gProtonsPointOnITSLayer6Reject",
2372                                                   "",10,-1,1);
2373   gProtonsPointOnITSLayer6Reject->SetFillColor(kRed-2);
2374   fQAProtonsRejectedList->Add(gProtonsPointOnITSLayer6Reject);
2375   TH1F *gProtonsNumberOfTPCdEdxPointsReject = new TH1F("gProtonsNumberOfTPCdEdxPointsReject","",100,0,200);
2376   gProtonsNumberOfTPCdEdxPointsReject->SetFillColor(kRed-2);
2377   fQAProtonsRejectedList->Add(gProtonsNumberOfTPCdEdxPointsReject);
2378   TH1F *gProtonsITSClusterMapReject = new TH1F("gProtonsITSClusterMapReject",";ITS Layer;Entries",6,0.5,6.5);
2379   gProtonsITSClusterMapReject->SetFillColor(kRed-2);
2380   fQAProtonsRejectedList->Add(gProtonsITSClusterMapReject);
2381   TH1F *gProtonsDCA3DReject = new TH1F("gProtonsDCA3DReject",
2382                                        ";dca [cm];Entries",
2383                                        100,0,20);
2384   gProtonsDCA3DReject->SetFillColor(kRed-2);
2385   fQAProtonsRejectedList->Add(gProtonsDCA3DReject);
2386     
2387   //========================================================//
2388   fQAAntiProtonsAcceptedList = new TList();
2389   fQAAntiProtonsAcceptedList->SetName("fQAAntiProtonsAcceptedList");
2390   fGlobalQAList->Add(fQAAntiProtonsAcceptedList);
2391   //Accepted antiprotons
2392   TH1F *gAntiProtonsITSClustersPass = new TH1F("gAntiProtonsITSClustersPass",
2393                                                ";N_{clusters} (ITS);Entries",
2394                                                7,0,7);
2395   fQAAntiProtonsAcceptedList->Add(gAntiProtonsITSClustersPass);
2396   TH1F *gAntiProtonsChi2PerClusterITSPass = new TH1F("gAntiProtonsChi2PerClusterITSPass",
2397                                                      ";x^{2}/N_{clusters} (ITS);Entries",
2398                                                      100,0,4);
2399   fQAAntiProtonsAcceptedList->Add(gAntiProtonsChi2PerClusterITSPass);
2400   TH1F *gAntiProtonsTPCClustersPass = new TH1F("gAntiProtonsTPCClustersPass",
2401                                                ";N_{clusters} (TPC);Entries",
2402                                                100,0,200);
2403   fQAAntiProtonsAcceptedList->Add(gAntiProtonsTPCClustersPass);
2404   TH1F *gAntiProtonsChi2PerClusterTPCPass = new TH1F("gAntiProtonsChi2PerClusterTPCPass",
2405                                                      ";x^{2}/N_{clusters} (TPC);Entries",
2406                                                      100,0,4);
2407   fQAAntiProtonsAcceptedList->Add(gAntiProtonsChi2PerClusterTPCPass);
2408   TH1F *gAntiProtonsExtCov11Pass = new TH1F("gAntiProtonsExtCov11Pass",
2409                                             ";#sigma_{y} [cm];Entries",
2410                                             100,0,4);
2411   fQAAntiProtonsAcceptedList->Add(gAntiProtonsExtCov11Pass);
2412   TH1F *gAntiProtonsExtCov22Pass = new TH1F("gAntiProtonsExtCov22Pass",
2413                                             ";#sigma_{z} [cm];Entries",
2414                                             100,0,4);
2415   fQAAntiProtonsAcceptedList->Add(gAntiProtonsExtCov22Pass);
2416   TH1F *gAntiProtonsExtCov33Pass = new TH1F("gAntiProtonsExtCov33Pass",
2417                                             ";#sigma_{sin(#phi)};Entries",
2418                                             100,0,4);
2419   fQAAntiProtonsAcceptedList->Add(gAntiProtonsExtCov33Pass);
2420   TH1F *gAntiProtonsExtCov44Pass = new TH1F("gAntiProtonsExtCov44Pass",
2421                                             ";#sigma_{tan(#lambda)};Entries",
2422                                             100,0,4);
2423   fQAAntiProtonsAcceptedList->Add(gAntiProtonsExtCov44Pass);
2424   TH1F *gAntiProtonsExtCov55Pass = new TH1F("gAntiProtonsExtCov55Pass",
2425                                             ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2426                                             100,0,4);
2427   fQAAntiProtonsAcceptedList->Add(gAntiProtonsExtCov55Pass);
2428   TH1F *gAntiProtonsSigmaToVertexPass = new TH1F("gAntiProtonsSigmaToVertexPass",
2429                                                  ";#sigma_{Vertex};Entries",
2430                                                  100,0,10);
2431   fQAAntiProtonsAcceptedList->Add(gAntiProtonsSigmaToVertexPass);
2432   TH1F *gAntiProtonsSigmaToVertexTPCPass = new TH1F("gAntiProtonsSigmaToVertexTPCPass",
2433                                                     ";#sigma_{Vertex};Entries",
2434                                                     100,0,10);
2435   fQAAntiProtonsAcceptedList->Add(gAntiProtonsSigmaToVertexTPCPass);
2436   TH1F *gAntiProtonsDCAXYPass = new TH1F("gAntiProtonsDCAXYPass",
2437                                          ";DCA_{xy} [cm];Entries",
2438                                          100,0,20);
2439   fQAAntiProtonsAcceptedList->Add(gAntiProtonsDCAXYPass);
2440   TH1F *gAntiProtonsDCAXYTPCPass = new TH1F("gAntiProtonsDCAXYTPCPass",
2441                                             ";DCA_{xy} [cm];Entries",
2442                                             100,0,20);
2443   fQAAntiProtonsAcceptedList->Add(gAntiProtonsDCAXYTPCPass);
2444   TH1F *gAntiProtonsDCAZPass = new TH1F("gAntiProtonsDCAZPass",
2445                                         ";DCA_{z} [cm];Entries",
2446                                         100,0,20);
2447   fQAAntiProtonsAcceptedList->Add(gAntiProtonsDCAZPass);
2448   TH1F *gAntiProtonsDCAZTPCPass = new TH1F("gAntiProtonsDCAZTPCPass",
2449                                            ";DCA_{z} [cm];Entries",
2450                                            100,0,20);
2451   fQAAntiProtonsAcceptedList->Add(gAntiProtonsDCAZTPCPass);
2452   TH1F *gAntiProtonsConstrainChi2Pass = new TH1F("gAntiProtonsConstrainChi2Pass",
2453                                                  ";Log_{10}(#chi^{2});Entries",
2454                                                  100,-10,10);
2455   fQAAntiProtonsAcceptedList->Add(gAntiProtonsConstrainChi2Pass);
2456   TH1F *gAntiProtonsITSRefitPass = new TH1F("gAntiProtonsITSRefitPass",
2457                                             "",10,-1,1);
2458   fQAAntiProtonsAcceptedList->Add(gAntiProtonsITSRefitPass);
2459   TH1F *gAntiProtonsTPCRefitPass = new TH1F("gAntiProtonsTPCRefitPass",
2460                                             "",10,-1,1);
2461   fQAAntiProtonsAcceptedList->Add(gAntiProtonsTPCRefitPass);
2462   TH1F *gAntiProtonsESDpidPass = new TH1F("gAntiProtonsESDpidPass",
2463                                           "",10,-1,1);
2464   fQAAntiProtonsAcceptedList->Add(gAntiProtonsESDpidPass);
2465   TH1F *gAntiProtonsTPCpidPass = new TH1F("gAntiProtonsTPCpidPass",
2466                                           "",10,-1,1);
2467   fQAAntiProtonsAcceptedList->Add(gAntiProtonsTPCpidPass);
2468   TH1F *gAntiProtonsPointOnITSLayer1Pass = new TH1F("gAntiProtonsPointOnITSLayer1Pass",
2469                                                     "",10,-1,1);
2470   fQAAntiProtonsAcceptedList->Add(gAntiProtonsPointOnITSLayer1Pass);
2471   TH1F *gAntiProtonsPointOnITSLayer2Pass = new TH1F("gAntiProtonsPointOnITSLayer2Pass",
2472                                                     "",10,-1,1);
2473   fQAAntiProtonsAcceptedList->Add(gAntiProtonsPointOnITSLayer2Pass);
2474   TH1F *gAntiProtonsPointOnITSLayer3Pass = new TH1F("gAntiProtonsPointOnITSLayer3Pass",
2475                                                     "",10,-1,1);
2476   fQAAntiProtonsAcceptedList->Add(gAntiProtonsPointOnITSLayer3Pass);
2477   TH1F *gAntiProtonsPointOnITSLayer4Pass = new TH1F("gAntiProtonsPointOnITSLayer4Pass",
2478                                                     "",10,-1,1);
2479   fQAAntiProtonsAcceptedList->Add(gAntiProtonsPointOnITSLayer4Pass);
2480   TH1F *gAntiProtonsPointOnITSLayer5Pass = new TH1F("gAntiProtonsPointOnITSLayer5Pass",
2481                                                     "",10,-1,1);
2482   fQAAntiProtonsAcceptedList->Add(gAntiProtonsPointOnITSLayer5Pass);
2483   TH1F *gAntiProtonsPointOnITSLayer6Pass = new TH1F("gAntiProtonsPointOnITSLayer6Pass",
2484                                                     "",10,-1,1);
2485   fQAAntiProtonsAcceptedList->Add(gAntiProtonsPointOnITSLayer6Pass);
2486   TH1F *gAntiProtonsNumberOfTPCdEdxPointsPass = new TH1F("gAntiProtonsNumberOfTPCdEdxPointsPass","",100,0,200);
2487   fQAAntiProtonsAcceptedList->Add(gAntiProtonsNumberOfTPCdEdxPointsPass);
2488   TH1F *gAntiProtonsITSClusterMapPass = new TH1F("gAntiProtonsITSClusterMapPass",";ITS Layer;Entries",6,0.5,6.5);
2489   fQAAntiProtonsAcceptedList->Add(gAntiProtonsITSClusterMapPass);
2490   TH1F *gAntiProtonsDCA3DPass = new TH1F("gAntiProtonsDCA3DPass",
2491                                          ";dca [cm];Entries",
2492                                          100,0,20);
2493   fQAAntiProtonsAcceptedList->Add(gAntiProtonsDCA3DPass);
2494
2495   //========================================================//
2496   fQAAntiProtonsRejectedList = new TList();
2497   fQAAntiProtonsRejectedList->SetName("fQAAntiProtonsRejectedList");
2498   fGlobalQAList->Add(fQAAntiProtonsRejectedList);
2499   //Rejected antiprotons
2500   TH1F *gAntiProtonsITSClustersReject = new TH1F("gAntiProtonsITSClustersReject",
2501                                                  ";N_{clusters} (ITS);Entries",
2502                                                  7,0,7);
2503   gAntiProtonsITSClustersReject->SetFillColor(kRed-2);
2504   fQAAntiProtonsRejectedList->Add(gAntiProtonsITSClustersReject);
2505   TH1F *gAntiProtonsChi2PerClusterITSReject = new TH1F("gAntiProtonsChi2PerClusterITSReject",
2506                                                        ";x^{2}/N_{clusters} (ITS);Entries",
2507                                                        100,0,4);
2508   gAntiProtonsChi2PerClusterITSReject->SetFillColor(kRed-2);
2509   fQAAntiProtonsRejectedList->Add(gAntiProtonsChi2PerClusterITSReject);
2510   TH1F *gAntiProtonsTPCClustersReject = new TH1F("gAntiProtonsTPCClustersReject",
2511                                                  ";N_{clusters} (TPC);Entries",
2512                                                  100,0,200);
2513   gAntiProtonsTPCClustersReject->SetFillColor(kRed-2);
2514   fQAAntiProtonsRejectedList->Add(gAntiProtonsTPCClustersReject);
2515   TH1F *gAntiProtonsChi2PerClusterTPCReject = new TH1F("gAntiProtonsChi2PerClusterTPCReject",
2516                                                        ";x^{2}/N_{clusters} (TPC);Entries",
2517                                                        100,0,4);
2518   gAntiProtonsChi2PerClusterTPCReject->SetFillColor(kRed-2);
2519   fQAAntiProtonsRejectedList->Add(gAntiProtonsChi2PerClusterTPCReject);
2520   TH1F *gAntiProtonsExtCov11Reject = new TH1F("gAntiProtonsExtCov11Reject",
2521                                               ";#sigma_{y} [cm];Entries",
2522                                               100,0,4);
2523   gAntiProtonsExtCov11Reject->SetFillColor(kRed-2);
2524   fQAAntiProtonsRejectedList->Add(gAntiProtonsExtCov11Reject);
2525   TH1F *gAntiProtonsExtCov22Reject = new TH1F("gAntiProtonsExtCov22Reject",
2526                                               ";#sigma_{z} [cm];Entries",
2527                                               100,0,4);
2528   gAntiProtonsExtCov22Reject->SetFillColor(kRed-2);
2529   fQAAntiProtonsRejectedList->Add(gAntiProtonsExtCov22Reject);
2530   TH1F *gAntiProtonsExtCov33Reject = new TH1F("gAntiProtonsExtCov33Reject",
2531                                               ";#sigma_{sin(#phi)};Entries",
2532                                               100,0,4);
2533   gAntiProtonsExtCov33Reject->SetFillColor(kRed-2);
2534   fQAAntiProtonsRejectedList->Add(gAntiProtonsExtCov33Reject);
2535   TH1F *gAntiProtonsExtCov44Reject = new TH1F("gAntiProtonsExtCov44Reject",
2536                                               ";#sigma_{tan(#lambda)};Entries",
2537                                               100,0,4);
2538   gAntiProtonsExtCov44Reject->SetFillColor(kRed-2);
2539   fQAAntiProtonsRejectedList->Add(gAntiProtonsExtCov44Reject);
2540   TH1F *gAntiProtonsExtCov55Reject = new TH1F("gAntiProtonsExtCov55Reject",
2541                                               ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2542                                               100,0,4);
2543   gAntiProtonsExtCov55Reject->SetFillColor(kRed-2);
2544   fQAAntiProtonsRejectedList->Add(gAntiProtonsExtCov55Reject);
2545   TH1F *gAntiProtonsSigmaToVertexReject = new TH1F("gAntiProtonsSigmaToVertexReject",
2546                                                    ";#sigma_{Vertex};Entries",
2547                                                    100,0,10);
2548   gAntiProtonsSigmaToVertexReject->SetFillColor(kRed-2);
2549   fQAAntiProtonsRejectedList->Add(gAntiProtonsSigmaToVertexReject);
2550   TH1F *gAntiProtonsSigmaToVertexTPCReject = new TH1F("gAntiProtonsSigmaToVertexTPCReject",
2551                                                       ";#sigma_{Vertex};Entries",
2552                                                       100,0,10);
2553   gAntiProtonsSigmaToVertexTPCReject->SetFillColor(kRed-2);
2554   fQAAntiProtonsRejectedList->Add(gAntiProtonsSigmaToVertexTPCReject);
2555   TH1F *gAntiProtonsDCAXYReject = new TH1F("gAntiProtonsDCAXYReject",
2556                                            ";DCA_{xy} [cm];Entries",
2557                                            100,0,20);
2558   gAntiProtonsDCAXYReject->SetFillColor(kRed-2);
2559   fQAAntiProtonsRejectedList->Add(gAntiProtonsDCAXYReject);
2560   TH1F *gAntiProtonsDCAXYTPCReject = new TH1F("gAntiProtonsDCAXYTPCReject",
2561                                               ";DCA_{xy} [cm];Entries",
2562                                               100,0,20);
2563   gAntiProtonsDCAXYTPCReject->SetFillColor(kRed-2);
2564   fQAAntiProtonsRejectedList->Add(gAntiProtonsDCAXYTPCReject);
2565   TH1F *gAntiProtonsDCAZReject = new TH1F("gAntiProtonsDCAZReject",
2566                                           ";DCA_{z} [cm];Entries",
2567                                           100,0,20);
2568   gAntiProtonsDCAZReject->SetFillColor(kRed-2);
2569   fQAAntiProtonsRejectedList->Add(gAntiProtonsDCAZReject);
2570   TH1F *gAntiProtonsDCAZTPCReject = new TH1F("gAntiProtonsDCAZTPCReject",
2571                                              ";DCA_{z} [cm];Entries",
2572                                              100,0,20);
2573   gAntiProtonsDCAZTPCReject->SetFillColor(kRed-2);
2574   fQAAntiProtonsRejectedList->Add(gAntiProtonsDCAZTPCReject);
2575   TH1F *gAntiProtonsConstrainChi2Reject = new TH1F("gAntiProtonsConstrainChi2Reject",
2576                                                    ";Log_{10}(#chi^{2});Entries",
2577                                                    100,-10,10);
2578   gAntiProtonsConstrainChi2Reject->SetFillColor(kRed-2);
2579   fQAAntiProtonsRejectedList->Add(gAntiProtonsConstrainChi2Reject);
2580   TH1F *gAntiProtonsITSRefitReject = new TH1F("gAntiProtonsITSRefitReject",
2581                                               "",10,-1,1);
2582   gAntiProtonsITSRefitReject->SetFillColor(kRed-2);
2583   fQAAntiProtonsRejectedList->Add(gAntiProtonsITSRefitReject);
2584   TH1F *gAntiProtonsTPCRefitReject = new TH1F("gAntiProtonsTPCRefitReject",
2585                                               "",10,-1,1);
2586   gAntiProtonsTPCRefitReject->SetFillColor(kRed-2);
2587   fQAAntiProtonsRejectedList->Add(gAntiProtonsTPCRefitReject);
2588   TH1F *gAntiProtonsESDpidReject = new TH1F("gAntiProtonsESDpidReject",
2589                                             "",10,-1,1);
2590   gAntiProtonsESDpidReject->SetFillColor(kRed-2);
2591   fQAAntiProtonsRejectedList->Add(gAntiProtonsESDpidReject);
2592   TH1F *gAntiProtonsTPCpidReject = new TH1F("gAntiProtonsTPCpidReject",
2593                                             "",10,-1,1);
2594   gAntiProtonsTPCpidReject->SetFillColor(kRed-2);
2595   fQAAntiProtonsRejectedList->Add(gAntiProtonsTPCpidReject);
2596   TH1F *gAntiProtonsPointOnITSLayer1Reject = new TH1F("gAntiProtonsPointOnITSLayer1Reject",
2597                                                       "",10,-1,1);
2598   gAntiProtonsPointOnITSLayer1Reject->SetFillColor(kRed-2);
2599   fQAAntiProtonsRejectedList->Add(gAntiProtonsPointOnITSLayer1Reject);
2600   TH1F *gAntiProtonsPointOnITSLayer2Reject = new TH1F("gAntiProtonsPointOnITSLayer2Reject",
2601                                                       "",10,-1,1);
2602   gAntiProtonsPointOnITSLayer2Reject->SetFillColor(kRed-2);
2603   fQAAntiProtonsRejectedList->Add(gAntiProtonsPointOnITSLayer2Reject);
2604   TH1F *gAntiProtonsPointOnITSLayer3Reject = new TH1F("gAntiProtonsPointOnITSLayer3Reject",
2605                                                       "",10,-1,1);
2606   gAntiProtonsPointOnITSLayer3Reject->SetFillColor(kRed-2);
2607   fQAAntiProtonsRejectedList->Add(gAntiProtonsPointOnITSLayer3Reject);
2608   TH1F *gAntiProtonsPointOnITSLayer4Reject = new TH1F("gAntiProtonsPointOnITSLayer4Reject",
2609                                                       "",10,-1,1);
2610   gAntiProtonsPointOnITSLayer4Reject->SetFillColor(kRed-2);
2611   fQAAntiProtonsRejectedList->Add(gAntiProtonsPointOnITSLayer4Reject);
2612   TH1F *gAntiProtonsPointOnITSLayer5Reject = new TH1F("gAntiProtonsPointOnITSLayer5Reject",
2613                                                       "",10,-1,1);
2614   gAntiProtonsPointOnITSLayer5Reject->SetFillColor(kRed-2);
2615   fQAAntiProtonsRejectedList->Add(gAntiProtonsPointOnITSLayer5Reject);
2616   TH1F *gAntiProtonsPointOnITSLayer6Reject = new TH1F("gAntiProtonsPointOnITSLayer6Reject",
2617                                                       "",10,-1,1);
2618   gAntiProtonsPointOnITSLayer6Reject->SetFillColor(kRed-2);
2619   fQAAntiProtonsRejectedList->Add(gAntiProtonsPointOnITSLayer6Reject);
2620   TH1F *gAntiProtonsNumberOfTPCdEdxPointsReject = new TH1F("gAntiProtonsNumberOfTPCdEdxPointsReject","",100,0,200);
2621   gAntiProtonsNumberOfTPCdEdxPointsReject->SetFillColor(kRed-2);
2622   fQAAntiProtonsRejectedList->Add(gAntiProtonsNumberOfTPCdEdxPointsReject);
2623   TH1F *gAntiProtonsITSClusterMapReject = new TH1F("gAntiProtonsITSClusterMapReject",";ITS Layer;Entries",6,0.5,6.5);
2624   gAntiProtonsITSClusterMapReject->SetFillColor(kRed-2);
2625   fQAAntiProtonsRejectedList->Add(gAntiProtonsITSClusterMapReject);
2626   TH1F *gAntiProtonsDCA3DReject = new TH1F("gAntiProtonsDCA3DReject",
2627                                            ";dca [cm];Entries",
2628                                            100,0,20);
2629   gAntiProtonsDCA3DReject->SetFillColor(kRed-2);
2630   fQAAntiProtonsRejectedList->Add(gAntiProtonsDCA3DReject);
2631 }
2632
2633 //____________________________________________________________________//
2634 void AliProtonAnalysis::FillQA(AliESDEvent *esd,
2635                                const AliESDVertex *vertex, 
2636                                AliESDtrack* track) {
2637   //Fills the QA histograms
2638   Double_t gPt = 0.0, gPx = 0.0, gPy = 0.0, gPz = 0.0;
2639   Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0};  //The impact parameters and their covariance.
2640   Double_t dca3D = 0.0;
2641   Float_t dcaXY = 0.0, dcaZ = 0.0;
2642
2643   if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
2644     AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
2645     if(!tpcTrack) {
2646       gPt = 0.0; gPx = 0.0; gPy = 0.0; gPz = 0.0;
2647       dca[0] = -100.; dca[1] = -100.;
2648       cov[0] = -100.; cov[1] = -100.; cov[2] = -100.;
2649     }
2650     else {
2651       gPt = tpcTrack->Pt();
2652       gPx = tpcTrack->Px();
2653       gPy = tpcTrack->Py();
2654       gPz = tpcTrack->Pz();
2655       tpcTrack->PropagateToDCA(vertex,
2656                                esd->GetMagneticField(),
2657                                100.,dca,cov);
2658     }
2659   }
2660   if(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kFullHybrid) {
2661     AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
2662     AliExternalTrackParam cParam;
2663     if(!tpcTrack) {
2664       gPt = 0.0; gPx = 0.0; gPy = 0.0; gPz = 0.0;
2665       dca[0] = -100.; dca[1] = -100.;
2666       cov[0] = -100.; cov[1] = -100.; cov[2] = -100.;
2667     }
2668     else {
2669       gPt = tpcTrack->Pt();
2670       gPx = tpcTrack->Px();
2671       gPy = tpcTrack->Py();
2672       gPz = tpcTrack->Pz();
2673       track->RelateToVertex(vertex,
2674                             esd->GetMagneticField(),
2675                             100.,&cParam);
2676       track->GetImpactParameters(dcaXY,dcaZ);
2677       dca[0] = dcaXY; dca[1] = dcaZ;
2678     }
2679   }
2680   else{
2681     gPt = track->Pt();
2682     gPx = track->Px();
2683     gPy = track->Py();
2684     gPz = track->Pz();
2685     track->PropagateToDCA(vertex,
2686                           esd->GetMagneticField(),
2687                           100.,dca,cov);
2688   }
2689
2690   dca3D = TMath::Sqrt(TMath::Power(dca[0],2) +
2691                       TMath::Power(dca[1],2));
2692
2693   //Int_t  fIdxInt[200];
2694   //Int_t nClustersITS = track->GetITSclusters(fIdxInt);
2695   //Int_t nClustersTPC = track->GetTPCclusters(fIdxInt);
2696   Int_t nClustersITS = track->GetITSclusters(0x0);
2697   Int_t nClustersTPC = track->GetTPCclusters(0x0);
2698
2699   Float_t chi2PerClusterITS = -1;
2700   if (nClustersITS!=0)
2701     chi2PerClusterITS = track->GetITSchi2()/Float_t(nClustersITS);
2702   Float_t chi2PerClusterTPC = -1;
2703   if (nClustersTPC!=0)
2704     chi2PerClusterTPC = track->GetTPCchi2()/Float_t(nClustersTPC);
2705
2706   Double_t extCov[15];
2707   track->GetExternalCovariance(extCov);
2708   
2709   //protons
2710   if(track->Charge() > 0) {
2711     if(fProtonAnalysisBase->IsUsedMinITSClusters()) {
2712       if(nClustersITS < fProtonAnalysisBase->GetMinITSClusters()) {
2713         ((TH1F *)(fQAProtonsRejectedList->At(0)))->Fill(nClustersITS);
2714       }
2715       else if(nClustersITS >= fProtonAnalysisBase->GetMinITSClusters()) 
2716         ((TH1F *)(fQAProtonsAcceptedList->At(0)))->Fill(nClustersITS);
2717     }//ITS clusters
2718     if(fProtonAnalysisBase->IsUsedMaxChi2PerITSCluster()) {
2719       if(chi2PerClusterITS > fProtonAnalysisBase->GetMaxChi2PerITSCluster()) {
2720         ((TH1F *)(fQAProtonsRejectedList->At(1)))->Fill(chi2PerClusterITS);
2721       }
2722       else if(chi2PerClusterITS <= fProtonAnalysisBase->GetMaxChi2PerITSCluster())
2723         ((TH1F *)(fQAProtonsAcceptedList->At(1)))->Fill(chi2PerClusterITS);
2724     }//chi2 per ITS cluster
2725     if(fProtonAnalysisBase->IsUsedMinTPCClusters()) {
2726       if(nClustersTPC < fProtonAnalysisBase->GetMinTPCClusters()) {
2727         ((TH1F *)(fQAProtonsRejectedList->At(2)))->Fill(nClustersTPC);
2728       }
2729       else if(nClustersTPC >= fProtonAnalysisBase->GetMinTPCClusters()) {
2730         ((TH1F *)(fQAProtonsAcceptedList->At(2)))->Fill(nClustersTPC);
2731       }
2732     }//TPC clusters
2733     if(fProtonAnalysisBase->IsUsedMaxChi2PerTPCCluster()) {
2734       if(chi2PerClusterTPC > fProtonAnalysisBase->GetMaxChi2PerTPCCluster()) {
2735         ((TH1F *)(fQAProtonsRejectedList->At(3)))->Fill(chi2PerClusterTPC);
2736       }
2737       else if(chi2PerClusterTPC <= fProtonAnalysisBase->GetMaxChi2PerTPCCluster())
2738         ((TH1F *)(fQAProtonsAcceptedList->At(3)))->Fill(chi2PerClusterTPC);
2739     }//chi2 per TPC cluster
2740     if(fProtonAnalysisBase->IsUsedMaxCov11()) {
2741       if(extCov[0] > fProtonAnalysisBase->GetMaxCov11()) {
2742         ((TH1F *)(fQAProtonsRejectedList->At(4)))->Fill(extCov[0]);
2743       }
2744       else if(extCov[0] <= fProtonAnalysisBase->GetMaxCov11())
2745         ((TH1F *)(fQAProtonsAcceptedList->At(4)))->Fill(extCov[0]);
2746     }//cov11
2747     if(fProtonAnalysisBase->IsUsedMaxCov22()) {
2748       if(extCov[2] > fProtonAnalysisBase->GetMaxCov22()) {
2749         ((TH1F *)(fQAProtonsRejectedList->At(5)))->Fill(extCov[2]);
2750       }
2751       else if(extCov[2] <= fProtonAnalysisBase->GetMaxCov22())
2752         ((TH1F *)(fQAProtonsAcceptedList->At(5)))->Fill(extCov[2]);
2753     }//cov11
2754     if(fProtonAnalysisBase->IsUsedMaxCov33()) {
2755       if(extCov[5] > fProtonAnalysisBase->GetMaxCov33()) {
2756         ((TH1F *)(fQAProtonsRejectedList->At(6)))->Fill(extCov[5]);
2757       }
2758       else if(extCov[5] <= fProtonAnalysisBase->GetMaxCov33())
2759         ((TH1F *)(fQAProtonsAcceptedList->At(6)))->Fill(extCov[5]);
2760     }//cov11
2761     if(fProtonAnalysisBase->IsUsedMaxCov44()) {
2762       if(extCov[9] > fProtonAnalysisBase->GetMaxCov44()) {
2763         ((TH1F *)(fQAProtonsRejectedList->At(7)))->Fill(extCov[9]);
2764       }
2765       else if(extCov[9] <= fProtonAnalysisBase->GetMaxCov44())
2766         ((TH1F *)(fQAProtonsAcceptedList->At(7)))->Fill(extCov[9]);
2767     }//cov11
2768     if(fProtonAnalysisBase->IsUsedMaxCov55()) {
2769       if(extCov[14] > fProtonAnalysisBase->GetMaxCov55()) {
2770         ((TH1F *)(fQAProtonsRejectedList->At(8)))->Fill(extCov[14]);
2771       }
2772       else if(extCov[14] <= fProtonAnalysisBase->GetMaxCov55())
2773         ((TH1F *)(fQAProtonsAcceptedList->At(8)))->Fill(extCov[14]);
2774     }//cov55
2775     if(fProtonAnalysisBase->IsUsedMaxSigmaToVertex()) {
2776       if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertex()) {
2777         ((TH1F *)(fQAProtonsRejectedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
2778       }
2779       else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertex())
2780         ((TH1F *)(fQAProtonsAcceptedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
2781     }//sigma to vertex
2782     if(fProtonAnalysisBase->IsUsedMaxSigmaToVertexTPC()) {
2783       if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertexTPC()) {
2784         ((TH1F *)(fQAProtonsRejectedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
2785       }
2786       else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertexTPC())
2787         ((TH1F *)(fQAProtonsAcceptedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
2788     }//sigma to vertex TPC
2789     if(fProtonAnalysisBase->IsUsedMaxDCAXY()) {
2790       if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXY()) {
2791         ((TH1F *)(fQAProtonsRejectedList->At(11)))->Fill(TMath::Abs(dca[0]));
2792       }
2793       else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXY())
2794         ((TH1F *)(fQAProtonsAcceptedList->At(11)))->Fill(TMath::Abs(dca[0]));
2795     }//DCA xy global tracking
2796     if(fProtonAnalysisBase->IsUsedMaxDCAXYTPC()) {
2797       if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXYTPC()) {
2798         ((TH1F *)(fQAProtonsRejectedList->At(12)))->Fill(TMath::Abs(dca[0]));
2799       }
2800       else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXYTPC())
2801         ((TH1F *)(fQAProtonsAcceptedList->At(12)))->Fill(TMath::Abs(dca[0]));
2802     }//DCA xy TPC tracking
2803     if(fProtonAnalysisBase->IsUsedMaxDCAZ()) {
2804       if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZ()) {
2805         ((TH1F *)(fQAProtonsRejectedList->At(13)))->Fill(TMath::Abs(dca[1]));
2806       }
2807       else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZ())
2808         ((TH1F *)(fQAProtonsAcceptedList->At(13)))->Fill(TMath::Abs(dca[1]));
2809     }//DCA z global tracking
2810     if(fProtonAnalysisBase->IsUsedMaxDCAZTPC()) {
2811       if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZTPC()) {
2812         ((TH1F *)(fQAProtonsRejectedList->At(14)))->Fill(TMath::Abs(dca[1]));
2813       }
2814       else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZTPC())
2815         ((TH1F *)(fQAProtonsAcceptedList->At(14)))->Fill(TMath::Abs(dca[1]));
2816     }//DCA z TPC tracking
2817     if(fProtonAnalysisBase->IsUsedMaxConstrainChi2()) {
2818       if(track->GetConstrainedChi2() > 0) {
2819         if(TMath::Log(track->GetConstrainedChi2()) > fProtonAnalysisBase->GetMaxConstrainChi2()) {
2820           ((TH1F *)(fQAProtonsRejectedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
2821         }
2822         else if(TMath::Log(track->GetConstrainedChi2()) <= fProtonAnalysisBase->GetMaxConstrainChi2())
2823           ((TH1F *)(fQAProtonsAcceptedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
2824       }
2825     }//constrain chi2 - vertex
2826     if(fProtonAnalysisBase->IsUsedITSRefit()) {
2827       if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) {
2828         ((TH1F *)(fQAProtonsRejectedList->At(16)))->Fill(0);
2829       }
2830       else if((track->GetStatus() & AliESDtrack::kITSrefit) != 0)
2831         ((TH1F *)(fQAProtonsAcceptedList->At(16)))->Fill(0);
2832     }//ITS refit
2833     if(fProtonAnalysisBase->IsUsedTPCRefit()) {
2834       if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) {
2835         ((TH1F *)(fQAProtonsRejectedList->At(17)))->Fill(0);
2836       }
2837       else if((track->GetStatus() & AliESDtrack::kTPCrefit) != 0)
2838         ((TH1F *)(fQAProtonsAcceptedList->At(17)))->Fill(0);
2839     }//TPC refit
2840     if(fProtonAnalysisBase->IsUsedESDpid()) {
2841       if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) {
2842         ((TH1F *)(fQAProtonsRejectedList->At(18)))->Fill(0);
2843       }
2844       else if((track->GetStatus() & AliESDtrack::kESDpid) != 0)
2845         ((TH1F *)(fQAProtonsAcceptedList->At(18)))->Fill(0);
2846     }//ESD pid
2847     if(fProtonAnalysisBase->IsUsedTPCpid()) {
2848       if ((track->GetStatus() & AliESDtrack::kTPCpid) == 0) {
2849         ((TH1F *)(fQAProtonsRejectedList->At(19)))->Fill(0);
2850       }
2851       else if((track->GetStatus() & AliESDtrack::kTPCpid) != 0)
2852         ((TH1F *)(fQAProtonsAcceptedList->At(19)))->Fill(0);
2853     }//TPC pid
2854     if(fProtonAnalysisBase->IsUsedPointOnITSLayer1()) {
2855       if(!track->HasPointOnITSLayer(0)) {
2856         ((TH1F *)(fQAProtonsRejectedList->At(20)))->Fill(0);
2857       }
2858       else if(track->HasPointOnITSLayer(0))
2859         ((TH1F *)(fQAProtonsAcceptedList->At(20)))->Fill(0);
2860     }//point on SPD1
2861     if(fProtonAnalysisBase->IsUsedPointOnITSLayer2()) {
2862       if(!track->HasPointOnITSLayer(1)) {
2863         ((TH1F *)(fQAProtonsRejectedList->At(21)))->Fill(0);
2864       }
2865       else if(track->HasPointOnITSLayer(1))
2866         ((TH1F *)(fQAProtonsAcceptedList->At(21)))->Fill(0);
2867     }//point on SPD2
2868     if(fProtonAnalysisBase->IsUsedPointOnITSLayer3()) {
2869       if(!track->HasPointOnITSLayer(2)) {
2870         ((TH1F *)(fQAProtonsRejectedList->At(22)))->Fill(0);
2871       }
2872       else if(track->HasPointOnITSLayer(2))
2873         ((TH1F *)(fQAProtonsAcceptedList->At(22)))->Fill(0);
2874     }//point on SDD1
2875     if(fProtonAnalysisBase->IsUsedPointOnITSLayer4()) {
2876       if(!track->HasPointOnITSLayer(3)) {
2877         ((TH1F *)(fQAProtonsRejectedList->At(23)))->Fill(0);
2878       }
2879       else if(track->HasPointOnITSLayer(3))
2880         ((TH1F *)(fQAProtonsAcceptedList->At(23)))->Fill(0);
2881     }//point on SDD2
2882     if(fProtonAnalysisBase->IsUsedPointOnITSLayer5()) {
2883       if(!track->HasPointOnITSLayer(4)) {
2884         ((TH1F *)(fQAProtonsRejectedList->At(24)))->Fill(0);
2885       }
2886       else if(track->HasPointOnITSLayer(4))
2887         ((TH1F *)(fQAProtonsAcceptedList->At(24)))->Fill(0);
2888     }//point on SSD1
2889     if(fProtonAnalysisBase->IsUsedPointOnITSLayer6()) {
2890       if(!track->HasPointOnITSLayer(5)) {
2891         ((TH1F *)(fQAProtonsRejectedList->At(25)))->Fill(0);
2892       }
2893       else if(track->HasPointOnITSLayer(5))
2894         ((TH1F *)(fQAProtonsAcceptedList->At(25)))->Fill(0);
2895     }//point on SSD2
2896     if(fProtonAnalysisBase->IsUsedMinTPCdEdxPoints()) {
2897       if(track->GetTPCsignalN() < fProtonAnalysisBase->GetMinTPCdEdxPoints()) {
2898         ((TH1F *)(fQAProtonsRejectedList->At(26)))->Fill(track->GetTPCsignalN());
2899       }
2900       if(track->GetTPCsignalN() >= fProtonAnalysisBase->GetMinTPCdEdxPoints())
2901         ((TH1F *)(fQAProtonsAcceptedList->At(26)))->Fill(track->GetTPCsignalN());
2902     }//number of TPC points for the dE/dx
2903     if(fProtonAnalysisBase->IsUsedPointOnSPDLayer()) {
2904       if((!track->HasPointOnITSLayer(0))&&(!track->HasPointOnITSLayer(1))) {
2905         for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
2906           if(track->HasPointOnITSLayer(iLayer))
2907             ((TH1F *)(fQAProtonsRejectedList->At(27)))->Fill(iLayer+1);
2908         }
2909       }
2910       else if((track->HasPointOnITSLayer(0))||(track->HasPointOnITSLayer(1))) {
2911         for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
2912           if(track->HasPointOnITSLayer(iLayer))
2913             ((TH1F *)(fQAProtonsAcceptedList->At(27)))->Fill(iLayer+1);
2914         }
2915       }
2916     }//point on either SPD layers
2917     if(fProtonAnalysisBase->IsUsedMaxDCA3D()) {
2918       if(dca3D > fProtonAnalysisBase->GetMaxDCA3D()) {
2919         ((TH1F *)(fQAProtonsRejectedList->At(28)))->Fill(dca3D);
2920       }
2921       if(dca3D < fProtonAnalysisBase->GetMaxDCA3D()) 
2922         ((TH1F *)(fQAProtonsAcceptedList->At(28)))->Fill(dca3D);
2923     }//dca3D
2924   }//protons
2925
2926   //antiprotons
2927   if(track->Charge() < 0) {
2928     if(fProtonAnalysisBase->IsUsedMinITSClusters()) {
2929       if(nClustersITS < fProtonAnalysisBase->GetMinITSClusters()) {
2930         ((TH1F *)(fQAAntiProtonsRejectedList->At(0)))->Fill(nClustersITS);
2931       }
2932       else if(nClustersITS >= fProtonAnalysisBase->GetMinITSClusters()) 
2933         ((TH1F *)(fQAAntiProtonsAcceptedList->At(0)))->Fill(nClustersITS);
2934     }//ITS clusters
2935     if(fProtonAnalysisBase->IsUsedMaxChi2PerITSCluster()) {
2936       if(chi2PerClusterITS > fProtonAnalysisBase->GetMaxChi2PerITSCluster()) {
2937         ((TH1F *)(fQAAntiProtonsRejectedList->At(1)))->Fill(chi2PerClusterITS);
2938       }
2939       else if(chi2PerClusterITS <= fProtonAnalysisBase->GetMaxChi2PerITSCluster())
2940         ((TH1F *)(fQAAntiProtonsAcceptedList->At(1)))->Fill(chi2PerClusterITS);
2941     }//chi2 per ITS cluster
2942     if(fProtonAnalysisBase->IsUsedMinTPCClusters()) {
2943       if(nClustersTPC < fProtonAnalysisBase->GetMinTPCClusters()) {
2944         ((TH1F *)(fQAAntiProtonsRejectedList->At(2)))->Fill(nClustersTPC);
2945       }
2946       else if(nClustersTPC >= fProtonAnalysisBase->GetMinTPCClusters()) {
2947         ((TH1F *)(fQAAntiProtonsAcceptedList->At(2)))->Fill(nClustersTPC);
2948       }
2949     }//TPC clusters
2950     if(fProtonAnalysisBase->IsUsedMaxChi2PerTPCCluster()) {
2951       if(chi2PerClusterTPC > fProtonAnalysisBase->GetMaxChi2PerTPCCluster()) {
2952         ((TH1F *)(fQAAntiProtonsRejectedList->At(3)))->Fill(chi2PerClusterTPC);
2953       }
2954       else if(chi2PerClusterTPC <= fProtonAnalysisBase->GetMaxChi2PerTPCCluster())
2955         ((TH1F *)(fQAAntiProtonsAcceptedList->At(3)))->Fill(chi2PerClusterTPC);
2956     }//chi2 per TPC cluster
2957     if(fProtonAnalysisBase->IsUsedMaxCov11()) {
2958       if(extCov[0] > fProtonAnalysisBase->GetMaxCov11()) {
2959         ((TH1F *)(fQAAntiProtonsRejectedList->At(4)))->Fill(extCov[0]);
2960       }
2961       else if(extCov[0] <= fProtonAnalysisBase->GetMaxCov11())
2962         ((TH1F *)(fQAAntiProtonsAcceptedList->At(4)))->Fill(extCov[0]);
2963     }//cov11
2964     if(fProtonAnalysisBase->IsUsedMaxCov22()) {
2965       if(extCov[2] > fProtonAnalysisBase->GetMaxCov22()) {
2966         ((TH1F *)(fQAAntiProtonsRejectedList->At(5)))->Fill(extCov[2]);
2967       }
2968       else if(extCov[2] <= fProtonAnalysisBase->GetMaxCov22())
2969         ((TH1F *)(fQAAntiProtonsAcceptedList->At(5)))->Fill(extCov[2]);
2970     }//cov11
2971     if(fProtonAnalysisBase->IsUsedMaxCov33()) {
2972       if(extCov[5] > fProtonAnalysisBase->GetMaxCov33()) {
2973         ((TH1F *)(fQAAntiProtonsRejectedList->At(6)))->Fill(extCov[5]);
2974       }
2975       else if(extCov[5] <= fProtonAnalysisBase->GetMaxCov33())
2976         ((TH1F *)(fQAAntiProtonsAcceptedList->At(6)))->Fill(extCov[5]);
2977     }//cov11
2978     if(fProtonAnalysisBase->IsUsedMaxCov44()) {
2979       if(extCov[9] > fProtonAnalysisBase->GetMaxCov44()) {
2980         ((TH1F *)(fQAAntiProtonsRejectedList->At(7)))->Fill(extCov[9]);
2981       }
2982       else if(extCov[9] <= fProtonAnalysisBase->GetMaxCov44())
2983         ((TH1F *)(fQAAntiProtonsAcceptedList->At(7)))->Fill(extCov[9]);
2984     }//cov11
2985     if(fProtonAnalysisBase->IsUsedMaxCov55()) {
2986       if(extCov[14] > fProtonAnalysisBase->GetMaxCov55()) {
2987         ((TH1F *)(fQAAntiProtonsRejectedList->At(8)))->Fill(extCov[14]);
2988       }
2989       else if(extCov[14] <= fProtonAnalysisBase->GetMaxCov55())
2990         ((TH1F *)(fQAAntiProtonsAcceptedList->At(8)))->Fill(extCov[14]);
2991     }//cov55
2992     if(fProtonAnalysisBase->IsUsedMaxSigmaToVertex()) {
2993       if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertex()) {
2994         ((TH1F *)(fQAAntiProtonsRejectedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
2995       }
2996       else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertex())
2997         ((TH1F *)(fQAAntiProtonsAcceptedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
2998     }//sigma to vertex
2999     if(fProtonAnalysisBase->IsUsedMaxSigmaToVertexTPC()) {
3000       if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertexTPC()) {
3001         ((TH1F *)(fQAAntiProtonsRejectedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
3002       }
3003       else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertexTPC())
3004         ((TH1F *)(fQAAntiProtonsAcceptedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
3005     }//sigma to vertex TPC
3006     if(fProtonAnalysisBase->IsUsedMaxDCAXY()) {
3007       if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXY()) {
3008         ((TH1F *)(fQAAntiProtonsRejectedList->At(11)))->Fill(TMath::Abs(dca[0]));
3009       }
3010       else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXY())
3011         ((TH1F *)(fQAAntiProtonsAcceptedList->At(11)))->Fill(TMath::Abs(dca[0]));
3012     }//DCA xy global tracking
3013     if(fProtonAnalysisBase->IsUsedMaxDCAXYTPC()) {
3014       if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXYTPC()) {
3015         ((TH1F *)(fQAAntiProtonsRejectedList->At(12)))->Fill(TMath::Abs(dca[0]));
3016       }
3017       else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXYTPC())
3018         ((TH1F *)(fQAAntiProtonsAcceptedList->At(12)))->Fill(TMath::Abs(dca[0]));
3019     }//DCA xy TPC tracking
3020     if(fProtonAnalysisBase->IsUsedMaxDCAZ()) {
3021       if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZ()) {
3022         ((TH1F *)(fQAAntiProtonsRejectedList->At(13)))->Fill(TMath::Abs(dca[1]));
3023       }
3024       else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZ())
3025         ((TH1F *)(fQAAntiProtonsAcceptedList->At(13)))->Fill(TMath::Abs(dca[1]));
3026     }//DCA z global tracking
3027     if(fProtonAnalysisBase->IsUsedMaxDCAZTPC()) {
3028       if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZTPC()) {
3029         ((TH1F *)(fQAAntiProtonsRejectedList->At(14)))->Fill(TMath::Abs(dca[1]));
3030       }
3031       else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZTPC())
3032         ((TH1F *)(fQAAntiProtonsAcceptedList->At(14)))->Fill(TMath::Abs(dca[1]));
3033     }//DCA z TPC tracking
3034     if(fProtonAnalysisBase->IsUsedMaxConstrainChi2()) {
3035       if(track->GetConstrainedChi2() > 0) {
3036         if(TMath::Log(track->GetConstrainedChi2()) > fProtonAnalysisBase->GetMaxConstrainChi2()) {
3037           ((TH1F *)(fQAAntiProtonsRejectedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
3038         }
3039         else if(TMath::Log(track->GetConstrainedChi2()) <= fProtonAnalysisBase->GetMaxConstrainChi2())
3040           ((TH1F *)(fQAAntiProtonsAcceptedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
3041       }
3042     }//constrain chi2 - vertex
3043     if(fProtonAnalysisBase->IsUsedITSRefit()) {
3044       if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) {
3045         ((TH1F *)(fQAAntiProtonsRejectedList->At(16)))->Fill(0);
3046       }
3047       else if((track->GetStatus() & AliESDtrack::kITSrefit) != 0)
3048         ((TH1F *)(fQAAntiProtonsAcceptedList->At(16)))->Fill(0);
3049     }//ITS refit
3050     if(fProtonAnalysisBase->IsUsedTPCRefit()) {
3051       if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) {
3052         ((TH1F *)(fQAAntiProtonsRejectedList->At(17)))->Fill(0);
3053       }
3054       else if((track->GetStatus() & AliESDtrack::kTPCrefit) != 0)
3055         ((TH1F *)(fQAAntiProtonsAcceptedList->At(17)))->Fill(0);
3056     }//TPC refit
3057     if(fProtonAnalysisBase->IsUsedESDpid()) {
3058       if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) {
3059         ((TH1F *)(fQAAntiProtonsRejectedList->At(18)))->Fill(0);
3060       }
3061       else if((track->GetStatus() & AliESDtrack::kESDpid) != 0)
3062         ((TH1F *)(fQAAntiProtonsAcceptedList->At(18)))->Fill(0);
3063     }//ESD pid
3064     if(fProtonAnalysisBase->IsUsedTPCpid()) {
3065       if ((track->GetStatus() & AliESDtrack::kTPCpid) == 0) {
3066         ((TH1F *)(fQAAntiProtonsRejectedList->At(19)))->Fill(0);
3067       }
3068       else if((track->GetStatus() & AliESDtrack::kTPCpid) != 0)
3069         ((TH1F *)(fQAAntiProtonsAcceptedList->At(19)))->Fill(0);
3070     }//TPC pid
3071     if(fProtonAnalysisBase->IsUsedPointOnITSLayer1()) {
3072       if(!track->HasPointOnITSLayer(0)) {
3073         ((TH1F *)(fQAAntiProtonsRejectedList->At(20)))->Fill(0);
3074       }
3075       else if(track->HasPointOnITSLayer(0))
3076         ((TH1F *)(fQAAntiProtonsAcceptedList->At(20)))->Fill(0);
3077     }//point on SPD1
3078     if(fProtonAnalysisBase->IsUsedPointOnITSLayer2()) {
3079       if(!track->HasPointOnITSLayer(1)) {
3080         ((TH1F *)(fQAAntiProtonsRejectedList->At(21)))->Fill(0);
3081       }
3082       else if(track->HasPointOnITSLayer(1))
3083         ((TH1F *)(fQAAntiProtonsAcceptedList->At(21)))->Fill(0);
3084     }//point on SPD2
3085     if(fProtonAnalysisBase->IsUsedPointOnITSLayer3()) {
3086       if(!track->HasPointOnITSLayer(2)) {
3087         ((TH1F *)(fQAAntiProtonsRejectedList->At(22)))->Fill(0);
3088       }
3089       else if(track->HasPointOnITSLayer(2))
3090         ((TH1F *)(fQAAntiProtonsAcceptedList->At(22)))->Fill(0);
3091     }//point on SDD1
3092     if(fProtonAnalysisBase->IsUsedPointOnITSLayer4()) {
3093       if(!track->HasPointOnITSLayer(3)) {
3094         ((TH1F *)(fQAAntiProtonsRejectedList->At(23)))->Fill(0);
3095       }
3096       else if(track->HasPointOnITSLayer(3))
3097         ((TH1F *)(fQAAntiProtonsAcceptedList->At(23)))->Fill(0);
3098     }//point on SDD2
3099     if(fProtonAnalysisBase->IsUsedPointOnITSLayer5()) {
3100       if(!track->HasPointOnITSLayer(4)) {
3101         ((TH1F *)(fQAAntiProtonsRejectedList->At(24)))->Fill(0);
3102       }
3103       else if(track->HasPointOnITSLayer(4))
3104         ((TH1F *)(fQAAntiProtonsAcceptedList->At(24)))->Fill(0);
3105     }//point on SSD1
3106     if(fProtonAnalysisBase->IsUsedPointOnITSLayer6()) {
3107       if(!track->HasPointOnITSLayer(5)) {
3108         ((TH1F *)(fQAAntiProtonsRejectedList->At(25)))->Fill(0);
3109       }
3110       else if(track->HasPointOnITSLayer(5))
3111         ((TH1F *)(fQAAntiProtonsAcceptedList->At(25)))->Fill(0);
3112     }//point on SSD2
3113     if(fProtonAnalysisBase->IsUsedMinTPCdEdxPoints()) {
3114       if(track->GetTPCsignalN() < fProtonAnalysisBase->GetMinTPCdEdxPoints()) {
3115         ((TH1F *)(fQAAntiProtonsRejectedList->At(26)))->Fill(track->GetTPCsignalN());
3116       }
3117       if(track->GetTPCsignalN() >= fProtonAnalysisBase->GetMinTPCdEdxPoints())
3118         ((TH1F *)(fQAAntiProtonsAcceptedList->At(26)))->Fill(track->GetTPCsignalN());
3119     }//number of TPC points for the dE/dx
3120     if(fProtonAnalysisBase->IsUsedPointOnSPDLayer()) {
3121       if((!track->HasPointOnITSLayer(0))&&(!track->HasPointOnITSLayer(1))) {
3122         for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
3123           if(track->HasPointOnITSLayer(iLayer))
3124             ((TH1F *)(fQAAntiProtonsRejectedList->At(27)))->Fill(iLayer+1);
3125         }
3126       }
3127       else if((track->HasPointOnITSLayer(0))||(track->HasPointOnITSLayer(1))) {
3128         for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
3129           if(track->HasPointOnITSLayer(iLayer))
3130             ((TH1F *)(fQAAntiProtonsAcceptedList->At(27)))->Fill(iLayer+1);
3131         }
3132       }
3133     }//point on either SPD layers
3134     if(fProtonAnalysisBase->IsUsedMaxDCA3D()) {
3135       if(dca3D > fProtonAnalysisBase->GetMaxDCA3D()) {
3136         ((TH1F *)(fQAAntiProtonsRejectedList->At(28)))->Fill(dca3D);
3137       }
3138       if(dca3D < fProtonAnalysisBase->GetMaxDCA3D()) 
3139         ((TH1F *)(fQAAntiProtonsAcceptedList->At(28)))->Fill(dca3D);
3140     }//dca3D
3141   }//antiprotons
3142 }