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