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