]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/SPECTRA/AliProtonQAAnalysis.cxx
Returning the 2D histograms from the CF containers
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / AliProtonQAAnalysis.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: AliProtonQAAnalysis.cxx 29114 2008-10-03 16:49:02Z pchrist $ */
15
16 //-----------------------------------------------------------------
17 //                 AliProtonQAAnalysis 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 <TSystem.h>
23 #include <TF1.h>
24 #include <TH2D.h>
25 #include <TH3F.h>
26 #include <TH1D.h>
27 #include <TArrayI.h>
28 #include <TParticle.h>
29
30 #include "AliProtonQAAnalysis.h"
31 #include "AliProtonAnalysisBase.h"
32
33 #include <AliExternalTrackParam.h>
34 #include <AliESDEvent.h>
35 #include <AliLog.h>
36 #include <AliPID.h>
37 #include <AliStack.h>
38 #include <AliESDVertex.h>
39 #include <AliGenEventHeader.h>
40 #include <AliMCEvent.h>
41
42 ClassImp(AliProtonQAAnalysis)
43
44 //____________________________________________________________________//
45 AliProtonQAAnalysis::AliProtonQAAnalysis() : 
46   TObject(), fProtonAnalysisBase(0),
47   fNBinsY(0), fMinY(0), fMaxY(0), fY(0),
48   fNBinsPt(0), fMinPt(0), fMaxPt(0), fPt(0), fUseAsymmetricBinning(kFALSE),
49   fGlobalQAList(0), fQAVertexList(0), fQA2DList(0),
50   fQAPrimaryProtonsAcceptedList(0),
51   fQAPrimaryProtonsRejectedList(0),
52   fQASecondaryProtonsAcceptedList(0),
53   fQASecondaryProtonsRejectedList(0),
54   fQAPrimaryAntiProtonsAcceptedList(0),
55   fQAPrimaryAntiProtonsRejectedList(0),
56   fQASecondaryAntiProtonsAcceptedList(0),
57   fQASecondaryAntiProtonsRejectedList(0),
58   fPDGList(0), fMCProcessesList(0),
59   fRunMCAnalysis(kFALSE),
60   fMCProcessIdFlag(kFALSE), fMCProcessId(0),
61   fMotherParticlePDGCodeFlag(kFALSE), fMotherParticlePDGCode(0),
62   fAcceptedCutList(0), fRejectedCutList(0),
63   fAcceptedDCAList(0), fRejectedDCAList(0),
64   fRunEfficiencyAnalysis(kFALSE),
65   fUseCutsInEfficiency(kFALSE),
66   fEfficiencyList(0), fCutEfficiencyList(0) {
67   //Default constructor
68 }
69
70 //____________________________________________________________________//
71 AliProtonQAAnalysis::~AliProtonQAAnalysis() {
72   //Default destructor
73   if(fProtonAnalysisBase) delete fProtonAnalysisBase;
74   if(fGlobalQAList) delete fGlobalQAList;
75   if(fQAVertexList) delete fQAVertexList;
76   if(fQA2DList) delete fQA2DList;
77   if(fQAPrimaryProtonsAcceptedList) delete fQAPrimaryProtonsAcceptedList;
78   if(fQAPrimaryProtonsRejectedList) delete fQAPrimaryProtonsRejectedList;
79   if(fQASecondaryProtonsAcceptedList) delete fQASecondaryProtonsAcceptedList;
80   if(fQASecondaryProtonsRejectedList) delete fQASecondaryProtonsRejectedList;
81   if(fQAPrimaryAntiProtonsAcceptedList) 
82     delete fQAPrimaryAntiProtonsAcceptedList;
83   if(fQAPrimaryAntiProtonsRejectedList) 
84     delete fQAPrimaryAntiProtonsRejectedList;
85   if(fQASecondaryAntiProtonsAcceptedList) 
86     delete fQASecondaryAntiProtonsAcceptedList;
87   if(fQASecondaryAntiProtonsRejectedList) 
88     delete fQASecondaryAntiProtonsRejectedList; 
89
90   if(fPDGList) delete fPDGList;
91   if(fMCProcessesList) delete fMCProcessesList;
92   
93   if(fAcceptedCutList) delete fAcceptedCutList;
94   if(fRejectedCutList) delete fRejectedCutList;
95   if(fAcceptedDCAList) delete fAcceptedDCAList;
96   if(fRejectedDCAList) delete fRejectedDCAList;
97  
98   if(fEfficiencyList) delete fEfficiencyList;
99   if(fCutEfficiencyList) delete fCutEfficiencyList;
100 }
101
102 //____________________________________________________________________//
103 void AliProtonQAAnalysis::FillQA(AliStack *const stack,
104                                  AliESDEvent *esd,
105                                  const AliESDVertex *vertex, 
106                                  AliESDtrack* track) {
107   // Checks if the track is excluded from the cuts
108   Int_t nPrimaries = stack->GetNprimary();
109   Int_t label = TMath::Abs(track->GetLabel());
110
111   Double_t gPt = 0.0, gPx = 0.0, gPy = 0.0, gPz = 0.0;
112   Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0};  //The impact parameters and their covariance.
113
114   if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
115     AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
116     if(!tpcTrack) {
117       gPt = 0.0; gPx = 0.0; gPy = 0.0; gPz = 0.0;
118       dca[0] = -100.; dca[1] = -100.;
119       cov[0] = -100.; cov[1] = -100.; cov[2] = -100.;
120     }
121     else {
122       gPt = tpcTrack->Pt();
123       gPx = tpcTrack->Px();
124       gPy = tpcTrack->Py();
125       gPz = tpcTrack->Pz();
126       tpcTrack->PropagateToDCA(vertex,
127                                esd->GetMagneticField(),
128                                100.,dca,cov);
129     }
130   }
131   else{
132     gPt = track->Pt();
133     gPx = track->Px();
134     gPy = track->Py();
135     gPz = track->Pz();
136     track->PropagateToDCA(vertex,
137                           esd->GetMagneticField(),
138                           100.,dca,cov);
139   }
140
141   //TParticle *particle = stack->Particle(label);
142   //if(particle) {
143   //Int_t pdgcode = particle->GetPdgCode();
144   //Int_t gProcess = particle->GetUniqueID();
145   Int_t  fIdxInt[200];
146   Int_t nClustersITS = track->GetITSclusters(fIdxInt);
147   Int_t nClustersTPC = track->GetTPCclusters(fIdxInt);
148   
149   Float_t chi2PerClusterITS = -1;
150   if (nClustersITS!=0)
151     chi2PerClusterITS = track->GetITSchi2()/Float_t(nClustersITS);
152   Float_t chi2PerClusterTPC = -1;
153   if (nClustersTPC!=0)
154     chi2PerClusterTPC = track->GetTPCchi2()/Float_t(nClustersTPC);
155   
156   Double_t extCov[15];
157     track->GetExternalCovariance(extCov);
158     
159     //protons
160     if(track->Charge() > 0) {
161       //Primaries
162       if(label <= nPrimaries) {
163         if(fProtonAnalysisBase->IsUsedMinITSClusters()) {
164           if(nClustersITS < fProtonAnalysisBase->GetMinITSClusters()) {
165             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(0)))->Fill(nClustersITS);
166           }
167           else if(nClustersITS >= fProtonAnalysisBase->GetMinITSClusters()) 
168             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(0)))->Fill(nClustersITS);
169         }//ITS clusters
170         if(fProtonAnalysisBase->IsUsedMaxChi2PerITSCluster()) {
171           if(chi2PerClusterITS > fProtonAnalysisBase->GetMaxChi2PerITSCluster()) {
172             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(1)))->Fill(chi2PerClusterITS);
173           }
174           else if(chi2PerClusterITS <= fProtonAnalysisBase->GetMaxChi2PerITSCluster())
175             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(1)))->Fill(chi2PerClusterITS);
176         }//chi2 per ITS cluster
177         if(fProtonAnalysisBase->IsUsedMinTPCClusters()) {
178           if(nClustersTPC < fProtonAnalysisBase->GetMinTPCClusters()) {
179             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(2)))->Fill(nClustersTPC);
180           }
181           else if(nClustersTPC >= fProtonAnalysisBase->GetMinTPCClusters()) {
182             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(2)))->Fill(nClustersTPC);
183           }
184         }//TPC clusters
185         if(fProtonAnalysisBase->IsUsedMaxChi2PerTPCCluster()) {
186           if(chi2PerClusterTPC > fProtonAnalysisBase->GetMaxChi2PerTPCCluster()) {
187             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(3)))->Fill(chi2PerClusterTPC);
188           }
189           else if(chi2PerClusterTPC <= fProtonAnalysisBase->GetMaxChi2PerTPCCluster())
190             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(3)))->Fill(chi2PerClusterTPC);
191         }//chi2 per TPC cluster
192         if(fProtonAnalysisBase->IsUsedMaxCov11()) {
193           if(extCov[0] > fProtonAnalysisBase->GetMaxCov11()) {
194             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(4)))->Fill(extCov[0]);
195           }
196           else if(extCov[0] <= fProtonAnalysisBase->GetMaxCov11())
197             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(4)))->Fill(extCov[0]);
198         }//cov11
199         if(fProtonAnalysisBase->IsUsedMaxCov22()) {
200           if(extCov[2] > fProtonAnalysisBase->GetMaxCov22()) {
201             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(5)))->Fill(extCov[2]);
202           }
203           else if(extCov[2] <= fProtonAnalysisBase->GetMaxCov22())
204             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(5)))->Fill(extCov[2]);
205         }//cov11
206         if(fProtonAnalysisBase->IsUsedMaxCov33()) {
207           if(extCov[5] > fProtonAnalysisBase->GetMaxCov33()) {
208             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(6)))->Fill(extCov[5]);
209           }
210           else if(extCov[5] <= fProtonAnalysisBase->GetMaxCov33())
211             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(6)))->Fill(extCov[5]);
212         }//cov11
213         if(fProtonAnalysisBase->IsUsedMaxCov44()) {
214           if(extCov[9] > fProtonAnalysisBase->GetMaxCov44()) {
215             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(7)))->Fill(extCov[9]);
216           }
217           else if(extCov[9] <= fProtonAnalysisBase->GetMaxCov44())
218             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(7)))->Fill(extCov[9]);
219         }//cov11
220         if(fProtonAnalysisBase->IsUsedMaxCov55()) {
221           if(extCov[14] > fProtonAnalysisBase->GetMaxCov55()) {
222             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(8)))->Fill(extCov[14]);
223           }
224           else if(extCov[14] <= fProtonAnalysisBase->GetMaxCov55())
225             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(8)))->Fill(extCov[14]);
226         }//cov55
227         if(fProtonAnalysisBase->IsUsedMaxSigmaToVertex()) {
228           if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertex()) {
229             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
230           }
231           else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertex())
232             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
233         }//sigma to vertex
234         if(fProtonAnalysisBase->IsUsedMaxSigmaToVertexTPC()) {
235           if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertexTPC()) {
236             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
237           }
238           else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertexTPC())
239             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
240         }//sigma to vertex TPC
241         if(fProtonAnalysisBase->IsUsedMaxDCAXY()) {
242           if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXY()) {
243             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(11)))->Fill(TMath::Abs(dca[0]));
244           }
245           else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXY())
246             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(11)))->Fill(TMath::Abs(dca[0]));
247         }//DCA xy global tracking
248         if(fProtonAnalysisBase->IsUsedMaxDCAXYTPC()) {
249           if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXYTPC()) {
250             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(12)))->Fill(TMath::Abs(dca[0]));
251           }
252           else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXYTPC())
253             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(12)))->Fill(TMath::Abs(dca[0]));
254         }//DCA xy TPC tracking
255         if(fProtonAnalysisBase->IsUsedMaxDCAZ()) {
256           if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZ()) {
257             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(13)))->Fill(TMath::Abs(dca[1]));
258           }
259           else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZ())
260             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(13)))->Fill(TMath::Abs(dca[1]));
261         }//DCA z global tracking
262         if(fProtonAnalysisBase->IsUsedMaxDCAZTPC()) {
263           if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZTPC()) {
264             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(14)))->Fill(TMath::Abs(dca[1]));
265           }
266           else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZTPC())
267             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(14)))->Fill(TMath::Abs(dca[1]));
268         }//DCA z TPC tracking
269         if(fProtonAnalysisBase->IsUsedMaxConstrainChi2()) {
270           if(track->GetConstrainedChi2() > 0) {
271             if(TMath::Log(track->GetConstrainedChi2()) > fProtonAnalysisBase->GetMaxConstrainChi2()) {
272               ((TH1F *)(fQAPrimaryProtonsRejectedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
273             }
274             else if(TMath::Log(track->GetConstrainedChi2()) <= fProtonAnalysisBase->GetMaxConstrainChi2())
275               ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
276           }
277         }//constrain chi2 - vertex
278         if(fProtonAnalysisBase->IsUsedITSRefit()) {
279           if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) {
280             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(16)))->Fill(0);
281           }
282           else if((track->GetStatus() & AliESDtrack::kITSrefit) != 0)
283             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(16)))->Fill(0);
284         }//ITS refit
285         if(fProtonAnalysisBase->IsUsedTPCRefit()) {
286           if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) {
287             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(17)))->Fill(0);
288           }
289           else if((track->GetStatus() & AliESDtrack::kTPCrefit) != 0)
290             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(17)))->Fill(0);
291         }//TPC refit
292         if(fProtonAnalysisBase->IsUsedESDpid()) {
293           if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) {
294             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(18)))->Fill(0);
295           }
296           else if((track->GetStatus() & AliESDtrack::kESDpid) != 0)
297             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(18)))->Fill(0);
298         }//ESD pid
299         if(fProtonAnalysisBase->IsUsedTPCpid()) {
300           if ((track->GetStatus() & AliESDtrack::kTPCpid) == 0) {
301             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(19)))->Fill(0);
302         }
303           else if((track->GetStatus() & AliESDtrack::kTPCpid) != 0)
304             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(19)))->Fill(0);
305         }//TPC pid
306         if(fProtonAnalysisBase->IsUsedPointOnITSLayer1()) {
307           if(!track->HasPointOnITSLayer(0)) {
308             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(20)))->Fill(0);
309           }
310           else if(track->HasPointOnITSLayer(0))
311             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(20)))->Fill(0);
312         }//point on SPD1
313         if(fProtonAnalysisBase->IsUsedPointOnITSLayer2()) {
314           if(!track->HasPointOnITSLayer(1)) {
315             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(21)))->Fill(0);
316           }
317           else if(track->HasPointOnITSLayer(1))
318             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(21)))->Fill(0);
319         }//point on SPD2
320         if(fProtonAnalysisBase->IsUsedPointOnITSLayer3()) {
321           if(!track->HasPointOnITSLayer(2)) {
322             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(22)))->Fill(0);
323           }
324           else if(track->HasPointOnITSLayer(2))
325             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(22)))->Fill(0);
326         }//point on SDD1
327         if(fProtonAnalysisBase->IsUsedPointOnITSLayer4()) {
328           if(!track->HasPointOnITSLayer(3)) {
329             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(23)))->Fill(0);
330           }
331           else if(track->HasPointOnITSLayer(3))
332             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(23)))->Fill(0);
333         }//point on SDD2
334         if(fProtonAnalysisBase->IsUsedPointOnITSLayer5()) {
335           if(!track->HasPointOnITSLayer(4)) {
336             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(24)))->Fill(0);
337           }
338           else if(track->HasPointOnITSLayer(4))
339             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(24)))->Fill(0);
340         }//point on SSD1
341         if(fProtonAnalysisBase->IsUsedPointOnITSLayer6()) {
342           if(!track->HasPointOnITSLayer(5)) {
343             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(25)))->Fill(0);
344           }
345           else if(track->HasPointOnITSLayer(5))
346             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(25)))->Fill(0);
347         }//point on SSD2
348         if(fProtonAnalysisBase->IsUsedMinTPCdEdxPoints()) {
349           if(track->GetTPCsignalN() < fProtonAnalysisBase->GetMinTPCdEdxPoints()) {
350             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(26)))->Fill(track->GetTPCsignalN());
351         }
352           if(track->GetTPCsignalN() >= fProtonAnalysisBase->GetMinTPCdEdxPoints())
353             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(26)))->Fill(track->GetTPCsignalN());
354         }//number of TPC points for the dE/dx
355         
356         /*if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXY()) {
357           ((TH2F *)(fQAPrimaryProtonsRejectedList->At(27)))->Fill(gPt,TMath::Abs(dca[0]));
358         }
359         else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXY())
360           ((TH2F *)(fQAPrimaryProtonsAcceptedList->At(27)))->Fill(gPt,TMath::Abs(dca[0]));
361         if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZ()) {
362           ((TH2F *)(fQAPrimaryProtonsRejectedList->At(28)))->Fill(gPt,TMath::Abs(dca[1]));
363         }
364         else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZ())
365         ((TH2F *)(fQAPrimaryProtonsAcceptedList->At(28)))->Fill(gPt,TMath::Abs(dca[1]));*/
366       }//primary particle cut
367       
368       //Secondaries
369       if(label > nPrimaries) {
370         if(fProtonAnalysisBase->IsUsedMinITSClusters()) {
371           if(nClustersITS < fProtonAnalysisBase->GetMinITSClusters()) {
372             ((TH1F *)(fQASecondaryProtonsRejectedList->At(0)))->Fill(nClustersITS);
373           }
374           else if(nClustersITS >= fProtonAnalysisBase->GetMinITSClusters()) 
375             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(0)))->Fill(nClustersITS);
376         }//ITS clusters
377         if(fProtonAnalysisBase->IsUsedMaxChi2PerITSCluster()) {
378           if(chi2PerClusterITS > fProtonAnalysisBase->GetMaxChi2PerITSCluster()) {
379             ((TH1F *)(fQASecondaryProtonsRejectedList->At(1)))->Fill(chi2PerClusterITS);
380           }
381           else if(chi2PerClusterITS <= fProtonAnalysisBase->GetMaxChi2PerITSCluster())
382             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(1)))->Fill(chi2PerClusterITS);
383         }//chi2 per ITS cluster
384         if(fProtonAnalysisBase->IsUsedMinTPCClusters()) {
385           if(nClustersTPC < fProtonAnalysisBase->GetMinTPCClusters()) {
386             //cout<<"Secondary proton rejected"<<endl;
387             ((TH1F *)(fQASecondaryProtonsRejectedList->At(2)))->Fill(nClustersTPC);
388           }
389           else if(nClustersTPC >= fProtonAnalysisBase->GetMinTPCClusters()) {
390             //cout<<"Secondary proton accepted"<<endl;
391             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(2)))->Fill(nClustersTPC);
392           }
393         }//TPC clusters
394         if(fProtonAnalysisBase->IsUsedMaxChi2PerTPCCluster()) {
395           if(chi2PerClusterTPC > fProtonAnalysisBase->GetMaxChi2PerTPCCluster()) {
396             ((TH1F *)(fQASecondaryProtonsRejectedList->At(3)))->Fill(chi2PerClusterTPC);
397           }
398           else if(chi2PerClusterTPC <= fProtonAnalysisBase->GetMaxChi2PerTPCCluster())
399             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(3)))->Fill(chi2PerClusterTPC);
400         }//chi2 per TPC cluster
401         if(fProtonAnalysisBase->IsUsedMaxCov11()) {
402           if(extCov[0] > fProtonAnalysisBase->GetMaxCov11()) {
403             ((TH1F *)(fQASecondaryProtonsRejectedList->At(4)))->Fill(extCov[0]);
404           }
405           else if(extCov[0] <= fProtonAnalysisBase->GetMaxCov11())
406             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(4)))->Fill(extCov[0]);
407         }//cov11
408         if(fProtonAnalysisBase->IsUsedMaxCov22()) {
409           if(extCov[2] > fProtonAnalysisBase->GetMaxCov22()) {
410             ((TH1F *)(fQASecondaryProtonsRejectedList->At(5)))->Fill(extCov[2]);
411           }
412           else if(extCov[2] <= fProtonAnalysisBase->GetMaxCov22())
413             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(5)))->Fill(extCov[2]);
414         }//cov11
415         if(fProtonAnalysisBase->IsUsedMaxCov33()) {
416           if(extCov[5] > fProtonAnalysisBase->GetMaxCov33()) {
417             ((TH1F *)(fQASecondaryProtonsRejectedList->At(6)))->Fill(extCov[5]);
418           }
419           else if(extCov[5] <= fProtonAnalysisBase->GetMaxCov33())
420             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(6)))->Fill(extCov[5]);
421         }//cov11
422         if(fProtonAnalysisBase->IsUsedMaxCov44()) {
423           if(extCov[9] > fProtonAnalysisBase->GetMaxCov44()) {
424             ((TH1F *)(fQASecondaryProtonsRejectedList->At(7)))->Fill(extCov[9]);
425           }
426           else if(extCov[9] <= fProtonAnalysisBase->GetMaxCov44())
427             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(7)))->Fill(extCov[9]);
428         }//cov11
429         if(fProtonAnalysisBase->IsUsedMaxCov55()) {
430           if(extCov[14] > fProtonAnalysisBase->GetMaxCov55()) {
431             ((TH1F *)(fQASecondaryProtonsRejectedList->At(8)))->Fill(extCov[14]);
432           }
433           else if(extCov[14] <= fProtonAnalysisBase->GetMaxCov55())
434             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(8)))->Fill(extCov[14]);
435         }//cov55
436         if(fProtonAnalysisBase->IsUsedMaxSigmaToVertex()) {
437           if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertex()) {
438             ((TH1F *)(fQASecondaryProtonsRejectedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
439           }
440           else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertex())
441             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
442         }//sigma to vertex
443         if(fProtonAnalysisBase->IsUsedMaxSigmaToVertexTPC()) {
444           if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertexTPC()) {
445             ((TH1F *)(fQASecondaryProtonsRejectedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
446           }
447           else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertexTPC())
448             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
449         }//sigma to vertex TPC
450         if(fProtonAnalysisBase->IsUsedMaxDCAXY()) {
451           if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXY()) {
452             ((TH1F *)(fQASecondaryProtonsRejectedList->At(11)))->Fill(TMath::Abs(dca[0]));
453           }
454           else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXY())
455             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(11)))->Fill(TMath::Abs(dca[0]));
456         }//DCA xy global tracking
457         if(fProtonAnalysisBase->IsUsedMaxDCAXYTPC()) {
458           if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXYTPC()) {
459             ((TH1F *)(fQASecondaryProtonsRejectedList->At(12)))->Fill(TMath::Abs(dca[0]));
460           }
461           else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXYTPC())
462             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(12)))->Fill(TMath::Abs(dca[0]));
463         }//DCA xy TPC tracking
464         if(fProtonAnalysisBase->IsUsedMaxDCAZ()) {
465           if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZ()) {
466             ((TH1F *)(fQASecondaryProtonsRejectedList->At(13)))->Fill(TMath::Abs(dca[1]));
467           }
468           else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZ())
469             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(13)))->Fill(TMath::Abs(dca[1]));
470         }//DCA z global tracking
471         if(fProtonAnalysisBase->IsUsedMaxDCAZTPC()) {
472           if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZTPC()) {
473             ((TH1F *)(fQASecondaryProtonsRejectedList->At(14)))->Fill(TMath::Abs(dca[1]));
474           }
475           else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZTPC())
476             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(14)))->Fill(TMath::Abs(dca[1]));
477         }//DCA z TPC tracking
478         if(fProtonAnalysisBase->IsUsedMaxConstrainChi2()) {
479           if(track->GetConstrainedChi2() > 0) {
480             if(TMath::Log(track->GetConstrainedChi2()) > fProtonAnalysisBase->GetMaxConstrainChi2()) {
481               ((TH1F *)(fQASecondaryProtonsRejectedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
482             }
483             else if(TMath::Log(track->GetConstrainedChi2()) <= fProtonAnalysisBase->GetMaxConstrainChi2())
484               ((TH1F *)(fQASecondaryProtonsAcceptedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
485           }
486         }//constrain chi2 - vertex
487         if(fProtonAnalysisBase->IsUsedITSRefit()) {
488           if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) {
489             ((TH1F *)(fQASecondaryProtonsRejectedList->At(16)))->Fill(0);
490           }
491           else if((track->GetStatus() & AliESDtrack::kITSrefit) != 0)
492             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(16)))->Fill(0);
493         }//ITS refit
494         if(fProtonAnalysisBase->IsUsedTPCRefit()) {
495           if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) {
496             ((TH1F *)(fQASecondaryProtonsRejectedList->At(17)))->Fill(0);
497           }
498           else if((track->GetStatus() & AliESDtrack::kTPCrefit) != 0)
499             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(17)))->Fill(0);
500         }//TPC refit
501         if(fProtonAnalysisBase->IsUsedESDpid()) {
502           if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) {
503             ((TH1F *)(fQASecondaryProtonsRejectedList->At(18)))->Fill(0);
504           }
505           else if((track->GetStatus() & AliESDtrack::kESDpid) != 0)
506             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(18)))->Fill(0);
507         }//ESD pid
508         if(fProtonAnalysisBase->IsUsedTPCpid()) {
509           if ((track->GetStatus() & AliESDtrack::kTPCpid) == 0) {
510             ((TH1F *)(fQASecondaryProtonsRejectedList->At(19)))->Fill(0);
511           }
512           else if((track->GetStatus() & AliESDtrack::kTPCpid) != 0)
513             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(19)))->Fill(0);
514         }//TPC pid
515         if(fProtonAnalysisBase->IsUsedPointOnITSLayer1()) {
516           if(!track->HasPointOnITSLayer(0)) {
517             ((TH1F *)(fQASecondaryProtonsRejectedList->At(20)))->Fill(0);
518           }
519           else if(track->HasPointOnITSLayer(0))
520             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(20)))->Fill(0);
521         }//point on SPD1
522         if(fProtonAnalysisBase->IsUsedPointOnITSLayer2()) {
523           if(!track->HasPointOnITSLayer(1)) {
524             ((TH1F *)(fQASecondaryProtonsRejectedList->At(21)))->Fill(0);
525           }
526           else if(track->HasPointOnITSLayer(1))
527             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(21)))->Fill(0);
528         }//point on SPD2
529         if(fProtonAnalysisBase->IsUsedPointOnITSLayer3()) {
530           if(!track->HasPointOnITSLayer(2)) {
531             ((TH1F *)(fQASecondaryProtonsRejectedList->At(22)))->Fill(0);
532           }
533           else if(track->HasPointOnITSLayer(2))
534             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(22)))->Fill(0);
535         }//point on SDD1
536         if(fProtonAnalysisBase->IsUsedPointOnITSLayer4()) {
537           if(!track->HasPointOnITSLayer(3)) {
538             ((TH1F *)(fQASecondaryProtonsRejectedList->At(23)))->Fill(0);
539           }
540           else if(track->HasPointOnITSLayer(3))
541             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(23)))->Fill(0);
542         }//point on SDD2
543         if(fProtonAnalysisBase->IsUsedPointOnITSLayer5()) {
544           if(!track->HasPointOnITSLayer(4)) {
545             ((TH1F *)(fQASecondaryProtonsRejectedList->At(24)))->Fill(0);
546           }
547           else if(track->HasPointOnITSLayer(4))
548             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(24)))->Fill(0);
549         }//point on SSD1
550         if(fProtonAnalysisBase->IsUsedPointOnITSLayer6()) {
551           if(!track->HasPointOnITSLayer(5)) {
552             ((TH1F *)(fQASecondaryProtonsRejectedList->At(25)))->Fill(0);
553           }
554           else if(track->HasPointOnITSLayer(5))
555             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(25)))->Fill(0);
556         }//point on SSD2
557         if(fProtonAnalysisBase->IsUsedMinTPCdEdxPoints()) {
558           if(track->GetTPCsignalN() < fProtonAnalysisBase->GetMinTPCdEdxPoints()) {
559             ((TH1F *)(fQASecondaryProtonsRejectedList->At(26)))->Fill(track->GetTPCsignalN());
560           }
561           if(track->GetTPCsignalN() >= fProtonAnalysisBase->GetMinTPCdEdxPoints())
562             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(26)))->Fill(track->GetTPCsignalN());
563         }//number of TPC points for the dE/dx
564
565         /*if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXY()) {
566           if(gProcess == 4)
567             ((TH2F *)(fQASecondaryProtonsRejectedList->At(27)))->Fill(gPt,TMath::Abs(dca[0]));
568           if(gProcess == 13)
569             ((TH2F *)(fQASecondaryProtonsRejectedList->At(29)))->Fill(gPt,TMath::Abs(dca[0]));
570         }
571         else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXY()) {
572           if(gProcess == 4)
573             ((TH2F *)(fQASecondaryProtonsAcceptedList->At(27)))->Fill(gPt,TMath::Abs(dca[0]));
574           if(gProcess == 13)
575             ((TH2F *)(fQASecondaryProtonsAcceptedList->At(29)))->Fill(gPt,TMath::Abs(dca[0]));
576         }
577         if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZ()) {
578           if(gProcess == 4)
579             ((TH2F *)(fQASecondaryProtonsRejectedList->At(28)))->Fill(gPt,TMath::Abs(dca[1]));
580           if(gProcess == 13)
581             ((TH2F *)(fQASecondaryProtonsRejectedList->At(30)))->Fill(gPt,TMath::Abs(dca[1]));
582         }
583         else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZ()) {
584           if(gProcess == 4)
585             ((TH2F *)(fQASecondaryProtonsAcceptedList->At(28)))->Fill(gPt,TMath::Abs(dca[1]));
586           if(gProcess == 13)
587             ((TH2F *)(fQASecondaryProtonsAcceptedList->At(30)))->Fill(gPt,TMath::Abs(dca[1]));
588             }*/
589       }//secondary particle cut
590     }//protons
591     
592     //antiprotons
593     if(track->Charge() < 0) {
594       //Primaries
595       if(label <= nPrimaries) {
596         if(fProtonAnalysisBase->IsUsedMinITSClusters()) {
597         if(nClustersITS < fProtonAnalysisBase->GetMinITSClusters()) {
598           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(0)))->Fill(nClustersITS);
599         }
600         else if(nClustersITS >= fProtonAnalysisBase->GetMinITSClusters()) 
601           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(0)))->Fill(nClustersITS);
602       }//ITS clusters
603       if(fProtonAnalysisBase->IsUsedMaxChi2PerITSCluster()) {
604         if(chi2PerClusterITS > fProtonAnalysisBase->GetMaxChi2PerITSCluster()) {
605           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(1)))->Fill(chi2PerClusterITS);
606         }
607         else if(chi2PerClusterITS <= fProtonAnalysisBase->GetMaxChi2PerITSCluster())
608           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(1)))->Fill(chi2PerClusterITS);
609       }//chi2 per ITS cluster
610       if(fProtonAnalysisBase->IsUsedMinTPCClusters()) {
611         if(nClustersTPC < fProtonAnalysisBase->GetMinTPCClusters()) {
612           //cout<<"Primary antiproton rejected"<<endl;
613           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(2)))->Fill(nClustersTPC);
614         }
615         else if(nClustersTPC >= fProtonAnalysisBase->GetMinTPCClusters()) {
616           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(2)))->Fill(nClustersTPC);
617         }
618       }//TPC clusters
619       if(fProtonAnalysisBase->IsUsedMaxChi2PerTPCCluster()) {
620         if(chi2PerClusterTPC > fProtonAnalysisBase->GetMaxChi2PerTPCCluster()) {
621           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(3)))->Fill(chi2PerClusterTPC);
622         }
623         else if(chi2PerClusterTPC <= fProtonAnalysisBase->GetMaxChi2PerTPCCluster())
624           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(3)))->Fill(chi2PerClusterTPC);
625       }//chi2 per TPC cluster
626       if(fProtonAnalysisBase->IsUsedMaxCov11()) {
627         if(extCov[0] > fProtonAnalysisBase->GetMaxCov11()) {
628           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(4)))->Fill(extCov[0]);
629         }
630         else if(extCov[0] <= fProtonAnalysisBase->GetMaxCov11())
631           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(4)))->Fill(extCov[0]);
632       }//cov11
633       if(fProtonAnalysisBase->IsUsedMaxCov22()) {
634         if(extCov[2] > fProtonAnalysisBase->GetMaxCov22()) {
635           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(5)))->Fill(extCov[2]);
636         }
637         else if(extCov[2] <= fProtonAnalysisBase->GetMaxCov22())
638           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(5)))->Fill(extCov[2]);
639       }//cov11
640       if(fProtonAnalysisBase->IsUsedMaxCov33()) {
641         if(extCov[5] > fProtonAnalysisBase->GetMaxCov33()) {
642           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(6)))->Fill(extCov[5]);
643         }
644         else if(extCov[5] <= fProtonAnalysisBase->GetMaxCov33())
645           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(6)))->Fill(extCov[5]);
646       }//cov11
647       if(fProtonAnalysisBase->IsUsedMaxCov44()) {
648         if(extCov[9] > fProtonAnalysisBase->GetMaxCov44()) {
649           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(7)))->Fill(extCov[9]);
650         }
651         else if(extCov[9] <= fProtonAnalysisBase->GetMaxCov44())
652           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(7)))->Fill(extCov[9]);
653       }//cov11
654       if(fProtonAnalysisBase->IsUsedMaxCov55()) {
655         if(extCov[14] > fProtonAnalysisBase->GetMaxCov55()) {
656           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(8)))->Fill(extCov[14]);
657         }
658         else if(extCov[14] <= fProtonAnalysisBase->GetMaxCov55())
659           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(8)))->Fill(extCov[14]);
660       }//cov55
661       if(fProtonAnalysisBase->IsUsedMaxSigmaToVertex()) {
662         if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertex()) {
663           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
664         }
665         else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertex())
666           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
667       }//sigma to vertex
668       if(fProtonAnalysisBase->IsUsedMaxSigmaToVertexTPC()) {
669         if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertexTPC()) {
670           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
671         }
672         else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertexTPC())
673           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
674       }//sigma to vertex TPC
675       if(fProtonAnalysisBase->IsUsedMaxDCAXY()) {
676         if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXY()) {
677           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(11)))->Fill(TMath::Abs(dca[0]));
678         }
679         else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXY())
680           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(11)))->Fill(TMath::Abs(dca[0]));
681       }//DCA xy global tracking
682       if(fProtonAnalysisBase->IsUsedMaxDCAXYTPC()) {
683         if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXYTPC()) {
684           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(12)))->Fill(TMath::Abs(dca[0]));
685         }
686         else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXYTPC())
687           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(12)))->Fill(TMath::Abs(dca[0]));
688       }//DCA xy TPC tracking
689       if(fProtonAnalysisBase->IsUsedMaxDCAZ()) {
690         if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZ()) {
691           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(13)))->Fill(TMath::Abs(dca[1]));
692         }
693         else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZ())
694           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(13)))->Fill(TMath::Abs(dca[1]));
695       }//DCA z global tracking
696       if(fProtonAnalysisBase->IsUsedMaxDCAZTPC()) {
697         if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZTPC()) {
698           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(14)))->Fill(TMath::Abs(dca[1]));
699         }
700         else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZTPC())
701           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(14)))->Fill(TMath::Abs(dca[1]));
702       }//DCA z TPC tracking
703       if(fProtonAnalysisBase->IsUsedMaxConstrainChi2()) {
704         if(track->GetConstrainedChi2() > 0) {
705           if(TMath::Log(track->GetConstrainedChi2()) > fProtonAnalysisBase->GetMaxConstrainChi2()) {
706             ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
707           }
708           else if(TMath::Log(track->GetConstrainedChi2()) <= fProtonAnalysisBase->GetMaxConstrainChi2())
709             ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
710         }
711       }//constrain chi2 - vertex
712       if(fProtonAnalysisBase->IsUsedITSRefit()) {
713         if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) {
714           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(16)))->Fill(0);
715         }
716         else if((track->GetStatus() & AliESDtrack::kITSrefit) != 0)
717           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(16)))->Fill(0);
718       }//ITS refit
719       if(fProtonAnalysisBase->IsUsedTPCRefit()) {
720         if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) {
721           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(17)))->Fill(0);
722         }
723         else if((track->GetStatus() & AliESDtrack::kTPCrefit) != 0)
724           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(17)))->Fill(0);
725       }//TPC refit
726       if(fProtonAnalysisBase->IsUsedESDpid()) {
727         if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) {
728           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(18)))->Fill(0);
729         }
730         else if((track->GetStatus() & AliESDtrack::kESDpid) != 0)
731           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(18)))->Fill(0);
732       }//ESD pid
733       if(fProtonAnalysisBase->IsUsedTPCpid()) {
734         if ((track->GetStatus() & AliESDtrack::kTPCpid) == 0) {
735           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(19)))->Fill(0);
736         }
737         else if((track->GetStatus() & AliESDtrack::kTPCpid) != 0)
738           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(19)))->Fill(0);
739       }//TPC pid
740       if(fProtonAnalysisBase->IsUsedPointOnITSLayer1()) {
741         if(!track->HasPointOnITSLayer(0)) {
742           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(20)))->Fill(0);
743         }
744         else if(track->HasPointOnITSLayer(0))
745           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(20)))->Fill(0);
746       }//point on SPD1
747       if(fProtonAnalysisBase->IsUsedPointOnITSLayer2()) {
748         if(!track->HasPointOnITSLayer(1)) {
749           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(21)))->Fill(0);
750         }
751         else if(track->HasPointOnITSLayer(1))
752           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(21)))->Fill(0);
753       }//point on SPD2
754       if(fProtonAnalysisBase->IsUsedPointOnITSLayer3()) {
755         if(!track->HasPointOnITSLayer(2)) {
756           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(22)))->Fill(0);
757         }
758         else if(track->HasPointOnITSLayer(2))
759           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(22)))->Fill(0);
760       }//point on SDD1
761       if(fProtonAnalysisBase->IsUsedPointOnITSLayer4()) {
762         if(!track->HasPointOnITSLayer(3)) {
763           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(23)))->Fill(0);
764         }
765         else if(track->HasPointOnITSLayer(3))
766           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(23)))->Fill(0);
767       }//point on SDD2
768       if(fProtonAnalysisBase->IsUsedPointOnITSLayer5()) {
769         if(!track->HasPointOnITSLayer(4)) {
770           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(24)))->Fill(0);
771         }
772         else if(track->HasPointOnITSLayer(4))
773           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(24)))->Fill(0);
774       }//point on SSD1
775       if(fProtonAnalysisBase->IsUsedPointOnITSLayer6()) {
776         if(!track->HasPointOnITSLayer(5)) {
777           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(25)))->Fill(0);
778         }
779         else if(track->HasPointOnITSLayer(5))
780           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(25)))->Fill(0);
781       }//point on SSD2
782       if(fProtonAnalysisBase->IsUsedMinTPCdEdxPoints()) {
783         if(track->GetTPCsignalN() < fProtonAnalysisBase->GetMinTPCdEdxPoints()) {
784           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(26)))->Fill(track->GetTPCsignalN());
785         }
786         if(track->GetTPCsignalN() >= fProtonAnalysisBase->GetMinTPCdEdxPoints())
787           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(26)))->Fill(track->GetTPCsignalN());
788       }//number of TPC points for the dE/dx
789
790       /*if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXY()) {
791         ((TH2F *)(fQAPrimaryAntiProtonsRejectedList->At(27)))->Fill(gPt,TMath::Abs(dca[0]));
792       }
793       else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXY())
794         ((TH2F *)(fQAPrimaryAntiProtonsAcceptedList->At(27)))->Fill(gPt,TMath::Abs(dca[0]));
795       if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZ()) {
796         ((TH2F *)(fQAPrimaryAntiProtonsRejectedList->At(28)))->Fill(gPt,TMath::Abs(dca[1]));
797       }
798       else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZ())
799       ((TH2F *)(fQAPrimaryAntiProtonsAcceptedList->At(28)))->Fill(gPt,TMath::Abs(dca[1]));*/
800     }//primary particle cut
801
802     //Secondaries
803     if(label > nPrimaries) {
804       if(fProtonAnalysisBase->IsUsedMinITSClusters()) {
805         if(nClustersITS < fProtonAnalysisBase->GetMinITSClusters()) {
806           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(0)))->Fill(nClustersITS);
807         }
808         else if(nClustersITS >= fProtonAnalysisBase->GetMinITSClusters()) 
809           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(0)))->Fill(nClustersITS);
810       }//ITS clusters
811       if(fProtonAnalysisBase->IsUsedMaxChi2PerITSCluster()) {
812         if(chi2PerClusterITS > fProtonAnalysisBase->GetMaxChi2PerITSCluster()) {
813           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(1)))->Fill(chi2PerClusterITS);
814         }
815         else if(chi2PerClusterITS <= fProtonAnalysisBase->GetMaxChi2PerITSCluster())
816           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(1)))->Fill(chi2PerClusterITS);
817       }//chi2 per ITS cluster
818       if(fProtonAnalysisBase->IsUsedMinTPCClusters()) {
819         if(nClustersTPC < fProtonAnalysisBase->GetMinTPCClusters()) {
820           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(2)))->Fill(nClustersTPC);
821         }
822         else if(nClustersTPC >= fProtonAnalysisBase->GetMinTPCClusters()) {
823           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(2)))->Fill(nClustersTPC);
824         }
825       }//TPC clusters
826       if(fProtonAnalysisBase->IsUsedMaxChi2PerTPCCluster()) {
827         if(chi2PerClusterTPC > fProtonAnalysisBase->GetMaxChi2PerTPCCluster()) {
828           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(3)))->Fill(chi2PerClusterTPC);
829         }
830         else if(chi2PerClusterTPC <= fProtonAnalysisBase->GetMaxChi2PerTPCCluster())
831           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(3)))->Fill(chi2PerClusterTPC);
832       }//chi2 per TPC cluster
833       if(fProtonAnalysisBase->IsUsedMaxCov11()) {
834         if(extCov[0] > fProtonAnalysisBase->GetMaxCov11()) {
835           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(4)))->Fill(extCov[0]);
836         }
837         else if(extCov[0] <= fProtonAnalysisBase->GetMaxCov11())
838           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(4)))->Fill(extCov[0]);
839       }//cov11
840       if(fProtonAnalysisBase->IsUsedMaxCov22()) {
841         if(extCov[2] > fProtonAnalysisBase->GetMaxCov22()) {
842           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(5)))->Fill(extCov[2]);
843         }
844         else if(extCov[2] <= fProtonAnalysisBase->GetMaxCov22())
845           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(5)))->Fill(extCov[2]);
846       }//cov11
847       if(fProtonAnalysisBase->IsUsedMaxCov33()) {
848         if(extCov[5] > fProtonAnalysisBase->GetMaxCov33()) {
849           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(6)))->Fill(extCov[5]);
850         }
851         else if(extCov[5] <= fProtonAnalysisBase->GetMaxCov33())
852           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(6)))->Fill(extCov[5]);
853       }//cov11
854       if(fProtonAnalysisBase->IsUsedMaxCov44()) {
855         if(extCov[9] > fProtonAnalysisBase->GetMaxCov44()) {
856           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(7)))->Fill(extCov[9]);
857         }
858         else if(extCov[9] <= fProtonAnalysisBase->GetMaxCov44())
859           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(7)))->Fill(extCov[9]);
860       }//cov11
861       if(fProtonAnalysisBase->IsUsedMaxCov55()) {
862         if(extCov[14] > fProtonAnalysisBase->GetMaxCov55()) {
863           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(8)))->Fill(extCov[14]);
864         }
865         else if(extCov[14] <= fProtonAnalysisBase->GetMaxCov55())
866           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(8)))->Fill(extCov[14]);
867       }//cov55
868       if(fProtonAnalysisBase->IsUsedMaxSigmaToVertex()) {
869         if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertex()) {
870           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
871         }
872         else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertex())
873           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(9)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
874       }//sigma to vertex
875       if(fProtonAnalysisBase->IsUsedMaxSigmaToVertexTPC()) {
876         if(fProtonAnalysisBase->GetSigmaToVertex(track) > fProtonAnalysisBase->GetMaxSigmaToVertexTPC()) {
877           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
878         }
879         else if(fProtonAnalysisBase->GetSigmaToVertex(track) <= fProtonAnalysisBase->GetMaxSigmaToVertexTPC())
880           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(10)))->Fill(fProtonAnalysisBase->GetSigmaToVertex(track));
881       }//sigma to vertex TPC
882       if(fProtonAnalysisBase->IsUsedMaxDCAXY()) {
883         if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXY()) {
884           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(11)))->Fill(TMath::Abs(dca[0]));
885         }
886         else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXY())
887           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(11)))->Fill(TMath::Abs(dca[0]));
888       }//DCA xy global tracking
889       if(fProtonAnalysisBase->IsUsedMaxDCAXYTPC()) {
890         if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXYTPC()) {
891           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(12)))->Fill(TMath::Abs(dca[0]));
892         }
893         else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXYTPC())
894           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(12)))->Fill(TMath::Abs(dca[0]));
895       }//DCA xy TPC tracking
896       if(fProtonAnalysisBase->IsUsedMaxDCAZ()) {
897         if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZ()) {
898           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(13)))->Fill(TMath::Abs(dca[1]));
899         }
900         else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZ())
901           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(13)))->Fill(TMath::Abs(dca[1]));
902       }//DCA z global tracking
903       if(fProtonAnalysisBase->IsUsedMaxDCAZTPC()) {
904         if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZTPC()) {
905           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(14)))->Fill(TMath::Abs(dca[1]));
906         }
907         else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZTPC())
908           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(14)))->Fill(TMath::Abs(dca[1]));
909       }//DCA z TPC tracking
910       if(fProtonAnalysisBase->IsUsedMaxConstrainChi2()) {
911         if(track->GetConstrainedChi2() > 0) {
912           if(TMath::Log(track->GetConstrainedChi2()) > fProtonAnalysisBase->GetMaxConstrainChi2()) {
913             ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
914           }
915           else if(TMath::Log(track->GetConstrainedChi2()) <= fProtonAnalysisBase->GetMaxConstrainChi2())
916             ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
917         }
918       }//constrain chi2 - vertex
919       if(fProtonAnalysisBase->IsUsedITSRefit()) {
920         if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) {
921           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(16)))->Fill(0);
922         }
923         else if((track->GetStatus() & AliESDtrack::kITSrefit) != 0)
924           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(16)))->Fill(0);
925       }//ITS refit
926       if(fProtonAnalysisBase->IsUsedTPCRefit()) {
927         if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) {
928           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(17)))->Fill(0);
929         }
930         else if((track->GetStatus() & AliESDtrack::kTPCrefit) != 0)
931           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(17)))->Fill(0);
932       }//TPC refit
933       if(fProtonAnalysisBase->IsUsedESDpid()) {
934         if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) {
935           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(18)))->Fill(0);
936         }
937         else if((track->GetStatus() & AliESDtrack::kESDpid) != 0)
938           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(18)))->Fill(0);
939       }//ESD pid
940       if(fProtonAnalysisBase->IsUsedTPCpid()) {
941         if ((track->GetStatus() & AliESDtrack::kTPCpid) == 0) {
942           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(19)))->Fill(0);
943         }
944         else if((track->GetStatus() & AliESDtrack::kTPCpid) != 0)
945           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(19)))->Fill(0);
946       }//TPC pid
947       if(fProtonAnalysisBase->IsUsedPointOnITSLayer1()) {
948         if(!track->HasPointOnITSLayer(0)) {
949           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(20)))->Fill(0);
950         }
951         else if(track->HasPointOnITSLayer(0))
952           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(20)))->Fill(0);
953       }//point on SPD1
954       if(fProtonAnalysisBase->IsUsedPointOnITSLayer2()) {
955         if(!track->HasPointOnITSLayer(1)) {
956           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(21)))->Fill(0);
957         }
958         else if(track->HasPointOnITSLayer(1))
959           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(21)))->Fill(0);
960       }//point on SPD2
961       if(fProtonAnalysisBase->IsUsedPointOnITSLayer3()) {
962         if(!track->HasPointOnITSLayer(2)) {
963           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(22)))->Fill(0);
964         }
965         else if(track->HasPointOnITSLayer(2))
966           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(22)))->Fill(0);
967       }//point on SDD1
968       if(fProtonAnalysisBase->IsUsedPointOnITSLayer4()) {
969         if(!track->HasPointOnITSLayer(3)) {
970           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(23)))->Fill(0);
971         }
972         else if(track->HasPointOnITSLayer(3))
973           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(23)))->Fill(0);
974       }//point on SDD2
975       if(fProtonAnalysisBase->IsUsedPointOnITSLayer5()) {
976         if(!track->HasPointOnITSLayer(4)) {
977           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(24)))->Fill(0);
978         }
979         else if(track->HasPointOnITSLayer(4))
980           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(24)))->Fill(0);
981       }//point on SSD1
982       if(fProtonAnalysisBase->IsUsedPointOnITSLayer6()) {
983         if(!track->HasPointOnITSLayer(5)) {
984           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(25)))->Fill(0);
985         }
986         else if(track->HasPointOnITSLayer(5))
987           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(25)))->Fill(0);
988       }//point on SSD2
989       if(fProtonAnalysisBase->IsUsedMinTPCdEdxPoints()) {
990         if(track->GetTPCsignalN() < fProtonAnalysisBase->GetMinTPCdEdxPoints()) {
991           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(26)))->Fill(track->GetTPCsignalN());
992         }
993         if(track->GetTPCsignalN() >= fProtonAnalysisBase->GetMinTPCdEdxPoints())
994           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(26)))->Fill(track->GetTPCsignalN());
995       }//number of TPC points for the dE/dx
996
997       /*if(TMath::Abs(dca[0]) > fProtonAnalysisBase->GetMaxDCAXY()) {
998         if(gProcess == 4)
999           ((TH2F *)(fQASecondaryAntiProtonsRejectedList->At(27)))->Fill(gPt,TMath::Abs(dca[0]));
1000         if(gProcess == 13)
1001           ((TH2F *)(fQASecondaryAntiProtonsRejectedList->At(29)))->Fill(gPt,TMath::Abs(dca[0]));
1002       }
1003       else if(TMath::Abs(dca[0]) <= fProtonAnalysisBase->GetMaxDCAXY()) {
1004         if(gProcess == 4)
1005           ((TH2F *)(fQASecondaryAntiProtonsAcceptedList->At(27)))->Fill(gPt,TMath::Abs(dca[0]));
1006         if(gProcess == 13)
1007           ((TH2F *)(fQASecondaryAntiProtonsAcceptedList->At(29)))->Fill(gPt,TMath::Abs(dca[0]));
1008       }
1009       if(TMath::Abs(dca[1]) > fProtonAnalysisBase->GetMaxDCAZ()) {
1010         if(gProcess == 4)
1011           ((TH2F *)(fQASecondaryAntiProtonsRejectedList->At(28)))->Fill(gPt,TMath::Abs(dca[1]));
1012         if(gProcess == 13)
1013           ((TH2F *)(fQASecondaryAntiProtonsRejectedList->At(30)))->Fill(gPt,TMath::Abs(dca[1]));
1014       }
1015       else if(TMath::Abs(dca[1]) <= fProtonAnalysisBase->GetMaxDCAZ()) {
1016         if(gProcess == 4)
1017           ((TH2F *)(fQASecondaryAntiProtonsAcceptedList->At(28)))->Fill(gPt,TMath::Abs(dca[1]));
1018         if(gProcess == 13)
1019           ((TH2F *)(fQASecondaryAntiProtonsAcceptedList->At(30)))->Fill(gPt,TMath::Abs(dca[1]));
1020           }*/
1021     }//secondary particle cut
1022   }//antiprotons
1023     //}//if TParticle
1024 }
1025
1026 //____________________________________________________________________//
1027 void AliProtonQAAnalysis::SetRunQAAnalysis() {
1028   //initializes the QA lists
1029   //fQAHistograms = kTRUE;
1030   fGlobalQAList = new TList();
1031
1032   fQA2DList = new TList();
1033   fQA2DList->SetName("fQA2DList");
1034   fGlobalQAList->Add(fQA2DList);
1035   
1036   fQAPrimaryProtonsAcceptedList = new TList();
1037   fQAPrimaryProtonsAcceptedList->SetName("fQAPrimaryProtonsAcceptedList");
1038   fGlobalQAList->Add(fQAPrimaryProtonsAcceptedList);
1039   
1040   fQAPrimaryProtonsRejectedList = new TList();
1041   fQAPrimaryProtonsRejectedList->SetName("fQAPrimaryProtonsRejectedList");
1042   fGlobalQAList->Add(fQAPrimaryProtonsRejectedList);
1043   
1044   fQASecondaryProtonsAcceptedList = new TList();
1045   fQASecondaryProtonsAcceptedList->SetName("fQASecondaryProtonsAcceptedList");
1046   fGlobalQAList->Add(fQASecondaryProtonsAcceptedList);
1047   
1048   fQASecondaryProtonsRejectedList = new TList();
1049   fQASecondaryProtonsRejectedList->SetName("fQASecondaryProtonsRejectedList");
1050   fGlobalQAList->Add(fQASecondaryProtonsRejectedList);
1051   
1052   fQAPrimaryAntiProtonsAcceptedList = new TList();
1053   fQAPrimaryAntiProtonsAcceptedList->SetName("fQAPrimaryAntiProtonsAcceptedList");
1054   fGlobalQAList->Add(fQAPrimaryAntiProtonsAcceptedList);
1055   
1056   fQAPrimaryAntiProtonsRejectedList = new TList();
1057   fQAPrimaryAntiProtonsRejectedList->SetName("fQAPrimaryAntiProtonsRejectedList");
1058   fGlobalQAList->Add(fQAPrimaryAntiProtonsRejectedList);
1059   
1060   fQASecondaryAntiProtonsAcceptedList = new TList();
1061   fQASecondaryAntiProtonsAcceptedList->SetName("fQASecondaryAntiProtonsAcceptedList");
1062   fGlobalQAList->Add(fQASecondaryAntiProtonsAcceptedList);
1063   
1064   fQASecondaryAntiProtonsRejectedList = new TList();
1065   fQASecondaryAntiProtonsRejectedList->SetName("fQASecondaryAntiProtonsRejectedList");
1066   fGlobalQAList->Add(fQASecondaryAntiProtonsRejectedList);
1067 }
1068
1069 //____________________________________________________________________//
1070 void AliProtonQAAnalysis::SetQAYPtBins(Int_t nbinsY, 
1071                                        Double_t minY, Double_t maxY,
1072                                        Int_t nbinsPt, 
1073                                        Double_t minPt, Double_t maxPt) {
1074   //Initializes the QA binning
1075   fNBinsY = nbinsY;
1076   fMinY = minY; fMaxY = maxY;
1077   fNBinsPt = nbinsPt;
1078   fMinPt = minPt; fMaxPt = maxPt;
1079   InitQA();
1080   InitCutLists();
1081   InitVertexQA();
1082   if(fRunMCAnalysis) InitMCAnalysis();
1083   if(fRunEfficiencyAnalysis) InitEfficiencyAnalysis();
1084 }
1085
1086 //____________________________________________________________________//
1087 void AliProtonQAAnalysis::SetQAYPtBins(Int_t nbinsY, Double_t *gY,
1088                                        Int_t nbinsPt, Double_t *gPt) {
1089   //Initializes the QA binning - asymmetric binning case
1090   fUseAsymmetricBinning = kTRUE;
1091   fNBinsY = nbinsY;
1092   for(Int_t i = 0; i < nbinsY; i++) fY[i] = gY[i];
1093   fMinY = gY[0]; fMaxY = gY[nbinsPt];
1094   fNBinsPt = nbinsPt;
1095   for(Int_t i = 0; i < nbinsPt; i++) fPt[i] = gPt[i];
1096   fMinPt = gPt[0]; fMaxPt = gPt[nbinsPt];
1097   InitQA();
1098   InitCutLists();
1099   InitVertexQA();
1100   if(fRunMCAnalysis) InitMCAnalysis();
1101   if(fRunEfficiencyAnalysis) InitEfficiencyAnalysis();
1102 }
1103
1104 //____________________________________________________________________//
1105 void AliProtonQAAnalysis::InitEfficiencyAnalysis() {
1106   //Initialization of the efficiency list - reconstruction & PID & cut 
1107   //efficiency
1108   //Adding each monitored object in the list
1109   fEfficiencyList = new TList();
1110
1111   //MC primary protons and antiprotons for the reconstruction efficiency
1112   TH2D *gHistMCYPtProtons = 0x0;
1113   if(fUseAsymmetricBinning)
1114     gHistMCYPtProtons = new TH2D("gHistMCYPtProtons",
1115                                  ";;P_{T} [GeV/c]",
1116                                  fNBinsY,fY,fNBinsPt,fPt);
1117   else
1118     gHistMCYPtProtons = new TH2D("gHistMCYPtProtons",
1119                                  ";;P_{T} [GeV/c]",
1120                                  fNBinsY,fMinY,fMaxY,
1121                                  fNBinsPt,fMinPt,fMaxPt);
1122   if(fProtonAnalysisBase->GetEtaMode()) 
1123     gHistMCYPtProtons->GetXaxis()->SetTitle("#eta");
1124   else 
1125     gHistMCYPtProtons->GetXaxis()->SetTitle("y");
1126   gHistMCYPtProtons->SetStats(kTRUE);
1127   gHistMCYPtProtons->GetXaxis()->SetTitleColor(1);
1128   fEfficiencyList->Add(gHistMCYPtProtons);
1129   TH2D *gHistMCYPtAntiProtons = 0x0;
1130   if(fUseAsymmetricBinning)
1131     gHistMCYPtAntiProtons = new TH2D("gHistMCYPtAntiProtons",
1132                                      ";;P_{T} [GeV/c]",
1133                                      fNBinsY,fY,fNBinsPt,fPt);
1134   else
1135     gHistMCYPtAntiProtons = new TH2D("gHistMCYPtAntiProtons",
1136                                      ";y;P_{T} [GeV/c]",
1137                                      fNBinsY,fMinY,fMaxY,
1138                                      fNBinsPt,fMinPt,fMaxPt);
1139   if(fProtonAnalysisBase->GetEtaMode()) 
1140     gHistMCYPtAntiProtons->GetXaxis()->SetTitle("#eta");
1141   else 
1142     gHistMCYPtAntiProtons->GetXaxis()->SetTitle("y");
1143   gHistMCYPtAntiProtons->SetStats(kTRUE);
1144   gHistMCYPtAntiProtons->GetXaxis()->SetTitleColor(1);
1145   fEfficiencyList->Add(gHistMCYPtAntiProtons);
1146
1147   //MC secondary protons and antiprotons that come from weak decay for the reconstruction efficiency
1148   TH2D *gHistMCYPtProtonsFromWeak = 0x0;
1149   if(fUseAsymmetricBinning)
1150     gHistMCYPtProtonsFromWeak = new TH2D("gHistMCYPtProtonsFromWeak",
1151                                          ";;P_{T} [GeV/c]",
1152                                          fNBinsY,fY,fNBinsPt,fPt);
1153   else
1154     gHistMCYPtProtonsFromWeak = new TH2D("gHistMCYPtProtonsFromWeak",
1155                                          ";;P_{T} [GeV/c]",
1156                                          fNBinsY,fMinY,fMaxY,
1157                                          fNBinsPt,fMinPt,fMaxPt);
1158   if(fProtonAnalysisBase->GetEtaMode()) 
1159     gHistMCYPtProtonsFromWeak->GetXaxis()->SetTitle("#eta");
1160   else 
1161     gHistMCYPtProtonsFromWeak->GetXaxis()->SetTitle("y");
1162   gHistMCYPtProtonsFromWeak->SetStats(kTRUE);
1163   gHistMCYPtProtonsFromWeak->GetXaxis()->SetTitleColor(1);
1164   fEfficiencyList->Add(gHistMCYPtProtonsFromWeak);
1165   TH2D *gHistMCYPtAntiProtonsFromWeak = 0x0;
1166   if(fUseAsymmetricBinning)
1167     gHistMCYPtAntiProtonsFromWeak = new TH2D("gHistMCYPtAntiProtonsFromWeak",
1168                                              ";;P_{T} [GeV/c]",
1169                                              fNBinsY,fY,fNBinsPt,fPt);
1170   else
1171     gHistMCYPtAntiProtonsFromWeak = new TH2D("gHistMCYPtAntiProtonsFromWeak",
1172                                              ";y;P_{T} [GeV/c]",
1173                                              fNBinsY,fMinY,fMaxY,
1174                                              fNBinsPt,fMinPt,fMaxPt);
1175   if(fProtonAnalysisBase->GetEtaMode()) 
1176     gHistMCYPtAntiProtonsFromWeak->GetXaxis()->SetTitle("#eta");
1177   else 
1178     gHistMCYPtAntiProtonsFromWeak->GetXaxis()->SetTitle("y");
1179   gHistMCYPtAntiProtonsFromWeak->SetStats(kTRUE);
1180   gHistMCYPtAntiProtonsFromWeak->GetXaxis()->SetTitleColor(1);
1181   fEfficiencyList->Add(gHistMCYPtAntiProtonsFromWeak);
1182
1183   //MC secondary protons and antiprotons that come from hadronic interactions for the reconstruction efficiency
1184   TH2D *gHistMCYPtProtonsFromHadronic = 0x0;
1185   if(fUseAsymmetricBinning)
1186     gHistMCYPtProtonsFromHadronic = new TH2D("gHistMCYPtProtonsFromHadronic",
1187                                              ";;P_{T} [GeV/c]",
1188                                              fNBinsY,fY,fNBinsPt,fPt);
1189   else
1190     gHistMCYPtProtonsFromHadronic = new TH2D("gHistMCYPtProtonsFromHadronic",
1191                                              ";;P_{T} [GeV/c]",
1192                                              fNBinsY,fMinY,fMaxY,
1193                                              fNBinsPt,fMinPt,fMaxPt);
1194   if(fProtonAnalysisBase->GetEtaMode()) 
1195     gHistMCYPtProtonsFromHadronic->GetXaxis()->SetTitle("#eta");
1196   else 
1197     gHistMCYPtProtonsFromHadronic->GetXaxis()->SetTitle("y");
1198   gHistMCYPtProtonsFromHadronic->SetStats(kTRUE);
1199   gHistMCYPtProtonsFromHadronic->GetXaxis()->SetTitleColor(1);
1200   fEfficiencyList->Add(gHistMCYPtProtonsFromHadronic);
1201   TH2D *gHistMCYPtAntiProtonsFromHadronic = 0x0;
1202   if(fUseAsymmetricBinning)
1203   gHistMCYPtAntiProtonsFromHadronic = new TH2D("gHistMCYPtAntiProtonsFromHadronic",
1204                                                ";;P_{T} [GeV/c]",
1205                                                fNBinsY,fY,fNBinsPt,fPt);
1206   else
1207     gHistMCYPtAntiProtonsFromHadronic = new TH2D("gHistMCYPtAntiProtonsFromHadronic",
1208                                                  ";y;P_{T} [GeV/c]",
1209                                                  fNBinsY,fMinY,fMaxY,
1210                                                  fNBinsPt,fMinPt,fMaxPt);
1211   if(fProtonAnalysisBase->GetEtaMode()) 
1212     gHistMCYPtAntiProtonsFromHadronic->GetXaxis()->SetTitle("#eta");
1213   else 
1214     gHistMCYPtAntiProtonsFromHadronic->GetXaxis()->SetTitle("y");
1215   gHistMCYPtAntiProtonsFromHadronic->SetStats(kTRUE);
1216   gHistMCYPtAntiProtonsFromHadronic->GetXaxis()->SetTitleColor(1);
1217   fEfficiencyList->Add(gHistMCYPtAntiProtonsFromHadronic);
1218   
1219   //ESD primary protons and antiprotons for the reconstruction efficiency
1220   TH2D *gHistESDYPtProtons = 0x0;
1221   if(fUseAsymmetricBinning)
1222     gHistESDYPtProtons = new TH2D("gHistESDYPtProtons",
1223                                   ";;P_{T} [GeV/c]",
1224                                   fNBinsY,fY,fNBinsPt,fPt);
1225   else
1226     gHistESDYPtProtons = new TH2D("gHistESDYPtProtons",
1227                                   ";;P_{T} [GeV/c]",
1228                                   fNBinsY,fMinY,fMaxY,
1229                                   fNBinsPt,fMinPt,fMaxPt);
1230   if(fProtonAnalysisBase->GetEtaMode()) 
1231     gHistESDYPtProtons->GetXaxis()->SetTitle("#eta");
1232   else 
1233     gHistESDYPtProtons->GetXaxis()->SetTitle("y");
1234   gHistESDYPtProtons->SetStats(kTRUE);
1235   gHistESDYPtProtons->GetXaxis()->SetTitleColor(1);
1236   fEfficiencyList->Add(gHistESDYPtProtons);
1237   TH2D *gHistESDYPtAntiProtons = 0x0;
1238   if(fUseAsymmetricBinning)
1239     gHistESDYPtAntiProtons = new TH2D("gHistESDYPtAntiProtons",
1240                                       ";;P_{T} [GeV/c]",
1241                                       fNBinsY,fY,fNBinsPt,fPt);
1242   else
1243     gHistESDYPtAntiProtons = new TH2D("gHistESDYPtAntiProtons",
1244                                       ";;P_{T} [GeV/c]",
1245                                       fNBinsY,fMinY,fMaxY,
1246                                       fNBinsPt,fMinPt,fMaxPt);
1247   if(fProtonAnalysisBase->GetEtaMode()) 
1248     gHistESDYPtAntiProtons->GetXaxis()->SetTitle("#eta");
1249   else 
1250     gHistESDYPtAntiProtons->GetXaxis()->SetTitle("y");
1251   gHistESDYPtAntiProtons->SetStats(kTRUE);
1252   gHistESDYPtAntiProtons->GetXaxis()->SetTitleColor(1);
1253   fEfficiencyList->Add(gHistESDYPtAntiProtons);
1254
1255   //ESD (anti)protons from weak decays for the reconstruction efficiency
1256   TH2D *gHistESDYPtProtonsFromWeak = 0x0;
1257   if(fUseAsymmetricBinning)
1258   gHistESDYPtProtonsFromWeak = new TH2D("gHistESDYPtProtonsFromWeak",
1259                                         ";;P_{T} [GeV/c]",
1260                                         fNBinsY,fY,fNBinsPt,fPt);
1261   else
1262     gHistESDYPtProtonsFromWeak = new TH2D("gHistESDYPtProtonsFromWeak",
1263                                           ";;P_{T} [GeV/c]",
1264                                           fNBinsY,fMinY,fMaxY,
1265                                           fNBinsPt,fMinPt,fMaxPt);
1266   if(fProtonAnalysisBase->GetEtaMode()) 
1267     gHistESDYPtProtonsFromWeak->GetXaxis()->SetTitle("#eta");
1268   else 
1269     gHistESDYPtProtonsFromWeak->GetXaxis()->SetTitle("y");
1270   gHistESDYPtProtonsFromWeak->SetStats(kTRUE);
1271   gHistESDYPtProtonsFromWeak->GetXaxis()->SetTitleColor(1);
1272   fEfficiencyList->Add(gHistESDYPtProtonsFromWeak);
1273   TH2D *gHistESDYPtAntiProtonsFromWeak = 0x0;
1274   if(fUseAsymmetricBinning)
1275     gHistESDYPtAntiProtonsFromWeak = new TH2D("gHistESDYPtAntiProtonsFromWeak",
1276                                               ";;P_{T} [GeV/c]",
1277                                               fNBinsY,fY,fNBinsPt,fPt);
1278   else
1279     gHistESDYPtAntiProtonsFromWeak = new TH2D("gHistESDYPtAntiProtonsFromWeak",
1280                                               ";;P_{T} [GeV/c]",
1281                                               fNBinsY,fMinY,fMaxY,
1282                                               fNBinsPt,fMinPt,fMaxPt);
1283   if(fProtonAnalysisBase->GetEtaMode()) 
1284     gHistESDYPtAntiProtonsFromWeak->GetXaxis()->SetTitle("#eta");
1285   else 
1286     gHistESDYPtAntiProtonsFromWeak->GetXaxis()->SetTitle("y");
1287   gHistESDYPtAntiProtonsFromWeak->SetStats(kTRUE);
1288   gHistESDYPtAntiProtonsFromWeak->GetXaxis()->SetTitleColor(1);
1289   fEfficiencyList->Add(gHistESDYPtAntiProtonsFromWeak);
1290
1291   //ESD (anti)protons from hadronic interactions for the reconstruction efficiency
1292   TH2D *gHistESDYPtProtonsFromHadronic = 0x0;
1293   if(fUseAsymmetricBinning)
1294     gHistESDYPtProtonsFromHadronic = new TH2D("gHistESDYPtProtonsFromHadronic",
1295                                               ";;P_{T} [GeV/c]",
1296                                               fNBinsY,fY,fNBinsPt,fPt);
1297   else
1298     gHistESDYPtProtonsFromHadronic = new TH2D("gHistESDYPtProtonsFromHadronic",
1299                                               ";;P_{T} [GeV/c]",
1300                                               fNBinsY,fMinY,fMaxY,
1301                                               fNBinsPt,fMinPt,fMaxPt);
1302   if(fProtonAnalysisBase->GetEtaMode()) 
1303     gHistESDYPtProtonsFromHadronic->GetXaxis()->SetTitle("#eta");
1304   else 
1305     gHistESDYPtProtonsFromHadronic->GetXaxis()->SetTitle("y");
1306   gHistESDYPtProtonsFromHadronic->SetStats(kTRUE);
1307   gHistESDYPtProtonsFromHadronic->GetXaxis()->SetTitleColor(1);
1308   fEfficiencyList->Add(gHistESDYPtProtonsFromHadronic);
1309   TH2D *gHistESDYPtAntiProtonsFromHadronic = 0x0;
1310   if(fUseAsymmetricBinning)
1311     gHistESDYPtAntiProtonsFromHadronic = new TH2D("gHistESDYPtAntiProtonsFromHadronic",
1312                                                   ";;P_{T} [GeV/c]",
1313                                                   fNBinsY,fY,fNBinsPt,fPt);
1314   else
1315     gHistESDYPtAntiProtonsFromHadronic = new TH2D("gHistESDYPtAntiProtonsFromHadronic",
1316                                                   ";;P_{T} [GeV/c]",
1317                                                   fNBinsY,fMinY,fMaxY,
1318                                                   fNBinsPt,fMinPt,fMaxPt);
1319   if(fProtonAnalysisBase->GetEtaMode()) 
1320     gHistESDYPtAntiProtonsFromHadronic->GetXaxis()->SetTitle("#eta");
1321   else 
1322     gHistESDYPtAntiProtonsFromHadronic->GetXaxis()->SetTitle("y");
1323   gHistESDYPtAntiProtonsFromHadronic->SetStats(kTRUE);
1324   gHistESDYPtAntiProtonsFromHadronic->GetXaxis()->SetTitleColor(1);
1325   fEfficiencyList->Add(gHistESDYPtAntiProtonsFromHadronic);
1326   
1327   //ESD reconstructed tracks that were initially protons for the PID efficiency
1328   TH3D *gHistESDInitYPtProtons = 0x0;
1329   if(fUseAsymmetricBinning) {
1330     Double_t gNPoints[51];
1331     for(Int_t i = 0; i < 51; i++)
1332       gNPoints[i] = i*4; 
1333   gHistESDInitYPtProtons = new TH3D("gHistESDInitYPtProtons",
1334                                     ";;P_{T} [GeV/c];N_{points}",
1335                                     fNBinsY,fY,fNBinsPt,fPt,50,gNPoints);
1336   }
1337   else
1338     gHistESDInitYPtProtons = new TH3D("gHistESDInitYPtProtons",
1339                                       ";;P_{T} [GeV/c];N_{points}",
1340                                       fNBinsY,fMinY,fMaxY,
1341                                       fNBinsPt,fMinPt,fMaxPt,
1342                                       50,0,200);
1343   if(fProtonAnalysisBase->GetEtaMode()) 
1344     gHistESDInitYPtProtons->GetXaxis()->SetTitle("#eta");
1345   else 
1346     gHistESDInitYPtProtons->GetXaxis()->SetTitle("y");
1347   gHistESDInitYPtProtons->SetStats(kTRUE);
1348   gHistESDInitYPtProtons->GetXaxis()->SetTitleColor(1);
1349   fEfficiencyList->Add(gHistESDInitYPtProtons);
1350   
1351   //ESD reconstructed tracks that were initially protons and were identified as protons for the PID efficiency
1352   TH3D *gHistESDIdYPtProtons = 0x0;
1353   if(fUseAsymmetricBinning) {
1354     Double_t gNPoints[51];
1355     for(Int_t i = 0; i < 51; i++)
1356       gNPoints[i] = i*4; 
1357     gHistESDIdYPtProtons = new TH3D("gHistESDIdYPtProtons",
1358                                     ";;P_{T} [GeV/c];N_{points}",
1359                                     fNBinsY,fY,fNBinsPt,fPt,50,gNPoints);
1360   }
1361   else
1362     gHistESDIdYPtProtons = new TH3D("gHistESDIdYPtProtons",
1363                                     ";;P_{T} [GeV/c];N_{points}",
1364                                     fNBinsY,fMinY,fMaxY,
1365                                     fNBinsPt,fMinPt,fMaxPt,
1366                                     50,0,200);
1367   if(fProtonAnalysisBase->GetEtaMode()) 
1368     gHistESDIdYPtProtons->GetXaxis()->SetTitle("#eta");
1369   else 
1370     gHistESDIdYPtProtons->GetXaxis()->SetTitle("y");
1371   gHistESDIdYPtProtons->SetStats(kTRUE);
1372   gHistESDIdYPtProtons->GetXaxis()->SetTitleColor(1);
1373   fEfficiencyList->Add(gHistESDIdYPtProtons);
1374  
1375   //ESD reconstructed tracks that were identified as protons for the PID contamination
1376   TH3D *gHistESDRecIdYPtProtons = 0x0;
1377   if(fUseAsymmetricBinning) {
1378     Double_t gNPoints[51];
1379     for(Int_t i = 0; i < 51; i++)
1380       gNPoints[i] = i*4; 
1381     gHistESDRecIdYPtProtons = new TH3D("gHistESDRecIdYPtProtons",
1382                                        ";;P_{T} [GeV/c];N_{points}",
1383                                        fNBinsY,fY,fNBinsPt,fPt,50,gNPoints);
1384   }
1385   else
1386     gHistESDRecIdYPtProtons = new TH3D("gHistESDRecIdYPtProtons",
1387                                        ";;P_{T} [GeV/c];N_{points}",
1388                                        fNBinsY,fMinY,fMaxY,
1389                                        fNBinsPt,fMinPt,fMaxPt,
1390                                        50,0,200);
1391   if(fProtonAnalysisBase->GetEtaMode()) 
1392     gHistESDRecIdYPtProtons->GetXaxis()->SetTitle("#eta");
1393   else 
1394     gHistESDRecIdYPtProtons->GetXaxis()->SetTitle("y");
1395   gHistESDRecIdYPtProtons->SetStats(kTRUE);
1396   gHistESDRecIdYPtProtons->GetXaxis()->SetTitleColor(1);
1397   fEfficiencyList->Add(gHistESDRecIdYPtProtons);
1398
1399   //ESD reconstructed tracks that were identified as protons but were initially not protons for the PID contamination
1400   TH3D *gHistESDContamYPtProtons = 0x0;
1401   if(fUseAsymmetricBinning) {
1402     Double_t gNPoints[51];
1403     for(Int_t i = 0; i < 51; i++)
1404       gNPoints[i] = i*4; 
1405     gHistESDContamYPtProtons = new TH3D("gHistESDContamYPtProtons",
1406                                         ";;P_{T} [GeV/c];N_{points}",
1407                                         fNBinsY,fY,fNBinsPt,fPt,50,gNPoints);
1408   }
1409   else
1410     gHistESDContamYPtProtons = new TH3D("gHistESDContamYPtProtons",
1411                                         ";;P_{T} [GeV/c];N_{points}",
1412                                         fNBinsY,fMinY,fMaxY,
1413                                         fNBinsPt,fMinPt,fMaxPt,
1414                                         50,0,200);
1415   if(fProtonAnalysisBase->GetEtaMode()) 
1416     gHistESDContamYPtProtons->GetXaxis()->SetTitle("#eta");
1417   else 
1418     gHistESDContamYPtProtons->GetXaxis()->SetTitle("y");
1419   gHistESDContamYPtProtons->SetStats(kTRUE);
1420   gHistESDContamYPtProtons->GetXaxis()->SetTitleColor(1);
1421   fEfficiencyList->Add(gHistESDContamYPtProtons);
1422
1423   //==============//
1424   //Cut efficiency//
1425   //==============//
1426   fCutEfficiencyList = new TList();
1427   //Reconstructed primary tracks that were identified as protons
1428   TH2D *gHistESDYPtProtonsTotal = 0x0;
1429   if(fUseAsymmetricBinning)
1430     gHistESDYPtProtonsTotal = new TH2D("gHistESDYPtProtonsTotal",
1431                                        ";;P_{T} [GeV/c]",
1432                                        fNBinsY,fY,fNBinsPt,fPt);
1433   else
1434     gHistESDYPtProtonsTotal = new TH2D("gHistESDYPtProtonsTotal",
1435                                        ";;P_{T} [GeV/c]",
1436                                        fNBinsY,fMinY,fMaxY,
1437                                        fNBinsPt,fMinPt,fMaxPt);
1438   if(fProtonAnalysisBase->GetEtaMode()) 
1439     gHistESDYPtProtonsTotal->GetXaxis()->SetTitle("#eta");
1440   else 
1441     gHistESDYPtProtonsTotal->GetXaxis()->SetTitle("y");
1442   gHistESDYPtProtonsTotal->SetStats(kTRUE);
1443   gHistESDYPtProtonsTotal->GetXaxis()->SetTitleColor(1);
1444   fCutEfficiencyList->Add(gHistESDYPtProtonsTotal);
1445
1446   //Reconstructed primary tracks that were identified as antiprotons
1447   TH2D *gHistESDYPtAntiProtonsTotal = 0x0;
1448   if(fUseAsymmetricBinning)
1449     gHistESDYPtAntiProtonsTotal = new TH2D("gHistESDYPtAntiProtonsTotal",
1450                                            ";;P_{T} [GeV/c]",
1451                                            fNBinsY,fY,fNBinsPt,fPt);
1452   else
1453     gHistESDYPtAntiProtonsTotal = new TH2D("gHistESDYPtAntiProtonsTotal",
1454                                            ";;P_{T} [GeV/c]",
1455                                            fNBinsY,fMinY,fMaxY,
1456                                            fNBinsPt,fMinPt,fMaxPt);
1457   if(fProtonAnalysisBase->GetEtaMode()) 
1458     gHistESDYPtAntiProtonsTotal->GetXaxis()->SetTitle("#eta");
1459   else 
1460     gHistESDYPtAntiProtonsTotal->GetXaxis()->SetTitle("y");
1461   gHistESDYPtAntiProtonsTotal->SetStats(kTRUE);
1462   gHistESDYPtAntiProtonsTotal->GetXaxis()->SetTitleColor(1);
1463   fCutEfficiencyList->Add(gHistESDYPtAntiProtonsTotal);
1464   
1465   //Reconstructed, survived primary tracks that were identified as protons
1466   TH2D *gHistESDYPtProtonsSurvived = 0x0;
1467   if(fUseAsymmetricBinning)
1468     gHistESDYPtProtonsSurvived = new TH2D("gHistESDYPtProtonsSurvived",
1469                                           ";;P_{T} [GeV/c]",
1470                                           fNBinsY,fY,fNBinsPt,fPt);
1471   else
1472     gHistESDYPtProtonsSurvived = new TH2D("gHistESDYPtProtonsSurvived",
1473                                           ";;P_{T} [GeV/c]",
1474                                           fNBinsY,fMinY,fMaxY,
1475                                           fNBinsPt,fMinPt,fMaxPt);
1476   if(fProtonAnalysisBase->GetEtaMode()) 
1477     gHistESDYPtProtonsSurvived->GetXaxis()->SetTitle("#eta");
1478   else 
1479     gHistESDYPtProtonsSurvived->GetXaxis()->SetTitle("y");
1480   gHistESDYPtProtonsSurvived->SetStats(kTRUE);
1481   gHistESDYPtProtonsSurvived->GetXaxis()->SetTitleColor(1);
1482   fCutEfficiencyList->Add(gHistESDYPtProtonsSurvived);
1483   
1484   //Reconstructed, survived primary tracks that were identified as antiprotons
1485   TH2D *gHistESDYPtAntiProtonsSurvived = 0x0;
1486   if(fUseAsymmetricBinning)
1487     gHistESDYPtAntiProtonsSurvived = new TH2D("gHistESDYPtAntiProtonsSurvived",
1488                                               ";;P_{T} [GeV/c]",
1489                                               fNBinsY,fY,fNBinsPt,fPt);
1490   else
1491     gHistESDYPtAntiProtonsSurvived = new TH2D("gHistESDYPtAntiProtonsSurvived",
1492                                               ";;P_{T} [GeV/c]",
1493                                               fNBinsY,fMinY,fMaxY,
1494                                               fNBinsPt,fMinPt,fMaxPt);
1495   if(fProtonAnalysisBase->GetEtaMode()) 
1496     gHistESDYPtAntiProtonsSurvived->GetXaxis()->SetTitle("#eta");
1497   else 
1498     gHistESDYPtAntiProtonsSurvived->GetXaxis()->SetTitle("y");
1499   gHistESDYPtAntiProtonsSurvived->SetStats(kTRUE);
1500   gHistESDYPtAntiProtonsSurvived->GetXaxis()->SetTitleColor(1);
1501   fCutEfficiencyList->Add(gHistESDYPtAntiProtonsSurvived);
1502 }
1503
1504 //____________________________________________________________________//
1505 void AliProtonQAAnalysis::InitCutLists() {
1506   //Initialization of the cut lists
1507   //Adding each monitored object in each list
1508
1509   //Accepted cut list
1510   fAcceptedCutList = new TList();
1511   TH1F *gPrimaryProtonsClustersOnITSLayers = new TH1F("gPrimaryProtonsClustersOnITSLayers",";ITS Layer;Entries",6,0.5,6.5);
1512   fAcceptedCutList->Add(gPrimaryProtonsClustersOnITSLayers);
1513   TH1F *gPrimaryAntiProtonsClustersOnITSLayers = new TH1F("gPrimaryAntiProtonsClustersOnITSLayers",";ITS Layer;Entries",6,0.5,6.5);
1514   fAcceptedCutList->Add(gPrimaryAntiProtonsClustersOnITSLayers);
1515   TH1F *gSecondaryProtonsClustersOnITSLayers = new TH1F("gSecondaryProtonsClustersOnITSLayers",";ITS Layer;Entries",6,0.5,6.5);
1516   fAcceptedCutList->Add(gSecondaryProtonsClustersOnITSLayers);
1517   TH1F *gSecondaryAntiProtonsClustersOnITSLayers = new TH1F("gSecondaryAntiProtonsClustersOnITSLayers",";ITS Layer;Entries",6,0.5,6.5);
1518   fAcceptedCutList->Add(gSecondaryAntiProtonsClustersOnITSLayers);
1519
1520   TH1F *gPrimaryProtonsNClustersITS = new TH1F("gPrimaryProtonsNClustersITS",";ITS Layer;Entries",6,0.5,6.5);
1521   fAcceptedCutList->Add(gPrimaryProtonsNClustersITS);
1522   TH1F *gPrimaryAntiProtonsNClustersITS = new TH1F("gPrimaryAntiProtonsNClustersITS",";ITS Layer;Entries",6,0.5,6.5);
1523   fAcceptedCutList->Add(gPrimaryAntiProtonsNClustersITS);
1524   TH1F *gSecondaryProtonsNClustersITS = new TH1F("gSecondaryProtonsNClustersITS",";ITS Layer;Entries",6,0.5,6.5);
1525   fAcceptedCutList->Add(gSecondaryProtonsNClustersITS);
1526   TH1F *gSecondaryAntiProtonsNClustersITS = new TH1F("gSecondaryAntiProtonsNClustersITS",";ITS Layer;Entries",6,0.5,6.5);
1527   fAcceptedCutList->Add(gSecondaryAntiProtonsNClustersITS);
1528
1529   TH1F *gPrimaryProtonsChi2PerClusterITS = new TH1F("gPrimaryProtonsChi2PerClusterITS",
1530                                                     ";x^{2}/N_{clusters} (ITS);Entries",
1531                                                     100,0,20);
1532   fAcceptedCutList->Add(gPrimaryProtonsChi2PerClusterITS);
1533   TH1F *gPrimaryAntiProtonsChi2PerClusterITS = new TH1F("gPrimaryAntiProtonsChi2PerClusterITS",
1534                                                         ";x^{2}/N_{clusters} (ITS);Entries",
1535                                                         100,0,20);
1536   fAcceptedCutList->Add(gPrimaryAntiProtonsChi2PerClusterITS);
1537   TH1F *gSecondaryProtonsChi2PerClusterITS = new TH1F("gSecondaryProtonsChi2PerClusterITS",
1538                                                       ";x^{2}/N_{clusters} (ITS);Entries",
1539                                                       100,0,20);
1540   fAcceptedCutList->Add(gSecondaryProtonsChi2PerClusterITS);
1541   TH1F *gSecondaryAntiProtonsChi2PerClusterITS = new TH1F("gSecondaryAntiProtonsChi2PerClusterITS",
1542                                                           ";x^{2}/N_{clusters} (ITS);Entries",
1543                                                           100,0,20);
1544   fAcceptedCutList->Add(gSecondaryAntiProtonsChi2PerClusterITS);
1545
1546   TH1F *gPrimaryProtonsConstrainChi2 = new TH1F("gPrimaryProtonsConstrainChi2",
1547                                                 ";Log_{10}(#chi^{2});Entries",
1548                                                 100,-10,10);
1549   fAcceptedCutList->Add(gPrimaryProtonsConstrainChi2);
1550   TH1F *gPrimaryAntiProtonsConstrainChi2 = new TH1F("gPrimaryAntiProtonsConstrainChi2",
1551                                                     ";Log_{10}(#chi^{2});Entries",
1552                                                     100,-10,10);
1553   fAcceptedCutList->Add(gPrimaryAntiProtonsConstrainChi2);
1554   TH1F *gSecondaryProtonsConstrainChi2 = new TH1F("gSecondaryProtonsConstrainChi2",
1555                                                   ";Log_{10}(#chi^{2});Entries",
1556                                                   100,-10,10);
1557   fAcceptedCutList->Add(gSecondaryProtonsConstrainChi2);
1558   TH1F *gSecondaryAntiProtonsConstrainChi2 = new TH1F("gSecondaryAntiProtonsConstrainChi2",
1559                                                       ";Log_{10}(#chi^{2});Entries",
1560                                                       100,-10,10);
1561   fAcceptedCutList->Add(gSecondaryAntiProtonsConstrainChi2);
1562
1563   TH1F *gPrimaryProtonsTPCClusters = new TH1F("gPrimaryProtonsTPCClusters",
1564                                               ";N_{clusters} (TPC);Entries",
1565                                               100,0,200);
1566   fAcceptedCutList->Add(gPrimaryProtonsTPCClusters);
1567   TH1F *gPrimaryAntiProtonsTPCClusters = new TH1F("gPrimaryAntiProtonsTPCClusters",
1568                                                   ";N_{clusters} (TPC);Entries",
1569                                                   100,0,200);
1570   fAcceptedCutList->Add(gPrimaryAntiProtonsTPCClusters);
1571   TH1F *gSecondaryProtonsTPCClusters = new TH1F("gSecondaryProtonsTPCClusters",
1572                                                 ";N_{clusters} (TPC);Entries",
1573                                                 100,0,200);
1574   fAcceptedCutList->Add(gSecondaryProtonsTPCClusters);
1575   TH1F *gSecondaryAntiProtonsTPCClusters = new TH1F("gSecondaryAntiProtonsTPCClusters",
1576                                                     ";N_{clusters} (TPC);Entries",
1577                                                     100,0,200);
1578   fAcceptedCutList->Add(gSecondaryAntiProtonsTPCClusters);
1579
1580   TH1F *gPrimaryProtonsChi2PerClusterTPC = new TH1F("gPrimaryProtonsChi2PerClusterTPC",
1581                                                     ";x^{2}/N_{clusters} (TPC);Entries",
1582                                                     100,0,4);
1583   fAcceptedCutList->Add(gPrimaryProtonsChi2PerClusterTPC);
1584   TH1F *gPrimaryAntiProtonsChi2PerClusterTPC = new TH1F("gPrimaryAntiProtonsChi2PerClusterTPC",
1585                                                         ";x^{2}/N_{clusters} (TPC);Entries",
1586                                                         100,0,4);
1587   fAcceptedCutList->Add(gPrimaryAntiProtonsChi2PerClusterTPC);
1588   TH1F *gSecondaryProtonsChi2PerClusterTPC = new TH1F("gSecondaryProtonsChi2PerClusterTPC",
1589                                                       ";x^{2}/N_{clusters} (TPC);Entries",
1590                                                       100,0,4);
1591   fAcceptedCutList->Add(gSecondaryProtonsChi2PerClusterTPC);
1592   TH1F *gSecondaryAntiProtonsChi2PerClusterTPC = new TH1F("gSecondaryAntiProtonsChi2PerClusterTPC",
1593                                                           ";x^{2}/N_{clusters} (TPC);Entries",
1594                                                           100,0,4);
1595   fAcceptedCutList->Add(gSecondaryAntiProtonsChi2PerClusterTPC);
1596
1597   TH1F *gPrimaryProtonsExtCov11 = new TH1F("gPrimaryProtonsExtCov11",
1598                                            ";#sigma_{y} [cm];Entries",
1599                                            100,0,4);
1600   fAcceptedCutList->Add(gPrimaryProtonsExtCov11);
1601   TH1F *gPrimaryAntiProtonsExtCov11 = new TH1F("gPrimaryAntiProtonsExtCov11",
1602                                                ";#sigma_{y} [cm];Entries",
1603                                                100,0,4);
1604   fAcceptedCutList->Add(gPrimaryAntiProtonsExtCov11);
1605   TH1F *gSecondaryProtonsExtCov11 = new TH1F("gSecondaryProtonsExtCov11",
1606                                              ";#sigma_{y} [cm];Entries",
1607                                              100,0,4);
1608   fAcceptedCutList->Add(gSecondaryProtonsExtCov11);
1609   TH1F *gSecondaryAntiProtonsExtCov11 = new TH1F("gSecondaryAntiProtonsExtCov11",
1610                                                  ";#sigma_{y} [cm];Entries",
1611                                                  100,0,4);
1612   fAcceptedCutList->Add(gSecondaryAntiProtonsExtCov11);
1613
1614
1615   TH1F *gPrimaryProtonsExtCov22 = new TH1F("gPrimaryProtonsExtCov22",
1616                                            ";#sigma_{z} [cm];Entries",
1617                                            100,0,4);
1618   fAcceptedCutList->Add(gPrimaryProtonsExtCov22);
1619   TH1F *gPrimaryAntiProtonsExtCov22 = new TH1F("gPrimaryAntiProtonsExtCov22",
1620                                                ";#sigma_{z} [cm];Entries",
1621                                                100,0,4);
1622   fAcceptedCutList->Add(gPrimaryAntiProtonsExtCov22);
1623   TH1F *gSecondaryProtonsExtCov22 = new TH1F("gSecondaryProtonsExtCov22",
1624                                              ";#sigma_{z} [cm];Entries",
1625                                              100,0,4);
1626   fAcceptedCutList->Add(gSecondaryProtonsExtCov22);
1627   TH1F *gSecondaryAntiProtonsExtCov22 = new TH1F("gSecondaryAntiProtonsExtCov22",
1628                                                  ";#sigma_{z} [cm];Entries",
1629                                                  100,0,4);
1630   fAcceptedCutList->Add(gSecondaryAntiProtonsExtCov22);
1631
1632
1633   TH1F *gPrimaryProtonsExtCov33 = new TH1F("gPrimaryProtonsExtCov33",
1634                                            ";#sigma_{sin(#phi)};Entries",
1635                                            100,0,4);
1636   fAcceptedCutList->Add(gPrimaryProtonsExtCov33);
1637   TH1F *gPrimaryAntiProtonsExtCov33 = new TH1F("gPrimaryAntiProtonsExtCov33",
1638                                                ";#sigma_{sin(#phi)};Entries",
1639                                                100,0,4);
1640   fAcceptedCutList->Add(gPrimaryAntiProtonsExtCov33);
1641   TH1F *gSecondaryProtonsExtCov33 = new TH1F("gSecondaryProtonsExtCov33",
1642                                              ";#sigma_{sin(#phi)};Entries",
1643                                              100,0,4);
1644   fAcceptedCutList->Add(gSecondaryProtonsExtCov33);
1645   TH1F *gSecondaryAntiProtonsExtCov33 = new TH1F("gSecondaryAntiProtonsExtCov33",
1646                                                  ";#sigma_{sin(#phi)};Entries",
1647                                                  100,0,4);
1648   fAcceptedCutList->Add(gSecondaryAntiProtonsExtCov33);
1649
1650
1651   TH1F *gPrimaryProtonsExtCov44 = new TH1F("gPrimaryProtonsExtCov44",
1652                                            ";#sigma_{tan(#lambda)};Entries",
1653                                            100,0,4);
1654   fAcceptedCutList->Add(gPrimaryProtonsExtCov44);
1655   TH1F *gPrimaryAntiProtonsExtCov44 = new TH1F("gPrimaryAntiProtonsExtCov44",
1656                                                ";#sigma_{tan(#lambda)};Entries",
1657                                                100,0,4);
1658   fAcceptedCutList->Add(gPrimaryAntiProtonsExtCov44);
1659   TH1F *gSecondaryProtonsExtCov44 = new TH1F("gSecondaryProtonsExtCov44",
1660                                              ";#sigma_{tan(#lambda)};Entries",
1661                                              100,0,4);
1662   fAcceptedCutList->Add(gSecondaryProtonsExtCov44);
1663   TH1F *gSecondaryAntiProtonsExtCov44 = new TH1F("gSecondaryAntiProtonsExtCov44",
1664                                                  ";#sigma_{tan(#lambda)};Entries",
1665                                                  100,0,4);
1666   fAcceptedCutList->Add(gSecondaryAntiProtonsExtCov44);
1667
1668
1669   TH1F *gPrimaryProtonsExtCov55 = new TH1F("gPrimaryProtonsExtCov55",
1670                                            ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
1671                                            100,0,4);
1672   fAcceptedCutList->Add(gPrimaryProtonsExtCov55);
1673   TH1F *gPrimaryAntiProtonsExtCov55 = new TH1F("gPrimaryAntiProtonsExtCov55",
1674                                                ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
1675                                                100,0,4);
1676   fAcceptedCutList->Add(gPrimaryAntiProtonsExtCov55);
1677   TH1F *gSecondaryProtonsExtCov55 = new TH1F("gSecondaryProtonsExtCov55",
1678                                              ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
1679                                              100,0,4);
1680   fAcceptedCutList->Add(gSecondaryProtonsExtCov55);
1681   TH1F *gSecondaryAntiProtonsExtCov55 = new TH1F("gSecondaryAntiProtonsExtCov55",
1682                                                  ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
1683                                                  100,0,4);
1684   fAcceptedCutList->Add(gSecondaryAntiProtonsExtCov55);
1685   //eta-phi-Nclusters
1686   TH3D *gHistEtaPhiNClustersPrimaryProtonsPass = new TH3D("gHistEtaPhiNClustersPrimaryProtonsPass",
1687                                                           "Accepted primary protons;#eta;#phi;N_{clusters}(TPC)",
1688                                                           fNBinsY,fMinY,fMaxY,
1689                                                           100,0,360,
1690                                                           100,0,200);
1691   gHistEtaPhiNClustersPrimaryProtonsPass->SetStats(kTRUE);
1692   gHistEtaPhiNClustersPrimaryProtonsPass->GetXaxis()->SetTitleColor(1);
1693   fAcceptedCutList->Add(gHistEtaPhiNClustersPrimaryProtonsPass);//eta-phi of primary accepted ESD protons
1694   TH3D *gHistEtaPhiNClustersPrimaryAntiProtonsPass = new TH3D("gHistEtaPhiNClustersPrimaryAntiProtonsPass",
1695                                                               "Accepted primary antiprotons;#eta;#phi;N_{clusters}(TPC)",
1696                                                               fNBinsY,fMinY,fMaxY,
1697                                                               100,0,360,
1698                                                               100,0,200);
1699   gHistEtaPhiNClustersPrimaryAntiProtonsPass->SetStats(kTRUE);
1700   gHistEtaPhiNClustersPrimaryAntiProtonsPass->GetXaxis()->SetTitleColor(1);
1701   fAcceptedCutList->Add(gHistEtaPhiNClustersPrimaryAntiProtonsPass);//eta-phi of primary accepted ESD antiprotons
1702   TH3D *gHistEtaPhiNClustersSecondaryProtonsPass = new TH3D("gHistEtaPhiNClustersSecondaryProtonsPass",
1703                                                             "Accepted secondary protons;#eta;#phi;N_{clusters}(TPC)",
1704                                                             fNBinsY,fMinY,fMaxY,
1705                                                             100,0,360,
1706                                                             100,0,200);
1707   gHistEtaPhiNClustersSecondaryProtonsPass->SetStats(kTRUE);
1708   gHistEtaPhiNClustersSecondaryProtonsPass->GetXaxis()->SetTitleColor(1);
1709   fAcceptedCutList->Add(gHistEtaPhiNClustersSecondaryProtonsPass);//eta-phi of secondary accepted ESD protons
1710   TH3D *gHistEtaPhiNClustersSecondaryAntiProtonsPass = new TH3D("gHistEtaPhiNClustersSecondaryAntiProtonsPass",
1711                                                                 "Accepted secondary antiprotons;#eta;#phi;N_{clusters}(TPC)",
1712                                                                 fNBinsY,fMinY,fMaxY,
1713                                                                 100,0,360,
1714                                                                 100,0,200);
1715   gHistEtaPhiNClustersSecondaryAntiProtonsPass->SetStats(kTRUE);
1716   gHistEtaPhiNClustersSecondaryAntiProtonsPass->GetXaxis()->SetTitleColor(1);
1717   fAcceptedCutList->Add(gHistEtaPhiNClustersSecondaryAntiProtonsPass);//eta-phi of secondary accepted ESD antiprotons
1718   //eta-phi-chi^2 per TPC cluster
1719   TH3D *gHistEtaPhiChi2PerTPCClusterPrimaryProtonsPass = new TH3D("gHistEtaPhiChi2PerTPCClusterPrimaryProtonsPass",
1720                                                                   "Accepted primary protons;#eta;#phi;#chi^{2}/N_{clusters}(TPC)",
1721                                                                   fNBinsY,fMinY,fMaxY,
1722                                                                   100,0,360,
1723                                                                   100,0,4);
1724   gHistEtaPhiChi2PerTPCClusterPrimaryProtonsPass->SetStats(kTRUE);
1725   gHistEtaPhiChi2PerTPCClusterPrimaryProtonsPass->GetXaxis()->SetTitleColor(1);
1726   fAcceptedCutList->Add(gHistEtaPhiChi2PerTPCClusterPrimaryProtonsPass);//eta-phi of primary accepted ESD protons
1727   TH3D *gHistEtaPhiChi2PerTPCClusterPrimaryAntiProtonsPass = new TH3D("gHistEtaPhiChi2PerTPCClusterPrimaryAntiProtonsPass",
1728                                                                       "Accepted primary antiprotons;#eta;#phi;#chi^{2}/N_{clusters}(TPC)",
1729                                                                       fNBinsY,fMinY,fMaxY,
1730                                                                       100,0,360,
1731                                                                       100,0,4);
1732   gHistEtaPhiChi2PerTPCClusterPrimaryAntiProtonsPass->SetStats(kTRUE);
1733   gHistEtaPhiChi2PerTPCClusterPrimaryAntiProtonsPass->GetXaxis()->SetTitleColor(1);
1734   fAcceptedCutList->Add(gHistEtaPhiChi2PerTPCClusterPrimaryAntiProtonsPass);//eta-phi of primary accepted ESD antiprotons
1735   TH3D *gHistEtaPhiChi2PerTPCClusterSecondaryProtonsPass = new TH3D("gHistEtaPhiChi2PerTPCClusterSecondaryProtonsPass",
1736                                                                     "Accepted secondary protons;#eta;#phi;#chi^{2}/N_{clusters}(TPC)",
1737                                                                     fNBinsY,fMinY,fMaxY,
1738                                                                     100,0,360,
1739                                                                     100,0,4);
1740   gHistEtaPhiChi2PerTPCClusterSecondaryProtonsPass->SetStats(kTRUE);
1741   gHistEtaPhiChi2PerTPCClusterSecondaryProtonsPass->GetXaxis()->SetTitleColor(1);
1742   fAcceptedCutList->Add(gHistEtaPhiChi2PerTPCClusterSecondaryProtonsPass);//eta-phi of secondary accepted ESD protons
1743   TH3D *gHistEtaPhiChi2PerTPCClusterSecondaryAntiProtonsPass = new TH3D("gHistEtaPhiChi2PerTPCClusterSecondaryAntiProtonsPass",
1744                                                                         "Accepted secondary antiprotons;#eta;#phi;#chi^{2}/N_{clusters}(TPC)",
1745                                                                         fNBinsY,fMinY,fMaxY,
1746                                                                         100,0,360,
1747                                                                         100,0,4);
1748   gHistEtaPhiChi2PerTPCClusterSecondaryAntiProtonsPass->SetStats(kTRUE);
1749   gHistEtaPhiChi2PerTPCClusterSecondaryAntiProtonsPass->GetXaxis()->SetTitleColor(1);
1750   fAcceptedCutList->Add(gHistEtaPhiChi2PerTPCClusterSecondaryAntiProtonsPass);//eta-phi of secondary accepted ESD antiprotons
1751   //eta-phi-number of TPC points for the dE/dx
1752   TH3D *gHistEtaPhiTPCdEdxNPointsPrimaryProtonsPass = new TH3D("gHistEtaPhiTPCdEdxNPointsPrimaryProtonsPass",
1753                                                                   "Accepted primary protons;#eta;#phi;N_{points}(TPC)",
1754                                                                   fNBinsY,fMinY,fMaxY,
1755                                                                   100,0,360,
1756                                                                   100,0,200);
1757   gHistEtaPhiTPCdEdxNPointsPrimaryProtonsPass->SetStats(kTRUE);
1758   gHistEtaPhiTPCdEdxNPointsPrimaryProtonsPass->GetXaxis()->SetTitleColor(1);
1759   fAcceptedCutList->Add(gHistEtaPhiTPCdEdxNPointsPrimaryProtonsPass);//eta-phi of primary accepted ESD protons
1760   TH3D *gHistEtaPhiTPCdEdxNPointsPrimaryAntiProtonsPass = new TH3D("gHistEtaPhiTPCdEdxNPointsPrimaryAntiProtonsPass",
1761                                                                       "Accepted primary antiprotons;#eta;#phi;N_{points}(TPC)",
1762                                                                       fNBinsY,fMinY,fMaxY,
1763                                                                       100,0,360,
1764                                                                       100,0,200);
1765   gHistEtaPhiTPCdEdxNPointsPrimaryAntiProtonsPass->SetStats(kTRUE);
1766   gHistEtaPhiTPCdEdxNPointsPrimaryAntiProtonsPass->GetXaxis()->SetTitleColor(1);
1767   fAcceptedCutList->Add(gHistEtaPhiTPCdEdxNPointsPrimaryAntiProtonsPass);//eta-phi of primary accepted ESD antiprotons
1768   TH3D *gHistEtaPhiTPCdEdxNPointsSecondaryProtonsPass = new TH3D("gHistEtaPhiTPCdEdxNPointsSecondaryProtonsPass",
1769                                                                     "Accepted secondary protons;#eta;#phi;N_{points}(TPC)",
1770                                                                     fNBinsY,fMinY,fMaxY,
1771                                                                     100,0,360,
1772                                                                     100,0,200);
1773   gHistEtaPhiTPCdEdxNPointsSecondaryProtonsPass->SetStats(kTRUE);
1774   gHistEtaPhiTPCdEdxNPointsSecondaryProtonsPass->GetXaxis()->SetTitleColor(1);
1775   fAcceptedCutList->Add(gHistEtaPhiTPCdEdxNPointsSecondaryProtonsPass);//eta-phi of secondary accepted ESD protons
1776   TH3D *gHistEtaPhiTPCdEdxNPointsSecondaryAntiProtonsPass = new TH3D("gHistEtaPhiTPCdEdxNPointsSecondaryAntiProtonsPass",
1777                                                                         "Accepted secondary antiprotons;#eta;#phi;N_{points}(TPC)",
1778                                                                         fNBinsY,fMinY,fMaxY,
1779                                                                         100,0,360,
1780                                                                         100,0,200);
1781   gHistEtaPhiTPCdEdxNPointsSecondaryAntiProtonsPass->SetStats(kTRUE);
1782   gHistEtaPhiTPCdEdxNPointsSecondaryAntiProtonsPass->GetXaxis()->SetTitleColor(1);
1783   fAcceptedCutList->Add(gHistEtaPhiTPCdEdxNPointsSecondaryAntiProtonsPass);//eta-phi of secondary accepted ESD antiprotons
1784
1785   TH1F *gPrimaryProtonsNPointsTPCdEdx = new TH1F("gPrimaryProtonsNPointsTPCdEdx",
1786                                               ";N_{points} (TPC-dE/dx);Entries",
1787                                               100,0,200);
1788   fAcceptedCutList->Add(gPrimaryProtonsNPointsTPCdEdx);
1789   TH1F *gPrimaryAntiProtonsNPointsTPCdEdx = new TH1F("gPrimaryAntiProtonsNPointsTPCdEdx",
1790                                                   ";N_{points} (TPC-dE/dx);Entries",
1791                                                   100,0,200);
1792   fAcceptedCutList->Add(gPrimaryAntiProtonsNPointsTPCdEdx);
1793   TH1F *gSecondaryProtonsNPointsTPCdEdx = new TH1F("gSecondaryProtonsNPointsTPCdEdx",
1794                                                 ";N_{points} (TPC-dE/dx);Entries",
1795                                                 100,0,200);
1796   fAcceptedCutList->Add(gSecondaryProtonsNPointsTPCdEdx);
1797   TH1F *gSecondaryAntiProtonsNPointsTPCdEdx = new TH1F("gSecondaryAntiProtonsNPointsTPCdEdx",
1798                                                     ";N_{points} (TPC-dE/dx);Entries",
1799                                                     100,0,200);
1800   fAcceptedCutList->Add(gSecondaryAntiProtonsNPointsTPCdEdx);
1801   
1802   //Rejected cut list
1803   fRejectedCutList = new TList();
1804   //eta-phi-Nclusters
1805   TH3D *gHistEtaPhiNClustersPrimaryProtonsReject = new TH3D("gHistEtaPhiNClustersPrimaryProtonsReject",
1806                                                           "Rejected primary protons;#eta;#phi;N_{clusters}(TPC)",
1807                                                           fNBinsY,fMinY,fMaxY,
1808                                                           100,0,360,
1809                                                           100,0,200);
1810   gHistEtaPhiNClustersPrimaryProtonsReject->SetStats(kTRUE);
1811   gHistEtaPhiNClustersPrimaryProtonsReject->GetXaxis()->SetTitleColor(1);
1812   fRejectedCutList->Add(gHistEtaPhiNClustersPrimaryProtonsReject);//eta-phi of primary rejected ESD protons
1813   TH3D *gHistEtaPhiNClustersPrimaryAntiProtonsReject = new TH3D("gHistEtaPhiNClustersPrimaryAntiProtonsReject",
1814                                                               "Rejected primary antiprotons;#eta;#phi;N_{clusters}(TPC)",
1815                                                               fNBinsY,fMinY,fMaxY,
1816                                                               100,0,360,
1817                                                               100,0,200);
1818   gHistEtaPhiNClustersPrimaryAntiProtonsReject->SetStats(kTRUE);
1819   gHistEtaPhiNClustersPrimaryAntiProtonsReject->GetXaxis()->SetTitleColor(1);
1820   fRejectedCutList->Add(gHistEtaPhiNClustersPrimaryAntiProtonsReject);//eta-phi of primary rejected ESD antiprotons
1821   TH3D *gHistEtaPhiNClustersSecondaryProtonsReject = new TH3D("gHistEtaPhiNClustersSecondaryProtonsReject",
1822                                                             "Rejected secondary protons;#eta;#phi;N_{clusters}(TPC)",
1823                                                             fNBinsY,fMinY,fMaxY,
1824                                                             100,0,360,
1825                                                             100,0,200);
1826   gHistEtaPhiNClustersSecondaryProtonsReject->SetStats(kTRUE);
1827   gHistEtaPhiNClustersSecondaryProtonsReject->GetXaxis()->SetTitleColor(1);
1828   fRejectedCutList->Add(gHistEtaPhiNClustersSecondaryProtonsReject);//eta-phi of secondary rejected ESD protons
1829   TH3D *gHistEtaPhiNClustersSecondaryAntiProtonsReject = new TH3D("gHistEtaPhiNClustersSecondaryAntiProtonsReject",
1830                                                                 "Rejected secondary antiprotons;#eta;#phi;N_{clusters}(TPC)",
1831                                                                 fNBinsY,fMinY,fMaxY,
1832                                                                 100,0,360,
1833                                                                 100,0,200);
1834   gHistEtaPhiNClustersSecondaryAntiProtonsReject->SetStats(kTRUE);
1835   gHistEtaPhiNClustersSecondaryAntiProtonsReject->GetXaxis()->SetTitleColor(1);
1836   fRejectedCutList->Add(gHistEtaPhiNClustersSecondaryAntiProtonsReject);//eta-phi of secondary rejected ESD antiprotons
1837   //eta-phi-chi^2 per TPC cluster
1838   TH3D *gHistEtaPhiChi2PerTPCClusterPrimaryProtonsReject = new TH3D("gHistEtaPhiChi2PerTPCClusterPrimaryProtonsReject",
1839                                                                   "Rejected primary protons;#eta;#phi;#chi^{2}/N_{clusters}(TPC)",
1840                                                                   fNBinsY,fMinY,fMaxY,
1841                                                                   100,0,360,
1842                                                                   100,0,4);
1843   gHistEtaPhiChi2PerTPCClusterPrimaryProtonsReject->SetStats(kTRUE);
1844   gHistEtaPhiChi2PerTPCClusterPrimaryProtonsReject->GetXaxis()->SetTitleColor(1);
1845   fRejectedCutList->Add(gHistEtaPhiChi2PerTPCClusterPrimaryProtonsReject);//eta-phi of primary rejected ESD protons
1846   TH3D *gHistEtaPhiChi2PerTPCClusterPrimaryAntiProtonsReject = new TH3D("gHistEtaPhiChi2PerTPCClusterPrimaryAntiProtonsReject",
1847                                                                       "Rejected primary antiprotons;#eta;#phi;#chi^{2}/N_{clusters}(TPC)",
1848                                                                       fNBinsY,fMinY,fMaxY,
1849                                                                       100,0,360,
1850                                                                       100,0,4);
1851   gHistEtaPhiChi2PerTPCClusterPrimaryAntiProtonsReject->SetStats(kTRUE);
1852   gHistEtaPhiChi2PerTPCClusterPrimaryAntiProtonsReject->GetXaxis()->SetTitleColor(1);
1853   fRejectedCutList->Add(gHistEtaPhiChi2PerTPCClusterPrimaryAntiProtonsReject);//eta-phi of primary rejected ESD antiprotons
1854   TH3D *gHistEtaPhiChi2PerTPCClusterSecondaryProtonsReject = new TH3D("gHistEtaPhiChi2PerTPCClusterSecondaryProtonsReject",
1855                                                                     "Rejected secondary protons;#eta;#phi;#chi^{2}/N_{clusters}(TPC)",
1856                                                                     fNBinsY,fMinY,fMaxY,
1857                                                                     100,0,360,
1858                                                                     100,0,4);
1859   gHistEtaPhiChi2PerTPCClusterSecondaryProtonsReject->SetStats(kTRUE);
1860   gHistEtaPhiChi2PerTPCClusterSecondaryProtonsReject->GetXaxis()->SetTitleColor(1);
1861   fRejectedCutList->Add(gHistEtaPhiChi2PerTPCClusterSecondaryProtonsReject);//eta-phi of secondary rejected ESD protons
1862   TH3D *gHistEtaPhiChi2PerTPCClusterSecondaryAntiProtonsReject = new TH3D("gHistEtaPhiChi2PerTPCClusterSecondaryAntiProtonsReject",
1863                                                                         "Rejected secondary antiprotons;#eta;#phi;#chi^{2}/N_{clusters}(TPC)",
1864                                                                         fNBinsY,fMinY,fMaxY,
1865                                                                         100,0,360,
1866                                                                         100,0,4);
1867   gHistEtaPhiChi2PerTPCClusterSecondaryAntiProtonsReject->SetStats(kTRUE);
1868   gHistEtaPhiChi2PerTPCClusterSecondaryAntiProtonsReject->GetXaxis()->SetTitleColor(1);
1869   fRejectedCutList->Add(gHistEtaPhiChi2PerTPCClusterSecondaryAntiProtonsReject);//eta-phi of secondary rejected ESD antiprotons
1870   //eta-phi-number of TPC points for the dE/dx
1871   TH3D *gHistEtaPhiTPCdEdxNPointsPrimaryProtonsReject = new TH3D("gHistEtaPhiTPCdEdxNPointsPrimaryProtonsReject",
1872                                                                   "Rejected primary protons;#eta;#phi;N_{points}(TPC)",
1873                                                                   fNBinsY,fMinY,fMaxY,
1874                                                                   100,0,360,
1875                                                                   100,0,200);
1876   gHistEtaPhiTPCdEdxNPointsPrimaryProtonsReject->SetStats(kTRUE);
1877   gHistEtaPhiTPCdEdxNPointsPrimaryProtonsReject->GetXaxis()->SetTitleColor(1);
1878   fRejectedCutList->Add(gHistEtaPhiTPCdEdxNPointsPrimaryProtonsReject);//eta-phi of primary rejected ESD protons
1879   TH3D *gHistEtaPhiTPCdEdxNPointsPrimaryAntiProtonsReject = new TH3D("gHistEtaPhiTPCdEdxNPointsPrimaryAntiProtonsReject",
1880                                                                       "Rejected primary antiprotons;#eta;#phi;N_{points}(TPC)",
1881                                                                       fNBinsY,fMinY,fMaxY,
1882                                                                       100,0,360,
1883                                                                       100,0,200);
1884   gHistEtaPhiTPCdEdxNPointsPrimaryAntiProtonsReject->SetStats(kTRUE);
1885   gHistEtaPhiTPCdEdxNPointsPrimaryAntiProtonsReject->GetXaxis()->SetTitleColor(1);
1886   fRejectedCutList->Add(gHistEtaPhiTPCdEdxNPointsPrimaryAntiProtonsReject);//eta-phi of primary rejected ESD antiprotons
1887   TH3D *gHistEtaPhiTPCdEdxNPointsSecondaryProtonsReject = new TH3D("gHistEtaPhiTPCdEdxNPointsSecondaryProtonsReject",
1888                                                                     "Rejected secondary protons;#eta;#phi;N_{points}(TPC)",
1889                                                                     fNBinsY,fMinY,fMaxY,
1890                                                                     100,0,360,
1891                                                                     100,0,200);
1892   gHistEtaPhiTPCdEdxNPointsSecondaryProtonsReject->SetStats(kTRUE);
1893   gHistEtaPhiTPCdEdxNPointsSecondaryProtonsReject->GetXaxis()->SetTitleColor(1);
1894   fRejectedCutList->Add(gHistEtaPhiTPCdEdxNPointsSecondaryProtonsReject);//eta-phi of secondary rejected ESD protons
1895   TH3D *gHistEtaPhiTPCdEdxNPointsSecondaryAntiProtonsReject = new TH3D("gHistEtaPhiTPCdEdxNPointsSecondaryAntiProtonsReject",
1896                                                                         "Rejected secondary antiprotons;#eta;#phi;N_{points}(TPC)",
1897                                                                         fNBinsY,fMinY,fMaxY,
1898                                                                         100,0,360,
1899                                                                         100,0,200);
1900   gHistEtaPhiTPCdEdxNPointsSecondaryAntiProtonsReject->SetStats(kTRUE);
1901   gHistEtaPhiTPCdEdxNPointsSecondaryAntiProtonsReject->GetXaxis()->SetTitleColor(1);
1902   fRejectedCutList->Add(gHistEtaPhiTPCdEdxNPointsSecondaryAntiProtonsReject);//eta-phi of secondary rejected ESD antiprotons
1903
1904   //DCA list
1905   fAcceptedDCAList = new TList();
1906   TH1F *gPrimaryProtonsDCAXY = new TH1F("gPrimaryProtonsDCAXY",
1907                                         ";DCA_{xy} [cm];Entries",
1908                                         100,0,20);
1909   fAcceptedDCAList->Add(gPrimaryProtonsDCAXY);
1910   TH1F *gPrimaryAntiProtonsDCAXY = new TH1F("gPrimaryAntiProtonsDCAXY",
1911                                             ";DCA_{xy} [cm];Entries",
1912                                             100,0,20);
1913   fAcceptedDCAList->Add(gPrimaryAntiProtonsDCAXY);
1914   TH1F *gSecondaryProtonsDCAXY = new TH1F("gSecondaryProtonsDCAXY",
1915                                           ";DCA_{xy} [cm];Entries",
1916                                           100,0,20);
1917   fAcceptedDCAList->Add(gSecondaryProtonsDCAXY);
1918   TH1F *gSecondaryAntiProtonsDCAXY = new TH1F("gSecondaryAntiProtonsDCAXY",
1919                                               ";DCA_{xy} [cm];Entries",
1920                                               100,0,20);
1921
1922   fAcceptedDCAList->Add(gSecondaryAntiProtonsDCAXY);
1923   TH1F *gPrimaryProtonsDCAZ = new TH1F("gPrimaryProtonsDCAZ",
1924                                        ";DCA_{z} [cm];Entries",
1925                                        100,0,20);
1926   fAcceptedDCAList->Add(gPrimaryProtonsDCAZ);
1927   TH1F *gPrimaryAntiProtonsDCAZ = new TH1F("gPrimaryAntiProtonsDCAZ",
1928                                            ";DCA_{z} [cm];Entries",
1929                                            100,0,20);
1930   fAcceptedDCAList->Add(gPrimaryAntiProtonsDCAZ);
1931   TH1F *gSecondaryProtonsDCAZ = new TH1F("gSecondaryProtonsDCAZ",
1932                                          ";DCA_{z} [cm];Entries",
1933                                          100,0,20);
1934   fAcceptedDCAList->Add(gSecondaryProtonsDCAZ);
1935   TH1F *gSecondaryAntiProtonsDCAZ = new TH1F("gSecondaryAntiProtonsDCAZ",
1936                                              ";DCA_{z} [cm];Entries",
1937                                              100,0,20);
1938   fAcceptedDCAList->Add(gSecondaryAntiProtonsDCAZ);
1939
1940   TH1F *gPrimaryProtonsSigmaToVertex = new TH1F("gPrimaryProtonsSigmaToVertex",
1941                                                 ";#sigma_{Vertex};Entries",
1942                                                 100,0,10);
1943   fAcceptedDCAList->Add(gPrimaryProtonsSigmaToVertex);
1944   TH1F *gPrimaryAntiProtonsSigmaToVertex = new TH1F("gPrimaryAntiProtonsSigmaToVertex",
1945                                                     ";#sigma_{Vertex};Entries",
1946                                                     100,0,10);
1947   fAcceptedDCAList->Add(gPrimaryAntiProtonsSigmaToVertex);
1948   TH1F *gSecondaryProtonsSigmaToVertex = new TH1F("gSecondaryProtonsSigmaToVertex",
1949                                                   ";#sigma_{Vertex};Entries",
1950                                                   100,0,10);
1951   fAcceptedDCAList->Add(gSecondaryProtonsSigmaToVertex);
1952   TH1F *gSecondaryAntiProtonsSigmaToVertex = new TH1F("gSecondaryAntiProtonsSigmaToVertex",
1953                                                       ";#sigma_{Vertex};Entries",
1954                                                       100,0,10);
1955   fAcceptedDCAList->Add(gSecondaryAntiProtonsSigmaToVertex);
1956
1957   //2D DCA vs pT plots
1958   TH2F *gHistPrimaryProtonsDCAxyPt = new TH2F("gHistPrimaryProtonsDCAxyPt",
1959                                                   ";P_{T} [GeV/c];dca_{xy} [cm]",
1960                                                   16,0.3,1.1,
1961                                                   1000,0,10);
1962   gHistPrimaryProtonsDCAxyPt->SetStats(kFALSE);
1963   fAcceptedDCAList->Add(gHistPrimaryProtonsDCAxyPt);
1964   TH2F *gHistPrimaryAntiProtonsDCAxyPt = new TH2F("gHistPrimaryAntiProtonsDCAxyPt",
1965                                                   ";P_{T} [GeV/c];dca_{xy} [cm]",
1966                                                   16,0.3,1.1,
1967                                                   1000,0,10);
1968   gHistPrimaryAntiProtonsDCAxyPt->SetStats(kFALSE);
1969   fAcceptedDCAList->Add(gHistPrimaryAntiProtonsDCAxyPt);
1970   TH2F *gHistSecondaryProtonsFromWeakDCAxyPt = new TH2F("gHistSecondaryProtonsFromWeakDCAxyPt",
1971                                                             ";P_{T} [GeV/c];dca_{xy} [cm]",
1972                                                             16,0.3,1.1,
1973                                                             1000,0,10);
1974   gHistSecondaryProtonsFromWeakDCAxyPt->SetStats(kFALSE);
1975   fAcceptedDCAList->Add(gHistSecondaryProtonsFromWeakDCAxyPt);
1976   TH2F *gHistSecondaryAntiProtonsFromWeakDCAxyPt = new TH2F("gHistSecondaryAntiProtonsFromWeakDCAxyPt",
1977                                                             ";P_{T} [GeV/c];dca_{xy} [cm]",
1978                                                             16,0.3,1.1,
1979                                                             1000,0,10);
1980   gHistSecondaryAntiProtonsFromWeakDCAxyPt->SetStats(kFALSE);
1981   fAcceptedDCAList->Add(gHistSecondaryAntiProtonsFromWeakDCAxyPt);
1982   TH2F *gHistSecondaryProtonsFromHadronicDCAxyPt = new TH2F("gHistSecondaryProtonsFromHadronicDCAxyPt",
1983                                                                 ";P_{T} [GeV/c];dca_{xy} [cm]",
1984                                                                 16,0.3,1.1,
1985                                                                 1000,0,10);
1986   gHistSecondaryProtonsFromHadronicDCAxyPt->SetStats(kFALSE);
1987   fAcceptedDCAList->Add(gHistSecondaryProtonsFromHadronicDCAxyPt);
1988   TH2F *gHistSecondaryAntiProtonsFromHadronicDCAxyPt = new TH2F("gHistSecondaryAntiProtonsFromHadronicDCAxyPt",
1989                                                                 ";P_{T} [GeV/c];dca_{xy} [cm]",
1990                                                                 16,0.3,1.1,
1991                                                                 1000,0,10);
1992   gHistSecondaryAntiProtonsFromHadronicDCAxyPt->SetStats(kFALSE);
1993   fAcceptedDCAList->Add(gHistSecondaryAntiProtonsFromHadronicDCAxyPt);
1994
1995   TH2F *gHistPrimaryProtonsDCAzPt = new TH2F("gHistPrimaryProtonsDCAzPt",
1996                                                  ";P_{T} [GeV/c];dca_{z} [cm]",
1997                                                  16,0.3,1.1,
1998                                                  1000,0,10);
1999   gHistPrimaryProtonsDCAzPt->SetStats(kFALSE);
2000   fAcceptedDCAList->Add(gHistPrimaryProtonsDCAzPt);
2001   TH2F *gHistPrimaryAntiProtonsDCAzPt = new TH2F("gHistPrimaryAntiProtonsDCAzPt",
2002                                                  ";P_{T} [GeV/c];dca_{z} [cm]",
2003                                                  16,0.3,1.1,
2004                                                  1000,0,10);
2005   gHistPrimaryAntiProtonsDCAzPt->SetStats(kFALSE);
2006   fAcceptedDCAList->Add(gHistPrimaryAntiProtonsDCAzPt);
2007   TH2F *gHistSecondaryProtonsFromWeakDCAzPt = new TH2F("gHistSecondaryProtonsFromWeakDCAzPt",
2008                                                            ";P_{T} [GeV/c];dca_{z} [cm]",
2009                                                            16,0.3,1.1,
2010                                                            1000,0,10);
2011   gHistSecondaryProtonsFromWeakDCAzPt->SetStats(kFALSE);
2012   fAcceptedDCAList->Add(gHistSecondaryProtonsFromWeakDCAzPt);
2013   TH2F *gHistSecondaryAntiProtonsFromWeakDCAzPt = new TH2F("gHistSecondaryAntiProtonsFromWeakDCAzPt",
2014                                                            ";P_{T} [GeV/c];dca_{z} [cm]",
2015                                                            16,0.3,1.1,
2016                                                            1000,0,10);
2017   gHistSecondaryAntiProtonsFromWeakDCAzPt->SetStats(kFALSE);
2018   fAcceptedDCAList->Add(gHistSecondaryAntiProtonsFromWeakDCAzPt);
2019   TH2F *gHistSecondaryProtonsFromHadronicDCAzPt = new TH2F("gHistSecondaryProtonsFromHadronicDCAzPt",
2020                                                                ";P_{T} [GeV/c];dca_{z} [cm]",
2021                                                                16,0.3,1.1,
2022                                                                1000,0,10);
2023   gHistSecondaryProtonsFromHadronicDCAzPt->SetStats(kFALSE);
2024   fAcceptedDCAList->Add(gHistSecondaryProtonsFromHadronicDCAzPt);
2025   TH2F *gHistSecondaryAntiProtonsFromHadronicDCAzPt = new TH2F("gHistSecondaryAntiProtonsFromHadronicDCAzPt",
2026                                                                ";P_{T} [GeV/c];dca_{z} [cm]",
2027                                                                16,0.3,1.1,
2028                                                                1000,0,10);
2029   gHistSecondaryAntiProtonsFromHadronicDCAzPt->SetStats(kFALSE);
2030   fAcceptedDCAList->Add(gHistSecondaryAntiProtonsFromHadronicDCAzPt);
2031 }
2032
2033 //____________________________________________________________________//
2034 void AliProtonQAAnalysis::InitVertexQA() {
2035   //Initializes the Vertex QA histograms
2036   fQAVertexList = new TList();
2037   fQAVertexList->SetName("fQAVertexList");
2038
2039   //Gen. multiplicity bins
2040   //Float_t xBins[24] = {0,1,2,4,6,8,10,15,20,30,40,50,75,100,
2041   //200,300,400,500,750,1000,1500,2000,2500,3000};
2042   //MC primary multiplicity (vertex efficiency calculation)
2043   TH1F *gHistMCPrimaryVz = new TH1F("gHistMCPrimaryVz",
2044                                     ";V_{z} (gen.) [cm];Entries",
2045                                     40,-20.,20.);
2046   fQAVertexList->Add(gHistMCPrimaryVz);
2047   //TH1F *gHistMCPrimaryMultiplicity = new TH1F("gHistMCPrimaryMultiplicity",
2048   //";N_{prim. gen.};Entries",
2049   //23,xBins);
2050   //fQAVertexList->Add(gHistMCPrimaryMultiplicity);
2051   
2052   //TPC
2053   TH1F *gHistTPCVz = new TH1F("gHistTPCVz",
2054                               ";V_{z} (gen.) [cm];Entries",
2055                               40,-20.,20.);
2056   fQAVertexList->Add(gHistTPCVz);
2057   //TH1F *gHistMCPrimaryMultiplicityTPC = new TH1F("gHistMCPrimaryMultiplicityTPC",
2058   //"Vertex TPC;N_{prim. gen.};Entries",
2059   //23,xBins);
2060   //fQAVertexList->Add(gHistMCPrimaryMultiplicityTPC);
2061   TH2F *gHistTPCESDVxN = new TH2F("gHistTPCESDVxN",
2062                                  "Primary vertex TPC;V_{x} [cm];N_{contributors}",
2063                                  100,-10.,10.,1000,0,5000);
2064   fQAVertexList->Add(gHistTPCESDVxN);
2065   TH2F *gHistTPCESDVyN = new TH2F("gHistTPCESDVyN",
2066                                  "Primary vertex TPC;V_{y} [cm];N_{contributors}",
2067                                  100,-10.,10.,1000,0,5000);
2068   fQAVertexList->Add(gHistTPCESDVyN);
2069   TH2F *gHistTPCESDVzN = new TH2F("gHistTPCESDVzN",
2070                                  "Primary vertex TPC;V_{z} [cm];N_{contributors}",
2071                                  100,-20.,20.,1000,0,5000);
2072   fQAVertexList->Add(gHistTPCESDVzN);
2073   TH1F *gHistTPCDiffVx = new TH1F("gHistTPCDiffVx",
2074                                   ";V_{x}(rec.) - V_{x}(true) [#mu m];Entries",
2075                                   100,-10000.,10000.);
2076   fQAVertexList->Add(gHistTPCDiffVx);
2077   TH1F *gHistTPCDiffVy = new TH1F("gHistTPCDiffVy",
2078                                   ";V_{y}(rec.) - V_{y}(true) [#mu m];Entries",
2079                                   100,-10000.,10000.);
2080   fQAVertexList->Add(gHistTPCDiffVy);
2081   TH1F *gHistTPCDiffVz = new TH1F("gHistTPCDiffVz",
2082                                   ";V_{z}(rec.) - V_{z}(true) [#mu m];Entries",
2083                                   100,-10000.,10000.);
2084   fQAVertexList->Add(gHistTPCDiffVz);
2085   TH1F *gHistTPCResolutionVx = new TH1F("gHistTPCResolutionVx",
2086                                         ";#sigma_{x} [#mu m];Entries",
2087                                         100,0.,1000000.);
2088   fQAVertexList->Add(gHistTPCResolutionVx);
2089   TH1F *gHistTPCResolutionVy = new TH1F("gHistTPCResolutionVy",
2090                                         ";#sigma_{y} [#mu m];Entries",
2091                                         100,0.,1000000.);
2092   fQAVertexList->Add(gHistTPCResolutionVy);
2093   TH1F *gHistTPCResolutionVz = new TH1F("gHistTPCResolutionVz",
2094                                         ";#sigma_{z} [#mu m];Entries",
2095                                         100,0.,6000.);
2096   fQAVertexList->Add(gHistTPCResolutionVz);
2097   
2098   //SPD
2099   TH1F *gHistSPDVz = new TH1F("gHistSPDVz",
2100                               ";V_{z} (gen.) [cm];Entries",
2101                               40,-20.,20.);
2102   fQAVertexList->Add(gHistSPDVz);
2103   //TH1F *gHistMCPrimaryMultiplicitySPD = new TH1F("gHistMCPrimaryMultiplicitySPD",
2104   //"Vertex SPD;N_{prim. gen.};Entries",
2105   //23,xBins);
2106   //fQAVertexList->Add(gHistMCPrimaryMultiplicitySPD);
2107   TH2F *gHistSPDESDVxN = new TH2F("gHistSPDESDVxN",
2108                                  "Primary vertex SPD;V_{x} [cm];N_{contributors}",
2109                                  100,-10.,10.,1000,0,5000);
2110   fQAVertexList->Add(gHistSPDESDVxN);
2111   TH2F *gHistSPDESDVyN = new TH2F("gHistSPDESDVyN",
2112                                  "Primary vertex SPD;V_{y} [cm];N_{contributors}",
2113                                  100,-10.,10.,1000,0,5000);
2114   fQAVertexList->Add(gHistSPDESDVyN);
2115   TH2F *gHistSPDESDVzN = new TH2F("gHistSPDESDVzN",
2116                                  "Primary vertex SPD;V_{z} [cm];N_{contributors}",
2117                                  100,-20.,20.,1000,0,5000);
2118   fQAVertexList->Add(gHistSPDESDVzN);
2119   TH1F *gHistSPDDiffVx = new TH1F("gHistSPDDiffVx",
2120                                   ";V_{x}(rec.) - V_{x}(true) [#mu m];Entries",
2121                                   100,-10000.,10000.);
2122   fQAVertexList->Add(gHistSPDDiffVx);
2123   TH1F *gHistSPDDiffVy = new TH1F("gHistSPDDiffVy",
2124                                   ";V_{y}(rec.) - V_{y}(true) [#mu m];Entries",
2125                                   100,-10000.,10000.);
2126   fQAVertexList->Add(gHistSPDDiffVy);
2127   TH1F *gHistSPDDiffVz = new TH1F("gHistSPDDiffVz",
2128                                   ";V_{z}(rec.) - V_{z}(true) [#mu m];Entries",
2129                                   100,-10000.,10000.);
2130   fQAVertexList->Add(gHistSPDDiffVz);
2131   TH1F *gHistSPDResolutionVx = new TH1F("gHistSPDResolutionVx",
2132                                         ";#sigma_{x} [#mu m];Entries",
2133                                         100,0.,1000.);
2134   fQAVertexList->Add(gHistSPDResolutionVx);
2135   TH1F *gHistSPDResolutionVy = new TH1F("gHistSPDResolutionVy",
2136                                         ";#sigma_{y} [#mu m];Entries",
2137                                         100,0.,1000.);
2138   fQAVertexList->Add(gHistSPDResolutionVy);
2139   TH1F *gHistSPDResolutionVz = new TH1F("gHistSPDResolutionVz",
2140                                         ";#sigma_{z} [#mu m];Entries",
2141                                         100,0.,500.);
2142   fQAVertexList->Add(gHistSPDResolutionVz);
2143   
2144   //Tracks
2145   TH1F *gHistTracksVz = new TH1F("gHistTracksVz",
2146                                  ";V_{z} (gen.) [cm];Entries",
2147                                  40,-20.,20.);
2148   fQAVertexList->Add(gHistTracksVz);
2149   //TH1F *gHistMCPrimaryMultiplicityTracks = new TH1F("gHistMCPrimaryMultiplicityTracks",
2150   //"Vertex Tracks;N_{prim. gen.};Entries",
2151   //23,xBins);
2152   //fQAVertexList->Add(gHistMCPrimaryMultiplicityTracks);
2153   TH2F *gHistTracksESDVxN = new TH2F("gHistTracksESDVxN",
2154                                      "Primary vertex Tracks;V_{x} [cm];N_{contributors}",
2155                                      100,-10.,10.,1000,0,5000);
2156   fQAVertexList->Add(gHistTracksESDVxN);
2157   TH2F *gHistTracksESDVyN = new TH2F("gHistTracksESDVyN",
2158                                     "Primary vertex Tracks;V_{y} [cm];N_{contributors}",
2159                                     100,-10.,10.,1000,0,5000);
2160   fQAVertexList->Add(gHistTracksESDVyN);
2161   TH2F *gHistTracksESDVzN = new TH2F("gHistTracksESDVzN",
2162                                     "Primary vertex Tracks;V_{z} [cm];N_{contributors}",
2163                                     100,-20.,20.,1000,0,5000);
2164   fQAVertexList->Add(gHistTracksESDVzN);
2165   TH1F *gHistTracksDiffVx = new TH1F("gHistTracksDiffVx",
2166                                      ";V_{x}(rec.) - V_{x}(true) [#mu m];Entries",
2167                                      100,-10000.,10000.);
2168   fQAVertexList->Add(gHistTracksDiffVx);
2169   TH1F *gHistTracksDiffVy = new TH1F("gHistTracksDiffVy",
2170                                      ";V_{y}(rec.) - V_{y}(true) [#mu m];Entries",
2171                                      100,-10000.,10000.);
2172   fQAVertexList->Add(gHistTracksDiffVy);
2173   TH1F *gHistTracksDiffVz = new TH1F("gHistTracksDiffVz",
2174                                      ";V_{z}(rec.) - V_{z}(true) [#mu m];Entries",
2175                                      100,-10000.,10000.);
2176   fQAVertexList->Add(gHistTracksDiffVz);
2177   TH1F *gHistTracksResolutionVx = new TH1F("gHistTracksResolutionVx",
2178                                            ";#sigma_{x} [#mu m];Entries",
2179                                            100,0.,5000.);
2180   fQAVertexList->Add(gHistTracksResolutionVx);
2181   TH1F *gHistTracksResolutionVy = new TH1F("gHistTracksResolutionVy",
2182                                            ";#sigma_{y} [#mu m];Entries",
2183                                            100,0.,5000.);
2184   fQAVertexList->Add(gHistTracksResolutionVy);
2185   TH1F *gHistTracksResolutionVz = new TH1F("gHistTracksResolutionVz",
2186                                            ";#sigma_{z} [#mu m];Entries",
2187                                            100,0.,1000.);
2188   fQAVertexList->Add(gHistTracksResolutionVz);
2189 }
2190
2191 //____________________________________________________________________//
2192 void AliProtonQAAnalysis::InitQA() {
2193   //Initializes the QA histograms
2194   //if(!fQAHistograms) 
2195   SetRunQAAnalysis();
2196
2197   //2D histograms
2198   //TDirectory *dir2D = gDirectory->mkdir("2D");
2199   //fGlobalQAList->Add(dir2D); dir2D->cd();
2200   TH2D *gHistYPtPrimaryProtonsPass = 0x0;
2201   if(fUseAsymmetricBinning)
2202   gHistYPtPrimaryProtonsPass = new TH2D("gHistYPtPrimaryProtonsPass",
2203                                         ";;P_{T} [GeV/c]",
2204                                         fNBinsY,fY,fNBinsPt,fPt);
2205   else
2206     gHistYPtPrimaryProtonsPass = new TH2D("gHistYPtPrimaryProtonsPass",
2207                                           ";;P_{T} [GeV/c]",
2208                                           fNBinsY,fMinY,fMaxY,
2209                                           fNBinsPt,fMinPt,fMaxPt);
2210   if(fProtonAnalysisBase->GetEtaMode()) 
2211     gHistYPtPrimaryProtonsPass->GetXaxis()->SetTitle("#eta");
2212   else 
2213     gHistYPtPrimaryProtonsPass->GetXaxis()->SetTitle("y");
2214   gHistYPtPrimaryProtonsPass->SetStats(kTRUE);
2215   gHistYPtPrimaryProtonsPass->GetXaxis()->SetTitleColor(1);
2216   fQA2DList->Add(gHistYPtPrimaryProtonsPass);//y-pT of primary accepted ESD protons
2217   TH2D *gHistYPtPrimaryProtonsReject = 0x0;
2218   if(fUseAsymmetricBinning)
2219     gHistYPtPrimaryProtonsReject = new TH2D("gHistYPtPrimaryProtonsReject",
2220                                             ";;P_{T} [GeV/c]",
2221                                             fNBinsY,fY,fNBinsPt,fPt);
2222   else
2223     gHistYPtPrimaryProtonsReject = new TH2D("gHistYPtPrimaryProtonsReject",
2224                                             ";;P_{T} [GeV/c]",
2225                                             fNBinsY,fMinY,fMaxY,
2226                                             fNBinsPt,fMinPt,fMaxPt);
2227   if(fProtonAnalysisBase->GetEtaMode()) 
2228     gHistYPtPrimaryProtonsReject->GetXaxis()->SetTitle("#eta");
2229   else 
2230     gHistYPtPrimaryProtonsReject->GetXaxis()->SetTitle("y");
2231   gHistYPtPrimaryProtonsReject->SetStats(kTRUE);
2232   gHistYPtPrimaryProtonsReject->GetXaxis()->SetTitleColor(1);
2233   fQA2DList->Add(gHistYPtPrimaryProtonsReject);//y-pT of primary rejected ESD protons
2234
2235   TH2D *gHistYPtSecondaryProtonsPass = 0x0;
2236   if(fUseAsymmetricBinning)
2237     gHistYPtSecondaryProtonsPass = new TH2D("gHistYPtSecondaryProtonsPass",
2238                                             ";;P_{T} [GeV/c]",
2239                                             fNBinsY,fY,fNBinsPt,fPt);
2240   else
2241     gHistYPtSecondaryProtonsPass = new TH2D("gHistYPtSecondaryProtonsPass",
2242                                             ";;P_{T} [GeV/c]",
2243                                             fNBinsY,fMinY,fMaxY,
2244                                             fNBinsPt,fMinPt,fMaxPt);
2245   if(fProtonAnalysisBase->GetEtaMode()) 
2246     gHistYPtSecondaryProtonsPass->GetXaxis()->SetTitle("#eta");
2247   else 
2248     gHistYPtSecondaryProtonsPass->GetXaxis()->SetTitle("y");
2249   gHistYPtSecondaryProtonsPass->SetStats(kTRUE);
2250   gHistYPtSecondaryProtonsPass->GetXaxis()->SetTitleColor(1);
2251   fQA2DList->Add(gHistYPtSecondaryProtonsPass);//y-pT of secondary accepted ESD protons
2252   TH2D *gHistYPtSecondaryProtonsReject = 0x0;
2253   if(fUseAsymmetricBinning)
2254     gHistYPtSecondaryProtonsReject = new TH2D("gHistYPtSecondaryProtonsReject",
2255                                               ";;P_{T} [GeV/c]",
2256                                               fNBinsY,fY,fNBinsPt,fPt);
2257   else
2258     gHistYPtSecondaryProtonsReject = new TH2D("gHistYPtSecondaryProtonsReject",
2259                                               ";;P_{T} [GeV/c]",
2260                                               fNBinsY,fMinY,fMaxY,
2261                                               fNBinsPt,fMinPt,fMaxPt);
2262   if(fProtonAnalysisBase->GetEtaMode()) 
2263     gHistYPtSecondaryProtonsReject->GetXaxis()->SetTitle("#eta");
2264   else 
2265     gHistYPtSecondaryProtonsReject->GetXaxis()->SetTitle("y");
2266   gHistYPtSecondaryProtonsReject->SetStats(kTRUE);
2267   gHistYPtSecondaryProtonsReject->GetXaxis()->SetTitleColor(1);
2268   fQA2DList->Add(gHistYPtSecondaryProtonsReject);//y-pT of secondary rejected ESD protons
2269
2270   TH2D *gHistYPtPrimaryAntiProtonsPass = 0x0;
2271   if(fUseAsymmetricBinning)
2272     gHistYPtPrimaryAntiProtonsPass = new TH2D("gHistYPtPrimaryAntiProtonsPass",
2273                                               ";;P_{T} [GeV/c]",
2274                                               fNBinsY,fY,fNBinsPt,fPt);
2275   else
2276     gHistYPtPrimaryAntiProtonsPass = new TH2D("gHistYPtPrimaryAntiProtonsPass",
2277                                               ";;P_{T} [GeV/c]",
2278                                               fNBinsY,fMinY,fMaxY,
2279                                               fNBinsPt,fMinPt,fMaxPt);
2280   if(fProtonAnalysisBase->GetEtaMode()) 
2281     gHistYPtPrimaryAntiProtonsPass->GetXaxis()->SetTitle("#eta");
2282   else 
2283     gHistYPtPrimaryAntiProtonsPass->GetXaxis()->SetTitle("y");
2284   gHistYPtPrimaryAntiProtonsPass->SetStats(kTRUE);
2285   gHistYPtPrimaryAntiProtonsPass->GetXaxis()->SetTitleColor(1);
2286   fQA2DList->Add(gHistYPtPrimaryAntiProtonsPass);//y-pT of primary accepted ESD antiprotons
2287   TH2D *gHistYPtPrimaryAntiProtonsReject = 0x0;
2288   if(fUseAsymmetricBinning)
2289     gHistYPtPrimaryAntiProtonsReject = new TH2D("gHistYPtPrimaryAntiProtonsReject",
2290                                                 ";;P_{T} [GeV/c]",
2291                                                 fNBinsY,fY,fNBinsPt,fPt);
2292   else
2293     gHistYPtPrimaryAntiProtonsReject = new TH2D("gHistYPtPrimaryAntiProtonsReject",
2294                                                 ";;P_{T} [GeV/c]",
2295                                                 fNBinsY,fMinY,fMaxY,
2296                                                 fNBinsPt,fMinPt,fMaxPt);
2297   if(fProtonAnalysisBase->GetEtaMode()) 
2298     gHistYPtPrimaryAntiProtonsReject->GetXaxis()->SetTitle("#eta");
2299   else 
2300     gHistYPtPrimaryAntiProtonsReject->GetXaxis()->SetTitle("y");
2301   gHistYPtPrimaryAntiProtonsReject->SetStats(kTRUE);
2302   gHistYPtPrimaryAntiProtonsReject->GetXaxis()->SetTitleColor(1);
2303   fQA2DList->Add(gHistYPtPrimaryAntiProtonsReject);//y-pT of primary rejected ESD antiprotons
2304
2305   TH2D *gHistYPtSecondaryAntiProtonsPass = 0x0;
2306   if(fUseAsymmetricBinning)
2307   gHistYPtSecondaryAntiProtonsPass = new TH2D("gHistYPtSecondaryAntiProtonsPass",
2308                                               ";;P_{T} [GeV/c]",
2309                                               fNBinsY,fY,fNBinsPt,fPt);
2310   else
2311     gHistYPtSecondaryAntiProtonsPass = new TH2D("gHistYPtSecondaryAntiProtonsPass",
2312                                                 ";;P_{T} [GeV/c]",
2313                                                 fNBinsY,fMinY,fMaxY,
2314                                                 fNBinsPt,fMinPt,fMaxPt);
2315   if(fProtonAnalysisBase->GetEtaMode()) 
2316     gHistYPtSecondaryAntiProtonsPass->GetXaxis()->SetTitle("#eta");
2317   else 
2318     gHistYPtSecondaryAntiProtonsPass->GetXaxis()->SetTitle("y");
2319   gHistYPtSecondaryAntiProtonsPass->SetStats(kTRUE);
2320   gHistYPtSecondaryAntiProtonsPass->GetXaxis()->SetTitleColor(1);
2321   fQA2DList->Add(gHistYPtSecondaryAntiProtonsPass);//y-pT of secondary accepted ESD antiprotons
2322   TH2D *gHistYPtSecondaryAntiProtonsReject = 0x0;
2323   if(fUseAsymmetricBinning)
2324   gHistYPtSecondaryAntiProtonsReject = new TH2D("gHistYPtSecondaryAntiProtonsReject",
2325                                                 ";;P_{T} [GeV/c]",
2326                                                 fNBinsY,fY,fNBinsPt,fPt);
2327   else
2328     gHistYPtSecondaryAntiProtonsReject = new TH2D("gHistYPtSecondaryAntiProtonsReject",
2329                                                   ";;P_{T} [GeV/c]",
2330                                                   fNBinsY,fMinY,fMaxY,
2331                                                   fNBinsPt,fMinPt,fMaxPt);
2332   if(fProtonAnalysisBase->GetEtaMode()) 
2333     gHistYPtSecondaryAntiProtonsReject->GetXaxis()->SetTitle("#eta");
2334   else 
2335     gHistYPtSecondaryAntiProtonsReject->GetXaxis()->SetTitle("y");
2336   gHistYPtSecondaryAntiProtonsReject->SetStats(kTRUE);
2337   gHistYPtSecondaryAntiProtonsReject->GetXaxis()->SetTitleColor(1);
2338   fQA2DList->Add(gHistYPtSecondaryAntiProtonsReject);//y-pT of secondary rejected ESD antiprotons
2339
2340   TH2D *gHistYPtPrimaryProtonsMC = 0x0;
2341   if(fUseAsymmetricBinning)
2342     gHistYPtPrimaryProtonsMC = new TH2D("gHistYPtPrimaryProtonsMC",
2343                                         ";;P_{T} [GeV/c]",
2344                                         fNBinsY,fY,fNBinsPt,fPt);
2345   else
2346     gHistYPtPrimaryProtonsMC = new TH2D("gHistYPtPrimaryProtonsMC",
2347                                         ";;P_{T} [GeV/c]",
2348                                         fNBinsY,fMinY,fMaxY,
2349                                         fNBinsPt,fMinPt,fMaxPt);
2350   if(fProtonAnalysisBase->GetEtaMode()) 
2351     gHistYPtPrimaryProtonsMC->GetXaxis()->SetTitle("#eta");
2352   else 
2353     gHistYPtPrimaryProtonsMC->GetXaxis()->SetTitle("y");
2354   gHistYPtPrimaryProtonsMC->SetStats(kTRUE);
2355   gHistYPtPrimaryProtonsMC->GetXaxis()->SetTitleColor(1);
2356   fQA2DList->Add(gHistYPtPrimaryProtonsMC);//y-pT of primary MC protons
2357   TH2D *gHistYPtPrimaryAntiProtonsMC = 0x0;
2358   if(fUseAsymmetricBinning)
2359     gHistYPtPrimaryAntiProtonsMC = new TH2D("gHistYPtPrimaryAntiProtonsMC",
2360                                             ";;P_{T} [GeV/c]",
2361                                             fNBinsY,fY,fNBinsPt,fPt);
2362   else
2363     gHistYPtPrimaryAntiProtonsMC = new TH2D("gHistYPtPrimaryAntiProtonsMC",
2364                                             ";;P_{T} [GeV/c]",
2365                                             fNBinsY,fMinY,fMaxY,
2366                                             fNBinsPt,fMinPt,fMaxPt);
2367   if(fProtonAnalysisBase->GetEtaMode()) 
2368     gHistYPtPrimaryAntiProtonsMC->GetXaxis()->SetTitle("#eta");
2369   else 
2370     gHistYPtPrimaryAntiProtonsMC->GetXaxis()->SetTitle("y");
2371   gHistYPtPrimaryAntiProtonsMC->SetStats(kTRUE);
2372   gHistYPtPrimaryAntiProtonsMC->GetXaxis()->SetTitleColor(1);
2373   fQA2DList->Add(gHistYPtPrimaryAntiProtonsMC);//y-pT of primary MC antiprotons
2374
2375   TH3F *gHistYPtPDGProtonsPass = 0x0;
2376   if(fUseAsymmetricBinning) {
2377     Double_t gPDG[15] = {-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5,11.5,12.5,13.5};
2378     gHistYPtPDGProtonsPass = new TH3F("gHistYPtPDGProtonsPass",
2379                                       ";;P_{T} [GeV/c];PDG",
2380                                       fNBinsY,fY,fNBinsPt,fPt,14,gPDG);
2381   }
2382   else
2383     gHistYPtPDGProtonsPass = new TH3F("gHistYPtPDGProtonsPass",
2384                                       ";;P_{T} [GeV/c];PDG",
2385                                       fNBinsY,fMinY,fMaxY,
2386                                       fNBinsPt,fMinPt,fMaxPt,
2387                                       14,-0.5,13.5);
2388   if(fProtonAnalysisBase->GetEtaMode()) 
2389     gHistYPtPDGProtonsPass->GetXaxis()->SetTitle("#eta");
2390   else 
2391     gHistYPtPDGProtonsPass->GetXaxis()->SetTitle("y");
2392   fQA2DList->Add(gHistYPtPDGProtonsPass);//composition of secondary protons
2393   TH3F *gHistYPtPDGAntiProtonsPass = 0x0;
2394   if(fUseAsymmetricBinning) {
2395     Double_t gPDG[15] = {-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5,11.5,12.5,13.5};
2396     gHistYPtPDGAntiProtonsPass = new TH3F("gHistYPtPDGAntiProtonsPass",
2397                                           ";;P_{T} [GeV/c];PDG",
2398                                           fNBinsY,fY,fNBinsPt,fPt,14,gPDG);
2399   }
2400   else
2401     gHistYPtPDGAntiProtonsPass = new TH3F("gHistYPtPDGAntiProtonsPass",
2402                                           ";;P_{T} [GeV/c];PDG",
2403                                           fNBinsY,fMinY,fMaxY,
2404                                           fNBinsPt,fMinPt,fMaxPt,
2405                                           14,-0.5,13.5);
2406   if(fProtonAnalysisBase->GetEtaMode()) 
2407     gHistYPtPDGAntiProtonsPass->GetXaxis()->SetTitle("#eta");
2408   else 
2409     gHistYPtPDGAntiProtonsPass->GetXaxis()->SetTitle("y");
2410   fQA2DList->Add(gHistYPtPDGAntiProtonsPass);//composition of secondary antiprotons
2411
2412   /*gDirectory->cd("../");
2413   //protons
2414   TDirectory *dirProtons = gDirectory->mkdir("Protons");
2415   fGlobalQAList->Add(dirProtons); dirProtons->cd();*/
2416   
2417   //________________________________________________________________//
2418   /*TDirectory *dirProtonsPrimary = gDirectory->mkdir("Primaries");
2419   dirProtonsPrimary->cd();
2420   TDirectory *dirProtonsPrimaryAccepted = gDirectory->mkdir("Accepted");
2421   dirProtonsPrimaryAccepted->cd();*/
2422
2423   //Accepted primary protons
2424   TH1F *gPrimaryProtonsITSClustersPass = new TH1F("gPrimaryProtonsITSClustersPass",
2425                                             ";N_{clusters} (ITS);Entries",
2426                                             7,0,7);
2427   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsITSClustersPass);
2428   TH1F *gPrimaryProtonsChi2PerClusterITSPass = new TH1F("gPrimaryProtonsChi2PerClusterITSPass",
2429                                                   ";x^{2}/N_{clusters} (ITS);Entries",
2430                                                   100,0,4);
2431   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsChi2PerClusterITSPass);
2432   TH1F *gPrimaryProtonsTPCClustersPass = new TH1F("gPrimaryProtonsTPCClustersPass",
2433                                             ";N_{clusters} (TPC);Entries",
2434                                             100,0,200);
2435   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsTPCClustersPass);
2436   TH1F *gPrimaryProtonsChi2PerClusterTPCPass = new TH1F("gPrimaryProtonsChi2PerClusterTPCPass",
2437                                                   ";x^{2}/N_{clusters} (TPC);Entries",
2438                                                   100,0,4);
2439   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsChi2PerClusterTPCPass);
2440   TH1F *gPrimaryProtonsExtCov11Pass = new TH1F("gPrimaryProtonsExtCov11Pass",
2441                                          ";#sigma_{y} [cm];Entries",
2442                                          100,0,4);
2443   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov11Pass);
2444   TH1F *gPrimaryProtonsExtCov22Pass = new TH1F("gPrimaryProtonsExtCov22Pass",
2445                                          ";#sigma_{z} [cm];Entries",
2446                                          100,0,4);
2447   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov22Pass);
2448   TH1F *gPrimaryProtonsExtCov33Pass = new TH1F("gPrimaryProtonsExtCov33Pass",
2449                                          ";#sigma_{sin(#phi)};Entries",
2450                                          100,0,4);
2451   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov33Pass);
2452   TH1F *gPrimaryProtonsExtCov44Pass = new TH1F("gPrimaryProtonsExtCov44Pass",
2453                                          ";#sigma_{tan(#lambda)};Entries",
2454                                          100,0,4);
2455   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov44Pass);
2456   TH1F *gPrimaryProtonsExtCov55Pass = new TH1F("gPrimaryProtonsExtCov55Pass",
2457                                          ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2458                                          100,0,4);
2459   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov55Pass);
2460   TH1F *gPrimaryProtonsSigmaToVertexPass = new TH1F("gPrimaryProtonsSigmaToVertexPass",
2461                                              ";#sigma_{Vertex};Entries",
2462                                              100,0,10);
2463   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsSigmaToVertexPass);
2464   TH1F *gPrimaryProtonsSigmaToVertexTPCPass = new TH1F("gPrimaryProtonsSigmaToVertexTPCPass",
2465                                              ";#sigma_{Vertex};Entries",
2466                                              100,0,10);
2467   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsSigmaToVertexTPCPass);
2468   TH1F *gPrimaryProtonsDCAXYPass = new TH1F("gPrimaryProtonsDCAXYPass",
2469                                              ";DCA_{xy} [cm];Entries",
2470                                              100,0,20);
2471   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsDCAXYPass);
2472   TH1F *gPrimaryProtonsDCAXYTPCPass = new TH1F("gPrimaryProtonsDCAXYTPCPass",
2473                                                ";DCA_{xy} [cm];Entries",
2474                                                100,0,20);
2475   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsDCAXYTPCPass);
2476   TH1F *gPrimaryProtonsDCAZPass = new TH1F("gPrimaryProtonsDCAZPass",
2477                                            ";DCA_{z} [cm];Entries",
2478                                            100,0,20);
2479   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsDCAZPass);
2480   TH1F *gPrimaryProtonsDCAZTPCPass = new TH1F("gPrimaryProtonsDCAZTPCPass",
2481                                               ";DCA_{z} [cm];Entries",
2482                                               100,0,20);
2483   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsDCAZTPCPass);
2484   TH1F *gPrimaryProtonsConstrainChi2Pass = new TH1F("gPrimaryProtonsConstrainChi2Pass",
2485                                                     ";Log_{10}(#chi^{2});Entries",
2486                                                     100,-10,10);
2487   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsConstrainChi2Pass);
2488   TH1F *gPrimaryProtonsITSRefitPass = new TH1F("gPrimaryProtonsITSRefitPass",
2489                                                "",10,-1,1);
2490   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsITSRefitPass);
2491   TH1F *gPrimaryProtonsTPCRefitPass = new TH1F("gPrimaryProtonsTPCRefitPass",
2492                                                "",10,-1,1);
2493   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsTPCRefitPass);
2494   TH1F *gPrimaryProtonsESDpidPass = new TH1F("gPrimaryProtonsESDpidPass",
2495                                              "",10,-1,1);
2496   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsESDpidPass);
2497   TH1F *gPrimaryProtonsTPCpidPass = new TH1F("gPrimaryProtonsTPCpidPass",
2498                                              "",10,-1,1);
2499   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsTPCpidPass);
2500   TH1F *gPrimaryProtonsPointOnITSLayer1Pass = new TH1F("gPrimaryProtonsPointOnITSLayer1Pass",
2501                                              "",10,-1,1);
2502   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer1Pass);
2503   TH1F *gPrimaryProtonsPointOnITSLayer2Pass = new TH1F("gPrimaryProtonsPointOnITSLayer2Pass",
2504                                              "",10,-1,1);
2505   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer2Pass);
2506   TH1F *gPrimaryProtonsPointOnITSLayer3Pass = new TH1F("gPrimaryProtonsPointOnITSLayer3Pass",
2507                                              "",10,-1,1);
2508   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer3Pass);
2509   TH1F *gPrimaryProtonsPointOnITSLayer4Pass = new TH1F("gPrimaryProtonsPointOnITSLayer4Pass",
2510                                              "",10,-1,1);
2511   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer4Pass);
2512   TH1F *gPrimaryProtonsPointOnITSLayer5Pass = new TH1F("gPrimaryProtonsPointOnITSLayer5Pass",
2513                                              "",10,-1,1);
2514   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer5Pass);
2515   TH1F *gPrimaryProtonsPointOnITSLayer6Pass = new TH1F("gPrimaryProtonsPointOnITSLayer6Pass",
2516                                              "",10,-1,1);
2517   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer6Pass);
2518   TH1F *gPrimaryProtonsNumberOfTPCdEdxPointsPass = new TH1F("gPrimaryProtonsNumberOfTPCdEdxPointsPass","",100,0,200);
2519   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsNumberOfTPCdEdxPointsPass);
2520
2521   //Rejected primary protons
2522   /*gDirectory->cd("../");
2523   TDirectory *dirProtonsPrimaryRejected = gDirectory->mkdir("Rejected");
2524   dirProtonsPrimaryRejected->cd();*/
2525
2526   TH1F *gPrimaryProtonsITSClustersReject = new TH1F("gPrimaryProtonsITSClustersReject",
2527                                                     ";N_{clusters} (ITS);Entries",
2528                                                     7,0,7);
2529   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsITSClustersReject);
2530   TH1F *gPrimaryProtonsChi2PerClusterITSReject = new TH1F("gPrimaryProtonsChi2PerClusterITSReject",
2531                                                           ";x^{2}/N_{clusters} (ITS);Entries",
2532                                                           100,0,4);
2533   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsChi2PerClusterITSReject);
2534   TH1F *gPrimaryProtonsTPCClustersReject = new TH1F("gPrimaryProtonsTPCClustersReject",
2535                                             ";N_{clusters} (TPC);Entries",
2536                                             100,0,200);
2537   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsTPCClustersReject);
2538   TH1F *gPrimaryProtonsChi2PerClusterTPCReject = new TH1F("gPrimaryProtonsChi2PerClusterTPCReject",
2539                                                   ";x^{2}/N_{clusters} (TPC);Entries",
2540                                                   100,0,4);
2541   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsChi2PerClusterTPCReject);
2542   TH1F *gPrimaryProtonsExtCov11Reject = new TH1F("gPrimaryProtonsExtCov11Reject",
2543                                          ";#sigma_{y} [cm];Entries",
2544                                          100,0,4);
2545   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov11Reject);
2546   TH1F *gPrimaryProtonsExtCov22Reject = new TH1F("gPrimaryProtonsExtCov22Reject",
2547                                          ";#sigma_{z} [cm];Entries",
2548                                          100,0,4);
2549   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov22Reject);
2550   TH1F *gPrimaryProtonsExtCov33Reject = new TH1F("gPrimaryProtonsExtCov33Reject",
2551                                          ";#sigma_{sin(#phi)};Entries",
2552                                          100,0,4);
2553   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov33Reject);
2554   TH1F *gPrimaryProtonsExtCov44Reject = new TH1F("gPrimaryProtonsExtCov44Reject",
2555                                          ";#sigma_{tan(#lambda)};Entries",
2556                                          100,0,4);
2557   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov44Reject);
2558   TH1F *gPrimaryProtonsExtCov55Reject = new TH1F("gPrimaryProtonsExtCov55Reject",
2559                                          ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2560                                          100,0,4);
2561   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov55Reject);
2562   TH1F *gPrimaryProtonsSigmaToVertexReject = new TH1F("gPrimaryProtonsSigmaToVertexReject",
2563                                              ";#sigma_{Vertex};Entries",
2564                                              100,0,10);
2565   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsSigmaToVertexReject);
2566   TH1F *gPrimaryProtonsSigmaToVertexTPCReject = new TH1F("gPrimaryProtonsSigmaToVertexTPCReject",
2567                                              ";#sigma_{Vertex};Entries",
2568                                              100,0,10);
2569   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsSigmaToVertexTPCReject);
2570   TH1F *gPrimaryProtonsDCAXYReject = new TH1F("gPrimaryProtonsDCAXYReject",
2571                                               ";DCA_{xy} [cm];Entries",
2572                                               100,0,20);
2573   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsDCAXYReject);
2574   TH1F *gPrimaryProtonsDCAXYTPCReject = new TH1F("gPrimaryProtonsDCAXYTPCReject",
2575                                                  ";DCA_{xy} [cm];Entries",
2576                                                  100,0,20);
2577   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsDCAXYTPCReject);
2578   TH1F *gPrimaryProtonsDCAZReject = new TH1F("gPrimaryProtonsDCAZReject",
2579                                              ";DCA_{z} [cm];Entries",
2580                                              100,0,20);
2581   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsDCAZReject);
2582   TH1F *gPrimaryProtonsDCAZTPCReject = new TH1F("gPrimaryProtonsDCAZTPCReject",
2583                                                 ";DCA_{z} [cm];Entries",
2584                                                 100,0,20);
2585   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsDCAZTPCReject);
2586   TH1F *gPrimaryProtonsConstrainChi2Reject = new TH1F("gPrimaryProtonsConstrainChi2Reject",
2587                                                     ";Log_{10}(#chi^{2});Entries",
2588                                                     100,-10,10);
2589   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsConstrainChi2Reject);
2590   TH1F *gPrimaryProtonsITSRefitReject = new TH1F("gPrimaryProtonsITSRefitReject",
2591                                                  "",10,-1,1);
2592   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsITSRefitReject);
2593   TH1F *gPrimaryProtonsTPCRefitReject = new TH1F("gPrimaryProtonsTPCRefitReject",
2594                                                  "",10,-1,1);
2595   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsTPCRefitReject);
2596   TH1F *gPrimaryProtonsESDpidReject = new TH1F("gPrimaryProtonsESDpidReject",
2597                                                "",10,-1,1);
2598   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsESDpidReject);
2599   TH1F *gPrimaryProtonsTPCpidReject = new TH1F("gPrimaryProtonsTPCpidReject",
2600                                                "",10,-1,1);
2601   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsTPCpidReject);
2602   TH1F *gPrimaryProtonsPointOnITSLayer1Reject = new TH1F("gPrimaryProtonsPointOnITSLayer1Reject",
2603                                              "",10,-1,1);
2604   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer1Reject);
2605   TH1F *gPrimaryProtonsPointOnITSLayer2Reject = new TH1F("gPrimaryProtonsPointOnITSLayer2Reject",
2606                                              "",10,-1,1);
2607   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer2Reject);
2608   TH1F *gPrimaryProtonsPointOnITSLayer3Reject = new TH1F("gPrimaryProtonsPointOnITSLayer3Reject",
2609                                              "",10,-1,1);
2610   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer3Reject);
2611   TH1F *gPrimaryProtonsPointOnITSLayer4Reject = new TH1F("gPrimaryProtonsPointOnITSLayer4Reject",
2612                                              "",10,-1,1);
2613   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer4Reject);
2614   TH1F *gPrimaryProtonsPointOnITSLayer5Reject = new TH1F("gPrimaryProtonsPointOnITSLayer5Reject",
2615                                              "",10,-1,1);
2616   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer5Reject);
2617   TH1F *gPrimaryProtonsPointOnITSLayer6Reject = new TH1F("gPrimaryProtonsPointOnITSLayer6Reject",
2618                                              "",10,-1,1);
2619   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer6Reject);
2620   TH1F *gPrimaryProtonsNumberOfTPCdEdxPointsReject = new TH1F("gPrimaryProtonsNumberOfTPCdEdxPointsReject","",100,0,200);
2621   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsNumberOfTPCdEdxPointsReject);
2622   /*TH2F *gHistPrimaryProtonsDCAxyPtReject = new TH2F("gHistPrimaryProtonsDCAxyPtReject",
2623                                                     ";P_{T} [GeV/c];dca_{xy} [cm]",
2624                                                     16,0.3,1.1,
2625                                                     1000,0,10);
2626   gHistPrimaryProtonsDCAxyPtReject->SetStats(kFALSE);
2627   fQAPrimaryProtonsRejectedList->Add(gHistPrimaryProtonsDCAxyPtReject);
2628   TH2F *gHistPrimaryProtonsDCAzPtReject = new TH2F("gHistPrimaryProtonsDCAzPtReject",
2629                                                    ";P_{T} [GeV/c];dca_{z} [cm]",
2630                                                    16,0.3,1.1,
2631                                                    1000,0,10);
2632   gHistPrimaryProtonsDCAzPtReject->SetStats(kFALSE);
2633   fQAPrimaryProtonsRejectedList->Add(gHistPrimaryProtonsDCAzPtReject);*/
2634
2635   //________________________________________________________________//
2636   /*gDirectory->cd("../../");
2637
2638   TDirectory *dirProtonsSecondary = gDirectory->mkdir("Secondaries");
2639   dirProtonsSecondary->cd();
2640   TDirectory *dirProtonsSecondaryAccepted = gDirectory->mkdir("Accepted");
2641   dirProtonsSecondaryAccepted->cd();*/
2642
2643   //Accepted secondary protons
2644   TH1F *gSecondaryProtonsITSClustersPass = new TH1F("gSecondaryProtonsITSClustersPass",
2645                                                     ";N_{clusters} (ITS);Entries",
2646                                                     7,0,7);
2647   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsITSClustersPass);
2648   TH1F *gSecondaryProtonsChi2PerClusterITSPass = new TH1F("gSecondaryProtonsChi2PerClusterITSPass",
2649                                                           ";x^{2}/N_{clusters} (ITS);Entries",
2650                                                           100,0,4);
2651   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsChi2PerClusterITSPass);
2652   TH1F *gSecondaryProtonsTPCClustersPass = new TH1F("gSecondaryProtonsTPCClustersPass",
2653                                             ";N_{clusters} (TPC);Entries",
2654                                             100,0,200);
2655   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsTPCClustersPass);
2656   TH1F *gSecondaryProtonsChi2PerClusterTPCPass = new TH1F("gSecondaryProtonsChi2PerClusterTPCPass",
2657                                                   ";x^{2}/N_{clusters} (TPC);Entries",
2658                                                   100,0,4);
2659   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsChi2PerClusterTPCPass);
2660   TH1F *gSecondaryProtonsExtCov11Pass = new TH1F("gSecondaryProtonsExtCov11Pass",
2661                                          ";#sigma_{y} [cm];Entries",
2662                                          100,0,4);
2663   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov11Pass);
2664   TH1F *gSecondaryProtonsExtCov22Pass = new TH1F("gSecondaryProtonsExtCov22Pass",
2665                                          ";#sigma_{z} [cm];Entries",
2666                                          100,0,4);
2667   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov22Pass);
2668   TH1F *gSecondaryProtonsExtCov33Pass = new TH1F("gSecondaryProtonsExtCov33Pass",
2669                                          ";#sigma_{sin(#phi)};Entries",
2670                                          100,0,4);
2671   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov33Pass);
2672   TH1F *gSecondaryProtonsExtCov44Pass = new TH1F("gSecondaryProtonsExtCov44Pass",
2673                                          ";#sigma_{tan(#lambda)};Entries",
2674                                          100,0,4);
2675   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov44Pass);
2676   TH1F *gSecondaryProtonsExtCov55Pass = new TH1F("gSecondaryProtonsExtCov55Pass",
2677                                          ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2678                                          100,0,4);
2679   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov55Pass);
2680   TH1F *gSecondaryProtonsSigmaToVertexPass = new TH1F("gSecondaryProtonsSigmaToVertexPass",
2681                                              ";#sigma_{Vertex};Entries",
2682                                              100,0,10);
2683   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsSigmaToVertexPass);
2684   TH1F *gSecondaryProtonsSigmaToVertexTPCPass = new TH1F("gSecondaryProtonsSigmaToVertexTPCPass",
2685                                              ";#sigma_{Vertex};Entries",
2686                                              100,0,10);
2687   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsSigmaToVertexTPCPass);
2688   TH1F *gSecondaryProtonsDCAXYPass = new TH1F("gSecondaryProtonsDCAXYPass",
2689                                               ";DCA_{xy} [cm];Entries",
2690                                               100,0,20);
2691   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsDCAXYPass);
2692   TH1F *gSecondaryProtonsDCAXYTPCPass = new TH1F("gSecondaryProtonsDCAXYTPCPass",
2693                                                  ";DCA_{xy} [cm];Entries",
2694                                                  100,0,20);
2695   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsDCAXYTPCPass);
2696   TH1F *gSecondaryProtonsDCAZPass = new TH1F("gSecondaryProtonsDCAZPass",
2697                                              ";DCA_{z} [cm];Entries",
2698                                              100,0,20);
2699   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsDCAZPass);
2700   TH1F *gSecondaryProtonsDCAZTPCPass = new TH1F("gSecondaryProtonsDCAZTPCPass",
2701                                                 ";DCA_{z} [cm];Entries",
2702                                                 100,0,20);
2703   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsDCAZTPCPass);
2704   TH1F *gSecondaryProtonsConstrainChi2Pass = new TH1F("gSecondaryProtonsConstrainChi2Pass",
2705                                                     ";Log_{10}(#chi^{2});Entries",
2706                                                     100,-10,10);
2707   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsConstrainChi2Pass);
2708   TH1F *gSecondaryProtonsITSRefitPass = new TH1F("gSecondaryProtonsITSRefitPass",
2709                                                  "",10,-1,1);
2710   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsITSRefitPass);
2711   TH1F *gSecondaryProtonsTPCRefitPass = new TH1F("gSecondaryProtonsTPCRefitPass",
2712                                                  "",10,-1,1);
2713   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsTPCRefitPass);
2714   TH1F *gSecondaryProtonsESDpidPass = new TH1F("gSecondaryProtonsESDpidPass",
2715                                                "",10,-1,1);
2716   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsESDpidPass);
2717   TH1F *gSecondaryProtonsTPCpidPass = new TH1F("gSecondaryProtonsTPCpidPass",
2718                                                "",10,-1,1);
2719   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsTPCpidPass);
2720   TH1F *gSecondaryProtonsPointOnITSLayer1Pass = new TH1F("gSecondaryProtonsPointOnITSLayer1Pass",
2721                                                          "",10,-1,1);
2722   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer1Pass);
2723   TH1F *gSecondaryProtonsPointOnITSLayer2Pass = new TH1F("gSecondaryProtonsPointOnITSLayer2Pass",
2724                                                          "",10,-1,1);
2725   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer2Pass);
2726   TH1F *gSecondaryProtonsPointOnITSLayer3Pass = new TH1F("gSecondaryProtonsPointOnITSLayer3Pass",
2727                                                          "",10,-1,1);
2728   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer3Pass);
2729   TH1F *gSecondaryProtonsPointOnITSLayer4Pass = new TH1F("gSecondaryProtonsPointOnITSLayer4Pass",
2730                                                          "",10,-1,1);
2731   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer4Pass);
2732   TH1F *gSecondaryProtonsPointOnITSLayer5Pass = new TH1F("gSecondaryProtonsPointOnITSLayer5Pass",
2733                                                          "",10,-1,1);
2734   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer5Pass);
2735   TH1F *gSecondaryProtonsPointOnITSLayer6Pass = new TH1F("gSecondaryProtonsPointOnITSLayer6Pass",
2736                                                          "",10,-1,1);
2737   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer6Pass);
2738   TH1F *gSecondaryProtonsNumberOfTPCdEdxPointsPass = new TH1F("gSecondaryProtonsNumberOfTPCdEdxPointsPass","",100,0,200);
2739   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsNumberOfTPCdEdxPointsPass);
2740
2741   //Rejected secondary protons
2742   /*gDirectory->cd("../");
2743   TDirectory *dirProtonsSecondaryRejected = gDirectory->mkdir("Rejected");
2744   dirProtonsSecondaryRejected->cd();*/
2745
2746   TH1F *gSecondaryProtonsITSClustersReject = new TH1F("gSecondaryProtonsITSClustersReject",
2747                                                       ";N_{clusters} (ITS);Entries",
2748                                                       7,0,7);
2749   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsITSClustersReject);
2750   TH1F *gSecondaryProtonsChi2PerClusterITSReject = new TH1F("gSecondaryProtonsChi2PerClusterITSReject",
2751                                                             ";x^{2}/N_{clusters} (ITS);Entries",
2752                                                             100,0,4);
2753   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsChi2PerClusterITSReject);
2754   TH1F *gSecondaryProtonsTPCClustersReject = new TH1F("gSecondaryProtonsTPCClustersReject",
2755                                             ";N_{clusters} (TPC);Entries",
2756                                             100,0,200);
2757   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsTPCClustersReject);
2758   TH1F *gSecondaryProtonsChi2PerClusterTPCReject = new TH1F("gSecondaryProtonsChi2PerClusterTPCReject",
2759                                                   ";x^{2}/N_{clusters} (TPC);Entries",
2760                                                   100,0,4);
2761   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsChi2PerClusterTPCReject);
2762   TH1F *gSecondaryProtonsExtCov11Reject = new TH1F("gSecondaryProtonsExtCov11Reject",
2763                                          ";#sigma_{y} [cm];Entries",
2764                                          100,0,4);
2765   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov11Reject);
2766   TH1F *gSecondaryProtonsExtCov22Reject = new TH1F("gSecondaryProtonsExtCov22Reject",
2767                                          ";#sigma_{z} [cm];Entries",
2768                                          100,0,4);
2769   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov22Reject);
2770   TH1F *gSecondaryProtonsExtCov33Reject = new TH1F("gSecondaryProtonsExtCov33Reject",
2771                                          ";#sigma_{sin(#phi)};Entries",
2772                                          100,0,4);
2773   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov33Reject);
2774   TH1F *gSecondaryProtonsExtCov44Reject = new TH1F("gSecondaryProtonsExtCov44Reject",
2775                                          ";#sigma_{tan(#lambda)};Entries",
2776                                          100,0,4);
2777   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov44Reject);
2778   TH1F *gSecondaryProtonsExtCov55Reject = new TH1F("gSecondaryProtonsExtCov55Reject",
2779                                          ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2780                                          100,0,4);
2781   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov55Reject);
2782   TH1F *gSecondaryProtonsSigmaToVertexReject = new TH1F("gSecondaryProtonsSigmaToVertexReject",
2783                                              ";#sigma_{Vertex};Entries",
2784                                              100,0,10);
2785   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsSigmaToVertexReject);
2786   TH1F *gSecondaryProtonsSigmaToVertexTPCReject = new TH1F("gSecondaryProtonsSigmaToVertexTPCReject",
2787                                                            ";#sigma_{Vertex};Entries",
2788                                                            100,0,10);
2789   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsSigmaToVertexTPCReject);
2790   TH1F *gSecondaryProtonsDCAXYReject = new TH1F("gSecondaryProtonsDCAXYReject",
2791                                                 ";DCA_{xy} [cm];Entries",
2792                                                 100,0,20);
2793   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsDCAXYReject);
2794   TH1F *gSecondaryProtonsDCAXYTPCReject = new TH1F("gSecondaryProtonsDCAXYTPCReject",
2795                                                    ";DCA_{xy} [cm];Entries",
2796                                                    100,0,20);
2797   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsDCAXYTPCReject);
2798   TH1F *gSecondaryProtonsDCAZReject = new TH1F("gSecondaryProtonsDCAZReject",
2799                                                ";DCA_{z} [cm];Entries",
2800                                                100,0,20);
2801   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsDCAZReject);
2802   TH1F *gSecondaryProtonsDCAZTPCReject = new TH1F("gSecondaryProtonsDCAZTPCReject",
2803                                                   ";DCA_{z} [cm];Entries",
2804                                                   100,0,20);
2805   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsDCAZTPCReject);
2806   TH1F *gSecondaryProtonsConstrainChi2Reject = new TH1F("gSecondaryProtonsConstrainChi2Reject",
2807                                                         ";Log_{10}(#chi^{2});Entries",
2808                                                         100,-10,10);
2809   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsConstrainChi2Reject);
2810   TH1F *gSecondaryProtonsITSRefitReject = new TH1F("gSecondaryProtonsITSRefitReject",
2811                                                    "",10,-1,1);
2812   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsITSRefitReject);
2813   TH1F *gSecondaryProtonsTPCRefitReject = new TH1F("gSecondaryProtonsTPCRefitReject",
2814                                                    "",10,-1,1);
2815   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsTPCRefitReject);
2816   TH1F *gSecondaryProtonsESDpidReject = new TH1F("gSecondaryProtonsESDpidReject",
2817                                                  "",10,-1,1);
2818   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsESDpidReject);
2819   TH1F *gSecondaryProtonsTPCpidReject = new TH1F("gSecondaryProtonsTPCpidReject",
2820                                                  "",10,-1,1);
2821   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsTPCpidReject);
2822   TH1F *gSecondaryProtonsPointOnITSLayer1Reject = new TH1F("gSecondaryProtonsPointOnITSLayer1Reject",
2823                                                            "",10,-1,1);
2824   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer1Reject);
2825   TH1F *gSecondaryProtonsPointOnITSLayer2Reject = new TH1F("gSecondaryProtonsPointOnITSLayer2Reject",
2826                                                            "",10,-1,1);
2827   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer2Reject);
2828   TH1F *gSecondaryProtonsPointOnITSLayer3Reject = new TH1F("gSecondaryProtonsPointOnITSLayer3Reject",
2829                                                            "",10,-1,1);
2830   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer3Reject);
2831   TH1F *gSecondaryProtonsPointOnITSLayer4Reject = new TH1F("gSecondaryProtonsPointOnITSLayer4Reject",
2832                                                            "",10,-1,1);
2833   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer4Reject);
2834   TH1F *gSecondaryProtonsPointOnITSLayer5Reject = new TH1F("gSecondaryProtonsPointOnITSLayer5Reject",
2835                                                            "",10,-1,1);
2836   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer5Reject);
2837   TH1F *gSecondaryProtonsPointOnITSLayer6Reject = new TH1F("gSecondaryProtonsPointOnITSLayer6Reject",
2838                                                            "",10,-1,1);
2839   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer6Reject);
2840   TH1F *gSecondaryProtonsNumberOfTPCdEdxPointsReject = new TH1F("gSecondaryProtonsNumberOfTPCdEdxPointsReject","",100,0,200);
2841   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsNumberOfTPCdEdxPointsReject);  
2842   /*TH2F *gHistSecondaryProtonsFromWeakDCAxyPtReject = new TH2F("gHistSecondaryProtonsFromWeakDCAxyPtReject",
2843                                                               ";P_{T} [GeV/c];dca_{xy} [cm]",
2844                                                               16,0.3,1.1,
2845                                                               1000,0,10);
2846   gHistSecondaryProtonsFromWeakDCAxyPtReject->SetStats(kFALSE);
2847   fQASecondaryProtonsRejectedList->Add(gHistSecondaryProtonsFromWeakDCAxyPtReject);
2848   TH2F *gHistSecondaryProtonsFromWeakDCAzPtReject = new TH2F("gHistSecondaryProtonsFromWeakDCAzPtReject",
2849                                                              ";P_{T} [GeV/c];dca_{z} [cm]",
2850                                                              16,0.3,1.1,
2851                                                              1000,0,10);
2852   gHistSecondaryProtonsFromWeakDCAzPtReject->SetStats(kFALSE);
2853   fQASecondaryProtonsRejectedList->Add(gHistSecondaryProtonsFromWeakDCAzPtReject);
2854   TH2F *gHistSecondaryProtonsFromHadronicDCAxyPtReject = new TH2F("gHistSecondaryProtonsFromHadronicDCAxyPtReject",
2855                                                                   ";P_{T} [GeV/c];dca_{xy} [cm]",
2856                                                                   16,0.3,1.1,
2857                                                                   1000,0,10);
2858   gHistSecondaryProtonsFromHadronicDCAxyPtReject->SetStats(kFALSE);
2859   fQASecondaryProtonsRejectedList->Add(gHistSecondaryProtonsFromHadronicDCAxyPtReject);
2860   TH2F *gHistSecondaryProtonsFromHadronicDCAzPtReject = new TH2F("gHistSecondaryProtonsFromHadronicDCAzPtReject",
2861                                                                  ";P_{T} [GeV/c];dca_{z} [cm]",
2862                                                                  16,0.3,1.1,
2863                                                                  1000,0,10);
2864   gHistSecondaryProtonsFromHadronicDCAzPtReject->SetStats(kFALSE);
2865   fQASecondaryProtonsRejectedList->Add(gHistSecondaryProtonsFromHadronicDCAzPtReject);*/
2866
2867   /*gDirectory->cd("../../../");
2868
2869   //antiprotons
2870   TDirectory *dirAntiProtons = gDirectory->mkdir("AntiProtons");
2871   fGlobalQAList->Add(dirAntiProtons); dirAntiProtons->cd();*/
2872   
2873   //________________________________________________________________//
2874   /*TDirectory *dirAntiProtonsPrimary = gDirectory->mkdir("Primaries");
2875   dirAntiProtonsPrimary->cd();
2876   TDirectory *dirAntiProtonsPrimaryAccepted = gDirectory->mkdir("Accepted");
2877   dirAntiProtonsPrimaryAccepted->cd();*/
2878   
2879   //Accepted primary antiprotons
2880   TH1F *gPrimaryAntiProtonsITSClustersPass = new TH1F("gPrimaryAntiProtonsITSClustersPass",
2881                                                       ";N_{clusters} (ITS);Entries",
2882                                                       7,0,7);
2883   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsITSClustersPass);
2884   TH1F *gPrimaryAntiProtonsChi2PerClusterITSPass = new TH1F("gPrimaryAntiProtonsChi2PerClusterITSPass",
2885                                                             ";x^{2}/N_{clusters} (ITS);Entries",
2886                                                             100,0,4);
2887   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsChi2PerClusterITSPass);
2888   TH1F *gPrimaryAntiProtonsTPCClustersPass = new TH1F("gPrimaryAntiProtonsTPCClustersPass",
2889                                                       ";N_{clusters} (TPC);Entries",
2890                                                       100,0,200);
2891   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsTPCClustersPass);
2892   TH1F *gPrimaryAntiProtonsChi2PerClusterTPCPass = new TH1F("gPrimaryAntiProtonsChi2PerClusterTPCPass",
2893                                                             ";x^{2}/N_{clusters} (TPC);Entries",
2894                                                             100,0,4);
2895   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsChi2PerClusterTPCPass);
2896   TH1F *gPrimaryAntiProtonsExtCov11Pass = new TH1F("gPrimaryAntiProtonsExtCov11Pass",
2897                                                    ";#sigma_{y} [cm];Entries",
2898                                                    100,0,4);
2899   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov11Pass);
2900   TH1F *gPrimaryAntiProtonsExtCov22Pass = new TH1F("gPrimaryAntiProtonsExtCov22Pass",
2901                                                    ";#sigma_{z} [cm];Entries",
2902                                                    100,0,4);
2903   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov22Pass);
2904   TH1F *gPrimaryAntiProtonsExtCov33Pass = new TH1F("gPrimaryAntiProtonsExtCov33Pass",
2905                                                    ";#sigma_{sin(#phi)};Entries",
2906                                                    100,0,4);
2907   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov33Pass);
2908   TH1F *gPrimaryAntiProtonsExtCov44Pass = new TH1F("gPrimaryAntiProtonsExtCov44Pass",
2909                                                    ";#sigma_{tan(#lambda)};Entries",
2910                                                    100,0,4);
2911   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov44Pass);
2912   TH1F *gPrimaryAntiProtonsExtCov55Pass = new TH1F("gPrimaryAntiProtonsExtCov55Pass",
2913                                                    ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2914                                                    100,0,4);
2915   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov55Pass);
2916   TH1F *gPrimaryAntiProtonsSigmaToVertexPass = new TH1F("gPrimaryAntiProtonsSigmaToVertexPass",
2917                                                         ";#sigma_{Vertex};Entries",
2918                                                         100,0,10);
2919   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsSigmaToVertexPass);
2920   TH1F *gPrimaryAntiProtonsSigmaToVertexTPCPass = new TH1F("gPrimaryAntiProtonsSigmaToVertexTPCPass",
2921                                                            ";#sigma_{Vertex};Entries",
2922                                                            100,0,10);
2923   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsSigmaToVertexTPCPass);
2924   TH1F *gPrimaryAntiProtonsDCAXYPass = new TH1F("gPrimaryAntiProtonsDCAXYPass",
2925                                                 ";DCA_{xy} [cm];Entries",
2926                                                 100,0,20);
2927   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsDCAXYPass);
2928   TH1F *gPrimaryAntiProtonsDCAXYTPCPass = new TH1F("gPrimaryAntiProtonsDCAXYTPCPass",
2929                                                    ";DCA_{xy} [cm];Entries",
2930                                                    100,0,20);
2931   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsDCAXYTPCPass);
2932   TH1F *gPrimaryAntiProtonsDCAZPass = new TH1F("gPrimaryAntiProtonsDCAZPass",
2933                                                ";DCA_{z} [cm];Entries",
2934                                                100,0,20);
2935   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsDCAZPass);
2936   TH1F *gPrimaryAntiProtonsDCAZTPCPass = new TH1F("gPrimaryAntiProtonsDCAZTPCPass",
2937                                                   ";DCA_{z} [cm];Entries",
2938                                                   100,0,20);
2939   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsDCAZTPCPass);
2940   TH1F *gPrimaryAntiProtonsConstrainChi2Pass = new TH1F("gPrimaryAntiProtonsConstrainChi2Pass",
2941                                                         ";Log_{10}(#chi^{2});Entries",
2942                                                         100,-10,10);
2943   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsConstrainChi2Pass);
2944   TH1F *gPrimaryAntiProtonsITSRefitPass = new TH1F("gPrimaryAntiProtonsITSRefitPass",
2945                                                    "",10,-1,1);
2946   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsITSRefitPass);
2947   TH1F *gPrimaryAntiProtonsTPCRefitPass = new TH1F("gPrimaryAntiProtonsTPCRefitPass",
2948                                                    "",10,-1,1);
2949   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsTPCRefitPass);
2950   TH1F *gPrimaryAntiProtonsESDpidPass = new TH1F("gPrimaryAntiProtonsESDpidPass",
2951                                                  "",10,-1,1);
2952   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsESDpidPass);
2953   TH1F *gPrimaryAntiProtonsTPCpidPass = new TH1F("gPrimaryAntiProtonsTPCpidPass",
2954                                                  "",10,-1,1);
2955   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsTPCpidPass);
2956   TH1F *gPrimaryAntiProtonsPointOnITSLayer1Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer1Pass",
2957                                                            "",10,-1,1);
2958   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer1Pass);
2959   TH1F *gPrimaryAntiProtonsPointOnITSLayer2Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer2Pass",
2960                                                            "",10,-1,1);
2961   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer2Pass);
2962   TH1F *gPrimaryAntiProtonsPointOnITSLayer3Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer3Pass",
2963                                                            "",10,-1,1);
2964   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer3Pass);
2965   TH1F *gPrimaryAntiProtonsPointOnITSLayer4Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer4Pass",
2966                                                            "",10,-1,1);
2967   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer4Pass);
2968   TH1F *gPrimaryAntiProtonsPointOnITSLayer5Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer5Pass",
2969                                                            "",10,-1,1);
2970   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer5Pass);
2971   TH1F *gPrimaryAntiProtonsPointOnITSLayer6Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer6Pass",
2972                                                            "",10,-1,1);
2973   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer6Pass);
2974   TH1F *gPrimaryAntiProtonsNumberOfTPCdEdxPointsPass = new TH1F("gPrimaryAntiProtonsNumberOfTPCdEdxPointsPass","",100,0,200);
2975   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsNumberOfTPCdEdxPointsPass);
2976   /*TH2F *gHistPrimaryAntiProtonsDCAxyPtPass = new TH2F("gHistPrimaryAntiProtonsDCAxyPtPass",
2977                                                       ";P_{T} [GeV/c];dca_{xy} [cm]",
2978                                                       16,0.3,1.1,
2979                                                       1000,0,10);
2980   gHistPrimaryAntiProtonsDCAxyPtPass->SetStats(kFALSE);
2981   fQAPrimaryAntiProtonsAcceptedList->Add(gHistPrimaryAntiProtonsDCAxyPtPass);
2982   TH2F *gHistPrimaryAntiProtonsDCAzPtPass = new TH2F("gHistPrimaryAntiProtonsDCAzPtPass",
2983                                                      ";P_{T} [GeV/c];dca_{z} [cm]",
2984                                                      16,0.3,1.1,
2985                                                      1000,0,10);
2986   gHistPrimaryAntiProtonsDCAzPtPass->SetStats(kFALSE);
2987   fQAPrimaryAntiProtonsAcceptedList->Add(gHistPrimaryAntiProtonsDCAzPtPass);*/
2988
2989   //Rejected primary antiprotons
2990   /*gDirectory->cd("../");
2991   TDirectory *dirAntiProtonsPrimaryRejected = gDirectory->mkdir("Rejected");
2992   dirAntiProtonsPrimaryRejected->cd();*/
2993   
2994   TH1F *gPrimaryAntiProtonsITSClustersReject = new TH1F("gPrimaryAntiProtonsITSClustersReject",
2995                                                         ";N_{clusters} (ITS);Entries",
2996                                                         7,0,7);
2997   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsITSClustersReject);
2998   TH1F *gPrimaryAntiProtonsChi2PerClusterITSReject = new TH1F("gPrimaryAntiProtonsChi2PerClusterITSReject",
2999                                                               ";x^{2}/N_{clusters} (ITS);Entries",
3000                                                               100,0,4);
3001   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsChi2PerClusterITSReject);
3002   TH1F *gPrimaryAntiProtonsTPCClustersReject = new TH1F("gPrimaryAntiProtonsTPCClustersReject",
3003                                                         ";N_{clusters} (TPC);Entries",
3004                                                         100,0,200);
3005   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsTPCClustersReject);
3006   TH1F *gPrimaryAntiProtonsChi2PerClusterTPCReject = new TH1F("gPrimaryAntiProtonsChi2PerClusterTPCReject",
3007                                                               ";x^{2}/N_{clusters} (TPC);Entries",
3008                                                               100,0,4);
3009   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsChi2PerClusterTPCReject);
3010   TH1F *gPrimaryAntiProtonsExtCov11Reject = new TH1F("gPrimaryAntiProtonsExtCov11Reject",
3011                                                      ";#sigma_{y} [cm];Entries",
3012                                                      100,0,4);
3013   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov11Reject);
3014   TH1F *gPrimaryAntiProtonsExtCov22Reject = new TH1F("gPrimaryAntiProtonsExtCov22Reject",
3015                                                      ";#sigma_{z} [cm];Entries",
3016                                                      100,0,4);
3017   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov22Reject);
3018   TH1F *gPrimaryAntiProtonsExtCov33Reject = new TH1F("gPrimaryAntiProtonsExtCov33Reject",
3019                                                      ";#sigma_{sin(#phi)};Entries",
3020                                                      100,0,4);
3021   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov33Reject);
3022   TH1F *gPrimaryAntiProtonsExtCov44Reject = new TH1F("gPrimaryAntiProtonsExtCov44Reject",
3023                                                      ";#sigma_{tan(#lambda)};Entries",
3024                                                      100,0,4);
3025   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov44Reject);
3026   TH1F *gPrimaryAntiProtonsExtCov55Reject = new TH1F("gPrimaryAntiProtonsExtCov55Reject",
3027                                                      ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
3028                                                      100,0,4);
3029   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov55Reject);
3030   TH1F *gPrimaryAntiProtonsSigmaToVertexReject = new TH1F("gPrimaryAntiProtonsSigmaToVertexReject",
3031                                                           ";#sigma_{Vertex};Entries",
3032                                                           100,0,10);
3033   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsSigmaToVertexReject);
3034   TH1F *gPrimaryAntiProtonsSigmaToVertexTPCReject = new TH1F("gPrimaryAntiProtonsSigmaToVertexTPCReject",
3035                                                              ";#sigma_{Vertex};Entries",
3036                                                              100,0,10);
3037   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsSigmaToVertexTPCReject);
3038   TH1F *gPrimaryAntiProtonsDCAXYReject = new TH1F("gPrimaryAntiProtonsDCAXYReject",
3039                                                   ";DCA_{xy} [cm];Entries",
3040                                                   100,0,20);
3041   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsDCAXYReject);
3042   TH1F *gPrimaryAntiProtonsDCAXYTPCReject = new TH1F("gPrimaryAntiProtonsDCAXYTPCReject",
3043                                                      ";DCA_{xy} [cm];Entries",
3044                                                      100,0,20);
3045   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsDCAXYTPCReject);
3046   TH1F *gPrimaryAntiProtonsDCAZReject = new TH1F("gPrimaryAntiProtonsDCAZReject",
3047                                                  ";DCA_{z} [cm];Entries",
3048                                                  100,0,20);
3049   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsDCAZReject);
3050   TH1F *gPrimaryAntiProtonsDCAZTPCReject = new TH1F("gPrimaryAntiProtonsDCAZTPCReject",
3051                                                     ";DCA_{z} [cm];Entries",
3052                                                     100,0,20);
3053   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsDCAZTPCReject);
3054   TH1F *gPrimaryAntiProtonsConstrainChi2Reject = new TH1F("gPrimaryAntiProtonsConstrainChi2Reject",
3055                                                           ";Log_{10}(#chi^{2});Entries",
3056                                                           100,-10,10);
3057   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsConstrainChi2Reject);
3058   TH1F *gPrimaryAntiProtonsITSRefitReject = new TH1F("gPrimaryAntiProtonsITSRefitReject",
3059                                                      "",10,-1,1);
3060   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsITSRefitReject);
3061   TH1F *gPrimaryAntiProtonsTPCRefitReject = new TH1F("gPrimaryAntiProtonsTPCRefitReject",
3062                                                      "",10,-1,1);
3063   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsTPCRefitReject);
3064   TH1F *gPrimaryAntiProtonsESDpidReject = new TH1F("gPrimaryAntiProtonsESDpidReject",
3065                                                    "",10,-1,1);
3066   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsESDpidReject);
3067   TH1F *gPrimaryAntiProtonsTPCpidReject = new TH1F("gPrimaryAntiProtonsTPCpidReject",
3068                                                    "",10,-1,1);
3069   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsTPCpidReject);
3070   TH1F *gPrimaryAntiProtonsPointOnITSLayer1Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer1Reject",
3071                                                              "",10,-1,1);
3072   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer1Reject);
3073   TH1F *gPrimaryAntiProtonsPointOnITSLayer2Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer2Reject",
3074                                                              "",10,-1,1);
3075   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer2Reject);
3076   TH1F *gPrimaryAntiProtonsPointOnITSLayer3Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer3Reject",
3077                                                              "",10,-1,1);
3078   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer3Reject);
3079   TH1F *gPrimaryAntiProtonsPointOnITSLayer4Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer4Reject",
3080                                                              "",10,-1,1);
3081   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer4Reject);
3082   TH1F *gPrimaryAntiProtonsPointOnITSLayer5Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer5Reject",
3083                                                              "",10,-1,1);
3084   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer5Reject);
3085   TH1F *gPrimaryAntiProtonsPointOnITSLayer6Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer6Reject",
3086                                                              "",10,-1,1);
3087   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer6Reject);
3088   TH1F *gPrimaryAntiProtonsNumberOfTPCdEdxPointsReject = new TH1F("gPrimaryAntiProtonsNumberOfTPCdEdxPointsReject","",100,0,200);
3089   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsNumberOfTPCdEdxPointsReject);
3090   /*TH2F *gHistPrimaryAntiProtonsDCAxyPtReject = new TH2F("gHistPrimaryAntiProtonsDCAxyPtReject",
3091                                                         ";P_{T} [GeV/c];dca_{xy} [cm]",
3092                                                         16,0.3,1.1,
3093                                                         1000,0,10);
3094   gHistPrimaryAntiProtonsDCAxyPtReject->SetStats(kFALSE);
3095   fQAPrimaryAntiProtonsRejectedList->Add(gHistPrimaryAntiProtonsDCAxyPtReject);
3096   TH2F *gHistPrimaryAntiProtonsDCAzPtReject = new TH2F("gHistPrimaryAntiProtonsDCAzPtReject",
3097                                                        ";P_{T} [GeV/c];dca_{z} [cm]",
3098                                                        16,0.3,1.1,
3099                                                        1000,0,10);
3100   gHistPrimaryAntiProtonsDCAzPtReject->SetStats(kFALSE);
3101   fQAPrimaryAntiProtonsRejectedList->Add(gHistPrimaryAntiProtonsDCAzPtReject);*/
3102   
3103   //________________________________________________________________//
3104   /*gDirectory->cd("../../");
3105
3106   TDirectory *dirAntiProtonsSecondary = gDirectory->mkdir("Secondaries");
3107   dirAntiProtonsSecondary->cd();
3108   TDirectory *dirAntiProtonsSecondaryAccepted = gDirectory->mkdir("Accepted");
3109   dirAntiProtonsSecondaryAccepted->cd();*/
3110
3111   //Accepted secondary antiprotons
3112   TH1F *gSecondaryAntiProtonsITSClustersPass = new TH1F("gSecondaryAntiProtonsITSClustersPass",
3113                                                         ";N_{clusters} (ITS);Entries",
3114                                                         7,0,7);
3115   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsITSClustersPass);
3116   TH1F *gSecondaryAntiProtonsChi2PerClusterITSPass = new TH1F("gSecondaryAntiProtonsChi2PerClusterITSPass",
3117                                                               ";x^{2}/N_{clusters} (ITS);Entries",
3118                                                               100,0,4);
3119   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsChi2PerClusterITSPass);
3120   TH1F *gSecondaryAntiProtonsTPCClustersPass = new TH1F("gSecondaryAntiProtonsTPCClustersPass",
3121                                                         ";N_{clusters} (TPC);Entries",
3122                                                         100,0,200);
3123   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsTPCClustersPass);
3124   TH1F *gSecondaryAntiProtonsChi2PerClusterTPCPass = new TH1F("gSecondaryAntiProtonsChi2PerClusterTPCPass",
3125                                                               ";x^{2}/N_{clusters} (TPC);Entries",
3126                                                               100,0,4);
3127   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsChi2PerClusterTPCPass);
3128   TH1F *gSecondaryAntiProtonsExtCov11Pass = new TH1F("gSecondaryAntiProtonsExtCov11Pass",
3129                                                      ";#sigma_{y} [cm];Entries",
3130                                                      100,0,4);
3131   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov11Pass);
3132   TH1F *gSecondaryAntiProtonsExtCov22Pass = new TH1F("gSecondaryAntiProtonsExtCov22Pass",
3133                                                      ";#sigma_{z} [cm];Entries",
3134                                                      100,0,4);
3135   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov22Pass);
3136   TH1F *gSecondaryAntiProtonsExtCov33Pass = new TH1F("gSecondaryAntiProtonsExtCov33Pass",
3137                                                      ";#sigma_{sin(#phi)};Entries",
3138                                                      100,0,4);
3139   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov33Pass);
3140   TH1F *gSecondaryAntiProtonsExtCov44Pass = new TH1F("gSecondaryAntiProtonsExtCov44Pass",
3141                                                      ";#sigma_{tan(#lambda)};Entries",
3142                                                      100,0,4);
3143   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov44Pass);
3144   TH1F *gSecondaryAntiProtonsExtCov55Pass = new TH1F("gSecondaryAntiProtonsExtCov55Pass",
3145                                                      ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
3146                                                      100,0,4);
3147   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov55Pass);
3148   TH1F *gSecondaryAntiProtonsSigmaToVertexPass = new TH1F("gSecondaryAntiProtonsSigmaToVertexPass",
3149                                                           ";#sigma_{Vertex};Entries",
3150                                                           100,0,10);
3151   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsSigmaToVertexPass);
3152   TH1F *gSecondaryAntiProtonsSigmaToVertexTPCPass = new TH1F("gSecondaryAntiProtonsSigmaToVertexTPCPass",
3153                                                              ";#sigma_{Vertex};Entries",
3154                                                              100,0,10);
3155   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsSigmaToVertexTPCPass);
3156   TH1F *gSecondaryAntiProtonsDCAXYPass = new TH1F("gSecondaryAntiProtonsDCAXYPass",
3157                                                   ";DCA_{xy} [cm];Entries",
3158                                                   100,0,20);
3159   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsDCAXYPass);
3160   TH1F *gSecondaryAntiProtonsDCAXYTPCPass = new TH1F("gSecondaryAntiProtonsDCAXYTPCPass",
3161                                                      ";DCA_{xy} [cm];Entries",
3162                                                      100,0,20);
3163   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsDCAXYTPCPass);
3164   TH1F *gSecondaryAntiProtonsDCAZPass = new TH1F("gSecondaryAntiProtonsDCAZPass",
3165                                                  ";DCA_{z} [cm];Entries",
3166                                                  100,0,20);
3167   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsDCAZPass);
3168   TH1F *gSecondaryAntiProtonsDCAZTPCPass = new TH1F("gSecondaryAntiProtonsDCAZTPCPass",
3169                                                     ";DCA_{z} [cm];Entries",
3170                                                     100,0,20);
3171   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsDCAZTPCPass);
3172   TH1F *gSecondaryAntiProtonsConstrainChi2Pass = new TH1F("gSecondaryAntiProtonsConstrainChi2Pass",
3173                                                           ";Log_{10}(#chi^{2});Entries",
3174                                                           100,-10,10);
3175   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsConstrainChi2Pass);
3176   TH1F *gSecondaryAntiProtonsITSRefitPass = new TH1F("gSecondaryAntiProtonsITSRefitPass",
3177                                                      "",10,-1,1);
3178   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsITSRefitPass);
3179   TH1F *gSecondaryAntiProtonsTPCRefitPass = new TH1F("gSecondaryAntiProtonsTPCRefitPass",
3180                                                      "",10,-1,1);
3181   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsTPCRefitPass);
3182   TH1F *gSecondaryAntiProtonsESDpidPass = new TH1F("gSecondaryAntiProtonsESDpidPass",
3183                                                    "",10,-1,1);
3184   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsESDpidPass);
3185   TH1F *gSecondaryAntiProtonsTPCpidPass = new TH1F("gSecondaryAntiProtonsTPCpidPass",
3186                                                    "",10,-1,1);
3187   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsTPCpidPass);
3188   TH1F *gSecondaryAntiProtonsPointOnITSLayer1Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer1Pass",
3189                                                              "",10,-1,1);
3190   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer1Pass);
3191   TH1F *gSecondaryAntiProtonsPointOnITSLayer2Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer2Pass",
3192                                                              "",10,-1,1);
3193   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer2Pass);
3194   TH1F *gSecondaryAntiProtonsPointOnITSLayer3Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer3Pass",
3195                                                              "",10,-1,1);
3196   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer3Pass);
3197   TH1F *gSecondaryAntiProtonsPointOnITSLayer4Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer4Pass",
3198                                                              "",10,-1,1);
3199   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer4Pass);
3200   TH1F *gSecondaryAntiProtonsPointOnITSLayer5Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer5Pass",
3201                                                              "",10,-1,1);
3202   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer5Pass);
3203   TH1F *gSecondaryAntiProtonsPointOnITSLayer6Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer6Pass",
3204                                                              "",10,-1,1);
3205   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer6Pass);
3206   TH1F *gSecondaryAntiProtonsNumberOfTPCdEdxPointsPass = new TH1F("gSecondaryAntiProtonsNumberOfTPCdEdxPointsPass","",100,0,200);
3207   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsNumberOfTPCdEdxPointsPass);
3208   /*TH2F *gHistSecondaryAntiProtonsFromWeakDCAxyPtPass = new TH2F("gHistSecondaryAntiProtonsFromWeakDCAxyPtPass",
3209                                                                 ";P_{T} [GeV/c];dca_{xy} [cm]",
3210                                                                 16,0.3,1.1,
3211                                                                 1000,0,10);
3212   gHistSecondaryAntiProtonsFromWeakDCAxyPtPass->SetStats(kFALSE);
3213   fQASecondaryAntiProtonsAcceptedList->Add(gHistSecondaryAntiProtonsFromWeakDCAxyPtPass);
3214   TH2F *gHistSecondaryAntiProtonsFromWeakDCAzPtPass = new TH2F("gHistSecondaryAntiProtonsFromWeakDCAzPtPass",
3215                                                                ";P_{T} [GeV/c];dca_{z} [cm]",
3216                                                                16,0.3,1.1,
3217                                                                1000,0,10);
3218   gHistSecondaryAntiProtonsFromWeakDCAzPtPass->SetStats(kFALSE);
3219   fQASecondaryAntiProtonsAcceptedList->Add(gHistSecondaryAntiProtonsFromWeakDCAzPtPass);
3220   TH2F *gHistSecondaryAntiProtonsFromHadronicDCAxyPtPass = new TH2F("gHistSecondaryAntiProtonsFromHadronicDCAxyPtPass",
3221                                                                     ";P_{T} [GeV/c];dca_{xy} [cm]",
3222                                                                     16,0.3,1.1,
3223                                                                     1000,0,10);
3224   gHistSecondaryAntiProtonsFromHadronicDCAxyPtPass->SetStats(kFALSE);
3225   fQASecondaryAntiProtonsAcceptedList->Add(gHistSecondaryAntiProtonsFromHadronicDCAxyPtPass);
3226   TH2F *gHistSecondaryAntiProtonsFromHadronicDCAzPtPass = new TH2F("gHistSecondaryAntiProtonsFromHadronicDCAzPtPass",
3227                                                                    ";P_{T} [GeV/c];dca_{z} [cm]",
3228                                                                    16,0.3,1.1,
3229                                                                    1000,0,10);
3230   gHistSecondaryAntiProtonsFromHadronicDCAzPtPass->SetStats(kFALSE);
3231   fQASecondaryAntiProtonsAcceptedList->Add(gHistSecondaryAntiProtonsFromHadronicDCAzPtPass);*/
3232   
3233   //Rejected secondary antiprotons
3234   /*gDirectory->cd("../");
3235   TDirectory *dirAntiProtonsSecondaryRejected = gDirectory->mkdir("Rejected");
3236   dirAntiProtonsSecondaryRejected->cd();*/
3237
3238   TH1F *gSecondaryAntiProtonsITSClustersReject = new TH1F("gSecondaryAntiProtonsITSClustersReject",
3239                                                           ";N_{clusters} (ITS);Entries",
3240                                                           7,0,7);
3241   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsITSClustersReject);
3242   TH1F *gSecondaryAntiProtonsChi2PerClusterITSReject = new TH1F("gSecondaryAntiProtonsChi2PerClusterITSReject",
3243                                                                 ";x^{2}/N_{clusters} (ITS);Entries",
3244                                                                 100,0,4);
3245   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsChi2PerClusterITSReject);
3246   TH1F *gSecondaryAntiProtonsTPCClustersReject = new TH1F("gSecondaryAntiProtonsTPCClustersReject",
3247                                                           ";N_{clusters} (TPC);Entries",
3248                                                           100,0,200);
3249   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsTPCClustersReject);
3250   TH1F *gSecondaryAntiProtonsChi2PerClusterTPCReject = new TH1F("gSecondaryAntiProtonsChi2PerClusterTPCReject",
3251                                                                 ";x^{2}/N_{clusters} (TPC);Entries",
3252                                                                 100,0,4);
3253   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsChi2PerClusterTPCReject);
3254   TH1F *gSecondaryAntiProtonsExtCov11Reject = new TH1F("gSecondaryAntiProtonsExtCov11Reject",
3255                                                        ";#sigma_{y} [cm];Entries",
3256                                                        100,0,4);
3257   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov11Reject);
3258   TH1F *gSecondaryAntiProtonsExtCov22Reject = new TH1F("gSecondaryAntiProtonsExtCov22Reject",
3259                                                        ";#sigma_{z} [cm];Entries",
3260                                                        100,0,4);
3261   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov22Reject);
3262   TH1F *gSecondaryAntiProtonsExtCov33Reject = new TH1F("gSecondaryAntiProtonsExtCov33Reject",
3263                                                        ";#sigma_{sin(#phi)};Entries",
3264                                                        100,0,4);
3265   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov33Reject);
3266   TH1F *gSecondaryAntiProtonsExtCov44Reject = new TH1F("gSecondaryAntiProtonsExtCov44Reject",
3267                                                        ";#sigma_{tan(#lambda)};Entries",
3268                                                        100,0,4);
3269   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov44Reject);
3270   TH1F *gSecondaryAntiProtonsExtCov55Reject = new TH1F("gSecondaryAntiProtonsExtCov55Reject",
3271                                                        ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
3272                                                        100,0,4);
3273   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov55Reject);
3274   TH1F *gSecondaryAntiProtonsSigmaToVertexReject = new TH1F("gSecondaryAntiProtonsSigmaToVertexReject",
3275                                                             ";#sigma_{Vertex};Entries",
3276                                                             100,0,10);
3277   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsSigmaToVertexReject);
3278   TH1F *gSecondaryAntiProtonsSigmaToVertexTPCReject = new TH1F("gSecondaryAntiProtonsSigmaToVertexTPCReject",
3279                                                                ";#sigma_{Vertex};Entries",
3280                                                                100,0,10);
3281   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsSigmaToVertexTPCReject);
3282   TH1F *gSecondaryAntiProtonsDCAXYReject = new TH1F("gSecondaryAntiProtonsDCAXYReject",
3283                                                     ";DCA_{xy} [cm];Entries",
3284                                                     100,0,20);
3285   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsDCAXYReject);
3286   TH1F *gSecondaryAntiProtonsDCAXYTPCReject = new TH1F("gSecondaryAntiProtonsDCAXYTPCReject",
3287                                                        ";DCA_{xy} [cm];Entries",
3288                                                        100,0,20);
3289   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsDCAXYTPCReject);
3290   TH1F *gSecondaryAntiProtonsDCAZReject = new TH1F("gSecondaryAntiProtonsDCAZReject",
3291                                                    ";DCA_{z} [cm];Entries",
3292                                                    100,0,20);
3293   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsDCAZReject);
3294   TH1F *gSecondaryAntiProtonsDCAZTPCReject = new TH1F("gSecondaryAntiProtonsDCAZTPCReject",
3295                                                       ";DCA_{z} [cm];Entries",
3296                                                       100,0,20);
3297   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsDCAZTPCReject);
3298   TH1F *gSecondaryAntiProtonsConstrainChi2Reject = new TH1F("gSecondaryAntiProtonsConstrainChi2Reject",
3299                                                             ";Log_{10}(#chi^{2});Entries",
3300                                                             100,-10,10);
3301   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsConstrainChi2Reject);
3302   TH1F *gSecondaryAntiProtonsITSRefitReject = new TH1F("gSecondaryAntiProtonsITSRefitReject",
3303                                                        "",10,-1,1);
3304   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsITSRefitReject);
3305   TH1F *gSecondaryAntiProtonsTPCRefitReject = new TH1F("gSecondaryAntiProtonsTPCRefitReject",
3306                                                        "",10,-1,1);
3307   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsTPCRefitReject);
3308   TH1F *gSecondaryAntiProtonsESDpidReject = new TH1F("gSecondaryAntiProtonsESDpidReject",
3309                                                      "",10,-1,1);
3310   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsESDpidReject);
3311   TH1F *gSecondaryAntiProtonsTPCpidReject = new TH1F("gSecondaryAntiProtonsTPCpidReject",
3312                                                      "",10,-1,1);
3313   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsTPCpidReject);
3314   TH1F *gSecondaryAntiProtonsPointOnITSLayer1Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer1Reject",
3315                                                              "",10,-1,1);
3316   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer1Reject);
3317   TH1F *gSecondaryAntiProtonsPointOnITSLayer2Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer2Reject",
3318                                                              "",10,-1,1);
3319   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer2Reject);
3320   TH1F *gSecondaryAntiProtonsPointOnITSLayer3Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer3Reject",
3321                                                              "",10,-1,1);
3322   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer3Reject);
3323   TH1F *gSecondaryAntiProtonsPointOnITSLayer4Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer4Reject",
3324                                                              "",10,-1,1);
3325   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer4Reject);
3326   TH1F *gSecondaryAntiProtonsPointOnITSLayer5Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer5Reject",
3327                                                              "",10,-1,1);
3328   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer5Reject);
3329   TH1F *gSecondaryAntiProtonsPointOnITSLayer6Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer6Reject",
3330                                                              "",10,-1,1);
3331   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer6Reject);
3332   TH1F *gSecondaryAntiProtonsNumberOfTPCdEdxPointsReject = new TH1F("gSecondaryAntiProtonsNumberOfTPCdEdxPointsReject","",100,0,200);
3333   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsNumberOfTPCdEdxPointsReject);
3334   /*TH2F *gHistSecondaryAntiProtonsFromWeakDCAxyPtReject = new TH2F("gHistSecondaryAntiProtonsFromWeakDCAxyPtReject",
3335                                                                   ";P_{T} [GeV/c];dca_{xy} [cm]",
3336                                                                   16,0.3,1.1,
3337                                                                   1000,0,10);
3338   gHistSecondaryAntiProtonsFromWeakDCAxyPtReject->SetStats(kFALSE);
3339   fQASecondaryAntiProtonsRejectedList->Add(gHistSecondaryAntiProtonsFromWeakDCAxyPtReject);
3340   TH2F *gHistSecondaryAntiProtonsFromWeakDCAzPtReject = new TH2F("gHistSecondaryAntiProtonsFromWeakDCAzPtReject",
3341                                                                  ";P_{T} [GeV/c];dca_{z} [cm]",
3342                                                                  16,0.3,1.1,
3343                                                                  1000,0,10);
3344   gHistSecondaryAntiProtonsFromWeakDCAzPtReject->SetStats(kFALSE);
3345   fQASecondaryAntiProtonsRejectedList->Add(gHistSecondaryAntiProtonsFromWeakDCAzPtReject);
3346   TH2F *gHistSecondaryAntiProtonsFromHadronicDCAxyPtReject = new TH2F("gHistSecondaryAntiProtonsFromHadronicDCAxyPtReject",
3347                                                                       ";P_{T} [GeV/c];dca_{xy} [cm]",
3348                                                                       16,0.3,1.1,
3349                                                                       1000,0,10);
3350   gHistSecondaryAntiProtonsFromHadronicDCAxyPtReject->SetStats(kFALSE);
3351   fQASecondaryAntiProtonsRejectedList->Add(gHistSecondaryAntiProtonsFromHadronicDCAxyPtReject);
3352   TH2F *gHistSecondaryAntiProtonsFromHadronicDCAzPtReject = new TH2F("gHistSecondaryAntiProtonsFromHadronicDCAzPtReject",
3353                                                                      ";P_{T} [GeV/c];dca_{z} [cm]",
3354                                                                      16,0.3,1.1,
3355                                                                      1000,0,10);
3356   gHistSecondaryAntiProtonsFromHadronicDCAzPtReject->SetStats(kFALSE);
3357   fQASecondaryAntiProtonsRejectedList->Add(gHistSecondaryAntiProtonsFromHadronicDCAzPtReject);*/
3358 }
3359
3360 //____________________________________________________________________//
3361 void AliProtonQAAnalysis::RunReconstructionEfficiencyAnalysis(AliMCEvent *const mcEvent, 
3362                                                               AliESDEvent *esd,
3363                                                               const AliESDVertex *vertex) {
3364   //Run the reconstruction efficiency code (primaries & secondaries)
3365   AliStack *stack = mcEvent->Stack();
3366
3367   Int_t nMCParticles = mcEvent->GetNumberOfTracks();
3368   Int_t nMCLabelCounter = 0;
3369   TArrayI labelMCArray(nMCParticles);
3370
3371   for (Int_t iTracks = 0; iTracks < mcEvent->GetNumberOfTracks(); iTracks++) {
3372     AliMCParticle *mcTrack = (AliMCParticle*) mcEvent->GetTrack(iTracks);
3373     if (!mcTrack) {
3374       Printf("ERROR: Could not receive track %d (mc loop)", iTracks);
3375       continue;
3376     }
3377
3378     Double_t vz = mcTrack->Zv();
3379     if (TMath::Abs(vz) > 50.) continue;//exclude particles generated out of the acceptance
3380
3381     if(TMath::Abs(mcTrack->Eta()) > 1.0) continue;//acceptance
3382     if((mcTrack->Pt() > fMaxPt)||(mcTrack->Pt() < fMinPt)) continue;
3383     if(fProtonAnalysisBase->GetEtaMode()) {
3384       if((mcTrack->Eta() > fMaxY)|| (mcTrack->Eta() < fMinY)) continue;
3385     }
3386     else 
3387       if((fProtonAnalysisBase->Rapidity(mcTrack->Px(),mcTrack->Py(),mcTrack->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(mcTrack->Px(),mcTrack->Py(),mcTrack->Pz()) < fMinY)) continue;
3388     
3389     // Loop over Track References
3390     Bool_t labelTPC = kFALSE;
3391     AliTrackReference* trackRef = 0;
3392     for (Int_t iTrackRef = 0; iTrackRef  < mcTrack->GetNumberOfTrackReferences(); iTrackRef++) {
3393       trackRef = mcTrack->GetTrackReference(iTrackRef);
3394       if(trackRef) {
3395         Int_t detectorId = trackRef->DetectorId(); 
3396         if (detectorId == AliTrackReference::kTPC) {        
3397           labelTPC = kTRUE;
3398           break;
3399         }
3400       }      
3401     }
3402
3403     //findable tracks
3404     //if (labelTPC) {
3405       TParticle* particle = mcTrack->Particle();
3406       if(!particle) continue;
3407       Int_t pdgcode = particle->GetPdgCode();
3408       if(TMath::Abs(pdgcode) != 2212) continue;
3409       
3410       labelMCArray.AddAt(iTracks,nMCLabelCounter);
3411       nMCLabelCounter += 1;
3412
3413       if(iTracks <= stack->GetNprimary()) {
3414         if(pdgcode == 2212) {
3415           if(fProtonAnalysisBase->GetEtaMode()) 
3416             ((TH2D *)(fEfficiencyList->At(0)))->Fill(particle->Eta(),
3417                                                      particle->Pt());
3418           else
3419             ((TH2D *)(fEfficiencyList->At(0)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3420                                                                                    particle->Py(),
3421                                                                                    particle->Pz()),
3422                                                      particle->Pt());
3423         }//protons
3424         if(pdgcode == -2212) {
3425           if(fProtonAnalysisBase->GetEtaMode()) 
3426             ((TH2D *)(fEfficiencyList->At(1)))->Fill(particle->Eta(),
3427                                                      particle->Pt());
3428           else
3429             ((TH2D *)(fEfficiencyList->At(1)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3430                                                                                    particle->Py(),
3431                                                                                    particle->Pz()),
3432                                                      particle->Pt());
3433         }//antiprotons
3434       }//primaries
3435       else {
3436         //secondaries
3437         Int_t lPartMother = -1;
3438         Int_t motherPDGCode = -1;
3439         lPartMother = particle->GetFirstMother();
3440         AliMCParticle *mcMotherTrack = (AliMCParticle*) mcEvent->GetTrack(lPartMother);
3441         TParticle *motherParticle = mcMotherTrack->Particle();
3442         if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
3443         
3444         if(pdgcode == 2212) {
3445           if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3446             if(fProtonAnalysisBase->GetEtaMode()) 
3447               ((TH2D *)(fEfficiencyList->At(2)))->Fill(particle->Eta(),
3448                                                        particle->Pt());
3449             else
3450               ((TH2D *)(fEfficiencyList->At(2)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3451                                                                 particle->Py(),
3452                                                                 particle->Pz()),
3453                                                        particle->Pt());
3454           }//weak decays
3455           if((particle->GetUniqueID() == 13)) {
3456             if(fProtonAnalysisBase->GetEtaMode()) 
3457               ((TH2D *)(fEfficiencyList->At(4)))->Fill(particle->Eta(),
3458                                                        particle->Pt());
3459             else
3460               ((TH2D *)(fEfficiencyList->At(4)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3461                                                                 particle->Py(),
3462                                                                 particle->Pz()),
3463                                                        particle->Pt());
3464           }//hadronic interactions
3465         }//protons
3466         if(pdgcode == -2212) {
3467           if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3468             if(fProtonAnalysisBase->GetEtaMode()) 
3469               ((TH2D *)(fEfficiencyList->At(3)))->Fill(particle->Eta(),
3470                                                        particle->Pt());
3471             else
3472               ((TH2D *)(fEfficiencyList->At(3)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3473                                                                 particle->Py(),
3474                                                                 particle->Pz()),
3475                                                        particle->Pt());
3476           }//weak decays
3477           if((particle->GetUniqueID() == 13)) {
3478             if(fProtonAnalysisBase->GetEtaMode()) 
3479               ((TH2D *)(fEfficiencyList->At(5)))->Fill(particle->Eta(),
3480                                                        particle->Pt());
3481             else
3482               ((TH2D *)(fEfficiencyList->At(5)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3483                                                                 particle->Py(),
3484                                                                 particle->Pz()),
3485                                                        particle->Pt());
3486           }//hadronic interactions
3487         }//antiprotons
3488       }//secondaries
3489       //}//findable tracks
3490   }//MC track loop
3491
3492   //ESD track loop
3493   Bool_t iFound = kFALSE;
3494   Int_t mcGoods = nMCLabelCounter;
3495   for (Int_t k = 0; k < mcGoods; k++) {
3496     Int_t mcLabel = labelMCArray.At(k);
3497     iFound = kFALSE;
3498
3499     Int_t nGoodTracks = esd->GetNumberOfTracks();
3500     TArrayI labelArray(nGoodTracks);
3501     Int_t labelCounter = 0;
3502     for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) {
3503       AliESDtrack* track = esd->GetTrack(iTracks);
3504       if(!track) continue;
3505             
3506       //TPC only
3507       if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
3508         AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
3509         if(!tpcTrack) continue;
3510         
3511         Int_t label = TMath::Abs(track->GetTPCLabel());
3512         if(IsLabelUsed(labelArray,label)) continue;
3513         labelArray.AddAt(label,labelCounter);
3514         labelCounter += 1;
3515         
3516         if (mcLabel != TMath::Abs(label)) continue;
3517         if(mcLabel != label) continue;
3518         
3519         TParticle *particle = stack->Particle(label);
3520         if(!particle) continue;
3521         Int_t pdgcode = particle->GetPdgCode();
3522         if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
3523         if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
3524         if(fProtonAnalysisBase->GetEtaMode()) {
3525           if((particle->Eta() > fMaxY)|| (particle->Eta() < fMinY)) continue;
3526         }
3527         else 
3528           if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
3529                 
3530         if(fUseCutsInEfficiency) {
3531           if(!fProtonAnalysisBase->IsPrimary(esd,vertex,track)) continue;
3532           if(!fProtonAnalysisBase->IsAccepted(track)) continue;
3533         }       
3534         //reconstructed primary (anti)protons
3535         if(pdgcode == 2212) {
3536           if(label <= stack->GetNprimary()) {
3537             if(fProtonAnalysisBase->GetEtaMode())
3538               ((TH2D *)(fEfficiencyList->At(6)))->Fill(particle->Eta(),
3539                                                        particle->Pt());
3540             else
3541               ((TH2D *)(fEfficiencyList->At(6)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3542                                                                 particle->Py(),
3543                                                                 particle->Pz()),
3544                                                        particle->Pt());
3545           }//primaries
3546           if(label > stack->GetNprimary()) {
3547             Int_t lPartMother = -1;
3548             Int_t motherPDGCode = -1;
3549             lPartMother = particle->GetFirstMother();
3550             TParticle *motherParticle = stack->Particle(lPartMother);
3551             if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
3552             
3553             if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3554               if(fProtonAnalysisBase->GetEtaMode())
3555                 ((TH2D *)(fEfficiencyList->At(8)))->Fill(particle->Eta(),
3556                                                          particle->Pt());
3557               else
3558                 ((TH2D *)(fEfficiencyList->At(8)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3559                                                                   particle->Py(),
3560                                                                   particle->Pz()),
3561                                                          particle->Pt());
3562             }//weak decays
3563             if((particle->GetUniqueID() == 13)) {
3564               if(fProtonAnalysisBase->GetEtaMode())
3565                 ((TH2D *)(fEfficiencyList->At(10)))->Fill(particle->Eta(),
3566                                                           particle->Pt());
3567               else
3568                 ((TH2D *)(fEfficiencyList->At(10)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3569                                                                    particle->Py(),
3570                                                                    particle->Pz()),
3571                                                           particle->Pt());
3572             }//hadronic interactions
3573           }//secondaries
3574         }//initial protons
3575         if(pdgcode == -2212) {  
3576           if(label <= stack->GetNprimary()) {
3577             if(fProtonAnalysisBase->GetEtaMode())
3578               ((TH2D *)(fEfficiencyList->At(7)))->Fill(particle->Eta(),
3579                                                        particle->Pt());
3580             else
3581               ((TH2D *)(fEfficiencyList->At(7)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3582                                                                 particle->Py(),
3583                                                                 particle->Pz()),
3584                                                        particle->Pt());
3585           }//primaries
3586           if(label > stack->GetNprimary()) {
3587             Int_t lPartMother = -1;
3588             Int_t motherPDGCode = -1;
3589             lPartMother = particle->GetFirstMother();
3590             TParticle *motherParticle = stack->Particle(lPartMother);
3591             if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
3592             
3593             if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3594               if(fProtonAnalysisBase->GetEtaMode())
3595                 ((TH2D *)(fEfficiencyList->At(9)))->Fill(particle->Eta(),
3596                                                          particle->Pt());
3597               else
3598                 ((TH2D *)(fEfficiencyList->At(9)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3599                                                                   particle->Py(),
3600                                                                   particle->Pz()),
3601                                                          particle->Pt());
3602             }//weak decays
3603             if((particle->GetUniqueID() == 13)) {
3604               if(fProtonAnalysisBase->GetEtaMode())
3605                 ((TH2D *)(fEfficiencyList->At(11)))->Fill(particle->Eta(),
3606                                                           particle->Pt());
3607               else
3608                 ((TH2D *)(fEfficiencyList->At(11)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3609                                                                    particle->Py(),
3610                                                                    particle->Pz()),
3611                                                           particle->Pt());
3612             }//hadronic interactions
3613           }//secondaries
3614         }//initial antiprotons  
3615       }//TPC only tracks
3616       else {
3617         Int_t label = TMath::Abs(track->GetLabel());
3618         if(IsLabelUsed(labelArray,label)) continue;
3619         labelArray.AddAt(label,labelCounter);
3620         labelCounter += 1;
3621         
3622         if (mcLabel != TMath::Abs(label)) continue;
3623         if(mcLabel != label) continue;
3624         
3625         TParticle *particle = stack->Particle(label);
3626         if(!particle) continue;
3627         Int_t pdgcode = particle->GetPdgCode();
3628         if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
3629         if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
3630         if(fProtonAnalysisBase->GetEtaMode()) {
3631           if((particle->Eta() > fMaxY)|| (particle->Eta() < fMinY)) continue;
3632         }
3633         else 
3634           if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
3635         
3636         //Double_t probability[5];
3637
3638         if(fUseCutsInEfficiency) {
3639           if(!fProtonAnalysisBase->IsPrimary(esd,vertex,track)) continue;
3640           if(!fProtonAnalysisBase->IsAccepted(track)) continue;
3641         }       
3642         //reconstructed primary (anti)protons
3643         if(pdgcode == 2212) {
3644           if(label <= stack->GetNprimary()) {
3645             if(fProtonAnalysisBase->GetEtaMode())
3646               ((TH2D *)(fEfficiencyList->At(6)))->Fill(particle->Eta(),
3647                                                        particle->Pt());
3648             else
3649               ((TH2D *)(fEfficiencyList->At(6)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3650                                                                 particle->Py(),
3651                                                                 particle->Pz()),
3652                                                        particle->Pt());
3653           }//primaries
3654           if(label > stack->GetNprimary()) {
3655             Int_t lPartMother = -1;
3656             Int_t motherPDGCode = -1;
3657             lPartMother = particle->GetFirstMother();
3658             TParticle *motherParticle = stack->Particle(lPartMother);
3659             if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
3660             
3661             if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3662               if(fProtonAnalysisBase->GetEtaMode())
3663                 ((TH2D *)(fEfficiencyList->At(8)))->Fill(particle->Eta(),
3664                                                          particle->Pt());
3665               else
3666                 ((TH2D *)(fEfficiencyList->At(8)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3667                                                                   particle->Py(),
3668                                                                   particle->Pz()),
3669                                                          particle->Pt());
3670             }//weak decays
3671             if((particle->GetUniqueID() == 13)) {
3672               if(fProtonAnalysisBase->GetEtaMode())
3673                 ((TH2D *)(fEfficiencyList->At(10)))->Fill(particle->Eta(),
3674                                                           particle->Pt());
3675               else
3676                 ((TH2D *)(fEfficiencyList->At(10)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3677                                                                    particle->Py(),
3678                                                                    particle->Pz()),
3679                                                           particle->Pt());
3680             }//hadronic interactions
3681           }//secondaries
3682         }//initial protons
3683         if(pdgcode == -2212) {  
3684           if(label <= stack->GetNprimary()) {
3685             if(fProtonAnalysisBase->GetEtaMode())
3686               ((TH2D *)(fEfficiencyList->At(7)))->Fill(particle->Eta(),
3687                                                        particle->Pt());
3688             else
3689               ((TH2D *)(fEfficiencyList->At(7)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3690                                                                 particle->Py(),
3691                                                                 particle->Pz()),
3692                                                        particle->Pt());
3693           }//primaries
3694           if(label > stack->GetNprimary()) {
3695             Int_t lPartMother = -1;
3696             Int_t motherPDGCode = -1;
3697             lPartMother = particle->GetFirstMother();
3698             TParticle *motherParticle = stack->Particle(lPartMother);
3699             if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
3700             
3701             if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3702               if(fProtonAnalysisBase->GetEtaMode())
3703                 ((TH2D *)(fEfficiencyList->At(9)))->Fill(particle->Eta(),
3704                                                          particle->Pt());
3705               else
3706                 ((TH2D *)(fEfficiencyList->At(9)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3707                                                                   particle->Py(),
3708                                                                   particle->Pz()),
3709                                                          particle->Pt());
3710             }//weak decays
3711             if((particle->GetUniqueID() == 13)) {
3712               if(fProtonAnalysisBase->GetEtaMode())
3713                 ((TH2D *)(fEfficiencyList->At(11)))->Fill(particle->Eta(),
3714                                                           particle->Pt());
3715               else
3716                 ((TH2D *)(fEfficiencyList->At(11)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3717                                                                    particle->Py(),
3718                                                                    particle->Pz()),
3719                                                           particle->Pt());
3720             }//hadronic interactions
3721           }//secondaries
3722         }//initial antiprotons  
3723       }//global tracking
3724     }//track loop
3725     labelArray.Reset();
3726   }//loop over findable tracks
3727
3728   labelMCArray.Reset();
3729 }
3730
3731 //____________________________________________________________________//
3732 void AliProtonQAAnalysis::RunPIDEfficiencyAnalysis(AliStack *const stack, 
3733                                                    AliESDEvent *esd,
3734                                                    const AliESDVertex *vertex) {
3735   //Runs the PID efficiency analysis
3736   Int_t nGoodTracks = esd->GetNumberOfTracks();
3737   TArrayI labelArray(nGoodTracks);
3738   Int_t labelCounter = 0;
3739   for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) {
3740     AliESDtrack* track = esd->GetTrack(iTracks);
3741     if(!track) continue;
3742     
3743     //TPC only
3744     if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
3745       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
3746       if(!tpcTrack) continue;
3747     }
3748         
3749     Int_t label = TMath::Abs(track->GetLabel());
3750     if(IsLabelUsed(labelArray,label)) continue;
3751     labelArray.AddAt(label,labelCounter);
3752     labelCounter += 1;
3753                 
3754     TParticle *particle = stack->Particle(label);
3755     if(!particle) continue;
3756     Int_t pdgcode = particle->GetPdgCode();
3757     
3758     Int_t nTPCpoints = track->GetTPCsignalN();
3759
3760     if(fUseCutsInEfficiency) {
3761       if(!fProtonAnalysisBase->IsPrimary(esd,vertex,track)) continue;
3762       if(!fProtonAnalysisBase->IsAccepted(track)) continue;
3763     }   
3764     if(TMath::Abs(pdgcode) == 2212) {
3765       if(fProtonAnalysisBase->GetEtaMode())
3766         ((TH3D *)(fEfficiencyList->At(12)))->Fill(particle->Eta(),
3767                                                   particle->Pt(),nTPCpoints);
3768       else
3769         ((TH3D *)(fEfficiencyList->At(12)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt(),nTPCpoints);
3770     }
3771
3772     //pid
3773     if(fProtonAnalysisBase->IsProton(track)) {
3774       if(fProtonAnalysisBase->GetEtaMode())
3775         ((TH3D *)(fEfficiencyList->At(14)))->Fill(particle->Eta(),
3776                                                   particle->Pt(),nTPCpoints);
3777       else ((TH3D *)(fEfficiencyList->At(14)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt(),nTPCpoints);
3778       if(TMath::Abs(pdgcode) == 2212) {
3779         if(fProtonAnalysisBase->GetEtaMode())
3780           ((TH3D *)(fEfficiencyList->At(13)))->Fill(particle->Eta(),
3781                                                     particle->Pt(),nTPCpoints);
3782         else
3783           ((TH3D *)(fEfficiencyList->At(13)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt(),nTPCpoints);
3784       }//properly identified as proton
3785       else {
3786         if(fProtonAnalysisBase->GetEtaMode())
3787           ((TH3D *)(fEfficiencyList->At(15)))->Fill(particle->Eta(),
3788                                                     particle->Pt(),nTPCpoints);
3789         else
3790           ((TH3D *)(fEfficiencyList->At(15)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt(),nTPCpoints);
3791       }//contamination
3792     }//identified as proton
3793   }//ESD track loop
3794   labelArray.Reset();
3795 }
3796
3797 //____________________________________________________________________//
3798 void AliProtonQAAnalysis::RunCutEfficiencyAnalysis(AliStack *const stack, 
3799                                                    AliESDEvent *esd,
3800                                                    const AliESDVertex *vertex) {
3801   //Runs the cut efficiency analysis
3802   Int_t nGoodTracks = esd->GetNumberOfTracks();
3803   TArrayI labelArray(nGoodTracks);
3804   Int_t labelCounter = 0;
3805   Int_t nPrimaries = stack->GetNprimary();
3806   for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) {
3807     AliESDtrack* track = esd->GetTrack(iTracks);
3808     if(!track) continue;
3809     
3810     //TPC only
3811     if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
3812       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
3813       if(!tpcTrack) continue;
3814     }
3815         
3816     Int_t label = TMath::Abs(track->GetLabel());
3817     if(IsLabelUsed(labelArray,label)) continue;
3818     labelArray.AddAt(label,labelCounter);
3819     labelCounter += 1;
3820
3821     TParticle *particle = stack->Particle(label);
3822     if(!particle) continue;
3823                 
3824     //select primaries
3825     if(label > nPrimaries) continue;
3826     //select identified protons
3827     if(!fProtonAnalysisBase->IsProton(track)) continue;
3828  
3829     if(track->Charge() > 0) {
3830       if(fProtonAnalysisBase->GetEtaMode())
3831         ((TH2F *)(fCutEfficiencyList->At(0)))->Fill(particle->Eta(),
3832                                                     particle->Pt());
3833       else
3834         ((TH2F *)(fCutEfficiencyList->At(0)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt());
3835     }
3836
3837     if(track->Charge() < 0) {
3838       if(fProtonAnalysisBase->GetEtaMode())
3839         ((TH2F *)(fCutEfficiencyList->At(1)))->Fill(particle->Eta(),
3840                                                     particle->Pt());
3841       else
3842         ((TH2F *)(fCutEfficiencyList->At(1)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt());
3843     }
3844
3845     //survived tracks
3846     if(!fProtonAnalysisBase->IsPrimary(esd,vertex,track)) continue;
3847     if(!fProtonAnalysisBase->IsAccepted(track)) continue;
3848     if(track->Charge() > 0) {
3849       if(fProtonAnalysisBase->GetEtaMode())
3850         ((TH2F *)(fCutEfficiencyList->At(2)))->Fill(particle->Eta(),
3851                                                     particle->Pt());
3852       else
3853         ((TH2F *)(fCutEfficiencyList->At(2)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt());
3854     }
3855
3856     if(track->Charge() < 0) {
3857       if(fProtonAnalysisBase->GetEtaMode())
3858         ((TH2F *)(fCutEfficiencyList->At(3)))->Fill(particle->Eta(),
3859                                                     particle->Pt());
3860       else
3861         ((TH2F *)(fCutEfficiencyList->At(3)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt());
3862     }
3863   }//ESD track loop
3864   labelArray.Reset();
3865 }
3866
3867 //____________________________________________________________________//
3868 void AliProtonQAAnalysis::RunEfficiencyAnalysis(AliStack *const stack, 
3869                                                 AliESDEvent *esd,
3870                                                 const AliESDVertex *vertex) {
3871   //Runs the efficiency code
3872   //MC loop
3873   Int_t nMCProtons = 0, nESDProtons = 0;
3874   for(Int_t iParticle = 0; iParticle < stack->GetNtrack(); iParticle++) {
3875     TParticle *particle = stack->Particle(iParticle);
3876     if(!particle) continue;
3877
3878     if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
3879     if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
3880     if(fProtonAnalysisBase->GetEtaMode()) {
3881       if((particle->Eta() > fMaxY)|| (particle->Eta() < fMinY)) continue;
3882     }
3883     else 
3884       if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
3885
3886     Int_t pdgcode = particle->GetPdgCode();
3887     if(TMath::Abs(pdgcode) != 2212) continue;
3888
3889     if(iParticle <= stack->GetNprimary()) {
3890       if(pdgcode == 2212) {
3891         nMCProtons += 1;
3892         if(fProtonAnalysisBase->GetEtaMode()) 
3893           ((TH2D *)(fEfficiencyList->At(0)))->Fill(particle->Eta(),
3894                                                    particle->Pt());
3895         else
3896           ((TH2D *)(fEfficiencyList->At(0)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3897                                                             particle->Py(),
3898                                                             particle->Pz()),
3899                                                    particle->Pt());
3900       }//protons
3901       if(pdgcode == -2212) {
3902         if(fProtonAnalysisBase->GetEtaMode()) 
3903           ((TH2D *)(fEfficiencyList->At(1)))->Fill(particle->Eta(),
3904                                                    particle->Pt());
3905         else
3906           ((TH2D *)(fEfficiencyList->At(1)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3907                                                                                  particle->Py(),
3908                                                                                  particle->Pz()),
3909                                                    particle->Pt());
3910       }//antiprotons
3911     }//primaries
3912     else {
3913       //secondaries
3914       Int_t lPartMother = -1;
3915       Int_t motherPDGCode = -1;
3916       lPartMother = particle->GetFirstMother();
3917       TParticle *motherParticle = stack->Particle(lPartMother);
3918       if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
3919
3920       if(pdgcode == 2212) {
3921         if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3922           if(fProtonAnalysisBase->GetEtaMode()) 
3923             ((TH2D *)(fEfficiencyList->At(2)))->Fill(particle->Eta(),
3924                                                      particle->Pt());
3925           else
3926             ((TH2D *)(fEfficiencyList->At(2)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3927                                                                                    particle->Py(),
3928                                                                                    particle->Pz()),
3929                                                      particle->Pt());
3930         }//weak decays
3931         if((particle->GetUniqueID() == 13)) {
3932           if(fProtonAnalysisBase->GetEtaMode()) 
3933             ((TH2D *)(fEfficiencyList->At(4)))->Fill(particle->Eta(),
3934                                                      particle->Pt());
3935           else
3936             ((TH2D *)(fEfficiencyList->At(4)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3937                                                                                    particle->Py(),
3938                                                                                    particle->Pz()),
3939                                                      particle->Pt());
3940         }//hadronic interactions
3941       }//protons
3942       if(pdgcode == -2212) {
3943         if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3944           if(fProtonAnalysisBase->GetEtaMode()) 
3945             ((TH2D *)(fEfficiencyList->At(3)))->Fill(particle->Eta(),
3946                                                      particle->Pt());
3947           else
3948             ((TH2D *)(fEfficiencyList->At(3)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3949                                                                                    particle->Py(),
3950                                                                                    particle->Pz()),
3951                                                      particle->Pt());
3952         }//weak decays
3953         if((particle->GetUniqueID() == 13)) {
3954           if(fProtonAnalysisBase->GetEtaMode()) 
3955             ((TH2D *)(fEfficiencyList->At(5)))->Fill(particle->Eta(),
3956                                                      particle->Pt());
3957           else
3958             ((TH2D *)(fEfficiencyList->At(5)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3959                                                               particle->Py(),
3960                                                               particle->Pz()),
3961                                                      particle->Pt());
3962         }//hadronic interactions
3963       }//antiprotons
3964     }//secondaries
3965   
3966   }//MC loop
3967
3968   //ESD track loop
3969   Int_t nGoodTracks = esd->GetNumberOfTracks();
3970   TArrayI labelArray(nGoodTracks);
3971   Int_t labelCounter = 0;
3972   for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) {
3973     AliESDtrack* track = esd->GetTrack(iTracks);
3974     if(!track) continue;
3975     
3976     Int_t label = TMath::Abs(track->GetLabel());
3977     if(IsLabelUsed(labelArray,label)) continue;
3978     labelArray.AddAt(label,labelCounter);
3979     labelCounter += 1;
3980     
3981     TParticle *particle = stack->Particle(label);
3982     if(!particle) continue;
3983     Int_t pdgcode = particle->GetPdgCode();
3984     if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
3985     
3986     Double_t gPt = 0.0, gP = 0.0;
3987     
3988     //TPC only
3989     if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
3990       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
3991       if(!tpcTrack) continue;
3992       gPt = tpcTrack->Pt();
3993       gP = tpcTrack->P();
3994       
3995       if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
3996       if(fProtonAnalysisBase->GetEtaMode()) {
3997         if((particle->Eta() > fMaxY)|| (particle->Eta() < fMinY)) continue;
3998       }
3999       else 
4000         if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
4001       
4002       if(fUseCutsInEfficiency) {
4003         if(!fProtonAnalysisBase->IsPrimary(esd,vertex,track)) continue;
4004         if(!fProtonAnalysisBase->IsAccepted(track)) continue;
4005       }      
4006       //reconstructed primary (anti)protons
4007       if(pdgcode == 2212) {
4008         if(label <= stack->GetNprimary()) {
4009           nESDProtons += 1;
4010           if(fProtonAnalysisBase->GetEtaMode())
4011             ((TH2D *)(fEfficiencyList->At(6)))->Fill(particle->Eta(),
4012                                                      particle->Pt());
4013           else
4014             ((TH2D *)(fEfficiencyList->At(6)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4015                                                                                    particle->Py(),
4016                                                                                    particle->Pz()),
4017                                                      particle->Pt());
4018         }//primaries
4019         if(label > stack->GetNprimary()) {
4020           Int_t lPartMother = -1;
4021           Int_t motherPDGCode = -1;
4022           lPartMother = particle->GetFirstMother();
4023           TParticle *motherParticle = stack->Particle(lPartMother);
4024           if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
4025           
4026           if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
4027             if(fProtonAnalysisBase->GetEtaMode())
4028               ((TH2D *)(fEfficiencyList->At(8)))->Fill(particle->Eta(),
4029                                                        particle->Pt());
4030             else
4031               ((TH2D *)(fEfficiencyList->At(8)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4032                                                                                      particle->Py(),
4033                                                                                      particle->Pz()),
4034                                                        particle->Pt());
4035           }//weak decays
4036           if((particle->GetUniqueID() == 13)) {
4037             if(fProtonAnalysisBase->GetEtaMode())
4038               ((TH2D *)(fEfficiencyList->At(10)))->Fill(particle->Eta(),
4039                                                         particle->Pt());
4040             else
4041               ((TH2D *)(fEfficiencyList->At(10)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4042                                                                                       particle->Py(),
4043                                                                                       particle->Pz()),
4044                                                         particle->Pt());
4045           }//hadronic interactions
4046         }//secondaries
4047       }//initial protons
4048       if(pdgcode == -2212) {    
4049         if(label <= stack->GetNprimary()) {
4050           if(fProtonAnalysisBase->GetEtaMode())
4051             ((TH2D *)(fEfficiencyList->At(7)))->Fill(particle->Eta(),
4052                                                      particle->Pt());
4053           else
4054             ((TH2D *)(fEfficiencyList->At(7)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4055                                                                                    particle->Py(),
4056                                                                                    particle->Pz()),
4057                                                      particle->Pt());
4058         }//primaries
4059         if(label > stack->GetNprimary()) {
4060           Int_t lPartMother = -1;
4061           Int_t motherPDGCode = -1;
4062           lPartMother = particle->GetFirstMother();
4063           TParticle *motherParticle = stack->Particle(lPartMother);
4064           if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
4065           
4066           if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
4067             if(fProtonAnalysisBase->GetEtaMode())
4068               ((TH2D *)(fEfficiencyList->At(9)))->Fill(particle->Eta(),
4069                                                        particle->Pt());
4070             else
4071               ((TH2D *)(fEfficiencyList->At(9)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4072                                                                                      particle->Py(),
4073                                                                                      particle->Pz()),
4074                                                        particle->Pt());
4075           }//weak decays
4076           if((particle->GetUniqueID() == 13)) {
4077             if(fProtonAnalysisBase->GetEtaMode())
4078               ((TH2D *)(fEfficiencyList->At(11)))->Fill(particle->Eta(),
4079                                                         particle->Pt());
4080             else
4081               ((TH2D *)(fEfficiencyList->At(11)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4082                                                                                       particle->Py(),
4083                                                                                       particle->Pz()),
4084                                                         particle->Pt());
4085           }//hadronic interactions
4086         }//secondaries
4087       }//initial antiprotons
4088     }//TPC only tracks
4089     else {
4090       if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
4091       if(fProtonAnalysisBase->GetEtaMode()) {
4092         if((particle->Eta() > fMaxY)|| (particle->Eta() < fMinY)) continue;
4093       }
4094       else {
4095         if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
4096       }
4097       
4098       if(fUseCutsInEfficiency) {
4099         if(!fProtonAnalysisBase->IsPrimary(esd,vertex,track)) continue;
4100         if(!fProtonAnalysisBase->IsAccepted(track)) continue;
4101       }      
4102       //reconstructed primary (anti)protons
4103       if(pdgcode == 2212) {
4104         if(label <= stack->GetNprimary()) {
4105           nESDProtons += 1;
4106           if(fProtonAnalysisBase->GetEtaMode())
4107             ((TH2D *)(fEfficiencyList->At(6)))->Fill(particle->Eta(),
4108                                                      particle->Pt());
4109           else
4110             ((TH2D *)(fEfficiencyList->At(6)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4111                                                                                    particle->Py(),
4112                                                                                    particle->Pz()),
4113                                                      particle->Pt());
4114         }//primaries
4115         if(label > stack->GetNprimary()) {
4116           Int_t lPartMother = -1;
4117           Int_t motherPDGCode = -1;
4118           lPartMother = particle->GetFirstMother();
4119           TParticle *motherParticle = stack->Particle(lPartMother);
4120           if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
4121           
4122           if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
4123             if(fProtonAnalysisBase->GetEtaMode())
4124               ((TH2D *)(fEfficiencyList->At(8)))->Fill(particle->Eta(),
4125                                                        particle->Pt());
4126             else
4127               ((TH2D *)(fEfficiencyList->At(8)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4128                                                                                      particle->Py(),
4129                                                                                      particle->Pz()),
4130                                                        particle->Pt());
4131           }//weak decays
4132           if((particle->GetUniqueID() == 13)) {
4133             if(fProtonAnalysisBase->GetEtaMode())
4134               ((TH2D *)(fEfficiencyList->At(10)))->Fill(particle->Eta(),
4135                                                         particle->Pt());
4136             else
4137               ((TH2D *)(fEfficiencyList->At(10)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4138                                                                                       particle->Py(),
4139                                                                                       particle->Pz()),
4140                                                         particle->Pt());
4141           }//hadronic interactions
4142         }//secondaries
4143       }//initial protons
4144       if(pdgcode == -2212) {    
4145         if(fProtonAnalysisBase->GetEtaMode())
4146           ((TH2D *)(fEfficiencyList->At(12)))->Fill(particle->Eta(),
4147                                                     particle->Pt());
4148         else
4149           ((TH2D *)(fEfficiencyList->At(12)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4150                                                                                   particle->Py(),
4151                                                                                   particle->Pz()),
4152                                                     particle->Pt());
4153         if(label <= stack->GetNprimary()) {
4154           if(fProtonAnalysisBase->GetEtaMode())
4155             ((TH2D *)(fEfficiencyList->At(7)))->Fill(particle->Eta(),
4156                                                      particle->Pt());
4157           else
4158             ((TH2D *)(fEfficiencyList->At(7)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4159                                                                                    particle->Py(),
4160                                                                                    particle->Pz()),
4161                                                      particle->Pt());
4162         }//primaries
4163         if(label > stack->GetNprimary()) {
4164           Int_t lPartMother = -1;
4165           Int_t motherPDGCode = -1;
4166           lPartMother = particle->GetFirstMother();
4167           TParticle *motherParticle = stack->Particle(lPartMother);
4168           if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
4169           
4170           if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
4171             if(fProtonAnalysisBase->GetEtaMode())
4172               ((TH2D *)(fEfficiencyList->At(9)))->Fill(particle->Eta(),
4173                                                        particle->Pt());
4174             else
4175               ((TH2D *)(fEfficiencyList->At(9)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4176                                                                                      particle->Py(),
4177                                                                                      particle->Pz()),
4178                                                        particle->Pt());
4179           }//weak decays
4180           if((particle->GetUniqueID() == 13)) {
4181             if(fProtonAnalysisBase->GetEtaMode())
4182               ((TH2D *)(fEfficiencyList->At(11)))->Fill(particle->Eta(),
4183                                                         particle->Pt());
4184             else
4185               ((TH2D *)(fEfficiencyList->At(11)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4186                                                                                       particle->Py(),
4187                                                                                       particle->Pz()),
4188                                                         particle->Pt());
4189           }//hadronic interactions
4190         }//secondaries
4191       }//initial antiprotons
4192     }//global tracking
4193   }//track loop
4194   
4195   //Printf("MC protons: %d - ESD protons: %d",nMCProtons,nESDProtons);
4196 }
4197
4198 //____________________________________________________________________//
4199 Bool_t AliProtonQAAnalysis::IsLabelUsed(TArrayI labelArray, 
4200                                         Int_t label) {
4201   //Checks if the label is used already
4202   Bool_t status = kFALSE;
4203   for(Int_t i = 0; i < labelArray.GetSize(); i++) {
4204     if(labelArray.At(i) == label)
4205       status = kTRUE;
4206   }
4207
4208   return status;
4209 }
4210
4211 //____________________________________________________________________//
4212 void AliProtonQAAnalysis::RunVertexQA(AliGenEventHeader *header,
4213                                       AliESDEvent *const esd) {
4214   //Runs the vertex QA
4215   //MC vertex
4216   TArrayF primaryVertex(3);
4217   header->PrimaryVertex(primaryVertex);
4218
4219   //Int_t nPrimaries = stack->GetNprimary();
4220   ((TH1F *)(fQAVertexList->At(0)))->Fill(primaryVertex[2]);
4221
4222   //TPC vertex
4223   const AliESDVertex *vertexTPC = esd->GetPrimaryVertexTPC();
4224   if(!vertexTPC) {
4225     Printf("ERROR: Could not retrieve the TPC vertex");
4226     return;
4227   }
4228   if(vertexTPC->GetNContributors() > 0) {
4229     ((TH1F *)(fQAVertexList->At(1)))->Fill(primaryVertex[2]);
4230     ((TH2F *)(fQAVertexList->At(2)))->Fill(vertexTPC->GetXv(),
4231                                            vertexTPC->GetNContributors());
4232     ((TH2F *)(fQAVertexList->At(3)))->Fill(vertexTPC->GetYv(),
4233                                            vertexTPC->GetNContributors());
4234     ((TH2F *)(fQAVertexList->At(4)))->Fill(vertexTPC->GetZv(),
4235                                            vertexTPC->GetNContributors());
4236     ((TH1F *)(fQAVertexList->At(5)))->Fill((vertexTPC->GetXv()-primaryVertex[0])*10000.);
4237     ((TH1F *)(fQAVertexList->At(6)))->Fill((vertexTPC->GetYv()-primaryVertex[1])*10000.);
4238     ((TH1F *)(fQAVertexList->At(7)))->Fill((vertexTPC->GetZv()-primaryVertex[2])*10000.);
4239     ((TH1F *)(fQAVertexList->At(8)))->Fill(vertexTPC->GetXRes()*10000.);
4240     ((TH1F *)(fQAVertexList->At(9)))->Fill(vertexTPC->GetYRes()*10000.);
4241     ((TH1F *)(fQAVertexList->At(10)))->Fill(vertexTPC->GetZRes()*10000.);
4242   }//TPC vertex
4243
4244   //SPD vertex
4245   const AliESDVertex *vertexSPD = esd->GetPrimaryVertexSPD();
4246   if(!vertexSPD) {
4247     Printf("ERROR: Could not retrieve the SPD vertex");
4248     return;
4249   }
4250   if(vertexSPD->GetNContributors() > 0) {
4251     ((TH1F *)(fQAVertexList->At(11)))->Fill(primaryVertex[2]);
4252     ((TH2F *)(fQAVertexList->At(12)))->Fill(vertexSPD->GetXv(),
4253                                             vertexSPD->GetNContributors());
4254     ((TH2F *)(fQAVertexList->At(13)))->Fill(vertexSPD->GetYv(),
4255                                             vertexSPD->GetNContributors());
4256     ((TH2F *)(fQAVertexList->At(14)))->Fill(vertexSPD->GetZv(),
4257                                             vertexSPD->GetNContributors());
4258     ((TH1F *)(fQAVertexList->At(15)))->Fill((vertexSPD->GetXv()-primaryVertex[0])*10000.);
4259     ((TH1F *)(fQAVertexList->At(16)))->Fill((vertexSPD->GetYv()-primaryVertex[1])*10000.);
4260     ((TH1F *)(fQAVertexList->At(17)))->Fill((vertexSPD->GetZv()-primaryVertex[2])*10000.);
4261     ((TH1F *)(fQAVertexList->At(18)))->Fill(vertexSPD->GetXRes()*10000.);
4262     ((TH1F *)(fQAVertexList->At(19)))->Fill(vertexSPD->GetYRes()*10000.);
4263     ((TH1F *)(fQAVertexList->At(20)))->Fill(vertexSPD->GetZRes()*10000.);
4264   }//SPD vertex
4265   
4266   //Tracks vertex
4267   const AliESDVertex *vertexTracks = esd->GetPrimaryVertex();
4268   if(!vertexTracks) {
4269     Printf("ERROR: Could not retrieve the Tracks vertex");
4270     return;
4271   }
4272   if(vertexTracks->GetNContributors() > 0) {
4273     ((TH1F *)(fQAVertexList->At(21)))->Fill(primaryVertex[2]);
4274     ((TH2F *)(fQAVertexList->At(22)))->Fill(vertexTracks->GetXv(),
4275                                             vertexTracks->GetNContributors());
4276     ((TH2F *)(fQAVertexList->At(23)))->Fill(vertexTracks->GetYv(),
4277                                             vertexTracks->GetNContributors());
4278     ((TH2F *)(fQAVertexList->At(24)))->Fill(vertexTracks->GetZv(),
4279                                             vertexTracks->GetNContributors());
4280     ((TH1F *)(fQAVertexList->At(25)))->Fill((vertexTracks->GetXv()-primaryVertex[0])*10000.);
4281     ((TH1F *)(fQAVertexList->At(26)))->Fill((vertexTracks->GetYv()-primaryVertex[1])*10000.);
4282     ((TH1F *)(fQAVertexList->At(27)))->Fill((vertexTracks->GetZv()-primaryVertex[2])*10000.);
4283     ((TH1F *)(fQAVertexList->At(28)))->Fill(vertexTracks->GetXRes()*10000.);
4284     ((TH1F *)(fQAVertexList->At(29)))->Fill(vertexTracks->GetYRes()*10000.);
4285     ((TH1F *)(fQAVertexList->At(30)))->Fill(vertexTracks->GetZRes()*10000.);
4286   }//Tracks vertex
4287
4288 }
4289
4290 //____________________________________________________________________//
4291 void AliProtonQAAnalysis::RunQAAnalysis(AliStack *stack, 
4292                                         AliESDEvent *esd,
4293                                         const AliESDVertex *vertex) {
4294   //Runs the QA code
4295   //MC loop
4296   for(Int_t iParticle = 0; iParticle < stack->GetNprimary(); iParticle++) {
4297     TParticle *particle = stack->Particle(iParticle);
4298     if(!particle) continue;
4299
4300     if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
4301     if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
4302     if(fProtonAnalysisBase->GetEtaMode()) {
4303       if((particle->Eta() > fMaxY)||(particle->Eta() < fMinY)) continue;
4304     }
4305     else {
4306       if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
4307     }
4308     Int_t pdgcode = particle->GetPdgCode();
4309     if(pdgcode == 2212) {
4310       if(fProtonAnalysisBase->GetEtaMode())
4311         ((TH2D *)(fQA2DList->At(8)))->Fill(particle->Eta(),
4312                                            particle->Pt());
4313       else
4314         ((TH2D *)(fQA2DList->At(8)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4315                                                                          particle->Py(),
4316                                                                          particle->Pz()),
4317                                            particle->Pt());
4318     }
4319     if(pdgcode == -2212) {
4320       if(fProtonAnalysisBase->GetEtaMode())
4321         ((TH2D *)(fQA2DList->At(9)))->Fill(particle->Eta(),
4322                                            particle->Pt());
4323       else
4324         ((TH2D *)(fQA2DList->At(9)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4325                                                                          particle->Py(),
4326                                                                          particle->Pz()),
4327                                            particle->Pt());
4328     }
4329   }//MC loop
4330
4331   Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0};
4332   //ESD track loop
4333   Int_t nGoodTracks = esd->GetNumberOfTracks();
4334   TArrayI labelArray(nGoodTracks);
4335   Int_t labelCounter = 0;
4336   for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) {
4337     AliESDtrack* track = esd->GetTrack(iTracks);
4338     if(!track) continue;
4339     
4340     Int_t label = TMath::Abs(track->GetLabel()); 
4341     if(IsLabelUsed(labelArray,label)) continue;
4342     labelArray.AddAt(label,labelCounter);
4343     labelCounter += 1;
4344     
4345     TParticle *particle = stack->Particle(label);
4346     if(!particle) continue;
4347     if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
4348     
4349     AliESDtrack trackTPC;
4350     
4351     //in case it's a TPC only track relate it to the proper vertex
4352     //if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)&&(!fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
4353       //if((fUseTPCOnly)&&(!fUseHybridTPC)) {
4354       /*track->GetImpactParametersTPC(dca,cov);
4355       if (dca[0]==0 && dca[1]==0)  
4356         track->RelateToVertexTPC(((AliESDEvent*)esd)->GetPrimaryVertexTPC(),esd->GetMagneticField(),kVeryBig);
4357       if (!track->FillTPCOnlyTrack(trackTPC)) {
4358         continue;
4359       }
4360       track = &trackTPC ;*/
4361     //}
4362     
4363     Double_t gPt = 0.0, gP = 0.0;
4364     //Double_t probability[5];
4365     //Float_t dcaXY = 0.0, dcaZ = 0.0;
4366     Double_t nSigmaToVertex = fProtonAnalysisBase->GetSigmaToVertex(track);
4367     Int_t  fIdxInt[200];
4368     Int_t nClustersITS = track->GetITSclusters(fIdxInt);
4369     Int_t nClustersTPC = track->GetTPCclusters(fIdxInt);
4370     
4371     Float_t chi2PerClusterITS = -1;
4372     if (nClustersITS!=0)
4373       chi2PerClusterITS = track->GetITSchi2()/Float_t(nClustersITS);
4374     Float_t chi2PerClusterTPC = -1;
4375     if (nClustersTPC!=0)
4376       chi2PerClusterTPC = track->GetTPCchi2()/Float_t(nClustersTPC);
4377     Double_t chi2ConstrainVertex = TMath::Log(track->GetConstrainedChi2());    
4378     Double_t extCov[15];
4379     track->GetExternalCovariance(extCov);
4380     Int_t npointsTPCdEdx = track->GetTPCsignalN();
4381
4382     //TPC only
4383     if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
4384       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
4385       if(!tpcTrack) continue;
4386       gPt = tpcTrack->Pt();
4387       gP = tpcTrack->P();
4388       /*if(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)
4389         track->GetImpactParameters(dcaXY,dcaZ);
4390         else track->GetImpactParametersTPC(dcaXY,dcaZ);*/
4391       tpcTrack->PropagateToDCA(vertex,
4392                                esd->GetMagneticField(),
4393                                100.,dca,cov);
4394
4395       //pid
4396       if(fProtonAnalysisBase->IsProton(track)) {
4397         if(!fProtonAnalysisBase->IsInPhaseSpace(track)) continue; //track outside the analyzed y-Pt
4398
4399         FillQA(stack,esd,vertex,track);
4400         if(fProtonAnalysisBase->IsPrimary(esd,vertex,track)) {
4401           if(fProtonAnalysisBase->IsAccepted(track)) {
4402             if(label <= stack->GetNprimary()) {
4403               if(track->Charge() > 0) {
4404                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4405                   if(track->HasPointOnITSLayer(iLayer))
4406                     ((TH1F *)(fAcceptedCutList->At(0)))->Fill(iLayer+1);
4407                 }
4408                 ((TH1F *)(fAcceptedCutList->At(4)))->Fill(nClustersITS);
4409                 ((TH1F *)(fAcceptedCutList->At(8)))->Fill(chi2PerClusterITS);
4410                 ((TH1F *)(fAcceptedCutList->At(12)))->Fill(chi2ConstrainVertex);
4411                 ((TH1F *)(fAcceptedCutList->At(16)))->Fill(nClustersTPC);
4412                 ((TH1F *)(fAcceptedCutList->At(20)))->Fill(chi2PerClusterTPC);
4413                 ((TH1F *)(fAcceptedCutList->At(24)))->Fill(extCov[0]);
4414                 ((TH1F *)(fAcceptedCutList->At(28)))->Fill(extCov[2]);
4415                 ((TH1F *)(fAcceptedCutList->At(32)))->Fill(extCov[5]);
4416                 ((TH1F *)(fAcceptedCutList->At(36)))->Fill(extCov[9]);
4417                 ((TH1F *)(fAcceptedCutList->At(40)))->Fill(extCov[14]);
4418                 ((TH3D *)(fAcceptedCutList->At(44)))->Fill(tpcTrack->Eta(),
4419                                                            tpcTrack->Phi()*180./TMath::Pi(),
4420                                                            nClustersTPC);
4421                 ((TH3D *)(fAcceptedCutList->At(48)))->Fill(tpcTrack->Eta(),
4422                                                            tpcTrack->Phi()*180./TMath::Pi(),
4423                                                            chi2PerClusterTPC);
4424                 ((TH3D *)(fAcceptedCutList->At(52)))->Fill(tpcTrack->Eta(),
4425                                                            tpcTrack->Phi()*180./TMath::Pi(),
4426                                                            npointsTPCdEdx);
4427                 ((TH1D *)(fAcceptedCutList->At(56)))->Fill(npointsTPCdEdx);
4428                 
4429                 ((TH1F *)(fAcceptedDCAList->At(0)))->Fill(TMath::Abs(dca[0]));
4430                 ((TH1F *)(fAcceptedDCAList->At(4)))->Fill(TMath::Abs(dca[1]));
4431                 ((TH1F *)(fAcceptedDCAList->At(8)))->Fill(nSigmaToVertex);
4432                 ((TH2F *)(fAcceptedDCAList->At(12)))->Fill(gPt,TMath::Abs(dca[0]));
4433                 ((TH2F *)(fAcceptedDCAList->At(18)))->Fill(gPt,TMath::Abs(dca[1]));
4434                 if(fProtonAnalysisBase->GetEtaMode())
4435                   ((TH2D *)(fQA2DList->At(0)))->Fill(tpcTrack->Eta(),gPt);
4436                 else
4437                   ((TH2D *)(fQA2DList->At(0)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4438                                                                                    tpcTrack->Py(),
4439                                                                                    tpcTrack->Pz()),
4440                                                      gPt);
4441               }//accepted primary protons
4442               else if(track->Charge() < 0) {
4443                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4444                   if(track->HasPointOnITSLayer(iLayer))
4445                     ((TH1F *)(fAcceptedCutList->At(1)))->Fill(iLayer+1);
4446                 }
4447                 ((TH1F *)(fAcceptedCutList->At(5)))->Fill(nClustersITS);
4448                 ((TH1F *)(fAcceptedCutList->At(9)))->Fill(chi2PerClusterITS);
4449                 ((TH1F *)(fAcceptedCutList->At(13)))->Fill(chi2ConstrainVertex);
4450                 ((TH1F *)(fAcceptedCutList->At(17)))->Fill(nClustersTPC);
4451                 ((TH1F *)(fAcceptedCutList->At(21)))->Fill(chi2PerClusterTPC);
4452                 ((TH1F *)(fAcceptedCutList->At(25)))->Fill(extCov[0]);
4453                 ((TH1F *)(fAcceptedCutList->At(29)))->Fill(extCov[2]);
4454                 ((TH1F *)(fAcceptedCutList->At(33)))->Fill(extCov[5]);
4455                 ((TH1F *)(fAcceptedCutList->At(37)))->Fill(extCov[9]);
4456                 ((TH1F *)(fAcceptedCutList->At(41)))->Fill(extCov[14]);
4457                 ((TH3D *)(fAcceptedCutList->At(45)))->Fill(tpcTrack->Eta(),
4458                                                            tpcTrack->Phi()*180./TMath::Pi(),
4459                                                            nClustersTPC);
4460                 ((TH3D *)(fAcceptedCutList->At(49)))->Fill(tpcTrack->Eta(),
4461                                                            tpcTrack->Phi()*180./TMath::Pi(),
4462                                                            chi2PerClusterTPC);
4463                 ((TH3D *)(fAcceptedCutList->At(53)))->Fill(tpcTrack->Eta(),
4464                                                            tpcTrack->Phi()*180./TMath::Pi(),
4465                                                            npointsTPCdEdx);
4466                 ((TH1D *)(fAcceptedCutList->At(57)))->Fill(npointsTPCdEdx);
4467                 
4468                 ((TH1F *)(fAcceptedDCAList->At(1)))->Fill(TMath::Abs(dca[0]));
4469                 ((TH1F *)(fAcceptedDCAList->At(5)))->Fill(TMath::Abs(dca[1]));
4470                 ((TH1F *)(fAcceptedDCAList->At(9)))->Fill(nSigmaToVertex);
4471                 ((TH2F *)(fAcceptedDCAList->At(13)))->Fill(gPt,TMath::Abs(dca[0]));
4472                 ((TH2F *)(fAcceptedDCAList->At(19)))->Fill(gPt,TMath::Abs(dca[1]));
4473                 if(fProtonAnalysisBase->GetEtaMode())
4474                   ((TH2D *)(fQA2DList->At(4)))->Fill(tpcTrack->Eta(),gPt);
4475                 else
4476                   ((TH2D *)(fQA2DList->At(4)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4477                                                                                    tpcTrack->Py(),
4478                                                                                    tpcTrack->Pz()),
4479                                                      gPt);
4480               }//accepted primary antiprotons
4481             }//accepted primary particles
4482             else if(label > stack->GetNprimary()) {
4483               Int_t lPartMother = -1;
4484               Int_t motherPDGCode = -1;
4485               if(particle) {
4486                 lPartMother = particle->GetFirstMother();
4487                 TParticle *motherParticle = stack->Particle(lPartMother);
4488                 if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
4489               }
4490               
4491               if(fMCProcessIdFlag)
4492                 if(particle->GetUniqueID() != fMCProcessId) continue;
4493               if(fMotherParticlePDGCodeFlag)
4494                 if(TMath::Abs(motherPDGCode) != fMotherParticlePDGCode) continue;
4495               
4496               if(track->Charge() > 0) {
4497                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4498                   if(track->HasPointOnITSLayer(iLayer))
4499                     ((TH1F *)(fAcceptedCutList->At(2)))->Fill(iLayer+1);
4500                 }
4501                 ((TH1F *)(fAcceptedCutList->At(6)))->Fill(nClustersITS);
4502                 ((TH1F *)(fAcceptedCutList->At(10)))->Fill(chi2PerClusterITS);
4503                 ((TH1F *)(fAcceptedCutList->At(14)))->Fill(chi2ConstrainVertex);
4504                 ((TH1F *)(fAcceptedCutList->At(18)))->Fill(nClustersTPC);
4505                 ((TH1F *)(fAcceptedCutList->At(22)))->Fill(chi2PerClusterTPC);
4506                 ((TH1F *)(fAcceptedCutList->At(26)))->Fill(extCov[0]);
4507                 ((TH1F *)(fAcceptedCutList->At(30)))->Fill(extCov[2]);
4508                 ((TH1F *)(fAcceptedCutList->At(34)))->Fill(extCov[5]);
4509                 ((TH1F *)(fAcceptedCutList->At(38)))->Fill(extCov[9]);
4510                 ((TH1F *)(fAcceptedCutList->At(42)))->Fill(extCov[14]);
4511                 ((TH3D *)(fAcceptedCutList->At(46)))->Fill(tpcTrack->Eta(),
4512                                                            tpcTrack->Phi()*180./TMath::Pi(),
4513                                                            nClustersTPC);
4514                 ((TH3D *)(fAcceptedCutList->At(50)))->Fill(tpcTrack->Eta(),
4515                                                            tpcTrack->Phi()*180./TMath::Pi(),
4516                                                            chi2PerClusterTPC);
4517                 ((TH3D *)(fAcceptedCutList->At(54)))->Fill(tpcTrack->Eta(),
4518                                                            tpcTrack->Phi()*180./TMath::Pi(),
4519                                                            npointsTPCdEdx);
4520                 ((TH1D *)(fAcceptedCutList->At(58)))->Fill(npointsTPCdEdx);
4521                 
4522                 ((TH1F *)(fAcceptedDCAList->At(2)))->Fill(TMath::Abs(dca[0]));
4523                 ((TH1F *)(fAcceptedDCAList->At(6)))->Fill(TMath::Abs(dca[1]));
4524                 ((TH1F *)(fAcceptedDCAList->At(10)))->Fill(nSigmaToVertex);
4525                 if(particle->GetUniqueID() == 4) {
4526                   ((TH2F *)(fAcceptedDCAList->At(14)))->Fill(gPt,TMath::Abs(dca[0]));
4527                   ((TH2F *)(fAcceptedDCAList->At(20)))->Fill(gPt,TMath::Abs(dca[1]));
4528                 }
4529                 if(particle->GetUniqueID() == 13) {
4530                   ((TH2F *)(fAcceptedDCAList->At(16)))->Fill(gPt,TMath::Abs(dca[0]));
4531                   ((TH2F *)(fAcceptedDCAList->At(22)))->Fill(gPt,TMath::Abs(dca[1]));
4532                 }
4533                 if(fProtonAnalysisBase->GetEtaMode())
4534                   ((TH2D *)(fQA2DList->At(2)))->Fill(tpcTrack->Eta(),gPt);
4535                 else
4536                   ((TH2D *)(fQA2DList->At(2)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4537                                                                                    tpcTrack->Py(),
4538                                                                                    tpcTrack->Pz()),
4539                                                      gPt);
4540                 if(fProtonAnalysisBase->GetEtaMode())
4541                   ((TH3F *)(fQA2DList->At(10)))->Fill(tpcTrack->Eta(),gPt,
4542                                                       ConvertPDGToInt(motherPDGCode));
4543                 else
4544                   ((TH3F *)(fQA2DList->At(10)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4545                                                                                     tpcTrack->Py(),
4546                                                                                     tpcTrack->Pz()),
4547                                                       gPt,
4548                                                       ConvertPDGToInt(motherPDGCode));
4549               }//accepted secondary protons
4550               else if(track->Charge() < 0) {
4551                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4552                   if(track->HasPointOnITSLayer(iLayer))
4553                     ((TH1F *)(fAcceptedCutList->At(3)))->Fill(iLayer+1);
4554                 }
4555                 ((TH1F *)(fAcceptedCutList->At(7)))->Fill(nClustersITS);
4556                 ((TH1F *)(fAcceptedCutList->At(11)))->Fill(chi2PerClusterITS);
4557                 ((TH1F *)(fAcceptedCutList->At(15)))->Fill(chi2ConstrainVertex);
4558                 ((TH1F *)(fAcceptedCutList->At(19)))->Fill(nClustersTPC);
4559                 ((TH1F *)(fAcceptedCutList->At(23)))->Fill(chi2PerClusterTPC);
4560                 ((TH1F *)(fAcceptedCutList->At(27)))->Fill(extCov[0]);
4561                 ((TH1F *)(fAcceptedCutList->At(31)))->Fill(extCov[2]);
4562                 ((TH1F *)(fAcceptedCutList->At(35)))->Fill(extCov[5]);
4563                 ((TH1F *)(fAcceptedCutList->At(39)))->Fill(extCov[9]);
4564                 ((TH1F *)(fAcceptedCutList->At(43)))->Fill(extCov[14]);
4565                 ((TH3D *)(fAcceptedCutList->At(47)))->Fill(tpcTrack->Eta(),
4566                                                            tpcTrack->Phi()*180./TMath::Pi(),
4567                                                            nClustersTPC);
4568                 ((TH3D *)(fAcceptedCutList->At(51)))->Fill(tpcTrack->Eta(),
4569                                                            tpcTrack->Phi()*180./TMath::Pi(),
4570                                                            chi2PerClusterTPC);
4571                 ((TH3D *)(fAcceptedCutList->At(55)))->Fill(tpcTrack->Eta(),
4572                                                            tpcTrack->Phi()*180./TMath::Pi(),
4573                                                            npointsTPCdEdx);
4574                 ((TH1F *)(fAcceptedCutList->At(59)))->Fill(npointsTPCdEdx);
4575                 
4576                 ((TH1F *)(fAcceptedDCAList->At(3)))->Fill(TMath::Abs(dca[0]));
4577                 ((TH1F *)(fAcceptedDCAList->At(7)))->Fill(TMath::Abs(dca[1]));
4578                 ((TH1F *)(fAcceptedDCAList->At(11)))->Fill(nSigmaToVertex);
4579                 if(particle->GetUniqueID() == 4) {
4580                   ((TH2F *)(fAcceptedDCAList->At(15)))->Fill(gPt,TMath::Abs(dca[0]));
4581                   ((TH2F *)(fAcceptedDCAList->At(21)))->Fill(gPt,TMath::Abs(dca[1]));
4582                 }
4583                 if(particle->GetUniqueID() == 13) {
4584                   ((TH2F *)(fAcceptedDCAList->At(17)))->Fill(gPt,TMath::Abs(dca[0]));
4585                   ((TH2F *)(fAcceptedDCAList->At(23)))->Fill(gPt,TMath::Abs(dca[1]));
4586                 }
4587                 if(fProtonAnalysisBase->GetEtaMode())
4588                   ((TH2D *)(fQA2DList->At(6)))->Fill(tpcTrack->Eta(),gPt);
4589                 else
4590                   ((TH2D *)(fQA2DList->At(6)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4591                                                                                    tpcTrack->Py(),
4592                                                                                    tpcTrack->Pz()),
4593                                                      gPt);
4594                 if(fProtonAnalysisBase->GetEtaMode())
4595                   ((TH3F *)(fQA2DList->At(11)))->Fill(tpcTrack->Eta(),gPt,
4596                                                       ConvertPDGToInt(motherPDGCode));
4597                 else
4598                   ((TH3F *)(fQA2DList->At(11)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4599                                                                                     tpcTrack->Py(),
4600                                                                                     tpcTrack->Pz()),
4601                                                       gPt,
4602                                                       ConvertPDGToInt(motherPDGCode));
4603               }//accepted secondary antiprotons
4604             }//accepted secondary particles
4605           }//accepted - track cuts
4606         }//primary-like cut
4607         else {
4608           if(label <= stack->GetNprimary()) {
4609             if(track->Charge() > 0) {
4610               ((TH3D *)(fRejectedCutList->At(0)))->Fill(tpcTrack->Eta(),
4611                                                         tpcTrack->Phi()*180./TMath::Pi(),
4612                                                         nClustersTPC);
4613               ((TH3D *)(fRejectedCutList->At(4)))->Fill(tpcTrack->Eta(),
4614                                                         tpcTrack->Phi()*180./TMath::Pi(),
4615                                                         chi2PerClusterTPC);
4616               ((TH3D *)(fRejectedCutList->At(8)))->Fill(tpcTrack->Eta(),
4617                                                         tpcTrack->Phi()*180./TMath::Pi(),
4618                                                         npointsTPCdEdx);
4619               
4620               if(fProtonAnalysisBase->GetEtaMode())
4621                 ((TH2D *)(fQA2DList->At(1)))->Fill(tpcTrack->Eta(),gPt);
4622               else
4623                 ((TH2D *)(fQA2DList->At(1)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4624                                                                                  tpcTrack->Py(),
4625                                                                                  tpcTrack->Pz()),
4626                                                    gPt);
4627             }
4628             else if(track->Charge() < 0) {
4629               ((TH3D *)(fRejectedCutList->At(1)))->Fill(tpcTrack->Eta(),
4630                                                         tpcTrack->Phi()*180./TMath::Pi(),
4631                                                         nClustersTPC);
4632               ((TH3D *)(fRejectedCutList->At(5)))->Fill(tpcTrack->Eta(),
4633                                                         tpcTrack->Phi()*180./TMath::Pi(),
4634                                                         chi2PerClusterTPC);
4635               ((TH3D *)(fRejectedCutList->At(9)))->Fill(tpcTrack->Eta(),
4636                                                         tpcTrack->Phi()*180./TMath::Pi(),
4637                                                         npointsTPCdEdx);
4638               if(fProtonAnalysisBase->GetEtaMode())
4639                 ((TH2D *)(fQA2DList->At(5)))->Fill(tpcTrack->Eta(),gPt);
4640               else
4641                 ((TH2D *)(fQA2DList->At(5)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4642                                                             tpcTrack->Py(),
4643                                                             tpcTrack->Pz()),
4644                                                    gPt);
4645             }
4646           }//rejected primary particles
4647           else if(label > stack->GetNprimary()) {
4648             if(track->Charge() > 0) {
4649               ((TH3D *)(fRejectedCutList->At(2)))->Fill(tpcTrack->Eta(),
4650                                                         tpcTrack->Phi()*180./TMath::Pi(),
4651                                                         nClustersTPC);
4652               ((TH3D *)(fRejectedCutList->At(6)))->Fill(tpcTrack->Eta(),
4653                                                         tpcTrack->Phi()*180./TMath::Pi(),
4654                                                         chi2PerClusterTPC);
4655               ((TH3D *)(fRejectedCutList->At(10)))->Fill(tpcTrack->Eta(),
4656                                                          tpcTrack->Phi()*180./TMath::Pi(),
4657                                                          npointsTPCdEdx);
4658               if(fProtonAnalysisBase->GetEtaMode())
4659                 ((TH2D *)(fQA2DList->At(3)))->Fill(tpcTrack->Eta(),gPt);
4660               else
4661                 ((TH2D *)(fQA2DList->At(3)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4662                                                             tpcTrack->Py(),
4663                                                             tpcTrack->Pz()),
4664                                                    gPt);
4665             }
4666             else if(track->Charge() < 0) {
4667               ((TH3D *)(fRejectedCutList->At(3)))->Fill(tpcTrack->Eta(),
4668                                                         tpcTrack->Phi()*180./TMath::Pi(),
4669                                                         nClustersTPC);
4670               ((TH3D *)(fRejectedCutList->At(7)))->Fill(tpcTrack->Eta(),
4671                                                         tpcTrack->Phi()*180./TMath::Pi(),
4672                                                         chi2PerClusterTPC);
4673               ((TH3D *)(fRejectedCutList->At(11)))->Fill(tpcTrack->Eta(),
4674                                                          tpcTrack->Phi()*180./TMath::Pi(),
4675                                                          npointsTPCdEdx);
4676
4677               if(fProtonAnalysisBase->GetEtaMode())
4678                 ((TH2D *)(fQA2DList->At(7)))->Fill(tpcTrack->Eta(),gPt);
4679               else
4680                 ((TH2D *)(fQA2DList->At(7)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4681                                                             tpcTrack->Py(),
4682                                                             tpcTrack->Pz()),
4683                                                    gPt);
4684             }
4685           }//rejected secondary particles
4686         }//rejected - track cuts
4687       }//proton check
4688     }//TPC only tracks
4689     //combined tracking
4690     else {
4691       gPt = track->Pt();
4692       gP = track->P();
4693       track->PropagateToDCA(vertex,
4694                                esd->GetMagneticField(),
4695                                100.,dca,cov);
4696       
4697       //pid
4698       if(fProtonAnalysisBase->IsProton(track)) {
4699         if(!fProtonAnalysisBase->IsInPhaseSpace(track)) continue; //track outside the analyzed y-Pt
4700
4701         FillQA(stack,esd,vertex,track);
4702         if(fProtonAnalysisBase->IsPrimary(esd,vertex,track)) {
4703           if(fProtonAnalysisBase->IsAccepted(track)) {
4704             if(label <= stack->GetNprimary()) {
4705               if(track->Charge() > 0) {
4706                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4707                   if(track->HasPointOnITSLayer(iLayer))
4708                     ((TH1F *)(fAcceptedCutList->At(0)))->Fill(iLayer+1);
4709                 }
4710                 ((TH1F *)(fAcceptedCutList->At(4)))->Fill(nClustersITS);
4711                 ((TH1F *)(fAcceptedCutList->At(8)))->Fill(chi2PerClusterITS);
4712                 ((TH1F *)(fAcceptedCutList->At(12)))->Fill(chi2ConstrainVertex);
4713                 ((TH1F *)(fAcceptedCutList->At(16)))->Fill(nClustersTPC);
4714                 ((TH1F *)(fAcceptedCutList->At(20)))->Fill(chi2PerClusterTPC);
4715                 ((TH1F *)(fAcceptedCutList->At(24)))->Fill(extCov[0]);
4716                 ((TH1F *)(fAcceptedCutList->At(28)))->Fill(extCov[2]);
4717                 ((TH1F *)(fAcceptedCutList->At(32)))->Fill(extCov[5]);
4718                 ((TH1F *)(fAcceptedCutList->At(36)))->Fill(extCov[9]);
4719                 ((TH1F *)(fAcceptedCutList->At(40)))->Fill(extCov[14]);
4720                 ((TH3D *)(fAcceptedCutList->At(44)))->Fill(track->Eta(),
4721                                                            track->Phi()*180./TMath::Pi(),
4722                                                            nClustersTPC);
4723                 ((TH3D *)(fAcceptedCutList->At(48)))->Fill(track->Eta(),
4724                                                            track->Phi()*180./TMath::Pi(),
4725                                                            chi2PerClusterTPC);
4726                 ((TH3D *)(fAcceptedCutList->At(52)))->Fill(track->Eta(),
4727                                                            track->Phi()*180./TMath::Pi(),
4728                                                            npointsTPCdEdx);
4729                 ((TH1F *)(fAcceptedCutList->At(56)))->Fill(npointsTPCdEdx);
4730                 
4731                 ((TH1F *)(fAcceptedDCAList->At(0)))->Fill(TMath::Abs(dca[0]));
4732                 ((TH1F *)(fAcceptedDCAList->At(4)))->Fill(TMath::Abs(dca[1]));
4733                 ((TH1F *)(fAcceptedDCAList->At(8)))->Fill(nSigmaToVertex);
4734                 ((TH1F *)(fAcceptedDCAList->At(12)))->Fill(gPt,TMath::Abs(dca[0]));
4735                 ((TH1F *)(fAcceptedDCAList->At(18)))->Fill(gPt,TMath::Abs(dca[0]));
4736                 if(fProtonAnalysisBase->GetEtaMode())
4737                   ((TH2D *)(fQA2DList->At(0)))->Fill(track->Eta(),gPt);
4738                 else
4739                   ((TH2D *)(fQA2DList->At(0)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4740                                                                                    track->Py(),
4741                                                                                    track->Pz()),
4742                                                      gPt);
4743               }
4744               else if(track->Charge() < 0) {
4745                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4746                   if(track->HasPointOnITSLayer(iLayer))
4747                     ((TH1F *)(fAcceptedCutList->At(1)))->Fill(iLayer+1);
4748                 }
4749                 ((TH1F *)(fAcceptedCutList->At(5)))->Fill(nClustersITS);
4750                 ((TH1F *)(fAcceptedCutList->At(9)))->Fill(chi2PerClusterITS);
4751                 ((TH1F *)(fAcceptedCutList->At(13)))->Fill(chi2ConstrainVertex);
4752                 ((TH1F *)(fAcceptedCutList->At(17)))->Fill(nClustersTPC);
4753                 ((TH1F *)(fAcceptedCutList->At(21)))->Fill(chi2PerClusterTPC);
4754                 ((TH1F *)(fAcceptedCutList->At(25)))->Fill(extCov[0]);
4755                 ((TH1F *)(fAcceptedCutList->At(29)))->Fill(extCov[2]);
4756                 ((TH1F *)(fAcceptedCutList->At(33)))->Fill(extCov[5]);
4757                 ((TH1F *)(fAcceptedCutList->At(37)))->Fill(extCov[9]);
4758                 ((TH1F *)(fAcceptedCutList->At(41)))->Fill(extCov[14]);
4759                 ((TH3D *)(fAcceptedCutList->At(45)))->Fill(track->Eta(),
4760                                                            track->Phi()*180./TMath::Pi(),
4761                                                            nClustersTPC);
4762                 ((TH3D *)(fAcceptedCutList->At(49)))->Fill(track->Eta(),
4763                                                            track->Phi()*180./TMath::Pi(),
4764                                                            chi2PerClusterTPC);
4765                 ((TH3D *)(fAcceptedCutList->At(53)))->Fill(track->Eta(),
4766                                                            track->Phi()*180./TMath::Pi(),
4767                                                            npointsTPCdEdx);
4768                 ((TH1F *)(fAcceptedCutList->At(57)))->Fill(npointsTPCdEdx);
4769                 
4770                 ((TH1F *)(fAcceptedDCAList->At(1)))->Fill(TMath::Abs(dca[0]));
4771                 ((TH1F *)(fAcceptedDCAList->At(5)))->Fill(TMath::Abs(dca[1]));
4772                 ((TH1F *)(fAcceptedDCAList->At(9)))->Fill(nSigmaToVertex);
4773                 ((TH1F *)(fAcceptedDCAList->At(13)))->Fill(gPt,TMath::Abs(dca[0]));
4774                 ((TH1F *)(fAcceptedDCAList->At(19)))->Fill(gPt,TMath::Abs(dca[0]));
4775                 if(fProtonAnalysisBase->GetEtaMode())
4776                   ((TH2D *)(fQA2DList->At(4)))->Fill(track->Eta(),gPt);
4777                 else
4778                   ((TH2D *)(fQA2DList->At(4)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4779                                                                                    track->Py(),
4780                                                                                    track->Pz()),
4781                                                      gPt);
4782               }
4783             }//primary particles
4784             else if(label > stack->GetNprimary()) {
4785               Int_t lPartMother = -1;
4786               Int_t motherPDGCode = -1;
4787               if(particle) {
4788                 lPartMother = particle->GetFirstMother();
4789                 TParticle *motherParticle = stack->Particle(lPartMother);
4790                 if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
4791               }
4792               
4793               if(fMCProcessIdFlag)
4794                 if(particle->GetUniqueID() != fMCProcessId) continue;
4795               if(fMotherParticlePDGCodeFlag)
4796                 if(TMath::Abs(motherPDGCode) != fMotherParticlePDGCode) continue;
4797               
4798               if(track->Charge() > 0) {
4799                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4800                   if(track->HasPointOnITSLayer(iLayer))
4801                     ((TH1F *)(fAcceptedCutList->At(2)))->Fill(iLayer+1);
4802                 }
4803                 ((TH1F *)(fAcceptedCutList->At(6)))->Fill(nClustersITS);
4804                 ((TH1F *)(fAcceptedCutList->At(10)))->Fill(chi2PerClusterITS);
4805                 ((TH1F *)(fAcceptedCutList->At(14)))->Fill(chi2ConstrainVertex);
4806                 ((TH1F *)(fAcceptedCutList->At(18)))->Fill(nClustersTPC);
4807                 ((TH1F *)(fAcceptedCutList->At(22)))->Fill(chi2PerClusterTPC);
4808                 ((TH1F *)(fAcceptedCutList->At(26)))->Fill(extCov[0]);
4809                 ((TH1F *)(fAcceptedCutList->At(30)))->Fill(extCov[2]);
4810                 ((TH1F *)(fAcceptedCutList->At(34)))->Fill(extCov[5]);
4811                 ((TH1F *)(fAcceptedCutList->At(38)))->Fill(extCov[9]);
4812                 ((TH1F *)(fAcceptedCutList->At(42)))->Fill(extCov[14]);
4813                 ((TH3D *)(fAcceptedCutList->At(46)))->Fill(track->Eta(),
4814                                                            track->Phi()*180./TMath::Pi(),
4815                                                            nClustersTPC);
4816                 ((TH3D *)(fAcceptedCutList->At(50)))->Fill(track->Eta(),
4817                                                            track->Phi()*180./TMath::Pi(),
4818                                                            chi2PerClusterTPC);
4819                 ((TH3D *)(fAcceptedCutList->At(54)))->Fill(track->Eta(),
4820                                                            track->Phi()*180./TMath::Pi(),
4821                                                            npointsTPCdEdx);
4822                 ((TH1F *)(fAcceptedCutList->At(58)))->Fill(npointsTPCdEdx);
4823                 
4824                 ((TH1F *)(fAcceptedDCAList->At(2)))->Fill(TMath::Abs(dca[0]));
4825                 ((TH1F *)(fAcceptedDCAList->At(6)))->Fill(TMath::Abs(dca[1]));
4826                 ((TH1F *)(fAcceptedDCAList->At(10)))->Fill(nSigmaToVertex);
4827                 if(particle->GetUniqueID() == 4) {
4828                   ((TH2F *)(fAcceptedDCAList->At(14)))->Fill(gPt,TMath::Abs(dca[0]));
4829                   ((TH2F *)(fAcceptedDCAList->At(20)))->Fill(gPt,TMath::Abs(dca[1]));
4830                 }
4831                 if(particle->GetUniqueID() == 13) {
4832                   ((TH2F *)(fAcceptedDCAList->At(16)))->Fill(gPt,TMath::Abs(dca[0]));
4833                   ((TH2F *)(fAcceptedDCAList->At(22)))->Fill(gPt,TMath::Abs(dca[1]));
4834                 }
4835                 if(fProtonAnalysisBase->GetEtaMode())
4836                   ((TH2D *)(fQA2DList->At(2)))->Fill(track->Eta(),gPt);
4837                 else
4838                   ((TH2D *)(fQA2DList->At(2)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4839                                                                                    track->Py(),
4840                                                                                    track->Pz()),
4841                                                      gPt);
4842                 if(fProtonAnalysisBase->GetEtaMode())
4843                   ((TH3F *)(fQA2DList->At(10)))->Fill(track->Eta(),gPt,
4844                                                       ConvertPDGToInt(motherPDGCode));
4845                 else
4846                   ((TH3F *)(fQA2DList->At(10)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4847                                                                                     track->Py(),
4848                                                                                     track->Pz()),
4849                                                       gPt,
4850                                                       ConvertPDGToInt(motherPDGCode));
4851               }
4852               else if(track->Charge() < 0) {
4853                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4854                   if(track->HasPointOnITSLayer(iLayer))
4855                     ((TH1F *)(fAcceptedCutList->At(3)))->Fill(iLayer+1);
4856                 }
4857                 ((TH1F *)(fAcceptedCutList->At(7)))->Fill(nClustersITS);
4858                 ((TH1F *)(fAcceptedCutList->At(11)))->Fill(chi2PerClusterITS);
4859                 ((TH1F *)(fAcceptedCutList->At(15)))->Fill(chi2ConstrainVertex);
4860                 ((TH1F *)(fAcceptedCutList->At(19)))->Fill(nClustersTPC);
4861                 ((TH1F *)(fAcceptedCutList->At(23)))->Fill(chi2PerClusterTPC);
4862                 ((TH1F *)(fAcceptedCutList->At(27)))->Fill(extCov[0]);
4863                 ((TH1F *)(fAcceptedCutList->At(31)))->Fill(extCov[2]);
4864                 ((TH1F *)(fAcceptedCutList->At(35)))->Fill(extCov[5]);
4865                 ((TH1F *)(fAcceptedCutList->At(39)))->Fill(extCov[9]);
4866                 ((TH1F *)(fAcceptedCutList->At(43)))->Fill(extCov[14]);
4867                 ((TH3D *)(fAcceptedCutList->At(47)))->Fill(track->Eta(),
4868                                                            track->Phi()*180./TMath::Pi(),
4869                                                            nClustersTPC);
4870                 ((TH3D *)(fAcceptedCutList->At(51)))->Fill(track->Eta(),
4871                                                            track->Phi()*180./TMath::Pi(),
4872                                                            chi2PerClusterTPC);
4873                 ((TH3D *)(fAcceptedCutList->At(55)))->Fill(track->Eta(),
4874                                                            track->Phi()*180./TMath::Pi(),
4875                                                            npointsTPCdEdx);
4876                 ((TH1F *)(fAcceptedCutList->At(59)))->Fill(npointsTPCdEdx);
4877                 
4878                 ((TH1F *)(fAcceptedDCAList->At(3)))->Fill(TMath::Abs(dca[0]));
4879                 ((TH1F *)(fAcceptedDCAList->At(7)))->Fill(TMath::Abs(dca[1]));
4880                 ((TH1F *)(fAcceptedDCAList->At(11)))->Fill(nSigmaToVertex);
4881                 if(particle->GetUniqueID() == 4) {
4882                   ((TH2F *)(fAcceptedDCAList->At(15)))->Fill(gPt,TMath::Abs(dca[0]));
4883                   ((TH2F *)(fAcceptedDCAList->At(21)))->Fill(gPt,TMath::Abs(dca[1]));
4884                 }
4885                 if(particle->GetUniqueID() == 13) {
4886                   ((TH2F *)(fAcceptedDCAList->At(17)))->Fill(gPt,TMath::Abs(dca[0]));
4887                   ((TH2F *)(fAcceptedDCAList->At(23)))->Fill(gPt,TMath::Abs(dca[1]));
4888                 }
4889                 if(fProtonAnalysisBase->GetEtaMode())
4890                   ((TH2D *)(fQA2DList->At(6)))->Fill(track->Eta(),gPt);
4891                 else
4892                   ((TH2D *)(fQA2DList->At(6)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4893                                                                                    track->Py(),
4894                                                                                    track->Pz()),
4895                                                      gPt);
4896                 if(fProtonAnalysisBase->GetEtaMode())
4897                   ((TH3F *)(fQA2DList->At(11)))->Fill(track->Eta(),gPt,
4898                                                       ConvertPDGToInt(motherPDGCode));
4899                 else
4900                   ((TH3F *)(fQA2DList->At(11)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4901                                                                                     track->Py(),
4902                                                                                     track->Pz()),
4903                                                       gPt,
4904                                                       ConvertPDGToInt(motherPDGCode));
4905               }
4906             }//secondary particles
4907           }//accepted - track cuts
4908         }//primary-like cut
4909         else if((!fProtonAnalysisBase->IsAccepted(track)) || 
4910                 (!fProtonAnalysisBase->IsPrimary(esd,vertex,track))) {
4911           if(label <= stack->GetNprimary()) {
4912             if(track->Charge() > 0) {
4913               ((TH3D *)(fRejectedCutList->At(0)))->Fill(track->Eta(),
4914                                                         track->Phi()*180./TMath::Pi(),
4915                                                         nClustersTPC);
4916               ((TH3D *)(fRejectedCutList->At(4)))->Fill(track->Eta(),
4917                                                         track->Phi()*180./TMath::Pi(),
4918                                                         chi2PerClusterTPC);
4919               ((TH3D *)(fRejectedCutList->At(8)))->Fill(track->Eta(),
4920                                                         track->Phi()*180./TMath::Pi(),
4921                                                         npointsTPCdEdx);
4922               if(fProtonAnalysisBase->GetEtaMode())
4923                 ((TH2D *)(fQA2DList->At(1)))->Fill(track->Eta(),gPt);
4924               else
4925                 ((TH2D *)(fQA2DList->At(1)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4926                                                             track->Py(),
4927                                                             track->Pz()),
4928                                                    gPt);
4929             }
4930             else if(track->Charge() < 0) {
4931               ((TH3D *)(fRejectedCutList->At(1)))->Fill(track->Eta(),
4932                                                         track->Phi()*180./TMath::Pi(),
4933                                                         nClustersTPC);
4934               ((TH3D *)(fRejectedCutList->At(5)))->Fill(track->Eta(),
4935                                                         track->Phi()*180./TMath::Pi(),
4936                                                         chi2PerClusterTPC);
4937               ((TH3D *)(fRejectedCutList->At(9)))->Fill(track->Eta(),
4938                                                         track->Phi()*180./TMath::Pi(),
4939                                                         npointsTPCdEdx);
4940                                                 
4941               if(fProtonAnalysisBase->GetEtaMode())
4942                 ((TH2D *)(fQA2DList->At(5)))->Fill(track->Eta(),gPt);
4943               else
4944                 ((TH2D *)(fQA2DList->At(5)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4945                                                             track->Py(),
4946                                                             track->Pz()),
4947                                                    gPt);
4948             }
4949           }//primary particles
4950           else if(label > stack->GetNprimary()) {
4951             if(track->Charge() > 0) {
4952               ((TH3D *)(fRejectedCutList->At(2)))->Fill(track->Eta(),
4953                                                         track->Phi()*180./TMath::Pi(),
4954                                                         nClustersTPC);
4955               ((TH3D *)(fRejectedCutList->At(6)))->Fill(track->Eta(),
4956                                                         track->Phi()*180./TMath::Pi(),
4957                                                         chi2PerClusterTPC);
4958               ((TH3D *)(fRejectedCutList->At(10)))->Fill(track->Eta(),
4959                                                         track->Phi()*180./TMath::Pi(),
4960                                                         npointsTPCdEdx);
4961               if(fProtonAnalysisBase->GetEtaMode())
4962                 ((TH2D *)(fQA2DList->At(3)))->Fill(track->Eta(),gPt);
4963               else
4964                 ((TH2D *)(fQA2DList->At(3)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4965                                                             track->Py(),
4966                                                             track->Pz()),
4967                                                    gPt);
4968             }
4969             else if(track->Charge() < 0) {
4970               ((TH3D *)(fRejectedCutList->At(3)))->Fill(track->Eta(),
4971                                                         track->Phi()*180./TMath::Pi(),
4972                                                         nClustersTPC);
4973               ((TH3D *)(fRejectedCutList->At(7)))->Fill(track->Eta(),
4974                                                         track->Phi()*180./TMath::Pi(),
4975                                                         chi2PerClusterTPC);
4976               ((TH3D *)(fRejectedCutList->At(11)))->Fill(track->Eta(),
4977                                                         track->Phi()*180./TMath::Pi(),
4978                                                         npointsTPCdEdx);
4979               if(fProtonAnalysisBase->GetEtaMode())
4980                 ((TH2D *)(fQA2DList->At(7)))->Fill(track->Eta(),gPt);
4981               else
4982                 ((TH2D *)(fQA2DList->At(7)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4983                                                             track->Py(),
4984                                                             track->Pz()),
4985                                                    gPt);
4986             }
4987           }//secondary particles
4988         }//rejected - track cuts
4989       }//proton check
4990     }//combined tracking
4991   }//track loop
4992     
4993 }
4994
4995 //____________________________________________________________________//
4996 void AliProtonQAAnalysis::InitMCAnalysis() {
4997   //MC analysis - 3D histograms: y-pT-pdg
4998   fPDGList = new TList();
4999   TH3F *gHistYPtPDGProtons = 0x0;
5000   if(fUseAsymmetricBinning) {
5001     Double_t gPDG[15] = {-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5,11.5,12.5,13.5};
5002   gHistYPtPDGProtons = new TH3F("gHistYPtPDGProtons",
5003                                 ";;P_{T} [GeV/c];PDG",
5004                                 fNBinsY,fY,fNBinsPt,fPt,14,gPDG);
5005   }
5006   else
5007     gHistYPtPDGProtons = new TH3F("gHistYPtPDGProtons",
5008                                   ";;P_{T} [GeV/c];PDG",
5009                                   fNBinsY,fMinY,fMaxY,
5010                                   fNBinsPt,fMinPt,fMaxPt,
5011                                   14,-0.5,13.5);
5012   if(fProtonAnalysisBase->GetEtaMode()) 
5013     gHistYPtPDGProtons->GetXaxis()->SetTitle("#eta");
5014   else 
5015     gHistYPtPDGProtons->GetXaxis()->SetTitle("y");
5016   fPDGList->Add(gHistYPtPDGProtons);
5017   TH3F *gHistYPtPDGAntiProtons = 0x0;
5018   if(fUseAsymmetricBinning) {
5019     Double_t gPDG[15] = {-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5,11.5,12.5,13.5};
5020     gHistYPtPDGAntiProtons = new TH3F("gHistYPtPDGAntiProtons",
5021                                       ";;P_{T} [GeV/c];PDG",
5022                                       fNBinsY,fY,fNBinsPt,fPt,14,gPDG);
5023   }
5024   else
5025     gHistYPtPDGAntiProtons = new TH3F("gHistYPtPDGAntiProtons",
5026                                       ";;P_{T} [GeV/c];PDG",
5027                                       fNBinsY,fMinY,fMaxY,
5028                                       fNBinsPt,fMinPt,fMaxPt,
5029                                       14,-0.5,13.5);
5030   if(fProtonAnalysisBase->GetEtaMode()) 
5031     gHistYPtPDGAntiProtons->GetXaxis()->SetTitle("#eta");
5032   else 
5033     gHistYPtPDGAntiProtons->GetXaxis()->SetTitle("y");
5034   fPDGList->Add(gHistYPtPDGAntiProtons);
5035
5036   //MC processes
5037   fMCProcessesList = new TList();
5038   TH1F *gHistProtonsFromKLProcess = new TH1F("gHistProtonsFromKLProcess","",51,-0.5,50.5);
5039   fMCProcessesList->Add(gHistProtonsFromKLProcess);
5040   TH1F *gHistProtonsFromPionProcess = new TH1F("gHistProtonsFromPionProcess","",51,-0.5,50.5);
5041   fMCProcessesList->Add(gHistProtonsFromPionProcess);
5042   TH1F *gHistProtonsFromKSProcess = new TH1F("gHistProtonsFromKSProcess","",51,-0.5,50.5);
5043   fMCProcessesList->Add(gHistProtonsFromKSProcess);
5044   TH1F *gHistProtonsFromKaonProcess = new TH1F("gHistProtonsFromKaonProcess","",51,-0.5,50.5);
5045   fMCProcessesList->Add(gHistProtonsFromKaonProcess);
5046   TH1F *gHistProtonsFromNeutronProcess = new TH1F("gHistProtonsFromNeutronProcess","",51,-0.5,50.5);
5047   fMCProcessesList->Add(gHistProtonsFromNeutronProcess);
5048   TH1F *gHistProtonsFromProtonProcess = new TH1F("gHistProtonsFromProtonProcess","",51,-0.5,50.5);
5049   fMCProcessesList->Add(gHistProtonsFromProtonProcess);
5050   TH1F *gHistProtonsFromSigmaMinusProcess = new TH1F("gHistProtonsFromSigmaMinusProcess","",51,-0.5,50.5);
5051   fMCProcessesList->Add(gHistProtonsFromSigmaMinusProcess);
5052   TH1F *gHistProtonsFromLambda0Process = new TH1F("gHistProtonsFromLambda0Process","",51,-0.5,50.5);
5053   fMCProcessesList->Add(gHistProtonsFromLambda0Process);
5054   TH1F *gHistProtonsFromSigmaPlusProcess = new TH1F("gHistProtonsFromSigmaPlusProcess","",51,-0.5,50.5);
5055   fMCProcessesList->Add(gHistProtonsFromSigmaPlusProcess);
5056   TH1F *gHistProtonsFromXiMinusProcess = new TH1F("gHistProtonsFromXiMinusProcess","",51,-0.5,50.5);
5057   fMCProcessesList->Add(gHistProtonsFromXiMinusProcess);
5058   TH1F *gHistProtonsFromXi0Process = new TH1F("gHistProtonsFromXi0Process","",51,-0.5,50.5);                                        
5059   fMCProcessesList->Add(gHistProtonsFromXi0Process);
5060   TH1F *gHistProtonsFromOmegaProcess = new TH1F("gHistProtonsFromOmegaProcess","",51,-0.5,50.5); 
5061   fMCProcessesList->Add(gHistProtonsFromOmegaProcess);
5062
5063   TH1F *gHistAntiProtonsFromKLProcess = new TH1F("gHistAntiProtonsFromKLProcess","",51,-0.5,50.5); 
5064   fMCProcessesList->Add(gHistAntiProtonsFromKLProcess);
5065   TH1F *gHistAntiProtonsFromPionProcess = new TH1F("gHistAntiProtonsFromPionProcess","",51,-0.5,50.5); 
5066   fMCProcessesList->Add(gHistAntiProtonsFromPionProcess);
5067   TH1F *gHistAntiProtonsFromKSProcess = new TH1F("gHistAntiProtonsFromKSProcess","",51,-0.5,50.5); 
5068   fMCProcessesList->Add(gHistAntiProtonsFromKSProcess);
5069   TH1F *gHistAntiProtonsFromKaonProcess = new TH1F("gHistAntiProtonsFromKaonProcess","",51,-0.5,50.5); 
5070   fMCProcessesList->Add(gHistAntiProtonsFromKaonProcess);
5071   TH1F *gHistAntiProtonsFromNeutronProcess = new TH1F("gHistAntiProtonsFromNeutronProcess","",51,-0.5,50.5); 
5072   fMCProcessesList->Add(gHistAntiProtonsFromNeutronProcess);
5073   TH1F *gHistAntiProtonsFromProtonProcess = new TH1F("gHistAntiProtonsFromProtonProcess","",51,-0.5,50.5); 
5074   fMCProcessesList->Add(gHistAntiProtonsFromProtonProcess);
5075   TH1F *gHistAntiProtonsFromLambda0Process = new TH1F("gHistAntiProtonsFromLambda0Process","",51,-0.5,50.5); 
5076   fMCProcessesList->Add(gHistAntiProtonsFromLambda0Process);
5077   TH1F *gHistAntiProtonsFromSigmaPlusProcess = new TH1F("gHistAntiProtonsFromSigmaPlusProcess","",51,-0.5,50.5); 
5078   fMCProcessesList->Add(gHistAntiProtonsFromSigmaPlusProcess);
5079 }
5080
5081 //____________________________________________________________________//
5082 void AliProtonQAAnalysis::RunMCAnalysis(AliStack* const stack) {
5083   //Main analysis part - MC 
5084   for(Int_t iParticle = 0; iParticle < stack->GetNtrack(); iParticle++) {
5085     TParticle *particle = stack->Particle(iParticle);
5086     if(!particle) continue;
5087
5088     if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
5089     if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
5090     if(fProtonAnalysisBase->GetEtaMode()) {
5091       if((particle->Eta() > fMaxY)||(particle->Eta() < fMinY)) continue;
5092     }
5093     else {
5094       if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
5095     }
5096
5097     Int_t pdgcode = particle->GetPdgCode();
5098     if(pdgcode == 2212) {
5099       if(iParticle <= stack->GetNprimary()) {
5100         if(fProtonAnalysisBase->GetEtaMode())
5101           ((TH3F *)(fPDGList->At(0)))->Fill(particle->Eta(),particle->Pt(),0);
5102         else
5103           ((TH3F *)(fPDGList->At(0)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
5104                                                      particle->Py(),
5105                                                      particle->Pz()),
5106                                             particle->Pt(),0);
5107       }
5108       else if(iParticle > stack->GetNprimary()) {
5109         Int_t lPartMother = particle->GetFirstMother();
5110         TParticle *motherParticle = stack->Particle(lPartMother);
5111         if(!motherParticle) continue;
5112         Int_t motherPDGCode = motherParticle->GetPdgCode();
5113         if(fMCProcessIdFlag)
5114           if(particle->GetUniqueID() != fMCProcessId) continue;
5115         if(fMotherParticlePDGCodeFlag)
5116           if(TMath::Abs(motherPDGCode) != fMotherParticlePDGCode) continue;
5117
5118         if(fProtonAnalysisBase->GetEtaMode())
5119           ((TH3F *)(fPDGList->At(0)))->Fill(particle->Eta(),
5120                                             particle->Pt(),
5121                                             ConvertPDGToInt(motherParticle->GetPdgCode()));
5122         else
5123           ((TH3F *)(fPDGList->At(0)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
5124                                                      particle->Py(),
5125                                                      particle->Pz()),
5126                                             particle->Pt(),
5127                                             ConvertPDGToInt(motherParticle->GetPdgCode()));
5128         //processes
5129         if(TMath::Abs(motherParticle->GetPdgCode()) == 130)
5130           ((TH1F *)(fMCProcessesList->At(0)))->Fill(particle->GetUniqueID());
5131         if(TMath::Abs(motherParticle->GetPdgCode()) == 211)
5132           ((TH1F *)(fMCProcessesList->At(1)))->Fill(particle->GetUniqueID());
5133         if(TMath::Abs(motherParticle->GetPdgCode()) == 310)
5134           ((TH1F *)(fMCProcessesList->At(2)))->Fill(particle->GetUniqueID());
5135         if(TMath::Abs(motherParticle->GetPdgCode()) == 321)
5136           ((TH1F *)(fMCProcessesList->At(3)))->Fill(particle->GetUniqueID());
5137         if(TMath::Abs(motherParticle->GetPdgCode()) == 2112)
5138           ((TH1F *)(fMCProcessesList->At(4)))->Fill(particle->GetUniqueID());
5139         if(TMath::Abs(motherParticle->GetPdgCode()) == 2212)
5140           ((TH1F *)(fMCProcessesList->At(5)))->Fill(particle->GetUniqueID());
5141         if(TMath::Abs(motherParticle->GetPdgCode()) == 3112)
5142           ((TH1F *)(fMCProcessesList->At(6)))->Fill(particle->GetUniqueID());
5143         if(TMath::Abs(motherParticle->GetPdgCode()) == 3122)
5144           ((TH1F *)(fMCProcessesList->At(7)))->Fill(particle->GetUniqueID());
5145         if(TMath::Abs(motherParticle->GetPdgCode()) == 3222)
5146           ((TH1F *)(fMCProcessesList->At(8)))->Fill(particle->GetUniqueID());
5147         if(TMath::Abs(motherParticle->GetPdgCode()) == 3312)
5148           ((TH1F *)(fMCProcessesList->At(9)))->Fill(particle->GetUniqueID());
5149         if(TMath::Abs(motherParticle->GetPdgCode()) == 3322)
5150           ((TH1F *)(fMCProcessesList->At(10)))->Fill(particle->GetUniqueID());
5151         if(TMath::Abs(motherParticle->GetPdgCode()) == 3334)
5152           ((TH1F *)(fMCProcessesList->At(11)))->Fill(particle->GetUniqueID());
5153       }//secondary proton
5154     }//pdgcode of proton
5155
5156     if(pdgcode == -2212) {
5157       if(iParticle <= stack->GetNprimary()) {
5158         if(fProtonAnalysisBase->GetEtaMode())
5159           ((TH3F *)(fPDGList->At(1)))->Fill(particle->Eta(),particle->Pt(),0);
5160         else
5161           ((TH3F *)(fPDGList->At(1)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
5162                                                      particle->Py(),
5163                                                      particle->Pz()),
5164                                             particle->Pt(),0);
5165       }
5166       else if(iParticle > stack->GetNprimary()) {
5167         Int_t lPartMother = particle->GetFirstMother();
5168         TParticle *motherParticle = stack->Particle(lPartMother);
5169         if(!motherParticle) continue;
5170         Int_t motherPDGCode = motherParticle->GetPdgCode();
5171         if(fMCProcessIdFlag)
5172           if(particle->GetUniqueID() != fMCProcessId) continue;
5173         if(fMotherParticlePDGCodeFlag)
5174           if(TMath::Abs(motherPDGCode) != fMotherParticlePDGCode) continue;
5175
5176         if(fProtonAnalysisBase->GetEtaMode())
5177           ((TH3F *)(fPDGList->At(1)))->Fill(particle->Eta(),
5178                                             particle->Pt(),
5179                                             ConvertPDGToInt(motherParticle->GetPdgCode()));
5180         else
5181           ((TH3F *)(fPDGList->At(1)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
5182                                                      particle->Py(),
5183                                                      particle->Pz()),
5184                                             particle->Pt(),
5185                                             ConvertPDGToInt(motherParticle->GetPdgCode()));
5186
5187         //processes
5188         if(TMath::Abs(motherParticle->GetPdgCode()) == 130)
5189           ((TH1F *)(fMCProcessesList->At(12)))->Fill(particle->GetUniqueID());
5190         if(TMath::Abs(motherParticle->GetPdgCode()) == 211)
5191           ((TH1F *)(fMCProcessesList->At(13)))->Fill(particle->GetUniqueID());
5192         if(TMath::Abs(motherParticle->GetPdgCode()) == 310)
5193           ((TH1F *)(fMCProcessesList->At(14)))->Fill(particle->GetUniqueID());
5194         if(TMath::Abs(motherParticle->GetPdgCode()) == 321)
5195           ((TH1F *)(fMCProcessesList->At(15)))->Fill(particle->GetUniqueID());
5196         if(TMath::Abs(motherParticle->GetPdgCode()) == 2112)
5197           ((TH1F *)(fMCProcessesList->At(16)))->Fill(particle->GetUniqueID());
5198         if(TMath::Abs(motherParticle->GetPdgCode()) == 2212)
5199           ((TH1F *)(fMCProcessesList->At(17)))->Fill(particle->GetUniqueID());
5200         if(TMath::Abs(motherParticle->GetPdgCode()) == 3122)
5201           ((TH1F *)(fMCProcessesList->At(18)))->Fill(particle->GetUniqueID());
5202         if(TMath::Abs(motherParticle->GetPdgCode()) == 3222)
5203           ((TH1F *)(fMCProcessesList->At(19)))->Fill(particle->GetUniqueID());
5204       }//secondary antiproton
5205     }//pdgcode of antiproton
5206
5207   }//particle loop
5208 }
5209
5210 //____________________________________________________________________//
5211 Int_t AliProtonQAAnalysis::ConvertPDGToInt(Int_t pdgCode) const {
5212   //Converts the pdg code to an int based on the following scheme:
5213   //1: PDG code: 130 - Name: K_L0
5214   //2: PDG code: 211 - Name: pi+
5215   //3: PDG code: 310 - Name: K_S0
5216   //4: PDG code: 321 - Name: K+
5217   //5: PDG code: 2112 - Name: neutron
5218   //6: PDG code: 2212 - Name: proton
5219   //7: PDG code: 3112 - Name: Sigma-
5220   //8: PDG code: 3122 - Name: Lambda0
5221   //9: PDG code: 3222 - Name: Sigma+
5222   //10: PDG code: 3312 - Name: Xi-
5223   //11: PDG code: 3322 - Name: Xi0
5224   //12: PDG code: 3334 - Name: Omega-
5225   Int_t code = -1;
5226   switch (TMath::Abs(pdgCode)) {
5227   case 130: {
5228     code = 1;
5229     break;
5230   }
5231   case 211: {
5232     code = 2;
5233     break;
5234   }
5235   case 310: {
5236     code = 3;
5237     break;
5238   }
5239   case 321: {
5240     code = 4;
5241     break;
5242   }
5243   case 2112: {
5244     code = 5;
5245     break;
5246   }
5247   case 2212: {
5248     code = 6;
5249     break;
5250   }
5251   case 3112: {
5252     code = 7;
5253     break;
5254   }
5255   case 3122: {
5256     code = 8;
5257     break;
5258   }
5259   case 3222: {
5260     code = 9;
5261     break;
5262   }
5263   case 3312: {
5264     code = 10;
5265     break;
5266   }
5267   case 3322: {
5268     code = 11;
5269     break;
5270   }
5271   case 3334: {
5272     code = 12;
5273     break;
5274   }
5275   default: {
5276     code = -1;
5277     break;
5278   }
5279   }//switch
5280
5281   return code;
5282 }
5283
5284
5285
5286
5287
5288