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