]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/SPECTRA/AntiprotonToProton/AliProtonQAAnalysis.cxx
Added possibility to do cut on TPCnSigma and rapidity in the task.
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / AntiprotonToProton / 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   //3D DCA vs pT plots
1958   TH3F *gHistPrimaryProtonsDCAxyEtaPt = new TH3F("gHistPrimaryProtonsDCAxyEtaPt",
1959                                                  ";#eta;P_{T} [GeV/c];dca_{xy} [cm]",
1960                                                  9,-0.9,0.9,
1961                                                  6,0.45,1.05,
1962                                                  100,0,10);
1963   gHistPrimaryProtonsDCAxyEtaPt->SetStats(kFALSE);
1964   fAcceptedDCAList->Add(gHistPrimaryProtonsDCAxyEtaPt);
1965   TH3F *gHistPrimaryAntiProtonsDCAxyEtaPt = new TH3F("gHistPrimaryAntiProtonsDCAxyEtaPt",
1966                                                      ";#eta;P_{T} [GeV/c];dca_{xy} [cm]",
1967                                                      9,-0.9,0.9,
1968                                                      6,0.45,1.05,
1969                                                      100,0,10);
1970   gHistPrimaryAntiProtonsDCAxyEtaPt->SetStats(kFALSE);
1971   fAcceptedDCAList->Add(gHistPrimaryAntiProtonsDCAxyEtaPt);
1972   TH3F *gHistSecondaryProtonsFromWeakDCAxyEtaPt = new TH3F("gHistSecondaryProtonsFromWeakDCAxyEtaPt",
1973                                                            ";#eta;P_{T} [GeV/c];dca_{xy} [cm]",
1974                                                            9,-0.9,0.9,
1975                                                            6,0.45,1.05,
1976                                                            100,0,10);
1977   gHistSecondaryProtonsFromWeakDCAxyEtaPt->SetStats(kFALSE);
1978   fAcceptedDCAList->Add(gHistSecondaryProtonsFromWeakDCAxyEtaPt);
1979   TH3F *gHistSecondaryAntiProtonsFromWeakDCAxyEtaPt = new TH3F("gHistSecondaryAntiProtonsFromWeakDCAxyEtaPt",
1980                                                                ";#eta;P_{T} [GeV/c];dca_{xy} [cm]",
1981                                                                9,-0.9,0.9,
1982                                                                6,0.45,1.05,
1983                                                                100,0,10);
1984   gHistSecondaryAntiProtonsFromWeakDCAxyEtaPt->SetStats(kFALSE);
1985   fAcceptedDCAList->Add(gHistSecondaryAntiProtonsFromWeakDCAxyEtaPt);
1986   TH3F *gHistSecondaryProtonsFromHadronicDCAxyEtaPt = new TH3F("gHistSecondaryProtonsFromHadronicDCAxyEtaPt",
1987                                                                ";#eta;P_{T} [GeV/c];dca_{xy} [cm]",
1988                                                                9,-0.9,0.9,
1989                                                                6,0.45,1.05,
1990                                                                100,0,10);
1991   gHistSecondaryProtonsFromHadronicDCAxyEtaPt->SetStats(kFALSE);
1992   fAcceptedDCAList->Add(gHistSecondaryProtonsFromHadronicDCAxyEtaPt);
1993   TH3F *gHistSecondaryAntiProtonsFromHadronicDCAxyEtaPt = new TH3F("gHistSecondaryAntiProtonsFromHadronicDCAxyEtaPt",
1994                                                                    ";#eta;P_{T} [GeV/c];dca_{xy} [cm]",
1995                                                                    9,-0.9,0.9,
1996                                                                    6,0.45,1.05,
1997                                                                    100,0,10);
1998   gHistSecondaryAntiProtonsFromHadronicDCAxyEtaPt->SetStats(kFALSE);
1999   fAcceptedDCAList->Add(gHistSecondaryAntiProtonsFromHadronicDCAxyEtaPt);
2000   
2001   TH3F *gHistPrimaryProtonsDCAzEtaPt = new TH3F("gHistPrimaryProtonsDCAzEtaPt",
2002                                                 ";#eta;P_{T} [GeV/c];dca_{z} [cm]",
2003                                                 9,-0.9,0.9,
2004                                                 6,0.45,1.05,
2005                                                 100,0,10);
2006   gHistPrimaryProtonsDCAzEtaPt->SetStats(kFALSE);
2007   fAcceptedDCAList->Add(gHistPrimaryProtonsDCAzEtaPt);
2008   TH3F *gHistPrimaryAntiProtonsDCAzEtaPt = new TH3F("gHistPrimaryAntiProtonsDCAzEtaPt",
2009                                                     ";#eta;P_{T} [GeV/c];dca_{z} [cm]",
2010                                                     9,-0.9,0.9,
2011                                                     6,0.45,1.05,
2012                                                     100,0,10);
2013   gHistPrimaryAntiProtonsDCAzEtaPt->SetStats(kFALSE);
2014   fAcceptedDCAList->Add(gHistPrimaryAntiProtonsDCAzEtaPt);
2015   TH3F *gHistSecondaryProtonsFromWeakDCAzEtaPt = new TH3F("gHistSecondaryProtonsFromWeakDCAzEtaPt",
2016                                                           ";#eta;P_{T} [GeV/c];dca_{z} [cm]",
2017                                                           9,-0.9,0.9,
2018                                                           6,0.45,1.05,
2019                                                           100,0,10);
2020   gHistSecondaryProtonsFromWeakDCAzEtaPt->SetStats(kFALSE);
2021   fAcceptedDCAList->Add(gHistSecondaryProtonsFromWeakDCAzEtaPt);
2022   TH3F *gHistSecondaryAntiProtonsFromWeakDCAzEtaPt = new TH3F("gHistSecondaryAntiProtonsFromWeakDCAzEtaPt",
2023                                                               ";#eta;P_{T} [GeV/c];dca_{z} [cm]",
2024                                                               9,-0.9,0.9,
2025                                                               6,0.45,1.05,
2026                                                               100,0,10);
2027   gHistSecondaryAntiProtonsFromWeakDCAzEtaPt->SetStats(kFALSE);
2028   fAcceptedDCAList->Add(gHistSecondaryAntiProtonsFromWeakDCAzEtaPt);
2029   TH3F *gHistSecondaryProtonsFromHadronicDCAzEtaPt = new TH3F("gHistSecondaryProtonsFromHadronicDCAzEtaPt",
2030                                                               ";#eta;P_{T} [GeV/c];dca_{z} [cm]",
2031                                                               9,-0.9,0.9,
2032                                                               6,0.45,1.05,
2033                                                               100,0,10);
2034   gHistSecondaryProtonsFromHadronicDCAzEtaPt->SetStats(kFALSE);
2035   fAcceptedDCAList->Add(gHistSecondaryProtonsFromHadronicDCAzEtaPt);
2036   TH3F *gHistSecondaryAntiProtonsFromHadronicDCAzEtaPt = new TH3F("gHistSecondaryAntiProtonsFromHadronicDCAzEtaPt",
2037                                                                   ";#eta;P_{T} [GeV/c];dca_{z} [cm]",
2038                                                                   9,-0.9,0.9,
2039                                                                   6,0.45,1.05,
2040                                                                   100,0,10);
2041   gHistSecondaryAntiProtonsFromHadronicDCAzEtaPt->SetStats(kFALSE);
2042   fAcceptedDCAList->Add(gHistSecondaryAntiProtonsFromHadronicDCAzEtaPt);
2043 }
2044
2045 //____________________________________________________________________//
2046 void AliProtonQAAnalysis::InitVertexQA() {
2047   //Initializes the Vertex QA histograms
2048   fQAVertexList = new TList();
2049   fQAVertexList->SetName("fQAVertexList");
2050
2051   //Gen. multiplicity bins
2052   //Float_t xBins[24] = {0,1,2,4,6,8,10,15,20,30,40,50,75,100,
2053   //200,300,400,500,750,1000,1500,2000,2500,3000};
2054   //MC primary multiplicity (vertex efficiency calculation)
2055   TH1F *gHistMCPrimaryVz = new TH1F("gHistMCPrimaryVz",
2056                                     ";V_{z} (gen.) [cm];Entries",
2057                                     40,-20.,20.);
2058   fQAVertexList->Add(gHistMCPrimaryVz);
2059   //TH1F *gHistMCPrimaryMultiplicity = new TH1F("gHistMCPrimaryMultiplicity",
2060   //";N_{prim. gen.};Entries",
2061   //23,xBins);
2062   //fQAVertexList->Add(gHistMCPrimaryMultiplicity);
2063   
2064   //TPC
2065   TH1F *gHistTPCVz = new TH1F("gHistTPCVz",
2066                               ";V_{z} (gen.) [cm];Entries",
2067                               40,-20.,20.);
2068   fQAVertexList->Add(gHistTPCVz);
2069   //TH1F *gHistMCPrimaryMultiplicityTPC = new TH1F("gHistMCPrimaryMultiplicityTPC",
2070   //"Vertex TPC;N_{prim. gen.};Entries",
2071   //23,xBins);
2072   //fQAVertexList->Add(gHistMCPrimaryMultiplicityTPC);
2073   TH2F *gHistTPCESDVxN = new TH2F("gHistTPCESDVxN",
2074                                  "Primary vertex TPC;V_{x} [cm];N_{contributors}",
2075                                  100,-10.,10.,1000,0,5000);
2076   fQAVertexList->Add(gHistTPCESDVxN);
2077   TH2F *gHistTPCESDVyN = new TH2F("gHistTPCESDVyN",
2078                                  "Primary vertex TPC;V_{y} [cm];N_{contributors}",
2079                                  100,-10.,10.,1000,0,5000);
2080   fQAVertexList->Add(gHistTPCESDVyN);
2081   TH2F *gHistTPCESDVzN = new TH2F("gHistTPCESDVzN",
2082                                  "Primary vertex TPC;V_{z} [cm];N_{contributors}",
2083                                  100,-20.,20.,1000,0,5000);
2084   fQAVertexList->Add(gHistTPCESDVzN);
2085   TH1F *gHistTPCDiffVx = new TH1F("gHistTPCDiffVx",
2086                                   ";V_{x}(rec.) - V_{x}(true) [#mu m];Entries",
2087                                   100,-10000.,10000.);
2088   fQAVertexList->Add(gHistTPCDiffVx);
2089   TH1F *gHistTPCDiffVy = new TH1F("gHistTPCDiffVy",
2090                                   ";V_{y}(rec.) - V_{y}(true) [#mu m];Entries",
2091                                   100,-10000.,10000.);
2092   fQAVertexList->Add(gHistTPCDiffVy);
2093   TH1F *gHistTPCDiffVz = new TH1F("gHistTPCDiffVz",
2094                                   ";V_{z}(rec.) - V_{z}(true) [#mu m];Entries",
2095                                   100,-10000.,10000.);
2096   fQAVertexList->Add(gHistTPCDiffVz);
2097   TH1F *gHistTPCResolutionVx = new TH1F("gHistTPCResolutionVx",
2098                                         ";#sigma_{x} [#mu m];Entries",
2099                                         100,0.,1000000.);
2100   fQAVertexList->Add(gHistTPCResolutionVx);
2101   TH1F *gHistTPCResolutionVy = new TH1F("gHistTPCResolutionVy",
2102                                         ";#sigma_{y} [#mu m];Entries",
2103                                         100,0.,1000000.);
2104   fQAVertexList->Add(gHistTPCResolutionVy);
2105   TH1F *gHistTPCResolutionVz = new TH1F("gHistTPCResolutionVz",
2106                                         ";#sigma_{z} [#mu m];Entries",
2107                                         100,0.,6000.);
2108   fQAVertexList->Add(gHistTPCResolutionVz);
2109   
2110   //SPD
2111   TH1F *gHistSPDVz = new TH1F("gHistSPDVz",
2112                               ";V_{z} (gen.) [cm];Entries",
2113                               40,-20.,20.);
2114   fQAVertexList->Add(gHistSPDVz);
2115   //TH1F *gHistMCPrimaryMultiplicitySPD = new TH1F("gHistMCPrimaryMultiplicitySPD",
2116   //"Vertex SPD;N_{prim. gen.};Entries",
2117   //23,xBins);
2118   //fQAVertexList->Add(gHistMCPrimaryMultiplicitySPD);
2119   TH2F *gHistSPDESDVxN = new TH2F("gHistSPDESDVxN",
2120                                  "Primary vertex SPD;V_{x} [cm];N_{contributors}",
2121                                  100,-10.,10.,1000,0,5000);
2122   fQAVertexList->Add(gHistSPDESDVxN);
2123   TH2F *gHistSPDESDVyN = new TH2F("gHistSPDESDVyN",
2124                                  "Primary vertex SPD;V_{y} [cm];N_{contributors}",
2125                                  100,-10.,10.,1000,0,5000);
2126   fQAVertexList->Add(gHistSPDESDVyN);
2127   TH2F *gHistSPDESDVzN = new TH2F("gHistSPDESDVzN",
2128                                  "Primary vertex SPD;V_{z} [cm];N_{contributors}",
2129                                  100,-20.,20.,1000,0,5000);
2130   fQAVertexList->Add(gHistSPDESDVzN);
2131   TH1F *gHistSPDDiffVx = new TH1F("gHistSPDDiffVx",
2132                                   ";V_{x}(rec.) - V_{x}(true) [#mu m];Entries",
2133                                   100,-10000.,10000.);
2134   fQAVertexList->Add(gHistSPDDiffVx);
2135   TH1F *gHistSPDDiffVy = new TH1F("gHistSPDDiffVy",
2136                                   ";V_{y}(rec.) - V_{y}(true) [#mu m];Entries",
2137                                   100,-10000.,10000.);
2138   fQAVertexList->Add(gHistSPDDiffVy);
2139   TH1F *gHistSPDDiffVz = new TH1F("gHistSPDDiffVz",
2140                                   ";V_{z}(rec.) - V_{z}(true) [#mu m];Entries",
2141                                   100,-10000.,10000.);
2142   fQAVertexList->Add(gHistSPDDiffVz);
2143   TH1F *gHistSPDResolutionVx = new TH1F("gHistSPDResolutionVx",
2144                                         ";#sigma_{x} [#mu m];Entries",
2145                                         100,0.,1000.);
2146   fQAVertexList->Add(gHistSPDResolutionVx);
2147   TH1F *gHistSPDResolutionVy = new TH1F("gHistSPDResolutionVy",
2148                                         ";#sigma_{y} [#mu m];Entries",
2149                                         100,0.,1000.);
2150   fQAVertexList->Add(gHistSPDResolutionVy);
2151   TH1F *gHistSPDResolutionVz = new TH1F("gHistSPDResolutionVz",
2152                                         ";#sigma_{z} [#mu m];Entries",
2153                                         100,0.,500.);
2154   fQAVertexList->Add(gHistSPDResolutionVz);
2155   
2156   //Tracks
2157   TH1F *gHistTracksVz = new TH1F("gHistTracksVz",
2158                                  ";V_{z} (gen.) [cm];Entries",
2159                                  40,-20.,20.);
2160   fQAVertexList->Add(gHistTracksVz);
2161   //TH1F *gHistMCPrimaryMultiplicityTracks = new TH1F("gHistMCPrimaryMultiplicityTracks",
2162   //"Vertex Tracks;N_{prim. gen.};Entries",
2163   //23,xBins);
2164   //fQAVertexList->Add(gHistMCPrimaryMultiplicityTracks);
2165   TH2F *gHistTracksESDVxN = new TH2F("gHistTracksESDVxN",
2166                                      "Primary vertex Tracks;V_{x} [cm];N_{contributors}",
2167                                      100,-10.,10.,1000,0,5000);
2168   fQAVertexList->Add(gHistTracksESDVxN);
2169   TH2F *gHistTracksESDVyN = new TH2F("gHistTracksESDVyN",
2170                                     "Primary vertex Tracks;V_{y} [cm];N_{contributors}",
2171                                     100,-10.,10.,1000,0,5000);
2172   fQAVertexList->Add(gHistTracksESDVyN);
2173   TH2F *gHistTracksESDVzN = new TH2F("gHistTracksESDVzN",
2174                                     "Primary vertex Tracks;V_{z} [cm];N_{contributors}",
2175                                     100,-20.,20.,1000,0,5000);
2176   fQAVertexList->Add(gHistTracksESDVzN);
2177   TH1F *gHistTracksDiffVx = new TH1F("gHistTracksDiffVx",
2178                                      ";V_{x}(rec.) - V_{x}(true) [#mu m];Entries",
2179                                      100,-10000.,10000.);
2180   fQAVertexList->Add(gHistTracksDiffVx);
2181   TH1F *gHistTracksDiffVy = new TH1F("gHistTracksDiffVy",
2182                                      ";V_{y}(rec.) - V_{y}(true) [#mu m];Entries",
2183                                      100,-10000.,10000.);
2184   fQAVertexList->Add(gHistTracksDiffVy);
2185   TH1F *gHistTracksDiffVz = new TH1F("gHistTracksDiffVz",
2186                                      ";V_{z}(rec.) - V_{z}(true) [#mu m];Entries",
2187                                      100,-10000.,10000.);
2188   fQAVertexList->Add(gHistTracksDiffVz);
2189   TH1F *gHistTracksResolutionVx = new TH1F("gHistTracksResolutionVx",
2190                                            ";#sigma_{x} [#mu m];Entries",
2191                                            100,0.,5000.);
2192   fQAVertexList->Add(gHistTracksResolutionVx);
2193   TH1F *gHistTracksResolutionVy = new TH1F("gHistTracksResolutionVy",
2194                                            ";#sigma_{y} [#mu m];Entries",
2195                                            100,0.,5000.);
2196   fQAVertexList->Add(gHistTracksResolutionVy);
2197   TH1F *gHistTracksResolutionVz = new TH1F("gHistTracksResolutionVz",
2198                                            ";#sigma_{z} [#mu m];Entries",
2199                                            100,0.,1000.);
2200   fQAVertexList->Add(gHistTracksResolutionVz);
2201 }
2202
2203 //____________________________________________________________________//
2204 void AliProtonQAAnalysis::InitQA() {
2205   //Initializes the QA histograms
2206   //if(!fQAHistograms) 
2207   SetRunQAAnalysis();
2208
2209   //2D histograms
2210   //TDirectory *dir2D = gDirectory->mkdir("2D");
2211   //fGlobalQAList->Add(dir2D); dir2D->cd();
2212   TH2D *gHistYPtPrimaryProtonsPass = 0x0;
2213   if(fUseAsymmetricBinning)
2214   gHistYPtPrimaryProtonsPass = new TH2D("gHistYPtPrimaryProtonsPass",
2215                                         ";;P_{T} [GeV/c]",
2216                                         fNBinsY,fY,fNBinsPt,fPt);
2217   else
2218     gHistYPtPrimaryProtonsPass = new TH2D("gHistYPtPrimaryProtonsPass",
2219                                           ";;P_{T} [GeV/c]",
2220                                           fNBinsY,fMinY,fMaxY,
2221                                           fNBinsPt,fMinPt,fMaxPt);
2222   if(fProtonAnalysisBase->GetEtaMode()) 
2223     gHistYPtPrimaryProtonsPass->GetXaxis()->SetTitle("#eta");
2224   else 
2225     gHistYPtPrimaryProtonsPass->GetXaxis()->SetTitle("y");
2226   gHistYPtPrimaryProtonsPass->SetStats(kTRUE);
2227   gHistYPtPrimaryProtonsPass->GetXaxis()->SetTitleColor(1);
2228   fQA2DList->Add(gHistYPtPrimaryProtonsPass);//y-pT of primary accepted ESD protons
2229   TH2D *gHistYPtPrimaryProtonsReject = 0x0;
2230   if(fUseAsymmetricBinning)
2231     gHistYPtPrimaryProtonsReject = new TH2D("gHistYPtPrimaryProtonsReject",
2232                                             ";;P_{T} [GeV/c]",
2233                                             fNBinsY,fY,fNBinsPt,fPt);
2234   else
2235     gHistYPtPrimaryProtonsReject = new TH2D("gHistYPtPrimaryProtonsReject",
2236                                             ";;P_{T} [GeV/c]",
2237                                             fNBinsY,fMinY,fMaxY,
2238                                             fNBinsPt,fMinPt,fMaxPt);
2239   if(fProtonAnalysisBase->GetEtaMode()) 
2240     gHistYPtPrimaryProtonsReject->GetXaxis()->SetTitle("#eta");
2241   else 
2242     gHistYPtPrimaryProtonsReject->GetXaxis()->SetTitle("y");
2243   gHistYPtPrimaryProtonsReject->SetStats(kTRUE);
2244   gHistYPtPrimaryProtonsReject->GetXaxis()->SetTitleColor(1);
2245   fQA2DList->Add(gHistYPtPrimaryProtonsReject);//y-pT of primary rejected ESD protons
2246
2247   TH2D *gHistYPtSecondaryProtonsPass = 0x0;
2248   if(fUseAsymmetricBinning)
2249     gHistYPtSecondaryProtonsPass = new TH2D("gHistYPtSecondaryProtonsPass",
2250                                             ";;P_{T} [GeV/c]",
2251                                             fNBinsY,fY,fNBinsPt,fPt);
2252   else
2253     gHistYPtSecondaryProtonsPass = new TH2D("gHistYPtSecondaryProtonsPass",
2254                                             ";;P_{T} [GeV/c]",
2255                                             fNBinsY,fMinY,fMaxY,
2256                                             fNBinsPt,fMinPt,fMaxPt);
2257   if(fProtonAnalysisBase->GetEtaMode()) 
2258     gHistYPtSecondaryProtonsPass->GetXaxis()->SetTitle("#eta");
2259   else 
2260     gHistYPtSecondaryProtonsPass->GetXaxis()->SetTitle("y");
2261   gHistYPtSecondaryProtonsPass->SetStats(kTRUE);
2262   gHistYPtSecondaryProtonsPass->GetXaxis()->SetTitleColor(1);
2263   fQA2DList->Add(gHistYPtSecondaryProtonsPass);//y-pT of secondary accepted ESD protons
2264   TH2D *gHistYPtSecondaryProtonsReject = 0x0;
2265   if(fUseAsymmetricBinning)
2266     gHistYPtSecondaryProtonsReject = new TH2D("gHistYPtSecondaryProtonsReject",
2267                                               ";;P_{T} [GeV/c]",
2268                                               fNBinsY,fY,fNBinsPt,fPt);
2269   else
2270     gHistYPtSecondaryProtonsReject = new TH2D("gHistYPtSecondaryProtonsReject",
2271                                               ";;P_{T} [GeV/c]",
2272                                               fNBinsY,fMinY,fMaxY,
2273                                               fNBinsPt,fMinPt,fMaxPt);
2274   if(fProtonAnalysisBase->GetEtaMode()) 
2275     gHistYPtSecondaryProtonsReject->GetXaxis()->SetTitle("#eta");
2276   else 
2277     gHistYPtSecondaryProtonsReject->GetXaxis()->SetTitle("y");
2278   gHistYPtSecondaryProtonsReject->SetStats(kTRUE);
2279   gHistYPtSecondaryProtonsReject->GetXaxis()->SetTitleColor(1);
2280   fQA2DList->Add(gHistYPtSecondaryProtonsReject);//y-pT of secondary rejected ESD protons
2281
2282   TH2D *gHistYPtPrimaryAntiProtonsPass = 0x0;
2283   if(fUseAsymmetricBinning)
2284     gHistYPtPrimaryAntiProtonsPass = new TH2D("gHistYPtPrimaryAntiProtonsPass",
2285                                               ";;P_{T} [GeV/c]",
2286                                               fNBinsY,fY,fNBinsPt,fPt);
2287   else
2288     gHistYPtPrimaryAntiProtonsPass = new TH2D("gHistYPtPrimaryAntiProtonsPass",
2289                                               ";;P_{T} [GeV/c]",
2290                                               fNBinsY,fMinY,fMaxY,
2291                                               fNBinsPt,fMinPt,fMaxPt);
2292   if(fProtonAnalysisBase->GetEtaMode()) 
2293     gHistYPtPrimaryAntiProtonsPass->GetXaxis()->SetTitle("#eta");
2294   else 
2295     gHistYPtPrimaryAntiProtonsPass->GetXaxis()->SetTitle("y");
2296   gHistYPtPrimaryAntiProtonsPass->SetStats(kTRUE);
2297   gHistYPtPrimaryAntiProtonsPass->GetXaxis()->SetTitleColor(1);
2298   fQA2DList->Add(gHistYPtPrimaryAntiProtonsPass);//y-pT of primary accepted ESD antiprotons
2299   TH2D *gHistYPtPrimaryAntiProtonsReject = 0x0;
2300   if(fUseAsymmetricBinning)
2301     gHistYPtPrimaryAntiProtonsReject = new TH2D("gHistYPtPrimaryAntiProtonsReject",
2302                                                 ";;P_{T} [GeV/c]",
2303                                                 fNBinsY,fY,fNBinsPt,fPt);
2304   else
2305     gHistYPtPrimaryAntiProtonsReject = new TH2D("gHistYPtPrimaryAntiProtonsReject",
2306                                                 ";;P_{T} [GeV/c]",
2307                                                 fNBinsY,fMinY,fMaxY,
2308                                                 fNBinsPt,fMinPt,fMaxPt);
2309   if(fProtonAnalysisBase->GetEtaMode()) 
2310     gHistYPtPrimaryAntiProtonsReject->GetXaxis()->SetTitle("#eta");
2311   else 
2312     gHistYPtPrimaryAntiProtonsReject->GetXaxis()->SetTitle("y");
2313   gHistYPtPrimaryAntiProtonsReject->SetStats(kTRUE);
2314   gHistYPtPrimaryAntiProtonsReject->GetXaxis()->SetTitleColor(1);
2315   fQA2DList->Add(gHistYPtPrimaryAntiProtonsReject);//y-pT of primary rejected ESD antiprotons
2316
2317   TH2D *gHistYPtSecondaryAntiProtonsPass = 0x0;
2318   if(fUseAsymmetricBinning)
2319   gHistYPtSecondaryAntiProtonsPass = new TH2D("gHistYPtSecondaryAntiProtonsPass",
2320                                               ";;P_{T} [GeV/c]",
2321                                               fNBinsY,fY,fNBinsPt,fPt);
2322   else
2323     gHistYPtSecondaryAntiProtonsPass = new TH2D("gHistYPtSecondaryAntiProtonsPass",
2324                                                 ";;P_{T} [GeV/c]",
2325                                                 fNBinsY,fMinY,fMaxY,
2326                                                 fNBinsPt,fMinPt,fMaxPt);
2327   if(fProtonAnalysisBase->GetEtaMode()) 
2328     gHistYPtSecondaryAntiProtonsPass->GetXaxis()->SetTitle("#eta");
2329   else 
2330     gHistYPtSecondaryAntiProtonsPass->GetXaxis()->SetTitle("y");
2331   gHistYPtSecondaryAntiProtonsPass->SetStats(kTRUE);
2332   gHistYPtSecondaryAntiProtonsPass->GetXaxis()->SetTitleColor(1);
2333   fQA2DList->Add(gHistYPtSecondaryAntiProtonsPass);//y-pT of secondary accepted ESD antiprotons
2334   TH2D *gHistYPtSecondaryAntiProtonsReject = 0x0;
2335   if(fUseAsymmetricBinning)
2336   gHistYPtSecondaryAntiProtonsReject = new TH2D("gHistYPtSecondaryAntiProtonsReject",
2337                                                 ";;P_{T} [GeV/c]",
2338                                                 fNBinsY,fY,fNBinsPt,fPt);
2339   else
2340     gHistYPtSecondaryAntiProtonsReject = new TH2D("gHistYPtSecondaryAntiProtonsReject",
2341                                                   ";;P_{T} [GeV/c]",
2342                                                   fNBinsY,fMinY,fMaxY,
2343                                                   fNBinsPt,fMinPt,fMaxPt);
2344   if(fProtonAnalysisBase->GetEtaMode()) 
2345     gHistYPtSecondaryAntiProtonsReject->GetXaxis()->SetTitle("#eta");
2346   else 
2347     gHistYPtSecondaryAntiProtonsReject->GetXaxis()->SetTitle("y");
2348   gHistYPtSecondaryAntiProtonsReject->SetStats(kTRUE);
2349   gHistYPtSecondaryAntiProtonsReject->GetXaxis()->SetTitleColor(1);
2350   fQA2DList->Add(gHistYPtSecondaryAntiProtonsReject);//y-pT of secondary rejected ESD antiprotons
2351
2352   TH2D *gHistYPtPrimaryProtonsMC = 0x0;
2353   if(fUseAsymmetricBinning)
2354     gHistYPtPrimaryProtonsMC = new TH2D("gHistYPtPrimaryProtonsMC",
2355                                         ";;P_{T} [GeV/c]",
2356                                         fNBinsY,fY,fNBinsPt,fPt);
2357   else
2358     gHistYPtPrimaryProtonsMC = new TH2D("gHistYPtPrimaryProtonsMC",
2359                                         ";;P_{T} [GeV/c]",
2360                                         fNBinsY,fMinY,fMaxY,
2361                                         fNBinsPt,fMinPt,fMaxPt);
2362   if(fProtonAnalysisBase->GetEtaMode()) 
2363     gHistYPtPrimaryProtonsMC->GetXaxis()->SetTitle("#eta");
2364   else 
2365     gHistYPtPrimaryProtonsMC->GetXaxis()->SetTitle("y");
2366   gHistYPtPrimaryProtonsMC->SetStats(kTRUE);
2367   gHistYPtPrimaryProtonsMC->GetXaxis()->SetTitleColor(1);
2368   fQA2DList->Add(gHistYPtPrimaryProtonsMC);//y-pT of primary MC protons
2369   TH2D *gHistYPtPrimaryAntiProtonsMC = 0x0;
2370   if(fUseAsymmetricBinning)
2371     gHistYPtPrimaryAntiProtonsMC = new TH2D("gHistYPtPrimaryAntiProtonsMC",
2372                                             ";;P_{T} [GeV/c]",
2373                                             fNBinsY,fY,fNBinsPt,fPt);
2374   else
2375     gHistYPtPrimaryAntiProtonsMC = new TH2D("gHistYPtPrimaryAntiProtonsMC",
2376                                             ";;P_{T} [GeV/c]",
2377                                             fNBinsY,fMinY,fMaxY,
2378                                             fNBinsPt,fMinPt,fMaxPt);
2379   if(fProtonAnalysisBase->GetEtaMode()) 
2380     gHistYPtPrimaryAntiProtonsMC->GetXaxis()->SetTitle("#eta");
2381   else 
2382     gHistYPtPrimaryAntiProtonsMC->GetXaxis()->SetTitle("y");
2383   gHistYPtPrimaryAntiProtonsMC->SetStats(kTRUE);
2384   gHistYPtPrimaryAntiProtonsMC->GetXaxis()->SetTitleColor(1);
2385   fQA2DList->Add(gHistYPtPrimaryAntiProtonsMC);//y-pT of primary MC antiprotons
2386
2387   TH3F *gHistYPtPDGProtonsPass = 0x0;
2388   if(fUseAsymmetricBinning) {
2389     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};
2390     gHistYPtPDGProtonsPass = new TH3F("gHistYPtPDGProtonsPass",
2391                                       ";;P_{T} [GeV/c];PDG",
2392                                       fNBinsY,fY,fNBinsPt,fPt,14,gPDG);
2393   }
2394   else
2395     gHistYPtPDGProtonsPass = new TH3F("gHistYPtPDGProtonsPass",
2396                                       ";;P_{T} [GeV/c];PDG",
2397                                       fNBinsY,fMinY,fMaxY,
2398                                       fNBinsPt,fMinPt,fMaxPt,
2399                                       14,-0.5,13.5);
2400   if(fProtonAnalysisBase->GetEtaMode()) 
2401     gHistYPtPDGProtonsPass->GetXaxis()->SetTitle("#eta");
2402   else 
2403     gHistYPtPDGProtonsPass->GetXaxis()->SetTitle("y");
2404   fQA2DList->Add(gHistYPtPDGProtonsPass);//composition of secondary protons
2405   TH3F *gHistYPtPDGAntiProtonsPass = 0x0;
2406   if(fUseAsymmetricBinning) {
2407     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};
2408     gHistYPtPDGAntiProtonsPass = new TH3F("gHistYPtPDGAntiProtonsPass",
2409                                           ";;P_{T} [GeV/c];PDG",
2410                                           fNBinsY,fY,fNBinsPt,fPt,14,gPDG);
2411   }
2412   else
2413     gHistYPtPDGAntiProtonsPass = new TH3F("gHistYPtPDGAntiProtonsPass",
2414                                           ";;P_{T} [GeV/c];PDG",
2415                                           fNBinsY,fMinY,fMaxY,
2416                                           fNBinsPt,fMinPt,fMaxPt,
2417                                           14,-0.5,13.5);
2418   if(fProtonAnalysisBase->GetEtaMode()) 
2419     gHistYPtPDGAntiProtonsPass->GetXaxis()->SetTitle("#eta");
2420   else 
2421     gHistYPtPDGAntiProtonsPass->GetXaxis()->SetTitle("y");
2422   fQA2DList->Add(gHistYPtPDGAntiProtonsPass);//composition of secondary antiprotons
2423
2424   /*gDirectory->cd("../");
2425   //protons
2426   TDirectory *dirProtons = gDirectory->mkdir("Protons");
2427   fGlobalQAList->Add(dirProtons); dirProtons->cd();*/
2428   
2429   //________________________________________________________________//
2430   /*TDirectory *dirProtonsPrimary = gDirectory->mkdir("Primaries");
2431   dirProtonsPrimary->cd();
2432   TDirectory *dirProtonsPrimaryAccepted = gDirectory->mkdir("Accepted");
2433   dirProtonsPrimaryAccepted->cd();*/
2434
2435   //Accepted primary protons
2436   TH1F *gPrimaryProtonsITSClustersPass = new TH1F("gPrimaryProtonsITSClustersPass",
2437                                             ";N_{clusters} (ITS);Entries",
2438                                             7,0,7);
2439   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsITSClustersPass);
2440   TH1F *gPrimaryProtonsChi2PerClusterITSPass = new TH1F("gPrimaryProtonsChi2PerClusterITSPass",
2441                                                   ";x^{2}/N_{clusters} (ITS);Entries",
2442                                                   100,0,4);
2443   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsChi2PerClusterITSPass);
2444   TH1F *gPrimaryProtonsTPCClustersPass = new TH1F("gPrimaryProtonsTPCClustersPass",
2445                                             ";N_{clusters} (TPC);Entries",
2446                                             100,0,200);
2447   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsTPCClustersPass);
2448   TH1F *gPrimaryProtonsChi2PerClusterTPCPass = new TH1F("gPrimaryProtonsChi2PerClusterTPCPass",
2449                                                   ";x^{2}/N_{clusters} (TPC);Entries",
2450                                                   100,0,4);
2451   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsChi2PerClusterTPCPass);
2452   TH1F *gPrimaryProtonsExtCov11Pass = new TH1F("gPrimaryProtonsExtCov11Pass",
2453                                          ";#sigma_{y} [cm];Entries",
2454                                          100,0,4);
2455   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov11Pass);
2456   TH1F *gPrimaryProtonsExtCov22Pass = new TH1F("gPrimaryProtonsExtCov22Pass",
2457                                          ";#sigma_{z} [cm];Entries",
2458                                          100,0,4);
2459   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov22Pass);
2460   TH1F *gPrimaryProtonsExtCov33Pass = new TH1F("gPrimaryProtonsExtCov33Pass",
2461                                          ";#sigma_{sin(#phi)};Entries",
2462                                          100,0,4);
2463   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov33Pass);
2464   TH1F *gPrimaryProtonsExtCov44Pass = new TH1F("gPrimaryProtonsExtCov44Pass",
2465                                          ";#sigma_{tan(#lambda)};Entries",
2466                                          100,0,4);
2467   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov44Pass);
2468   TH1F *gPrimaryProtonsExtCov55Pass = new TH1F("gPrimaryProtonsExtCov55Pass",
2469                                          ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2470                                          100,0,4);
2471   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov55Pass);
2472   TH1F *gPrimaryProtonsSigmaToVertexPass = new TH1F("gPrimaryProtonsSigmaToVertexPass",
2473                                              ";#sigma_{Vertex};Entries",
2474                                              100,0,10);
2475   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsSigmaToVertexPass);
2476   TH1F *gPrimaryProtonsSigmaToVertexTPCPass = new TH1F("gPrimaryProtonsSigmaToVertexTPCPass",
2477                                              ";#sigma_{Vertex};Entries",
2478                                              100,0,10);
2479   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsSigmaToVertexTPCPass);
2480   TH1F *gPrimaryProtonsDCAXYPass = new TH1F("gPrimaryProtonsDCAXYPass",
2481                                              ";DCA_{xy} [cm];Entries",
2482                                              100,0,20);
2483   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsDCAXYPass);
2484   TH1F *gPrimaryProtonsDCAXYTPCPass = new TH1F("gPrimaryProtonsDCAXYTPCPass",
2485                                                ";DCA_{xy} [cm];Entries",
2486                                                100,0,20);
2487   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsDCAXYTPCPass);
2488   TH1F *gPrimaryProtonsDCAZPass = new TH1F("gPrimaryProtonsDCAZPass",
2489                                            ";DCA_{z} [cm];Entries",
2490                                            100,0,20);
2491   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsDCAZPass);
2492   TH1F *gPrimaryProtonsDCAZTPCPass = new TH1F("gPrimaryProtonsDCAZTPCPass",
2493                                               ";DCA_{z} [cm];Entries",
2494                                               100,0,20);
2495   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsDCAZTPCPass);
2496   TH1F *gPrimaryProtonsConstrainChi2Pass = new TH1F("gPrimaryProtonsConstrainChi2Pass",
2497                                                     ";Log_{10}(#chi^{2});Entries",
2498                                                     100,-10,10);
2499   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsConstrainChi2Pass);
2500   TH1F *gPrimaryProtonsITSRefitPass = new TH1F("gPrimaryProtonsITSRefitPass",
2501                                                "",10,-1,1);
2502   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsITSRefitPass);
2503   TH1F *gPrimaryProtonsTPCRefitPass = new TH1F("gPrimaryProtonsTPCRefitPass",
2504                                                "",10,-1,1);
2505   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsTPCRefitPass);
2506   TH1F *gPrimaryProtonsESDpidPass = new TH1F("gPrimaryProtonsESDpidPass",
2507                                              "",10,-1,1);
2508   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsESDpidPass);
2509   TH1F *gPrimaryProtonsTPCpidPass = new TH1F("gPrimaryProtonsTPCpidPass",
2510                                              "",10,-1,1);
2511   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsTPCpidPass);
2512   TH1F *gPrimaryProtonsPointOnITSLayer1Pass = new TH1F("gPrimaryProtonsPointOnITSLayer1Pass",
2513                                              "",10,-1,1);
2514   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer1Pass);
2515   TH1F *gPrimaryProtonsPointOnITSLayer2Pass = new TH1F("gPrimaryProtonsPointOnITSLayer2Pass",
2516                                              "",10,-1,1);
2517   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer2Pass);
2518   TH1F *gPrimaryProtonsPointOnITSLayer3Pass = new TH1F("gPrimaryProtonsPointOnITSLayer3Pass",
2519                                              "",10,-1,1);
2520   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer3Pass);
2521   TH1F *gPrimaryProtonsPointOnITSLayer4Pass = new TH1F("gPrimaryProtonsPointOnITSLayer4Pass",
2522                                              "",10,-1,1);
2523   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer4Pass);
2524   TH1F *gPrimaryProtonsPointOnITSLayer5Pass = new TH1F("gPrimaryProtonsPointOnITSLayer5Pass",
2525                                              "",10,-1,1);
2526   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer5Pass);
2527   TH1F *gPrimaryProtonsPointOnITSLayer6Pass = new TH1F("gPrimaryProtonsPointOnITSLayer6Pass",
2528                                              "",10,-1,1);
2529   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer6Pass);
2530   TH1F *gPrimaryProtonsNumberOfTPCdEdxPointsPass = new TH1F("gPrimaryProtonsNumberOfTPCdEdxPointsPass","",100,0,200);
2531   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsNumberOfTPCdEdxPointsPass);
2532
2533   //Rejected primary protons
2534   /*gDirectory->cd("../");
2535   TDirectory *dirProtonsPrimaryRejected = gDirectory->mkdir("Rejected");
2536   dirProtonsPrimaryRejected->cd();*/
2537
2538   TH1F *gPrimaryProtonsITSClustersReject = new TH1F("gPrimaryProtonsITSClustersReject",
2539                                                     ";N_{clusters} (ITS);Entries",
2540                                                     7,0,7);
2541   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsITSClustersReject);
2542   TH1F *gPrimaryProtonsChi2PerClusterITSReject = new TH1F("gPrimaryProtonsChi2PerClusterITSReject",
2543                                                           ";x^{2}/N_{clusters} (ITS);Entries",
2544                                                           100,0,4);
2545   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsChi2PerClusterITSReject);
2546   TH1F *gPrimaryProtonsTPCClustersReject = new TH1F("gPrimaryProtonsTPCClustersReject",
2547                                             ";N_{clusters} (TPC);Entries",
2548                                             100,0,200);
2549   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsTPCClustersReject);
2550   TH1F *gPrimaryProtonsChi2PerClusterTPCReject = new TH1F("gPrimaryProtonsChi2PerClusterTPCReject",
2551                                                   ";x^{2}/N_{clusters} (TPC);Entries",
2552                                                   100,0,4);
2553   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsChi2PerClusterTPCReject);
2554   TH1F *gPrimaryProtonsExtCov11Reject = new TH1F("gPrimaryProtonsExtCov11Reject",
2555                                          ";#sigma_{y} [cm];Entries",
2556                                          100,0,4);
2557   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov11Reject);
2558   TH1F *gPrimaryProtonsExtCov22Reject = new TH1F("gPrimaryProtonsExtCov22Reject",
2559                                          ";#sigma_{z} [cm];Entries",
2560                                          100,0,4);
2561   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov22Reject);
2562   TH1F *gPrimaryProtonsExtCov33Reject = new TH1F("gPrimaryProtonsExtCov33Reject",
2563                                          ";#sigma_{sin(#phi)};Entries",
2564                                          100,0,4);
2565   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov33Reject);
2566   TH1F *gPrimaryProtonsExtCov44Reject = new TH1F("gPrimaryProtonsExtCov44Reject",
2567                                          ";#sigma_{tan(#lambda)};Entries",
2568                                          100,0,4);
2569   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov44Reject);
2570   TH1F *gPrimaryProtonsExtCov55Reject = new TH1F("gPrimaryProtonsExtCov55Reject",
2571                                          ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2572                                          100,0,4);
2573   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov55Reject);
2574   TH1F *gPrimaryProtonsSigmaToVertexReject = new TH1F("gPrimaryProtonsSigmaToVertexReject",
2575                                              ";#sigma_{Vertex};Entries",
2576                                              100,0,10);
2577   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsSigmaToVertexReject);
2578   TH1F *gPrimaryProtonsSigmaToVertexTPCReject = new TH1F("gPrimaryProtonsSigmaToVertexTPCReject",
2579                                              ";#sigma_{Vertex};Entries",
2580                                              100,0,10);
2581   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsSigmaToVertexTPCReject);
2582   TH1F *gPrimaryProtonsDCAXYReject = new TH1F("gPrimaryProtonsDCAXYReject",
2583                                               ";DCA_{xy} [cm];Entries",
2584                                               100,0,20);
2585   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsDCAXYReject);
2586   TH1F *gPrimaryProtonsDCAXYTPCReject = new TH1F("gPrimaryProtonsDCAXYTPCReject",
2587                                                  ";DCA_{xy} [cm];Entries",
2588                                                  100,0,20);
2589   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsDCAXYTPCReject);
2590   TH1F *gPrimaryProtonsDCAZReject = new TH1F("gPrimaryProtonsDCAZReject",
2591                                              ";DCA_{z} [cm];Entries",
2592                                              100,0,20);
2593   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsDCAZReject);
2594   TH1F *gPrimaryProtonsDCAZTPCReject = new TH1F("gPrimaryProtonsDCAZTPCReject",
2595                                                 ";DCA_{z} [cm];Entries",
2596                                                 100,0,20);
2597   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsDCAZTPCReject);
2598   TH1F *gPrimaryProtonsConstrainChi2Reject = new TH1F("gPrimaryProtonsConstrainChi2Reject",
2599                                                     ";Log_{10}(#chi^{2});Entries",
2600                                                     100,-10,10);
2601   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsConstrainChi2Reject);
2602   TH1F *gPrimaryProtonsITSRefitReject = new TH1F("gPrimaryProtonsITSRefitReject",
2603                                                  "",10,-1,1);
2604   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsITSRefitReject);
2605   TH1F *gPrimaryProtonsTPCRefitReject = new TH1F("gPrimaryProtonsTPCRefitReject",
2606                                                  "",10,-1,1);
2607   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsTPCRefitReject);
2608   TH1F *gPrimaryProtonsESDpidReject = new TH1F("gPrimaryProtonsESDpidReject",
2609                                                "",10,-1,1);
2610   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsESDpidReject);
2611   TH1F *gPrimaryProtonsTPCpidReject = new TH1F("gPrimaryProtonsTPCpidReject",
2612                                                "",10,-1,1);
2613   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsTPCpidReject);
2614   TH1F *gPrimaryProtonsPointOnITSLayer1Reject = new TH1F("gPrimaryProtonsPointOnITSLayer1Reject",
2615                                              "",10,-1,1);
2616   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer1Reject);
2617   TH1F *gPrimaryProtonsPointOnITSLayer2Reject = new TH1F("gPrimaryProtonsPointOnITSLayer2Reject",
2618                                              "",10,-1,1);
2619   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer2Reject);
2620   TH1F *gPrimaryProtonsPointOnITSLayer3Reject = new TH1F("gPrimaryProtonsPointOnITSLayer3Reject",
2621                                              "",10,-1,1);
2622   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer3Reject);
2623   TH1F *gPrimaryProtonsPointOnITSLayer4Reject = new TH1F("gPrimaryProtonsPointOnITSLayer4Reject",
2624                                              "",10,-1,1);
2625   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer4Reject);
2626   TH1F *gPrimaryProtonsPointOnITSLayer5Reject = new TH1F("gPrimaryProtonsPointOnITSLayer5Reject",
2627                                              "",10,-1,1);
2628   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer5Reject);
2629   TH1F *gPrimaryProtonsPointOnITSLayer6Reject = new TH1F("gPrimaryProtonsPointOnITSLayer6Reject",
2630                                              "",10,-1,1);
2631   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer6Reject);
2632   TH1F *gPrimaryProtonsNumberOfTPCdEdxPointsReject = new TH1F("gPrimaryProtonsNumberOfTPCdEdxPointsReject","",100,0,200);
2633   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsNumberOfTPCdEdxPointsReject);
2634   //________________________________________________________________//
2635   /*gDirectory->cd("../../");
2636
2637   TDirectory *dirProtonsSecondary = gDirectory->mkdir("Secondaries");
2638   dirProtonsSecondary->cd();
2639   TDirectory *dirProtonsSecondaryAccepted = gDirectory->mkdir("Accepted");
2640   dirProtonsSecondaryAccepted->cd();*/
2641
2642   //Accepted secondary protons
2643   TH1F *gSecondaryProtonsITSClustersPass = new TH1F("gSecondaryProtonsITSClustersPass",
2644                                                     ";N_{clusters} (ITS);Entries",
2645                                                     7,0,7);
2646   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsITSClustersPass);
2647   TH1F *gSecondaryProtonsChi2PerClusterITSPass = new TH1F("gSecondaryProtonsChi2PerClusterITSPass",
2648                                                           ";x^{2}/N_{clusters} (ITS);Entries",
2649                                                           100,0,4);
2650   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsChi2PerClusterITSPass);
2651   TH1F *gSecondaryProtonsTPCClustersPass = new TH1F("gSecondaryProtonsTPCClustersPass",
2652                                             ";N_{clusters} (TPC);Entries",
2653                                             100,0,200);
2654   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsTPCClustersPass);
2655   TH1F *gSecondaryProtonsChi2PerClusterTPCPass = new TH1F("gSecondaryProtonsChi2PerClusterTPCPass",
2656                                                   ";x^{2}/N_{clusters} (TPC);Entries",
2657                                                   100,0,4);
2658   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsChi2PerClusterTPCPass);
2659   TH1F *gSecondaryProtonsExtCov11Pass = new TH1F("gSecondaryProtonsExtCov11Pass",
2660                                          ";#sigma_{y} [cm];Entries",
2661                                          100,0,4);
2662   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov11Pass);
2663   TH1F *gSecondaryProtonsExtCov22Pass = new TH1F("gSecondaryProtonsExtCov22Pass",
2664                                          ";#sigma_{z} [cm];Entries",
2665                                          100,0,4);
2666   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov22Pass);
2667   TH1F *gSecondaryProtonsExtCov33Pass = new TH1F("gSecondaryProtonsExtCov33Pass",
2668                                          ";#sigma_{sin(#phi)};Entries",
2669                                          100,0,4);
2670   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov33Pass);
2671   TH1F *gSecondaryProtonsExtCov44Pass = new TH1F("gSecondaryProtonsExtCov44Pass",
2672                                          ";#sigma_{tan(#lambda)};Entries",
2673                                          100,0,4);
2674   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov44Pass);
2675   TH1F *gSecondaryProtonsExtCov55Pass = new TH1F("gSecondaryProtonsExtCov55Pass",
2676                                          ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2677                                          100,0,4);
2678   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov55Pass);
2679   TH1F *gSecondaryProtonsSigmaToVertexPass = new TH1F("gSecondaryProtonsSigmaToVertexPass",
2680                                              ";#sigma_{Vertex};Entries",
2681                                              100,0,10);
2682   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsSigmaToVertexPass);
2683   TH1F *gSecondaryProtonsSigmaToVertexTPCPass = new TH1F("gSecondaryProtonsSigmaToVertexTPCPass",
2684                                              ";#sigma_{Vertex};Entries",
2685                                              100,0,10);
2686   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsSigmaToVertexTPCPass);
2687   TH1F *gSecondaryProtonsDCAXYPass = new TH1F("gSecondaryProtonsDCAXYPass",
2688                                               ";DCA_{xy} [cm];Entries",
2689                                               100,0,20);
2690   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsDCAXYPass);
2691   TH1F *gSecondaryProtonsDCAXYTPCPass = new TH1F("gSecondaryProtonsDCAXYTPCPass",
2692                                                  ";DCA_{xy} [cm];Entries",
2693                                                  100,0,20);
2694   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsDCAXYTPCPass);
2695   TH1F *gSecondaryProtonsDCAZPass = new TH1F("gSecondaryProtonsDCAZPass",
2696                                              ";DCA_{z} [cm];Entries",
2697                                              100,0,20);
2698   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsDCAZPass);
2699   TH1F *gSecondaryProtonsDCAZTPCPass = new TH1F("gSecondaryProtonsDCAZTPCPass",
2700                                                 ";DCA_{z} [cm];Entries",
2701                                                 100,0,20);
2702   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsDCAZTPCPass);
2703   TH1F *gSecondaryProtonsConstrainChi2Pass = new TH1F("gSecondaryProtonsConstrainChi2Pass",
2704                                                     ";Log_{10}(#chi^{2});Entries",
2705                                                     100,-10,10);
2706   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsConstrainChi2Pass);
2707   TH1F *gSecondaryProtonsITSRefitPass = new TH1F("gSecondaryProtonsITSRefitPass",
2708                                                  "",10,-1,1);
2709   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsITSRefitPass);
2710   TH1F *gSecondaryProtonsTPCRefitPass = new TH1F("gSecondaryProtonsTPCRefitPass",
2711                                                  "",10,-1,1);
2712   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsTPCRefitPass);
2713   TH1F *gSecondaryProtonsESDpidPass = new TH1F("gSecondaryProtonsESDpidPass",
2714                                                "",10,-1,1);
2715   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsESDpidPass);
2716   TH1F *gSecondaryProtonsTPCpidPass = new TH1F("gSecondaryProtonsTPCpidPass",
2717                                                "",10,-1,1);
2718   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsTPCpidPass);
2719   TH1F *gSecondaryProtonsPointOnITSLayer1Pass = new TH1F("gSecondaryProtonsPointOnITSLayer1Pass",
2720                                                          "",10,-1,1);
2721   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer1Pass);
2722   TH1F *gSecondaryProtonsPointOnITSLayer2Pass = new TH1F("gSecondaryProtonsPointOnITSLayer2Pass",
2723                                                          "",10,-1,1);
2724   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer2Pass);
2725   TH1F *gSecondaryProtonsPointOnITSLayer3Pass = new TH1F("gSecondaryProtonsPointOnITSLayer3Pass",
2726                                                          "",10,-1,1);
2727   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer3Pass);
2728   TH1F *gSecondaryProtonsPointOnITSLayer4Pass = new TH1F("gSecondaryProtonsPointOnITSLayer4Pass",
2729                                                          "",10,-1,1);
2730   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer4Pass);
2731   TH1F *gSecondaryProtonsPointOnITSLayer5Pass = new TH1F("gSecondaryProtonsPointOnITSLayer5Pass",
2732                                                          "",10,-1,1);
2733   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer5Pass);
2734   TH1F *gSecondaryProtonsPointOnITSLayer6Pass = new TH1F("gSecondaryProtonsPointOnITSLayer6Pass",
2735                                                          "",10,-1,1);
2736   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer6Pass);
2737   TH1F *gSecondaryProtonsNumberOfTPCdEdxPointsPass = new TH1F("gSecondaryProtonsNumberOfTPCdEdxPointsPass","",100,0,200);
2738   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsNumberOfTPCdEdxPointsPass);
2739
2740   //Rejected secondary protons
2741   /*gDirectory->cd("../");
2742   TDirectory *dirProtonsSecondaryRejected = gDirectory->mkdir("Rejected");
2743   dirProtonsSecondaryRejected->cd();*/
2744
2745   TH1F *gSecondaryProtonsITSClustersReject = new TH1F("gSecondaryProtonsITSClustersReject",
2746                                                       ";N_{clusters} (ITS);Entries",
2747                                                       7,0,7);
2748   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsITSClustersReject);
2749   TH1F *gSecondaryProtonsChi2PerClusterITSReject = new TH1F("gSecondaryProtonsChi2PerClusterITSReject",
2750                                                             ";x^{2}/N_{clusters} (ITS);Entries",
2751                                                             100,0,4);
2752   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsChi2PerClusterITSReject);
2753   TH1F *gSecondaryProtonsTPCClustersReject = new TH1F("gSecondaryProtonsTPCClustersReject",
2754                                             ";N_{clusters} (TPC);Entries",
2755                                             100,0,200);
2756   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsTPCClustersReject);
2757   TH1F *gSecondaryProtonsChi2PerClusterTPCReject = new TH1F("gSecondaryProtonsChi2PerClusterTPCReject",
2758                                                   ";x^{2}/N_{clusters} (TPC);Entries",
2759                                                   100,0,4);
2760   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsChi2PerClusterTPCReject);
2761   TH1F *gSecondaryProtonsExtCov11Reject = new TH1F("gSecondaryProtonsExtCov11Reject",
2762                                          ";#sigma_{y} [cm];Entries",
2763                                          100,0,4);
2764   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov11Reject);
2765   TH1F *gSecondaryProtonsExtCov22Reject = new TH1F("gSecondaryProtonsExtCov22Reject",
2766                                          ";#sigma_{z} [cm];Entries",
2767                                          100,0,4);
2768   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov22Reject);
2769   TH1F *gSecondaryProtonsExtCov33Reject = new TH1F("gSecondaryProtonsExtCov33Reject",
2770                                          ";#sigma_{sin(#phi)};Entries",
2771                                          100,0,4);
2772   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov33Reject);
2773   TH1F *gSecondaryProtonsExtCov44Reject = new TH1F("gSecondaryProtonsExtCov44Reject",
2774                                          ";#sigma_{tan(#lambda)};Entries",
2775                                          100,0,4);
2776   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov44Reject);
2777   TH1F *gSecondaryProtonsExtCov55Reject = new TH1F("gSecondaryProtonsExtCov55Reject",
2778                                          ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2779                                          100,0,4);
2780   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov55Reject);
2781   TH1F *gSecondaryProtonsSigmaToVertexReject = new TH1F("gSecondaryProtonsSigmaToVertexReject",
2782                                              ";#sigma_{Vertex};Entries",
2783                                              100,0,10);
2784   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsSigmaToVertexReject);
2785   TH1F *gSecondaryProtonsSigmaToVertexTPCReject = new TH1F("gSecondaryProtonsSigmaToVertexTPCReject",
2786                                                            ";#sigma_{Vertex};Entries",
2787                                                            100,0,10);
2788   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsSigmaToVertexTPCReject);
2789   TH1F *gSecondaryProtonsDCAXYReject = new TH1F("gSecondaryProtonsDCAXYReject",
2790                                                 ";DCA_{xy} [cm];Entries",
2791                                                 100,0,20);
2792   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsDCAXYReject);
2793   TH1F *gSecondaryProtonsDCAXYTPCReject = new TH1F("gSecondaryProtonsDCAXYTPCReject",
2794                                                    ";DCA_{xy} [cm];Entries",
2795                                                    100,0,20);
2796   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsDCAXYTPCReject);
2797   TH1F *gSecondaryProtonsDCAZReject = new TH1F("gSecondaryProtonsDCAZReject",
2798                                                ";DCA_{z} [cm];Entries",
2799                                                100,0,20);
2800   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsDCAZReject);
2801   TH1F *gSecondaryProtonsDCAZTPCReject = new TH1F("gSecondaryProtonsDCAZTPCReject",
2802                                                   ";DCA_{z} [cm];Entries",
2803                                                   100,0,20);
2804   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsDCAZTPCReject);
2805   TH1F *gSecondaryProtonsConstrainChi2Reject = new TH1F("gSecondaryProtonsConstrainChi2Reject",
2806                                                         ";Log_{10}(#chi^{2});Entries",
2807                                                         100,-10,10);
2808   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsConstrainChi2Reject);
2809   TH1F *gSecondaryProtonsITSRefitReject = new TH1F("gSecondaryProtonsITSRefitReject",
2810                                                    "",10,-1,1);
2811   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsITSRefitReject);
2812   TH1F *gSecondaryProtonsTPCRefitReject = new TH1F("gSecondaryProtonsTPCRefitReject",
2813                                                    "",10,-1,1);
2814   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsTPCRefitReject);
2815   TH1F *gSecondaryProtonsESDpidReject = new TH1F("gSecondaryProtonsESDpidReject",
2816                                                  "",10,-1,1);
2817   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsESDpidReject);
2818   TH1F *gSecondaryProtonsTPCpidReject = new TH1F("gSecondaryProtonsTPCpidReject",
2819                                                  "",10,-1,1);
2820   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsTPCpidReject);
2821   TH1F *gSecondaryProtonsPointOnITSLayer1Reject = new TH1F("gSecondaryProtonsPointOnITSLayer1Reject",
2822                                                            "",10,-1,1);
2823   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer1Reject);
2824   TH1F *gSecondaryProtonsPointOnITSLayer2Reject = new TH1F("gSecondaryProtonsPointOnITSLayer2Reject",
2825                                                            "",10,-1,1);
2826   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer2Reject);
2827   TH1F *gSecondaryProtonsPointOnITSLayer3Reject = new TH1F("gSecondaryProtonsPointOnITSLayer3Reject",
2828                                                            "",10,-1,1);
2829   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer3Reject);
2830   TH1F *gSecondaryProtonsPointOnITSLayer4Reject = new TH1F("gSecondaryProtonsPointOnITSLayer4Reject",
2831                                                            "",10,-1,1);
2832   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer4Reject);
2833   TH1F *gSecondaryProtonsPointOnITSLayer5Reject = new TH1F("gSecondaryProtonsPointOnITSLayer5Reject",
2834                                                            "",10,-1,1);
2835   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer5Reject);
2836   TH1F *gSecondaryProtonsPointOnITSLayer6Reject = new TH1F("gSecondaryProtonsPointOnITSLayer6Reject",
2837                                                            "",10,-1,1);
2838   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer6Reject);
2839   TH1F *gSecondaryProtonsNumberOfTPCdEdxPointsReject = new TH1F("gSecondaryProtonsNumberOfTPCdEdxPointsReject","",100,0,200);
2840   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsNumberOfTPCdEdxPointsReject);  
2841
2842   /*gDirectory->cd("../../../");
2843
2844   //antiprotons
2845   TDirectory *dirAntiProtons = gDirectory->mkdir("AntiProtons");
2846   fGlobalQAList->Add(dirAntiProtons); dirAntiProtons->cd();*/
2847   
2848   //________________________________________________________________//
2849   /*TDirectory *dirAntiProtonsPrimary = gDirectory->mkdir("Primaries");
2850   dirAntiProtonsPrimary->cd();
2851   TDirectory *dirAntiProtonsPrimaryAccepted = gDirectory->mkdir("Accepted");
2852   dirAntiProtonsPrimaryAccepted->cd();*/
2853   
2854   //Accepted primary antiprotons
2855   TH1F *gPrimaryAntiProtonsITSClustersPass = new TH1F("gPrimaryAntiProtonsITSClustersPass",
2856                                                       ";N_{clusters} (ITS);Entries",
2857                                                       7,0,7);
2858   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsITSClustersPass);
2859   TH1F *gPrimaryAntiProtonsChi2PerClusterITSPass = new TH1F("gPrimaryAntiProtonsChi2PerClusterITSPass",
2860                                                             ";x^{2}/N_{clusters} (ITS);Entries",
2861                                                             100,0,4);
2862   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsChi2PerClusterITSPass);
2863   TH1F *gPrimaryAntiProtonsTPCClustersPass = new TH1F("gPrimaryAntiProtonsTPCClustersPass",
2864                                                       ";N_{clusters} (TPC);Entries",
2865                                                       100,0,200);
2866   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsTPCClustersPass);
2867   TH1F *gPrimaryAntiProtonsChi2PerClusterTPCPass = new TH1F("gPrimaryAntiProtonsChi2PerClusterTPCPass",
2868                                                             ";x^{2}/N_{clusters} (TPC);Entries",
2869                                                             100,0,4);
2870   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsChi2PerClusterTPCPass);
2871   TH1F *gPrimaryAntiProtonsExtCov11Pass = new TH1F("gPrimaryAntiProtonsExtCov11Pass",
2872                                                    ";#sigma_{y} [cm];Entries",
2873                                                    100,0,4);
2874   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov11Pass);
2875   TH1F *gPrimaryAntiProtonsExtCov22Pass = new TH1F("gPrimaryAntiProtonsExtCov22Pass",
2876                                                    ";#sigma_{z} [cm];Entries",
2877                                                    100,0,4);
2878   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov22Pass);
2879   TH1F *gPrimaryAntiProtonsExtCov33Pass = new TH1F("gPrimaryAntiProtonsExtCov33Pass",
2880                                                    ";#sigma_{sin(#phi)};Entries",
2881                                                    100,0,4);
2882   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov33Pass);
2883   TH1F *gPrimaryAntiProtonsExtCov44Pass = new TH1F("gPrimaryAntiProtonsExtCov44Pass",
2884                                                    ";#sigma_{tan(#lambda)};Entries",
2885                                                    100,0,4);
2886   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov44Pass);
2887   TH1F *gPrimaryAntiProtonsExtCov55Pass = new TH1F("gPrimaryAntiProtonsExtCov55Pass",
2888                                                    ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2889                                                    100,0,4);
2890   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov55Pass);
2891   TH1F *gPrimaryAntiProtonsSigmaToVertexPass = new TH1F("gPrimaryAntiProtonsSigmaToVertexPass",
2892                                                         ";#sigma_{Vertex};Entries",
2893                                                         100,0,10);
2894   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsSigmaToVertexPass);
2895   TH1F *gPrimaryAntiProtonsSigmaToVertexTPCPass = new TH1F("gPrimaryAntiProtonsSigmaToVertexTPCPass",
2896                                                            ";#sigma_{Vertex};Entries",
2897                                                            100,0,10);
2898   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsSigmaToVertexTPCPass);
2899   TH1F *gPrimaryAntiProtonsDCAXYPass = new TH1F("gPrimaryAntiProtonsDCAXYPass",
2900                                                 ";DCA_{xy} [cm];Entries",
2901                                                 100,0,20);
2902   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsDCAXYPass);
2903   TH1F *gPrimaryAntiProtonsDCAXYTPCPass = new TH1F("gPrimaryAntiProtonsDCAXYTPCPass",
2904                                                    ";DCA_{xy} [cm];Entries",
2905                                                    100,0,20);
2906   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsDCAXYTPCPass);
2907   TH1F *gPrimaryAntiProtonsDCAZPass = new TH1F("gPrimaryAntiProtonsDCAZPass",
2908                                                ";DCA_{z} [cm];Entries",
2909                                                100,0,20);
2910   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsDCAZPass);
2911   TH1F *gPrimaryAntiProtonsDCAZTPCPass = new TH1F("gPrimaryAntiProtonsDCAZTPCPass",
2912                                                   ";DCA_{z} [cm];Entries",
2913                                                   100,0,20);
2914   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsDCAZTPCPass);
2915   TH1F *gPrimaryAntiProtonsConstrainChi2Pass = new TH1F("gPrimaryAntiProtonsConstrainChi2Pass",
2916                                                         ";Log_{10}(#chi^{2});Entries",
2917                                                         100,-10,10);
2918   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsConstrainChi2Pass);
2919   TH1F *gPrimaryAntiProtonsITSRefitPass = new TH1F("gPrimaryAntiProtonsITSRefitPass",
2920                                                    "",10,-1,1);
2921   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsITSRefitPass);
2922   TH1F *gPrimaryAntiProtonsTPCRefitPass = new TH1F("gPrimaryAntiProtonsTPCRefitPass",
2923                                                    "",10,-1,1);
2924   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsTPCRefitPass);
2925   TH1F *gPrimaryAntiProtonsESDpidPass = new TH1F("gPrimaryAntiProtonsESDpidPass",
2926                                                  "",10,-1,1);
2927   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsESDpidPass);
2928   TH1F *gPrimaryAntiProtonsTPCpidPass = new TH1F("gPrimaryAntiProtonsTPCpidPass",
2929                                                  "",10,-1,1);
2930   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsTPCpidPass);
2931   TH1F *gPrimaryAntiProtonsPointOnITSLayer1Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer1Pass",
2932                                                            "",10,-1,1);
2933   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer1Pass);
2934   TH1F *gPrimaryAntiProtonsPointOnITSLayer2Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer2Pass",
2935                                                            "",10,-1,1);
2936   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer2Pass);
2937   TH1F *gPrimaryAntiProtonsPointOnITSLayer3Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer3Pass",
2938                                                            "",10,-1,1);
2939   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer3Pass);
2940   TH1F *gPrimaryAntiProtonsPointOnITSLayer4Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer4Pass",
2941                                                            "",10,-1,1);
2942   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer4Pass);
2943   TH1F *gPrimaryAntiProtonsPointOnITSLayer5Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer5Pass",
2944                                                            "",10,-1,1);
2945   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer5Pass);
2946   TH1F *gPrimaryAntiProtonsPointOnITSLayer6Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer6Pass",
2947                                                            "",10,-1,1);
2948   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer6Pass);
2949   TH1F *gPrimaryAntiProtonsNumberOfTPCdEdxPointsPass = new TH1F("gPrimaryAntiProtonsNumberOfTPCdEdxPointsPass","",100,0,200);
2950   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsNumberOfTPCdEdxPointsPass);
2951   /*TH2F *gHistPrimaryAntiProtonsDCAxyPtPass = new TH2F("gHistPrimaryAntiProtonsDCAxyPtPass",
2952                                                       ";P_{T} [GeV/c];dca_{xy} [cm]",
2953                                                       16,0.3,1.1,
2954                                                       1000,0,10);
2955   gHistPrimaryAntiProtonsDCAxyPtPass->SetStats(kFALSE);
2956   fQAPrimaryAntiProtonsAcceptedList->Add(gHistPrimaryAntiProtonsDCAxyPtPass);
2957   TH2F *gHistPrimaryAntiProtonsDCAzPtPass = new TH2F("gHistPrimaryAntiProtonsDCAzPtPass",
2958                                                      ";P_{T} [GeV/c];dca_{z} [cm]",
2959                                                      16,0.3,1.1,
2960                                                      1000,0,10);
2961   gHistPrimaryAntiProtonsDCAzPtPass->SetStats(kFALSE);
2962   fQAPrimaryAntiProtonsAcceptedList->Add(gHistPrimaryAntiProtonsDCAzPtPass);*/
2963
2964   //Rejected primary antiprotons
2965   /*gDirectory->cd("../");
2966   TDirectory *dirAntiProtonsPrimaryRejected = gDirectory->mkdir("Rejected");
2967   dirAntiProtonsPrimaryRejected->cd();*/
2968   
2969   TH1F *gPrimaryAntiProtonsITSClustersReject = new TH1F("gPrimaryAntiProtonsITSClustersReject",
2970                                                         ";N_{clusters} (ITS);Entries",
2971                                                         7,0,7);
2972   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsITSClustersReject);
2973   TH1F *gPrimaryAntiProtonsChi2PerClusterITSReject = new TH1F("gPrimaryAntiProtonsChi2PerClusterITSReject",
2974                                                               ";x^{2}/N_{clusters} (ITS);Entries",
2975                                                               100,0,4);
2976   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsChi2PerClusterITSReject);
2977   TH1F *gPrimaryAntiProtonsTPCClustersReject = new TH1F("gPrimaryAntiProtonsTPCClustersReject",
2978                                                         ";N_{clusters} (TPC);Entries",
2979                                                         100,0,200);
2980   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsTPCClustersReject);
2981   TH1F *gPrimaryAntiProtonsChi2PerClusterTPCReject = new TH1F("gPrimaryAntiProtonsChi2PerClusterTPCReject",
2982                                                               ";x^{2}/N_{clusters} (TPC);Entries",
2983                                                               100,0,4);
2984   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsChi2PerClusterTPCReject);
2985   TH1F *gPrimaryAntiProtonsExtCov11Reject = new TH1F("gPrimaryAntiProtonsExtCov11Reject",
2986                                                      ";#sigma_{y} [cm];Entries",
2987                                                      100,0,4);
2988   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov11Reject);
2989   TH1F *gPrimaryAntiProtonsExtCov22Reject = new TH1F("gPrimaryAntiProtonsExtCov22Reject",
2990                                                      ";#sigma_{z} [cm];Entries",
2991                                                      100,0,4);
2992   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov22Reject);
2993   TH1F *gPrimaryAntiProtonsExtCov33Reject = new TH1F("gPrimaryAntiProtonsExtCov33Reject",
2994                                                      ";#sigma_{sin(#phi)};Entries",
2995                                                      100,0,4);
2996   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov33Reject);
2997   TH1F *gPrimaryAntiProtonsExtCov44Reject = new TH1F("gPrimaryAntiProtonsExtCov44Reject",
2998                                                      ";#sigma_{tan(#lambda)};Entries",
2999                                                      100,0,4);
3000   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov44Reject);
3001   TH1F *gPrimaryAntiProtonsExtCov55Reject = new TH1F("gPrimaryAntiProtonsExtCov55Reject",
3002                                                      ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
3003                                                      100,0,4);
3004   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov55Reject);
3005   TH1F *gPrimaryAntiProtonsSigmaToVertexReject = new TH1F("gPrimaryAntiProtonsSigmaToVertexReject",
3006                                                           ";#sigma_{Vertex};Entries",
3007                                                           100,0,10);
3008   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsSigmaToVertexReject);
3009   TH1F *gPrimaryAntiProtonsSigmaToVertexTPCReject = new TH1F("gPrimaryAntiProtonsSigmaToVertexTPCReject",
3010                                                              ";#sigma_{Vertex};Entries",
3011                                                              100,0,10);
3012   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsSigmaToVertexTPCReject);
3013   TH1F *gPrimaryAntiProtonsDCAXYReject = new TH1F("gPrimaryAntiProtonsDCAXYReject",
3014                                                   ";DCA_{xy} [cm];Entries",
3015                                                   100,0,20);
3016   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsDCAXYReject);
3017   TH1F *gPrimaryAntiProtonsDCAXYTPCReject = new TH1F("gPrimaryAntiProtonsDCAXYTPCReject",
3018                                                      ";DCA_{xy} [cm];Entries",
3019                                                      100,0,20);
3020   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsDCAXYTPCReject);
3021   TH1F *gPrimaryAntiProtonsDCAZReject = new TH1F("gPrimaryAntiProtonsDCAZReject",
3022                                                  ";DCA_{z} [cm];Entries",
3023                                                  100,0,20);
3024   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsDCAZReject);
3025   TH1F *gPrimaryAntiProtonsDCAZTPCReject = new TH1F("gPrimaryAntiProtonsDCAZTPCReject",
3026                                                     ";DCA_{z} [cm];Entries",
3027                                                     100,0,20);
3028   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsDCAZTPCReject);
3029   TH1F *gPrimaryAntiProtonsConstrainChi2Reject = new TH1F("gPrimaryAntiProtonsConstrainChi2Reject",
3030                                                           ";Log_{10}(#chi^{2});Entries",
3031                                                           100,-10,10);
3032   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsConstrainChi2Reject);
3033   TH1F *gPrimaryAntiProtonsITSRefitReject = new TH1F("gPrimaryAntiProtonsITSRefitReject",
3034                                                      "",10,-1,1);
3035   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsITSRefitReject);
3036   TH1F *gPrimaryAntiProtonsTPCRefitReject = new TH1F("gPrimaryAntiProtonsTPCRefitReject",
3037                                                      "",10,-1,1);
3038   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsTPCRefitReject);
3039   TH1F *gPrimaryAntiProtonsESDpidReject = new TH1F("gPrimaryAntiProtonsESDpidReject",
3040                                                    "",10,-1,1);
3041   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsESDpidReject);
3042   TH1F *gPrimaryAntiProtonsTPCpidReject = new TH1F("gPrimaryAntiProtonsTPCpidReject",
3043                                                    "",10,-1,1);
3044   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsTPCpidReject);
3045   TH1F *gPrimaryAntiProtonsPointOnITSLayer1Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer1Reject",
3046                                                              "",10,-1,1);
3047   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer1Reject);
3048   TH1F *gPrimaryAntiProtonsPointOnITSLayer2Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer2Reject",
3049                                                              "",10,-1,1);
3050   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer2Reject);
3051   TH1F *gPrimaryAntiProtonsPointOnITSLayer3Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer3Reject",
3052                                                              "",10,-1,1);
3053   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer3Reject);
3054   TH1F *gPrimaryAntiProtonsPointOnITSLayer4Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer4Reject",
3055                                                              "",10,-1,1);
3056   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer4Reject);
3057   TH1F *gPrimaryAntiProtonsPointOnITSLayer5Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer5Reject",
3058                                                              "",10,-1,1);
3059   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer5Reject);
3060   TH1F *gPrimaryAntiProtonsPointOnITSLayer6Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer6Reject",
3061                                                              "",10,-1,1);
3062   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer6Reject);
3063   TH1F *gPrimaryAntiProtonsNumberOfTPCdEdxPointsReject = new TH1F("gPrimaryAntiProtonsNumberOfTPCdEdxPointsReject","",100,0,200);
3064   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsNumberOfTPCdEdxPointsReject);
3065   /*TH2F *gHistPrimaryAntiProtonsDCAxyPtReject = new TH2F("gHistPrimaryAntiProtonsDCAxyPtReject",
3066                                                         ";P_{T} [GeV/c];dca_{xy} [cm]",
3067                                                         16,0.3,1.1,
3068                                                         1000,0,10);
3069   gHistPrimaryAntiProtonsDCAxyPtReject->SetStats(kFALSE);
3070   fQAPrimaryAntiProtonsRejectedList->Add(gHistPrimaryAntiProtonsDCAxyPtReject);
3071   TH2F *gHistPrimaryAntiProtonsDCAzPtReject = new TH2F("gHistPrimaryAntiProtonsDCAzPtReject",
3072                                                        ";P_{T} [GeV/c];dca_{z} [cm]",
3073                                                        16,0.3,1.1,
3074                                                        1000,0,10);
3075   gHistPrimaryAntiProtonsDCAzPtReject->SetStats(kFALSE);
3076   fQAPrimaryAntiProtonsRejectedList->Add(gHistPrimaryAntiProtonsDCAzPtReject);*/
3077   
3078   //________________________________________________________________//
3079   /*gDirectory->cd("../../");
3080
3081   TDirectory *dirAntiProtonsSecondary = gDirectory->mkdir("Secondaries");
3082   dirAntiProtonsSecondary->cd();
3083   TDirectory *dirAntiProtonsSecondaryAccepted = gDirectory->mkdir("Accepted");
3084   dirAntiProtonsSecondaryAccepted->cd();*/
3085
3086   //Accepted secondary antiprotons
3087   TH1F *gSecondaryAntiProtonsITSClustersPass = new TH1F("gSecondaryAntiProtonsITSClustersPass",
3088                                                         ";N_{clusters} (ITS);Entries",
3089                                                         7,0,7);
3090   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsITSClustersPass);
3091   TH1F *gSecondaryAntiProtonsChi2PerClusterITSPass = new TH1F("gSecondaryAntiProtonsChi2PerClusterITSPass",
3092                                                               ";x^{2}/N_{clusters} (ITS);Entries",
3093                                                               100,0,4);
3094   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsChi2PerClusterITSPass);
3095   TH1F *gSecondaryAntiProtonsTPCClustersPass = new TH1F("gSecondaryAntiProtonsTPCClustersPass",
3096                                                         ";N_{clusters} (TPC);Entries",
3097                                                         100,0,200);
3098   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsTPCClustersPass);
3099   TH1F *gSecondaryAntiProtonsChi2PerClusterTPCPass = new TH1F("gSecondaryAntiProtonsChi2PerClusterTPCPass",
3100                                                               ";x^{2}/N_{clusters} (TPC);Entries",
3101                                                               100,0,4);
3102   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsChi2PerClusterTPCPass);
3103   TH1F *gSecondaryAntiProtonsExtCov11Pass = new TH1F("gSecondaryAntiProtonsExtCov11Pass",
3104                                                      ";#sigma_{y} [cm];Entries",
3105                                                      100,0,4);
3106   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov11Pass);
3107   TH1F *gSecondaryAntiProtonsExtCov22Pass = new TH1F("gSecondaryAntiProtonsExtCov22Pass",
3108                                                      ";#sigma_{z} [cm];Entries",
3109                                                      100,0,4);
3110   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov22Pass);
3111   TH1F *gSecondaryAntiProtonsExtCov33Pass = new TH1F("gSecondaryAntiProtonsExtCov33Pass",
3112                                                      ";#sigma_{sin(#phi)};Entries",
3113                                                      100,0,4);
3114   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov33Pass);
3115   TH1F *gSecondaryAntiProtonsExtCov44Pass = new TH1F("gSecondaryAntiProtonsExtCov44Pass",
3116                                                      ";#sigma_{tan(#lambda)};Entries",
3117                                                      100,0,4);
3118   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov44Pass);
3119   TH1F *gSecondaryAntiProtonsExtCov55Pass = new TH1F("gSecondaryAntiProtonsExtCov55Pass",
3120                                                      ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
3121                                                      100,0,4);
3122   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov55Pass);
3123   TH1F *gSecondaryAntiProtonsSigmaToVertexPass = new TH1F("gSecondaryAntiProtonsSigmaToVertexPass",
3124                                                           ";#sigma_{Vertex};Entries",
3125                                                           100,0,10);
3126   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsSigmaToVertexPass);
3127   TH1F *gSecondaryAntiProtonsSigmaToVertexTPCPass = new TH1F("gSecondaryAntiProtonsSigmaToVertexTPCPass",
3128                                                              ";#sigma_{Vertex};Entries",
3129                                                              100,0,10);
3130   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsSigmaToVertexTPCPass);
3131   TH1F *gSecondaryAntiProtonsDCAXYPass = new TH1F("gSecondaryAntiProtonsDCAXYPass",
3132                                                   ";DCA_{xy} [cm];Entries",
3133                                                   100,0,20);
3134   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsDCAXYPass);
3135   TH1F *gSecondaryAntiProtonsDCAXYTPCPass = new TH1F("gSecondaryAntiProtonsDCAXYTPCPass",
3136                                                      ";DCA_{xy} [cm];Entries",
3137                                                      100,0,20);
3138   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsDCAXYTPCPass);
3139   TH1F *gSecondaryAntiProtonsDCAZPass = new TH1F("gSecondaryAntiProtonsDCAZPass",
3140                                                  ";DCA_{z} [cm];Entries",
3141                                                  100,0,20);
3142   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsDCAZPass);
3143   TH1F *gSecondaryAntiProtonsDCAZTPCPass = new TH1F("gSecondaryAntiProtonsDCAZTPCPass",
3144                                                     ";DCA_{z} [cm];Entries",
3145                                                     100,0,20);
3146   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsDCAZTPCPass);
3147   TH1F *gSecondaryAntiProtonsConstrainChi2Pass = new TH1F("gSecondaryAntiProtonsConstrainChi2Pass",
3148                                                           ";Log_{10}(#chi^{2});Entries",
3149                                                           100,-10,10);
3150   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsConstrainChi2Pass);
3151   TH1F *gSecondaryAntiProtonsITSRefitPass = new TH1F("gSecondaryAntiProtonsITSRefitPass",
3152                                                      "",10,-1,1);
3153   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsITSRefitPass);
3154   TH1F *gSecondaryAntiProtonsTPCRefitPass = new TH1F("gSecondaryAntiProtonsTPCRefitPass",
3155                                                      "",10,-1,1);
3156   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsTPCRefitPass);
3157   TH1F *gSecondaryAntiProtonsESDpidPass = new TH1F("gSecondaryAntiProtonsESDpidPass",
3158                                                    "",10,-1,1);
3159   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsESDpidPass);
3160   TH1F *gSecondaryAntiProtonsTPCpidPass = new TH1F("gSecondaryAntiProtonsTPCpidPass",
3161                                                    "",10,-1,1);
3162   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsTPCpidPass);
3163   TH1F *gSecondaryAntiProtonsPointOnITSLayer1Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer1Pass",
3164                                                              "",10,-1,1);
3165   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer1Pass);
3166   TH1F *gSecondaryAntiProtonsPointOnITSLayer2Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer2Pass",
3167                                                              "",10,-1,1);
3168   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer2Pass);
3169   TH1F *gSecondaryAntiProtonsPointOnITSLayer3Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer3Pass",
3170                                                              "",10,-1,1);
3171   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer3Pass);
3172   TH1F *gSecondaryAntiProtonsPointOnITSLayer4Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer4Pass",
3173                                                              "",10,-1,1);
3174   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer4Pass);
3175   TH1F *gSecondaryAntiProtonsPointOnITSLayer5Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer5Pass",
3176                                                              "",10,-1,1);
3177   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer5Pass);
3178   TH1F *gSecondaryAntiProtonsPointOnITSLayer6Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer6Pass",
3179                                                              "",10,-1,1);
3180   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer6Pass);
3181   TH1F *gSecondaryAntiProtonsNumberOfTPCdEdxPointsPass = new TH1F("gSecondaryAntiProtonsNumberOfTPCdEdxPointsPass","",100,0,200);
3182   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsNumberOfTPCdEdxPointsPass);
3183   /*TH2F *gHistSecondaryAntiProtonsFromWeakDCAxyPtPass = new TH2F("gHistSecondaryAntiProtonsFromWeakDCAxyPtPass",
3184                                                                 ";P_{T} [GeV/c];dca_{xy} [cm]",
3185                                                                 16,0.3,1.1,
3186                                                                 1000,0,10);
3187   gHistSecondaryAntiProtonsFromWeakDCAxyPtPass->SetStats(kFALSE);
3188   fQASecondaryAntiProtonsAcceptedList->Add(gHistSecondaryAntiProtonsFromWeakDCAxyPtPass);
3189   TH2F *gHistSecondaryAntiProtonsFromWeakDCAzPtPass = new TH2F("gHistSecondaryAntiProtonsFromWeakDCAzPtPass",
3190                                                                ";P_{T} [GeV/c];dca_{z} [cm]",
3191                                                                16,0.3,1.1,
3192                                                                1000,0,10);
3193   gHistSecondaryAntiProtonsFromWeakDCAzPtPass->SetStats(kFALSE);
3194   fQASecondaryAntiProtonsAcceptedList->Add(gHistSecondaryAntiProtonsFromWeakDCAzPtPass);
3195   TH2F *gHistSecondaryAntiProtonsFromHadronicDCAxyPtPass = new TH2F("gHistSecondaryAntiProtonsFromHadronicDCAxyPtPass",
3196                                                                     ";P_{T} [GeV/c];dca_{xy} [cm]",
3197                                                                     16,0.3,1.1,
3198                                                                     1000,0,10);
3199   gHistSecondaryAntiProtonsFromHadronicDCAxyPtPass->SetStats(kFALSE);
3200   fQASecondaryAntiProtonsAcceptedList->Add(gHistSecondaryAntiProtonsFromHadronicDCAxyPtPass);
3201   TH2F *gHistSecondaryAntiProtonsFromHadronicDCAzPtPass = new TH2F("gHistSecondaryAntiProtonsFromHadronicDCAzPtPass",
3202                                                                    ";P_{T} [GeV/c];dca_{z} [cm]",
3203                                                                    16,0.3,1.1,
3204                                                                    1000,0,10);
3205   gHistSecondaryAntiProtonsFromHadronicDCAzPtPass->SetStats(kFALSE);
3206   fQASecondaryAntiProtonsAcceptedList->Add(gHistSecondaryAntiProtonsFromHadronicDCAzPtPass);*/
3207   
3208   //Rejected secondary antiprotons
3209   /*gDirectory->cd("../");
3210   TDirectory *dirAntiProtonsSecondaryRejected = gDirectory->mkdir("Rejected");
3211   dirAntiProtonsSecondaryRejected->cd();*/
3212
3213   TH1F *gSecondaryAntiProtonsITSClustersReject = new TH1F("gSecondaryAntiProtonsITSClustersReject",
3214                                                           ";N_{clusters} (ITS);Entries",
3215                                                           7,0,7);
3216   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsITSClustersReject);
3217   TH1F *gSecondaryAntiProtonsChi2PerClusterITSReject = new TH1F("gSecondaryAntiProtonsChi2PerClusterITSReject",
3218                                                                 ";x^{2}/N_{clusters} (ITS);Entries",
3219                                                                 100,0,4);
3220   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsChi2PerClusterITSReject);
3221   TH1F *gSecondaryAntiProtonsTPCClustersReject = new TH1F("gSecondaryAntiProtonsTPCClustersReject",
3222                                                           ";N_{clusters} (TPC);Entries",
3223                                                           100,0,200);
3224   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsTPCClustersReject);
3225   TH1F *gSecondaryAntiProtonsChi2PerClusterTPCReject = new TH1F("gSecondaryAntiProtonsChi2PerClusterTPCReject",
3226                                                                 ";x^{2}/N_{clusters} (TPC);Entries",
3227                                                                 100,0,4);
3228   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsChi2PerClusterTPCReject);
3229   TH1F *gSecondaryAntiProtonsExtCov11Reject = new TH1F("gSecondaryAntiProtonsExtCov11Reject",
3230                                                        ";#sigma_{y} [cm];Entries",
3231                                                        100,0,4);
3232   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov11Reject);
3233   TH1F *gSecondaryAntiProtonsExtCov22Reject = new TH1F("gSecondaryAntiProtonsExtCov22Reject",
3234                                                        ";#sigma_{z} [cm];Entries",
3235                                                        100,0,4);
3236   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov22Reject);
3237   TH1F *gSecondaryAntiProtonsExtCov33Reject = new TH1F("gSecondaryAntiProtonsExtCov33Reject",
3238                                                        ";#sigma_{sin(#phi)};Entries",
3239                                                        100,0,4);
3240   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov33Reject);
3241   TH1F *gSecondaryAntiProtonsExtCov44Reject = new TH1F("gSecondaryAntiProtonsExtCov44Reject",
3242                                                        ";#sigma_{tan(#lambda)};Entries",
3243                                                        100,0,4);
3244   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov44Reject);
3245   TH1F *gSecondaryAntiProtonsExtCov55Reject = new TH1F("gSecondaryAntiProtonsExtCov55Reject",
3246                                                        ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
3247                                                        100,0,4);
3248   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov55Reject);
3249   TH1F *gSecondaryAntiProtonsSigmaToVertexReject = new TH1F("gSecondaryAntiProtonsSigmaToVertexReject",
3250                                                             ";#sigma_{Vertex};Entries",
3251                                                             100,0,10);
3252   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsSigmaToVertexReject);
3253   TH1F *gSecondaryAntiProtonsSigmaToVertexTPCReject = new TH1F("gSecondaryAntiProtonsSigmaToVertexTPCReject",
3254                                                                ";#sigma_{Vertex};Entries",
3255                                                                100,0,10);
3256   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsSigmaToVertexTPCReject);
3257   TH1F *gSecondaryAntiProtonsDCAXYReject = new TH1F("gSecondaryAntiProtonsDCAXYReject",
3258                                                     ";DCA_{xy} [cm];Entries",
3259                                                     100,0,20);
3260   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsDCAXYReject);
3261   TH1F *gSecondaryAntiProtonsDCAXYTPCReject = new TH1F("gSecondaryAntiProtonsDCAXYTPCReject",
3262                                                        ";DCA_{xy} [cm];Entries",
3263                                                        100,0,20);
3264   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsDCAXYTPCReject);
3265   TH1F *gSecondaryAntiProtonsDCAZReject = new TH1F("gSecondaryAntiProtonsDCAZReject",
3266                                                    ";DCA_{z} [cm];Entries",
3267                                                    100,0,20);
3268   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsDCAZReject);
3269   TH1F *gSecondaryAntiProtonsDCAZTPCReject = new TH1F("gSecondaryAntiProtonsDCAZTPCReject",
3270                                                       ";DCA_{z} [cm];Entries",
3271                                                       100,0,20);
3272   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsDCAZTPCReject);
3273   TH1F *gSecondaryAntiProtonsConstrainChi2Reject = new TH1F("gSecondaryAntiProtonsConstrainChi2Reject",
3274                                                             ";Log_{10}(#chi^{2});Entries",
3275                                                             100,-10,10);
3276   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsConstrainChi2Reject);
3277   TH1F *gSecondaryAntiProtonsITSRefitReject = new TH1F("gSecondaryAntiProtonsITSRefitReject",
3278                                                        "",10,-1,1);
3279   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsITSRefitReject);
3280   TH1F *gSecondaryAntiProtonsTPCRefitReject = new TH1F("gSecondaryAntiProtonsTPCRefitReject",
3281                                                        "",10,-1,1);
3282   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsTPCRefitReject);
3283   TH1F *gSecondaryAntiProtonsESDpidReject = new TH1F("gSecondaryAntiProtonsESDpidReject",
3284                                                      "",10,-1,1);
3285   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsESDpidReject);
3286   TH1F *gSecondaryAntiProtonsTPCpidReject = new TH1F("gSecondaryAntiProtonsTPCpidReject",
3287                                                      "",10,-1,1);
3288   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsTPCpidReject);
3289   TH1F *gSecondaryAntiProtonsPointOnITSLayer1Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer1Reject",
3290                                                              "",10,-1,1);
3291   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer1Reject);
3292   TH1F *gSecondaryAntiProtonsPointOnITSLayer2Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer2Reject",
3293                                                              "",10,-1,1);
3294   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer2Reject);
3295   TH1F *gSecondaryAntiProtonsPointOnITSLayer3Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer3Reject",
3296                                                              "",10,-1,1);
3297   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer3Reject);
3298   TH1F *gSecondaryAntiProtonsPointOnITSLayer4Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer4Reject",
3299                                                              "",10,-1,1);
3300   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer4Reject);
3301   TH1F *gSecondaryAntiProtonsPointOnITSLayer5Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer5Reject",
3302                                                              "",10,-1,1);
3303   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer5Reject);
3304   TH1F *gSecondaryAntiProtonsPointOnITSLayer6Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer6Reject",
3305                                                              "",10,-1,1);
3306   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer6Reject);
3307   TH1F *gSecondaryAntiProtonsNumberOfTPCdEdxPointsReject = new TH1F("gSecondaryAntiProtonsNumberOfTPCdEdxPointsReject","",100,0,200);
3308   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsNumberOfTPCdEdxPointsReject);
3309   /*TH2F *gHistSecondaryAntiProtonsFromWeakDCAxyPtReject = new TH2F("gHistSecondaryAntiProtonsFromWeakDCAxyPtReject",
3310                                                                   ";P_{T} [GeV/c];dca_{xy} [cm]",
3311                                                                   16,0.3,1.1,
3312                                                                   1000,0,10);
3313   gHistSecondaryAntiProtonsFromWeakDCAxyPtReject->SetStats(kFALSE);
3314   fQASecondaryAntiProtonsRejectedList->Add(gHistSecondaryAntiProtonsFromWeakDCAxyPtReject);
3315   TH2F *gHistSecondaryAntiProtonsFromWeakDCAzPtReject = new TH2F("gHistSecondaryAntiProtonsFromWeakDCAzPtReject",
3316                                                                  ";P_{T} [GeV/c];dca_{z} [cm]",
3317                                                                  16,0.3,1.1,
3318                                                                  1000,0,10);
3319   gHistSecondaryAntiProtonsFromWeakDCAzPtReject->SetStats(kFALSE);
3320   fQASecondaryAntiProtonsRejectedList->Add(gHistSecondaryAntiProtonsFromWeakDCAzPtReject);
3321   TH2F *gHistSecondaryAntiProtonsFromHadronicDCAxyPtReject = new TH2F("gHistSecondaryAntiProtonsFromHadronicDCAxyPtReject",
3322                                                                       ";P_{T} [GeV/c];dca_{xy} [cm]",
3323                                                                       16,0.3,1.1,
3324                                                                       1000,0,10);
3325   gHistSecondaryAntiProtonsFromHadronicDCAxyPtReject->SetStats(kFALSE);
3326   fQASecondaryAntiProtonsRejectedList->Add(gHistSecondaryAntiProtonsFromHadronicDCAxyPtReject);
3327   TH2F *gHistSecondaryAntiProtonsFromHadronicDCAzPtReject = new TH2F("gHistSecondaryAntiProtonsFromHadronicDCAzPtReject",
3328                                                                      ";P_{T} [GeV/c];dca_{z} [cm]",
3329                                                                      16,0.3,1.1,
3330                                                                      1000,0,10);
3331   gHistSecondaryAntiProtonsFromHadronicDCAzPtReject->SetStats(kFALSE);
3332   fQASecondaryAntiProtonsRejectedList->Add(gHistSecondaryAntiProtonsFromHadronicDCAzPtReject);*/
3333 }
3334
3335 //____________________________________________________________________//
3336 void AliProtonQAAnalysis::RunReconstructionEfficiencyAnalysis(AliMCEvent *const mcEvent, 
3337                                                               AliESDEvent *esd,
3338                                                               const AliESDVertex *vertex) {
3339   //Run the reconstruction efficiency code (primaries & secondaries)
3340   AliStack *stack = mcEvent->Stack();
3341
3342   Int_t nMCParticles = mcEvent->GetNumberOfTracks();
3343   Int_t nMCLabelCounter = 0;
3344   TArrayI labelMCArray(nMCParticles);
3345
3346   for (Int_t iTracks = 0; iTracks < mcEvent->GetNumberOfTracks(); iTracks++) {
3347     AliMCParticle *mcTrack = (AliMCParticle*) mcEvent->GetTrack(iTracks);
3348     if (!mcTrack) {
3349       Printf("ERROR: Could not receive track %d (mc loop)", iTracks);
3350       continue;
3351     }
3352
3353     Double_t vz = mcTrack->Zv();
3354     if (TMath::Abs(vz) > 50.) continue;//exclude particles generated out of the acceptance
3355
3356     if(TMath::Abs(mcTrack->Eta()) > 1.0) continue;//acceptance
3357     if((mcTrack->Pt() > fMaxPt)||(mcTrack->Pt() < fMinPt)) continue;
3358     if(fProtonAnalysisBase->GetEtaMode()) {
3359       if((mcTrack->Eta() > fMaxY)|| (mcTrack->Eta() < fMinY)) continue;
3360     }
3361     else 
3362       if((fProtonAnalysisBase->Rapidity(mcTrack->Px(),mcTrack->Py(),mcTrack->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(mcTrack->Px(),mcTrack->Py(),mcTrack->Pz()) < fMinY)) continue;
3363     
3364     // Loop over Track References
3365     Bool_t labelTPC = kFALSE;
3366     AliTrackReference* trackRef = 0;
3367     for (Int_t iTrackRef = 0; iTrackRef  < mcTrack->GetNumberOfTrackReferences(); iTrackRef++) {
3368       trackRef = mcTrack->GetTrackReference(iTrackRef);
3369       if(trackRef) {
3370         Int_t detectorId = trackRef->DetectorId(); 
3371         if (detectorId == AliTrackReference::kTPC) {        
3372           labelTPC = kTRUE;
3373           break;
3374         }
3375       }      
3376     }
3377
3378     //findable tracks
3379     //if (labelTPC) {
3380       TParticle* particle = mcTrack->Particle();
3381       if(!particle) continue;
3382       Int_t pdgcode = particle->GetPdgCode();
3383       if(TMath::Abs(pdgcode) != 2212) continue;
3384       
3385       labelMCArray.AddAt(iTracks,nMCLabelCounter);
3386       nMCLabelCounter += 1;
3387
3388       if(iTracks <= stack->GetNprimary()) {
3389         if(pdgcode == 2212) {
3390           if(fProtonAnalysisBase->GetEtaMode()) 
3391             ((TH2D *)(fEfficiencyList->At(0)))->Fill(particle->Eta(),
3392                                                      particle->Pt());
3393           else
3394             ((TH2D *)(fEfficiencyList->At(0)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3395                                                                                    particle->Py(),
3396                                                                                    particle->Pz()),
3397                                                      particle->Pt());
3398         }//protons
3399         if(pdgcode == -2212) {
3400           if(fProtonAnalysisBase->GetEtaMode()) 
3401             ((TH2D *)(fEfficiencyList->At(1)))->Fill(particle->Eta(),
3402                                                      particle->Pt());
3403           else
3404             ((TH2D *)(fEfficiencyList->At(1)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3405                                                                                    particle->Py(),
3406                                                                                    particle->Pz()),
3407                                                      particle->Pt());
3408         }//antiprotons
3409       }//primaries
3410       else {
3411         //secondaries
3412         Int_t lPartMother = -1;
3413         Int_t motherPDGCode = -1;
3414         lPartMother = particle->GetFirstMother();
3415         AliMCParticle *mcMotherTrack = (AliMCParticle*) mcEvent->GetTrack(lPartMother);
3416         TParticle *motherParticle = mcMotherTrack->Particle();
3417         if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
3418         
3419         if(pdgcode == 2212) {
3420           if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3421             if(fProtonAnalysisBase->GetEtaMode()) 
3422               ((TH2D *)(fEfficiencyList->At(2)))->Fill(particle->Eta(),
3423                                                        particle->Pt());
3424             else
3425               ((TH2D *)(fEfficiencyList->At(2)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3426                                                                 particle->Py(),
3427                                                                 particle->Pz()),
3428                                                        particle->Pt());
3429           }//weak decays
3430           if((particle->GetUniqueID() == 13)) {
3431             if(fProtonAnalysisBase->GetEtaMode()) 
3432               ((TH2D *)(fEfficiencyList->At(4)))->Fill(particle->Eta(),
3433                                                        particle->Pt());
3434             else
3435               ((TH2D *)(fEfficiencyList->At(4)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3436                                                                 particle->Py(),
3437                                                                 particle->Pz()),
3438                                                        particle->Pt());
3439           }//hadronic interactions
3440         }//protons
3441         if(pdgcode == -2212) {
3442           if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3443             if(fProtonAnalysisBase->GetEtaMode()) 
3444               ((TH2D *)(fEfficiencyList->At(3)))->Fill(particle->Eta(),
3445                                                        particle->Pt());
3446             else
3447               ((TH2D *)(fEfficiencyList->At(3)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3448                                                                 particle->Py(),
3449                                                                 particle->Pz()),
3450                                                        particle->Pt());
3451           }//weak decays
3452           if((particle->GetUniqueID() == 13)) {
3453             if(fProtonAnalysisBase->GetEtaMode()) 
3454               ((TH2D *)(fEfficiencyList->At(5)))->Fill(particle->Eta(),
3455                                                        particle->Pt());
3456             else
3457               ((TH2D *)(fEfficiencyList->At(5)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3458                                                                 particle->Py(),
3459                                                                 particle->Pz()),
3460                                                        particle->Pt());
3461           }//hadronic interactions
3462         }//antiprotons
3463       }//secondaries
3464       //}//findable tracks
3465   }//MC track loop
3466
3467   //ESD track loop
3468   Bool_t iFound = kFALSE;
3469   Int_t mcGoods = nMCLabelCounter;
3470   for (Int_t k = 0; k < mcGoods; k++) {
3471     Int_t mcLabel = labelMCArray.At(k);
3472     iFound = kFALSE;
3473
3474     Int_t nGoodTracks = esd->GetNumberOfTracks();
3475     TArrayI labelArray(nGoodTracks);
3476     Int_t labelCounter = 0;
3477     for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) {
3478       AliESDtrack* track = esd->GetTrack(iTracks);
3479       if(!track) continue;
3480             
3481       //TPC only
3482       if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
3483         AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
3484         if(!tpcTrack) continue;
3485         
3486         Int_t label = TMath::Abs(track->GetTPCLabel());
3487         if(IsLabelUsed(labelArray,label)) continue;
3488         labelArray.AddAt(label,labelCounter);
3489         labelCounter += 1;
3490         
3491         if (mcLabel != TMath::Abs(label)) continue;
3492         if(mcLabel != label) continue;
3493         if(label > stack->GetNtrack()) continue;
3494
3495         TParticle *particle = stack->Particle(label);
3496         if(!particle) continue;
3497         Int_t pdgcode = particle->GetPdgCode();
3498         if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
3499         if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
3500         if(fProtonAnalysisBase->GetEtaMode()) {
3501           if((particle->Eta() > fMaxY)|| (particle->Eta() < fMinY)) continue;
3502         }
3503         else 
3504           if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
3505                 
3506         if(fUseCutsInEfficiency) {
3507           if(!fProtonAnalysisBase->IsPrimary(esd,vertex,track)) continue;
3508           if(!fProtonAnalysisBase->IsAccepted(track)) continue;
3509         }       
3510         //reconstructed primary (anti)protons
3511         if(pdgcode == 2212) {
3512           if(label <= stack->GetNprimary()) {
3513             if(fProtonAnalysisBase->GetEtaMode())
3514               ((TH2D *)(fEfficiencyList->At(6)))->Fill(particle->Eta(),
3515                                                        particle->Pt());
3516             else
3517               ((TH2D *)(fEfficiencyList->At(6)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3518                                                                 particle->Py(),
3519                                                                 particle->Pz()),
3520                                                        particle->Pt());
3521           }//primaries
3522           if(label > stack->GetNprimary()) {
3523             Int_t lPartMother = -1;
3524             Int_t motherPDGCode = -1;
3525             lPartMother = particle->GetFirstMother();
3526             TParticle *motherParticle = stack->Particle(lPartMother);
3527             if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
3528             
3529             if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3530               if(fProtonAnalysisBase->GetEtaMode())
3531                 ((TH2D *)(fEfficiencyList->At(8)))->Fill(particle->Eta(),
3532                                                          particle->Pt());
3533               else
3534                 ((TH2D *)(fEfficiencyList->At(8)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3535                                                                   particle->Py(),
3536                                                                   particle->Pz()),
3537                                                          particle->Pt());
3538             }//weak decays
3539             if((particle->GetUniqueID() == 13)) {
3540               if(fProtonAnalysisBase->GetEtaMode())
3541                 ((TH2D *)(fEfficiencyList->At(10)))->Fill(particle->Eta(),
3542                                                           particle->Pt());
3543               else
3544                 ((TH2D *)(fEfficiencyList->At(10)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3545                                                                    particle->Py(),
3546                                                                    particle->Pz()),
3547                                                           particle->Pt());
3548             }//hadronic interactions
3549           }//secondaries
3550         }//initial protons
3551         if(pdgcode == -2212) {  
3552           if(label <= stack->GetNprimary()) {
3553             if(fProtonAnalysisBase->GetEtaMode())
3554               ((TH2D *)(fEfficiencyList->At(7)))->Fill(particle->Eta(),
3555                                                        particle->Pt());
3556             else
3557               ((TH2D *)(fEfficiencyList->At(7)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3558                                                                 particle->Py(),
3559                                                                 particle->Pz()),
3560                                                        particle->Pt());
3561           }//primaries
3562           if(label > stack->GetNprimary()) {
3563             Int_t lPartMother = -1;
3564             Int_t motherPDGCode = -1;
3565             lPartMother = particle->GetFirstMother();
3566             TParticle *motherParticle = stack->Particle(lPartMother);
3567             if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
3568             
3569             if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3570               if(fProtonAnalysisBase->GetEtaMode())
3571                 ((TH2D *)(fEfficiencyList->At(9)))->Fill(particle->Eta(),
3572                                                          particle->Pt());
3573               else
3574                 ((TH2D *)(fEfficiencyList->At(9)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3575                                                                   particle->Py(),
3576                                                                   particle->Pz()),
3577                                                          particle->Pt());
3578             }//weak decays
3579             if((particle->GetUniqueID() == 13)) {
3580               if(fProtonAnalysisBase->GetEtaMode())
3581                 ((TH2D *)(fEfficiencyList->At(11)))->Fill(particle->Eta(),
3582                                                           particle->Pt());
3583               else
3584                 ((TH2D *)(fEfficiencyList->At(11)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3585                                                                    particle->Py(),
3586                                                                    particle->Pz()),
3587                                                           particle->Pt());
3588             }//hadronic interactions
3589           }//secondaries
3590         }//initial antiprotons  
3591       }//TPC only tracks
3592       else {
3593         Int_t label = TMath::Abs(track->GetLabel());
3594         if(IsLabelUsed(labelArray,label)) continue;
3595         labelArray.AddAt(label,labelCounter);
3596         labelCounter += 1;
3597         
3598         if (mcLabel != TMath::Abs(label)) continue;
3599         if(mcLabel != label) continue;
3600         if(label > stack->GetNtrack()) continue;
3601                 
3602         TParticle *particle = stack->Particle(label);
3603         if(!particle) continue;
3604         Int_t pdgcode = particle->GetPdgCode();
3605         if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
3606         if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
3607         if(fProtonAnalysisBase->GetEtaMode()) {
3608           if((particle->Eta() > fMaxY)|| (particle->Eta() < fMinY)) continue;
3609         }
3610         else 
3611           if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
3612         
3613         //Double_t probability[5];
3614
3615         if(fUseCutsInEfficiency) {
3616           if(!fProtonAnalysisBase->IsPrimary(esd,vertex,track)) continue;
3617           if(!fProtonAnalysisBase->IsAccepted(track)) continue;
3618         }       
3619         //reconstructed primary (anti)protons
3620         if(pdgcode == 2212) {
3621           if(label <= stack->GetNprimary()) {
3622             if(fProtonAnalysisBase->GetEtaMode())
3623               ((TH2D *)(fEfficiencyList->At(6)))->Fill(particle->Eta(),
3624                                                        particle->Pt());
3625             else
3626               ((TH2D *)(fEfficiencyList->At(6)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3627                                                                 particle->Py(),
3628                                                                 particle->Pz()),
3629                                                        particle->Pt());
3630           }//primaries
3631           if(label > stack->GetNprimary()) {
3632             Int_t lPartMother = -1;
3633             Int_t motherPDGCode = -1;
3634             lPartMother = particle->GetFirstMother();
3635             TParticle *motherParticle = stack->Particle(lPartMother);
3636             if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
3637             
3638             if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3639               if(fProtonAnalysisBase->GetEtaMode())
3640                 ((TH2D *)(fEfficiencyList->At(8)))->Fill(particle->Eta(),
3641                                                          particle->Pt());
3642               else
3643                 ((TH2D *)(fEfficiencyList->At(8)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3644                                                                   particle->Py(),
3645                                                                   particle->Pz()),
3646                                                          particle->Pt());
3647             }//weak decays
3648             if((particle->GetUniqueID() == 13)) {
3649               if(fProtonAnalysisBase->GetEtaMode())
3650                 ((TH2D *)(fEfficiencyList->At(10)))->Fill(particle->Eta(),
3651                                                           particle->Pt());
3652               else
3653                 ((TH2D *)(fEfficiencyList->At(10)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3654                                                                    particle->Py(),
3655                                                                    particle->Pz()),
3656                                                           particle->Pt());
3657             }//hadronic interactions
3658           }//secondaries
3659         }//initial protons
3660         if(pdgcode == -2212) {  
3661           if(label <= stack->GetNprimary()) {
3662             if(fProtonAnalysisBase->GetEtaMode())
3663               ((TH2D *)(fEfficiencyList->At(7)))->Fill(particle->Eta(),
3664                                                        particle->Pt());
3665             else
3666               ((TH2D *)(fEfficiencyList->At(7)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3667                                                                 particle->Py(),
3668                                                                 particle->Pz()),
3669                                                        particle->Pt());
3670           }//primaries
3671           if(label > stack->GetNprimary()) {
3672             Int_t lPartMother = -1;
3673             Int_t motherPDGCode = -1;
3674             lPartMother = particle->GetFirstMother();
3675             TParticle *motherParticle = stack->Particle(lPartMother);
3676             if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
3677             
3678             if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3679               if(fProtonAnalysisBase->GetEtaMode())
3680                 ((TH2D *)(fEfficiencyList->At(9)))->Fill(particle->Eta(),
3681                                                          particle->Pt());
3682               else
3683                 ((TH2D *)(fEfficiencyList->At(9)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3684                                                                   particle->Py(),
3685                                                                   particle->Pz()),
3686                                                          particle->Pt());
3687             }//weak decays
3688             if((particle->GetUniqueID() == 13)) {
3689               if(fProtonAnalysisBase->GetEtaMode())
3690                 ((TH2D *)(fEfficiencyList->At(11)))->Fill(particle->Eta(),
3691                                                           particle->Pt());
3692               else
3693                 ((TH2D *)(fEfficiencyList->At(11)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3694                                                                    particle->Py(),
3695                                                                    particle->Pz()),
3696                                                           particle->Pt());
3697             }//hadronic interactions
3698           }//secondaries
3699         }//initial antiprotons  
3700       }//global tracking
3701     }//track loop
3702     labelArray.Reset();
3703   }//loop over findable tracks
3704
3705   labelMCArray.Reset();
3706 }
3707
3708 //____________________________________________________________________//
3709 void AliProtonQAAnalysis::RunPIDEfficiencyAnalysis(AliStack *const stack, 
3710                                                    AliESDEvent *esd,
3711                                                    const AliESDVertex *vertex) {
3712   //Runs the PID efficiency analysis
3713   Int_t nGoodTracks = esd->GetNumberOfTracks();
3714   TArrayI labelArray(nGoodTracks);
3715   Int_t labelCounter = 0;
3716   for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) {
3717     AliESDtrack* track = esd->GetTrack(iTracks);
3718     if(!track) continue;
3719     
3720     //TPC only
3721     if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
3722       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
3723       if(!tpcTrack) continue;
3724     }
3725         
3726     Int_t label = TMath::Abs(track->GetLabel());
3727     if(IsLabelUsed(labelArray,label)) continue;
3728     labelArray.AddAt(label,labelCounter);
3729     labelCounter += 1;
3730     if(label > stack->GetNtrack()) continue;
3731
3732     TParticle *particle = stack->Particle(label);
3733     if(!particle) continue;
3734     Int_t pdgcode = particle->GetPdgCode();
3735     
3736     Int_t nTPCpoints = track->GetTPCsignalN();
3737
3738     if(fUseCutsInEfficiency) {
3739       if(!fProtonAnalysisBase->IsPrimary(esd,vertex,track)) continue;
3740       if(!fProtonAnalysisBase->IsAccepted(track)) continue;
3741     }   
3742     if(TMath::Abs(pdgcode) == 2212) {
3743       if(fProtonAnalysisBase->GetEtaMode())
3744         ((TH3D *)(fEfficiencyList->At(12)))->Fill(particle->Eta(),
3745                                                   particle->Pt(),nTPCpoints);
3746       else
3747         ((TH3D *)(fEfficiencyList->At(12)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt(),nTPCpoints);
3748     }
3749
3750     //pid
3751     if(fProtonAnalysisBase->IsProton(track)) {
3752       if(fProtonAnalysisBase->GetEtaMode())
3753         ((TH3D *)(fEfficiencyList->At(14)))->Fill(particle->Eta(),
3754                                                   particle->Pt(),nTPCpoints);
3755       else ((TH3D *)(fEfficiencyList->At(14)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt(),nTPCpoints);
3756       if(TMath::Abs(pdgcode) == 2212) {
3757         if(fProtonAnalysisBase->GetEtaMode())
3758           ((TH3D *)(fEfficiencyList->At(13)))->Fill(particle->Eta(),
3759                                                     particle->Pt(),nTPCpoints);
3760         else
3761           ((TH3D *)(fEfficiencyList->At(13)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt(),nTPCpoints);
3762       }//properly identified as proton
3763       else {
3764         if(fProtonAnalysisBase->GetEtaMode())
3765           ((TH3D *)(fEfficiencyList->At(15)))->Fill(particle->Eta(),
3766                                                     particle->Pt(),nTPCpoints);
3767         else
3768           ((TH3D *)(fEfficiencyList->At(15)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt(),nTPCpoints);
3769       }//contamination
3770     }//identified as proton
3771   }//ESD track loop
3772   labelArray.Reset();
3773 }
3774
3775 //____________________________________________________________________//
3776 void AliProtonQAAnalysis::RunCutEfficiencyAnalysis(AliStack *const stack, 
3777                                                    AliESDEvent *esd,
3778                                                    const AliESDVertex *vertex) {
3779   //Runs the cut efficiency analysis
3780   Int_t nGoodTracks = esd->GetNumberOfTracks();
3781   TArrayI labelArray(nGoodTracks);
3782   Int_t labelCounter = 0;
3783   Int_t nPrimaries = stack->GetNprimary();
3784   for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) {
3785     AliESDtrack* track = esd->GetTrack(iTracks);
3786     if(!track) continue;
3787     
3788     //TPC only
3789     if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
3790       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
3791       if(!tpcTrack) continue;
3792     }
3793         
3794     Int_t label = TMath::Abs(track->GetLabel());
3795     if(IsLabelUsed(labelArray,label)) continue;
3796     labelArray.AddAt(label,labelCounter);
3797     labelCounter += 1;
3798     if(label > stack->GetNtrack()) continue;
3799
3800     TParticle *particle = stack->Particle(label);
3801     if(!particle) continue;
3802                 
3803     //select primaries
3804     if(label > nPrimaries) continue;
3805     //select identified protons
3806     if(!fProtonAnalysisBase->IsProton(track)) continue;
3807  
3808     if(track->Charge() > 0) {
3809       if(fProtonAnalysisBase->GetEtaMode())
3810         ((TH2F *)(fCutEfficiencyList->At(0)))->Fill(particle->Eta(),
3811                                                     particle->Pt());
3812       else
3813         ((TH2F *)(fCutEfficiencyList->At(0)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt());
3814     }
3815
3816     if(track->Charge() < 0) {
3817       if(fProtonAnalysisBase->GetEtaMode())
3818         ((TH2F *)(fCutEfficiencyList->At(1)))->Fill(particle->Eta(),
3819                                                     particle->Pt());
3820       else
3821         ((TH2F *)(fCutEfficiencyList->At(1)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt());
3822     }
3823
3824     //survived tracks
3825     if(!fProtonAnalysisBase->IsPrimary(esd,vertex,track)) continue;
3826     if(!fProtonAnalysisBase->IsAccepted(track)) continue;
3827     if(track->Charge() > 0) {
3828       if(fProtonAnalysisBase->GetEtaMode())
3829         ((TH2F *)(fCutEfficiencyList->At(2)))->Fill(particle->Eta(),
3830                                                     particle->Pt());
3831       else
3832         ((TH2F *)(fCutEfficiencyList->At(2)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt());
3833     }
3834
3835     if(track->Charge() < 0) {
3836       if(fProtonAnalysisBase->GetEtaMode())
3837         ((TH2F *)(fCutEfficiencyList->At(3)))->Fill(particle->Eta(),
3838                                                     particle->Pt());
3839       else
3840         ((TH2F *)(fCutEfficiencyList->At(3)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()),particle->Pt());
3841     }
3842   }//ESD track loop
3843   labelArray.Reset();
3844 }
3845
3846 //____________________________________________________________________//
3847 void AliProtonQAAnalysis::RunEfficiencyAnalysis(AliStack *const stack, 
3848                                                 AliESDEvent *esd,
3849                                                 const AliESDVertex *vertex) {
3850   //Runs the efficiency code
3851   //MC loop
3852   Int_t nMCProtons = 0, nESDProtons = 0;
3853   for(Int_t iParticle = 0; iParticle < stack->GetNtrack(); iParticle++) {
3854     TParticle *particle = stack->Particle(iParticle);
3855     if(!particle) continue;
3856
3857     if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
3858     if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
3859     if(fProtonAnalysisBase->GetEtaMode()) {
3860       if((particle->Eta() > fMaxY)|| (particle->Eta() < fMinY)) continue;
3861     }
3862     else 
3863       if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
3864
3865     Int_t pdgcode = particle->GetPdgCode();
3866     if(TMath::Abs(pdgcode) != 2212) continue;
3867
3868     if(iParticle <= stack->GetNprimary()) {
3869       if(pdgcode == 2212) {
3870         nMCProtons += 1;
3871         if(fProtonAnalysisBase->GetEtaMode()) 
3872           ((TH2D *)(fEfficiencyList->At(0)))->Fill(particle->Eta(),
3873                                                    particle->Pt());
3874         else
3875           ((TH2D *)(fEfficiencyList->At(0)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3876                                                             particle->Py(),
3877                                                             particle->Pz()),
3878                                                    particle->Pt());
3879       }//protons
3880       if(pdgcode == -2212) {
3881         if(fProtonAnalysisBase->GetEtaMode()) 
3882           ((TH2D *)(fEfficiencyList->At(1)))->Fill(particle->Eta(),
3883                                                    particle->Pt());
3884         else
3885           ((TH2D *)(fEfficiencyList->At(1)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3886                                                                                  particle->Py(),
3887                                                                                  particle->Pz()),
3888                                                    particle->Pt());
3889       }//antiprotons
3890     }//primaries
3891     else {
3892       //secondaries
3893       Int_t lPartMother = -1;
3894       Int_t motherPDGCode = -1;
3895       lPartMother = particle->GetFirstMother();
3896       TParticle *motherParticle = stack->Particle(lPartMother);
3897       if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
3898
3899       if(pdgcode == 2212) {
3900         if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3901           if(fProtonAnalysisBase->GetEtaMode()) 
3902             ((TH2D *)(fEfficiencyList->At(2)))->Fill(particle->Eta(),
3903                                                      particle->Pt());
3904           else
3905             ((TH2D *)(fEfficiencyList->At(2)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3906                                                                                    particle->Py(),
3907                                                                                    particle->Pz()),
3908                                                      particle->Pt());
3909         }//weak decays
3910         if((particle->GetUniqueID() == 13)) {
3911           if(fProtonAnalysisBase->GetEtaMode()) 
3912             ((TH2D *)(fEfficiencyList->At(4)))->Fill(particle->Eta(),
3913                                                      particle->Pt());
3914           else
3915             ((TH2D *)(fEfficiencyList->At(4)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3916                                                                                    particle->Py(),
3917                                                                                    particle->Pz()),
3918                                                      particle->Pt());
3919         }//hadronic interactions
3920       }//protons
3921       if(pdgcode == -2212) {
3922         if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
3923           if(fProtonAnalysisBase->GetEtaMode()) 
3924             ((TH2D *)(fEfficiencyList->At(3)))->Fill(particle->Eta(),
3925                                                      particle->Pt());
3926           else
3927             ((TH2D *)(fEfficiencyList->At(3)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3928                                                                                    particle->Py(),
3929                                                                                    particle->Pz()),
3930                                                      particle->Pt());
3931         }//weak decays
3932         if((particle->GetUniqueID() == 13)) {
3933           if(fProtonAnalysisBase->GetEtaMode()) 
3934             ((TH2D *)(fEfficiencyList->At(5)))->Fill(particle->Eta(),
3935                                                      particle->Pt());
3936           else
3937             ((TH2D *)(fEfficiencyList->At(5)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3938                                                               particle->Py(),
3939                                                               particle->Pz()),
3940                                                      particle->Pt());
3941         }//hadronic interactions
3942       }//antiprotons
3943     }//secondaries
3944   
3945   }//MC loop
3946
3947   //ESD track loop
3948   Int_t nGoodTracks = esd->GetNumberOfTracks();
3949   TArrayI labelArray(nGoodTracks);
3950   Int_t labelCounter = 0;
3951   for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) {
3952     AliESDtrack* track = esd->GetTrack(iTracks);
3953     if(!track) continue;
3954     
3955     Int_t label = TMath::Abs(track->GetLabel());
3956     if(IsLabelUsed(labelArray,label)) continue;
3957     labelArray.AddAt(label,labelCounter);
3958     labelCounter += 1;
3959     if(label > stack->GetNtrack()) continue;
3960
3961     TParticle *particle = stack->Particle(label);
3962     if(!particle) continue;
3963     Int_t pdgcode = particle->GetPdgCode();
3964     if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
3965     
3966     Double_t gPt = 0.0, gP = 0.0;
3967     
3968     //TPC only
3969     if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
3970       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
3971       if(!tpcTrack) continue;
3972       gPt = tpcTrack->Pt();
3973       gP = tpcTrack->P();
3974       
3975       if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
3976       if(fProtonAnalysisBase->GetEtaMode()) {
3977         if((particle->Eta() > fMaxY)|| (particle->Eta() < fMinY)) continue;
3978       }
3979       else 
3980         if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
3981       
3982       if(fUseCutsInEfficiency) {
3983         if(!fProtonAnalysisBase->IsPrimary(esd,vertex,track)) continue;
3984         if(!fProtonAnalysisBase->IsAccepted(track)) continue;
3985       }      
3986       //reconstructed primary (anti)protons
3987       if(pdgcode == 2212) {
3988         if(label <= stack->GetNprimary()) {
3989           nESDProtons += 1;
3990           if(fProtonAnalysisBase->GetEtaMode())
3991             ((TH2D *)(fEfficiencyList->At(6)))->Fill(particle->Eta(),
3992                                                      particle->Pt());
3993           else
3994             ((TH2D *)(fEfficiencyList->At(6)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
3995                                                                                    particle->Py(),
3996                                                                                    particle->Pz()),
3997                                                      particle->Pt());
3998         }//primaries
3999         if(label > stack->GetNprimary()) {
4000           Int_t lPartMother = -1;
4001           Int_t motherPDGCode = -1;
4002           lPartMother = particle->GetFirstMother();
4003           TParticle *motherParticle = stack->Particle(lPartMother);
4004           if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
4005           
4006           if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
4007             if(fProtonAnalysisBase->GetEtaMode())
4008               ((TH2D *)(fEfficiencyList->At(8)))->Fill(particle->Eta(),
4009                                                        particle->Pt());
4010             else
4011               ((TH2D *)(fEfficiencyList->At(8)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4012                                                                                      particle->Py(),
4013                                                                                      particle->Pz()),
4014                                                        particle->Pt());
4015           }//weak decays
4016           if((particle->GetUniqueID() == 13)) {
4017             if(fProtonAnalysisBase->GetEtaMode())
4018               ((TH2D *)(fEfficiencyList->At(10)))->Fill(particle->Eta(),
4019                                                         particle->Pt());
4020             else
4021               ((TH2D *)(fEfficiencyList->At(10)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4022                                                                                       particle->Py(),
4023                                                                                       particle->Pz()),
4024                                                         particle->Pt());
4025           }//hadronic interactions
4026         }//secondaries
4027       }//initial protons
4028       if(pdgcode == -2212) {    
4029         if(label <= stack->GetNprimary()) {
4030           if(fProtonAnalysisBase->GetEtaMode())
4031             ((TH2D *)(fEfficiencyList->At(7)))->Fill(particle->Eta(),
4032                                                      particle->Pt());
4033           else
4034             ((TH2D *)(fEfficiencyList->At(7)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4035                                                                                    particle->Py(),
4036                                                                                    particle->Pz()),
4037                                                      particle->Pt());
4038         }//primaries
4039         if(label > stack->GetNprimary()) {
4040           Int_t lPartMother = -1;
4041           Int_t motherPDGCode = -1;
4042           lPartMother = particle->GetFirstMother();
4043           TParticle *motherParticle = stack->Particle(lPartMother);
4044           if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
4045           
4046           if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
4047             if(fProtonAnalysisBase->GetEtaMode())
4048               ((TH2D *)(fEfficiencyList->At(9)))->Fill(particle->Eta(),
4049                                                        particle->Pt());
4050             else
4051               ((TH2D *)(fEfficiencyList->At(9)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4052                                                                                      particle->Py(),
4053                                                                                      particle->Pz()),
4054                                                        particle->Pt());
4055           }//weak decays
4056           if((particle->GetUniqueID() == 13)) {
4057             if(fProtonAnalysisBase->GetEtaMode())
4058               ((TH2D *)(fEfficiencyList->At(11)))->Fill(particle->Eta(),
4059                                                         particle->Pt());
4060             else
4061               ((TH2D *)(fEfficiencyList->At(11)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4062                                                                                       particle->Py(),
4063                                                                                       particle->Pz()),
4064                                                         particle->Pt());
4065           }//hadronic interactions
4066         }//secondaries
4067       }//initial antiprotons
4068     }//TPC only tracks
4069     else {
4070       if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
4071       if(fProtonAnalysisBase->GetEtaMode()) {
4072         if((particle->Eta() > fMaxY)|| (particle->Eta() < fMinY)) continue;
4073       }
4074       else {
4075         if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
4076       }
4077       
4078       if(fUseCutsInEfficiency) {
4079         if(!fProtonAnalysisBase->IsPrimary(esd,vertex,track)) continue;
4080         if(!fProtonAnalysisBase->IsAccepted(track)) continue;
4081       }      
4082       //reconstructed primary (anti)protons
4083       if(pdgcode == 2212) {
4084         if(label <= stack->GetNprimary()) {
4085           nESDProtons += 1;
4086           if(fProtonAnalysisBase->GetEtaMode())
4087             ((TH2D *)(fEfficiencyList->At(6)))->Fill(particle->Eta(),
4088                                                      particle->Pt());
4089           else
4090             ((TH2D *)(fEfficiencyList->At(6)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4091                                                                                    particle->Py(),
4092                                                                                    particle->Pz()),
4093                                                      particle->Pt());
4094         }//primaries
4095         if(label > stack->GetNprimary()) {
4096           Int_t lPartMother = -1;
4097           Int_t motherPDGCode = -1;
4098           lPartMother = particle->GetFirstMother();
4099           TParticle *motherParticle = stack->Particle(lPartMother);
4100           if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
4101           
4102           if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
4103             if(fProtonAnalysisBase->GetEtaMode())
4104               ((TH2D *)(fEfficiencyList->At(8)))->Fill(particle->Eta(),
4105                                                        particle->Pt());
4106             else
4107               ((TH2D *)(fEfficiencyList->At(8)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4108                                                                                      particle->Py(),
4109                                                                                      particle->Pz()),
4110                                                        particle->Pt());
4111           }//weak decays
4112           if((particle->GetUniqueID() == 13)) {
4113             if(fProtonAnalysisBase->GetEtaMode())
4114               ((TH2D *)(fEfficiencyList->At(10)))->Fill(particle->Eta(),
4115                                                         particle->Pt());
4116             else
4117               ((TH2D *)(fEfficiencyList->At(10)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4118                                                                                       particle->Py(),
4119                                                                                       particle->Pz()),
4120                                                         particle->Pt());
4121           }//hadronic interactions
4122         }//secondaries
4123       }//initial protons
4124       if(pdgcode == -2212) {    
4125         if(fProtonAnalysisBase->GetEtaMode())
4126           ((TH2D *)(fEfficiencyList->At(12)))->Fill(particle->Eta(),
4127                                                     particle->Pt());
4128         else
4129           ((TH2D *)(fEfficiencyList->At(12)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4130                                                                                   particle->Py(),
4131                                                                                   particle->Pz()),
4132                                                     particle->Pt());
4133         if(label <= stack->GetNprimary()) {
4134           if(fProtonAnalysisBase->GetEtaMode())
4135             ((TH2D *)(fEfficiencyList->At(7)))->Fill(particle->Eta(),
4136                                                      particle->Pt());
4137           else
4138             ((TH2D *)(fEfficiencyList->At(7)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4139                                                                                    particle->Py(),
4140                                                                                    particle->Pz()),
4141                                                      particle->Pt());
4142         }//primaries
4143         if(label > stack->GetNprimary()) {
4144           Int_t lPartMother = -1;
4145           Int_t motherPDGCode = -1;
4146           lPartMother = particle->GetFirstMother();
4147           TParticle *motherParticle = stack->Particle(lPartMother);
4148           if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
4149           
4150           if((particle->GetUniqueID() == 4)&&(TMath::Abs(motherPDGCode) == 3122)) {
4151             if(fProtonAnalysisBase->GetEtaMode())
4152               ((TH2D *)(fEfficiencyList->At(9)))->Fill(particle->Eta(),
4153                                                        particle->Pt());
4154             else
4155               ((TH2D *)(fEfficiencyList->At(9)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4156                                                                                      particle->Py(),
4157                                                                                      particle->Pz()),
4158                                                        particle->Pt());
4159           }//weak decays
4160           if((particle->GetUniqueID() == 13)) {
4161             if(fProtonAnalysisBase->GetEtaMode())
4162               ((TH2D *)(fEfficiencyList->At(11)))->Fill(particle->Eta(),
4163                                                         particle->Pt());
4164             else
4165               ((TH2D *)(fEfficiencyList->At(11)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4166                                                                                       particle->Py(),
4167                                                                                       particle->Pz()),
4168                                                         particle->Pt());
4169           }//hadronic interactions
4170         }//secondaries
4171       }//initial antiprotons
4172     }//global tracking
4173   }//track loop
4174   
4175   //Printf("MC protons: %d - ESD protons: %d",nMCProtons,nESDProtons);
4176 }
4177
4178 //____________________________________________________________________//
4179 Bool_t AliProtonQAAnalysis::IsLabelUsed(TArrayI labelArray, 
4180                                         Int_t label) {
4181   //Checks if the label is used already
4182   Bool_t status = kFALSE;
4183   for(Int_t i = 0; i < labelArray.GetSize(); i++) {
4184     if(labelArray.At(i) == label)
4185       status = kTRUE;
4186   }
4187
4188   return status;
4189 }
4190
4191 //____________________________________________________________________//
4192 void AliProtonQAAnalysis::RunVertexQA(AliGenEventHeader *header,
4193                                       AliESDEvent *const esd) {
4194   //Runs the vertex QA
4195   //MC vertex
4196   TArrayF primaryVertex(3);
4197   header->PrimaryVertex(primaryVertex);
4198
4199   //Int_t nPrimaries = stack->GetNprimary();
4200   ((TH1F *)(fQAVertexList->At(0)))->Fill(primaryVertex[2]);
4201
4202   //TPC vertex
4203   const AliESDVertex *vertexTPC = esd->GetPrimaryVertexTPC();
4204   if(!vertexTPC) {
4205     Printf("ERROR: Could not retrieve the TPC vertex");
4206     return;
4207   }
4208   if(vertexTPC->GetNContributors() > 0) {
4209     ((TH1F *)(fQAVertexList->At(1)))->Fill(primaryVertex[2]);
4210     ((TH2F *)(fQAVertexList->At(2)))->Fill(vertexTPC->GetXv(),
4211                                            vertexTPC->GetNContributors());
4212     ((TH2F *)(fQAVertexList->At(3)))->Fill(vertexTPC->GetYv(),
4213                                            vertexTPC->GetNContributors());
4214     ((TH2F *)(fQAVertexList->At(4)))->Fill(vertexTPC->GetZv(),
4215                                            vertexTPC->GetNContributors());
4216     ((TH1F *)(fQAVertexList->At(5)))->Fill((vertexTPC->GetXv()-primaryVertex[0])*10000.);
4217     ((TH1F *)(fQAVertexList->At(6)))->Fill((vertexTPC->GetYv()-primaryVertex[1])*10000.);
4218     ((TH1F *)(fQAVertexList->At(7)))->Fill((vertexTPC->GetZv()-primaryVertex[2])*10000.);
4219     ((TH1F *)(fQAVertexList->At(8)))->Fill(vertexTPC->GetXRes()*10000.);
4220     ((TH1F *)(fQAVertexList->At(9)))->Fill(vertexTPC->GetYRes()*10000.);
4221     ((TH1F *)(fQAVertexList->At(10)))->Fill(vertexTPC->GetZRes()*10000.);
4222   }//TPC vertex
4223
4224   //SPD vertex
4225   const AliESDVertex *vertexSPD = esd->GetPrimaryVertexSPD();
4226   if(!vertexSPD) {
4227     Printf("ERROR: Could not retrieve the SPD vertex");
4228     return;
4229   }
4230   if(vertexSPD->GetNContributors() > 0) {
4231     ((TH1F *)(fQAVertexList->At(11)))->Fill(primaryVertex[2]);
4232     ((TH2F *)(fQAVertexList->At(12)))->Fill(vertexSPD->GetXv(),
4233                                             vertexSPD->GetNContributors());
4234     ((TH2F *)(fQAVertexList->At(13)))->Fill(vertexSPD->GetYv(),
4235                                             vertexSPD->GetNContributors());
4236     ((TH2F *)(fQAVertexList->At(14)))->Fill(vertexSPD->GetZv(),
4237                                             vertexSPD->GetNContributors());
4238     ((TH1F *)(fQAVertexList->At(15)))->Fill((vertexSPD->GetXv()-primaryVertex[0])*10000.);
4239     ((TH1F *)(fQAVertexList->At(16)))->Fill((vertexSPD->GetYv()-primaryVertex[1])*10000.);
4240     ((TH1F *)(fQAVertexList->At(17)))->Fill((vertexSPD->GetZv()-primaryVertex[2])*10000.);
4241     ((TH1F *)(fQAVertexList->At(18)))->Fill(vertexSPD->GetXRes()*10000.);
4242     ((TH1F *)(fQAVertexList->At(19)))->Fill(vertexSPD->GetYRes()*10000.);
4243     ((TH1F *)(fQAVertexList->At(20)))->Fill(vertexSPD->GetZRes()*10000.);
4244   }//SPD vertex
4245   
4246   //Tracks vertex
4247   const AliESDVertex *vertexTracks = esd->GetPrimaryVertex();
4248   if(!vertexTracks) {
4249     Printf("ERROR: Could not retrieve the Tracks vertex");
4250     return;
4251   }
4252   if(vertexTracks->GetNContributors() > 0) {
4253     ((TH1F *)(fQAVertexList->At(21)))->Fill(primaryVertex[2]);
4254     ((TH2F *)(fQAVertexList->At(22)))->Fill(vertexTracks->GetXv(),
4255                                             vertexTracks->GetNContributors());
4256     ((TH2F *)(fQAVertexList->At(23)))->Fill(vertexTracks->GetYv(),
4257                                             vertexTracks->GetNContributors());
4258     ((TH2F *)(fQAVertexList->At(24)))->Fill(vertexTracks->GetZv(),
4259                                             vertexTracks->GetNContributors());
4260     ((TH1F *)(fQAVertexList->At(25)))->Fill((vertexTracks->GetXv()-primaryVertex[0])*10000.);
4261     ((TH1F *)(fQAVertexList->At(26)))->Fill((vertexTracks->GetYv()-primaryVertex[1])*10000.);
4262     ((TH1F *)(fQAVertexList->At(27)))->Fill((vertexTracks->GetZv()-primaryVertex[2])*10000.);
4263     ((TH1F *)(fQAVertexList->At(28)))->Fill(vertexTracks->GetXRes()*10000.);
4264     ((TH1F *)(fQAVertexList->At(29)))->Fill(vertexTracks->GetYRes()*10000.);
4265     ((TH1F *)(fQAVertexList->At(30)))->Fill(vertexTracks->GetZRes()*10000.);
4266   }//Tracks vertex
4267
4268 }
4269
4270 //____________________________________________________________________//
4271 void AliProtonQAAnalysis::RunQAAnalysis(AliStack *stack, 
4272                                         AliESDEvent *esd,
4273                                         const AliESDVertex *vertex) {
4274   //Runs the QA code
4275   //MC loop
4276   for(Int_t iParticle = 0; iParticle < stack->GetNprimary(); iParticle++) {
4277     TParticle *particle = stack->Particle(iParticle);
4278     if(!particle) continue;
4279
4280     if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
4281     if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
4282     if(fProtonAnalysisBase->GetEtaMode()) {
4283       if((particle->Eta() > fMaxY)||(particle->Eta() < fMinY)) continue;
4284     }
4285     else {
4286       if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
4287     }
4288     Int_t pdgcode = particle->GetPdgCode();
4289     if(pdgcode == 2212) {
4290       if(fProtonAnalysisBase->GetEtaMode())
4291         ((TH2D *)(fQA2DList->At(8)))->Fill(particle->Eta(),
4292                                            particle->Pt());
4293       else
4294         ((TH2D *)(fQA2DList->At(8)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4295                                                                          particle->Py(),
4296                                                                          particle->Pz()),
4297                                            particle->Pt());
4298     }
4299     if(pdgcode == -2212) {
4300       if(fProtonAnalysisBase->GetEtaMode())
4301         ((TH2D *)(fQA2DList->At(9)))->Fill(particle->Eta(),
4302                                            particle->Pt());
4303       else
4304         ((TH2D *)(fQA2DList->At(9)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
4305                                                                          particle->Py(),
4306                                                                          particle->Pz()),
4307                                            particle->Pt());
4308     }
4309   }//MC loop
4310
4311   Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0};
4312   //ESD track loop
4313   Int_t nGoodTracks = esd->GetNumberOfTracks();
4314   TArrayI labelArray(nGoodTracks);
4315   Int_t labelCounter = 0;
4316   for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) {
4317     AliESDtrack* track = esd->GetTrack(iTracks);
4318     if(!track) continue;
4319     
4320     Int_t label = TMath::Abs(track->GetLabel()); 
4321     if(IsLabelUsed(labelArray,label)) continue;
4322     labelArray.AddAt(label,labelCounter);
4323     labelCounter += 1;
4324     if(label > stack->GetNtrack()) continue;
4325
4326     TParticle *particle = stack->Particle(label);
4327     if(!particle) continue;
4328     if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
4329     
4330     AliESDtrack trackTPC;
4331     
4332     //in case it's a TPC only track relate it to the proper vertex
4333     //if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)&&(!fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
4334       //if((fUseTPCOnly)&&(!fUseHybridTPC)) {
4335       /*track->GetImpactParametersTPC(dca,cov);
4336       if (dca[0]==0 && dca[1]==0)  
4337         track->RelateToVertexTPC(((AliESDEvent*)esd)->GetPrimaryVertexTPC(),esd->GetMagneticField(),kVeryBig);
4338       if (!track->FillTPCOnlyTrack(trackTPC)) {
4339         continue;
4340       }
4341       track = &trackTPC ;*/
4342     //}
4343     
4344     Double_t gPt = 0.0, gP = 0.0;
4345     //Double_t probability[5];
4346     //Float_t dcaXY = 0.0, dcaZ = 0.0;
4347     Double_t nSigmaToVertex = fProtonAnalysisBase->GetSigmaToVertex(track);
4348     Int_t  fIdxInt[200];
4349     Int_t nClustersITS = track->GetITSclusters(fIdxInt);
4350     Int_t nClustersTPC = track->GetTPCclusters(fIdxInt);
4351     
4352     Float_t chi2PerClusterITS = -1;
4353     if (nClustersITS!=0)
4354       chi2PerClusterITS = track->GetITSchi2()/Float_t(nClustersITS);
4355     Float_t chi2PerClusterTPC = -1;
4356     if (nClustersTPC!=0)
4357       chi2PerClusterTPC = track->GetTPCchi2()/Float_t(nClustersTPC);
4358     Double_t chi2ConstrainVertex = TMath::Log(track->GetConstrainedChi2());    
4359     Double_t extCov[15];
4360     track->GetExternalCovariance(extCov);
4361     Int_t npointsTPCdEdx = track->GetTPCsignalN();
4362
4363     //TPC only
4364     if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
4365       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
4366       if(!tpcTrack) continue;
4367       gPt = tpcTrack->Pt();
4368       gP = tpcTrack->P();
4369       /*if(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)
4370         track->GetImpactParameters(dcaXY,dcaZ);
4371         else track->GetImpactParametersTPC(dcaXY,dcaZ);*/
4372       tpcTrack->PropagateToDCA(vertex,
4373                                esd->GetMagneticField(),
4374                                100.,dca,cov);
4375
4376       //pid
4377       if(fProtonAnalysisBase->IsProton(track)) {
4378         if(!fProtonAnalysisBase->IsInPhaseSpace(track)) continue; //track outside the analyzed y-Pt
4379
4380         FillQA(stack,esd,vertex,track);
4381         if(fProtonAnalysisBase->IsPrimary(esd,vertex,track)) {
4382           if(fProtonAnalysisBase->IsAccepted(track)) {
4383             if(label <= stack->GetNprimary()) {
4384               if(track->Charge() > 0) {
4385                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4386                   if(track->HasPointOnITSLayer(iLayer))
4387                     ((TH1F *)(fAcceptedCutList->At(0)))->Fill(iLayer+1);
4388                 }
4389                 ((TH1F *)(fAcceptedCutList->At(4)))->Fill(nClustersITS);
4390                 ((TH1F *)(fAcceptedCutList->At(8)))->Fill(chi2PerClusterITS);
4391                 ((TH1F *)(fAcceptedCutList->At(12)))->Fill(chi2ConstrainVertex);
4392                 ((TH1F *)(fAcceptedCutList->At(16)))->Fill(nClustersTPC);
4393                 ((TH1F *)(fAcceptedCutList->At(20)))->Fill(chi2PerClusterTPC);
4394                 ((TH1F *)(fAcceptedCutList->At(24)))->Fill(extCov[0]);
4395                 ((TH1F *)(fAcceptedCutList->At(28)))->Fill(extCov[2]);
4396                 ((TH1F *)(fAcceptedCutList->At(32)))->Fill(extCov[5]);
4397                 ((TH1F *)(fAcceptedCutList->At(36)))->Fill(extCov[9]);
4398                 ((TH1F *)(fAcceptedCutList->At(40)))->Fill(extCov[14]);
4399                 ((TH3D *)(fAcceptedCutList->At(44)))->Fill(tpcTrack->Eta(),
4400                                                            tpcTrack->Phi()*180./TMath::Pi(),
4401                                                            nClustersTPC);
4402                 ((TH3D *)(fAcceptedCutList->At(48)))->Fill(tpcTrack->Eta(),
4403                                                            tpcTrack->Phi()*180./TMath::Pi(),
4404                                                            chi2PerClusterTPC);
4405                 ((TH3D *)(fAcceptedCutList->At(52)))->Fill(tpcTrack->Eta(),
4406                                                            tpcTrack->Phi()*180./TMath::Pi(),
4407                                                            npointsTPCdEdx);
4408                 ((TH1D *)(fAcceptedCutList->At(56)))->Fill(npointsTPCdEdx);
4409                 
4410                 ((TH1F *)(fAcceptedDCAList->At(0)))->Fill(TMath::Abs(dca[0]));
4411                 ((TH1F *)(fAcceptedDCAList->At(4)))->Fill(TMath::Abs(dca[1]));
4412                 ((TH1F *)(fAcceptedDCAList->At(8)))->Fill(nSigmaToVertex);
4413                 ((TH3F *)(fAcceptedDCAList->At(12)))->Fill(tpcTrack->Eta(),gPt,TMath::Abs(dca[0]));
4414                 ((TH3F *)(fAcceptedDCAList->At(18)))->Fill(tpcTrack->Eta(),gPt,TMath::Abs(dca[1]));
4415                 if(fProtonAnalysisBase->GetEtaMode())
4416                   ((TH2D *)(fQA2DList->At(0)))->Fill(tpcTrack->Eta(),gPt);
4417                 else
4418                   ((TH2D *)(fQA2DList->At(0)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4419                                                                                    tpcTrack->Py(),
4420                                                                                    tpcTrack->Pz()),
4421                                                      gPt);
4422               }//accepted primary protons
4423               else if(track->Charge() < 0) {
4424                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4425                   if(track->HasPointOnITSLayer(iLayer))
4426                     ((TH1F *)(fAcceptedCutList->At(1)))->Fill(iLayer+1);
4427                 }
4428                 ((TH1F *)(fAcceptedCutList->At(5)))->Fill(nClustersITS);
4429                 ((TH1F *)(fAcceptedCutList->At(9)))->Fill(chi2PerClusterITS);
4430                 ((TH1F *)(fAcceptedCutList->At(13)))->Fill(chi2ConstrainVertex);
4431                 ((TH1F *)(fAcceptedCutList->At(17)))->Fill(nClustersTPC);
4432                 ((TH1F *)(fAcceptedCutList->At(21)))->Fill(chi2PerClusterTPC);
4433                 ((TH1F *)(fAcceptedCutList->At(25)))->Fill(extCov[0]);
4434                 ((TH1F *)(fAcceptedCutList->At(29)))->Fill(extCov[2]);
4435                 ((TH1F *)(fAcceptedCutList->At(33)))->Fill(extCov[5]);
4436                 ((TH1F *)(fAcceptedCutList->At(37)))->Fill(extCov[9]);
4437                 ((TH1F *)(fAcceptedCutList->At(41)))->Fill(extCov[14]);
4438                 ((TH3D *)(fAcceptedCutList->At(45)))->Fill(tpcTrack->Eta(),
4439                                                            tpcTrack->Phi()*180./TMath::Pi(),
4440                                                            nClustersTPC);
4441                 ((TH3D *)(fAcceptedCutList->At(49)))->Fill(tpcTrack->Eta(),
4442                                                            tpcTrack->Phi()*180./TMath::Pi(),
4443                                                            chi2PerClusterTPC);
4444                 ((TH3D *)(fAcceptedCutList->At(53)))->Fill(tpcTrack->Eta(),
4445                                                            tpcTrack->Phi()*180./TMath::Pi(),
4446                                                            npointsTPCdEdx);
4447                 ((TH1D *)(fAcceptedCutList->At(57)))->Fill(npointsTPCdEdx);
4448                 
4449                 ((TH1F *)(fAcceptedDCAList->At(1)))->Fill(TMath::Abs(dca[0]));
4450                 ((TH1F *)(fAcceptedDCAList->At(5)))->Fill(TMath::Abs(dca[1]));
4451                 ((TH1F *)(fAcceptedDCAList->At(9)))->Fill(nSigmaToVertex);
4452                 ((TH3F *)(fAcceptedDCAList->At(13)))->Fill(tpcTrack->Eta(),gPt,TMath::Abs(dca[0]));
4453                 ((TH3F *)(fAcceptedDCAList->At(19)))->Fill(tpcTrack->Eta(),gPt,TMath::Abs(dca[1]));
4454                 if(fProtonAnalysisBase->GetEtaMode())
4455                   ((TH2D *)(fQA2DList->At(4)))->Fill(tpcTrack->Eta(),gPt);
4456                 else
4457                   ((TH2D *)(fQA2DList->At(4)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4458                                                                                    tpcTrack->Py(),
4459                                                                                    tpcTrack->Pz()),
4460                                                      gPt);
4461               }//accepted primary antiprotons
4462             }//accepted primary particles
4463             else if(label > stack->GetNprimary()) {
4464               Int_t lPartMother = -1;
4465               Int_t motherPDGCode = -1;
4466               if(particle) {
4467                 lPartMother = particle->GetFirstMother();
4468                 TParticle *motherParticle = stack->Particle(lPartMother);
4469                 if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
4470               }
4471               
4472               if(fMCProcessIdFlag)
4473                 if(particle->GetUniqueID() != fMCProcessId) continue;
4474               if(fMotherParticlePDGCodeFlag)
4475                 if(TMath::Abs(motherPDGCode) != fMotherParticlePDGCode) continue;
4476               
4477               if(track->Charge() > 0) {
4478                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4479                   if(track->HasPointOnITSLayer(iLayer))
4480                     ((TH1F *)(fAcceptedCutList->At(2)))->Fill(iLayer+1);
4481                 }
4482                 ((TH1F *)(fAcceptedCutList->At(6)))->Fill(nClustersITS);
4483                 ((TH1F *)(fAcceptedCutList->At(10)))->Fill(chi2PerClusterITS);
4484                 ((TH1F *)(fAcceptedCutList->At(14)))->Fill(chi2ConstrainVertex);
4485                 ((TH1F *)(fAcceptedCutList->At(18)))->Fill(nClustersTPC);
4486                 ((TH1F *)(fAcceptedCutList->At(22)))->Fill(chi2PerClusterTPC);
4487                 ((TH1F *)(fAcceptedCutList->At(26)))->Fill(extCov[0]);
4488                 ((TH1F *)(fAcceptedCutList->At(30)))->Fill(extCov[2]);
4489                 ((TH1F *)(fAcceptedCutList->At(34)))->Fill(extCov[5]);
4490                 ((TH1F *)(fAcceptedCutList->At(38)))->Fill(extCov[9]);
4491                 ((TH1F *)(fAcceptedCutList->At(42)))->Fill(extCov[14]);
4492                 ((TH3D *)(fAcceptedCutList->At(46)))->Fill(tpcTrack->Eta(),
4493                                                            tpcTrack->Phi()*180./TMath::Pi(),
4494                                                            nClustersTPC);
4495                 ((TH3D *)(fAcceptedCutList->At(50)))->Fill(tpcTrack->Eta(),
4496                                                            tpcTrack->Phi()*180./TMath::Pi(),
4497                                                            chi2PerClusterTPC);
4498                 ((TH3D *)(fAcceptedCutList->At(54)))->Fill(tpcTrack->Eta(),
4499                                                            tpcTrack->Phi()*180./TMath::Pi(),
4500                                                            npointsTPCdEdx);
4501                 ((TH1D *)(fAcceptedCutList->At(58)))->Fill(npointsTPCdEdx);
4502                 
4503                 ((TH1F *)(fAcceptedDCAList->At(2)))->Fill(TMath::Abs(dca[0]));
4504                 ((TH1F *)(fAcceptedDCAList->At(6)))->Fill(TMath::Abs(dca[1]));
4505                 ((TH1F *)(fAcceptedDCAList->At(10)))->Fill(nSigmaToVertex);
4506                 if(particle->GetUniqueID() == 4) {
4507                   ((TH3F *)(fAcceptedDCAList->At(14)))->Fill(tpcTrack->Eta(),gPt,TMath::Abs(dca[0]));
4508                   ((TH3F *)(fAcceptedDCAList->At(20)))->Fill(tpcTrack->Eta(),gPt,TMath::Abs(dca[1]));
4509                 }
4510                 if(particle->GetUniqueID() == 13) {
4511                   ((TH3F *)(fAcceptedDCAList->At(16)))->Fill(tpcTrack->Eta(),gPt,TMath::Abs(dca[0]));
4512                   ((TH3F *)(fAcceptedDCAList->At(22)))->Fill(tpcTrack->Eta(),gPt,TMath::Abs(dca[1]));
4513                 }
4514                 if(fProtonAnalysisBase->GetEtaMode())
4515                   ((TH2D *)(fQA2DList->At(2)))->Fill(tpcTrack->Eta(),gPt);
4516                 else
4517                   ((TH2D *)(fQA2DList->At(2)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4518                                                                                    tpcTrack->Py(),
4519                                                                                    tpcTrack->Pz()),
4520                                                      gPt);
4521                 if(fProtonAnalysisBase->GetEtaMode())
4522                   ((TH3F *)(fQA2DList->At(10)))->Fill(tpcTrack->Eta(),gPt,
4523                                                       ConvertPDGToInt(motherPDGCode));
4524                 else
4525                   ((TH3F *)(fQA2DList->At(10)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4526                                                                                     tpcTrack->Py(),
4527                                                                                     tpcTrack->Pz()),
4528                                                       gPt,
4529                                                       ConvertPDGToInt(motherPDGCode));
4530               }//accepted secondary protons
4531               else if(track->Charge() < 0) {
4532                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4533                   if(track->HasPointOnITSLayer(iLayer))
4534                     ((TH1F *)(fAcceptedCutList->At(3)))->Fill(iLayer+1);
4535                 }
4536                 ((TH1F *)(fAcceptedCutList->At(7)))->Fill(nClustersITS);
4537                 ((TH1F *)(fAcceptedCutList->At(11)))->Fill(chi2PerClusterITS);
4538                 ((TH1F *)(fAcceptedCutList->At(15)))->Fill(chi2ConstrainVertex);
4539                 ((TH1F *)(fAcceptedCutList->At(19)))->Fill(nClustersTPC);
4540                 ((TH1F *)(fAcceptedCutList->At(23)))->Fill(chi2PerClusterTPC);
4541                 ((TH1F *)(fAcceptedCutList->At(27)))->Fill(extCov[0]);
4542                 ((TH1F *)(fAcceptedCutList->At(31)))->Fill(extCov[2]);
4543                 ((TH1F *)(fAcceptedCutList->At(35)))->Fill(extCov[5]);
4544                 ((TH1F *)(fAcceptedCutList->At(39)))->Fill(extCov[9]);
4545                 ((TH1F *)(fAcceptedCutList->At(43)))->Fill(extCov[14]);
4546                 ((TH3D *)(fAcceptedCutList->At(47)))->Fill(tpcTrack->Eta(),
4547                                                            tpcTrack->Phi()*180./TMath::Pi(),
4548                                                            nClustersTPC);
4549                 ((TH3D *)(fAcceptedCutList->At(51)))->Fill(tpcTrack->Eta(),
4550                                                            tpcTrack->Phi()*180./TMath::Pi(),
4551                                                            chi2PerClusterTPC);
4552                 ((TH3D *)(fAcceptedCutList->At(55)))->Fill(tpcTrack->Eta(),
4553                                                            tpcTrack->Phi()*180./TMath::Pi(),
4554                                                            npointsTPCdEdx);
4555                 ((TH1F *)(fAcceptedCutList->At(59)))->Fill(npointsTPCdEdx);
4556                 
4557                 ((TH1F *)(fAcceptedDCAList->At(3)))->Fill(TMath::Abs(dca[0]));
4558                 ((TH1F *)(fAcceptedDCAList->At(7)))->Fill(TMath::Abs(dca[1]));
4559                 ((TH1F *)(fAcceptedDCAList->At(11)))->Fill(nSigmaToVertex);
4560                 if(particle->GetUniqueID() == 4) {
4561                   ((TH3F *)(fAcceptedDCAList->At(15)))->Fill(tpcTrack->Eta(),gPt,TMath::Abs(dca[0]));
4562                   ((TH3F *)(fAcceptedDCAList->At(21)))->Fill(tpcTrack->Eta(),gPt,TMath::Abs(dca[1]));
4563                 }
4564                 if(particle->GetUniqueID() == 13) {
4565                   ((TH3F *)(fAcceptedDCAList->At(17)))->Fill(tpcTrack->Eta(),gPt,TMath::Abs(dca[0]));
4566                   ((TH3F *)(fAcceptedDCAList->At(23)))->Fill(tpcTrack->Eta(),gPt,TMath::Abs(dca[1]));
4567                 }
4568                 if(fProtonAnalysisBase->GetEtaMode())
4569                   ((TH2D *)(fQA2DList->At(6)))->Fill(tpcTrack->Eta(),gPt);
4570                 else
4571                   ((TH2D *)(fQA2DList->At(6)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4572                                                                                    tpcTrack->Py(),
4573                                                                                    tpcTrack->Pz()),
4574                                                      gPt);
4575                 if(fProtonAnalysisBase->GetEtaMode())
4576                   ((TH3F *)(fQA2DList->At(11)))->Fill(tpcTrack->Eta(),gPt,
4577                                                       ConvertPDGToInt(motherPDGCode));
4578                 else
4579                   ((TH3F *)(fQA2DList->At(11)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4580                                                                                     tpcTrack->Py(),
4581                                                                                     tpcTrack->Pz()),
4582                                                       gPt,
4583                                                       ConvertPDGToInt(motherPDGCode));
4584               }//accepted secondary antiprotons
4585             }//accepted secondary particles
4586           }//accepted - track cuts
4587         }//primary-like cut
4588         else {
4589           if(label <= stack->GetNprimary()) {
4590             if(track->Charge() > 0) {
4591               ((TH3D *)(fRejectedCutList->At(0)))->Fill(tpcTrack->Eta(),
4592                                                         tpcTrack->Phi()*180./TMath::Pi(),
4593                                                         nClustersTPC);
4594               ((TH3D *)(fRejectedCutList->At(4)))->Fill(tpcTrack->Eta(),
4595                                                         tpcTrack->Phi()*180./TMath::Pi(),
4596                                                         chi2PerClusterTPC);
4597               ((TH3D *)(fRejectedCutList->At(8)))->Fill(tpcTrack->Eta(),
4598                                                         tpcTrack->Phi()*180./TMath::Pi(),
4599                                                         npointsTPCdEdx);
4600               
4601               if(fProtonAnalysisBase->GetEtaMode())
4602                 ((TH2D *)(fQA2DList->At(1)))->Fill(tpcTrack->Eta(),gPt);
4603               else
4604                 ((TH2D *)(fQA2DList->At(1)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4605                                                                                  tpcTrack->Py(),
4606                                                                                  tpcTrack->Pz()),
4607                                                    gPt);
4608             }
4609             else if(track->Charge() < 0) {
4610               ((TH3D *)(fRejectedCutList->At(1)))->Fill(tpcTrack->Eta(),
4611                                                         tpcTrack->Phi()*180./TMath::Pi(),
4612                                                         nClustersTPC);
4613               ((TH3D *)(fRejectedCutList->At(5)))->Fill(tpcTrack->Eta(),
4614                                                         tpcTrack->Phi()*180./TMath::Pi(),
4615                                                         chi2PerClusterTPC);
4616               ((TH3D *)(fRejectedCutList->At(9)))->Fill(tpcTrack->Eta(),
4617                                                         tpcTrack->Phi()*180./TMath::Pi(),
4618                                                         npointsTPCdEdx);
4619               if(fProtonAnalysisBase->GetEtaMode())
4620                 ((TH2D *)(fQA2DList->At(5)))->Fill(tpcTrack->Eta(),gPt);
4621               else
4622                 ((TH2D *)(fQA2DList->At(5)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4623                                                             tpcTrack->Py(),
4624                                                             tpcTrack->Pz()),
4625                                                    gPt);
4626             }
4627           }//rejected primary particles
4628           else if(label > stack->GetNprimary()) {
4629             if(track->Charge() > 0) {
4630               ((TH3D *)(fRejectedCutList->At(2)))->Fill(tpcTrack->Eta(),
4631                                                         tpcTrack->Phi()*180./TMath::Pi(),
4632                                                         nClustersTPC);
4633               ((TH3D *)(fRejectedCutList->At(6)))->Fill(tpcTrack->Eta(),
4634                                                         tpcTrack->Phi()*180./TMath::Pi(),
4635                                                         chi2PerClusterTPC);
4636               ((TH3D *)(fRejectedCutList->At(10)))->Fill(tpcTrack->Eta(),
4637                                                          tpcTrack->Phi()*180./TMath::Pi(),
4638                                                          npointsTPCdEdx);
4639               if(fProtonAnalysisBase->GetEtaMode())
4640                 ((TH2D *)(fQA2DList->At(3)))->Fill(tpcTrack->Eta(),gPt);
4641               else
4642                 ((TH2D *)(fQA2DList->At(3)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4643                                                             tpcTrack->Py(),
4644                                                             tpcTrack->Pz()),
4645                                                    gPt);
4646             }
4647             else if(track->Charge() < 0) {
4648               ((TH3D *)(fRejectedCutList->At(3)))->Fill(tpcTrack->Eta(),
4649                                                         tpcTrack->Phi()*180./TMath::Pi(),
4650                                                         nClustersTPC);
4651               ((TH3D *)(fRejectedCutList->At(7)))->Fill(tpcTrack->Eta(),
4652                                                         tpcTrack->Phi()*180./TMath::Pi(),
4653                                                         chi2PerClusterTPC);
4654               ((TH3D *)(fRejectedCutList->At(11)))->Fill(tpcTrack->Eta(),
4655                                                          tpcTrack->Phi()*180./TMath::Pi(),
4656                                                          npointsTPCdEdx);
4657
4658               if(fProtonAnalysisBase->GetEtaMode())
4659                 ((TH2D *)(fQA2DList->At(7)))->Fill(tpcTrack->Eta(),gPt);
4660               else
4661                 ((TH2D *)(fQA2DList->At(7)))->Fill(fProtonAnalysisBase->Rapidity(tpcTrack->Px(),
4662                                                             tpcTrack->Py(),
4663                                                             tpcTrack->Pz()),
4664                                                    gPt);
4665             }
4666           }//rejected secondary particles
4667         }//rejected - track cuts
4668       }//proton check
4669     }//TPC only tracks
4670     //combined tracking
4671     else {
4672       gPt = track->Pt();
4673       gP = track->P();
4674       track->PropagateToDCA(vertex,
4675                                esd->GetMagneticField(),
4676                                100.,dca,cov);
4677       
4678       //pid
4679       if(fProtonAnalysisBase->IsProton(track)) {
4680         if(!fProtonAnalysisBase->IsInPhaseSpace(track)) continue; //track outside the analyzed y-Pt
4681
4682         FillQA(stack,esd,vertex,track);
4683         if(fProtonAnalysisBase->IsPrimary(esd,vertex,track)) {
4684           if(fProtonAnalysisBase->IsAccepted(track)) {
4685             if(label <= stack->GetNprimary()) {
4686               if(track->Charge() > 0) {
4687                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4688                   if(track->HasPointOnITSLayer(iLayer))
4689                     ((TH1F *)(fAcceptedCutList->At(0)))->Fill(iLayer+1);
4690                 }
4691                 ((TH1F *)(fAcceptedCutList->At(4)))->Fill(nClustersITS);
4692                 ((TH1F *)(fAcceptedCutList->At(8)))->Fill(chi2PerClusterITS);
4693                 ((TH1F *)(fAcceptedCutList->At(12)))->Fill(chi2ConstrainVertex);
4694                 ((TH1F *)(fAcceptedCutList->At(16)))->Fill(nClustersTPC);
4695                 ((TH1F *)(fAcceptedCutList->At(20)))->Fill(chi2PerClusterTPC);
4696                 ((TH1F *)(fAcceptedCutList->At(24)))->Fill(extCov[0]);
4697                 ((TH1F *)(fAcceptedCutList->At(28)))->Fill(extCov[2]);
4698                 ((TH1F *)(fAcceptedCutList->At(32)))->Fill(extCov[5]);
4699                 ((TH1F *)(fAcceptedCutList->At(36)))->Fill(extCov[9]);
4700                 ((TH1F *)(fAcceptedCutList->At(40)))->Fill(extCov[14]);
4701                 ((TH3D *)(fAcceptedCutList->At(44)))->Fill(track->Eta(),
4702                                                            track->Phi()*180./TMath::Pi(),
4703                                                            nClustersTPC);
4704                 ((TH3D *)(fAcceptedCutList->At(48)))->Fill(track->Eta(),
4705                                                            track->Phi()*180./TMath::Pi(),
4706                                                            chi2PerClusterTPC);
4707                 ((TH3D *)(fAcceptedCutList->At(52)))->Fill(track->Eta(),
4708                                                            track->Phi()*180./TMath::Pi(),
4709                                                            npointsTPCdEdx);
4710                 ((TH1F *)(fAcceptedCutList->At(56)))->Fill(npointsTPCdEdx);
4711                 
4712                 ((TH1F *)(fAcceptedDCAList->At(0)))->Fill(TMath::Abs(dca[0]));
4713                 ((TH1F *)(fAcceptedDCAList->At(4)))->Fill(TMath::Abs(dca[1]));
4714                 ((TH1F *)(fAcceptedDCAList->At(8)))->Fill(nSigmaToVertex);
4715                 ((TH3F *)(fAcceptedDCAList->At(12)))->Fill(track->Eta(),gPt,TMath::Abs(dca[0]));
4716                 ((TH3F *)(fAcceptedDCAList->At(18)))->Fill(track->Eta(),gPt,TMath::Abs(dca[0]));
4717                 if(fProtonAnalysisBase->GetEtaMode())
4718                   ((TH2D *)(fQA2DList->At(0)))->Fill(track->Eta(),gPt);
4719                 else
4720                   ((TH2D *)(fQA2DList->At(0)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4721                                                                                    track->Py(),
4722                                                                                    track->Pz()),
4723                                                      gPt);
4724               }
4725               else if(track->Charge() < 0) {
4726                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4727                   if(track->HasPointOnITSLayer(iLayer))
4728                     ((TH1F *)(fAcceptedCutList->At(1)))->Fill(iLayer+1);
4729                 }
4730                 ((TH1F *)(fAcceptedCutList->At(5)))->Fill(nClustersITS);
4731                 ((TH1F *)(fAcceptedCutList->At(9)))->Fill(chi2PerClusterITS);
4732                 ((TH1F *)(fAcceptedCutList->At(13)))->Fill(chi2ConstrainVertex);
4733                 ((TH1F *)(fAcceptedCutList->At(17)))->Fill(nClustersTPC);
4734                 ((TH1F *)(fAcceptedCutList->At(21)))->Fill(chi2PerClusterTPC);
4735                 ((TH1F *)(fAcceptedCutList->At(25)))->Fill(extCov[0]);
4736                 ((TH1F *)(fAcceptedCutList->At(29)))->Fill(extCov[2]);
4737                 ((TH1F *)(fAcceptedCutList->At(33)))->Fill(extCov[5]);
4738                 ((TH1F *)(fAcceptedCutList->At(37)))->Fill(extCov[9]);
4739                 ((TH1F *)(fAcceptedCutList->At(41)))->Fill(extCov[14]);
4740                 ((TH3D *)(fAcceptedCutList->At(45)))->Fill(track->Eta(),
4741                                                            track->Phi()*180./TMath::Pi(),
4742                                                            nClustersTPC);
4743                 ((TH3D *)(fAcceptedCutList->At(49)))->Fill(track->Eta(),
4744                                                            track->Phi()*180./TMath::Pi(),
4745                                                            chi2PerClusterTPC);
4746                 ((TH3D *)(fAcceptedCutList->At(53)))->Fill(track->Eta(),
4747                                                            track->Phi()*180./TMath::Pi(),
4748                                                            npointsTPCdEdx);
4749                 ((TH1F *)(fAcceptedCutList->At(57)))->Fill(npointsTPCdEdx);
4750                 
4751                 ((TH1F *)(fAcceptedDCAList->At(1)))->Fill(TMath::Abs(dca[0]));
4752                 ((TH1F *)(fAcceptedDCAList->At(5)))->Fill(TMath::Abs(dca[1]));
4753                 ((TH1F *)(fAcceptedDCAList->At(9)))->Fill(nSigmaToVertex);
4754                 ((TH3F *)(fAcceptedDCAList->At(13)))->Fill(track->Eta(),gPt,TMath::Abs(dca[0]));
4755                 ((TH3F *)(fAcceptedDCAList->At(19)))->Fill(track->Eta(),gPt,TMath::Abs(dca[0]));
4756                 if(fProtonAnalysisBase->GetEtaMode())
4757                   ((TH2D *)(fQA2DList->At(4)))->Fill(track->Eta(),gPt);
4758                 else
4759                   ((TH2D *)(fQA2DList->At(4)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4760                                                                                    track->Py(),
4761                                                                                    track->Pz()),
4762                                                      gPt);
4763               }
4764             }//primary particles
4765             else if(label > stack->GetNprimary()) {
4766               Int_t lPartMother = -1;
4767               Int_t motherPDGCode = -1;
4768               if(particle) {
4769                 lPartMother = particle->GetFirstMother();
4770                 TParticle *motherParticle = stack->Particle(lPartMother);
4771                 if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
4772               }
4773               
4774               if(fMCProcessIdFlag)
4775                 if(particle->GetUniqueID() != fMCProcessId) continue;
4776               if(fMotherParticlePDGCodeFlag)
4777                 if(TMath::Abs(motherPDGCode) != fMotherParticlePDGCode) continue;
4778               
4779               if(track->Charge() > 0) {
4780                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4781                   if(track->HasPointOnITSLayer(iLayer))
4782                     ((TH1F *)(fAcceptedCutList->At(2)))->Fill(iLayer+1);
4783                 }
4784                 ((TH1F *)(fAcceptedCutList->At(6)))->Fill(nClustersITS);
4785                 ((TH1F *)(fAcceptedCutList->At(10)))->Fill(chi2PerClusterITS);
4786                 ((TH1F *)(fAcceptedCutList->At(14)))->Fill(chi2ConstrainVertex);
4787                 ((TH1F *)(fAcceptedCutList->At(18)))->Fill(nClustersTPC);
4788                 ((TH1F *)(fAcceptedCutList->At(22)))->Fill(chi2PerClusterTPC);
4789                 ((TH1F *)(fAcceptedCutList->At(26)))->Fill(extCov[0]);
4790                 ((TH1F *)(fAcceptedCutList->At(30)))->Fill(extCov[2]);
4791                 ((TH1F *)(fAcceptedCutList->At(34)))->Fill(extCov[5]);
4792                 ((TH1F *)(fAcceptedCutList->At(38)))->Fill(extCov[9]);
4793                 ((TH1F *)(fAcceptedCutList->At(42)))->Fill(extCov[14]);
4794                 ((TH3D *)(fAcceptedCutList->At(46)))->Fill(track->Eta(),
4795                                                            track->Phi()*180./TMath::Pi(),
4796                                                            nClustersTPC);
4797                 ((TH3D *)(fAcceptedCutList->At(50)))->Fill(track->Eta(),
4798                                                            track->Phi()*180./TMath::Pi(),
4799                                                            chi2PerClusterTPC);
4800                 ((TH3D *)(fAcceptedCutList->At(54)))->Fill(track->Eta(),
4801                                                            track->Phi()*180./TMath::Pi(),
4802                                                            npointsTPCdEdx);
4803                 ((TH1F *)(fAcceptedCutList->At(58)))->Fill(npointsTPCdEdx);
4804                 
4805                 ((TH1F *)(fAcceptedDCAList->At(2)))->Fill(TMath::Abs(dca[0]));
4806                 ((TH1F *)(fAcceptedDCAList->At(6)))->Fill(TMath::Abs(dca[1]));
4807                 ((TH1F *)(fAcceptedDCAList->At(10)))->Fill(nSigmaToVertex);
4808                 if(particle->GetUniqueID() == 4) {
4809                   ((TH3F *)(fAcceptedDCAList->At(14)))->Fill(track->Eta(),gPt,TMath::Abs(dca[0]));
4810                   ((TH3F *)(fAcceptedDCAList->At(20)))->Fill(track->Eta(),gPt,TMath::Abs(dca[1]));
4811                 }
4812                 if(particle->GetUniqueID() == 13) {
4813                   ((TH3F *)(fAcceptedDCAList->At(16)))->Fill(track->Eta(),gPt,TMath::Abs(dca[0]));
4814                   ((TH3F *)(fAcceptedDCAList->At(22)))->Fill(track->Eta(),gPt,TMath::Abs(dca[1]));
4815                 }
4816                 if(fProtonAnalysisBase->GetEtaMode())
4817                   ((TH2D *)(fQA2DList->At(2)))->Fill(track->Eta(),gPt);
4818                 else
4819                   ((TH2D *)(fQA2DList->At(2)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4820                                                                                    track->Py(),
4821                                                                                    track->Pz()),
4822                                                      gPt);
4823                 if(fProtonAnalysisBase->GetEtaMode())
4824                   ((TH3F *)(fQA2DList->At(10)))->Fill(track->Eta(),gPt,
4825                                                       ConvertPDGToInt(motherPDGCode));
4826                 else
4827                   ((TH3F *)(fQA2DList->At(10)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4828                                                                                     track->Py(),
4829                                                                                     track->Pz()),
4830                                                       gPt,
4831                                                       ConvertPDGToInt(motherPDGCode));
4832               }
4833               else if(track->Charge() < 0) {
4834                 for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
4835                   if(track->HasPointOnITSLayer(iLayer))
4836                     ((TH1F *)(fAcceptedCutList->At(3)))->Fill(iLayer+1);
4837                 }
4838                 ((TH1F *)(fAcceptedCutList->At(7)))->Fill(nClustersITS);
4839                 ((TH1F *)(fAcceptedCutList->At(11)))->Fill(chi2PerClusterITS);
4840                 ((TH1F *)(fAcceptedCutList->At(15)))->Fill(chi2ConstrainVertex);
4841                 ((TH1F *)(fAcceptedCutList->At(19)))->Fill(nClustersTPC);
4842                 ((TH1F *)(fAcceptedCutList->At(23)))->Fill(chi2PerClusterTPC);
4843                 ((TH1F *)(fAcceptedCutList->At(27)))->Fill(extCov[0]);
4844                 ((TH1F *)(fAcceptedCutList->At(31)))->Fill(extCov[2]);
4845                 ((TH1F *)(fAcceptedCutList->At(35)))->Fill(extCov[5]);
4846                 ((TH1F *)(fAcceptedCutList->At(39)))->Fill(extCov[9]);
4847                 ((TH1F *)(fAcceptedCutList->At(43)))->Fill(extCov[14]);
4848                 ((TH3D *)(fAcceptedCutList->At(47)))->Fill(track->Eta(),
4849                                                            track->Phi()*180./TMath::Pi(),
4850                                                            nClustersTPC);
4851                 ((TH3D *)(fAcceptedCutList->At(51)))->Fill(track->Eta(),
4852                                                            track->Phi()*180./TMath::Pi(),
4853                                                            chi2PerClusterTPC);
4854                 ((TH3D *)(fAcceptedCutList->At(55)))->Fill(track->Eta(),
4855                                                            track->Phi()*180./TMath::Pi(),
4856                                                            npointsTPCdEdx);
4857                 ((TH1F *)(fAcceptedCutList->At(59)))->Fill(npointsTPCdEdx);
4858                 
4859                 ((TH1F *)(fAcceptedDCAList->At(3)))->Fill(TMath::Abs(dca[0]));
4860                 ((TH1F *)(fAcceptedDCAList->At(7)))->Fill(TMath::Abs(dca[1]));
4861                 ((TH1F *)(fAcceptedDCAList->At(11)))->Fill(nSigmaToVertex);
4862                 if(particle->GetUniqueID() == 4) {
4863                   ((TH3F *)(fAcceptedDCAList->At(15)))->Fill(track->Eta(),gPt,TMath::Abs(dca[0]));
4864                   ((TH3F *)(fAcceptedDCAList->At(21)))->Fill(track->Eta(),gPt,TMath::Abs(dca[1]));
4865                 }
4866                 if(particle->GetUniqueID() == 13) {
4867                   ((TH3F *)(fAcceptedDCAList->At(17)))->Fill(track->Eta(),gPt,TMath::Abs(dca[0]));
4868                   ((TH3F *)(fAcceptedDCAList->At(23)))->Fill(track->Eta(),gPt,TMath::Abs(dca[1]));
4869                 }
4870                 if(fProtonAnalysisBase->GetEtaMode())
4871                   ((TH2D *)(fQA2DList->At(6)))->Fill(track->Eta(),gPt);
4872                 else
4873                   ((TH2D *)(fQA2DList->At(6)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4874                                                                                    track->Py(),
4875                                                                                    track->Pz()),
4876                                                      gPt);
4877                 if(fProtonAnalysisBase->GetEtaMode())
4878                   ((TH3F *)(fQA2DList->At(11)))->Fill(track->Eta(),gPt,
4879                                                       ConvertPDGToInt(motherPDGCode));
4880                 else
4881                   ((TH3F *)(fQA2DList->At(11)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4882                                                                                     track->Py(),
4883                                                                                     track->Pz()),
4884                                                       gPt,
4885                                                       ConvertPDGToInt(motherPDGCode));
4886               }
4887             }//secondary particles
4888           }//accepted - track cuts
4889         }//primary-like cut
4890         else if((!fProtonAnalysisBase->IsAccepted(track)) || 
4891                 (!fProtonAnalysisBase->IsPrimary(esd,vertex,track))) {
4892           if(label <= stack->GetNprimary()) {
4893             if(track->Charge() > 0) {
4894               ((TH3D *)(fRejectedCutList->At(0)))->Fill(track->Eta(),
4895                                                         track->Phi()*180./TMath::Pi(),
4896                                                         nClustersTPC);
4897               ((TH3D *)(fRejectedCutList->At(4)))->Fill(track->Eta(),
4898                                                         track->Phi()*180./TMath::Pi(),
4899                                                         chi2PerClusterTPC);
4900               ((TH3D *)(fRejectedCutList->At(8)))->Fill(track->Eta(),
4901                                                         track->Phi()*180./TMath::Pi(),
4902                                                         npointsTPCdEdx);
4903               if(fProtonAnalysisBase->GetEtaMode())
4904                 ((TH2D *)(fQA2DList->At(1)))->Fill(track->Eta(),gPt);
4905               else
4906                 ((TH2D *)(fQA2DList->At(1)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4907                                                             track->Py(),
4908                                                             track->Pz()),
4909                                                    gPt);
4910             }
4911             else if(track->Charge() < 0) {
4912               ((TH3D *)(fRejectedCutList->At(1)))->Fill(track->Eta(),
4913                                                         track->Phi()*180./TMath::Pi(),
4914                                                         nClustersTPC);
4915               ((TH3D *)(fRejectedCutList->At(5)))->Fill(track->Eta(),
4916                                                         track->Phi()*180./TMath::Pi(),
4917                                                         chi2PerClusterTPC);
4918               ((TH3D *)(fRejectedCutList->At(9)))->Fill(track->Eta(),
4919                                                         track->Phi()*180./TMath::Pi(),
4920                                                         npointsTPCdEdx);
4921                                                 
4922               if(fProtonAnalysisBase->GetEtaMode())
4923                 ((TH2D *)(fQA2DList->At(5)))->Fill(track->Eta(),gPt);
4924               else
4925                 ((TH2D *)(fQA2DList->At(5)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4926                                                             track->Py(),
4927                                                             track->Pz()),
4928                                                    gPt);
4929             }
4930           }//primary particles
4931           else if(label > stack->GetNprimary()) {
4932             if(track->Charge() > 0) {
4933               ((TH3D *)(fRejectedCutList->At(2)))->Fill(track->Eta(),
4934                                                         track->Phi()*180./TMath::Pi(),
4935                                                         nClustersTPC);
4936               ((TH3D *)(fRejectedCutList->At(6)))->Fill(track->Eta(),
4937                                                         track->Phi()*180./TMath::Pi(),
4938                                                         chi2PerClusterTPC);
4939               ((TH3D *)(fRejectedCutList->At(10)))->Fill(track->Eta(),
4940                                                         track->Phi()*180./TMath::Pi(),
4941                                                         npointsTPCdEdx);
4942               if(fProtonAnalysisBase->GetEtaMode())
4943                 ((TH2D *)(fQA2DList->At(3)))->Fill(track->Eta(),gPt);
4944               else
4945                 ((TH2D *)(fQA2DList->At(3)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4946                                                             track->Py(),
4947                                                             track->Pz()),
4948                                                    gPt);
4949             }
4950             else if(track->Charge() < 0) {
4951               ((TH3D *)(fRejectedCutList->At(3)))->Fill(track->Eta(),
4952                                                         track->Phi()*180./TMath::Pi(),
4953                                                         nClustersTPC);
4954               ((TH3D *)(fRejectedCutList->At(7)))->Fill(track->Eta(),
4955                                                         track->Phi()*180./TMath::Pi(),
4956                                                         chi2PerClusterTPC);
4957               ((TH3D *)(fRejectedCutList->At(11)))->Fill(track->Eta(),
4958                                                         track->Phi()*180./TMath::Pi(),
4959                                                         npointsTPCdEdx);
4960               if(fProtonAnalysisBase->GetEtaMode())
4961                 ((TH2D *)(fQA2DList->At(7)))->Fill(track->Eta(),gPt);
4962               else
4963                 ((TH2D *)(fQA2DList->At(7)))->Fill(fProtonAnalysisBase->Rapidity(track->Px(),
4964                                                             track->Py(),
4965                                                             track->Pz()),
4966                                                    gPt);
4967             }
4968           }//secondary particles
4969         }//rejected - track cuts
4970       }//proton check
4971     }//combined tracking
4972   }//track loop
4973     
4974 }
4975
4976 //____________________________________________________________________//
4977 void AliProtonQAAnalysis::InitMCAnalysis() {
4978   //MC analysis - 3D histograms: y-pT-pdg
4979   fPDGList = new TList();
4980   TH3F *gHistYPtPDGProtons = 0x0;
4981   if(fUseAsymmetricBinning) {
4982     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};
4983   gHistYPtPDGProtons = new TH3F("gHistYPtPDGProtons",
4984                                 ";;P_{T} [GeV/c];PDG",
4985                                 fNBinsY,fY,fNBinsPt,fPt,14,gPDG);
4986   }
4987   else
4988     gHistYPtPDGProtons = new TH3F("gHistYPtPDGProtons",
4989                                   ";;P_{T} [GeV/c];PDG",
4990                                   fNBinsY,fMinY,fMaxY,
4991                                   fNBinsPt,fMinPt,fMaxPt,
4992                                   14,-0.5,13.5);
4993   if(fProtonAnalysisBase->GetEtaMode()) 
4994     gHistYPtPDGProtons->GetXaxis()->SetTitle("#eta");
4995   else 
4996     gHistYPtPDGProtons->GetXaxis()->SetTitle("y");
4997   fPDGList->Add(gHistYPtPDGProtons);
4998   TH3F *gHistYPtPDGAntiProtons = 0x0;
4999   if(fUseAsymmetricBinning) {
5000     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};
5001     gHistYPtPDGAntiProtons = new TH3F("gHistYPtPDGAntiProtons",
5002                                       ";;P_{T} [GeV/c];PDG",
5003                                       fNBinsY,fY,fNBinsPt,fPt,14,gPDG);
5004   }
5005   else
5006     gHistYPtPDGAntiProtons = new TH3F("gHistYPtPDGAntiProtons",
5007                                       ";;P_{T} [GeV/c];PDG",
5008                                       fNBinsY,fMinY,fMaxY,
5009                                       fNBinsPt,fMinPt,fMaxPt,
5010                                       14,-0.5,13.5);
5011   if(fProtonAnalysisBase->GetEtaMode()) 
5012     gHistYPtPDGAntiProtons->GetXaxis()->SetTitle("#eta");
5013   else 
5014     gHistYPtPDGAntiProtons->GetXaxis()->SetTitle("y");
5015   fPDGList->Add(gHistYPtPDGAntiProtons);
5016
5017   //MC processes
5018   fMCProcessesList = new TList();
5019   TH1F *gHistProtonsFromKLProcess = new TH1F("gHistProtonsFromKLProcess","",51,-0.5,50.5);
5020   fMCProcessesList->Add(gHistProtonsFromKLProcess);
5021   TH1F *gHistProtonsFromPionProcess = new TH1F("gHistProtonsFromPionProcess","",51,-0.5,50.5);
5022   fMCProcessesList->Add(gHistProtonsFromPionProcess);
5023   TH1F *gHistProtonsFromKSProcess = new TH1F("gHistProtonsFromKSProcess","",51,-0.5,50.5);
5024   fMCProcessesList->Add(gHistProtonsFromKSProcess);
5025   TH1F *gHistProtonsFromKaonProcess = new TH1F("gHistProtonsFromKaonProcess","",51,-0.5,50.5);
5026   fMCProcessesList->Add(gHistProtonsFromKaonProcess);
5027   TH1F *gHistProtonsFromNeutronProcess = new TH1F("gHistProtonsFromNeutronProcess","",51,-0.5,50.5);
5028   fMCProcessesList->Add(gHistProtonsFromNeutronProcess);
5029   TH1F *gHistProtonsFromProtonProcess = new TH1F("gHistProtonsFromProtonProcess","",51,-0.5,50.5);
5030   fMCProcessesList->Add(gHistProtonsFromProtonProcess);
5031   TH1F *gHistProtonsFromSigmaMinusProcess = new TH1F("gHistProtonsFromSigmaMinusProcess","",51,-0.5,50.5);
5032   fMCProcessesList->Add(gHistProtonsFromSigmaMinusProcess);
5033   TH1F *gHistProtonsFromLambda0Process = new TH1F("gHistProtonsFromLambda0Process","",51,-0.5,50.5);
5034   fMCProcessesList->Add(gHistProtonsFromLambda0Process);
5035   TH1F *gHistProtonsFromSigmaPlusProcess = new TH1F("gHistProtonsFromSigmaPlusProcess","",51,-0.5,50.5);
5036   fMCProcessesList->Add(gHistProtonsFromSigmaPlusProcess);
5037   TH1F *gHistProtonsFromXiMinusProcess = new TH1F("gHistProtonsFromXiMinusProcess","",51,-0.5,50.5);
5038   fMCProcessesList->Add(gHistProtonsFromXiMinusProcess);
5039   TH1F *gHistProtonsFromXi0Process = new TH1F("gHistProtonsFromXi0Process","",51,-0.5,50.5);                                        
5040   fMCProcessesList->Add(gHistProtonsFromXi0Process);
5041   TH1F *gHistProtonsFromOmegaProcess = new TH1F("gHistProtonsFromOmegaProcess","",51,-0.5,50.5); 
5042   fMCProcessesList->Add(gHistProtonsFromOmegaProcess);
5043
5044   TH1F *gHistAntiProtonsFromKLProcess = new TH1F("gHistAntiProtonsFromKLProcess","",51,-0.5,50.5); 
5045   fMCProcessesList->Add(gHistAntiProtonsFromKLProcess);
5046   TH1F *gHistAntiProtonsFromPionProcess = new TH1F("gHistAntiProtonsFromPionProcess","",51,-0.5,50.5); 
5047   fMCProcessesList->Add(gHistAntiProtonsFromPionProcess);
5048   TH1F *gHistAntiProtonsFromKSProcess = new TH1F("gHistAntiProtonsFromKSProcess","",51,-0.5,50.5); 
5049   fMCProcessesList->Add(gHistAntiProtonsFromKSProcess);
5050   TH1F *gHistAntiProtonsFromKaonProcess = new TH1F("gHistAntiProtonsFromKaonProcess","",51,-0.5,50.5); 
5051   fMCProcessesList->Add(gHistAntiProtonsFromKaonProcess);
5052   TH1F *gHistAntiProtonsFromNeutronProcess = new TH1F("gHistAntiProtonsFromNeutronProcess","",51,-0.5,50.5); 
5053   fMCProcessesList->Add(gHistAntiProtonsFromNeutronProcess);
5054   TH1F *gHistAntiProtonsFromProtonProcess = new TH1F("gHistAntiProtonsFromProtonProcess","",51,-0.5,50.5); 
5055   fMCProcessesList->Add(gHistAntiProtonsFromProtonProcess);
5056   TH1F *gHistAntiProtonsFromLambda0Process = new TH1F("gHistAntiProtonsFromLambda0Process","",51,-0.5,50.5); 
5057   fMCProcessesList->Add(gHistAntiProtonsFromLambda0Process);
5058   TH1F *gHistAntiProtonsFromSigmaPlusProcess = new TH1F("gHistAntiProtonsFromSigmaPlusProcess","",51,-0.5,50.5); 
5059   fMCProcessesList->Add(gHistAntiProtonsFromSigmaPlusProcess);
5060 }
5061
5062 //____________________________________________________________________//
5063 void AliProtonQAAnalysis::RunMCAnalysis(AliStack* const stack) {
5064   //Main analysis part - MC 
5065   for(Int_t iParticle = 0; iParticle < stack->GetNtrack(); iParticle++) {
5066     TParticle *particle = stack->Particle(iParticle);
5067     if(!particle) continue;
5068
5069     if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
5070     if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
5071     if(fProtonAnalysisBase->GetEtaMode()) {
5072       if((particle->Eta() > fMaxY)||(particle->Eta() < fMinY)) continue;
5073     }
5074     else {
5075       if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
5076     }
5077
5078     Int_t pdgcode = particle->GetPdgCode();
5079     if(pdgcode == 2212) {
5080       if(iParticle <= stack->GetNprimary()) {
5081         if(fProtonAnalysisBase->GetEtaMode())
5082           ((TH3F *)(fPDGList->At(0)))->Fill(particle->Eta(),particle->Pt(),0);
5083         else
5084           ((TH3F *)(fPDGList->At(0)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
5085                                                      particle->Py(),
5086                                                      particle->Pz()),
5087                                             particle->Pt(),0);
5088       }
5089       else if(iParticle > stack->GetNprimary()) {
5090         Int_t lPartMother = particle->GetFirstMother();
5091         TParticle *motherParticle = stack->Particle(lPartMother);
5092         if(!motherParticle) continue;
5093         Int_t motherPDGCode = motherParticle->GetPdgCode();
5094         if(fMCProcessIdFlag)
5095           if(particle->GetUniqueID() != fMCProcessId) continue;
5096         if(fMotherParticlePDGCodeFlag)
5097           if(TMath::Abs(motherPDGCode) != fMotherParticlePDGCode) continue;
5098
5099         if(fProtonAnalysisBase->GetEtaMode())
5100           ((TH3F *)(fPDGList->At(0)))->Fill(particle->Eta(),
5101                                             particle->Pt(),
5102                                             ConvertPDGToInt(motherParticle->GetPdgCode()));
5103         else
5104           ((TH3F *)(fPDGList->At(0)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
5105                                                      particle->Py(),
5106                                                      particle->Pz()),
5107                                             particle->Pt(),
5108                                             ConvertPDGToInt(motherParticle->GetPdgCode()));
5109         //processes
5110         if(TMath::Abs(motherParticle->GetPdgCode()) == 130)
5111           ((TH1F *)(fMCProcessesList->At(0)))->Fill(particle->GetUniqueID());
5112         if(TMath::Abs(motherParticle->GetPdgCode()) == 211)
5113           ((TH1F *)(fMCProcessesList->At(1)))->Fill(particle->GetUniqueID());
5114         if(TMath::Abs(motherParticle->GetPdgCode()) == 310)
5115           ((TH1F *)(fMCProcessesList->At(2)))->Fill(particle->GetUniqueID());
5116         if(TMath::Abs(motherParticle->GetPdgCode()) == 321)
5117           ((TH1F *)(fMCProcessesList->At(3)))->Fill(particle->GetUniqueID());
5118         if(TMath::Abs(motherParticle->GetPdgCode()) == 2112)
5119           ((TH1F *)(fMCProcessesList->At(4)))->Fill(particle->GetUniqueID());
5120         if(TMath::Abs(motherParticle->GetPdgCode()) == 2212)
5121           ((TH1F *)(fMCProcessesList->At(5)))->Fill(particle->GetUniqueID());
5122         if(TMath::Abs(motherParticle->GetPdgCode()) == 3112)
5123           ((TH1F *)(fMCProcessesList->At(6)))->Fill(particle->GetUniqueID());
5124         if(TMath::Abs(motherParticle->GetPdgCode()) == 3122)
5125           ((TH1F *)(fMCProcessesList->At(7)))->Fill(particle->GetUniqueID());
5126         if(TMath::Abs(motherParticle->GetPdgCode()) == 3222)
5127           ((TH1F *)(fMCProcessesList->At(8)))->Fill(particle->GetUniqueID());
5128         if(TMath::Abs(motherParticle->GetPdgCode()) == 3312)
5129           ((TH1F *)(fMCProcessesList->At(9)))->Fill(particle->GetUniqueID());
5130         if(TMath::Abs(motherParticle->GetPdgCode()) == 3322)
5131           ((TH1F *)(fMCProcessesList->At(10)))->Fill(particle->GetUniqueID());
5132         if(TMath::Abs(motherParticle->GetPdgCode()) == 3334)
5133           ((TH1F *)(fMCProcessesList->At(11)))->Fill(particle->GetUniqueID());
5134       }//secondary proton
5135     }//pdgcode of proton
5136
5137     if(pdgcode == -2212) {
5138       if(iParticle <= stack->GetNprimary()) {
5139         if(fProtonAnalysisBase->GetEtaMode())
5140           ((TH3F *)(fPDGList->At(1)))->Fill(particle->Eta(),particle->Pt(),0);
5141         else
5142           ((TH3F *)(fPDGList->At(1)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
5143                                                      particle->Py(),
5144                                                      particle->Pz()),
5145                                             particle->Pt(),0);
5146       }
5147       else if(iParticle > stack->GetNprimary()) {
5148         Int_t lPartMother = particle->GetFirstMother();
5149         TParticle *motherParticle = stack->Particle(lPartMother);
5150         if(!motherParticle) continue;
5151         Int_t motherPDGCode = motherParticle->GetPdgCode();
5152         if(fMCProcessIdFlag)
5153           if(particle->GetUniqueID() != fMCProcessId) continue;
5154         if(fMotherParticlePDGCodeFlag)
5155           if(TMath::Abs(motherPDGCode) != fMotherParticlePDGCode) continue;
5156
5157         if(fProtonAnalysisBase->GetEtaMode())
5158           ((TH3F *)(fPDGList->At(1)))->Fill(particle->Eta(),
5159                                             particle->Pt(),
5160                                             ConvertPDGToInt(motherParticle->GetPdgCode()));
5161         else
5162           ((TH3F *)(fPDGList->At(1)))->Fill(fProtonAnalysisBase->Rapidity(particle->Px(),
5163                                                      particle->Py(),
5164                                                      particle->Pz()),
5165                                             particle->Pt(),
5166                                             ConvertPDGToInt(motherParticle->GetPdgCode()));
5167
5168         //processes
5169         if(TMath::Abs(motherParticle->GetPdgCode()) == 130)
5170           ((TH1F *)(fMCProcessesList->At(12)))->Fill(particle->GetUniqueID());
5171         if(TMath::Abs(motherParticle->GetPdgCode()) == 211)
5172           ((TH1F *)(fMCProcessesList->At(13)))->Fill(particle->GetUniqueID());
5173         if(TMath::Abs(motherParticle->GetPdgCode()) == 310)
5174           ((TH1F *)(fMCProcessesList->At(14)))->Fill(particle->GetUniqueID());
5175         if(TMath::Abs(motherParticle->GetPdgCode()) == 321)
5176           ((TH1F *)(fMCProcessesList->At(15)))->Fill(particle->GetUniqueID());
5177         if(TMath::Abs(motherParticle->GetPdgCode()) == 2112)
5178           ((TH1F *)(fMCProcessesList->At(16)))->Fill(particle->GetUniqueID());
5179         if(TMath::Abs(motherParticle->GetPdgCode()) == 2212)
5180           ((TH1F *)(fMCProcessesList->At(17)))->Fill(particle->GetUniqueID());
5181         if(TMath::Abs(motherParticle->GetPdgCode()) == 3122)
5182           ((TH1F *)(fMCProcessesList->At(18)))->Fill(particle->GetUniqueID());
5183         if(TMath::Abs(motherParticle->GetPdgCode()) == 3222)
5184           ((TH1F *)(fMCProcessesList->At(19)))->Fill(particle->GetUniqueID());
5185       }//secondary antiproton
5186     }//pdgcode of antiproton
5187
5188   }//particle loop
5189 }
5190
5191 //____________________________________________________________________//
5192 Int_t AliProtonQAAnalysis::ConvertPDGToInt(Int_t pdgCode) const {
5193   //Converts the pdg code to an int based on the following scheme:
5194   //1: PDG code: 130 - Name: K_L0
5195   //2: PDG code: 211 - Name: pi+
5196   //3: PDG code: 310 - Name: K_S0
5197   //4: PDG code: 321 - Name: K+
5198   //5: PDG code: 2112 - Name: neutron
5199   //6: PDG code: 2212 - Name: proton
5200   //7: PDG code: 3112 - Name: Sigma-
5201   //8: PDG code: 3122 - Name: Lambda0
5202   //9: PDG code: 3222 - Name: Sigma+
5203   //10: PDG code: 3312 - Name: Xi-
5204   //11: PDG code: 3322 - Name: Xi0
5205   //12: PDG code: 3334 - Name: Omega-
5206   Int_t code = -1;
5207   switch (TMath::Abs(pdgCode)) {
5208   case 130: {
5209     code = 1;
5210     break;
5211   }
5212   case 211: {
5213     code = 2;
5214     break;
5215   }
5216   case 310: {
5217     code = 3;
5218     break;
5219   }
5220   case 321: {
5221     code = 4;
5222     break;
5223   }
5224   case 2112: {
5225     code = 5;
5226     break;
5227   }
5228   case 2212: {
5229     code = 6;
5230     break;
5231   }
5232   case 3112: {
5233     code = 7;
5234     break;
5235   }
5236   case 3122: {
5237     code = 8;
5238     break;
5239   }
5240   case 3222: {
5241     code = 9;
5242     break;
5243   }
5244   case 3312: {
5245     code = 10;
5246     break;
5247   }
5248   case 3322: {
5249     code = 11;
5250     break;
5251   }
5252   case 3334: {
5253     code = 12;
5254     break;
5255   }
5256   default: {
5257     code = -1;
5258     break;
5259   }
5260   }//switch
5261
5262   return code;
5263 }
5264
5265
5266
5267
5268
5269