]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/SPECTRA/AliProtonAnalysis.cxx
Added pass1 and pass2 directories
[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 && 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 && 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 && 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 && 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 && 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 && 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 && 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 && 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 && 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 && 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 && 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 && 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 && 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 && 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 && 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 && 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 && 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 && 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 && 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 && 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   else {
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   if(!fProtonAnalysisBase) return;
905   
906   //=========================================//
907   //Aleph parametrization
908   Double_t fAlephParameters[5];
909   if(fProtonAnalysisBase->GetMCAnalysisMode()) {
910     fAlephParameters[0] = 2.15898e+00/50.;
911     fAlephParameters[1] = 1.75295e+01;
912     fAlephParameters[2] = 3.40030e-09;
913     fAlephParameters[3] = 1.96178e+00;
914     fAlephParameters[4] = 3.91720e+00;
915   }
916   else {
917     fAlephParameters[0] = 0.0283086;
918     fAlephParameters[1] = 2.63394e+01;
919     fAlephParameters[2] = 5.04114e-11;
920     fAlephParameters[3] = 2.12543e+00;
921     fAlephParameters[4] = 4.88663e+00;
922   }
923
924   AliTPCPIDResponse *tpcResponse = new AliTPCPIDResponse();
925   tpcResponse->SetBetheBlochParameters(fAlephParameters[0],fAlephParameters[1],fAlephParameters[2],fAlephParameters[3],fAlephParameters[4]);
926   //=========================================//  
927
928   fHistEvents->Fill(1); //number of analyzed events
929   Double_t containerInput[2] ;
930   Double_t gPt = 0.0, gP = 0.0;
931   Float_t dcaXY = 0.0, dcaZ = 0.0;
932
933   nTracks = esd->GetNumberOfTracks();
934   for(Int_t iTracks = 0; iTracks < nTracks; iTracks++) {
935     AliESDtrack* track = esd->GetTrack(iTracks);
936     AliESDtrack trackTPC;
937
938     Int_t nClustersTPC = track->GetTPCclusters(0x0);
939     Int_t npointsTPCdEdx = track->GetTPCsignalN();
940     Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0};  //The impact parameters and their covariance.
941     Double_t dca3D = 0.0;
942
943     if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
944       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
945       if(!tpcTrack) continue;
946       gPt = tpcTrack->Pt();
947       gP = track->GetInnerParam()->P();
948       tpcTrack->PropagateToDCA(vertex,
949                                esd->GetMagneticField(),
950                                100.,dca,cov);
951       dca3D = TMath::Sqrt(TMath::Power(dca[0],2) +
952                           TMath::Power(dca[1],2));
953
954       if(fProtonAnalysisBase->GetEtaMode())
955         containerInput[0] = tpcTrack->Eta();
956       else
957         containerInput[0] = fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
958                                                           tpcTrack->Py(),
959                                                           tpcTrack->Pz());
960       containerInput[1] = gPt;
961
962        //Step: kStepSurvived
963       if(fProtonAnalysisBase->IsAccepted(track)) {
964         if(fProtonAnalysisBase->IsQARun()) {
965           ((TH2F *)(fQA2DList->At(1)))->Fill(gP,track->GetTPCsignal());
966           ((TH2F *)(fQA2DList->At(3)))->Fill(gP,TMath::Log(track->GetTPCsignal()/tpcResponse->GetExpectedSignal(gP,AliPID::kProton)));
967           ((TH3F *)(fQA2DList->At(5)))->Fill(tpcTrack->Eta(),
968                                              tpcTrack->Phi()*180./TMath::Pi(),
969                                              npointsTPCdEdx);
970           ((TH3F *)(fQA2DList->At(7)))->Fill(tpcTrack->Eta(),
971                                              tpcTrack->Phi()*180./TMath::Pi(),
972                                              nClustersTPC);
973           ((TH3F *)(fQA2DList->At(9)))->Fill(gPt,
974                                              tpcTrack->Phi()*180./TMath::Pi(),
975                                              npointsTPCdEdx);
976           ((TH3F *)(fQA2DList->At(11)))->Fill(gPt,
977                                               tpcTrack->Phi()*180./TMath::Pi(),
978                                               nClustersTPC);
979         }//run the qa
980         
981         if(tpcTrack->Charge() > 0) {
982           fProtonContainer->Fill(containerInput,kStepSurvived);   
983           if(fProtonAnalysisBase->IsQARun()) {
984             ((TH2F *)(fQA2DList->At(12)))->Fill(tpcTrack->Eta(),
985                                                 tpcTrack->Phi()*180./TMath::Pi());
986             if(fProtonAnalysisBase->GetEtaMode()) {
987               ((TH3F *)(fQA2DList->At(14)))->Fill(tpcTrack->Eta(),
988                                                   tpcTrack->Pt(),
989                                                   dca[0]);
990               ((TH3F *)(fQA2DList->At(15)))->Fill(tpcTrack->Eta(),
991                                                   tpcTrack->Pt(),
992                                                   dca[1]);
993               ((TH3F *)(fQA2DList->At(18)))->Fill(tpcTrack->Eta(),
994                                                   tpcTrack->Pt(),
995                                                   TMath::Abs(dca3D));
996             }
997             else {
998               ((TH3F *)(fQA2DList->At(14)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
999                                                   tpcTrack->Pt(),
1000                                                   dca[0]);
1001               ((TH3F *)(fQA2DList->At(15)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1002                                                   tpcTrack->Pt(),
1003                                                   dca[1]);
1004               ((TH3F *)(fQA2DList->At(18)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1005                                                   tpcTrack->Pt(),
1006                                                   TMath::Abs(dca3D));
1007             }
1008           }//run the qa
1009         }//protons
1010         else if(tpcTrack->Charge() < 0) {
1011           fAntiProtonContainer->Fill(containerInput,kStepSurvived);   
1012           if(fProtonAnalysisBase->IsQARun()) {
1013             ((TH2F *)(fQA2DList->At(13)))->Fill(tpcTrack->Eta(),
1014                                                 tpcTrack->Phi()*180./TMath::Pi());
1015             if(fProtonAnalysisBase->GetEtaMode()) {
1016               ((TH3F *)(fQA2DList->At(16)))->Fill(tpcTrack->Eta(),
1017                                                   tpcTrack->Pt(),
1018                                                   dca[0]);
1019               ((TH3F *)(fQA2DList->At(17)))->Fill(tpcTrack->Eta(),
1020                                                   tpcTrack->Pt(),
1021                                                   dca[1]);
1022               ((TH3F *)(fQA2DList->At(19)))->Fill(tpcTrack->Eta(),
1023                                                   tpcTrack->Pt(),
1024                                                   TMath::Abs(dca3D));
1025             }
1026             else {
1027               ((TH3F *)(fQA2DList->At(16)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1028                                                   tpcTrack->Pt(),
1029                                                   dca[0]);
1030               ((TH3F *)(fQA2DList->At(17)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1031                                                   tpcTrack->Pt(),
1032                                                   dca[1]);
1033               ((TH3F *)(fQA2DList->At(19)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1034                                                   tpcTrack->Pt(),
1035                                                   TMath::Abs(dca3D));
1036             }
1037           }//run the qa
1038         }//antiprotons
1039
1040         //Step: kStepIsPrimary
1041         if(fProtonAnalysisBase->IsPrimary(esd,vertex,track)) {
1042           if(tpcTrack->Charge() > 0)
1043             fProtonContainer->Fill(containerInput,kStepIsPrimary);   
1044           else if(tpcTrack->Charge() < 0) 
1045             fAntiProtonContainer->Fill(containerInput,kStepIsPrimary);   
1046           
1047           if(fProtonAnalysisBase->IsQARun()) {
1048             ((TH2F *)(fQA2DList->At(0)))->Fill(gP,track->GetTPCsignal());
1049             ((TH2F *)(fQA2DList->At(2)))->Fill(gP,TMath::Log(track->GetTPCsignal()/tpcResponse->GetExpectedSignal(gP,AliPID::kProton)));
1050             ((TH3F *)(fQA2DList->At(4)))->Fill(tpcTrack->Eta(),
1051                                                tpcTrack->Phi()*180./TMath::Pi(),
1052                                                npointsTPCdEdx);
1053             ((TH3F *)(fQA2DList->At(6)))->Fill(tpcTrack->Eta(),
1054                                                tpcTrack->Phi()*180./TMath::Pi(),
1055                                                nClustersTPC);
1056             ((TH3F *)(fQA2DList->At(8)))->Fill(gPt,
1057                                                tpcTrack->Phi()*180./TMath::Pi(),
1058                                                npointsTPCdEdx);
1059             ((TH3F *)(fQA2DList->At(10)))->Fill(gPt,
1060                                                 tpcTrack->Phi()*180./TMath::Pi(),
1061                                                 nClustersTPC);  
1062             if(track->Charge() > 0)
1063               ((TH2F *)(fQA2DList->At(20)))->Fill(gP,track->GetTPCsignal());
1064             if(track->Charge() < 0)
1065               ((TH2F *)(fQA2DList->At(21)))->Fill(gP,track->GetTPCsignal());
1066           }//run the qa
1067
1068           //Step: kStepIdentified         
1069           if(fProtonAnalysisBase->IsProton(track)) {
1070             if(tpcTrack->Charge() > 0) {
1071               nIdentifiedProtons += 1;
1072               fProtonContainer->Fill(containerInput,kStepIdentified);
1073             }//protons
1074             else if(tpcTrack->Charge() < 0) {
1075               nIdentifiedAntiProtons += 1;
1076               fAntiProtonContainer->Fill(containerInput,kStepIdentified);
1077             }//protons
1078         
1079             if(fProtonAnalysisBase->IsQARun()) FillQA(esd,vertex,track);
1080             
1081             //Step: kStepInPhaseSpace
1082             if(fProtonAnalysisBase->IsInPhaseSpace(track)) {
1083               if(tpcTrack->Charge() > 0) {
1084                 nSurvivedProtons += 1;
1085                 fHistYPtProtons->Fill(containerInput[0],
1086                                       containerInput[1]);
1087                 fProtonContainer->Fill(containerInput,kStepInPhaseSpace);   
1088               }//protons
1089               else if(tpcTrack->Charge() < 0) {
1090                 nSurvivedAntiProtons += 1;
1091                 fHistYPtAntiProtons->Fill(containerInput[0],
1092                                           containerInput[1]);
1093                 fAntiProtonContainer->Fill(containerInput,kStepInPhaseSpace);
1094               }//antiprotons
1095             }//Step: kStepInPhaseSpace
1096           }//Step: kStepIdentified
1097         }//Step: kStepIsPrimary
1098       }//Step: kStepSurvived
1099     }//TPC only tracks
1100     if(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kFullHybrid) {
1101       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
1102       if(!tpcTrack) continue;
1103
1104       AliExternalTrackParam cParam;
1105       gPt = tpcTrack->Pt();
1106       gP = track->GetInnerParam()->P();
1107       track->RelateToVertex(vertex,
1108                             esd->GetMagneticField(),
1109                             100.,&cParam);
1110       track->GetImpactParameters(dcaXY,dcaZ);
1111       dca[0] = dcaXY; dca[1] = dcaZ;
1112       dca3D = TMath::Sqrt(TMath::Power(dca[0],2) +
1113                           TMath::Power(dca[1],2));
1114       if(fProtonAnalysisBase->GetEtaMode())
1115         containerInput[0] = tpcTrack->Eta();
1116       else
1117         containerInput[0] = fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
1118                                                           tpcTrack->Py(),
1119                                                           tpcTrack->Pz());
1120       containerInput[1] = gPt;
1121             
1122       //Step: kStepSurvived
1123       if(fProtonAnalysisBase->IsAccepted(track)) {
1124         if(fProtonAnalysisBase->IsQARun()) {
1125           ((TH2F *)(fQA2DList->At(1)))->Fill(gP,track->GetTPCsignal());
1126           ((TH2F *)(fQA2DList->At(3)))->Fill(gP,TMath::Log(track->GetTPCsignal()/tpcResponse->GetExpectedSignal(gP,AliPID::kProton)));
1127           ((TH3F *)(fQA2DList->At(5)))->Fill(tpcTrack->Eta(),
1128                                              tpcTrack->Phi()*180./TMath::Pi(),
1129                                              npointsTPCdEdx);
1130           ((TH3F *)(fQA2DList->At(7)))->Fill(tpcTrack->Eta(),
1131                                              tpcTrack->Phi()*180./TMath::Pi(),
1132                                              nClustersTPC);
1133           ((TH3F *)(fQA2DList->At(9)))->Fill(gPt,
1134                                              tpcTrack->Phi()*180./TMath::Pi(),
1135                                              npointsTPCdEdx);
1136           ((TH3F *)(fQA2DList->At(11)))->Fill(gPt,
1137                                               tpcTrack->Phi()*180./TMath::Pi(),
1138                                               nClustersTPC);
1139         }//run the qa
1140         if(tpcTrack->Charge() > 0) {
1141           fProtonContainer->Fill(containerInput,kStepSurvived);   
1142           if(fProtonAnalysisBase->IsQARun()) {
1143             ((TH2F *)(fQA2DList->At(12)))->Fill(tpcTrack->Eta(),
1144                                                 tpcTrack->Phi()*180./TMath::Pi());
1145             if(fProtonAnalysisBase->GetEtaMode()) {
1146               ((TH3F *)(fQA2DList->At(14)))->Fill(tpcTrack->Eta(),
1147                                                   tpcTrack->Pt(),
1148                                                   dca[0]);
1149               ((TH3F *)(fQA2DList->At(15)))->Fill(tpcTrack->Eta(),
1150                                                   tpcTrack->Pt(),
1151                                                   dca[1]);
1152               ((TH3F *)(fQA2DList->At(18)))->Fill(tpcTrack->Eta(),
1153                                                   tpcTrack->Pt(),
1154                                                   TMath::Abs(dca3D));
1155             }
1156             else {
1157               ((TH3F *)(fQA2DList->At(14)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1158                                                   tpcTrack->Pt(),
1159                                                   dca[0]);
1160               ((TH3F *)(fQA2DList->At(15)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1161                                                   tpcTrack->Pt(),
1162                                                   dca[1]);
1163               ((TH3F *)(fQA2DList->At(18)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1164                                                   tpcTrack->Pt(),
1165                                                   TMath::Abs(dca3D));
1166             }
1167           }//run the qa
1168         }//protons
1169         else if(tpcTrack->Charge() < 0) {
1170           fAntiProtonContainer->Fill(containerInput,kStepSurvived);   
1171           if(fProtonAnalysisBase->IsQARun()) {
1172             ((TH2F *)(fQA2DList->At(13)))->Fill(tpcTrack->Eta(),
1173                                                 tpcTrack->Phi()*180./TMath::Pi());
1174             if(fProtonAnalysisBase->GetEtaMode()) {
1175               ((TH3F *)(fQA2DList->At(16)))->Fill(tpcTrack->Eta(),
1176                                                   tpcTrack->Pt(),
1177                                                   dca[0]);
1178               ((TH3F *)(fQA2DList->At(17)))->Fill(tpcTrack->Eta(),
1179                                                   tpcTrack->Pt(),
1180                                                   dca[1]);
1181               ((TH3F *)(fQA2DList->At(19)))->Fill(tpcTrack->Eta(),
1182                                                   tpcTrack->Pt(),
1183                                                   TMath::Abs(dca3D));
1184             }
1185             else {
1186               ((TH3F *)(fQA2DList->At(16)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1187                                                   tpcTrack->Pt(),
1188                                                   dca[0]);
1189               ((TH3F *)(fQA2DList->At(17)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1190                                                   tpcTrack->Pt(),
1191                                                   dca[1]);
1192               ((TH3F *)(fQA2DList->At(19)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()),
1193                                                   tpcTrack->Pt(),
1194                                                   TMath::Abs(dca3D));
1195             }
1196           }//run the qa
1197         }//antiprotons
1198
1199         //Step: kStepIsPrimary
1200         if(fProtonAnalysisBase->IsPrimary(esd,vertex,track)) {
1201           if(tpcTrack->Charge() > 0)
1202             fProtonContainer->Fill(containerInput,kStepIsPrimary);   
1203           else if(tpcTrack->Charge() < 0) 
1204             fAntiProtonContainer->Fill(containerInput,kStepIsPrimary);   
1205           
1206           if(fProtonAnalysisBase->IsQARun()) {
1207             ((TH2F *)(fQA2DList->At(0)))->Fill(gP,track->GetTPCsignal());
1208             ((TH2F *)(fQA2DList->At(2)))->Fill(gP,TMath::Log(track->GetTPCsignal()/tpcResponse->GetExpectedSignal(gP,AliPID::kProton)));
1209             ((TH3F *)(fQA2DList->At(4)))->Fill(tpcTrack->Eta(),
1210                                                tpcTrack->Phi()*180./TMath::Pi(),
1211                                                npointsTPCdEdx);
1212             ((TH3F *)(fQA2DList->At(6)))->Fill(tpcTrack->Eta(),
1213                                                tpcTrack->Phi()*180./TMath::Pi(),
1214                                                nClustersTPC);
1215             ((TH3F *)(fQA2DList->At(8)))->Fill(gPt,
1216                                                tpcTrack->Phi()*180./TMath::Pi(),
1217                                                npointsTPCdEdx);
1218             ((TH3F *)(fQA2DList->At(10)))->Fill(gPt,
1219                                                 tpcTrack->Phi()*180./TMath::Pi(),
1220                                                 nClustersTPC);  
1221             if(track->Charge() > 0)
1222               ((TH2F *)(fQA2DList->At(20)))->Fill(gP,track->GetTPCsignal());
1223             if(track->Charge() < 0)
1224               ((TH2F *)(fQA2DList->At(21)))->Fill(gP,track->GetTPCsignal());
1225           }//run the qa
1226           
1227           //Step: kStepIdentified
1228           if(fProtonAnalysisBase->IsProton(track)) {
1229             if(tpcTrack->Charge() > 0) {
1230               nIdentifiedProtons += 1;
1231               fProtonContainer->Fill(containerInput,kStepIdentified);
1232             }//protons
1233             else if(tpcTrack->Charge() < 0) {
1234               nIdentifiedAntiProtons += 1;
1235               fAntiProtonContainer->Fill(containerInput,kStepIdentified);
1236             }//protons
1237             
1238             if(fProtonAnalysisBase->IsQARun()) FillQA(esd,vertex,track);
1239    
1240             //Step: kStepInPhaseSpace
1241             if(fProtonAnalysisBase->IsInPhaseSpace(track)) {
1242               if(tpcTrack->Charge() > 0) {
1243                 nSurvivedProtons += 1;
1244                 fHistYPtProtons->Fill(containerInput[0],
1245                                       containerInput[1]);
1246                 fProtonContainer->Fill(containerInput,kStepInPhaseSpace);   
1247               }//protons
1248               else if(tpcTrack->Charge() < 0) {
1249                 nSurvivedAntiProtons += 1;
1250                 fHistYPtAntiProtons->Fill(containerInput[0],
1251                                           containerInput[1]);
1252                 fAntiProtonContainer->Fill(containerInput,kStepInPhaseSpace);
1253               }//antiprotons
1254             }//Step: kStepInPhaseSpace
1255           }//Step: kStepIdentified
1256         }//Step: kStepIsPrimary
1257       }//Step: kStepSurvived
1258     }//Full hybrid
1259     else if(fProtonAnalysisBase->GetAnalysisMode() == AliProtonAnalysisBase::kGlobal) {
1260       gPt = track->Pt();
1261       gP = track->GetInnerParam()->P();
1262
1263       track->PropagateToDCA(vertex,
1264                             esd->GetMagneticField(),
1265                             100.,dca,cov);
1266       dca3D = TMath::Sqrt(TMath::Power(dca[0],2) +
1267                           TMath::Power(dca[1],2));
1268
1269       if(fProtonAnalysisBase->GetEtaMode())
1270         containerInput[0] = track->Eta();
1271       else
1272         containerInput[0] = fProtonAnalysisBase->Rapidity(track->Px(),
1273                                                           track->Py(),
1274                                                           track->Pz());
1275       containerInput[1] = gPt;
1276       
1277       //Step: kStepSurvived
1278       if(fProtonAnalysisBase->IsAccepted(track)) {
1279         if(fProtonAnalysisBase->IsQARun()) {
1280           ((TH2F *)(fQA2DList->At(1)))->Fill(gP,track->GetTPCsignal());
1281           ((TH2F *)(fQA2DList->At(3)))->Fill(gP,TMath::Log(track->GetTPCsignal()/tpcResponse->GetExpectedSignal(gP,AliPID::kProton)));
1282           ((TH3F *)(fQA2DList->At(5)))->Fill(track->Eta(),
1283                                              track->Phi()*180./TMath::Pi(),
1284                                              npointsTPCdEdx);
1285           ((TH3F *)(fQA2DList->At(7)))->Fill(track->Eta(),
1286                                              track->Phi()*180./TMath::Pi(),
1287                                              nClustersTPC);
1288           ((TH3F *)(fQA2DList->At(9)))->Fill(gPt,
1289                                              track->Phi()*180./TMath::Pi(),
1290                                              npointsTPCdEdx);
1291           ((TH3F *)(fQA2DList->At(11)))->Fill(gPt,
1292                                               track->Phi()*180./TMath::Pi(),
1293                                               nClustersTPC);
1294         }//run the qa
1295         if(track->Charge() > 0) {
1296           fProtonContainer->Fill(containerInput,kStepSurvived);   
1297           if(fProtonAnalysisBase->IsQARun()) {
1298             ((TH2F *)(fQA2DList->At(12)))->Fill(track->Eta(),
1299                                                 track->Phi()*180./TMath::Pi());
1300             if(fProtonAnalysisBase->GetEtaMode()) {
1301               ((TH3F *)(fQA2DList->At(14)))->Fill(track->Eta(),
1302                                                   track->Pt(),
1303                                                   dca[0]);
1304               ((TH3F *)(fQA2DList->At(15)))->Fill(track->Eta(),
1305                                                   track->Pt(),
1306                                                   dca[1]);
1307               ((TH3F *)(fQA2DList->At(18)))->Fill(track->Eta(),
1308                                                   track->Pt(),
1309                                                   TMath::Abs(dca3D));
1310             }
1311             else {
1312               ((TH3F *)(fQA2DList->At(14)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz()),
1313                                                   track->Pt(),
1314                                                   dca[0]);
1315               ((TH3F *)(fQA2DList->At(15)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz()),
1316                                                   track->Pt(),
1317                                                   dca[1]);
1318               ((TH3F *)(fQA2DList->At(18)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz()),
1319                                                   track->Pt(),
1320                                                   TMath::Abs(dca3D));
1321             }
1322           }//run the qa
1323         }//protons
1324         else if(track->Charge() < 0) {
1325           fAntiProtonContainer->Fill(containerInput,kStepSurvived);   
1326           if(fProtonAnalysisBase->IsQARun()) {
1327             ((TH2F *)(fQA2DList->At(13)))->Fill(track->Eta(),
1328                                                 track->Phi()*180./TMath::Pi());
1329             if(fProtonAnalysisBase->GetEtaMode()) {
1330               ((TH3F *)(fQA2DList->At(16)))->Fill(track->Eta(),
1331                                                   track->Pt(),
1332                                                   dca[0]);
1333               ((TH3F *)(fQA2DList->At(17)))->Fill(track->Eta(),
1334                                                   track->Pt(),
1335                                                   dca[1]);
1336               ((TH3F *)(fQA2DList->At(19)))->Fill(track->Eta(),
1337                                                   track->Pt(),
1338                                                   TMath::Abs(dca3D));
1339             }
1340             else {
1341               ((TH3F *)(fQA2DList->At(16)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz()),
1342                                                   track->Pt(),
1343                                                   dca[0]);
1344               ((TH3F *)(fQA2DList->At(17)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz()),
1345                                                   track->Pt(),
1346                                                   dca[1]);
1347               ((TH3F *)(fQA2DList->At(19)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz()),
1348                                                   track->Pt(),
1349                                                   TMath::Abs(dca3D));
1350             }
1351           }//run the qa
1352         }//antiprotons
1353         
1354         //Step: kStepIsPrimary
1355         if(fProtonAnalysisBase->IsPrimary(esd,vertex,track)) {
1356           if(track->Charge() > 0)
1357             fProtonContainer->Fill(containerInput,kStepIsPrimary);   
1358           else if(track->Charge() < 0) 
1359             fAntiProtonContainer->Fill(containerInput,kStepIsPrimary);   
1360           
1361           if(fProtonAnalysisBase->IsQARun()) {
1362             ((TH2F *)(fQA2DList->At(0)))->Fill(gP,track->GetTPCsignal());
1363             ((TH2F *)(fQA2DList->At(2)))->Fill(gP,TMath::Log(track->GetTPCsignal()/tpcResponse->GetExpectedSignal(gP,AliPID::kProton)));
1364             ((TH3F *)(fQA2DList->At(4)))->Fill(track->Eta(),
1365                                                track->Phi()*180./TMath::Pi(),
1366                                                npointsTPCdEdx);
1367             ((TH3F *)(fQA2DList->At(6)))->Fill(track->Eta(),
1368                                                track->Phi()*180./TMath::Pi(),
1369                                                nClustersTPC);
1370             ((TH3F *)(fQA2DList->At(8)))->Fill(gPt,
1371                                                track->Phi()*180./TMath::Pi(),
1372                                                npointsTPCdEdx);
1373             ((TH3F *)(fQA2DList->At(10)))->Fill(gPt,
1374                                                 track->Phi()*180./TMath::Pi(),
1375                                                 nClustersTPC);  
1376             if(track->Charge() > 0)
1377               ((TH2F *)(fQA2DList->At(20)))->Fill(gP,track->GetTPCsignal());
1378             if(track->Charge() < 0)
1379               ((TH2F *)(fQA2DList->At(21)))->Fill(gP,track->GetTPCsignal());
1380           }//run the qa
1381
1382           //Step: kStepIdentified
1383           if(fProtonAnalysisBase->IsProton(track)) {
1384             if(track->Charge() > 0) {
1385               nIdentifiedProtons += 1;
1386               fProtonContainer->Fill(containerInput,kStepIdentified);
1387             }//protons
1388             else if(track->Charge() < 0) {
1389               nIdentifiedAntiProtons += 1;
1390               fAntiProtonContainer->Fill(containerInput,kStepIdentified);
1391             }//protons
1392             
1393             if(fProtonAnalysisBase->IsQARun()) FillQA(esd,vertex,track);
1394             
1395             //Step: kStepInPhaseSpace
1396             if(fProtonAnalysisBase->IsInPhaseSpace(track)) {
1397               if(track->Charge() > 0) {
1398                 nSurvivedProtons += 1;
1399                 fHistYPtProtons->Fill(containerInput[0],
1400                                       containerInput[1]);
1401                 fProtonContainer->Fill(containerInput,kStepInPhaseSpace);   
1402               }//protons
1403               else if(track->Charge() < 0) {
1404                 nSurvivedAntiProtons += 1;
1405                 fHistYPtAntiProtons->Fill(containerInput[0],
1406                                           containerInput[1]);
1407                 fAntiProtonContainer->Fill(containerInput,kStepInPhaseSpace);
1408               }//antiprotons
1409             }//Step: kStepInPhaseSpace
1410           }//Step: kStepIdentified
1411         }//Step: kStepIsPrimary
1412       }//Step: kStepSurvived
1413     }//Global tracking
1414   }//track loop 
1415   
1416   delete tpcResponse;
1417   
1418   if((nIdentifiedProtons > 0)||(nIdentifiedAntiProtons > 0))
1419     fHistEvents->Fill(2); //number of analyzed events with at least one (anti)proton
1420   
1421   if(fProtonAnalysisBase->GetDebugMode())
1422     Printf("Initial number of tracks: %d | Identified (anti)protons: %d - %d | Survived (anti)protons: %d - %d",nTracks,nIdentifiedProtons,nIdentifiedAntiProtons,nSurvivedProtons,nSurvivedAntiProtons);
1423 }
1424
1425 //____________________________________________________________________//
1426 void AliProtonAnalysis::Analyze(AliAODEvent* const fAOD) {
1427   //Main analysis part - AOD
1428   if(!fProtonAnalysisBase) return;
1429   fHistEvents->Fill(1); //number of analyzed events
1430   Int_t nTracks = fAOD->GetNumberOfTracks();
1431   for(Int_t iTracks = 0; iTracks < nTracks; iTracks++) {
1432     AliAODTrack* track = fAOD->GetTrack(iTracks);
1433     Double_t gPt = track->Pt();
1434     Double_t gP = track->P();
1435     
1436     //pid
1437     Double_t probability[10];
1438     track->GetPID(probability);
1439     Double_t rcc = 0.0;
1440     for(Int_t i = 0; i < AliPID::kSPECIESN; i++) rcc += probability[i]*fProtonAnalysisBase->GetParticleFraction(i,gP);
1441     if(rcc == 0.0) continue;
1442     Double_t w[10];
1443     for(Int_t i = 0; i < AliPID::kSPECIESN; i++) w[i] = probability[i]*fProtonAnalysisBase->GetParticleFraction(i,gP)/rcc;
1444     Long64_t fParticleType = TMath::LocMax(AliPID::kSPECIESN,w);
1445     if(fParticleType == 4) {
1446       if(track->Charge() > 0) 
1447         fHistYPtProtons->Fill(track->Y(fParticleType),gPt);
1448       else if(track->Charge() < 0) 
1449         fHistYPtAntiProtons->Fill(track->Y(fParticleType),gPt);
1450     }//proton check
1451   }//track loop 
1452 }
1453
1454 //____________________________________________________________________//
1455 void AliProtonAnalysis::Analyze(AliStack* const stack, 
1456                                 Bool_t iInclusive) {
1457   //Main analysis part - MC
1458   if(!fProtonAnalysisBase) return;
1459   fHistEvents->Fill(1); //number of analyzed events
1460
1461   Int_t nParticles = 0;
1462   //inclusive protons - 
1463   if(iInclusive) nParticles = stack->GetNtrack();
1464   else nParticles = stack->GetNprimary();
1465
1466   for(Int_t i = 0; i < nParticles; i++) {
1467     TParticle *particle = stack->Particle(i);
1468     if(!particle) continue;
1469
1470     //in case of inclusive protons reject the secondaries from hadronic inter.
1471     if(particle->GetUniqueID() == 13) continue;
1472
1473     if(TMath::Abs(particle->Eta()) > 1.0) continue;
1474     if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
1475     if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
1476
1477     Int_t pdgcode = particle->GetPdgCode();
1478     if(pdgcode == 2212) fHistYPtProtons->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
1479                                                                             particle->Py(),
1480                                                                             particle->Pz()),
1481                                               particle->Pt());
1482     if(pdgcode == -2212) fHistYPtAntiProtons->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
1483                                                                                  particle->Py(),
1484                                                                                  particle->Pz()),
1485                                                    particle->Pt());
1486   }//particle loop
1487 }
1488
1489 //____________________________________________________________________//
1490 Bool_t AliProtonAnalysis::PrintMean(TH1 *hist, Double_t edge) {
1491   //calculates the mean value of the ratio/asymmetry within \pm edge
1492   Double_t sum = 0.0, sumError = 0.0;
1493   Int_t nentries = 0;
1494   //calculate the mean
1495   for(Int_t i = 1; i <= hist->GetXaxis()->GetNbins(); i++) {
1496     Double_t x = hist->GetBinCenter(i);
1497     Double_t y = hist->GetBinContent(i);
1498     if(TMath::Abs(x) < edge) {
1499       sum += y;
1500       sumError += TMath::Power(hist->GetBinError(i),2);
1501       nentries += 1;
1502     }
1503     //Printf("eta: %lf - sum: %lf - sumError: %lf - counter: %d",
1504     //TMath::Abs(x),sum,sumError,nentries);
1505   }
1506   Double_t mean = 0.0;
1507   Double_t error = 0.0;
1508   if(nentries != 0) {
1509     mean = sum/nentries;
1510     error =  TMath::Sqrt(sumError)/nentries;
1511   }
1512
1513   //calculate the error
1514     /*for(Int_t i = 1; i <= hist->GetXaxis()->GetNbins(); i++) {
1515     Double_t x = hist->GetBinCenter(i);
1516     Double_t y = hist->GetBinContent(i);
1517     if(TMath::Abs(x) < edge) {
1518       sum += TMath::Power((mean - y),2);
1519       nentries += 1;
1520     }
1521     }*/
1522
1523
1524   cout<<"========================================="<<endl;
1525   cout<<"Input distribution: "<<hist->GetName()<<endl;
1526   cout<<"Interval used: -"<<edge<<" -> "<<edge<<endl;
1527   cout<<"Mean value :"<<mean<<endl;
1528   cout<<"Error: "<<error<<endl;
1529   cout<<"========================================="<<endl;
1530
1531   return 0;
1532 }
1533
1534 //____________________________________________________________________//
1535 Bool_t AliProtonAnalysis::PrintYields(TH1 *hist, Double_t edge) {
1536   //calculates the (anti)proton yields within the \pm edge
1537   Double_t sum = 0.0, sumerror = 0.0;
1538   Double_t error = 0.0;
1539   for(Int_t i = 0; i < hist->GetXaxis()->GetNbins(); i++) {
1540     Double_t x = hist->GetBinCenter(i+1);
1541     Double_t y = hist->GetBinContent(i+1);
1542     if(TMath::Abs(x) < edge) {
1543       sum += y;
1544       sumerror += TMath::Power(hist->GetBinError(i+1),2); 
1545     }
1546   }
1547
1548   error = TMath::Sqrt(sumerror);
1549
1550   cout<<"========================================="<<endl;
1551   cout<<"Input distribution: "<<hist->GetName()<<endl;
1552   cout<<"Interval used: -"<<edge<<" -> "<<edge<<endl;
1553   cout<<"Yields :"<<sum<<endl;
1554   cout<<"Error: "<<error<<endl;
1555   cout<<"========================================="<<endl;
1556
1557   return 0;
1558 }
1559
1560 //____________________________________________________________________//
1561 void AliProtonAnalysis::SetCorrectionMapForCuts(const char* filename) {
1562   //Reads the file with the correction maps for the cut efficiency
1563   TFile *gCorrectionForCuts = TFile::Open(filename);
1564   if(!gCorrectionForCuts) {
1565     Printf("The TFile object is not valid!!!");
1566     return;
1567   }
1568   if(!gCorrectionForCuts->IsOpen()) {
1569     Printf("The file is not found!!!");
1570     return;
1571   }
1572   fHistYPtCorrectionForCutsProtons = dynamic_cast<TH2D *>(gCorrectionForCuts->Get("gHistCorrectionForCutsProtons"));
1573   fHistYPtCorrectionForCutsAntiProtons = dynamic_cast<TH2D *>(gCorrectionForCuts->Get("gHistCorrectionForCutsAntiProtons"));
1574   fCorrectForCutsFlag = kTRUE;
1575 }
1576
1577 //____________________________________________________________________//
1578 void AliProtonAnalysis::SetCorrectionMapForTracking(const char* filename) {
1579   //Reads the file with the correction maps for the tracking efficiency
1580   TFile *gCorrectionForTracking = TFile::Open(filename);
1581   if(!gCorrectionForTracking) {
1582     Printf("The TFile object is not valid!!!");
1583     return;
1584   }
1585   if(!gCorrectionForTracking->IsOpen()) {
1586     Printf("The file is not found!!!");
1587     return;
1588   }
1589   fHistYPtCorrectionForTrackingProtons = dynamic_cast<TH2D *>(gCorrectionForTracking->Get("gHistCorrectionForTrackingProtons"));
1590   fHistYPtCorrectionForTrackingAntiProtons = dynamic_cast<TH2D *>(gCorrectionForTracking->Get("gHistCorrectionForTrackingAntiProtons"));
1591   fCorrectForTrackingFlag = kTRUE;
1592 }
1593
1594 //____________________________________________________________________//
1595 void AliProtonAnalysis::SetCorrectionMapForFeedDown(const char* filename) {
1596   //Reads the file with the correction maps for the feed-down contamination
1597   TFile *gCorrectionForFeedDown = TFile::Open(filename);
1598   if(!gCorrectionForFeedDown) {
1599     Printf("The TFile object is not valid!!!");
1600     return;
1601   }
1602   if(!gCorrectionForFeedDown->IsOpen()) {
1603     Printf("The file is not found!!!");
1604     return;
1605   }
1606   fHistYPtCorrectionForFeedDownProtons = dynamic_cast<TH2D *>(gCorrectionForFeedDown->Get("gHistCorrectionForFeedDownProtons"));
1607   fHistYPtCorrectionForFeedDownAntiProtons = dynamic_cast<TH2D *>(gCorrectionForFeedDown->Get("gHistCorrectionForFeedDownAntiProtons"));
1608   fCorrectForFeedDownFlag = kTRUE;
1609 }
1610
1611 //____________________________________________________________________//
1612 void AliProtonAnalysis::SetCorrectionMapForSecondaries(const char* filename) {
1613   //Reads the file with the correction maps for the secondaries
1614   TFile *gCorrectionForSecondaries = TFile::Open(filename);
1615   if(!gCorrectionForSecondaries) {
1616     Printf("The TFile object is not valid!!!");
1617     return;
1618   }
1619   if(!gCorrectionForSecondaries->IsOpen()) {
1620     Printf("The file is not found!!!");
1621     return;
1622   }
1623
1624   fHistYPtCorrectionForSecondaries = dynamic_cast<TH2D *>(gCorrectionForSecondaries->Get("gHistCorrectionForSecondaries"));
1625   fCorrectForSecondariesFlag = kTRUE;
1626 }
1627
1628 //____________________________________________________________________//
1629 void AliProtonAnalysis::SetCorrectionMapForCrossSection(const char* filename) {
1630   //Reads the file with the correction maps for the proper x-section
1631   TFile *gCorrectionForXSection = TFile::Open(filename);
1632   if(!gCorrectionForXSection) {
1633     Printf("The TFile object is not valid!!!");
1634     return;
1635   }
1636   if(!gCorrectionForXSection->IsOpen()) {
1637     Printf("The file is not found!!!");
1638     return;
1639   }
1640
1641   fHistCorrectionForCrossSectionYPtProtons = dynamic_cast<TH2D *>(gCorrectionForXSection->Get("gHistCorrectionForCrossSectionProtons"));
1642   fHistCorrectionForCrossSectionYPtAntiProtons = dynamic_cast<TH2D *>(gCorrectionForXSection->Get("gHistCorrectionForCrossSectionAntiProtons"));
1643   fHistCorrectionForCrossSectionFlag = kTRUE;
1644 }
1645
1646 //____________________________________________________________________//
1647 void AliProtonAnalysis::Correct() {
1648   //Apply the corrections: Fast & dirty way for the absorption corrections
1649   //Correct the protons for the efficiency
1650   fHistYPtProtonsCorrected = fProtonContainer->ShowProjection(0,1,kStepInPhaseSpace);
1651   fHistYPtProtonsCorrected->Divide(fHistEfficiencyYPtProtons);
1652   //Correct the protons for proper cross-section
1653   if(fHistCorrectionForCrossSectionFlag)
1654     fHistYPtProtonsCorrected->Multiply(fHistCorrectionForCrossSectionYPtProtons);
1655   //Correct the protons for secondaries
1656   if(fCorrectForSecondariesFlag)
1657     fHistYPtProtonsCorrected->Divide(fHistYPtCorrectionForSecondaries);
1658   //Correct the protons for feed-down
1659   if(fCorrectForFeedDownFlag)
1660     fHistYPtProtonsCorrected->Divide(fHistYPtCorrectionForFeedDownProtons);
1661   //Correct the protons for the cut efficiency
1662   if(fCorrectForCutsFlag)
1663     fHistYPtProtonsCorrected->Multiply(fHistYPtCorrectionForCutsProtons);
1664   //Correct the protons for the tracking efficiency
1665   if(fCorrectForTrackingFlag)
1666     fHistYPtProtonsCorrected->Multiply(fHistYPtCorrectionForTrackingProtons);
1667  
1668   //Correct the antiprotons for the efficiency
1669   fHistYPtAntiProtonsCorrected = fAntiProtonContainer->ShowProjection(0,1,kStepInPhaseSpace);
1670   fHistYPtAntiProtonsCorrected->Divide(fHistEfficiencyYPtAntiProtons);
1671   //Correct the antiprotons for proper cross-section
1672   if(fHistCorrectionForCrossSectionFlag)
1673     fHistYPtAntiProtonsCorrected->Multiply(fHistCorrectionForCrossSectionYPtAntiProtons);
1674   //Correct the antiprotons for feed-down
1675   if(fCorrectForFeedDownFlag)
1676     fHistYPtAntiProtonsCorrected->Divide(fHistYPtCorrectionForFeedDownAntiProtons);
1677   //Correct the antiprotons for the cut efficiency
1678    if(fCorrectForCutsFlag)
1679      fHistYPtAntiProtonsCorrected->Multiply(fHistYPtCorrectionForCutsAntiProtons);
1680   //Correct the antiprotons for the tracking efficiency
1681    if(fCorrectForTrackingFlag)
1682      fHistYPtAntiProtonsCorrected->Multiply(fHistYPtCorrectionForTrackingAntiProtons);
1683 }
1684
1685 //____________________________________________________________________//
1686 void AliProtonAnalysis::Correct(Int_t step) {
1687   //Applies the correction maps to the initial containers
1688   fCorrectProtons = new AliCFDataGrid("correctProtons",
1689                                       "corrected data",
1690                                       *fProtonContainer,0);
1691   //fCorrectProtons->SetMeasured(0);
1692   fCorrectProtons->ApplyEffCorrection(*(AliCFEffGrid *)fEffGridListProtons->At(step));
1693
1694   fCorrectAntiProtons = new AliCFDataGrid("correctAntiProtons",
1695                                           "corrected data",
1696                                           *fAntiProtonContainer,0);
1697   //fCorrectAntiProtons->SetMeasured(0);
1698   fCorrectAntiProtons->ApplyEffCorrection(*(AliCFEffGrid *)fEffGridListAntiProtons->At(step));
1699 }
1700
1701 //____________________________________________________________________//
1702 Bool_t AliProtonAnalysis::ReadCorrectionContainer(const char* filename) {
1703   // Reads the outout of the correction framework task
1704   // Creates the correction maps
1705   // Puts the results in the different TList objects
1706   Bool_t status = kTRUE;
1707
1708   TFile *file = TFile::Open(filename);
1709   if(!file) {
1710     cout<<"Could not find the input CORRFW file "<<filename<<endl;
1711     status = kFALSE;
1712   }
1713   else {
1714     TList *list = dynamic_cast<TList *>(file->Get("outputList"));
1715     Int_t iRap = 0, iPt = 1;
1716
1717     //Calculation of efficiency/correction: Protons
1718     AliCFContainer *gProtonContainer = dynamic_cast<AliCFContainer *>(list->At(0));
1719     AliCFContainer *gAntiProtonContainer = dynamic_cast<AliCFContainer *>(list->At(1));
1720
1721     if (gProtonContainer && gAntiProtonContainer){
1722       AliCFEffGrid *effProtonsStep0Step2 = new AliCFEffGrid("eff20",
1723                                                             "effProtonsStep0Step2",
1724                                                             *gProtonContainer);
1725       effProtonsStep0Step2->CalculateEfficiency(2,0); 
1726       fHistEfficiencyYPtProtons = (TH2D*)effProtonsStep0Step2->Project(iRap,iPt);
1727       fHistEfficiencyYPtProtons->Sumw2();
1728
1729       //Calculation of efficiency/correction: Protons
1730       AliCFEffGrid *effAntiProtonsStep0Step2 = new AliCFEffGrid("eff20",
1731                                                                 "effAntiProtonsStep0Step2",
1732                                                                 *gAntiProtonContainer);
1733       effAntiProtonsStep0Step2->CalculateEfficiency(2,0); 
1734       fHistEfficiencyYPtAntiProtons = (TH2D*)effAntiProtonsStep0Step2->Project(iRap,iPt);
1735       fHistEfficiencyYPtAntiProtons->Sumw2();
1736
1737       Correct();
1738     }
1739     else {
1740       cout<<"Could not retreive the proton and anti-proton correction containers"<<endl;
1741       status = kFALSE;
1742     }
1743   }
1744
1745   return status;
1746 }
1747
1748 //____________________________________________________________________//
1749 /*Bool_t AliProtonAnalysis::ReadCorrectionContainer(const char* filename) {
1750   // Reads the outout of the correction framework task
1751   // Creates the correction maps
1752   // Puts the results in the different TList objects
1753   Bool_t status = kTRUE;
1754
1755   TFile *file = TFile::Open(filename);
1756   if(!file) {
1757     cout<<"Could not find the input CORRFW file "<<filename<<endl;
1758     status = kFALSE;
1759   }
1760
1761   //________________________________________//
1762   //Protons
1763   fEffGridListProtons = new TList();
1764   fCorrectionListProtons2D = new TList(); 
1765   fEfficiencyListProtons1D = new TList(); 
1766   fCorrectionListProtons1D = new TList();
1767   
1768   AliCFContainer *corrfwContainerProtons = (AliCFContainer*) (file->Get("containerProtons"));
1769   if(!corrfwContainerProtons) {
1770     cout<<"CORRFW container for protons not found!"<<endl;
1771     status = kFALSE;
1772   }
1773   
1774   Int_t nSteps = corrfwContainerProtons->GetNStep();
1775   TH2D *gYPt[4];
1776   //currently the GRID is formed by the y-pT parameters
1777   //Add Vz as a next step
1778   Int_t iRap = 0, iPt = 1;
1779   AliCFEffGrid *effProtonsStep0Step1 = new AliCFEffGrid("eff10",
1780                                          "effProtonsStep0Step1",
1781                                          *corrfwContainerProtons);
1782   effProtonsStep0Step1->CalculateEfficiency(1,0); //eff= step1/step0
1783   fEffGridListProtons->Add(effProtonsStep0Step1);
1784   gYPt[0] = effProtonsStep0Step1->Project(iRap,iPt);
1785   fCorrectionListProtons2D->Add(gYPt[0]);
1786   
1787   AliCFEffGrid *effProtonsStep0Step2 = new AliCFEffGrid("eff20",
1788                                          "effProtonsStep0Step2",
1789                                          *corrfwContainerProtons);
1790   effProtonsStep0Step2->CalculateEfficiency(2,0); //eff= step2/step0
1791   fEffGridListProtons->Add(effProtonsStep0Step2);
1792   gYPt[1] = effProtonsStep0Step2->Project(iRap,iPt);
1793   fCorrectionListProtons2D->Add(gYPt[1]);
1794
1795   AliCFEffGrid *effProtonsStep0Step3 = new AliCFEffGrid("eff30",
1796                                          "effProtonsStep0Step3",
1797                                          *corrfwContainerProtons);
1798   effProtonsStep0Step3->CalculateEfficiency(3,0); //eff= step1/step0
1799   fEffGridListProtons->Add(effProtonsStep0Step3);
1800   gYPt[2] = effProtonsStep0Step3->Project(iRap,iPt);
1801   fCorrectionListProtons2D->Add(gYPt[2]);
1802
1803   TH1D *gEfficiency[2][3]; //efficiency as a function of pT and of y (raws-[2])
1804   TH1D *gCorrection[2][3]; //efficiency as a function of pT and of y (raws-[2])
1805   TString gTitle;
1806   //Get the projection of the efficiency maps
1807   for(Int_t iParameter = 0; iParameter < 2; iParameter++) {
1808     gEfficiency[iParameter][0] = effProtonsStep0Step1->Project(iParameter);
1809     gTitle = "ProtonsEfficiency_Parameter"; gTitle += iParameter+1;
1810     gTitle += "_Step0_Step1"; 
1811     gEfficiency[iParameter][0]->SetName(gTitle.Data());
1812     fEfficiencyListProtons1D->Add(gEfficiency[iParameter][0]);  
1813     gTitle = "ProtonsCorrection_Parameter"; gTitle += iParameter+1;
1814     gTitle += "_Step0_Step1"; 
1815     gCorrection[iParameter][0] = new TH1D(gTitle.Data(),
1816                                           gTitle.Data(),
1817                                           gEfficiency[iParameter][0]->GetNbinsX(),
1818                                           gEfficiency[iParameter][0]->GetXaxis()->GetXmin(),
1819                                           gEfficiency[iParameter][0]->GetXaxis()->GetXmax());
1820     //initialisation of the correction
1821     for(Int_t iBin = 1; iBin <= gEfficiency[iParameter][0]->GetNbinsX(); iBin++)
1822       gCorrection[iParameter][0]->SetBinContent(iBin,1.0);
1823
1824     gEfficiency[iParameter][1] = effProtonsStep0Step2->Project(iParameter);
1825     gTitle = "ProtonsEfficiency_Parameter"; gTitle += iParameter+1;
1826     gTitle += "_Step0_Step2"; 
1827     gEfficiency[iParameter][1]->SetName(gTitle.Data());
1828     fEfficiencyListProtons1D->Add(gEfficiency[iParameter][1]);  
1829     gTitle = "ProtonsCorrection_Parameter"; gTitle += iParameter+1;
1830     gTitle += "_Step0_Step2"; 
1831     gCorrection[iParameter][1] = new TH1D(gTitle.Data(),
1832                                           gTitle.Data(),
1833                                           gEfficiency[iParameter][1]->GetNbinsX(),
1834                                           gEfficiency[iParameter][1]->GetXaxis()->GetXmin(),
1835                                           gEfficiency[iParameter][1]->GetXaxis()->GetXmax());
1836     //initialisation of the correction
1837     for(Int_t iBin = 1; iBin <= gEfficiency[iParameter][1]->GetNbinsX(); iBin++)
1838       gCorrection[iParameter][1]->SetBinContent(iBin,1.0);
1839
1840     gEfficiency[iParameter][2] = effProtonsStep0Step3->Project(iParameter);
1841     gTitle = "ProtonsEfficiency_Parameter"; gTitle += iParameter+1;
1842     gTitle += "_Step0_Step3"; 
1843     gEfficiency[iParameter][2]->SetName(gTitle.Data());
1844     fEfficiencyListProtons1D->Add(gEfficiency[iParameter][2]);  
1845     gTitle = "ProtonsCorrection_Parameter"; gTitle += iParameter+1;
1846     gTitle += "_Step0_Step3"; 
1847     gCorrection[iParameter][2] = new TH1D(gTitle.Data(),
1848                                           gTitle.Data(),
1849                                           gEfficiency[iParameter][2]->GetNbinsX(),
1850                                           gEfficiency[iParameter][2]->GetXaxis()->GetXmin(),
1851                                           gEfficiency[iParameter][2]->GetXaxis()->GetXmax());
1852     //initialisation of the correction
1853     for(Int_t iBin = 1; iBin <= gEfficiency[iParameter][2]->GetNbinsX(); iBin++)
1854       gCorrection[iParameter][2]->SetBinContent(iBin,1.0);
1855   }//parameter loop
1856   //Calculate the 1D correction parameters as a function of y and pT
1857   for(Int_t iParameter = 0; iParameter < 2; iParameter++) { 
1858     for(Int_t iStep = 1; iStep < nSteps; iStep++) { 
1859       gCorrection[iParameter][iStep-1]->Divide(gEfficiency[iParameter][iStep-1]);
1860       fCorrectionListProtons1D->Add(gCorrection[iParameter][iStep-1]);  
1861     }
1862   }
1863
1864   //________________________________________//
1865   //AntiProtons
1866   fEffGridListAntiProtons = new TList();
1867   fCorrectionListAntiProtons2D = new TList(); 
1868   fEfficiencyListAntiProtons1D = new TList(); 
1869   fCorrectionListAntiProtons1D = new TList();
1870   
1871   AliCFContainer *corrfwContainerAntiProtons = (AliCFContainer*) (file->Get("containerAntiProtons"));
1872   if(!corrfwContainerAntiProtons) {
1873     cout<<"CORRFW container for antiprotons not found!"<<endl;
1874     status = kFALSE;
1875   }
1876   
1877   nSteps = corrfwContainerAntiProtons->GetNStep();
1878   //currently the GRID is formed by the y-pT parameters
1879   //Add Vz as a next step
1880   AliCFEffGrid *effAntiProtonsStep0Step1 = new AliCFEffGrid("eff10",
1881                                          "effAntiProtonsStep0Step1",
1882                                          *corrfwContainerAntiProtons);
1883   effAntiProtonsStep0Step1->CalculateEfficiency(1,0); //eff= step1/step0
1884   fEffGridListAntiProtons->Add(effAntiProtonsStep0Step1);
1885   gYPt[0] = effAntiProtonsStep0Step1->Project(iRap,iPt);
1886   fCorrectionListAntiProtons2D->Add(gYPt[0]);
1887   
1888   AliCFEffGrid *effAntiProtonsStep0Step2 = new AliCFEffGrid("eff20",
1889                                          "effAntiProtonsStep0Step2",
1890                                          *corrfwContainerAntiProtons);
1891   effAntiProtonsStep0Step2->CalculateEfficiency(2,0); //eff= step2/step0
1892   fEffGridListAntiProtons->Add(effAntiProtonsStep0Step2);
1893   gYPt[1] = effAntiProtonsStep0Step2->Project(iRap,iPt);
1894   fCorrectionListAntiProtons2D->Add(gYPt[1]);
1895
1896   AliCFEffGrid *effAntiProtonsStep0Step3 = new AliCFEffGrid("eff30",
1897                                          "effAntiProtonsStep0Step3",
1898                                          *corrfwContainerAntiProtons);
1899   effAntiProtonsStep0Step3->CalculateEfficiency(3,0); //eff= step1/step0
1900   fEffGridListAntiProtons->Add(effAntiProtonsStep0Step3);
1901   gYPt[2] = effAntiProtonsStep0Step3->Project(iRap,iPt);
1902   fCorrectionListAntiProtons2D->Add(gYPt[2]);
1903
1904   //Get the projection of the efficiency maps
1905   for(Int_t iParameter = 0; iParameter < 2; iParameter++) {
1906     gEfficiency[iParameter][0] = effAntiProtonsStep0Step1->Project(iParameter);
1907     gTitle = "AntiProtonsEfficiency_Parameter"; gTitle += iParameter+1;
1908     gTitle += "_Step0_Step1"; 
1909     gEfficiency[iParameter][0]->SetName(gTitle.Data());
1910     fEfficiencyListAntiProtons1D->Add(gEfficiency[iParameter][0]);  
1911     gTitle = "AntiProtonsCorrection_Parameter"; gTitle += iParameter+1;
1912     gTitle += "_Step0_Step1"; 
1913     gCorrection[iParameter][0] = new TH1D(gTitle.Data(),
1914                                           gTitle.Data(),
1915                                           gEfficiency[iParameter][0]->GetNbinsX(),
1916                                           gEfficiency[iParameter][0]->GetXaxis()->GetXmin(),
1917                                           gEfficiency[iParameter][0]->GetXaxis()->GetXmax());
1918     //initialisation of the correction
1919     for(Int_t iBin = 1; iBin <= gEfficiency[iParameter][0]->GetNbinsX(); iBin++)
1920       gCorrection[iParameter][0]->SetBinContent(iBin,1.0);
1921
1922     gEfficiency[iParameter][1] = effAntiProtonsStep0Step2->Project(iParameter);
1923     gTitle = "AntiProtonsEfficiency_Parameter"; gTitle += iParameter+1;
1924     gTitle += "_Step0_Step2"; 
1925     gEfficiency[iParameter][1]->SetName(gTitle.Data());
1926     fEfficiencyListAntiProtons1D->Add(gEfficiency[iParameter][1]);  
1927     gTitle = "AntiProtonsCorrection_Parameter"; gTitle += iParameter+1;
1928     gTitle += "_Step0_Step2"; 
1929     gCorrection[iParameter][1] = new TH1D(gTitle.Data(),
1930                                           gTitle.Data(),
1931                                           gEfficiency[iParameter][1]->GetNbinsX(),
1932                                           gEfficiency[iParameter][1]->GetXaxis()->GetXmin(),
1933                                           gEfficiency[iParameter][1]->GetXaxis()->GetXmax());
1934     //initialisation of the correction
1935     for(Int_t iBin = 1; iBin <= gEfficiency[iParameter][1]->GetNbinsX(); iBin++)
1936       gCorrection[iParameter][1]->SetBinContent(iBin,1.0);
1937
1938     gEfficiency[iParameter][2] = effAntiProtonsStep0Step3->Project(iParameter);
1939     gTitle = "AntiProtonsEfficiency_Parameter"; gTitle += iParameter+1;
1940     gTitle += "_Step0_Step3"; 
1941     gEfficiency[iParameter][2]->SetName(gTitle.Data());
1942     fEfficiencyListAntiProtons1D->Add(gEfficiency[iParameter][2]);  
1943     gTitle = "AntiProtonsCorrection_Parameter"; gTitle += iParameter+1;
1944     gTitle += "_Step0_Step3"; 
1945     gCorrection[iParameter][2] = new TH1D(gTitle.Data(),
1946                                           gTitle.Data(),
1947                                           gEfficiency[iParameter][2]->GetNbinsX(),
1948                                           gEfficiency[iParameter][2]->GetXaxis()->GetXmin(),
1949                                           gEfficiency[iParameter][2]->GetXaxis()->GetXmax());
1950     //initialisation of the correction
1951     for(Int_t iBin = 1; iBin <= gEfficiency[iParameter][2]->GetNbinsX(); iBin++)
1952       gCorrection[iParameter][2]->SetBinContent(iBin,1.0);
1953   }//parameter loop
1954   //Calculate the 1D correction parameters as a function of y and pT
1955   for(Int_t iParameter = 0; iParameter < 2; iParameter++) { 
1956     for(Int_t iStep = 1; iStep < nSteps; iStep++) { 
1957       gCorrection[iParameter][iStep-1]->Divide(gEfficiency[iParameter][iStep-1]);
1958       fCorrectionListAntiProtons1D->Add(gCorrection[iParameter][iStep-1]);  
1959     }
1960   }
1961
1962   return status;
1963   }*/
1964  
1965 //____________________________________________________________________//
1966 void AliProtonAnalysis::InitQA() {
1967   if(!fProtonAnalysisBase) return;
1968   //Applies the correction maps to the initial containers
1969   fGlobalQAList = new TList();
1970   fGlobalQAList->SetName("fGlobalQAList");
1971
1972   //========================================================//
1973   fQA2DList = new TList();
1974   fQA2DList->SetName("fQA2DList");
1975   fGlobalQAList->Add(fQA2DList);
1976
1977   //dEdx plots
1978   TH2F *gHistdEdxP = new TH2F("gHistdEdxP","dE/dx (TPC); P [GeV/c]; dE/dx [a.u]",1000,0.05,20.05,600,0,600);
1979   fQA2DList->Add(gHistdEdxP);
1980   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);
1981   fQA2DList->Add(gHistProtonsdEdxP);
1982
1983   //normalized dEdx plots
1984   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);
1985   fQA2DList->Add(gHistZP);
1986   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);
1987   fQA2DList->Add(gHistProtonsZP);
1988
1989   //eta-phi-Npoints(dEdx)
1990   TH3F *gHistEtaPhiTPCdEdxNPoints = new TH3F("gHistEtaPhiTPCdEdxNPoints",
1991                                              ";#eta;#phi;N_{points}(TPC)",
1992                                              18,-0.9,0.9,
1993                                              180,0,360,
1994                                              100,0,200);
1995   gHistEtaPhiTPCdEdxNPoints->SetStats(kTRUE);
1996   fQA2DList->Add(gHistEtaPhiTPCdEdxNPoints);
1997   TH3F *gHistProtonsEtaPhiTPCdEdxNPoints = new TH3F("gHistProtonsEtaPhiTPCdEdxNPoints",
1998                                                     ";#eta;#phi;N_{points}(TPC)",
1999                                                     18,-0.9,0.9,
2000                                                     180,0,360,
2001                                                     100,0,200);
2002   gHistProtonsEtaPhiTPCdEdxNPoints->SetStats(kTRUE);
2003   fQA2DList->Add(gHistProtonsEtaPhiTPCdEdxNPoints);
2004
2005   //eta-phi-Npoints
2006   TH3F *gHistEtaPhiTPCNPoints = new TH3F("gHistEtaPhiTPCNPoints",
2007                                          ";#eta;#phi;N_{points}(TPC)",
2008                                          18,-0.9,0.9,
2009                                          180,0,360,
2010                                          100,0,200);
2011   gHistEtaPhiTPCNPoints->SetStats(kTRUE);
2012   fQA2DList->Add(gHistEtaPhiTPCNPoints);
2013   TH3F *gHistProtonsEtaPhiTPCNPoints = new TH3F("gHistProtonsEtaPhiTPCNPoints",
2014                                                 ";#eta;#phi;N_{points}(TPC)",
2015                                                 18,-0.9,0.9,
2016                                                 180,0,360,
2017                                                 100,0,200);
2018   gHistProtonsEtaPhiTPCNPoints->SetStats(kTRUE);
2019   fQA2DList->Add(gHistProtonsEtaPhiTPCNPoints);
2020
2021   //pt-phi-Npoints(dEdx)
2022   TH3F *gHistPtPhiTPCdEdxNPoints = new TH3F("gHistPtPhiTPCdEdxNPoints",
2023                                             ";P_{T} [GeV/c];#phi;N_{points}(TPC)",
2024                                             fNBinsPt,fMinPt,fMaxPt,
2025                                             180,0,360,
2026                                             100,0,200);
2027   gHistPtPhiTPCdEdxNPoints->SetStats(kTRUE);
2028   fQA2DList->Add(gHistPtPhiTPCdEdxNPoints);
2029   TH3F *gHistProtonsPtPhiTPCdEdxNPoints = new TH3F("gHistProtonsPtPhiTPCdEdxNPoints",
2030                                                     ";P_{T} [GeV/c];#phi;N_{points}(TPC)",
2031                                                     fNBinsPt,fMinPt,fMaxPt,
2032                                                     180,0,360,
2033                                                     100,0,200);
2034   gHistProtonsPtPhiTPCdEdxNPoints->SetStats(kTRUE);
2035   fQA2DList->Add(gHistProtonsPtPhiTPCdEdxNPoints);
2036
2037   //pt-phi-Npoints
2038   TH3F *gHistPtPhiTPCNPoints = new TH3F("gHistPtPhiTPCNPoints",
2039                                         ";P_{T} [GeV/c];#phi;N_{points}(TPC)",
2040                                         fNBinsPt,fMinPt,fMaxPt,
2041                                         180,0,360,
2042                                         100,0,200);
2043   gHistPtPhiTPCNPoints->SetStats(kTRUE);
2044   fQA2DList->Add(gHistPtPhiTPCNPoints);
2045   TH3F *gHistProtonsPtPhiTPCNPoints = new TH3F("gHistProtonsPtPhiTPCNPoints",
2046                                                ";P_{T} [GeV/c];#phi;N_{points}(TPC)",
2047                                                fNBinsPt,fMinPt,fMaxPt,
2048                                                180,0,360,
2049                                                100,0,200);
2050   gHistProtonsPtPhiTPCNPoints->SetStats(kTRUE);
2051   fQA2DList->Add(gHistProtonsPtPhiTPCNPoints);
2052
2053   //eta-phi for protons & antiprotons
2054   TH2F *gHistProtonsEtaPhi = new TH2F("gHistProtonsEtaPhi",
2055                                       ";#eta;#phi",
2056                                       18,-0.9,0.9,
2057                                       180,0,360);
2058   gHistProtonsEtaPhi->SetStats(kTRUE);
2059   fQA2DList->Add(gHistProtonsEtaPhi);
2060   TH2F *gHistAntiProtonsEtaPhi = new TH2F("gHistAntiProtonsEtaPhi",
2061                                           ";#eta;#phi",
2062                                           18,-0.9,0.9,
2063                                           180,0,360);
2064   gHistAntiProtonsEtaPhi->SetStats(kTRUE);
2065   fQA2DList->Add(gHistAntiProtonsEtaPhi);
2066
2067   const Int_t nBinsdca = 1000;
2068   Double_t dcaBins[nBinsdca+1];
2069   Double_t dcamin = -5., dcamax = 5.;
2070   Double_t dca = -5.;
2071   Double_t dcaStepSmall = 0.01;
2072   Int_t iCounter = 0;
2073   while(dca <= 5.) {
2074     dcaBins[iCounter] = dcamin;
2075     dcamax = dcamin + dcaStepSmall;
2076     dca = dcamax;
2077     dcamin = dcamax;
2078     iCounter += 1;
2079   }
2080
2081   const Int_t nBinsY = 9;
2082   const Int_t nBinsPt = 6;
2083   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};
2084   Double_t gPt[nBinsPt+1] = {0.45,0.55,0.65,0.75,0.85,0.95,1.05};
2085
2086   //dca vs pT for protons & antiprotons
2087   TH3F *gHistProtonsDCAxyEtaPt = new TH3F("gHistProtonsDCAxyEtaPt",
2088                                           ";P_{T} [GeV/c];dca_{xy} [cm]",
2089                                           nBinsY,gY,nBinsPt,gPt,
2090                                           nBinsdca,dcaBins);
2091   if(fProtonAnalysisBase->GetEtaMode())
2092     gHistProtonsDCAxyEtaPt->GetXaxis()->SetTitle("#eta");
2093   else
2094     gHistProtonsDCAxyEtaPt->GetXaxis()->SetTitle("y");
2095   gHistProtonsDCAxyEtaPt->SetStats(kTRUE);
2096   fQA2DList->Add(gHistProtonsDCAxyEtaPt);
2097   TH3F *gHistProtonsDCAzEtaPt = new TH3F("gHistProtonsDCAzEtaPt",
2098                                          ";P_{T} [GeV/c];dca_{z} [cm]",
2099                                          nBinsY,gY,nBinsPt,gPt,
2100                                          nBinsdca,dcaBins);
2101   if(fProtonAnalysisBase->GetEtaMode())
2102     gHistProtonsDCAzEtaPt->GetXaxis()->SetTitle("#eta");
2103   else
2104     gHistProtonsDCAzEtaPt->GetXaxis()->SetTitle("y");
2105   gHistProtonsDCAzEtaPt->SetStats(kTRUE);
2106   fQA2DList->Add(gHistProtonsDCAzEtaPt);
2107   TH3F *gHistAntiProtonsDCAxyEtaPt = new TH3F("gHistAntiProtonsDCAxyEtaPt",
2108                                               ";P_{T} [GeV/c];dca_{xy} [cm]",
2109                                               nBinsY,gY,nBinsPt,gPt,
2110                                               nBinsdca,dcaBins);
2111   if(fProtonAnalysisBase->GetEtaMode())
2112     gHistAntiProtonsDCAxyEtaPt->GetXaxis()->SetTitle("#eta");
2113   else
2114     gHistAntiProtonsDCAxyEtaPt->GetXaxis()->SetTitle("y");
2115   gHistAntiProtonsDCAxyEtaPt->SetStats(kTRUE);
2116   fQA2DList->Add(gHistAntiProtonsDCAxyEtaPt);
2117   TH3F *gHistAntiProtonsDCAzEtaPt = new TH3F("gHistAntiProtonsDCAzEtaPt",
2118                                              ";P_{T} [GeV/c];dca_{z} [cm]",
2119                                              nBinsY,gY,nBinsPt,gPt,
2120                                              nBinsdca,dcaBins);
2121   if(fProtonAnalysisBase->GetEtaMode())
2122     gHistAntiProtonsDCAzEtaPt->GetXaxis()->SetTitle("#eta");
2123   else
2124     gHistAntiProtonsDCAzEtaPt->GetXaxis()->SetTitle("y");
2125   gHistAntiProtonsDCAzEtaPt->SetStats(kTRUE);
2126   fQA2DList->Add(gHistAntiProtonsDCAzEtaPt);
2127
2128   TH3F *gHistProtonsDCA3DEtaPt = new TH3F("gHistProtonsDCA3DEtaPt",
2129                                           ";P_{T} [GeV/c];dca [cm]",
2130                                           fNBinsY,fMinY,fMaxY,
2131                                           fNBinsPt,fMinPt,fMaxPt,
2132                                           100,0,20);
2133   if(fProtonAnalysisBase->GetEtaMode())
2134     gHistProtonsDCA3DEtaPt->GetXaxis()->SetTitle("#eta");
2135   else
2136     gHistProtonsDCA3DEtaPt->GetXaxis()->SetTitle("y");
2137   gHistProtonsDCA3DEtaPt->SetStats(kTRUE);
2138   fQA2DList->Add(gHistProtonsDCA3DEtaPt);
2139   TH3F *gHistAntiProtonsDCA3DEtaPt = new TH3F("gHistAntiProtonsDCA3DEtaPt",
2140                                               ";P_{T} [GeV/c];dca [cm]",
2141                                               fNBinsY,fMinY,fMaxY,
2142                                               fNBinsPt,fMinPt,fMaxPt,
2143                                               100,0,20);
2144   if(fProtonAnalysisBase->GetEtaMode())
2145     gHistAntiProtonsDCA3DEtaPt->GetXaxis()->SetTitle("#eta");
2146   else
2147     gHistAntiProtonsDCA3DEtaPt->GetXaxis()->SetTitle("y");
2148   gHistAntiProtonsDCA3DEtaPt->SetStats(kTRUE);
2149   fQA2DList->Add(gHistAntiProtonsDCA3DEtaPt);
2150
2151   TH2F *gHistPosdEdxP = new TH2F("gHistPosdEdxP","dE/dx (TPC); P [GeV/c]; dE/dx [a.u]",1000,0.05,20.05,600,0,600);
2152   fQA2DList->Add(gHistPosdEdxP);
2153   TH2F *gHistNegdEdxP = new TH2F("gHistNegdEdxP","dE/dx (TPC); P [GeV/c]; dE/dx [a.u]",1000,0.05,20.05,600,0,600);
2154   fQA2DList->Add(gHistNegdEdxP);
2155
2156   //========================================================//
2157   fQAProtonsAcceptedList = new TList();
2158   fQAProtonsAcceptedList->SetName("fQAProtonsAcceptedList");
2159   fGlobalQAList->Add(fQAProtonsAcceptedList);
2160   //Accepted protons
2161   TH1F *gProtonsITSClustersPass = new TH1F("gProtonsITSClustersPass",
2162                                             ";N_{clusters} (ITS);Entries",
2163                                             7,0,7);
2164   fQAProtonsAcceptedList->Add(gProtonsITSClustersPass);
2165   TH1F *gProtonsChi2PerClusterITSPass = new TH1F("gProtonsChi2PerClusterITSPass",
2166                                                  ";x^{2}/N_{clusters} (ITS);Entries",
2167                                                  100,0,4);
2168   fQAProtonsAcceptedList->Add(gProtonsChi2PerClusterITSPass);
2169   TH1F *gProtonsTPCClustersPass = new TH1F("gProtonsTPCClustersPass",
2170                                            ";N_{clusters} (TPC);Entries",
2171                                            100,0,200);
2172   fQAProtonsAcceptedList->Add(gProtonsTPCClustersPass);
2173   TH1F *gProtonsChi2PerClusterTPCPass = new TH1F("gProtonsChi2PerClusterTPCPass",
2174                                                  ";x^{2}/N_{clusters} (TPC);Entries",
2175                                                  100,0,4);
2176   fQAProtonsAcceptedList->Add(gProtonsChi2PerClusterTPCPass);
2177   TH1F *gProtonsExtCov11Pass = new TH1F("gProtonsExtCov11Pass",
2178                                         ";#sigma_{y} [cm];Entries",
2179                                         100,0,4);
2180   fQAProtonsAcceptedList->Add(gProtonsExtCov11Pass);
2181   TH1F *gProtonsExtCov22Pass = new TH1F("gProtonsExtCov22Pass",
2182                                         ";#sigma_{z} [cm];Entries",
2183                                         100,0,4);
2184   fQAProtonsAcceptedList->Add(gProtonsExtCov22Pass);
2185   TH1F *gProtonsExtCov33Pass = new TH1F("gProtonsExtCov33Pass",
2186                                         ";#sigma_{sin(#phi)};Entries",
2187                                         100,0,4);
2188   fQAProtonsAcceptedList->Add(gProtonsExtCov33Pass);
2189   TH1F *gProtonsExtCov44Pass = new TH1F("gProtonsExtCov44Pass",
2190                                         ";#sigma_{tan(#lambda)};Entries",
2191                                         100,0,4);
2192   fQAProtonsAcceptedList->Add(gProtonsExtCov44Pass);
2193   TH1F *gProtonsExtCov55Pass = new TH1F("gProtonsExtCov55Pass",
2194                                         ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2195                                         100,0,4);
2196   fQAProtonsAcceptedList->Add(gProtonsExtCov55Pass);
2197   TH1F *gProtonsSigmaToVertexPass = new TH1F("gProtonsSigmaToVertexPass",
2198                                              ";#sigma_{Vertex};Entries",
2199                                              100,0.,10.);
2200   fQAProtonsAcceptedList->Add(gProtonsSigmaToVertexPass);
2201   TH1F *gProtonsSigmaToVertexTPCPass = new TH1F("gProtonsSigmaToVertexTPCPass",
2202                                                 ";#sigma_{Vertex};Entries",
2203                                                 100,0.,10.);
2204   fQAProtonsAcceptedList->Add(gProtonsSigmaToVertexTPCPass);
2205   TH1F *gProtonsDCAXYPass = new TH1F("gProtonsDCAXYPass",
2206                                      ";DCA_{xy} [cm];Entries",
2207                                      100,0,20);
2208   fQAProtonsAcceptedList->Add(gProtonsDCAXYPass);
2209   TH1F *gProtonsDCAXYTPCPass = new TH1F("gProtonsDCAXYTPCPass",
2210                                         ";DCA_{xy} [cm];Entries",
2211                                         100,0,20);
2212   fQAProtonsAcceptedList->Add(gProtonsDCAXYTPCPass);
2213   TH1F *gProtonsDCAZPass = new TH1F("gProtonsDCAZPass",
2214                                     ";DCA_{z} [cm];Entries",
2215                                     100,0,20);
2216   fQAProtonsAcceptedList->Add(gProtonsDCAZPass);
2217   TH1F *gProtonsDCAZTPCPass = new TH1F("gProtonsDCAZTPCPass",
2218                                        ";DCA_{z} [cm];Entries",
2219                                        100,0,20);
2220   fQAProtonsAcceptedList->Add(gProtonsDCAZTPCPass);
2221   TH1F *gProtonsConstrainChi2Pass = new TH1F("gProtonsConstrainChi2Pass",
2222                                              ";Log_{10}(#chi^{2});Entries",
2223                                              100,-10,10);
2224   fQAProtonsAcceptedList->Add(gProtonsConstrainChi2Pass);
2225   TH1F *gProtonsITSRefitPass = new TH1F("gProtonsITSRefitPass",
2226                                         "",10,-1,1);
2227   fQAProtonsAcceptedList->Add(gProtonsITSRefitPass);
2228   TH1F *gProtonsTPCRefitPass = new TH1F("gProtonsTPCRefitPass",
2229                                         "",10,-1,1);
2230   fQAProtonsAcceptedList->Add(gProtonsTPCRefitPass);
2231   TH1F *gProtonsESDpidPass = new TH1F("gProtonsESDpidPass",
2232                                       "",10,-1,1);
2233   fQAProtonsAcceptedList->Add(gProtonsESDpidPass);
2234   TH1F *gProtonsTPCpidPass = new TH1F("gProtonsTPCpidPass",
2235                                       "",10,-1,1);
2236   fQAProtonsAcceptedList->Add(gProtonsTPCpidPass);
2237   TH1F *gProtonsPointOnITSLayer1Pass = new TH1F("gProtonsPointOnITSLayer1Pass",
2238                                                 "",10,-1,1);
2239   fQAProtonsAcceptedList->Add(gProtonsPointOnITSLayer1Pass);
2240   TH1F *gProtonsPointOnITSLayer2Pass = new TH1F("gProtonsPointOnITSLayer2Pass",
2241                                                 "",10,-1,1);
2242   fQAProtonsAcceptedList->Add(gProtonsPointOnITSLayer2Pass);
2243   TH1F *gProtonsPointOnITSLayer3Pass = new TH1F("gProtonsPointOnITSLayer3Pass",
2244                                                 "",10,-1,1);
2245   fQAProtonsAcceptedList->Add(gProtonsPointOnITSLayer3Pass);
2246   TH1F *gProtonsPointOnITSLayer4Pass = new TH1F("gProtonsPointOnITSLayer4Pass",
2247                                                 "",10,-1,1);
2248   fQAProtonsAcceptedList->Add(gProtonsPointOnITSLayer4Pass);
2249   TH1F *gProtonsPointOnITSLayer5Pass = new TH1F("gProtonsPointOnITSLayer5Pass",
2250                                                 "",10,-1,1);
2251   fQAProtonsAcceptedList->Add(gProtonsPointOnITSLayer5Pass);
2252   TH1F *gProtonsPointOnITSLayer6Pass = new TH1F("gProtonsPointOnITSLayer6Pass",
2253                                                 "",10,-1,1);
2254   fQAProtonsAcceptedList->Add(gProtonsPointOnITSLayer6Pass);
2255   TH1F *gProtonsNumberOfTPCdEdxPointsPass = new TH1F("gProtonsNumberOfTPCdEdxPointsPass","",100,0,200);
2256   fQAProtonsAcceptedList->Add(gProtonsNumberOfTPCdEdxPointsPass);
2257   TH1F *gProtonsITSClusterMapPass = new TH1F("gProtonsITSClusterMapPass",";ITS Layer;Entries",6,0.5,6.5);
2258   fQAProtonsAcceptedList->Add(gProtonsITSClusterMapPass);
2259   TH1F *gProtonsDCA3DPass = new TH1F("gProtonsDCA3DPass",
2260                                      ";dca [cm];Entries",
2261                                      100,0,20);
2262   fQAProtonsAcceptedList->Add(gProtonsDCA3DPass);
2263
2264   //========================================================//  
2265   fQAProtonsRejectedList = new TList();
2266   fQAProtonsRejectedList->SetName("fQAProtonsRejectedList");
2267   fGlobalQAList->Add(fQAProtonsRejectedList);
2268   //Rejected protons
2269   TH1F *gProtonsITSClustersReject = new TH1F("gProtonsITSClustersReject",
2270                                              ";N_{clusters} (ITS);Entries",
2271                                              7,0,7);
2272   gProtonsITSClustersReject->SetFillColor(kRed-2);
2273   fQAProtonsRejectedList->Add(gProtonsITSClustersReject);
2274   TH1F *gProtonsChi2PerClusterITSReject = new TH1F("gProtonsChi2PerClusterITSReject",
2275                                                    ";x^{2}/N_{clusters} (ITS);Entries",
2276                                                    100,0,4);
2277   gProtonsChi2PerClusterITSReject->SetFillColor(kRed-2);
2278   fQAProtonsRejectedList->Add(gProtonsChi2PerClusterITSReject);
2279   TH1F *gProtonsTPCClustersReject = new TH1F("gProtonsTPCClustersReject",
2280                                              ";N_{clusters} (TPC);Entries",
2281                                              100,0,200);
2282   gProtonsTPCClustersReject->SetFillColor(kRed-2);
2283   fQAProtonsRejectedList->Add(gProtonsTPCClustersReject);
2284   TH1F *gProtonsChi2PerClusterTPCReject = new TH1F("gProtonsChi2PerClusterTPCReject",
2285                                                    ";x^{2}/N_{clusters} (TPC);Entries",
2286                                                    100,0,4);
2287   gProtonsChi2PerClusterTPCReject->SetFillColor(kRed-2);
2288   fQAProtonsRejectedList->Add(gProtonsChi2PerClusterTPCReject);
2289   TH1F *gProtonsExtCov11Reject = new TH1F("gProtonsExtCov11Reject",
2290                                           ";#sigma_{y} [cm];Entries",
2291                                           100,0,4);
2292   gProtonsExtCov11Reject->SetFillColor(kRed-2);
2293   fQAProtonsRejectedList->Add(gProtonsExtCov11Reject);
2294   TH1F *gProtonsExtCov22Reject = new TH1F("gProtonsExtCov22Reject",
2295                                           ";#sigma_{z} [cm];Entries",
2296                                           100,0,4);
2297   gProtonsExtCov22Reject->SetFillColor(kRed-2);
2298   fQAProtonsRejectedList->Add(gProtonsExtCov22Reject);
2299   TH1F *gProtonsExtCov33Reject = new TH1F("gProtonsExtCov33Reject",
2300                                           ";#sigma_{sin(#phi)};Entries",
2301                                           100,0,4);
2302   gProtonsExtCov33Reject->SetFillColor(kRed-2);
2303   fQAProtonsRejectedList->Add(gProtonsExtCov33Reject);
2304   TH1F *gProtonsExtCov44Reject = new TH1F("gProtonsExtCov44Reject",
2305                                           ";#sigma_{tan(#lambda)};Entries",
2306                                           100,0,4);
2307   gProtonsExtCov44Reject->SetFillColor(kRed-2);
2308   fQAProtonsRejectedList->Add(gProtonsExtCov44Reject);
2309   TH1F *gProtonsExtCov55Reject = new TH1F("gProtonsExtCov55Reject",
2310                                           ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2311                                           100,0,4);
2312   gProtonsExtCov55Reject->SetFillColor(kRed-2);
2313   fQAProtonsRejectedList->Add(gProtonsExtCov55Reject);
2314   TH1F *gProtonsSigmaToVertexReject = new TH1F("gProtonsSigmaToVertexReject",
2315                                                ";#sigma_{Vertex};Entries",
2316                                                100,0,10);
2317   gProtonsSigmaToVertexReject->SetFillColor(kRed-2);
2318   fQAProtonsRejectedList->Add(gProtonsSigmaToVertexReject);
2319   TH1F *gProtonsSigmaToVertexTPCReject = new TH1F("gProtonsSigmaToVertexTPCReject",
2320                                                   ";#sigma_{Vertex};Entries",
2321                                                   100,0,10);
2322   gProtonsSigmaToVertexTPCReject->SetFillColor(kRed-2);
2323   fQAProtonsRejectedList->Add(gProtonsSigmaToVertexTPCReject);
2324   TH1F *gProtonsDCAXYReject = new TH1F("gProtonsDCAXYReject",
2325                                        ";DCA_{xy} [cm];Entries",
2326                                        100,0,20);
2327   gProtonsDCAXYReject->SetFillColor(kRed-2);
2328   fQAProtonsRejectedList->Add(gProtonsDCAXYReject);
2329   TH1F *gProtonsDCAXYTPCReject = new TH1F("gProtonsDCAXYTPCReject",
2330                                           ";DCA_{xy} [cm];Entries",
2331                                           100,0,20);
2332   gProtonsDCAXYTPCReject->SetFillColor(kRed-2);
2333   fQAProtonsRejectedList->Add(gProtonsDCAXYTPCReject);
2334   TH1F *gProtonsDCAZReject = new TH1F("gProtonsDCAZReject",
2335                                       ";DCA_{z} [cm];Entries",
2336                                       100,0,20);
2337   gProtonsDCAZReject->SetFillColor(kRed-2);
2338   fQAProtonsRejectedList->Add(gProtonsDCAZReject);
2339   TH1F *gProtonsDCAZTPCReject = new TH1F("gProtonsDCAZTPCReject",
2340                                          ";DCA_{z} [cm];Entries",
2341                                          100,0,20);
2342   gProtonsDCAZTPCReject->SetFillColor(kRed-2);
2343   fQAProtonsRejectedList->Add(gProtonsDCAZTPCReject);
2344   TH1F *gProtonsConstrainChi2Reject = new TH1F("gProtonsConstrainChi2Reject",
2345                                                ";Log_{10}(#chi^{2});Entries",
2346                                                100,-10,10);
2347   gProtonsConstrainChi2Reject->SetFillColor(kRed-2);
2348   fQAProtonsRejectedList->Add(gProtonsConstrainChi2Reject);
2349   TH1F *gProtonsITSRefitReject = new TH1F("gProtonsITSRefitReject",
2350                                           "",10,-1,1);
2351   gProtonsITSRefitReject->SetFillColor(kRed-2);
2352   fQAProtonsRejectedList->Add(gProtonsITSRefitReject);
2353   TH1F *gProtonsTPCRefitReject = new TH1F("gProtonsTPCRefitReject",
2354                                           "",10,-1,1);
2355   gProtonsTPCRefitReject->SetFillColor(kRed-2);
2356   fQAProtonsRejectedList->Add(gProtonsTPCRefitReject);
2357   TH1F *gProtonsESDpidReject = new TH1F("gProtonsESDpidReject",
2358                                         "",10,-1,1);
2359   gProtonsESDpidReject->SetFillColor(kRed-2);
2360   fQAProtonsRejectedList->Add(gProtonsESDpidReject);
2361   TH1F *gProtonsTPCpidReject = new TH1F("gProtonsTPCpidReject",
2362                                         "",10,-1,1);
2363   gProtonsTPCpidReject->SetFillColor(kRed-2);
2364   fQAProtonsRejectedList->Add(gProtonsTPCpidReject);
2365   TH1F *gProtonsPointOnITSLayer1Reject = new TH1F("gProtonsPointOnITSLayer1Reject",
2366                                                   "",10,-1,1);
2367   gProtonsPointOnITSLayer1Reject->SetFillColor(kRed-2);
2368   fQAProtonsRejectedList->Add(gProtonsPointOnITSLayer1Reject);
2369   TH1F *gProtonsPointOnITSLayer2Reject = new TH1F("gProtonsPointOnITSLayer2Reject",
2370                                                   "",10,-1,1);
2371   gProtonsPointOnITSLayer2Reject->SetFillColor(kRed-2);
2372   fQAProtonsRejectedList->Add(gProtonsPointOnITSLayer2Reject);
2373   TH1F *gProtonsPointOnITSLayer3Reject = new TH1F("gProtonsPointOnITSLayer3Reject",
2374                                                   "",10,-1,1);
2375   gProtonsPointOnITSLayer3Reject->SetFillColor(kRed-2);
2376   fQAProtonsRejectedList->Add(gProtonsPointOnITSLayer3Reject);
2377   TH1F *gProtonsPointOnITSLayer4Reject = new TH1F("gProtonsPointOnITSLayer4Reject",
2378                                                   "",10,-1,1);
2379   gProtonsPointOnITSLayer4Reject->SetFillColor(kRed-2);
2380   fQAProtonsRejectedList->Add(gProtonsPointOnITSLayer4Reject);
2381   TH1F *gProtonsPointOnITSLayer5Reject = new TH1F("gProtonsPointOnITSLayer5Reject",
2382                                                   "",10,-1,1);
2383   gProtonsPointOnITSLayer5Reject->SetFillColor(kRed-2);
2384   fQAProtonsRejectedList->Add(gProtonsPointOnITSLayer5Reject);
2385   TH1F *gProtonsPointOnITSLayer6Reject = new TH1F("gProtonsPointOnITSLayer6Reject",
2386                                                   "",10,-1,1);
2387   gProtonsPointOnITSLayer6Reject->SetFillColor(kRed-2);
2388   fQAProtonsRejectedList->Add(gProtonsPointOnITSLayer6Reject);
2389   TH1F *gProtonsNumberOfTPCdEdxPointsReject = new TH1F("gProtonsNumberOfTPCdEdxPointsReject","",100,0,200);
2390   gProtonsNumberOfTPCdEdxPointsReject->SetFillColor(kRed-2);
2391   fQAProtonsRejectedList->Add(gProtonsNumberOfTPCdEdxPointsReject);
2392   TH1F *gProtonsITSClusterMapReject = new TH1F("gProtonsITSClusterMapReject",";ITS Layer;Entries",6,0.5,6.5);
2393   gProtonsITSClusterMapReject->SetFillColor(kRed-2);
2394   fQAProtonsRejectedList->Add(gProtonsITSClusterMapReject);
2395   TH1F *gProtonsDCA3DReject = new TH1F("gProtonsDCA3DReject",
2396                                        ";dca [cm];Entries",
2397                                        100,0,20);
2398   gProtonsDCA3DReject->SetFillColor(kRed-2);
2399   fQAProtonsRejectedList->Add(gProtonsDCA3DReject);
2400     
2401   //========================================================//
2402   fQAAntiProtonsAcceptedList = new TList();
2403   fQAAntiProtonsAcceptedList->SetName("fQAAntiProtonsAcceptedList");
2404   fGlobalQAList->Add(fQAAntiProtonsAcceptedList);
2405   //Accepted antiprotons
2406   TH1F *gAntiProtonsITSClustersPass = new TH1F("gAntiProtonsITSClustersPass",
2407                                                ";N_{clusters} (ITS);Entries",
2408                                                7,0,7);
2409   fQAAntiProtonsAcceptedList->Add(gAntiProtonsITSClustersPass);
2410   TH1F *gAntiProtonsChi2PerClusterITSPass = new TH1F("gAntiProtonsChi2PerClusterITSPass",
2411                                                      ";x^{2}/N_{clusters} (ITS);Entries",
2412                                                      100,0,4);
2413   fQAAntiProtonsAcceptedList->Add(gAntiProtonsChi2PerClusterITSPass);
2414   TH1F *gAntiProtonsTPCClustersPass = new TH1F("gAntiProtonsTPCClustersPass",
2415                                                ";N_{clusters} (TPC);Entries",
2416                                                100,0,200);
2417   fQAAntiProtonsAcceptedList->Add(gAntiProtonsTPCClustersPass);
2418   TH1F *gAntiProtonsChi2PerClusterTPCPass = new TH1F("gAntiProtonsChi2PerClusterTPCPass",
2419                                                      ";x^{2}/N_{clusters} (TPC);Entries",
2420                                                      100,0,4);
2421   fQAAntiProtonsAcceptedList->Add(gAntiProtonsChi2PerClusterTPCPass);
2422   TH1F *gAntiProtonsExtCov11Pass = new TH1F("gAntiProtonsExtCov11Pass",
2423                                             ";#sigma_{y} [cm];Entries",
2424                                             100,0,4);
2425   fQAAntiProtonsAcceptedList->Add(gAntiProtonsExtCov11Pass);
2426   TH1F *gAntiProtonsExtCov22Pass = new TH1F("gAntiProtonsExtCov22Pass",
2427                                             ";#sigma_{z} [cm];Entries",
2428                                             100,0,4);
2429   fQAAntiProtonsAcceptedList->Add(gAntiProtonsExtCov22Pass);
2430   TH1F *gAntiProtonsExtCov33Pass = new TH1F("gAntiProtonsExtCov33Pass",
2431                                             ";#sigma_{sin(#phi)};Entries",
2432                                             100,0,4);
2433   fQAAntiProtonsAcceptedList->Add(gAntiProtonsExtCov33Pass);
2434   TH1F *gAntiProtonsExtCov44Pass = new TH1F("gAntiProtonsExtCov44Pass",
2435                                             ";#sigma_{tan(#lambda)};Entries",
2436                                             100,0,4);
2437   fQAAntiProtonsAcceptedList->Add(gAntiProtonsExtCov44Pass);
2438   TH1F *gAntiProtonsExtCov55Pass = new TH1F("gAntiProtonsExtCov55Pass",
2439                                             ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2440                                             100,0,4);
2441   fQAAntiProtonsAcceptedList->Add(gAntiProtonsExtCov55Pass);
2442   TH1F *gAntiProtonsSigmaToVertexPass = new TH1F("gAntiProtonsSigmaToVertexPass",
2443                                                  ";#sigma_{Vertex};Entries",
2444                                                  100,0,10);
2445   fQAAntiProtonsAcceptedList->Add(gAntiProtonsSigmaToVertexPass);
2446   TH1F *gAntiProtonsSigmaToVertexTPCPass = new TH1F("gAntiProtonsSigmaToVertexTPCPass",
2447                                                     ";#sigma_{Vertex};Entries",
2448                                                     100,0,10);
2449   fQAAntiProtonsAcceptedList->Add(gAntiProtonsSigmaToVertexTPCPass);
2450   TH1F *gAntiProtonsDCAXYPass = new TH1F("gAntiProtonsDCAXYPass",
2451                                          ";DCA_{xy} [cm];Entries",
2452                                          100,0,20);
2453   fQAAntiProtonsAcceptedList->Add(gAntiProtonsDCAXYPass);
2454   TH1F *gAntiProtonsDCAXYTPCPass = new TH1F("gAntiProtonsDCAXYTPCPass",
2455                                             ";DCA_{xy} [cm];Entries",
2456                                             100,0,20);
2457   fQAAntiProtonsAcceptedList->Add(gAntiProtonsDCAXYTPCPass);
2458   TH1F *gAntiProtonsDCAZPass = new TH1F("gAntiProtonsDCAZPass",
2459                                         ";DCA_{z} [cm];Entries",
2460                                         100,0,20);
2461   fQAAntiProtonsAcceptedList->Add(gAntiProtonsDCAZPass);
2462   TH1F *gAntiProtonsDCAZTPCPass = new TH1F("gAntiProtonsDCAZTPCPass",
2463                                            ";DCA_{z} [cm];Entries",
2464                                            100,0,20);
2465   fQAAntiProtonsAcceptedList->Add(gAntiProtonsDCAZTPCPass);
2466   TH1F *gAntiProtonsConstrainChi2Pass = new TH1F("gAntiProtonsConstrainChi2Pass",
2467                                                  ";Log_{10}(#chi^{2});Entries",
2468                                                  100,-10,10);
2469   fQAAntiProtonsAcceptedList->Add(gAntiProtonsConstrainChi2Pass);
2470   TH1F *gAntiProtonsITSRefitPass = new TH1F("gAntiProtonsITSRefitPass",
2471                                             "",10,-1,1);
2472   fQAAntiProtonsAcceptedList->Add(gAntiProtonsITSRefitPass);
2473   TH1F *gAntiProtonsTPCRefitPass = new TH1F("gAntiProtonsTPCRefitPass",
2474                                             "",10,-1,1);
2475   fQAAntiProtonsAcceptedList->Add(gAntiProtonsTPCRefitPass);
2476   TH1F *gAntiProtonsESDpidPass = new TH1F("gAntiProtonsESDpidPass",
2477                                           "",10,-1,1);
2478   fQAAntiProtonsAcceptedList->Add(gAntiProtonsESDpidPass);
2479   TH1F *gAntiProtonsTPCpidPass = new TH1F("gAntiProtonsTPCpidPass",
2480                                           "",10,-1,1);
2481   fQAAntiProtonsAcceptedList->Add(gAntiProtonsTPCpidPass);
2482   TH1F *gAntiProtonsPointOnITSLayer1Pass = new TH1F("gAntiProtonsPointOnITSLayer1Pass",
2483                                                     "",10,-1,1);
2484   fQAAntiProtonsAcceptedList->Add(gAntiProtonsPointOnITSLayer1Pass);
2485   TH1F *gAntiProtonsPointOnITSLayer2Pass = new TH1F("gAntiProtonsPointOnITSLayer2Pass",
2486                                                     "",10,-1,1);
2487   fQAAntiProtonsAcceptedList->Add(gAntiProtonsPointOnITSLayer2Pass);
2488   TH1F *gAntiProtonsPointOnITSLayer3Pass = new TH1F("gAntiProtonsPointOnITSLayer3Pass",
2489                                                     "",10,-1,1);
2490   fQAAntiProtonsAcceptedList->Add(gAntiProtonsPointOnITSLayer3Pass);
2491   TH1F *gAntiProtonsPointOnITSLayer4Pass = new TH1F("gAntiProtonsPointOnITSLayer4Pass",
2492                                                     "",10,-1,1);
2493   fQAAntiProtonsAcceptedList->Add(gAntiProtonsPointOnITSLayer4Pass);
2494   TH1F *gAntiProtonsPointOnITSLayer5Pass = new TH1F("gAntiProtonsPointOnITSLayer5Pass",
2495                                                     "",10,-1,1);
2496   fQAAntiProtonsAcceptedList->Add(gAntiProtonsPointOnITSLayer5Pass);
2497   TH1F *gAntiProtonsPointOnITSLayer6Pass = new TH1F("gAntiProtonsPointOnITSLayer6Pass",
2498                                                     "",10,-1,1);
2499   fQAAntiProtonsAcceptedList->Add(gAntiProtonsPointOnITSLayer6Pass);
2500   TH1F *gAntiProtonsNumberOfTPCdEdxPointsPass = new TH1F("gAntiProtonsNumberOfTPCdEdxPointsPass","",100,0,200);
2501   fQAAntiProtonsAcceptedList->Add(gAntiProtonsNumberOfTPCdEdxPointsPass);
2502   TH1F *gAntiProtonsITSClusterMapPass = new TH1F("gAntiProtonsITSClusterMapPass",";ITS Layer;Entries",6,0.5,6.5);
2503   fQAAntiProtonsAcceptedList->Add(gAntiProtonsITSClusterMapPass);
2504   TH1F *gAntiProtonsDCA3DPass = new TH1F("gAntiProtonsDCA3DPass",
2505                                          ";dca [cm];Entries",
2506                                          100,0,20);
2507   fQAAntiProtonsAcceptedList->Add(gAntiProtonsDCA3DPass);
2508
2509   //========================================================//
2510   fQAAntiProtonsRejectedList = new TList();
2511   fQAAntiProtonsRejectedList->SetName("fQAAntiProtonsRejectedList");
2512   fGlobalQAList->Add(fQAAntiProtonsRejectedList);
2513   //Rejected antiprotons
2514   TH1F *gAntiProtonsITSClustersReject = new TH1F("gAntiProtonsITSClustersReject",
2515                                                  ";N_{clusters} (ITS);Entries",
2516                                                  7,0,7);
2517   gAntiProtonsITSClustersReject->SetFillColor(kRed-2);
2518   fQAAntiProtonsRejectedList->Add(gAntiProtonsITSClustersReject);
2519   TH1F *gAntiProtonsChi2PerClusterITSReject = new TH1F("gAntiProtonsChi2PerClusterITSReject",
2520                                                        ";x^{2}/N_{clusters} (ITS);Entries",
2521                                                        100,0,4);
2522   gAntiProtonsChi2PerClusterITSReject->SetFillColor(kRed-2);
2523   fQAAntiProtonsRejectedList->Add(gAntiProtonsChi2PerClusterITSReject);
2524   TH1F *gAntiProtonsTPCClustersReject = new TH1F("gAntiProtonsTPCClustersReject",
2525                                                  ";N_{clusters} (TPC);Entries",
2526                                                  100,0,200);
2527   gAntiProtonsTPCClustersReject->SetFillColor(kRed-2);
2528   fQAAntiProtonsRejectedList->Add(gAntiProtonsTPCClustersReject);
2529   TH1F *gAntiProtonsChi2PerClusterTPCReject = new TH1F("gAntiProtonsChi2PerClusterTPCReject",
2530                                                        ";x^{2}/N_{clusters} (TPC);Entries",
2531                                                        100,0,4);
2532   gAntiProtonsChi2PerClusterTPCReject->SetFillColor(kRed-2);
2533   fQAAntiProtonsRejectedList->Add(gAntiProtonsChi2PerClusterTPCReject);
2534   TH1F *gAntiProtonsExtCov11Reject = new TH1F("gAntiProtonsExtCov11Reject",
2535                                               ";#sigma_{y} [cm];Entries",
2536                                               100,0,4);
2537   gAntiProtonsExtCov11Reject->SetFillColor(kRed-2);
2538   fQAAntiProtonsRejectedList->Add(gAntiProtonsExtCov11Reject);
2539   TH1F *gAntiProtonsExtCov22Reject = new TH1F("gAntiProtonsExtCov22Reject",
2540                                               ";#sigma_{z} [cm];Entries",
2541                                               100,0,4);
2542   gAntiProtonsExtCov22Reject->SetFillColor(kRed-2);
2543   fQAAntiProtonsRejectedList->Add(gAntiProtonsExtCov22Reject);
2544   TH1F *gAntiProtonsExtCov33Reject = new TH1F("gAntiProtonsExtCov33Reject",
2545                                               ";#sigma_{sin(#phi)};Entries",
2546                                               100,0,4);
2547   gAntiProtonsExtCov33Reject->SetFillColor(kRed-2);
2548   fQAAntiProtonsRejectedList->Add(gAntiProtonsExtCov33Reject);
2549   TH1F *gAntiProtonsExtCov44Reject = new TH1F("gAntiProtonsExtCov44Reject",
2550                                               ";#sigma_{tan(#lambda)};Entries",
2551                                               100,0,4);
2552   gAntiProtonsExtCov44Reject->SetFillColor(kRed-2);
2553   fQAAntiProtonsRejectedList->Add(gAntiProtonsExtCov44Reject);
2554   TH1F *gAntiProtonsExtCov55Reject = new TH1F("gAntiProtonsExtCov55Reject",
2555                                               ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2556                                               100,0,4);
2557   gAntiProtonsExtCov55Reject->SetFillColor(kRed-2);
2558   fQAAntiProtonsRejectedList->Add(gAntiProtonsExtCov55Reject);
2559   TH1F *gAntiProtonsSigmaToVertexReject = new TH1F("gAntiProtonsSigmaToVertexReject",
2560                                                    ";#sigma_{Vertex};Entries",
2561                                                    100,0,10);
2562   gAntiProtonsSigmaToVertexReject->SetFillColor(kRed-2);
2563   fQAAntiProtonsRejectedList->Add(gAntiProtonsSigmaToVertexReject);
2564   TH1F *gAntiProtonsSigmaToVertexTPCReject = new TH1F("gAntiProtonsSigmaToVertexTPCReject",
2565                                                       ";#sigma_{Vertex};Entries",
2566                                                       100,0,10);
2567   gAntiProtonsSigmaToVertexTPCReject->SetFillColor(kRed-2);
2568   fQAAntiProtonsRejectedList->Add(gAntiProtonsSigmaToVertexTPCReject);
2569   TH1F *gAntiProtonsDCAXYReject = new TH1F("gAntiProtonsDCAXYReject",
2570                                            ";DCA_{xy} [cm];Entries",
2571                                            100,0,20);
2572   gAntiProtonsDCAXYReject->SetFillColor(kRed-2);
2573   fQAAntiProtonsRejectedList->Add(gAntiProtonsDCAXYReject);
2574   TH1F *gAntiProtonsDCAXYTPCReject = new TH1F("gAntiProtonsDCAXYTPCReject",
2575                                               ";DCA_{xy} [cm];Entries",
2576                                               100,0,20);
2577   gAntiProtonsDCAXYTPCReject->SetFillColor(kRed-2);
2578   fQAAntiProtonsRejectedList->Add(gAntiProtonsDCAXYTPCReject);
2579   TH1F *gAntiProtonsDCAZReject = new TH1F("gAntiProtonsDCAZReject",
2580                                           ";DCA_{z} [cm];Entries",
2581                                           100,0,20);
2582   gAntiProtonsDCAZReject->SetFillColor(kRed-2);
2583   fQAAntiProtonsRejectedList->Add(gAntiProtonsDCAZReject);
2584   TH1F *gAntiProtonsDCAZTPCReject = new TH1F("gAntiProtonsDCAZTPCReject",
2585                                              ";DCA_{z} [cm];Entries",
2586                                              100,0,20);
2587   gAntiProtonsDCAZTPCReject->SetFillColor(kRed-2);
2588   fQAAntiProtonsRejectedList->Add(gAntiProtonsDCAZTPCReject);
2589   TH1F *gAntiProtonsConstrainChi2Reject = new TH1F("gAntiProtonsConstrainChi2Reject",
2590                                                    ";Log_{10}(#chi^{2});Entries",
2591                                                    100,-10,10);
2592   gAntiProtonsConstrainChi2Reject->SetFillColor(kRed-2);
2593   fQAAntiProtonsRejectedList->Add(gAntiProtonsConstrainChi2Reject);
2594   TH1F *gAntiProtonsITSRefitReject = new TH1F("gAntiProtonsITSRefitReject",
2595                                               "",10,-1,1);
2596   gAntiProtonsITSRefitReject->SetFillColor(kRed-2);
2597   fQAAntiProtonsRejectedList->Add(gAntiProtonsITSRefitReject);
2598   TH1F *gAntiProtonsTPCRefitReject = new TH1F("gAntiProtonsTPCRefitReject",
2599                                               "",10,-1,1);
2600   gAntiProtonsTPCRefitReject->SetFillColor(kRed-2);
2601   fQAAntiProtonsRejectedList->Add(gAntiProtonsTPCRefitReject);
2602   TH1F *gAntiProtonsESDpidReject = new TH1F("gAntiProtonsESDpidReject",
2603                                             "",10,-1,1);
2604   gAntiProtonsESDpidReject->SetFillColor(kRed-2);
2605   fQAAntiProtonsRejectedList->Add(gAntiProtonsESDpidReject);
2606   TH1F *gAntiProtonsTPCpidReject = new TH1F("gAntiProtonsTPCpidReject",
2607                                             "",10,-1,1);
2608   gAntiProtonsTPCpidReject->SetFillColor(kRed-2);
2609   fQAAntiProtonsRejectedList->Add(gAntiProtonsTPCpidReject);
2610   TH1F *gAntiProtonsPointOnITSLayer1Reject = new TH1F("gAntiProtonsPointOnITSLayer1Reject",
2611                                                       "",10,-1,1);
2612   gAntiProtonsPointOnITSLayer1Reject->SetFillColor(kRed-2);
2613   fQAAntiProtonsRejectedList->Add(gAntiProtonsPointOnITSLayer1Reject);
2614   TH1F *gAntiProtonsPointOnITSLayer2Reject = new TH1F("gAntiProtonsPointOnITSLayer2Reject",
2615                                                       "",10,-1,1);
2616   gAntiProtonsPointOnITSLayer2Reject->SetFillColor(kRed-2);
2617   fQAAntiProtonsRejectedList->Add(gAntiProtonsPointOnITSLayer2Reject);
2618   TH1F *gAntiProtonsPointOnITSLayer3Reject = new TH1F("gAntiProtonsPointOnITSLayer3Reject",
2619                                                       "",10,-1,1);
2620   gAntiProtonsPointOnITSLayer3Reject->SetFillColor(kRed-2);
2621   fQAAntiProtonsRejectedList->Add(gAntiProtonsPointOnITSLayer3Reject);
2622   TH1F *gAntiProtonsPointOnITSLayer4Reject = new TH1F("gAntiProtonsPointOnITSLayer4Reject",
2623                                                       "",10,-1,1);
2624   gAntiProtonsPointOnITSLayer4Reject->SetFillColor(kRed-2);
2625   fQAAntiProtonsRejectedList->Add(gAntiProtonsPointOnITSLayer4Reject);
2626   TH1F *gAntiProtonsPointOnITSLayer5Reject = new TH1F("gAntiProtonsPointOnITSLayer5Reject",
2627                                                       "",10,-1,1);
2628   gAntiProtonsPointOnITSLayer5Reject->SetFillColor(kRed-2);
2629   fQAAntiProtonsRejectedList->Add(gAntiProtonsPointOnITSLayer5Reject);
2630   TH1F *gAntiProtonsPointOnITSLayer6Reject = new TH1F("gAntiProtonsPointOnITSLayer6Reject",
2631                                                       "",10,-1,1);
2632   gAntiProtonsPointOnITSLayer6Reject->SetFillColor(kRed-2);
2633   fQAAntiProtonsRejectedList->Add(gAntiProtonsPointOnITSLayer6Reject);
2634   TH1F *gAntiProtonsNumberOfTPCdEdxPointsReject = new TH1F("gAntiProtonsNumberOfTPCdEdxPointsReject","",100,0,200);
2635   gAntiProtonsNumberOfTPCdEdxPointsReject->SetFillColor(kRed-2);
2636   fQAAntiProtonsRejectedList->Add(gAntiProtonsNumberOfTPCdEdxPointsReject);
2637   TH1F *gAntiProtonsITSClusterMapReject = new TH1F("gAntiProtonsITSClusterMapReject",";ITS Layer;Entries",6,0.5,6.5);
2638   gAntiProtonsITSClusterMapReject->SetFillColor(kRed-2);
2639   fQAAntiProtonsRejectedList->Add(gAntiProtonsITSClusterMapReject);
2640   TH1F *gAntiProtonsDCA3DReject = new TH1F("gAntiProtonsDCA3DReject",
2641                                            ";dca [cm];Entries",
2642                                            100,0,20);
2643   gAntiProtonsDCA3DReject->SetFillColor(kRed-2);
2644   fQAAntiProtonsRejectedList->Add(gAntiProtonsDCA3DReject);
2645 }
2646
2647 //____________________________________________________________________//
2648 void AliProtonAnalysis::FillQA(AliESDEvent *esd,
2649                                const AliESDVertex *vertex, 
2650                                AliESDtrack* track) {
2651   //Fills the QA histograms
2652   Double_t gPt = 0.0, gPx = 0.0, gPy = 0.0, gPz = 0.0;
2653   Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0};  //The impact parameters and their covariance.
2654   Double_t dca3D = 0.0;
2655   Float_t dcaXY = 0.0, dcaZ = 0.0;
2656   if(!fProtonAnalysisBase) return;
2657
2658   if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
2659     AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
2660     if(!tpcTrack) {
2661       gPt = 0.0; gPx = 0.0; gPy = 0.0; gPz = 0.0;
2662       dca[0] = -100.; dca[1] = -100.;
2663       cov[0] = -100.; cov[1] = -100.; cov[2] = -100.;
2664     }
2665     else {
2666       gPt = tpcTrack->Pt();
2667       gPx = tpcTrack->Px();
2668       gPy = tpcTrack->Py();
2669       gPz = tpcTrack->Pz();
2670       tpcTrack->PropagateToDCA(vertex,
2671                                esd->GetMagneticField(),
2672                                100.,dca,cov);
2673     }
2674   }
2675   if(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kFullHybrid) {
2676     AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
2677     AliExternalTrackParam cParam;
2678     if(!tpcTrack) {
2679       gPt = 0.0; gPx = 0.0; gPy = 0.0; gPz = 0.0;
2680       dca[0] = -100.; dca[1] = -100.;
2681       cov[0] = -100.; cov[1] = -100.; cov[2] = -100.;
2682     }
2683     else {
2684       gPt = tpcTrack->Pt();
2685       gPx = tpcTrack->Px();
2686       gPy = tpcTrack->Py();
2687       gPz = tpcTrack->Pz();
2688       track->RelateToVertex(vertex,
2689                             esd->GetMagneticField(),
2690                             100.,&cParam);
2691       track->GetImpactParameters(dcaXY,dcaZ);
2692       dca[0] = dcaXY; dca[1] = dcaZ;
2693     }
2694   }
2695   else{
2696     gPt = track->Pt();
2697     gPx = track->Px();
2698     gPy = track->Py();
2699     gPz = track->Pz();
2700     track->PropagateToDCA(vertex,
2701                           esd->GetMagneticField(),
2702                           100.,dca,cov);
2703   }
2704
2705   dca3D = TMath::Sqrt(TMath::Power(dca[0],2) +
2706                       TMath::Power(dca[1],2));
2707
2708   //Int_t  fIdxInt[200];
2709   //Int_t nClustersITS = track->GetITSclusters(fIdxInt);
2710   //Int_t nClustersTPC = track->GetTPCclusters(fIdxInt);
2711   Int_t nClustersITS = track->GetITSclusters(0x0);
2712   Int_t nClustersTPC = track->GetTPCclusters(0x0);
2713
2714   Float_t chi2PerClusterITS = -1;
2715   if (nClustersITS!=0)
2716     chi2PerClusterITS = track->GetITSchi2()/Float_t(nClustersITS);
2717   Float_t chi2PerClusterTPC = -1;
2718   if (nClustersTPC!=0)
2719     chi2PerClusterTPC = track->GetTPCchi2()/Float_t(nClustersTPC);
2720
2721   Double_t extCov[15];
2722   track->GetExternalCovariance(extCov);
2723   
2724   //protons
2725   if(track->Charge() > 0) {
2726     if(fProtonAnalysisBase->IsUsedMinITSClusters()) {
2727       if(nClustersITS < fProtonAnalysisBase->GetMinITSClusters()) {
2728         ((TH1F *)(fQAProtonsRejectedList->At(0)))->Fill(nClustersITS);
2729       }
2730       else if(nClustersITS >= fProtonAnalysisBase->GetMinITSClusters()) 
2731         ((TH1F *)(fQAProtonsAcceptedList->At(0)))->Fill(nClustersITS);
2732     }//ITS clusters
2733     if(fProtonAnalysisBase->IsUsedMaxChi2PerITSCluster()) {
2734       if(chi2PerClusterITS > fProtonAnalysisBase->GetMaxChi2PerITSCluster()) {
2735         ((TH1F *)(fQAProtonsRejectedList->At(1)))->Fill(chi2PerClusterITS);
2736       }
2737       else if(chi2PerClusterITS <= fProtonAnalysisBase->GetMaxChi2PerITSCluster())
2738         ((TH1F *)(fQAProtonsAcceptedList->At(1)))->Fill(chi2PerClusterITS);
2739     }//chi2 per ITS cluster
2740     if(fProtonAnalysisBase->IsUsedMinTPCClusters()) {
2741       if(nClustersTPC < fProtonAnalysisBase->GetMinTPCClusters()) {
2742         ((TH1F *)(fQAProtonsRejectedList->At(2)))->Fill(nClustersTPC);
2743       }
2744       else if(nClustersTPC >= fProtonAnalysisBase->GetMinTPCClusters()) {
2745         ((TH1F *)(fQAProtonsAcceptedList->At(2)))->Fill(nClustersTPC);
2746       }
2747     }//TPC clusters
2748     if(fProtonAnalysisBase->IsUsedMaxChi2PerTPCCluster()) {
2749       if(chi2PerClusterTPC > fProtonAnalysisBase->GetMaxChi2PerTPCCluster()) {
2750         ((TH1F *)(fQAProtonsRejectedList->At(3)))->Fill(chi2PerClusterTPC);
2751       }
2752       else if(chi2PerClusterTPC <= fProtonAnalysisBase->GetMaxChi2PerTPCCluster())
2753         ((TH1F *)(fQAProtonsAcceptedList->At(3)))->Fill(chi2PerClusterTPC);
2754     }//chi2 per TPC cluster
2755     if(fProtonAnalysisBase->IsUsedMaxCov11()) {
2756       if(extCov[0] > fProtonAnalysisBase->GetMaxCov11()) {
2757         ((TH1F *)(fQAProtonsRejectedList->At(4)))->Fill(extCov[0]);
2758       }
2759       else if(extCov[0] <= fProtonAnalysisBase->GetMaxCov11())
2760         ((TH1F *)(fQAProtonsAcceptedList->At(4)))->Fill(extCov[0]);
2761     }//cov11
2762     if(fProtonAnalysisBase->IsUsedMaxCov22()) {
2763       if(extCov[2] > fProtonAnalysisBase->GetMaxCov22()) {
2764         ((TH1F *)(fQAProtonsRejectedList->At(5)))->Fill(extCov[2]);
2765       }
2766       else if(extCov[2] <= fProtonAnalysisBase->GetMaxCov22())
2767         ((TH1F *)(fQAProtonsAcceptedList->At(5)))->Fill(extCov[2]);
2768     }//cov11
2769     if(fProtonAnalysisBase->IsUsedMaxCov33()) {
2770       if(extCov[5] > fProtonAnalysisBase->GetMaxCov33()) {
2771         ((TH1F *)(fQAProtonsRejectedList->At(6)))->Fill(extCov[5]);
2772       }
2773       else if(extCov[5] <= fProtonAnalysisBase->GetMaxCov33())
2774         ((TH1F *)(fQAProtonsAcceptedList->At(6)))->Fill(extCov[5]);
2775     }//cov11
2776     if(fProtonAnalysisBase->IsUsedMaxCov44()) {
2777       if(extCov[9] > fProtonAnalysisBase->GetMaxCov44()) {
2778         ((TH1F *)(fQAProtonsRejectedList->At(7)))->Fill(extCov[9]);
2779       }
2780       else if(extCov[9] <= fProtonAnalysisBase->GetMaxCov44())
2781         ((TH1F *)(fQAProtonsAcceptedList->At(7)))->Fill(extCov[9]);
2782     }//cov11
2783     if(fProtonAnalysisBase->IsUsedMaxCov55()) {
2784       if(extCov[14] > fProtonAnalysisBase->GetMaxCov55()) {
2785         ((TH1F *)(fQAProtonsRejectedList->At(8)))->Fill(extCov[14]);
2786       }
2787       else if(extCov[14] <= fProtonAnalysisBase->GetMaxCov55())
2788         ((TH1F *)(fQAProtonsAcceptedList->At(8)))->Fill(extCov[14]);
2789     }//cov55
2790     if(fProtonAnalysisBase->IsUsedMaxSigmaToVertex()) {
2791       if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertex()) {
2792         ((TH1F *)(fQAProtonsRejectedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
2793       }
2794       else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertex())
2795         ((TH1F *)(fQAProtonsAcceptedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
2796     }//sigma to vertex
2797     if(fProtonAnalysisBase->IsUsedMaxSigmaToVertexTPC()) {
2798       if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertexTPC()) {
2799         ((TH1F *)(fQAProtonsRejectedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
2800       }
2801       else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertexTPC())
2802         ((TH1F *)(fQAProtonsAcceptedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
2803     }//sigma to vertex TPC
2804     if(fProtonAnalysisBase->IsUsedMaxDCAXY()) {
2805       if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXY()) {
2806         ((TH1F *)(fQAProtonsRejectedList->At(11)))->Fill(TMath::Abs(dca[0]));
2807       }
2808       else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXY())
2809         ((TH1F *)(fQAProtonsAcceptedList->At(11)))->Fill(TMath::Abs(dca[0]));
2810     }//DCA xy global tracking
2811     if(fProtonAnalysisBase->IsUsedMaxDCAXYTPC()) {
2812       if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXYTPC()) {
2813         ((TH1F *)(fQAProtonsRejectedList->At(12)))->Fill(TMath::Abs(dca[0]));
2814       }
2815       else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXYTPC())
2816         ((TH1F *)(fQAProtonsAcceptedList->At(12)))->Fill(TMath::Abs(dca[0]));
2817     }//DCA xy TPC tracking
2818     if(fProtonAnalysisBase->IsUsedMaxDCAZ()) {
2819       if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZ()) {
2820         ((TH1F *)(fQAProtonsRejectedList->At(13)))->Fill(TMath::Abs(dca[1]));
2821       }
2822       else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZ())
2823         ((TH1F *)(fQAProtonsAcceptedList->At(13)))->Fill(TMath::Abs(dca[1]));
2824     }//DCA z global tracking
2825     if(fProtonAnalysisBase->IsUsedMaxDCAZTPC()) {
2826       if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZTPC()) {
2827         ((TH1F *)(fQAProtonsRejectedList->At(14)))->Fill(TMath::Abs(dca[1]));
2828       }
2829       else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZTPC())
2830         ((TH1F *)(fQAProtonsAcceptedList->At(14)))->Fill(TMath::Abs(dca[1]));
2831     }//DCA z TPC tracking
2832     if(fProtonAnalysisBase->IsUsedMaxConstrainChi2()) {
2833       if(track->GetConstrainedChi2() > 0) {
2834         if(TMath::Log(track->GetConstrainedChi2()) > fProtonAnalysisBase->GetMaxConstrainChi2()) {
2835           ((TH1F *)(fQAProtonsRejectedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
2836         }
2837         else if(TMath::Log(track->GetConstrainedChi2()) <= fProtonAnalysisBase->GetMaxConstrainChi2())
2838           ((TH1F *)(fQAProtonsAcceptedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
2839       }
2840     }//constrain chi2 - vertex
2841     if(fProtonAnalysisBase->IsUsedITSRefit()) {
2842       if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) {
2843         ((TH1F *)(fQAProtonsRejectedList->At(16)))->Fill(0);
2844       }
2845       else if((track->GetStatus() & AliESDtrack::kITSrefit) != 0)
2846         ((TH1F *)(fQAProtonsAcceptedList->At(16)))->Fill(0);
2847     }//ITS refit
2848     if(fProtonAnalysisBase->IsUsedTPCRefit()) {
2849       if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) {
2850         ((TH1F *)(fQAProtonsRejectedList->At(17)))->Fill(0);
2851       }
2852       else if((track->GetStatus() & AliESDtrack::kTPCrefit) != 0)
2853         ((TH1F *)(fQAProtonsAcceptedList->At(17)))->Fill(0);
2854     }//TPC refit
2855     if(fProtonAnalysisBase->IsUsedESDpid()) {
2856       if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) {
2857         ((TH1F *)(fQAProtonsRejectedList->At(18)))->Fill(0);
2858       }
2859       else if((track->GetStatus() & AliESDtrack::kESDpid) != 0)
2860         ((TH1F *)(fQAProtonsAcceptedList->At(18)))->Fill(0);
2861     }//ESD pid
2862     if(fProtonAnalysisBase->IsUsedTPCpid()) {
2863       if ((track->GetStatus() & AliESDtrack::kTPCpid) == 0) {
2864         ((TH1F *)(fQAProtonsRejectedList->At(19)))->Fill(0);
2865       }
2866       else if((track->GetStatus() & AliESDtrack::kTPCpid) != 0)
2867         ((TH1F *)(fQAProtonsAcceptedList->At(19)))->Fill(0);
2868     }//TPC pid
2869     if(fProtonAnalysisBase->IsUsedPointOnITSLayer1()) {
2870       if(!track->HasPointOnITSLayer(0)) {
2871         ((TH1F *)(fQAProtonsRejectedList->At(20)))->Fill(0);
2872       }
2873       else if(track->HasPointOnITSLayer(0))
2874         ((TH1F *)(fQAProtonsAcceptedList->At(20)))->Fill(0);
2875     }//point on SPD1
2876     if(fProtonAnalysisBase->IsUsedPointOnITSLayer2()) {
2877       if(!track->HasPointOnITSLayer(1)) {
2878         ((TH1F *)(fQAProtonsRejectedList->At(21)))->Fill(0);
2879       }
2880       else if(track->HasPointOnITSLayer(1))
2881         ((TH1F *)(fQAProtonsAcceptedList->At(21)))->Fill(0);
2882     }//point on SPD2
2883     if(fProtonAnalysisBase->IsUsedPointOnITSLayer3()) {
2884       if(!track->HasPointOnITSLayer(2)) {
2885         ((TH1F *)(fQAProtonsRejectedList->At(22)))->Fill(0);
2886       }
2887       else if(track->HasPointOnITSLayer(2))
2888         ((TH1F *)(fQAProtonsAcceptedList->At(22)))->Fill(0);
2889     }//point on SDD1
2890     if(fProtonAnalysisBase->IsUsedPointOnITSLayer4()) {
2891       if(!track->HasPointOnITSLayer(3)) {
2892         ((TH1F *)(fQAProtonsRejectedList->At(23)))->Fill(0);
2893       }
2894       else if(track->HasPointOnITSLayer(3))
2895         ((TH1F *)(fQAProtonsAcceptedList->At(23)))->Fill(0);
2896     }//point on SDD2
2897     if(fProtonAnalysisBase->IsUsedPointOnITSLayer5()) {
2898       if(!track->HasPointOnITSLayer(4)) {
2899         ((TH1F *)(fQAProtonsRejectedList->At(24)))->Fill(0);
2900       }
2901       else if(track->HasPointOnITSLayer(4))
2902         ((TH1F *)(fQAProtonsAcceptedList->At(24)))->Fill(0);
2903     }//point on SSD1
2904     if(fProtonAnalysisBase->IsUsedPointOnITSLayer6()) {
2905       if(!track->HasPointOnITSLayer(5)) {
2906         ((TH1F *)(fQAProtonsRejectedList->At(25)))->Fill(0);
2907       }
2908       else if(track->HasPointOnITSLayer(5))
2909         ((TH1F *)(fQAProtonsAcceptedList->At(25)))->Fill(0);
2910     }//point on SSD2
2911     if(fProtonAnalysisBase->IsUsedMinTPCdEdxPoints()) {
2912       if(track->GetTPCsignalN() < fProtonAnalysisBase->GetMinTPCdEdxPoints()) {
2913         ((TH1F *)(fQAProtonsRejectedList->At(26)))->Fill(track->GetTPCsignalN());
2914       }
2915       if(track->GetTPCsignalN() >= fProtonAnalysisBase->GetMinTPCdEdxPoints())
2916         ((TH1F *)(fQAProtonsAcceptedList->At(26)))->Fill(track->GetTPCsignalN());
2917     }//number of TPC points for the dE/dx
2918     if(fProtonAnalysisBase->IsUsedPointOnSPDLayer()) {
2919       if((!track->HasPointOnITSLayer(0))&&(!track->HasPointOnITSLayer(1))) {
2920         for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
2921           if(track->HasPointOnITSLayer(iLayer))
2922             ((TH1F *)(fQAProtonsRejectedList->At(27)))->Fill(iLayer+1);
2923         }
2924       }
2925       else if((track->HasPointOnITSLayer(0))||(track->HasPointOnITSLayer(1))) {
2926         for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
2927           if(track->HasPointOnITSLayer(iLayer))
2928             ((TH1F *)(fQAProtonsAcceptedList->At(27)))->Fill(iLayer+1);
2929         }
2930       }
2931     }//point on either SPD layers
2932     if(fProtonAnalysisBase->IsUsedMaxDCA3D()) {
2933       if(dca3D > fProtonAnalysisBase->GetMaxDCA3D()) {
2934         ((TH1F *)(fQAProtonsRejectedList->At(28)))->Fill(dca3D);
2935       }
2936       if(dca3D < fProtonAnalysisBase->GetMaxDCA3D()) 
2937         ((TH1F *)(fQAProtonsAcceptedList->At(28)))->Fill(dca3D);
2938     }//dca3D
2939   }//protons
2940
2941   //antiprotons
2942   if(track->Charge() < 0) {
2943     if(fProtonAnalysisBase->IsUsedMinITSClusters()) {
2944       if(nClustersITS < fProtonAnalysisBase->GetMinITSClusters()) {
2945         ((TH1F *)(fQAAntiProtonsRejectedList->At(0)))->Fill(nClustersITS);
2946       }
2947       else if(nClustersITS >= fProtonAnalysisBase->GetMinITSClusters()) 
2948         ((TH1F *)(fQAAntiProtonsAcceptedList->At(0)))->Fill(nClustersITS);
2949     }//ITS clusters
2950     if(fProtonAnalysisBase->IsUsedMaxChi2PerITSCluster()) {
2951       if(chi2PerClusterITS > fProtonAnalysisBase->GetMaxChi2PerITSCluster()) {
2952         ((TH1F *)(fQAAntiProtonsRejectedList->At(1)))->Fill(chi2PerClusterITS);
2953       }
2954       else if(chi2PerClusterITS <= fProtonAnalysisBase->GetMaxChi2PerITSCluster())
2955         ((TH1F *)(fQAAntiProtonsAcceptedList->At(1)))->Fill(chi2PerClusterITS);
2956     }//chi2 per ITS cluster
2957     if(fProtonAnalysisBase->IsUsedMinTPCClusters()) {
2958       if(nClustersTPC < fProtonAnalysisBase->GetMinTPCClusters()) {
2959         ((TH1F *)(fQAAntiProtonsRejectedList->At(2)))->Fill(nClustersTPC);
2960       }
2961       else if(nClustersTPC >= fProtonAnalysisBase->GetMinTPCClusters()) {
2962         ((TH1F *)(fQAAntiProtonsAcceptedList->At(2)))->Fill(nClustersTPC);
2963       }
2964     }//TPC clusters
2965     if(fProtonAnalysisBase->IsUsedMaxChi2PerTPCCluster()) {
2966       if(chi2PerClusterTPC > fProtonAnalysisBase->GetMaxChi2PerTPCCluster()) {
2967         ((TH1F *)(fQAAntiProtonsRejectedList->At(3)))->Fill(chi2PerClusterTPC);
2968       }
2969       else if(chi2PerClusterTPC <= fProtonAnalysisBase->GetMaxChi2PerTPCCluster())
2970         ((TH1F *)(fQAAntiProtonsAcceptedList->At(3)))->Fill(chi2PerClusterTPC);
2971     }//chi2 per TPC cluster
2972     if(fProtonAnalysisBase->IsUsedMaxCov11()) {
2973       if(extCov[0] > fProtonAnalysisBase->GetMaxCov11()) {
2974         ((TH1F *)(fQAAntiProtonsRejectedList->At(4)))->Fill(extCov[0]);
2975       }
2976       else if(extCov[0] <= fProtonAnalysisBase->GetMaxCov11())
2977         ((TH1F *)(fQAAntiProtonsAcceptedList->At(4)))->Fill(extCov[0]);
2978     }//cov11
2979     if(fProtonAnalysisBase->IsUsedMaxCov22()) {
2980       if(extCov[2] > fProtonAnalysisBase->GetMaxCov22()) {
2981         ((TH1F *)(fQAAntiProtonsRejectedList->At(5)))->Fill(extCov[2]);
2982       }
2983       else if(extCov[2] <= fProtonAnalysisBase->GetMaxCov22())
2984         ((TH1F *)(fQAAntiProtonsAcceptedList->At(5)))->Fill(extCov[2]);
2985     }//cov11
2986     if(fProtonAnalysisBase->IsUsedMaxCov33()) {
2987       if(extCov[5] > fProtonAnalysisBase->GetMaxCov33()) {
2988         ((TH1F *)(fQAAntiProtonsRejectedList->At(6)))->Fill(extCov[5]);
2989       }
2990       else if(extCov[5] <= fProtonAnalysisBase->GetMaxCov33())
2991         ((TH1F *)(fQAAntiProtonsAcceptedList->At(6)))->Fill(extCov[5]);
2992     }//cov11
2993     if(fProtonAnalysisBase->IsUsedMaxCov44()) {
2994       if(extCov[9] > fProtonAnalysisBase->GetMaxCov44()) {
2995         ((TH1F *)(fQAAntiProtonsRejectedList->At(7)))->Fill(extCov[9]);
2996       }
2997       else if(extCov[9] <= fProtonAnalysisBase->GetMaxCov44())
2998         ((TH1F *)(fQAAntiProtonsAcceptedList->At(7)))->Fill(extCov[9]);
2999     }//cov11
3000     if(fProtonAnalysisBase->IsUsedMaxCov55()) {
3001       if(extCov[14] > fProtonAnalysisBase->GetMaxCov55()) {
3002         ((TH1F *)(fQAAntiProtonsRejectedList->At(8)))->Fill(extCov[14]);
3003       }
3004       else if(extCov[14] <= fProtonAnalysisBase->GetMaxCov55())
3005         ((TH1F *)(fQAAntiProtonsAcceptedList->At(8)))->Fill(extCov[14]);
3006     }//cov55
3007     if(fProtonAnalysisBase->IsUsedMaxSigmaToVertex()) {
3008       if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertex()) {
3009         ((TH1F *)(fQAAntiProtonsRejectedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
3010       }
3011       else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertex())
3012         ((TH1F *)(fQAAntiProtonsAcceptedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
3013     }//sigma to vertex
3014     if(fProtonAnalysisBase->IsUsedMaxSigmaToVertexTPC()) {
3015       if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertexTPC()) {
3016         ((TH1F *)(fQAAntiProtonsRejectedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
3017       }
3018       else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertexTPC())
3019         ((TH1F *)(fQAAntiProtonsAcceptedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
3020     }//sigma to vertex TPC
3021     if(fProtonAnalysisBase->IsUsedMaxDCAXY()) {
3022       if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXY()) {
3023         ((TH1F *)(fQAAntiProtonsRejectedList->At(11)))->Fill(TMath::Abs(dca[0]));
3024       }
3025       else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXY())
3026         ((TH1F *)(fQAAntiProtonsAcceptedList->At(11)))->Fill(TMath::Abs(dca[0]));
3027     }//DCA xy global tracking
3028     if(fProtonAnalysisBase->IsUsedMaxDCAXYTPC()) {
3029       if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXYTPC()) {
3030         ((TH1F *)(fQAAntiProtonsRejectedList->At(12)))->Fill(TMath::Abs(dca[0]));
3031       }
3032       else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXYTPC())
3033         ((TH1F *)(fQAAntiProtonsAcceptedList->At(12)))->Fill(TMath::Abs(dca[0]));
3034     }//DCA xy TPC tracking
3035     if(fProtonAnalysisBase->IsUsedMaxDCAZ()) {
3036       if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZ()) {
3037         ((TH1F *)(fQAAntiProtonsRejectedList->At(13)))->Fill(TMath::Abs(dca[1]));
3038       }
3039       else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZ())
3040         ((TH1F *)(fQAAntiProtonsAcceptedList->At(13)))->Fill(TMath::Abs(dca[1]));
3041     }//DCA z global tracking
3042     if(fProtonAnalysisBase->IsUsedMaxDCAZTPC()) {
3043       if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZTPC()) {
3044         ((TH1F *)(fQAAntiProtonsRejectedList->At(14)))->Fill(TMath::Abs(dca[1]));
3045       }
3046       else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZTPC())
3047         ((TH1F *)(fQAAntiProtonsAcceptedList->At(14)))->Fill(TMath::Abs(dca[1]));
3048     }//DCA z TPC tracking
3049     if(fProtonAnalysisBase->IsUsedMaxConstrainChi2()) {
3050       if(track->GetConstrainedChi2() > 0) {
3051         if(TMath::Log(track->GetConstrainedChi2()) > fProtonAnalysisBase->GetMaxConstrainChi2()) {
3052           ((TH1F *)(fQAAntiProtonsRejectedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
3053         }
3054         else if(TMath::Log(track->GetConstrainedChi2()) <= fProtonAnalysisBase->GetMaxConstrainChi2())
3055           ((TH1F *)(fQAAntiProtonsAcceptedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
3056       }
3057     }//constrain chi2 - vertex
3058     if(fProtonAnalysisBase->IsUsedITSRefit()) {
3059       if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) {
3060         ((TH1F *)(fQAAntiProtonsRejectedList->At(16)))->Fill(0);
3061       }
3062       else if((track->GetStatus() & AliESDtrack::kITSrefit) != 0)
3063         ((TH1F *)(fQAAntiProtonsAcceptedList->At(16)))->Fill(0);
3064     }//ITS refit
3065     if(fProtonAnalysisBase->IsUsedTPCRefit()) {
3066       if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) {
3067         ((TH1F *)(fQAAntiProtonsRejectedList->At(17)))->Fill(0);
3068       }
3069       else if((track->GetStatus() & AliESDtrack::kTPCrefit) != 0)
3070         ((TH1F *)(fQAAntiProtonsAcceptedList->At(17)))->Fill(0);
3071     }//TPC refit
3072     if(fProtonAnalysisBase->IsUsedESDpid()) {
3073       if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) {
3074         ((TH1F *)(fQAAntiProtonsRejectedList->At(18)))->Fill(0);
3075       }
3076       else if((track->GetStatus() & AliESDtrack::kESDpid) != 0)
3077         ((TH1F *)(fQAAntiProtonsAcceptedList->At(18)))->Fill(0);
3078     }//ESD pid
3079     if(fProtonAnalysisBase->IsUsedTPCpid()) {
3080       if ((track->GetStatus() & AliESDtrack::kTPCpid) == 0) {
3081         ((TH1F *)(fQAAntiProtonsRejectedList->At(19)))->Fill(0);
3082       }
3083       else if((track->GetStatus() & AliESDtrack::kTPCpid) != 0)
3084         ((TH1F *)(fQAAntiProtonsAcceptedList->At(19)))->Fill(0);
3085     }//TPC pid
3086     if(fProtonAnalysisBase->IsUsedPointOnITSLayer1()) {
3087       if(!track->HasPointOnITSLayer(0)) {
3088         ((TH1F *)(fQAAntiProtonsRejectedList->At(20)))->Fill(0);
3089       }
3090       else if(track->HasPointOnITSLayer(0))
3091         ((TH1F *)(fQAAntiProtonsAcceptedList->At(20)))->Fill(0);
3092     }//point on SPD1
3093     if(fProtonAnalysisBase->IsUsedPointOnITSLayer2()) {
3094       if(!track->HasPointOnITSLayer(1)) {
3095         ((TH1F *)(fQAAntiProtonsRejectedList->At(21)))->Fill(0);
3096       }
3097       else if(track->HasPointOnITSLayer(1))
3098         ((TH1F *)(fQAAntiProtonsAcceptedList->At(21)))->Fill(0);
3099     }//point on SPD2
3100     if(fProtonAnalysisBase->IsUsedPointOnITSLayer3()) {
3101       if(!track->HasPointOnITSLayer(2)) {
3102         ((TH1F *)(fQAAntiProtonsRejectedList->At(22)))->Fill(0);
3103       }
3104       else if(track->HasPointOnITSLayer(2))
3105         ((TH1F *)(fQAAntiProtonsAcceptedList->At(22)))->Fill(0);
3106     }//point on SDD1
3107     if(fProtonAnalysisBase->IsUsedPointOnITSLayer4()) {
3108       if(!track->HasPointOnITSLayer(3)) {
3109         ((TH1F *)(fQAAntiProtonsRejectedList->At(23)))->Fill(0);
3110       }
3111       else if(track->HasPointOnITSLayer(3))
3112         ((TH1F *)(fQAAntiProtonsAcceptedList->At(23)))->Fill(0);
3113     }//point on SDD2
3114     if(fProtonAnalysisBase->IsUsedPointOnITSLayer5()) {
3115       if(!track->HasPointOnITSLayer(4)) {
3116         ((TH1F *)(fQAAntiProtonsRejectedList->At(24)))->Fill(0);
3117       }
3118       else if(track->HasPointOnITSLayer(4))
3119         ((TH1F *)(fQAAntiProtonsAcceptedList->At(24)))->Fill(0);
3120     }//point on SSD1
3121     if(fProtonAnalysisBase->IsUsedPointOnITSLayer6()) {
3122       if(!track->HasPointOnITSLayer(5)) {
3123         ((TH1F *)(fQAAntiProtonsRejectedList->At(25)))->Fill(0);
3124       }
3125       else if(track->HasPointOnITSLayer(5))
3126         ((TH1F *)(fQAAntiProtonsAcceptedList->At(25)))->Fill(0);
3127     }//point on SSD2
3128     if(fProtonAnalysisBase->IsUsedMinTPCdEdxPoints()) {
3129       if(track->GetTPCsignalN() < fProtonAnalysisBase->GetMinTPCdEdxPoints()) {
3130         ((TH1F *)(fQAAntiProtonsRejectedList->At(26)))->Fill(track->GetTPCsignalN());
3131       }
3132       if(track->GetTPCsignalN() >= fProtonAnalysisBase->GetMinTPCdEdxPoints())
3133         ((TH1F *)(fQAAntiProtonsAcceptedList->At(26)))->Fill(track->GetTPCsignalN());
3134     }//number of TPC points for the dE/dx
3135     if(fProtonAnalysisBase->IsUsedPointOnSPDLayer()) {
3136       if((!track->HasPointOnITSLayer(0))&&(!track->HasPointOnITSLayer(1))) {
3137         for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
3138           if(track->HasPointOnITSLayer(iLayer))
3139             ((TH1F *)(fQAAntiProtonsRejectedList->At(27)))->Fill(iLayer+1);
3140         }
3141       }
3142       else if((track->HasPointOnITSLayer(0))||(track->HasPointOnITSLayer(1))) {
3143         for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
3144           if(track->HasPointOnITSLayer(iLayer))
3145             ((TH1F *)(fQAAntiProtonsAcceptedList->At(27)))->Fill(iLayer+1);
3146         }
3147       }
3148     }//point on either SPD layers
3149     if(fProtonAnalysisBase->IsUsedMaxDCA3D()) {
3150       if(dca3D > fProtonAnalysisBase->GetMaxDCA3D()) {
3151         ((TH1F *)(fQAAntiProtonsRejectedList->At(28)))->Fill(dca3D);
3152       }
3153       if(dca3D < fProtonAnalysisBase->GetMaxDCA3D()) 
3154         ((TH1F *)(fQAAntiProtonsAcceptedList->At(28)))->Fill(dca3D);
3155     }//dca3D
3156   }//antiprotons
3157 }