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