]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/SPECTRA/AliProtonQAAnalysis.cxx
313b27a0ee1739260713e9acf2cc63cdd193315f
[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, UOA-CERN, Panos.Christakoglou@cern.ch
20 //-----------------------------------------------------------------
21 #include <Riostream.h>
22 #include <TFile.h>
23 #include <TSystem.h>
24 #include <TF1.h>
25 #include <TH2D.h>
26 #include <TH3F.h>
27 #include <TH1D.h>
28 #include <TArrayI.h>
29 #include <TParticle.h>
30
31 #include "AliProtonQAAnalysis.h"
32
33 #include <AliExternalTrackParam.h>
34 #include <AliESDEvent.h>
35 #include <AliLog.h>
36 #include <AliPID.h>
37 #include <AliStack.h>
38
39 ClassImp(AliProtonQAAnalysis)
40
41 //____________________________________________________________________//
42 AliProtonQAAnalysis::AliProtonQAAnalysis() : 
43   TObject(), 
44   fNBinsY(0), fMinY(0), fMaxY(0),
45   fNBinsPt(0), fMinPt(0), fMaxPt(0),
46   fMinTPCClusters(0), fMinITSClusters(0),
47   fMaxChi2PerTPCCluster(0), fMaxChi2PerITSCluster(0),
48   fMaxCov11(0), fMaxCov22(0), fMaxCov33(0), fMaxCov44(0), fMaxCov55(0),
49   fMaxSigmaToVertex(0), fMaxSigmaToVertexTPC(0),
50   fMaxDCAXY(0), fMaxDCAXYTPC(0),
51   fMaxDCAZ(0), fMaxDCAZTPC(0),
52   fMaxConstrainChi2(0),
53   fMinTPCClustersFlag(kFALSE), fMinITSClustersFlag(kFALSE),
54   fMaxChi2PerTPCClusterFlag(kFALSE), fMaxChi2PerITSClusterFlag(kFALSE),
55   fMaxCov11Flag(kFALSE), fMaxCov22Flag(kFALSE), 
56   fMaxCov33Flag(kFALSE), fMaxCov44Flag(kFALSE), fMaxCov55Flag(kFALSE),
57   fMaxSigmaToVertexFlag(kFALSE), fMaxSigmaToVertexTPCFlag(kFALSE),
58   fMaxDCAXYFlag(kFALSE), fMaxDCAXYTPCFlag(kFALSE),
59   fMaxDCAZFlag(kFALSE), fMaxDCAZTPCFlag(kFALSE),
60   fMaxConstrainChi2Flag(kFALSE),
61   fITSRefitFlag(kFALSE), fTPCRefitFlag(kFALSE),
62   fESDpidFlag(kFALSE), fTPCpidFlag(kFALSE),
63   fPointOnITSLayer1Flag(0), fPointOnITSLayer2Flag(0),
64   fPointOnITSLayer3Flag(0), fPointOnITSLayer4Flag(0),
65   fPointOnITSLayer5Flag(0), fPointOnITSLayer6Flag(0),
66   fGlobalQAList(0), fQA2DList(0),
67   fQAPrimaryProtonsAcceptedList(0),
68   fQAPrimaryProtonsRejectedList(0),
69   fQASecondaryProtonsAcceptedList(0),
70   fQASecondaryProtonsRejectedList(0),
71   fQAPrimaryAntiProtonsAcceptedList(0),
72   fQAPrimaryAntiProtonsRejectedList(0),
73   fQASecondaryAntiProtonsAcceptedList(0),
74   fQASecondaryAntiProtonsRejectedList(0),
75   fFunctionProbabilityFlag(kFALSE), 
76   fElectronFunction(0), fMuonFunction(0),
77   fPionFunction(0), fKaonFunction(0), fProtonFunction(0),
78   fUseTPCOnly(kFALSE), fUseHybridTPC(kFALSE),
79   fPDGList(0), fMCProcessesList(0),
80   fRunMCAnalysis(kFALSE),
81   fMCProcessIdFlag(kFALSE), fMCProcessId(0),
82   fMotherParticlePDGCodeFlag(kFALSE), fMotherParticlePDGCode(0),
83   fAcceptedCutList(0), fRejectedCutList(0),
84   fAcceptedDCAList(0), fRejectedDCAList(0),
85   fRunEfficiencyAnalysis(kFALSE), fEfficiencyList(0) {
86   //Default constructor
87   for(Int_t i = 0; i < 5; i++) fPartFrac[i] = 0.0;
88 }
89
90 //____________________________________________________________________//
91 AliProtonQAAnalysis::~AliProtonQAAnalysis() {
92   //Default destructor
93   if(fGlobalQAList) delete fGlobalQAList;
94   if(fQA2DList) delete fQA2DList;
95   if(fQAPrimaryProtonsAcceptedList) delete fQAPrimaryProtonsAcceptedList;
96   if(fQAPrimaryProtonsRejectedList) delete fQAPrimaryProtonsRejectedList;
97   if(fQASecondaryProtonsAcceptedList) delete fQASecondaryProtonsAcceptedList;
98   if(fQASecondaryProtonsRejectedList) delete fQASecondaryProtonsRejectedList;
99   if(fQAPrimaryAntiProtonsAcceptedList) 
100     delete fQAPrimaryAntiProtonsAcceptedList;
101   if(fQAPrimaryAntiProtonsRejectedList) 
102     delete fQAPrimaryAntiProtonsRejectedList;
103   if(fQASecondaryAntiProtonsAcceptedList) 
104     delete fQASecondaryAntiProtonsAcceptedList;
105   if(fQASecondaryAntiProtonsRejectedList) 
106     delete fQASecondaryAntiProtonsRejectedList; 
107
108   if(fPDGList) delete fPDGList;
109   if(fMCProcessesList) delete fMCProcessesList;
110   
111   if(fAcceptedCutList) delete fAcceptedCutList;
112   if(fRejectedCutList) delete fRejectedCutList;
113   if(fAcceptedDCAList) delete fAcceptedDCAList;
114   if(fRejectedDCAList) delete fRejectedDCAList;
115  
116   if(fEfficiencyList) delete fEfficiencyList;
117 }
118
119 //____________________________________________________________________//
120 Double_t AliProtonQAAnalysis::GetParticleFraction(Int_t i, Double_t p) {
121   Double_t partFrac=0;
122   if(fFunctionProbabilityFlag) {
123     if(i == 0) partFrac = fElectronFunction->Eval(p);
124     if(i == 1) partFrac = fMuonFunction->Eval(p);
125     if(i == 2) partFrac = fPionFunction->Eval(p);
126     if(i == 3) partFrac = fKaonFunction->Eval(p);
127     if(i == 4) partFrac = fProtonFunction->Eval(p);
128   }
129   else partFrac = fPartFrac[i];
130
131   return partFrac;
132 }
133
134 //____________________________________________________________________//
135 Bool_t AliProtonQAAnalysis::IsAccepted(AliESDtrack* track) {
136   // Checks if the track is excluded from the cuts
137   Double_t Pt = 0.0, Px = 0.0, Py = 0.0, Pz = 0.0;
138   Float_t dcaXY = 0.0, dcaZ = 0.0;
139
140   if((fUseTPCOnly)&&(!fUseHybridTPC)) {
141     AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
142     if(!tpcTrack) {
143       Pt = 0.0; Px = 0.0; Py = 0.0; Pz = 0.0;
144       dcaXY = -100.0, dcaZ = -100.0;
145     }
146     else {
147       Pt = tpcTrack->Pt();
148       Px = tpcTrack->Px();
149       Py = tpcTrack->Py();
150       Pz = tpcTrack->Pz();
151       track->GetImpactParametersTPC(dcaXY,dcaZ);
152     }
153   }
154   else if(fUseHybridTPC) {
155      AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
156     if(!tpcTrack) {
157       Pt = 0.0; Px = 0.0; Py = 0.0; Pz = 0.0;
158       dcaXY = -100.0, dcaZ = -100.0;
159     }
160     else {
161       Pt = tpcTrack->Pt();
162       Px = tpcTrack->Px();
163       Py = tpcTrack->Py();
164       Pz = tpcTrack->Pz();
165       track->GetImpactParameters(dcaXY,dcaZ);
166     }
167   }
168   else{
169     Pt = track->Pt();
170     Px = track->Px();
171     Py = track->Py();
172     Pz = track->Pz();
173     track->GetImpactParameters(dcaXY,dcaZ);
174   }
175      
176   Int_t  fIdxInt[200];
177   Int_t nClustersITS = track->GetITSclusters(fIdxInt);
178   Int_t nClustersTPC = track->GetTPCclusters(fIdxInt);
179
180   Float_t chi2PerClusterITS = -1;
181   if (nClustersITS!=0)
182     chi2PerClusterITS = track->GetITSchi2()/Float_t(nClustersITS);
183   Float_t chi2PerClusterTPC = -1;
184   if (nClustersTPC!=0)
185     chi2PerClusterTPC = track->GetTPCchi2()/Float_t(nClustersTPC);
186
187   Double_t extCov[15];
188   track->GetExternalCovariance(extCov);
189
190   if(fPointOnITSLayer1Flag)
191     if(!track->HasPointOnITSLayer(0)) return kFALSE;
192   if(fPointOnITSLayer2Flag)
193     if(!track->HasPointOnITSLayer(1)) return kFALSE;
194   if(fPointOnITSLayer3Flag)
195     if(!track->HasPointOnITSLayer(2)) return kFALSE;
196   if(fPointOnITSLayer4Flag)
197     if(!track->HasPointOnITSLayer(3)) return kFALSE;
198   if(fPointOnITSLayer5Flag)
199     if(!track->HasPointOnITSLayer(4)) return kFALSE;
200   if(fPointOnITSLayer6Flag)
201     if(!track->HasPointOnITSLayer(5)) return kFALSE;
202   if(fMinITSClustersFlag)
203     if(nClustersITS < fMinITSClusters) return kFALSE;
204   if(fMaxChi2PerITSClusterFlag)
205     if(chi2PerClusterITS > fMaxChi2PerITSCluster) return kFALSE; 
206   if(fMinTPCClustersFlag)
207     if(nClustersTPC < fMinTPCClusters) return kFALSE;
208   if(fMaxChi2PerTPCClusterFlag)
209     if(chi2PerClusterTPC > fMaxChi2PerTPCCluster) return kFALSE; 
210   if(fMaxCov11Flag)
211     if(extCov[0] > fMaxCov11) return kFALSE;
212   if(fMaxCov22Flag)
213     if(extCov[2] > fMaxCov22) return kFALSE;
214   if(fMaxCov33Flag)
215     if(extCov[5] > fMaxCov33) return kFALSE;
216   if(fMaxCov44Flag)
217     if(extCov[9] > fMaxCov44) return kFALSE;
218   if(fMaxCov55Flag)
219     if(extCov[14] > fMaxCov55) return kFALSE;
220   if(fMaxSigmaToVertexFlag)
221     if(GetSigmaToVertex(track) > fMaxSigmaToVertex) return kFALSE;
222   if(fMaxSigmaToVertexTPCFlag)
223     if(GetSigmaToVertex(track) > fMaxSigmaToVertexTPC) return kFALSE;
224   if(fMaxDCAXYFlag) 
225     if(TMath::Abs(dcaXY) > fMaxDCAXY) return kFALSE;
226   if(fMaxDCAXYTPCFlag) 
227     if(TMath::Abs(dcaXY) > fMaxDCAXYTPC) return kFALSE;
228     if(fMaxDCAZFlag) 
229     if(TMath::Abs(dcaZ) > fMaxDCAZ) return kFALSE;
230   if(fMaxDCAZTPCFlag) 
231     if(TMath::Abs(dcaZ) > fMaxDCAZTPC) return kFALSE;
232   if(fMaxConstrainChi2Flag) {
233     if(track->GetConstrainedChi2() > 0) 
234       if(TMath::Log(track->GetConstrainedChi2()) > fMaxConstrainChi2) return kFALSE;
235   }
236   if(fITSRefitFlag)
237     if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) return kFALSE;
238   if(fTPCRefitFlag)
239     if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) return kFALSE;
240   if(fESDpidFlag)
241     if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) return kFALSE;
242   if(fTPCpidFlag)
243     if ((track->GetStatus() & AliESDtrack::kTPCpid) == 0) return kFALSE;
244
245   if((Pt < fMinPt) || (Pt > fMaxPt)) return kFALSE;
246   if((Rapidity(Px,Py,Pz) < fMinY) || (Rapidity(Px,Py,Pz) > fMaxY)) 
247     return kFALSE;
248
249   return kTRUE;
250 }
251
252 //____________________________________________________________________//
253 void AliProtonQAAnalysis::FillQA(AliESDtrack* track, AliStack *stack) {
254   // Checks if the track is excluded from the cuts
255   Int_t nPrimaries = stack->GetNprimary();
256   Int_t label = TMath::Abs(track->GetLabel());
257
258   Double_t Pt = 0.0, Px = 0.0, Py = 0.0, Pz = 0.0;
259   Float_t dcaXY = 0.0, dcaZ = 0.0;
260   if((fUseTPCOnly)&&(!fUseHybridTPC)) {
261     AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
262     if(!tpcTrack) {
263       Pt = 0.0; Px = 0.0; Py = 0.0; Pz = 0.0;
264       dcaXY = -100.0, dcaZ = -100.0;
265     }
266     else {
267       Pt = tpcTrack->Pt();
268       Px = tpcTrack->Px();
269       Py = tpcTrack->Py();
270       Pz = tpcTrack->Pz();
271       track->GetImpactParametersTPC(dcaXY,dcaZ);
272     }
273   }
274   else if(fUseHybridTPC) {
275     AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
276     if(!tpcTrack) {
277       Pt = 0.0; Px = 0.0; Py = 0.0; Pz = 0.0;
278       dcaXY = -100.0, dcaZ = -100.0;
279     }
280     else {
281       Pt = tpcTrack->Pt();
282       Px = tpcTrack->Px();
283       Py = tpcTrack->Py();
284       Pz = tpcTrack->Pz();
285       track->GetImpactParameters(dcaXY,dcaZ);
286     }
287   }
288   else{
289     Pt = track->Pt();
290     Px = track->Px();
291     Py = track->Py();
292     Pz = track->Pz();
293     track->GetImpactParameters(dcaXY,dcaZ);
294   }
295      
296   Int_t  fIdxInt[200];
297   Int_t nClustersITS = track->GetITSclusters(fIdxInt);
298   Int_t nClustersTPC = track->GetTPCclusters(fIdxInt);
299
300   Float_t chi2PerClusterITS = -1;
301   if (nClustersITS!=0)
302     chi2PerClusterITS = track->GetITSchi2()/Float_t(nClustersITS);
303   Float_t chi2PerClusterTPC = -1;
304   if (nClustersTPC!=0)
305     chi2PerClusterTPC = track->GetTPCchi2()/Float_t(nClustersTPC);
306
307   Double_t extCov[15];
308   track->GetExternalCovariance(extCov);
309   
310   //cout<<"Charge: "<<track->Charge()<<
311   //" - Label/Primaries: "<<label<<"/"<<nPrimaries<<
312   //" - TPC clusters: "<<nClustersTPC<<endl;
313   //protons
314   if(track->Charge() > 0) {
315     //Primaries
316     if(label <= nPrimaries) {
317       if(fMinITSClustersFlag) {
318         if(nClustersITS < fMinITSClusters) {
319           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(0)))->Fill(nClustersITS);
320           //status = kFALSE;
321         }
322         else if(nClustersITS >= fMinITSClusters) 
323           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(0)))->Fill(nClustersITS);
324       }//ITS clusters
325       if(fMaxChi2PerITSClusterFlag) {
326         if(chi2PerClusterITS > fMaxChi2PerITSCluster) {
327           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(1)))->Fill(chi2PerClusterITS);
328           //status = kFALSE;
329         }
330         else if(chi2PerClusterITS <= fMaxChi2PerITSCluster)
331           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(1)))->Fill(chi2PerClusterITS);
332       }//chi2 per ITS cluster
333       if(fMinTPCClustersFlag) {
334         if(nClustersTPC < fMinTPCClusters) {
335           //cout<<"Primary proton rejected"<<endl;
336           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(2)))->Fill(nClustersTPC);
337           //status = kFALSE;
338         }
339         else if(nClustersTPC >= fMinTPCClusters) {
340           //cout<<"Primary proton accepted"<<endl;
341           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(2)))->Fill(nClustersTPC);
342         }
343       }//TPC clusters
344       if(fMaxChi2PerTPCClusterFlag) {
345         if(chi2PerClusterTPC > fMaxChi2PerTPCCluster) {
346           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(3)))->Fill(chi2PerClusterTPC);
347           //status = kFALSE;
348         }
349         else if(chi2PerClusterTPC <= fMaxChi2PerTPCCluster)
350           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(3)))->Fill(chi2PerClusterTPC);
351       }//chi2 per TPC cluster
352       if(fMaxCov11Flag) {
353         if(extCov[0] > fMaxCov11) {
354           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(4)))->Fill(extCov[0]);
355           //status = kFALSE;
356         }
357         else if(extCov[0] <= fMaxCov11)
358           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(4)))->Fill(extCov[0]);
359       }//cov11
360       if(fMaxCov22Flag) {
361         if(extCov[2] > fMaxCov22) {
362           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(5)))->Fill(extCov[2]);
363           //status = kFALSE;
364         }
365         else if(extCov[2] <= fMaxCov22)
366           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(5)))->Fill(extCov[2]);
367       }//cov11
368       if(fMaxCov33Flag) {
369         if(extCov[5] > fMaxCov33) {
370           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(6)))->Fill(extCov[5]);
371           //status = kFALSE;
372         }
373         else if(extCov[5] <= fMaxCov33)
374           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(6)))->Fill(extCov[5]);
375       }//cov11
376       if(fMaxCov44Flag) {
377         if(extCov[9] > fMaxCov44) {
378           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(7)))->Fill(extCov[9]);
379           //status = kFALSE;
380         }
381         else if(extCov[9] <= fMaxCov44)
382           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(7)))->Fill(extCov[9]);
383       }//cov11
384       if(fMaxCov55Flag) {
385         if(extCov[14] > fMaxCov55) {
386           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(8)))->Fill(extCov[14]);
387           //status = kFALSE;
388         }
389         else if(extCov[14] <= fMaxCov55)
390           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(8)))->Fill(extCov[14]);
391       }//cov55
392       if(fMaxSigmaToVertexFlag) {
393         if(GetSigmaToVertex(track) > fMaxSigmaToVertex) {
394           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(9)))->Fill(GetSigmaToVertex(track));
395           //status = kFALSE;
396         }
397         else if(GetSigmaToVertex(track) <= fMaxSigmaToVertex)
398           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(9)))->Fill(GetSigmaToVertex(track));
399       }//sigma to vertex
400       if(fMaxSigmaToVertexTPCFlag) {
401         if(GetSigmaToVertex(track) > fMaxSigmaToVertexTPC) {
402           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(10)))->Fill(GetSigmaToVertex(track));
403           //status = kFALSE;
404         }
405         else if(GetSigmaToVertex(track) <= fMaxSigmaToVertexTPC)
406           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(10)))->Fill(GetSigmaToVertex(track));
407       }//sigma to vertex TPC
408       if(fMaxDCAXYFlag) {
409         if(dcaXY > fMaxDCAXY) {
410           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(11)))->Fill(dcaXY);
411           //status = kFALSE;
412         }
413         else if(dcaXY <= fMaxDCAXY)
414           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(11)))->Fill(dcaXY);
415       }//DCA xy global tracking
416       if(fMaxDCAXYTPCFlag) {
417         if(dcaXY > fMaxDCAXYTPC) {
418           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(12)))->Fill(dcaXY);
419           //status = kFALSE;
420         }
421         else if(dcaXY <= fMaxDCAXYTPC)
422           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(12)))->Fill(dcaXY);
423       }//DCA xy TPC tracking
424       if(fMaxDCAZFlag) {
425         if(dcaZ > fMaxDCAZ) {
426           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(13)))->Fill(dcaZ);
427           //status = kFALSE;
428         }
429         else if(dcaZ <= fMaxDCAZ)
430           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(13)))->Fill(dcaZ);
431       }//DCA z global tracking
432       if(fMaxDCAZTPCFlag) {
433         if(dcaZ > fMaxDCAZTPC) {
434           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(14)))->Fill(dcaZ);
435           //status = kFALSE;
436         }
437         else if(dcaZ <= fMaxDCAZTPC)
438           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(14)))->Fill(dcaZ);
439       }//DCA z TPC tracking
440       if(fMaxConstrainChi2Flag) {
441         if(track->GetConstrainedChi2() > 0) {
442           if(TMath::Log(track->GetConstrainedChi2()) > fMaxConstrainChi2) {
443             ((TH1F *)(fQAPrimaryProtonsRejectedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
444             //status = kFALSE;
445           }
446           else if(TMath::Log(track->GetConstrainedChi2()) <= fMaxConstrainChi2)
447             ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
448         }
449       }//constrain chi2 - vertex
450       if(fITSRefitFlag) {
451         if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) {
452           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(16)))->Fill(0);
453         //status = kFALSE;
454         }
455         else if((track->GetStatus() & AliESDtrack::kITSrefit) != 0)
456           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(16)))->Fill(0);
457       }//ITS refit
458       if(fTPCRefitFlag) {
459         if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) {
460           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(17)))->Fill(0);
461           //status = kFALSE;
462         }
463         else if((track->GetStatus() & AliESDtrack::kTPCrefit) != 0)
464           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(17)))->Fill(0);
465       }//TPC refit
466       if(fESDpidFlag) {
467         if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) {
468           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(18)))->Fill(0);
469           //status = kFALSE;
470         }
471         else if((track->GetStatus() & AliESDtrack::kESDpid) != 0)
472           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(18)))->Fill(0);
473       }//ESD pid
474       if(fTPCpidFlag) {
475         if ((track->GetStatus() & AliESDtrack::kTPCpid) == 0) {
476           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(19)))->Fill(0);
477           //status = kFALSE;
478         }
479         else if((track->GetStatus() & AliESDtrack::kTPCpid) != 0)
480           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(19)))->Fill(0);
481       }//TPC pid
482       if(fPointOnITSLayer1Flag) {
483         if(!track->HasPointOnITSLayer(0)) {
484           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(20)))->Fill(0);
485         }
486         else if(track->HasPointOnITSLayer(0))
487           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(20)))->Fill(0);
488       }//point on SPD1
489       if(fPointOnITSLayer2Flag) {
490         if(!track->HasPointOnITSLayer(1)) {
491           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(21)))->Fill(0);
492         }
493         else if(track->HasPointOnITSLayer(1))
494           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(21)))->Fill(0);
495       }//point on SPD2
496       if(fPointOnITSLayer3Flag) {
497         if(!track->HasPointOnITSLayer(2)) {
498           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(22)))->Fill(0);
499         }
500         else if(track->HasPointOnITSLayer(2))
501           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(22)))->Fill(0);
502       }//point on SDD1
503       if(fPointOnITSLayer4Flag) {
504         if(!track->HasPointOnITSLayer(3)) {
505           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(23)))->Fill(0);
506         }
507         else if(track->HasPointOnITSLayer(3))
508           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(23)))->Fill(0);
509       }//point on SDD2
510       if(fPointOnITSLayer5Flag) {
511         if(!track->HasPointOnITSLayer(4)) {
512           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(24)))->Fill(0);
513         }
514         else if(track->HasPointOnITSLayer(4))
515           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(24)))->Fill(0);
516       }//point on SSD1
517       if(fPointOnITSLayer6Flag) {
518         if(!track->HasPointOnITSLayer(5)) {
519           ((TH1F *)(fQAPrimaryProtonsRejectedList->At(25)))->Fill(0);
520         }
521         else if(track->HasPointOnITSLayer(5))
522           ((TH1F *)(fQAPrimaryProtonsAcceptedList->At(25)))->Fill(0);
523       }//point on SSD2
524     }//primary particle cut
525
526     //Secondaries
527     if(label > nPrimaries) {
528       if(fMinITSClustersFlag) {
529         if(nClustersITS < fMinITSClusters) {
530           ((TH1F *)(fQASecondaryProtonsRejectedList->At(0)))->Fill(nClustersITS);
531           //status = kFALSE;
532         }
533         else if(nClustersITS >= fMinITSClusters) 
534           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(0)))->Fill(nClustersITS);
535       }//ITS clusters
536       if(fMaxChi2PerITSClusterFlag) {
537         if(chi2PerClusterITS > fMaxChi2PerITSCluster) {
538           ((TH1F *)(fQASecondaryProtonsRejectedList->At(1)))->Fill(chi2PerClusterITS);
539           //status = kFALSE;
540         }
541         else if(chi2PerClusterITS <= fMaxChi2PerITSCluster)
542           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(1)))->Fill(chi2PerClusterITS);
543       }//chi2 per ITS cluster
544       if(fMinTPCClustersFlag) {
545         if(nClustersTPC < fMinTPCClusters) {
546           //cout<<"Secondary proton rejected"<<endl;
547           ((TH1F *)(fQASecondaryProtonsRejectedList->At(2)))->Fill(nClustersTPC);
548           //status = kFALSE;
549         }
550         else if(nClustersTPC >= fMinTPCClusters) {
551           //cout<<"Secondary proton accepted"<<endl;
552           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(2)))->Fill(nClustersTPC);
553         }
554       }//TPC clusters
555       if(fMaxChi2PerTPCClusterFlag) {
556         if(chi2PerClusterTPC > fMaxChi2PerTPCCluster) {
557           ((TH1F *)(fQASecondaryProtonsRejectedList->At(3)))->Fill(chi2PerClusterTPC);
558           //status = kFALSE;
559         }
560         else if(chi2PerClusterTPC <= fMaxChi2PerTPCCluster)
561           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(3)))->Fill(chi2PerClusterTPC);
562       }//chi2 per TPC cluster
563       if(fMaxCov11Flag) {
564         if(extCov[0] > fMaxCov11) {
565           ((TH1F *)(fQASecondaryProtonsRejectedList->At(4)))->Fill(extCov[0]);
566           //status = kFALSE;
567         }
568         else if(extCov[0] <= fMaxCov11)
569           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(4)))->Fill(extCov[0]);
570       }//cov11
571       if(fMaxCov22Flag) {
572         if(extCov[2] > fMaxCov22) {
573           ((TH1F *)(fQASecondaryProtonsRejectedList->At(5)))->Fill(extCov[2]);
574           //status = kFALSE;
575         }
576         else if(extCov[2] <= fMaxCov22)
577           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(5)))->Fill(extCov[2]);
578       }//cov11
579       if(fMaxCov33Flag) {
580         if(extCov[5] > fMaxCov33) {
581           ((TH1F *)(fQASecondaryProtonsRejectedList->At(6)))->Fill(extCov[5]);
582           //status = kFALSE;
583         }
584         else if(extCov[5] <= fMaxCov33)
585           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(6)))->Fill(extCov[5]);
586       }//cov11
587       if(fMaxCov44Flag) {
588         if(extCov[9] > fMaxCov44) {
589           ((TH1F *)(fQASecondaryProtonsRejectedList->At(7)))->Fill(extCov[9]);
590           //status = kFALSE;
591         }
592         else if(extCov[9] <= fMaxCov44)
593           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(7)))->Fill(extCov[9]);
594       }//cov11
595       if(fMaxCov55Flag) {
596         if(extCov[14] > fMaxCov55) {
597           ((TH1F *)(fQASecondaryProtonsRejectedList->At(8)))->Fill(extCov[14]);
598           //status = kFALSE;
599         }
600         else if(extCov[14] <= fMaxCov55)
601           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(8)))->Fill(extCov[14]);
602       }//cov55
603       if(fMaxSigmaToVertexFlag) {
604         if(GetSigmaToVertex(track) > fMaxSigmaToVertex) {
605           ((TH1F *)(fQASecondaryProtonsRejectedList->At(9)))->Fill(GetSigmaToVertex(track));
606           //status = kFALSE;
607         }
608         else if(GetSigmaToVertex(track) <= fMaxSigmaToVertex)
609           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(9)))->Fill(GetSigmaToVertex(track));
610       }//sigma to vertex
611       if(fMaxSigmaToVertexTPCFlag) {
612         if(GetSigmaToVertex(track) > fMaxSigmaToVertexTPC) {
613           ((TH1F *)(fQASecondaryProtonsRejectedList->At(10)))->Fill(GetSigmaToVertex(track));
614           //status = kFALSE;
615         }
616         else if(GetSigmaToVertex(track) <= fMaxSigmaToVertexTPC)
617           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(10)))->Fill(GetSigmaToVertex(track));
618       }//sigma to vertex TPC
619       if(fMaxDCAXYFlag) {
620         if(dcaXY > fMaxDCAXY) {
621           ((TH1F *)(fQASecondaryProtonsRejectedList->At(11)))->Fill(dcaXY);
622           //status = kFALSE;
623         }
624         else if(dcaXY <= fMaxDCAXY)
625           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(11)))->Fill(dcaXY);
626       }//DCA xy global tracking
627       if(fMaxDCAXYTPCFlag) {
628         if(dcaXY > fMaxDCAXYTPC) {
629           ((TH1F *)(fQASecondaryProtonsRejectedList->At(12)))->Fill(dcaXY);
630           //status = kFALSE;
631         }
632         else if(dcaXY <= fMaxDCAXYTPC)
633           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(12)))->Fill(dcaXY);
634       }//DCA xy TPC tracking
635       if(fMaxDCAZFlag) {
636         if(dcaZ > fMaxDCAZ) {
637           ((TH1F *)(fQASecondaryProtonsRejectedList->At(13)))->Fill(dcaZ);
638           //status = kFALSE;
639         }
640         else if(dcaZ <= fMaxDCAZ)
641           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(13)))->Fill(dcaZ);
642       }//DCA z global tracking
643       if(fMaxDCAZTPCFlag) {
644         if(dcaZ > fMaxDCAZTPC) {
645           ((TH1F *)(fQASecondaryProtonsRejectedList->At(14)))->Fill(dcaZ);
646           //status = kFALSE;
647         }
648         else if(dcaZ <= fMaxDCAZTPC)
649           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(14)))->Fill(dcaZ);
650       }//DCA z TPC tracking
651       if(fMaxConstrainChi2Flag) {
652         if(track->GetConstrainedChi2() > 0) {
653           if(TMath::Log(track->GetConstrainedChi2()) > fMaxConstrainChi2) {
654             ((TH1F *)(fQASecondaryProtonsRejectedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
655             //status = kFALSE;
656           }
657           else if(TMath::Log(track->GetConstrainedChi2()) <= fMaxConstrainChi2)
658             ((TH1F *)(fQASecondaryProtonsAcceptedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
659         }
660       }//constrain chi2 - vertex
661       if(fITSRefitFlag) {
662         if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) {
663           ((TH1F *)(fQASecondaryProtonsRejectedList->At(16)))->Fill(0);
664         //status = kFALSE;
665         }
666         else if((track->GetStatus() & AliESDtrack::kITSrefit) != 0)
667           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(16)))->Fill(0);
668       }//ITS refit
669       if(fTPCRefitFlag) {
670         if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) {
671           ((TH1F *)(fQASecondaryProtonsRejectedList->At(17)))->Fill(0);
672           //status = kFALSE;
673         }
674         else if((track->GetStatus() & AliESDtrack::kTPCrefit) != 0)
675           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(17)))->Fill(0);
676       }//TPC refit
677       if(fESDpidFlag) {
678         if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) {
679           ((TH1F *)(fQASecondaryProtonsRejectedList->At(18)))->Fill(0);
680           //status = kFALSE;
681         }
682         else if((track->GetStatus() & AliESDtrack::kESDpid) != 0)
683           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(18)))->Fill(0);
684       }//ESD pid
685       if(fTPCpidFlag) {
686         if ((track->GetStatus() & AliESDtrack::kTPCpid) == 0) {
687           ((TH1F *)(fQASecondaryProtonsRejectedList->At(19)))->Fill(0);
688           //status = kFALSE;
689         }
690         else if((track->GetStatus() & AliESDtrack::kTPCpid) != 0)
691           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(19)))->Fill(0);
692       }//TPC pid
693       if(fPointOnITSLayer1Flag) {
694         if(!track->HasPointOnITSLayer(0)) {
695           ((TH1F *)(fQASecondaryProtonsRejectedList->At(20)))->Fill(0);
696         }
697         else if(track->HasPointOnITSLayer(0))
698           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(20)))->Fill(0);
699       }//point on SPD1
700       if(fPointOnITSLayer2Flag) {
701         if(!track->HasPointOnITSLayer(1)) {
702           ((TH1F *)(fQASecondaryProtonsRejectedList->At(21)))->Fill(0);
703         }
704         else if(track->HasPointOnITSLayer(1))
705           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(21)))->Fill(0);
706       }//point on SPD2
707       if(fPointOnITSLayer3Flag) {
708         if(!track->HasPointOnITSLayer(2)) {
709           ((TH1F *)(fQASecondaryProtonsRejectedList->At(22)))->Fill(0);
710         }
711         else if(track->HasPointOnITSLayer(2))
712           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(22)))->Fill(0);
713       }//point on SDD1
714       if(fPointOnITSLayer4Flag) {
715         if(!track->HasPointOnITSLayer(3)) {
716           ((TH1F *)(fQASecondaryProtonsRejectedList->At(23)))->Fill(0);
717         }
718         else if(track->HasPointOnITSLayer(3))
719           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(23)))->Fill(0);
720       }//point on SDD2
721       if(fPointOnITSLayer5Flag) {
722         if(!track->HasPointOnITSLayer(4)) {
723           ((TH1F *)(fQASecondaryProtonsRejectedList->At(24)))->Fill(0);
724         }
725         else if(track->HasPointOnITSLayer(4))
726           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(24)))->Fill(0);
727       }//point on SSD1
728       if(fPointOnITSLayer6Flag) {
729         if(!track->HasPointOnITSLayer(5)) {
730           ((TH1F *)(fQASecondaryProtonsRejectedList->At(25)))->Fill(0);
731         }
732         else if(track->HasPointOnITSLayer(5))
733           ((TH1F *)(fQASecondaryProtonsAcceptedList->At(25)))->Fill(0);
734       }//point on SSD2
735     }//secondary particle cut
736   }//protons
737
738   //antiprotons
739   if(track->Charge() < 0) {
740     //Primaries
741     if(label <= nPrimaries) {
742       if(fMinITSClustersFlag) {
743         if(nClustersITS < fMinITSClusters) {
744           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(0)))->Fill(nClustersITS);
745           //status = kFALSE;
746         }
747         else if(nClustersITS >= fMinITSClusters) 
748           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(0)))->Fill(nClustersITS);
749       }//ITS clusters
750       if(fMaxChi2PerITSClusterFlag) {
751         if(chi2PerClusterITS > fMaxChi2PerITSCluster) {
752           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(1)))->Fill(chi2PerClusterITS);
753           //status = kFALSE;
754         }
755         else if(chi2PerClusterITS <= fMaxChi2PerITSCluster)
756           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(1)))->Fill(chi2PerClusterITS);
757       }//chi2 per ITS cluster
758       if(fMinTPCClustersFlag) {
759         if(nClustersTPC < fMinTPCClusters) {
760           //cout<<"Primary antiproton rejected"<<endl;
761           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(2)))->Fill(nClustersTPC);
762           //status = kFALSE;
763         }
764         else if(nClustersTPC >= fMinTPCClusters) {
765           //cout<<"Primary antiproton accepted"<<endl;
766           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(2)))->Fill(nClustersTPC);
767         }
768       }//TPC clusters
769       if(fMaxChi2PerTPCClusterFlag) {
770         if(chi2PerClusterTPC > fMaxChi2PerTPCCluster) {
771           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(3)))->Fill(chi2PerClusterTPC);
772           //status = kFALSE;
773         }
774         else if(chi2PerClusterTPC <= fMaxChi2PerTPCCluster)
775           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(3)))->Fill(chi2PerClusterTPC);
776       }//chi2 per TPC cluster
777       if(fMaxCov11Flag) {
778         if(extCov[0] > fMaxCov11) {
779           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(4)))->Fill(extCov[0]);
780           //status = kFALSE;
781         }
782         else if(extCov[0] <= fMaxCov11)
783           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(4)))->Fill(extCov[0]);
784       }//cov11
785       if(fMaxCov22Flag) {
786         if(extCov[2] > fMaxCov22) {
787           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(5)))->Fill(extCov[2]);
788           //status = kFALSE;
789         }
790         else if(extCov[2] <= fMaxCov22)
791           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(5)))->Fill(extCov[2]);
792       }//cov11
793       if(fMaxCov33Flag) {
794         if(extCov[5] > fMaxCov33) {
795           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(6)))->Fill(extCov[5]);
796           //status = kFALSE;
797         }
798         else if(extCov[5] <= fMaxCov33)
799           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(6)))->Fill(extCov[5]);
800       }//cov11
801       if(fMaxCov44Flag) {
802         if(extCov[9] > fMaxCov44) {
803           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(7)))->Fill(extCov[9]);
804           //status = kFALSE;
805         }
806         else if(extCov[9] <= fMaxCov44)
807           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(7)))->Fill(extCov[9]);
808       }//cov11
809       if(fMaxCov55Flag) {
810         if(extCov[14] > fMaxCov55) {
811           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(8)))->Fill(extCov[14]);
812           //status = kFALSE;
813         }
814         else if(extCov[14] <= fMaxCov55)
815           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(8)))->Fill(extCov[14]);
816       }//cov55
817       if(fMaxSigmaToVertexFlag) {
818         if(GetSigmaToVertex(track) > fMaxSigmaToVertex) {
819           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(9)))->Fill(GetSigmaToVertex(track));
820           //status = kFALSE;
821         }
822         else if(GetSigmaToVertex(track) <= fMaxSigmaToVertex)
823           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(9)))->Fill(GetSigmaToVertex(track));
824       }//sigma to vertex
825       if(fMaxSigmaToVertexTPCFlag) {
826         if(GetSigmaToVertex(track) > fMaxSigmaToVertexTPC) {
827           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(10)))->Fill(GetSigmaToVertex(track));
828           //status = kFALSE;
829         }
830         else if(GetSigmaToVertex(track) <= fMaxSigmaToVertexTPC)
831           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(10)))->Fill(GetSigmaToVertex(track));
832       }//sigma to vertex TPC
833       if(fMaxDCAXYFlag) {
834         if(dcaXY > fMaxDCAXY) {
835           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(11)))->Fill(dcaXY);
836           //status = kFALSE;
837         }
838         else if(dcaXY <= fMaxDCAXY)
839           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(11)))->Fill(dcaXY);
840       }//DCA xy global tracking
841       if(fMaxDCAXYTPCFlag) {
842         if(dcaXY > fMaxDCAXYTPC) {
843           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(12)))->Fill(dcaXY);
844           //status = kFALSE;
845         }
846         else if(dcaXY <= fMaxDCAXYTPC)
847           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(12)))->Fill(dcaXY);
848       }//DCA xy TPC tracking
849       if(fMaxDCAZFlag) {
850         if(dcaZ > fMaxDCAZ) {
851           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(13)))->Fill(dcaZ);
852           //status = kFALSE;
853         }
854         else if(dcaZ <= fMaxDCAZ)
855           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(13)))->Fill(dcaZ);
856       }//DCA z global tracking
857       if(fMaxDCAZTPCFlag) {
858         if(dcaZ > fMaxDCAZTPC) {
859           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(14)))->Fill(dcaZ);
860           //status = kFALSE;
861         }
862         else if(dcaZ <= fMaxDCAZTPC)
863           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(14)))->Fill(dcaZ);
864       }//DCA z TPC tracking
865       if(fMaxConstrainChi2Flag) {
866         if(track->GetConstrainedChi2() > 0) {
867           if(TMath::Log(track->GetConstrainedChi2()) > fMaxConstrainChi2) {
868             ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
869             //status = kFALSE;
870           }
871           else if(TMath::Log(track->GetConstrainedChi2()) <= fMaxConstrainChi2)
872             ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
873         }
874       }//constrain chi2 - vertex
875       if(fITSRefitFlag) {
876         if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) {
877           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(16)))->Fill(0);
878         //status = kFALSE;
879         }
880         else if((track->GetStatus() & AliESDtrack::kITSrefit) != 0)
881           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(16)))->Fill(0);
882       }//ITS refit
883       if(fTPCRefitFlag) {
884         if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) {
885           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(17)))->Fill(0);
886           //status = kFALSE;
887         }
888         else if((track->GetStatus() & AliESDtrack::kTPCrefit) != 0)
889           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(17)))->Fill(0);
890       }//TPC refit
891       if(fESDpidFlag) {
892         if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) {
893           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(18)))->Fill(0);
894           //status = kFALSE;
895         }
896         else if((track->GetStatus() & AliESDtrack::kESDpid) != 0)
897           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(18)))->Fill(0);
898       }//ESD pid
899       if(fTPCpidFlag) {
900         if ((track->GetStatus() & AliESDtrack::kTPCpid) == 0) {
901           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(19)))->Fill(0);
902           //status = kFALSE;
903         }
904         else if((track->GetStatus() & AliESDtrack::kTPCpid) != 0)
905           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(19)))->Fill(0);
906       }//TPC pid
907       if(fPointOnITSLayer1Flag) {
908         if(!track->HasPointOnITSLayer(0)) {
909           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(20)))->Fill(0);
910         }
911         else if(track->HasPointOnITSLayer(0))
912           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(20)))->Fill(0);
913       }//point on SPD1
914       if(fPointOnITSLayer2Flag) {
915         if(!track->HasPointOnITSLayer(1)) {
916           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(21)))->Fill(0);
917         }
918         else if(track->HasPointOnITSLayer(1))
919           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(21)))->Fill(0);
920       }//point on SPD2
921       if(fPointOnITSLayer3Flag) {
922         if(!track->HasPointOnITSLayer(2)) {
923           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(22)))->Fill(0);
924         }
925         else if(track->HasPointOnITSLayer(2))
926           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(22)))->Fill(0);
927       }//point on SDD1
928       if(fPointOnITSLayer4Flag) {
929         if(!track->HasPointOnITSLayer(3)) {
930           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(23)))->Fill(0);
931         }
932         else if(track->HasPointOnITSLayer(3))
933           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(23)))->Fill(0);
934       }//point on SDD2
935       if(fPointOnITSLayer5Flag) {
936         if(!track->HasPointOnITSLayer(4)) {
937           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(24)))->Fill(0);
938         }
939         else if(track->HasPointOnITSLayer(4))
940           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(24)))->Fill(0);
941       }//point on SSD1
942       if(fPointOnITSLayer6Flag) {
943         if(!track->HasPointOnITSLayer(5)) {
944           ((TH1F *)(fQAPrimaryAntiProtonsRejectedList->At(25)))->Fill(0);
945         }
946         else if(track->HasPointOnITSLayer(5))
947           ((TH1F *)(fQAPrimaryAntiProtonsAcceptedList->At(25)))->Fill(0);
948       }//point on SSD2
949     }//primary particle cut
950
951     //Secondaries
952     if(label > nPrimaries) {
953       if(fMinITSClustersFlag) {
954         if(nClustersITS < fMinITSClusters) {
955           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(0)))->Fill(nClustersITS);
956           //status = kFALSE;
957         }
958         else if(nClustersITS >= fMinITSClusters) 
959           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(0)))->Fill(nClustersITS);
960       }//ITS clusters
961       if(fMaxChi2PerITSClusterFlag) {
962         if(chi2PerClusterITS > fMaxChi2PerITSCluster) {
963           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(1)))->Fill(chi2PerClusterITS);
964           //status = kFALSE;
965         }
966         else if(chi2PerClusterITS <= fMaxChi2PerITSCluster)
967           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(1)))->Fill(chi2PerClusterITS);
968       }//chi2 per ITS cluster
969       if(fMinTPCClustersFlag) {
970         if(nClustersTPC < fMinTPCClusters) {
971           //cout<<"Secondary antiproton rejected"<<endl;
972           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(2)))->Fill(nClustersTPC);
973           //status = kFALSE;
974         }
975         else if(nClustersTPC >= fMinTPCClusters) {
976           //cout<<"Secondary antiproton accepted"<<endl;
977           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(2)))->Fill(nClustersTPC);
978         }
979       }//TPC clusters
980       if(fMaxChi2PerTPCClusterFlag) {
981         if(chi2PerClusterTPC > fMaxChi2PerTPCCluster) {
982           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(3)))->Fill(chi2PerClusterTPC);
983           //status = kFALSE;
984         }
985         else if(chi2PerClusterTPC <= fMaxChi2PerTPCCluster)
986           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(3)))->Fill(chi2PerClusterTPC);
987       }//chi2 per TPC cluster
988       if(fMaxCov11Flag) {
989         if(extCov[0] > fMaxCov11) {
990           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(4)))->Fill(extCov[0]);
991           //status = kFALSE;
992         }
993         else if(extCov[0] <= fMaxCov11)
994           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(4)))->Fill(extCov[0]);
995       }//cov11
996       if(fMaxCov22Flag) {
997         if(extCov[2] > fMaxCov22) {
998           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(5)))->Fill(extCov[2]);
999           //status = kFALSE;
1000         }
1001         else if(extCov[2] <= fMaxCov22)
1002           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(5)))->Fill(extCov[2]);
1003       }//cov11
1004       if(fMaxCov33Flag) {
1005         if(extCov[5] > fMaxCov33) {
1006           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(6)))->Fill(extCov[5]);
1007           //status = kFALSE;
1008         }
1009         else if(extCov[5] <= fMaxCov33)
1010           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(6)))->Fill(extCov[5]);
1011       }//cov11
1012       if(fMaxCov44Flag) {
1013         if(extCov[9] > fMaxCov44) {
1014           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(7)))->Fill(extCov[9]);
1015           //status = kFALSE;
1016         }
1017         else if(extCov[9] <= fMaxCov44)
1018           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(7)))->Fill(extCov[9]);
1019       }//cov11
1020       if(fMaxCov55Flag) {
1021         if(extCov[14] > fMaxCov55) {
1022           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(8)))->Fill(extCov[14]);
1023           //status = kFALSE;
1024         }
1025         else if(extCov[14] <= fMaxCov55)
1026           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(8)))->Fill(extCov[14]);
1027       }//cov55
1028       if(fMaxSigmaToVertexFlag) {
1029         if(GetSigmaToVertex(track) > fMaxSigmaToVertex) {
1030           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(9)))->Fill(GetSigmaToVertex(track));
1031           //status = kFALSE;
1032         }
1033         else if(GetSigmaToVertex(track) <= fMaxSigmaToVertex)
1034           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(9)))->Fill(GetSigmaToVertex(track));
1035       }//sigma to vertex
1036       if(fMaxSigmaToVertexTPCFlag) {
1037         if(GetSigmaToVertex(track) > fMaxSigmaToVertexTPC) {
1038           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(10)))->Fill(GetSigmaToVertex(track));
1039           //status = kFALSE;
1040         }
1041         else if(GetSigmaToVertex(track) <= fMaxSigmaToVertexTPC)
1042           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(10)))->Fill(GetSigmaToVertex(track));
1043       }//sigma to vertex TPC
1044       if(fMaxDCAXYFlag) {
1045         if(dcaXY > fMaxDCAXY) {
1046           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(11)))->Fill(dcaXY);
1047           //status = kFALSE;
1048         }
1049         else if(dcaXY <= fMaxDCAXY)
1050           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(11)))->Fill(dcaXY);
1051       }//DCA xy global tracking
1052       if(fMaxDCAXYTPCFlag) {
1053         if(dcaXY > fMaxDCAXYTPC) {
1054           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(12)))->Fill(dcaXY);
1055           //status = kFALSE;
1056         }
1057         else if(dcaXY <= fMaxDCAXYTPC)
1058           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(12)))->Fill(dcaXY);
1059       }//DCA xy TPC tracking
1060       if(fMaxDCAZFlag) {
1061         if(dcaZ > fMaxDCAZ) {
1062           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(13)))->Fill(dcaZ);
1063           //status = kFALSE;
1064         }
1065         else if(dcaZ <= fMaxDCAZ)
1066           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(13)))->Fill(dcaZ);
1067       }//DCA z global tracking
1068       if(fMaxDCAZTPCFlag) {
1069         if(dcaZ > fMaxDCAZTPC) {
1070           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(14)))->Fill(dcaZ);
1071           //status = kFALSE;
1072         }
1073         else if(dcaZ <= fMaxDCAZTPC)
1074           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(14)))->Fill(dcaZ);
1075       }//DCA z TPC tracking
1076       if(fMaxConstrainChi2Flag) {
1077         if(track->GetConstrainedChi2() > 0) {
1078           if(TMath::Log(track->GetConstrainedChi2()) > fMaxConstrainChi2) {
1079             ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
1080             //status = kFALSE;
1081           }
1082           else if(TMath::Log(track->GetConstrainedChi2()) <= fMaxConstrainChi2)
1083             ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(15)))->Fill(TMath::Log(track->GetConstrainedChi2()));
1084         }
1085       }//constrain chi2 - vertex
1086       if(fITSRefitFlag) {
1087         if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) {
1088           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(16)))->Fill(0);
1089         //status = kFALSE;
1090         }
1091         else if((track->GetStatus() & AliESDtrack::kITSrefit) != 0)
1092           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(16)))->Fill(0);
1093       }//ITS refit
1094       if(fTPCRefitFlag) {
1095         if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) {
1096           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(17)))->Fill(0);
1097           //status = kFALSE;
1098         }
1099         else if((track->GetStatus() & AliESDtrack::kTPCrefit) != 0)
1100           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(17)))->Fill(0);
1101       }//TPC refit
1102       if(fESDpidFlag) {
1103         if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) {
1104           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(18)))->Fill(0);
1105           //status = kFALSE;
1106         }
1107         else if((track->GetStatus() & AliESDtrack::kESDpid) != 0)
1108           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(18)))->Fill(0);
1109       }//ESD pid
1110       if(fTPCpidFlag) {
1111         if ((track->GetStatus() & AliESDtrack::kTPCpid) == 0) {
1112           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(19)))->Fill(0);
1113           //status = kFALSE;
1114         }
1115         else if((track->GetStatus() & AliESDtrack::kTPCpid) != 0)
1116           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(19)))->Fill(0);
1117       }//TPC pid
1118       if(fPointOnITSLayer1Flag) {
1119         if(!track->HasPointOnITSLayer(0)) {
1120           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(20)))->Fill(0);
1121         }
1122         else if(track->HasPointOnITSLayer(0))
1123           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(20)))->Fill(0);
1124       }//point on SPD1
1125       if(fPointOnITSLayer2Flag) {
1126         if(!track->HasPointOnITSLayer(1)) {
1127           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(21)))->Fill(0);
1128         }
1129         else if(track->HasPointOnITSLayer(1))
1130           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(21)))->Fill(0);
1131       }//point on SPD2
1132       if(fPointOnITSLayer3Flag) {
1133         if(!track->HasPointOnITSLayer(2)) {
1134           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(22)))->Fill(0);
1135         }
1136         else if(track->HasPointOnITSLayer(2))
1137           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(22)))->Fill(0);
1138       }//point on SDD1
1139       if(fPointOnITSLayer4Flag) {
1140         if(!track->HasPointOnITSLayer(3)) {
1141           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(23)))->Fill(0);
1142         }
1143         else if(track->HasPointOnITSLayer(3))
1144           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(23)))->Fill(0);
1145       }//point on SDD2
1146       if(fPointOnITSLayer5Flag) {
1147         if(!track->HasPointOnITSLayer(4)) {
1148           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(24)))->Fill(0);
1149         }
1150         else if(track->HasPointOnITSLayer(4))
1151           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(24)))->Fill(0);
1152       }//point on SSD1
1153       if(fPointOnITSLayer6Flag) {
1154         if(!track->HasPointOnITSLayer(5)) {
1155           ((TH1F *)(fQASecondaryAntiProtonsRejectedList->At(25)))->Fill(0);
1156         }
1157         else if(track->HasPointOnITSLayer(5))
1158           ((TH1F *)(fQASecondaryAntiProtonsAcceptedList->At(25)))->Fill(0);
1159       }//point on SSD2
1160     }//secondary particle cut
1161   }//antiprotons
1162 }
1163
1164 //____________________________________________________________________//
1165 Float_t AliProtonQAAnalysis::GetSigmaToVertex(AliESDtrack* esdTrack) {
1166   // Calculates the number of sigma to the vertex.
1167   
1168   Float_t b[2];
1169   Float_t bRes[2];
1170   Float_t bCov[3];
1171   if((fUseTPCOnly)&&(!fUseHybridTPC))
1172     esdTrack->GetImpactParametersTPC(b,bCov);
1173   else
1174     esdTrack->GetImpactParameters(b,bCov);
1175   
1176   if (bCov[0]<=0 || bCov[2]<=0) {
1177     //AliDebug(1, "Estimated b resolution lower or equal zero!");
1178     bCov[0]=0; bCov[2]=0;
1179   }
1180   bRes[0] = TMath::Sqrt(bCov[0]);
1181   bRes[1] = TMath::Sqrt(bCov[2]);
1182   
1183   if (bRes[0] == 0 || bRes[1] ==0) return -1;
1184   
1185   Float_t d = TMath::Sqrt(TMath::Power(b[0]/bRes[0],2) + TMath::Power(b[1]/bRes[1],2));
1186   
1187   if (TMath::Exp(-d * d / 2) < 1e-10) return 1000;
1188   
1189   d = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2);
1190   
1191   return d;
1192 }
1193
1194 //____________________________________________________________________//
1195 Double_t AliProtonQAAnalysis::Rapidity(Double_t Px, Double_t Py, Double_t Pz) {
1196   //returns the rapidity of the proton - to be removed
1197   Double_t fMass = 9.38270000000000048e-01;
1198   
1199   Double_t P = TMath::Sqrt(TMath::Power(Px,2) + 
1200                            TMath::Power(Py,2) + 
1201                            TMath::Power(Pz,2));
1202   Double_t energy = TMath::Sqrt(P*P + fMass*fMass);
1203   Double_t y = -999;
1204   if(energy != Pz) 
1205     y = 0.5*TMath::Log((energy + Pz)/(energy - Pz));
1206
1207   return y;
1208 }
1209
1210 //____________________________________________________________________//
1211 void AliProtonQAAnalysis::SetRunQAAnalysis() {
1212   //initializes the QA lists
1213   //fQAHistograms = kTRUE;
1214   fGlobalQAList = new TList();
1215   fQA2DList = new TList();
1216   fQA2DList->SetName("fQA2DList");
1217   fGlobalQAList->Add(fQA2DList);
1218   
1219   fQAPrimaryProtonsAcceptedList = new TList();
1220   fQAPrimaryProtonsAcceptedList->SetName("fQAPrimaryProtonsAcceptedList");
1221   fGlobalQAList->Add(fQAPrimaryProtonsAcceptedList);
1222   
1223   fQAPrimaryProtonsRejectedList = new TList();
1224   fQAPrimaryProtonsRejectedList->SetName("fQAPrimaryProtonsRejectedList");
1225   fGlobalQAList->Add(fQAPrimaryProtonsRejectedList);
1226   
1227   fQASecondaryProtonsAcceptedList = new TList();
1228   fQASecondaryProtonsAcceptedList->SetName("fQASecondaryProtonsAcceptedList");
1229   fGlobalQAList->Add(fQASecondaryProtonsAcceptedList);
1230   
1231   fQASecondaryProtonsRejectedList = new TList();
1232   fQASecondaryProtonsRejectedList->SetName("fQASecondaryProtonsRejectedList");
1233   fGlobalQAList->Add(fQASecondaryProtonsRejectedList);
1234   
1235   fQAPrimaryAntiProtonsAcceptedList = new TList();
1236   fQAPrimaryAntiProtonsAcceptedList->SetName("fQAPrimaryAntiProtonsAcceptedList");
1237   fGlobalQAList->Add(fQAPrimaryAntiProtonsAcceptedList);
1238   
1239   fQAPrimaryAntiProtonsRejectedList = new TList();
1240   fQAPrimaryAntiProtonsRejectedList->SetName("fQAPrimaryAntiProtonsRejectedList");
1241   fGlobalQAList->Add(fQAPrimaryAntiProtonsRejectedList);
1242   
1243   fQASecondaryAntiProtonsAcceptedList = new TList();
1244   fQASecondaryAntiProtonsAcceptedList->SetName("fQASecondaryAntiProtonsAcceptedList");
1245   fGlobalQAList->Add(fQASecondaryAntiProtonsAcceptedList);
1246   
1247   fQASecondaryAntiProtonsRejectedList = new TList();
1248   fQASecondaryAntiProtonsRejectedList->SetName("fQASecondaryAntiProtonsRejectedList");
1249   fGlobalQAList->Add(fQASecondaryAntiProtonsRejectedList);
1250 }
1251
1252 //____________________________________________________________________//
1253 void AliProtonQAAnalysis::SetQAYPtBins(Int_t nbinsY, Double_t minY, Double_t maxY,
1254                                       Int_t nbinsPt, Double_t minPt, Double_t maxPt) {
1255   //Initializes the QA binning
1256   fNBinsY = nbinsY;
1257   fMinY = minY; fMaxY = maxY;
1258   fNBinsPt = nbinsPt;
1259   fMinPt = minPt; fMaxPt = maxPt;
1260   InitQA();
1261   InitCutLists();
1262   if(fRunMCAnalysis) InitMCAnalysis();
1263   if(fRunEfficiencyAnalysis) InitEfficiencyAnalysis();
1264 }
1265
1266 //____________________________________________________________________//
1267 void AliProtonQAAnalysis::InitEfficiencyAnalysis() {
1268   //Initialization of the efficiency list - reconstruction & PID efficiency
1269   //Adding each monitored object in the list
1270   fEfficiencyList = new TList();
1271
1272   //MC primary protons and antiprotons for the reconstruction efficiency
1273   TH2D *gHistMCYPtProtons = new TH2D("gHistMCYPtProtons",
1274                                      ";y;P_{T} [GeV/c]",
1275                                      fNBinsY,fMinY,fMaxY,
1276                                      fNBinsPt,fMinPt,fMaxPt);
1277   gHistMCYPtProtons->SetStats(kTRUE);
1278   gHistMCYPtProtons->GetXaxis()->SetTitleColor(1);
1279   fEfficiencyList->Add(gHistMCYPtProtons);
1280   TH2D *gHistMCYPtAntiProtons = new TH2D("gHistMCYPtAntiProtons",
1281                                          ";y;P_{T} [GeV/c]",
1282                                          fNBinsY,fMinY,fMaxY,
1283                                          fNBinsPt,fMinPt,fMaxPt);
1284   gHistMCYPtAntiProtons->SetStats(kTRUE);
1285   gHistMCYPtAntiProtons->GetXaxis()->SetTitleColor(1);
1286   fEfficiencyList->Add(gHistMCYPtAntiProtons);
1287
1288   //ESD primary protons and antiprotons for the reconstruction efficiency
1289   TH2D *gHistESDYPtProtons = new TH2D("gHistESDYPtProtons",
1290                                       ";y;P_{T} [GeV/c]",
1291                                       fNBinsY,fMinY,fMaxY,
1292                                       fNBinsPt,fMinPt,fMaxPt);
1293   gHistESDYPtProtons->SetStats(kTRUE);
1294   gHistESDYPtProtons->GetXaxis()->SetTitleColor(1);
1295   fEfficiencyList->Add(gHistESDYPtProtons);
1296   TH2D *gHistESDYPtAntiProtons = new TH2D("gHistESDYPtAntiProtons",
1297                                           ";y;P_{T} [GeV/c]",
1298                                           fNBinsY,fMinY,fMaxY,
1299                                           fNBinsPt,fMinPt,fMaxPt);
1300   gHistESDYPtAntiProtons->SetStats(kTRUE);
1301   gHistESDYPtAntiProtons->GetXaxis()->SetTitleColor(1);
1302   fEfficiencyList->Add(gHistESDYPtAntiProtons);
1303
1304   //ESD reconstructed tracks that were initially protons for the PID efficiency
1305   TH2D *gHistESDInitYPtProtons = new TH2D("gHistESDInitYPtProtons",
1306                                           ";y;P_{T} [GeV/c]",
1307                                           fNBinsY,fMinY,fMaxY,
1308                                           fNBinsPt,fMinPt,fMaxPt);
1309   gHistESDInitYPtProtons->SetStats(kTRUE);
1310   gHistESDInitYPtProtons->GetXaxis()->SetTitleColor(1);
1311   fEfficiencyList->Add(gHistESDInitYPtProtons);
1312   
1313   //ESD reconstructed tracks that were initially protons and were identified as protons for the PID efficiency
1314   TH2D *gHistESDIdYPtProtons = new TH2D("gHistESDIdYPtProtons",
1315                                         ";y;P_{T} [GeV/c]",
1316                                         fNBinsY,fMinY,fMaxY,
1317                                         fNBinsPt,fMinPt,fMaxPt);
1318   gHistESDIdYPtProtons->SetStats(kTRUE);
1319   gHistESDIdYPtProtons->GetXaxis()->SetTitleColor(1);
1320   fEfficiencyList->Add(gHistESDIdYPtProtons);
1321  
1322   //ESD reconstructed tracks that were identified as protons for the PID contamination
1323   TH2D *gHistESDRecIdYPtProtons = new TH2D("gHistESDRecIdYPtProtons",
1324                                            ";y;P_{T} [GeV/c]",
1325                                            fNBinsY,fMinY,fMaxY,
1326                                            fNBinsPt,fMinPt,fMaxPt);
1327   gHistESDRecIdYPtProtons->SetStats(kTRUE);
1328   gHistESDRecIdYPtProtons->GetXaxis()->SetTitleColor(1);
1329   fEfficiencyList->Add(gHistESDRecIdYPtProtons);
1330
1331   //ESD reconstructed tracks that were identified as protons but were initially not protons for the PID contamination
1332   TH2D *gHistESDContamYPtProtons = new TH2D("gHistESDContamYPtProtons",
1333                                            ";y;P_{T} [GeV/c]",
1334                                            fNBinsY,fMinY,fMaxY,
1335                                            fNBinsPt,fMinPt,fMaxPt);
1336   gHistESDContamYPtProtons->SetStats(kTRUE);
1337   gHistESDContamYPtProtons->GetXaxis()->SetTitleColor(1);
1338   fEfficiencyList->Add(gHistESDContamYPtProtons);
1339 }
1340
1341 //____________________________________________________________________//
1342 void AliProtonQAAnalysis::InitCutLists() {
1343   //Initialization of the cut lists
1344   //Adding each monitored object in each list
1345
1346   //Accepted cut list
1347   fAcceptedCutList = new TList();
1348   TH1F *gPrimaryProtonsClustersOnITSLayers = new TH1F("gPrimaryProtonsClustersOnITSLayers",";ITS Layer;Entries",6,0.5,6.5);
1349   fAcceptedCutList->Add(gPrimaryProtonsClustersOnITSLayers);
1350   TH1F *gPrimaryAntiProtonsClustersOnITSLayers = new TH1F("gPrimaryAntiProtonsClustersOnITSLayers",";ITS Layer;Entries",6,0.5,6.5);
1351   fAcceptedCutList->Add(gPrimaryAntiProtonsClustersOnITSLayers);
1352   TH1F *gSecondaryProtonsClustersOnITSLayers = new TH1F("gSecondaryProtonsClustersOnITSLayers",";ITS Layer;Entries",6,0.5,6.5);
1353   fAcceptedCutList->Add(gSecondaryProtonsClustersOnITSLayers);
1354   TH1F *gSecondaryAntiProtonsClustersOnITSLayers = new TH1F("gSecondaryAntiProtonsClustersOnITSLayers",";ITS Layer;Entries",6,0.5,6.5);
1355   fAcceptedCutList->Add(gSecondaryAntiProtonsClustersOnITSLayers);
1356
1357   TH1F *gPrimaryProtonsNClustersITS = new TH1F("gPrimaryProtonsNClustersITS",";ITS Layer;Entries",6,0.5,6.5);
1358   fAcceptedCutList->Add(gPrimaryProtonsNClustersITS);
1359   TH1F *gPrimaryAntiProtonsNClustersITS = new TH1F("gPrimaryAntiProtonsNClustersITS",";ITS Layer;Entries",6,0.5,6.5);
1360   fAcceptedCutList->Add(gPrimaryAntiProtonsNClustersITS);
1361   TH1F *gSecondaryProtonsNClustersITS = new TH1F("gSecondaryProtonsNClustersITS",";ITS Layer;Entries",6,0.5,6.5);
1362   fAcceptedCutList->Add(gSecondaryProtonsNClustersITS);
1363   TH1F *gSecondaryAntiProtonsNClustersITS = new TH1F("gSecondaryAntiProtonsNClustersITS",";ITS Layer;Entries",6,0.5,6.5);
1364   fAcceptedCutList->Add(gSecondaryAntiProtonsNClustersITS);
1365
1366   TH1F *gPrimaryProtonsChi2PerClusterITS = new TH1F("gPrimaryProtonsChi2PerClusterITS",
1367                                                     ";x^{2}/N_{clusters} (ITS);Entries",
1368                                                     100,0,20);
1369   fAcceptedCutList->Add(gPrimaryProtonsChi2PerClusterITS);
1370   TH1F *gPrimaryAntiProtonsChi2PerClusterITS = new TH1F("gPrimaryAntiProtonsChi2PerClusterITS",
1371                                                         ";x^{2}/N_{clusters} (ITS);Entries",
1372                                                         100,0,20);
1373   fAcceptedCutList->Add(gPrimaryAntiProtonsChi2PerClusterITS);
1374   TH1F *gSecondaryProtonsChi2PerClusterITS = new TH1F("gSecondaryProtonsChi2PerClusterITS",
1375                                                       ";x^{2}/N_{clusters} (ITS);Entries",
1376                                                       100,0,20);
1377   fAcceptedCutList->Add(gSecondaryProtonsChi2PerClusterITS);
1378   TH1F *gSecondaryAntiProtonsChi2PerClusterITS = new TH1F("gSecondaryAntiProtonsChi2PerClusterITS",
1379                                                           ";x^{2}/N_{clusters} (ITS);Entries",
1380                                                           100,0,20);
1381   fAcceptedCutList->Add(gSecondaryAntiProtonsChi2PerClusterITS);
1382
1383   TH1F *gPrimaryProtonsConstrainChi2 = new TH1F("gPrimaryProtonsConstrainChi2",
1384                                                 ";Log_{10}(#chi^{2});Entries",
1385                                                 100,-10,10);
1386   fAcceptedCutList->Add(gPrimaryProtonsConstrainChi2);
1387   TH1F *gPrimaryAntiProtonsConstrainChi2 = new TH1F("gPrimaryAntiProtonsConstrainChi2",
1388                                                     ";Log_{10}(#chi^{2});Entries",
1389                                                     100,-10,10);
1390   fAcceptedCutList->Add(gPrimaryAntiProtonsConstrainChi2);
1391   TH1F *gSecondaryProtonsConstrainChi2 = new TH1F("gSecondaryProtonsConstrainChi2",
1392                                                   ";Log_{10}(#chi^{2});Entries",
1393                                                   100,-10,10);
1394   fAcceptedCutList->Add(gSecondaryProtonsConstrainChi2);
1395   TH1F *gSecondaryAntiProtonsConstrainChi2 = new TH1F("gSecondaryAntiProtonsConstrainChi2",
1396                                                       ";Log_{10}(#chi^{2});Entries",
1397                                                       100,-10,10);
1398   fAcceptedCutList->Add(gSecondaryAntiProtonsConstrainChi2);
1399
1400   TH1F *gPrimaryProtonsTPCClusters = new TH1F("gPrimaryProtonsTPCClusters",
1401                                               ";N_{clusters} (TPC);Entries",
1402                                               100,0,200);
1403   fAcceptedCutList->Add(gPrimaryProtonsTPCClusters);
1404   TH1F *gPrimaryAntiProtonsTPCClusters = new TH1F("gPrimaryAntiProtonsTPCClusters",
1405                                                   ";N_{clusters} (TPC);Entries",
1406                                                   100,0,200);
1407   fAcceptedCutList->Add(gPrimaryAntiProtonsTPCClusters);
1408   TH1F *gSecondaryProtonsTPCClusters = new TH1F("gSecondaryProtonsTPCClusters",
1409                                                 ";N_{clusters} (TPC);Entries",
1410                                                 100,0,200);
1411   fAcceptedCutList->Add(gSecondaryProtonsTPCClusters);
1412   TH1F *gSecondaryAntiProtonsTPCClusters = new TH1F("gSecondaryAntiProtonsTPCClusters",
1413                                                     ";N_{clusters} (TPC);Entries",
1414                                                     100,0,200);
1415   fAcceptedCutList->Add(gSecondaryAntiProtonsTPCClusters);
1416
1417   TH1F *gPrimaryProtonsChi2PerClusterTPC = new TH1F("gPrimaryProtonsChi2PerClusterTPC",
1418                                                     ";x^{2}/N_{clusters} (TPC);Entries",
1419                                                     100,0,4);
1420   fAcceptedCutList->Add(gPrimaryProtonsChi2PerClusterTPC);
1421   TH1F *gPrimaryAntiProtonsChi2PerClusterTPC = new TH1F("gPrimaryAntiProtonsChi2PerClusterTPC",
1422                                                         ";x^{2}/N_{clusters} (TPC);Entries",
1423                                                         100,0,4);
1424   fAcceptedCutList->Add(gPrimaryAntiProtonsChi2PerClusterTPC);
1425   TH1F *gSecondaryProtonsChi2PerClusterTPC = new TH1F("gSecondaryProtonsChi2PerClusterTPC",
1426                                                       ";x^{2}/N_{clusters} (TPC);Entries",
1427                                                       100,0,4);
1428   fAcceptedCutList->Add(gSecondaryProtonsChi2PerClusterTPC);
1429   TH1F *gSecondaryAntiProtonsChi2PerClusterTPC = new TH1F("gSecondaryAntiProtonsChi2PerClusterTPC",
1430                                                           ";x^{2}/N_{clusters} (TPC);Entries",
1431                                                           100,0,4);
1432   fAcceptedCutList->Add(gSecondaryAntiProtonsChi2PerClusterTPC);
1433
1434   TH1F *gPrimaryProtonsExtCov11 = new TH1F("gPrimaryProtonsExtCov11",
1435                                            ";#sigma_{y} [cm];Entries",
1436                                            100,0,4);
1437   fAcceptedCutList->Add(gPrimaryProtonsExtCov11);
1438   TH1F *gPrimaryAntiProtonsExtCov11 = new TH1F("gPrimaryAntiProtonsExtCov11",
1439                                                ";#sigma_{y} [cm];Entries",
1440                                                100,0,4);
1441   fAcceptedCutList->Add(gPrimaryAntiProtonsExtCov11);
1442   TH1F *gSecondaryProtonsExtCov11 = new TH1F("gSecondaryProtonsExtCov11",
1443                                              ";#sigma_{y} [cm];Entries",
1444                                              100,0,4);
1445   fAcceptedCutList->Add(gSecondaryProtonsExtCov11);
1446   TH1F *gSecondaryAntiProtonsExtCov11 = new TH1F("gSecondaryAntiProtonsExtCov11",
1447                                                  ";#sigma_{y} [cm];Entries",
1448                                                  100,0,4);
1449   fAcceptedCutList->Add(gSecondaryAntiProtonsExtCov11);
1450
1451
1452   TH1F *gPrimaryProtonsExtCov22 = new TH1F("gPrimaryProtonsExtCov22",
1453                                            ";#sigma_{z} [cm];Entries",
1454                                            100,0,4);
1455   fAcceptedCutList->Add(gPrimaryProtonsExtCov22);
1456   TH1F *gPrimaryAntiProtonsExtCov22 = new TH1F("gPrimaryAntiProtonsExtCov22",
1457                                                ";#sigma_{z} [cm];Entries",
1458                                                100,0,4);
1459   fAcceptedCutList->Add(gPrimaryAntiProtonsExtCov22);
1460   TH1F *gSecondaryProtonsExtCov22 = new TH1F("gSecondaryProtonsExtCov22",
1461                                              ";#sigma_{z} [cm];Entries",
1462                                              100,0,4);
1463   fAcceptedCutList->Add(gSecondaryProtonsExtCov22);
1464   TH1F *gSecondaryAntiProtonsExtCov22 = new TH1F("gSecondaryAntiProtonsExtCov22",
1465                                                  ";#sigma_{z} [cm];Entries",
1466                                                  100,0,4);
1467   fAcceptedCutList->Add(gSecondaryAntiProtonsExtCov22);
1468
1469
1470   TH1F *gPrimaryProtonsExtCov33 = new TH1F("gPrimaryProtonsExtCov33",
1471                                            ";#sigma_{sin(#phi)};Entries",
1472                                            100,0,4);
1473   fAcceptedCutList->Add(gPrimaryProtonsExtCov33);
1474   TH1F *gPrimaryAntiProtonsExtCov33 = new TH1F("gPrimaryAntiProtonsExtCov33",
1475                                                ";#sigma_{sin(#phi)};Entries",
1476                                                100,0,4);
1477   fAcceptedCutList->Add(gPrimaryAntiProtonsExtCov33);
1478   TH1F *gSecondaryProtonsExtCov33 = new TH1F("gSecondaryProtonsExtCov33",
1479                                              ";#sigma_{sin(#phi)};Entries",
1480                                              100,0,4);
1481   fAcceptedCutList->Add(gSecondaryProtonsExtCov33);
1482   TH1F *gSecondaryAntiProtonsExtCov33 = new TH1F("gSecondaryAntiProtonsExtCov33",
1483                                                  ";#sigma_{sin(#phi)};Entries",
1484                                                  100,0,4);
1485   fAcceptedCutList->Add(gSecondaryAntiProtonsExtCov33);
1486
1487
1488   TH1F *gPrimaryProtonsExtCov44 = new TH1F("gPrimaryProtonsExtCov44",
1489                                            ";#sigma_{tan(#lambda)};Entries",
1490                                            100,0,4);
1491   fAcceptedCutList->Add(gPrimaryProtonsExtCov44);
1492   TH1F *gPrimaryAntiProtonsExtCov44 = new TH1F("gPrimaryAntiProtonsExtCov44",
1493                                                ";#sigma_{tan(#lambda)};Entries",
1494                                                100,0,4);
1495   fAcceptedCutList->Add(gPrimaryAntiProtonsExtCov44);
1496   TH1F *gSecondaryProtonsExtCov44 = new TH1F("gSecondaryProtonsExtCov44",
1497                                              ";#sigma_{tan(#lambda)};Entries",
1498                                              100,0,4);
1499   fAcceptedCutList->Add(gSecondaryProtonsExtCov44);
1500   TH1F *gSecondaryAntiProtonsExtCov44 = new TH1F("gSecondaryAntiProtonsExtCov44",
1501                                                  ";#sigma_{tan(#lambda)};Entries",
1502                                                  100,0,4);
1503   fAcceptedCutList->Add(gSecondaryAntiProtonsExtCov44);
1504
1505
1506   TH1F *gPrimaryProtonsExtCov55 = new TH1F("gPrimaryProtonsExtCov55",
1507                                            ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
1508                                            100,0,4);
1509   fAcceptedCutList->Add(gPrimaryProtonsExtCov55);
1510   TH1F *gPrimaryAntiProtonsExtCov55 = new TH1F("gPrimaryAntiProtonsExtCov55",
1511                                                ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
1512                                                100,0,4);
1513   fAcceptedCutList->Add(gPrimaryAntiProtonsExtCov55);
1514   TH1F *gSecondaryProtonsExtCov55 = new TH1F("gSecondaryProtonsExtCov55",
1515                                              ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
1516                                              100,0,4);
1517   fAcceptedCutList->Add(gSecondaryProtonsExtCov55);
1518   TH1F *gSecondaryAntiProtonsExtCov55 = new TH1F("gSecondaryAntiProtonsExtCov55",
1519                                                  ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
1520                                                  100,0,4);
1521   fAcceptedCutList->Add(gSecondaryAntiProtonsExtCov55);
1522
1523   //DCA list
1524   fAcceptedDCAList = new TList();
1525   TH1F *gPrimaryProtonsDCAXY = new TH1F("gPrimaryProtonsDCAXY",
1526                                         ";DCA_{xy} [cm];Entries",
1527                                         100,0,20);
1528   fAcceptedDCAList->Add(gPrimaryProtonsDCAXY);
1529   TH1F *gPrimaryAntiProtonsDCAXY = new TH1F("gPrimaryAntiProtonsDCAXY",
1530                                             ";DCA_{xy} [cm];Entries",
1531                                             100,0,20);
1532   fAcceptedDCAList->Add(gPrimaryAntiProtonsDCAXY);
1533   TH1F *gSecondaryProtonsDCAXY = new TH1F("gSecondaryProtonsDCAXY",
1534                                           ";DCA_{xy} [cm];Entries",
1535                                           100,0,20);
1536   fAcceptedDCAList->Add(gSecondaryProtonsDCAXY);
1537   TH1F *gSecondaryAntiProtonsDCAXY = new TH1F("gSecondaryAntiProtonsDCAXY",
1538                                               ";DCA_{xy} [cm];Entries",
1539                                               100,0,20);
1540
1541   fAcceptedDCAList->Add(gSecondaryAntiProtonsDCAXY);
1542   TH1F *gPrimaryProtonsDCAZ = new TH1F("gPrimaryProtonsDCAZ",
1543                                        ";DCA_{z} [cm];Entries",
1544                                        100,0,20);
1545   fAcceptedDCAList->Add(gPrimaryProtonsDCAZ);
1546   TH1F *gPrimaryAntiProtonsDCAZ = new TH1F("gPrimaryAntiProtonsDCAZ",
1547                                            ";DCA_{z} [cm];Entries",
1548                                            100,0,20);
1549   fAcceptedDCAList->Add(gPrimaryAntiProtonsDCAZ);
1550   TH1F *gSecondaryProtonsDCAZ = new TH1F("gSecondaryProtonsDCAZ",
1551                                          ";DCA_{z} [cm];Entries",
1552                                          100,0,20);
1553   fAcceptedDCAList->Add(gSecondaryProtonsDCAZ);
1554   TH1F *gSecondaryAntiProtonsDCAZ = new TH1F("gSecondaryAntiProtonsDCAZ",
1555                                              ";DCA_{z} [cm];Entries",
1556                                              100,0,20);
1557   fAcceptedDCAList->Add(gSecondaryAntiProtonsDCAZ);
1558
1559   TH1F *gPrimaryProtonsSigmaToVertex = new TH1F("gPrimaryProtonsSigmaToVertex",
1560                                                 ";#sigma_{Vertex};Entries",
1561                                                 100,0,10);
1562   fAcceptedDCAList->Add(gPrimaryProtonsSigmaToVertex);
1563   TH1F *gPrimaryAntiProtonsSigmaToVertex = new TH1F("gPrimaryAntiProtonsSigmaToVertex",
1564                                                     ";#sigma_{Vertex};Entries",
1565                                                     100,0,10);
1566   fAcceptedDCAList->Add(gPrimaryAntiProtonsSigmaToVertex);
1567   TH1F *gSecondaryProtonsSigmaToVertex = new TH1F("gSecondaryProtonsSigmaToVertex",
1568                                                   ";#sigma_{Vertex};Entries",
1569                                                   100,0,10);
1570   fAcceptedDCAList->Add(gSecondaryProtonsSigmaToVertex);
1571   TH1F *gSecondaryAntiProtonsSigmaToVertex = new TH1F("gSecondaryAntiProtonsSigmaToVertex",
1572                                                       ";#sigma_{Vertex};Entries",
1573                                                       100,0,10);
1574   fAcceptedDCAList->Add(gSecondaryAntiProtonsSigmaToVertex);
1575
1576 }
1577
1578 //____________________________________________________________________//
1579 void AliProtonQAAnalysis::InitQA() {
1580   //Initializes the QA histograms and builds the directory structure
1581   //if(!fQAHistograms) 
1582   SetRunQAAnalysis();
1583
1584   //2D histograms
1585   //TDirectory *dir2D = gDirectory->mkdir("2D");
1586   //fGlobalQAList->Add(dir2D); dir2D->cd();
1587   TH2D *gHistYPtPrimaryProtonsPass = new TH2D("gHistYPtPrimaryProtonsPass",
1588                                               ";y;P_{T} [GeV/c]",
1589                                               fNBinsY,fMinY,fMaxY,
1590                                               fNBinsPt,fMinPt,fMaxPt);
1591   gHistYPtPrimaryProtonsPass->SetStats(kTRUE);
1592   gHistYPtPrimaryProtonsPass->GetXaxis()->SetTitleColor(1);
1593   fQA2DList->Add(gHistYPtPrimaryProtonsPass);//y-pT of primary accepted ESD protons
1594   TH2D *gHistYPtPrimaryProtonsReject = new TH2D("gHistYPtPrimaryProtonsReject",
1595                                                 ";y;P_{T} [GeV/c]",
1596                                                 fNBinsY,fMinY,fMaxY,
1597                                                 fNBinsPt,fMinPt,fMaxPt);
1598   gHistYPtPrimaryProtonsReject->SetStats(kTRUE);
1599   gHistYPtPrimaryProtonsReject->GetXaxis()->SetTitleColor(1);
1600   fQA2DList->Add(gHistYPtPrimaryProtonsReject);//y-pT of primary rejected ESD protons
1601
1602   TH2D *gHistYPtSecondaryProtonsPass = new TH2D("gHistYPtSecondaryProtonsPass",
1603                                                 ";y;P_{T} [GeV/c]",
1604                                                 fNBinsY,fMinY,fMaxY,
1605                                                 fNBinsPt,fMinPt,fMaxPt);
1606   gHistYPtSecondaryProtonsPass->SetStats(kTRUE);
1607   gHistYPtSecondaryProtonsPass->GetXaxis()->SetTitleColor(1);
1608   fQA2DList->Add(gHistYPtSecondaryProtonsPass);//y-pT of secondary accepted ESD protons
1609   TH2D *gHistYPtSecondaryProtonsReject = new TH2D("gHistYPtSecondaryProtonsReject",
1610                                                   ";y;P_{T} [GeV/c]",
1611                                                   fNBinsY,fMinY,fMaxY,
1612                                                   fNBinsPt,fMinPt,fMaxPt);
1613   gHistYPtSecondaryProtonsReject->SetStats(kTRUE);
1614   gHistYPtSecondaryProtonsReject->GetXaxis()->SetTitleColor(1);
1615   fQA2DList->Add(gHistYPtSecondaryProtonsReject);//y-pT of secondary rejected ESD protons
1616
1617   TH2D *gHistYPtPrimaryAntiProtonsPass = new TH2D("gHistYPtPrimaryAntiProtonsPass",
1618                                                   ";y;P_{T} [GeV/c]",
1619                                                   fNBinsY,fMinY,fMaxY,
1620                                                   fNBinsPt,fMinPt,fMaxPt);
1621   gHistYPtPrimaryAntiProtonsPass->SetStats(kTRUE);
1622   gHistYPtPrimaryAntiProtonsPass->GetXaxis()->SetTitleColor(1);
1623   fQA2DList->Add(gHistYPtPrimaryAntiProtonsPass);//y-pT of primary accepted ESD antiprotons
1624   TH2D *gHistYPtPrimaryAntiProtonsReject = new TH2D("gHistYPtPrimaryAntiProtonsReject",
1625                                                   ";y;P_{T} [GeV/c]",
1626                                                   fNBinsY,fMinY,fMaxY,
1627                                                   fNBinsPt,fMinPt,fMaxPt);
1628   gHistYPtPrimaryAntiProtonsReject->SetStats(kTRUE);
1629   gHistYPtPrimaryAntiProtonsReject->GetXaxis()->SetTitleColor(1);
1630   fQA2DList->Add(gHistYPtPrimaryAntiProtonsReject);//y-pT of primary rejected ESD antiprotons
1631
1632   TH2D *gHistYPtSecondaryAntiProtonsPass = new TH2D("gHistYPtSecondaryAntiProtonsPass",
1633                                                   ";y;P_{T} [GeV/c]",
1634                                                   fNBinsY,fMinY,fMaxY,
1635                                                   fNBinsPt,fMinPt,fMaxPt);
1636   gHistYPtSecondaryAntiProtonsPass->SetStats(kTRUE);
1637   gHistYPtSecondaryAntiProtonsPass->GetXaxis()->SetTitleColor(1);
1638   fQA2DList->Add(gHistYPtSecondaryAntiProtonsPass);//y-pT of secondary accepted ESD antiprotons
1639   TH2D *gHistYPtSecondaryAntiProtonsReject = new TH2D("gHistYPtSecondaryAntiProtonsReject",
1640                                                   ";y;P_{T} [GeV/c]",
1641                                                   fNBinsY,fMinY,fMaxY,
1642                                                   fNBinsPt,fMinPt,fMaxPt);
1643   gHistYPtSecondaryAntiProtonsReject->SetStats(kTRUE);
1644   gHistYPtSecondaryAntiProtonsReject->GetXaxis()->SetTitleColor(1);
1645   fQA2DList->Add(gHistYPtSecondaryAntiProtonsReject);//y-pT of secondary rejected ESD antiprotons
1646
1647   TH2D *gHistYPtPrimaryProtonsMC = new TH2D("gHistYPtPrimaryProtonsMC",
1648                                             ";y;P_{T} [GeV/c]",
1649                                             fNBinsY,fMinY,fMaxY,
1650                                             fNBinsPt,fMinPt,fMaxPt);
1651   gHistYPtPrimaryProtonsMC->SetStats(kTRUE);
1652   gHistYPtPrimaryProtonsMC->GetXaxis()->SetTitleColor(1);
1653   fQA2DList->Add(gHistYPtPrimaryProtonsMC);//y-pT of primary MC protons
1654   TH2D *gHistYPtPrimaryAntiProtonsMC = new TH2D("gHistYPtPrimaryAntiProtonsMC",
1655                                                 ";y;P_{T} [GeV/c]",
1656                                                 fNBinsY,fMinY,fMaxY,
1657                                                 fNBinsPt,fMinPt,fMaxPt);
1658   gHistYPtPrimaryAntiProtonsMC->SetStats(kTRUE);
1659   gHistYPtPrimaryAntiProtonsMC->GetXaxis()->SetTitleColor(1);
1660   fQA2DList->Add(gHistYPtPrimaryAntiProtonsMC);//y-pT of primary MC antiprotons
1661
1662   TH3F *gHistYPtPDGProtonsPass = new TH3F("gHistYPtPDGProtonsPass",
1663                                           ";y;P_{T} [GeV/c];PDG",
1664                                           fNBinsY,fMinY,fMaxY,
1665                                           fNBinsPt,fMinPt,fMaxPt,
1666                                           14,-0.5,13.5);
1667   fQA2DList->Add(gHistYPtPDGProtonsPass);//composition of secondary protons
1668   TH3F *gHistYPtPDGAntiProtonsPass = new TH3F("gHistYPtPDGAntiProtonsPass",
1669                                               ";y;P_{T} [GeV/c];PDG",
1670                                               fNBinsY,fMinY,fMaxY,
1671                                               fNBinsPt,fMinPt,fMaxPt,
1672                                               14,-0.5,13.5);
1673   fQA2DList->Add(gHistYPtPDGAntiProtonsPass);//composition of secondary antiprotons
1674
1675   /*gDirectory->cd("../");
1676   //protons
1677   TDirectory *dirProtons = gDirectory->mkdir("Protons");
1678   fGlobalQAList->Add(dirProtons); dirProtons->cd();*/
1679   
1680   //________________________________________________________________//
1681   /*TDirectory *dirProtonsPrimary = gDirectory->mkdir("Primaries");
1682   dirProtonsPrimary->cd();
1683   TDirectory *dirProtonsPrimaryAccepted = gDirectory->mkdir("Accepted");
1684   dirProtonsPrimaryAccepted->cd();*/
1685
1686   //Accepted primary protons
1687   TH1F *gPrimaryProtonsITSClustersPass = new TH1F("gPrimaryProtonsITSClustersPass",
1688                                             ";N_{clusters} (ITS);Entries",
1689                                             7,0,7);
1690   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsITSClustersPass);
1691   TH1F *gPrimaryProtonsChi2PerClusterITSPass = new TH1F("gPrimaryProtonsChi2PerClusterITSPass",
1692                                                   ";x^{2}/N_{clusters} (ITS);Entries",
1693                                                   100,0,4);
1694   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsChi2PerClusterITSPass);
1695   TH1F *gPrimaryProtonsTPCClustersPass = new TH1F("gPrimaryProtonsTPCClustersPass",
1696                                             ";N_{clusters} (TPC);Entries",
1697                                             100,0,200);
1698   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsTPCClustersPass);
1699   TH1F *gPrimaryProtonsChi2PerClusterTPCPass = new TH1F("gPrimaryProtonsChi2PerClusterTPCPass",
1700                                                   ";x^{2}/N_{clusters} (TPC);Entries",
1701                                                   100,0,4);
1702   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsChi2PerClusterTPCPass);
1703   TH1F *gPrimaryProtonsExtCov11Pass = new TH1F("gPrimaryProtonsExtCov11Pass",
1704                                          ";#sigma_{y} [cm];Entries",
1705                                          100,0,4);
1706   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov11Pass);
1707   TH1F *gPrimaryProtonsExtCov22Pass = new TH1F("gPrimaryProtonsExtCov22Pass",
1708                                          ";#sigma_{z} [cm];Entries",
1709                                          100,0,4);
1710   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov22Pass);
1711   TH1F *gPrimaryProtonsExtCov33Pass = new TH1F("gPrimaryProtonsExtCov33Pass",
1712                                          ";#sigma_{sin(#phi)};Entries",
1713                                          100,0,4);
1714   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov33Pass);
1715   TH1F *gPrimaryProtonsExtCov44Pass = new TH1F("gPrimaryProtonsExtCov44Pass",
1716                                          ";#sigma_{tan(#lambda)};Entries",
1717                                          100,0,4);
1718   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov44Pass);
1719   TH1F *gPrimaryProtonsExtCov55Pass = new TH1F("gPrimaryProtonsExtCov55Pass",
1720                                          ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
1721                                          100,0,4);
1722   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsExtCov55Pass);
1723   TH1F *gPrimaryProtonsSigmaToVertexPass = new TH1F("gPrimaryProtonsSigmaToVertexPass",
1724                                              ";#sigma_{Vertex};Entries",
1725                                              100,0,10);
1726   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsSigmaToVertexPass);
1727   TH1F *gPrimaryProtonsSigmaToVertexTPCPass = new TH1F("gPrimaryProtonsSigmaToVertexTPCPass",
1728                                              ";#sigma_{Vertex};Entries",
1729                                              100,0,10);
1730   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsSigmaToVertexTPCPass);
1731   TH1F *gPrimaryProtonsDCAXYPass = new TH1F("gPrimaryProtonsDCAXYPass",
1732                                              ";DCA_{xy} [cm];Entries",
1733                                              100,0,20);
1734   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsDCAXYPass);
1735   TH1F *gPrimaryProtonsDCAXYTPCPass = new TH1F("gPrimaryProtonsDCAXYTPCPass",
1736                                                ";DCA_{xy} [cm];Entries",
1737                                                100,0,20);
1738   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsDCAXYTPCPass);
1739   TH1F *gPrimaryProtonsDCAZPass = new TH1F("gPrimaryProtonsDCAZPass",
1740                                            ";DCA_{z} [cm];Entries",
1741                                            100,0,20);
1742   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsDCAZPass);
1743   TH1F *gPrimaryProtonsDCAZTPCPass = new TH1F("gPrimaryProtonsDCAZTPCPass",
1744                                               ";DCA_{z} [cm];Entries",
1745                                               100,0,20);
1746   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsDCAZTPCPass);
1747   TH1F *gPrimaryProtonsConstrainChi2Pass = new TH1F("gPrimaryProtonsConstrainChi2Pass",
1748                                                     ";Log_{10}(#chi^{2});Entries",
1749                                                     100,-10,10);
1750   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsConstrainChi2Pass);
1751   TH1F *gPrimaryProtonsITSRefitPass = new TH1F("gPrimaryProtonsITSRefitPass",
1752                                                "",10,-1,1);
1753   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsITSRefitPass);
1754   TH1F *gPrimaryProtonsTPCRefitPass = new TH1F("gPrimaryProtonsTPCRefitPass",
1755                                                "",10,-1,1);
1756   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsTPCRefitPass);
1757   TH1F *gPrimaryProtonsESDpidPass = new TH1F("gPrimaryProtonsESDpidPass",
1758                                              "",10,-1,1);
1759   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsESDpidPass);
1760   TH1F *gPrimaryProtonsTPCpidPass = new TH1F("gPrimaryProtonsTPCpidPass",
1761                                              "",10,-1,1);
1762   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsTPCpidPass);
1763   TH1F *gPrimaryProtonsPointOnITSLayer1Pass = new TH1F("gPrimaryProtonsPointOnITSLayer1Pass",
1764                                              "",10,-1,1);
1765   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer1Pass);
1766   TH1F *gPrimaryProtonsPointOnITSLayer2Pass = new TH1F("gPrimaryProtonsPointOnITSLayer2Pass",
1767                                              "",10,-1,1);
1768   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer2Pass);
1769   TH1F *gPrimaryProtonsPointOnITSLayer3Pass = new TH1F("gPrimaryProtonsPointOnITSLayer3Pass",
1770                                              "",10,-1,1);
1771   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer3Pass);
1772   TH1F *gPrimaryProtonsPointOnITSLayer4Pass = new TH1F("gPrimaryProtonsPointOnITSLayer4Pass",
1773                                              "",10,-1,1);
1774   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer4Pass);
1775   TH1F *gPrimaryProtonsPointOnITSLayer5Pass = new TH1F("gPrimaryProtonsPointOnITSLayer5Pass",
1776                                              "",10,-1,1);
1777   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer5Pass);
1778   TH1F *gPrimaryProtonsPointOnITSLayer6Pass = new TH1F("gPrimaryProtonsPointOnITSLayer6Pass",
1779                                              "",10,-1,1);
1780   fQAPrimaryProtonsAcceptedList->Add(gPrimaryProtonsPointOnITSLayer6Pass);
1781
1782   //Rejected primary protons
1783   /*gDirectory->cd("../");
1784   TDirectory *dirProtonsPrimaryRejected = gDirectory->mkdir("Rejected");
1785   dirProtonsPrimaryRejected->cd();*/
1786
1787   TH1F *gPrimaryProtonsITSClustersReject = new TH1F("gPrimaryProtonsITSClustersReject",
1788                                                     ";N_{clusters} (ITS);Entries",
1789                                                     7,0,7);
1790   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsITSClustersReject);
1791   TH1F *gPrimaryProtonsChi2PerClusterITSReject = new TH1F("gPrimaryProtonsChi2PerClusterITSReject",
1792                                                           ";x^{2}/N_{clusters} (ITS);Entries",
1793                                                           100,0,4);
1794   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsChi2PerClusterITSReject);
1795   TH1F *gPrimaryProtonsTPCClustersReject = new TH1F("gPrimaryProtonsTPCClustersReject",
1796                                             ";N_{clusters} (TPC);Entries",
1797                                             100,0,200);
1798   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsTPCClustersReject);
1799   TH1F *gPrimaryProtonsChi2PerClusterTPCReject = new TH1F("gPrimaryProtonsChi2PerClusterTPCReject",
1800                                                   ";x^{2}/N_{clusters} (TPC);Entries",
1801                                                   100,0,4);
1802   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsChi2PerClusterTPCReject);
1803   TH1F *gPrimaryProtonsExtCov11Reject = new TH1F("gPrimaryProtonsExtCov11Reject",
1804                                          ";#sigma_{y} [cm];Entries",
1805                                          100,0,4);
1806   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov11Reject);
1807   TH1F *gPrimaryProtonsExtCov22Reject = new TH1F("gPrimaryProtonsExtCov22Reject",
1808                                          ";#sigma_{z} [cm];Entries",
1809                                          100,0,4);
1810   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov22Reject);
1811   TH1F *gPrimaryProtonsExtCov33Reject = new TH1F("gPrimaryProtonsExtCov33Reject",
1812                                          ";#sigma_{sin(#phi)};Entries",
1813                                          100,0,4);
1814   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov33Reject);
1815   TH1F *gPrimaryProtonsExtCov44Reject = new TH1F("gPrimaryProtonsExtCov44Reject",
1816                                          ";#sigma_{tan(#lambda)};Entries",
1817                                          100,0,4);
1818   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov44Reject);
1819   TH1F *gPrimaryProtonsExtCov55Reject = new TH1F("gPrimaryProtonsExtCov55Reject",
1820                                          ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
1821                                          100,0,4);
1822   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsExtCov55Reject);
1823   TH1F *gPrimaryProtonsSigmaToVertexReject = new TH1F("gPrimaryProtonsSigmaToVertexReject",
1824                                              ";#sigma_{Vertex};Entries",
1825                                              100,0,10);
1826   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsSigmaToVertexReject);
1827   TH1F *gPrimaryProtonsSigmaToVertexTPCReject = new TH1F("gPrimaryProtonsSigmaToVertexTPCReject",
1828                                              ";#sigma_{Vertex};Entries",
1829                                              100,0,10);
1830   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsSigmaToVertexTPCReject);
1831   TH1F *gPrimaryProtonsDCAXYReject = new TH1F("gPrimaryProtonsDCAXYReject",
1832                                               ";DCA_{xy} [cm];Entries",
1833                                               100,0,20);
1834   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsDCAXYReject);
1835   TH1F *gPrimaryProtonsDCAXYTPCReject = new TH1F("gPrimaryProtonsDCAXYTPCReject",
1836                                                  ";DCA_{xy} [cm];Entries",
1837                                                  100,0,20);
1838   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsDCAXYTPCReject);
1839   TH1F *gPrimaryProtonsDCAZReject = new TH1F("gPrimaryProtonsDCAZReject",
1840                                              ";DCA_{z} [cm];Entries",
1841                                              100,0,20);
1842   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsDCAZReject);
1843   TH1F *gPrimaryProtonsDCAZTPCReject = new TH1F("gPrimaryProtonsDCAZTPCReject",
1844                                                 ";DCA_{z} [cm];Entries",
1845                                                 100,0,20);
1846   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsDCAZTPCReject);
1847   TH1F *gPrimaryProtonsConstrainChi2Reject = new TH1F("gPrimaryProtonsConstrainChi2Reject",
1848                                                     ";Log_{10}(#chi^{2});Entries",
1849                                                     100,-10,10);
1850   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsConstrainChi2Reject);
1851   TH1F *gPrimaryProtonsITSRefitReject = new TH1F("gPrimaryProtonsITSRefitReject",
1852                                                  "",10,-1,1);
1853   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsITSRefitReject);
1854   TH1F *gPrimaryProtonsTPCRefitReject = new TH1F("gPrimaryProtonsTPCRefitReject",
1855                                                  "",10,-1,1);
1856   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsTPCRefitReject);
1857   TH1F *gPrimaryProtonsESDpidReject = new TH1F("gPrimaryProtonsESDpidReject",
1858                                                "",10,-1,1);
1859   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsESDpidReject);
1860   TH1F *gPrimaryProtonsTPCpidReject = new TH1F("gPrimaryProtonsTPCpidReject",
1861                                                "",10,-1,1);
1862   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsTPCpidReject);
1863   TH1F *gPrimaryProtonsPointOnITSLayer1Reject = new TH1F("gPrimaryProtonsPointOnITSLayer1Reject",
1864                                              "",10,-1,1);
1865   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer1Reject);
1866   TH1F *gPrimaryProtonsPointOnITSLayer2Reject = new TH1F("gPrimaryProtonsPointOnITSLayer2Reject",
1867                                              "",10,-1,1);
1868   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer2Reject);
1869   TH1F *gPrimaryProtonsPointOnITSLayer3Reject = new TH1F("gPrimaryProtonsPointOnITSLayer3Reject",
1870                                              "",10,-1,1);
1871   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer3Reject);
1872   TH1F *gPrimaryProtonsPointOnITSLayer4Reject = new TH1F("gPrimaryProtonsPointOnITSLayer4Reject",
1873                                              "",10,-1,1);
1874   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer4Reject);
1875   TH1F *gPrimaryProtonsPointOnITSLayer5Reject = new TH1F("gPrimaryProtonsPointOnITSLayer5Reject",
1876                                              "",10,-1,1);
1877   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer5Reject);
1878   TH1F *gPrimaryProtonsPointOnITSLayer6Reject = new TH1F("gPrimaryProtonsPointOnITSLayer6Reject",
1879                                              "",10,-1,1);
1880   fQAPrimaryProtonsRejectedList->Add(gPrimaryProtonsPointOnITSLayer6Reject);
1881
1882   //________________________________________________________________//
1883   /*gDirectory->cd("../../");
1884
1885   TDirectory *dirProtonsSecondary = gDirectory->mkdir("Secondaries");
1886   dirProtonsSecondary->cd();
1887   TDirectory *dirProtonsSecondaryAccepted = gDirectory->mkdir("Accepted");
1888   dirProtonsSecondaryAccepted->cd();*/
1889
1890   //Accepted secondary protons
1891   TH1F *gSecondaryProtonsITSClustersPass = new TH1F("gSecondaryProtonsITSClustersPass",
1892                                                     ";N_{clusters} (ITS);Entries",
1893                                                     7,0,7);
1894   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsITSClustersPass);
1895   TH1F *gSecondaryProtonsChi2PerClusterITSPass = new TH1F("gSecondaryProtonsChi2PerClusterITSPass",
1896                                                           ";x^{2}/N_{clusters} (ITS);Entries",
1897                                                           100,0,4);
1898   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsChi2PerClusterITSPass);
1899   TH1F *gSecondaryProtonsTPCClustersPass = new TH1F("gSecondaryProtonsTPCClustersPass",
1900                                             ";N_{clusters} (TPC);Entries",
1901                                             100,0,200);
1902   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsTPCClustersPass);
1903   TH1F *gSecondaryProtonsChi2PerClusterTPCPass = new TH1F("gSecondaryProtonsChi2PerClusterTPCPass",
1904                                                   ";x^{2}/N_{clusters} (TPC);Entries",
1905                                                   100,0,4);
1906   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsChi2PerClusterTPCPass);
1907   TH1F *gSecondaryProtonsExtCov11Pass = new TH1F("gSecondaryProtonsExtCov11Pass",
1908                                          ";#sigma_{y} [cm];Entries",
1909                                          100,0,4);
1910   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov11Pass);
1911   TH1F *gSecondaryProtonsExtCov22Pass = new TH1F("gSecondaryProtonsExtCov22Pass",
1912                                          ";#sigma_{z} [cm];Entries",
1913                                          100,0,4);
1914   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov22Pass);
1915   TH1F *gSecondaryProtonsExtCov33Pass = new TH1F("gSecondaryProtonsExtCov33Pass",
1916                                          ";#sigma_{sin(#phi)};Entries",
1917                                          100,0,4);
1918   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov33Pass);
1919   TH1F *gSecondaryProtonsExtCov44Pass = new TH1F("gSecondaryProtonsExtCov44Pass",
1920                                          ";#sigma_{tan(#lambda)};Entries",
1921                                          100,0,4);
1922   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov44Pass);
1923   TH1F *gSecondaryProtonsExtCov55Pass = new TH1F("gSecondaryProtonsExtCov55Pass",
1924                                          ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
1925                                          100,0,4);
1926   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsExtCov55Pass);
1927   TH1F *gSecondaryProtonsSigmaToVertexPass = new TH1F("gSecondaryProtonsSigmaToVertexPass",
1928                                              ";#sigma_{Vertex};Entries",
1929                                              100,0,10);
1930   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsSigmaToVertexPass);
1931   TH1F *gSecondaryProtonsSigmaToVertexTPCPass = new TH1F("gSecondaryProtonsSigmaToVertexTPCPass",
1932                                              ";#sigma_{Vertex};Entries",
1933                                              100,0,10);
1934   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsSigmaToVertexTPCPass);
1935   TH1F *gSecondaryProtonsDCAXYPass = new TH1F("gSecondaryProtonsDCAXYPass",
1936                                               ";DCA_{xy} [cm];Entries",
1937                                               100,0,20);
1938   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsDCAXYPass);
1939   TH1F *gSecondaryProtonsDCAXYTPCPass = new TH1F("gSecondaryProtonsDCAXYTPCPass",
1940                                                  ";DCA_{xy} [cm];Entries",
1941                                                  100,0,20);
1942   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsDCAXYTPCPass);
1943   TH1F *gSecondaryProtonsDCAZPass = new TH1F("gSecondaryProtonsDCAZPass",
1944                                              ";DCA_{z} [cm];Entries",
1945                                              100,0,20);
1946   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsDCAZPass);
1947   TH1F *gSecondaryProtonsDCAZTPCPass = new TH1F("gSecondaryProtonsDCAZTPCPass",
1948                                                 ";DCA_{z} [cm];Entries",
1949                                                 100,0,20);
1950   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsDCAZTPCPass);
1951   TH1F *gSecondaryProtonsConstrainChi2Pass = new TH1F("gSecondaryProtonsConstrainChi2Pass",
1952                                                     ";Log_{10}(#chi^{2});Entries",
1953                                                     100,-10,10);
1954   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsConstrainChi2Pass);
1955   TH1F *gSecondaryProtonsITSRefitPass = new TH1F("gSecondaryProtonsITSRefitPass",
1956                                                  "",10,-1,1);
1957   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsITSRefitPass);
1958   TH1F *gSecondaryProtonsTPCRefitPass = new TH1F("gSecondaryProtonsTPCRefitPass",
1959                                                  "",10,-1,1);
1960   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsTPCRefitPass);
1961   TH1F *gSecondaryProtonsESDpidPass = new TH1F("gSecondaryProtonsESDpidPass",
1962                                                "",10,-1,1);
1963   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsESDpidPass);
1964   TH1F *gSecondaryProtonsTPCpidPass = new TH1F("gSecondaryProtonsTPCpidPass",
1965                                                "",10,-1,1);
1966   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsTPCpidPass);
1967   TH1F *gSecondaryProtonsPointOnITSLayer1Pass = new TH1F("gSecondaryProtonsPointOnITSLayer1Pass",
1968                                                          "",10,-1,1);
1969   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer1Pass);
1970   TH1F *gSecondaryProtonsPointOnITSLayer2Pass = new TH1F("gSecondaryProtonsPointOnITSLayer2Pass",
1971                                                          "",10,-1,1);
1972   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer2Pass);
1973   TH1F *gSecondaryProtonsPointOnITSLayer3Pass = new TH1F("gSecondaryProtonsPointOnITSLayer3Pass",
1974                                                          "",10,-1,1);
1975   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer3Pass);
1976   TH1F *gSecondaryProtonsPointOnITSLayer4Pass = new TH1F("gSecondaryProtonsPointOnITSLayer4Pass",
1977                                                          "",10,-1,1);
1978   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer4Pass);
1979   TH1F *gSecondaryProtonsPointOnITSLayer5Pass = new TH1F("gSecondaryProtonsPointOnITSLayer5Pass",
1980                                                          "",10,-1,1);
1981   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer5Pass);
1982   TH1F *gSecondaryProtonsPointOnITSLayer6Pass = new TH1F("gSecondaryProtonsPointOnITSLayer6Pass",
1983                                                          "",10,-1,1);
1984   fQASecondaryProtonsAcceptedList->Add(gSecondaryProtonsPointOnITSLayer6Pass);
1985
1986   //Rejected secondary protons
1987   /*gDirectory->cd("../");
1988   TDirectory *dirProtonsSecondaryRejected = gDirectory->mkdir("Rejected");
1989   dirProtonsSecondaryRejected->cd();*/
1990
1991   TH1F *gSecondaryProtonsITSClustersReject = new TH1F("gSecondaryProtonsITSClustersReject",
1992                                                       ";N_{clusters} (ITS);Entries",
1993                                                       7,0,7);
1994   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsITSClustersReject);
1995   TH1F *gSecondaryProtonsChi2PerClusterITSReject = new TH1F("gSecondaryProtonsChi2PerClusterITSReject",
1996                                                             ";x^{2}/N_{clusters} (ITS);Entries",
1997                                                             100,0,4);
1998   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsChi2PerClusterITSReject);
1999   TH1F *gSecondaryProtonsTPCClustersReject = new TH1F("gSecondaryProtonsTPCClustersReject",
2000                                             ";N_{clusters} (TPC);Entries",
2001                                             100,0,200);
2002   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsTPCClustersReject);
2003   TH1F *gSecondaryProtonsChi2PerClusterTPCReject = new TH1F("gSecondaryProtonsChi2PerClusterTPCReject",
2004                                                   ";x^{2}/N_{clusters} (TPC);Entries",
2005                                                   100,0,4);
2006   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsChi2PerClusterTPCReject);
2007   TH1F *gSecondaryProtonsExtCov11Reject = new TH1F("gSecondaryProtonsExtCov11Reject",
2008                                          ";#sigma_{y} [cm];Entries",
2009                                          100,0,4);
2010   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov11Reject);
2011   TH1F *gSecondaryProtonsExtCov22Reject = new TH1F("gSecondaryProtonsExtCov22Reject",
2012                                          ";#sigma_{z} [cm];Entries",
2013                                          100,0,4);
2014   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov22Reject);
2015   TH1F *gSecondaryProtonsExtCov33Reject = new TH1F("gSecondaryProtonsExtCov33Reject",
2016                                          ";#sigma_{sin(#phi)};Entries",
2017                                          100,0,4);
2018   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov33Reject);
2019   TH1F *gSecondaryProtonsExtCov44Reject = new TH1F("gSecondaryProtonsExtCov44Reject",
2020                                          ";#sigma_{tan(#lambda)};Entries",
2021                                          100,0,4);
2022   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov44Reject);
2023   TH1F *gSecondaryProtonsExtCov55Reject = new TH1F("gSecondaryProtonsExtCov55Reject",
2024                                          ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2025                                          100,0,4);
2026   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsExtCov55Reject);
2027   TH1F *gSecondaryProtonsSigmaToVertexReject = new TH1F("gSecondaryProtonsSigmaToVertexReject",
2028                                              ";#sigma_{Vertex};Entries",
2029                                              100,0,10);
2030   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsSigmaToVertexReject);
2031   TH1F *gSecondaryProtonsSigmaToVertexTPCReject = new TH1F("gSecondaryProtonsSigmaToVertexTPCReject",
2032                                                            ";#sigma_{Vertex};Entries",
2033                                                            100,0,10);
2034   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsSigmaToVertexTPCReject);
2035   TH1F *gSecondaryProtonsDCAXYReject = new TH1F("gSecondaryProtonsDCAXYReject",
2036                                                 ";DCA_{xy} [cm];Entries",
2037                                                 100,0,20);
2038   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsDCAXYReject);
2039   TH1F *gSecondaryProtonsDCAXYTPCReject = new TH1F("gSecondaryProtonsDCAXYTPCReject",
2040                                                    ";DCA_{xy} [cm];Entries",
2041                                                    100,0,20);
2042   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsDCAXYTPCReject);
2043   TH1F *gSecondaryProtonsDCAZReject = new TH1F("gSecondaryProtonsDCAZReject",
2044                                                ";DCA_{z} [cm];Entries",
2045                                                100,0,20);
2046   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsDCAZReject);
2047   TH1F *gSecondaryProtonsDCAZTPCReject = new TH1F("gSecondaryProtonsDCAZTPCReject",
2048                                                   ";DCA_{z} [cm];Entries",
2049                                                   100,0,20);
2050   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsDCAZTPCReject);
2051   TH1F *gSecondaryProtonsConstrainChi2Reject = new TH1F("gSecondaryProtonsConstrainChi2Reject",
2052                                                         ";Log_{10}(#chi^{2});Entries",
2053                                                         100,-10,10);
2054   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsConstrainChi2Reject);
2055   TH1F *gSecondaryProtonsITSRefitReject = new TH1F("gSecondaryProtonsITSRefitReject",
2056                                                    "",10,-1,1);
2057   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsITSRefitReject);
2058   TH1F *gSecondaryProtonsTPCRefitReject = new TH1F("gSecondaryProtonsTPCRefitReject",
2059                                                    "",10,-1,1);
2060   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsTPCRefitReject);
2061   TH1F *gSecondaryProtonsESDpidReject = new TH1F("gSecondaryProtonsESDpidReject",
2062                                                  "",10,-1,1);
2063   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsESDpidReject);
2064   TH1F *gSecondaryProtonsTPCpidReject = new TH1F("gSecondaryProtonsTPCpidReject",
2065                                                  "",10,-1,1);
2066   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsTPCpidReject);
2067   TH1F *gSecondaryProtonsPointOnITSLayer1Reject = new TH1F("gSecondaryProtonsPointOnITSLayer1Reject",
2068                                                            "",10,-1,1);
2069   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer1Reject);
2070   TH1F *gSecondaryProtonsPointOnITSLayer2Reject = new TH1F("gSecondaryProtonsPointOnITSLayer2Reject",
2071                                                            "",10,-1,1);
2072   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer2Reject);
2073   TH1F *gSecondaryProtonsPointOnITSLayer3Reject = new TH1F("gSecondaryProtonsPointOnITSLayer3Reject",
2074                                                            "",10,-1,1);
2075   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer3Reject);
2076   TH1F *gSecondaryProtonsPointOnITSLayer4Reject = new TH1F("gSecondaryProtonsPointOnITSLayer4Reject",
2077                                                            "",10,-1,1);
2078   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer4Reject);
2079   TH1F *gSecondaryProtonsPointOnITSLayer5Reject = new TH1F("gSecondaryProtonsPointOnITSLayer5Reject",
2080                                                            "",10,-1,1);
2081   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer5Reject);
2082   TH1F *gSecondaryProtonsPointOnITSLayer6Reject = new TH1F("gSecondaryProtonsPointOnITSLayer6Reject",
2083                                                            "",10,-1,1);
2084   fQASecondaryProtonsRejectedList->Add(gSecondaryProtonsPointOnITSLayer6Reject);
2085   
2086
2087   /*gDirectory->cd("../../../");
2088
2089   //antiprotons
2090   TDirectory *dirAntiProtons = gDirectory->mkdir("AntiProtons");
2091   fGlobalQAList->Add(dirAntiProtons); dirAntiProtons->cd();*/
2092   
2093   //________________________________________________________________//
2094   /*TDirectory *dirAntiProtonsPrimary = gDirectory->mkdir("Primaries");
2095   dirAntiProtonsPrimary->cd();
2096   TDirectory *dirAntiProtonsPrimaryAccepted = gDirectory->mkdir("Accepted");
2097   dirAntiProtonsPrimaryAccepted->cd();*/
2098   
2099   //Accepted primary antiprotons
2100   TH1F *gPrimaryAntiProtonsITSClustersPass = new TH1F("gPrimaryAntiProtonsITSClustersPass",
2101                                                       ";N_{clusters} (ITS);Entries",
2102                                                       7,0,7);
2103   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsITSClustersPass);
2104   TH1F *gPrimaryAntiProtonsChi2PerClusterITSPass = new TH1F("gPrimaryAntiProtonsChi2PerClusterITSPass",
2105                                                             ";x^{2}/N_{clusters} (ITS);Entries",
2106                                                             100,0,4);
2107   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsChi2PerClusterITSPass);
2108   TH1F *gPrimaryAntiProtonsTPCClustersPass = new TH1F("gPrimaryAntiProtonsTPCClustersPass",
2109                                                       ";N_{clusters} (TPC);Entries",
2110                                                       100,0,200);
2111   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsTPCClustersPass);
2112   TH1F *gPrimaryAntiProtonsChi2PerClusterTPCPass = new TH1F("gPrimaryAntiProtonsChi2PerClusterTPCPass",
2113                                                             ";x^{2}/N_{clusters} (TPC);Entries",
2114                                                             100,0,4);
2115   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsChi2PerClusterTPCPass);
2116   TH1F *gPrimaryAntiProtonsExtCov11Pass = new TH1F("gPrimaryAntiProtonsExtCov11Pass",
2117                                                    ";#sigma_{y} [cm];Entries",
2118                                                    100,0,4);
2119   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov11Pass);
2120   TH1F *gPrimaryAntiProtonsExtCov22Pass = new TH1F("gPrimaryAntiProtonsExtCov22Pass",
2121                                                    ";#sigma_{z} [cm];Entries",
2122                                                    100,0,4);
2123   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov22Pass);
2124   TH1F *gPrimaryAntiProtonsExtCov33Pass = new TH1F("gPrimaryAntiProtonsExtCov33Pass",
2125                                                    ";#sigma_{sin(#phi)};Entries",
2126                                                    100,0,4);
2127   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov33Pass);
2128   TH1F *gPrimaryAntiProtonsExtCov44Pass = new TH1F("gPrimaryAntiProtonsExtCov44Pass",
2129                                                    ";#sigma_{tan(#lambda)};Entries",
2130                                                    100,0,4);
2131   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov44Pass);
2132   TH1F *gPrimaryAntiProtonsExtCov55Pass = new TH1F("gPrimaryAntiProtonsExtCov55Pass",
2133                                                    ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2134                                                    100,0,4);
2135   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsExtCov55Pass);
2136   TH1F *gPrimaryAntiProtonsSigmaToVertexPass = new TH1F("gPrimaryAntiProtonsSigmaToVertexPass",
2137                                                         ";#sigma_{Vertex};Entries",
2138                                                         100,0,10);
2139   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsSigmaToVertexPass);
2140   TH1F *gPrimaryAntiProtonsSigmaToVertexTPCPass = new TH1F("gPrimaryAntiProtonsSigmaToVertexTPCPass",
2141                                                            ";#sigma_{Vertex};Entries",
2142                                                            100,0,10);
2143   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsSigmaToVertexTPCPass);
2144   TH1F *gPrimaryAntiProtonsDCAXYPass = new TH1F("gPrimaryAntiProtonsDCAXYPass",
2145                                                 ";DCA_{xy} [cm];Entries",
2146                                                 100,0,20);
2147   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsDCAXYPass);
2148   TH1F *gPrimaryAntiProtonsDCAXYTPCPass = new TH1F("gPrimaryAntiProtonsDCAXYTPCPass",
2149                                                    ";DCA_{xy} [cm];Entries",
2150                                                    100,0,20);
2151   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsDCAXYTPCPass);
2152   TH1F *gPrimaryAntiProtonsDCAZPass = new TH1F("gPrimaryAntiProtonsDCAZPass",
2153                                                ";DCA_{z} [cm];Entries",
2154                                                100,0,20);
2155   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsDCAZPass);
2156   TH1F *gPrimaryAntiProtonsDCAZTPCPass = new TH1F("gPrimaryAntiProtonsDCAZTPCPass",
2157                                                   ";DCA_{z} [cm];Entries",
2158                                                   100,0,20);
2159   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsDCAZTPCPass);
2160   TH1F *gPrimaryAntiProtonsConstrainChi2Pass = new TH1F("gPrimaryAntiProtonsConstrainChi2Pass",
2161                                                         ";Log_{10}(#chi^{2});Entries",
2162                                                         100,-10,10);
2163   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsConstrainChi2Pass);
2164   TH1F *gPrimaryAntiProtonsITSRefitPass = new TH1F("gPrimaryAntiProtonsITSRefitPass",
2165                                                    "",10,-1,1);
2166   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsITSRefitPass);
2167   TH1F *gPrimaryAntiProtonsTPCRefitPass = new TH1F("gPrimaryAntiProtonsTPCRefitPass",
2168                                                    "",10,-1,1);
2169   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsTPCRefitPass);
2170   TH1F *gPrimaryAntiProtonsESDpidPass = new TH1F("gPrimaryAntiProtonsESDpidPass",
2171                                                  "",10,-1,1);
2172   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsESDpidPass);
2173   TH1F *gPrimaryAntiProtonsTPCpidPass = new TH1F("gPrimaryAntiProtonsTPCpidPass",
2174                                                  "",10,-1,1);
2175   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsTPCpidPass);
2176   TH1F *gPrimaryAntiProtonsPointOnITSLayer1Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer1Pass",
2177                                                            "",10,-1,1);
2178   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer1Pass);
2179   TH1F *gPrimaryAntiProtonsPointOnITSLayer2Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer2Pass",
2180                                                            "",10,-1,1);
2181   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer2Pass);
2182   TH1F *gPrimaryAntiProtonsPointOnITSLayer3Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer3Pass",
2183                                                            "",10,-1,1);
2184   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer3Pass);
2185   TH1F *gPrimaryAntiProtonsPointOnITSLayer4Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer4Pass",
2186                                                            "",10,-1,1);
2187   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer4Pass);
2188   TH1F *gPrimaryAntiProtonsPointOnITSLayer5Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer5Pass",
2189                                                            "",10,-1,1);
2190   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer5Pass);
2191   TH1F *gPrimaryAntiProtonsPointOnITSLayer6Pass = new TH1F("gPrimaryAntiProtonsPointOnITSLayer6Pass",
2192                                                            "",10,-1,1);
2193   fQAPrimaryAntiProtonsAcceptedList->Add(gPrimaryAntiProtonsPointOnITSLayer6Pass);
2194   
2195   //Rejected primary antiprotons
2196   /*gDirectory->cd("../");
2197   TDirectory *dirAntiProtonsPrimaryRejected = gDirectory->mkdir("Rejected");
2198   dirAntiProtonsPrimaryRejected->cd();*/
2199   
2200   TH1F *gPrimaryAntiProtonsITSClustersReject = new TH1F("gPrimaryAntiProtonsITSClustersReject",
2201                                                         ";N_{clusters} (ITS);Entries",
2202                                                         7,0,7);
2203   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsITSClustersReject);
2204   TH1F *gPrimaryAntiProtonsChi2PerClusterITSReject = new TH1F("gPrimaryAntiProtonsChi2PerClusterITSReject",
2205                                                               ";x^{2}/N_{clusters} (ITS);Entries",
2206                                                               100,0,4);
2207   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsChi2PerClusterITSReject);
2208   TH1F *gPrimaryAntiProtonsTPCClustersReject = new TH1F("gPrimaryAntiProtonsTPCClustersReject",
2209                                                         ";N_{clusters} (TPC);Entries",
2210                                                         100,0,200);
2211   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsTPCClustersReject);
2212   TH1F *gPrimaryAntiProtonsChi2PerClusterTPCReject = new TH1F("gPrimaryAntiProtonsChi2PerClusterTPCReject",
2213                                                               ";x^{2}/N_{clusters} (TPC);Entries",
2214                                                               100,0,4);
2215   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsChi2PerClusterTPCReject);
2216   TH1F *gPrimaryAntiProtonsExtCov11Reject = new TH1F("gPrimaryAntiProtonsExtCov11Reject",
2217                                                      ";#sigma_{y} [cm];Entries",
2218                                                      100,0,4);
2219   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov11Reject);
2220   TH1F *gPrimaryAntiProtonsExtCov22Reject = new TH1F("gPrimaryAntiProtonsExtCov22Reject",
2221                                                      ";#sigma_{z} [cm];Entries",
2222                                                      100,0,4);
2223   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov22Reject);
2224   TH1F *gPrimaryAntiProtonsExtCov33Reject = new TH1F("gPrimaryAntiProtonsExtCov33Reject",
2225                                                      ";#sigma_{sin(#phi)};Entries",
2226                                                      100,0,4);
2227   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov33Reject);
2228   TH1F *gPrimaryAntiProtonsExtCov44Reject = new TH1F("gPrimaryAntiProtonsExtCov44Reject",
2229                                                      ";#sigma_{tan(#lambda)};Entries",
2230                                                      100,0,4);
2231   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov44Reject);
2232   TH1F *gPrimaryAntiProtonsExtCov55Reject = new TH1F("gPrimaryAntiProtonsExtCov55Reject",
2233                                                      ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2234                                                      100,0,4);
2235   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsExtCov55Reject);
2236   TH1F *gPrimaryAntiProtonsSigmaToVertexReject = new TH1F("gPrimaryAntiProtonsSigmaToVertexReject",
2237                                                           ";#sigma_{Vertex};Entries",
2238                                                           100,0,10);
2239   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsSigmaToVertexReject);
2240   TH1F *gPrimaryAntiProtonsSigmaToVertexTPCReject = new TH1F("gPrimaryAntiProtonsSigmaToVertexTPCReject",
2241                                                              ";#sigma_{Vertex};Entries",
2242                                                              100,0,10);
2243   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsSigmaToVertexTPCReject);
2244   TH1F *gPrimaryAntiProtonsDCAXYReject = new TH1F("gPrimaryAntiProtonsDCAXYReject",
2245                                                   ";DCA_{xy} [cm];Entries",
2246                                                   100,0,20);
2247   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsDCAXYReject);
2248   TH1F *gPrimaryAntiProtonsDCAXYTPCReject = new TH1F("gPrimaryAntiProtonsDCAXYTPCReject",
2249                                                      ";DCA_{xy} [cm];Entries",
2250                                                      100,0,20);
2251   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsDCAXYTPCReject);
2252   TH1F *gPrimaryAntiProtonsDCAZReject = new TH1F("gPrimaryAntiProtonsDCAZReject",
2253                                                  ";DCA_{z} [cm];Entries",
2254                                                  100,0,20);
2255   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsDCAZReject);
2256   TH1F *gPrimaryAntiProtonsDCAZTPCReject = new TH1F("gPrimaryAntiProtonsDCAZTPCReject",
2257                                                     ";DCA_{z} [cm];Entries",
2258                                                     100,0,20);
2259   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsDCAZTPCReject);
2260   TH1F *gPrimaryAntiProtonsConstrainChi2Reject = new TH1F("gPrimaryAntiProtonsConstrainChi2Reject",
2261                                                           ";Log_{10}(#chi^{2});Entries",
2262                                                           100,-10,10);
2263   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsConstrainChi2Reject);
2264   TH1F *gPrimaryAntiProtonsITSRefitReject = new TH1F("gPrimaryAntiProtonsITSRefitReject",
2265                                                      "",10,-1,1);
2266   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsITSRefitReject);
2267   TH1F *gPrimaryAntiProtonsTPCRefitReject = new TH1F("gPrimaryAntiProtonsTPCRefitReject",
2268                                                      "",10,-1,1);
2269   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsTPCRefitReject);
2270   TH1F *gPrimaryAntiProtonsESDpidReject = new TH1F("gPrimaryAntiProtonsESDpidReject",
2271                                                    "",10,-1,1);
2272   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsESDpidReject);
2273   TH1F *gPrimaryAntiProtonsTPCpidReject = new TH1F("gPrimaryAntiProtonsTPCpidReject",
2274                                                    "",10,-1,1);
2275   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsTPCpidReject);
2276   TH1F *gPrimaryAntiProtonsPointOnITSLayer1Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer1Reject",
2277                                                              "",10,-1,1);
2278   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer1Reject);
2279   TH1F *gPrimaryAntiProtonsPointOnITSLayer2Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer2Reject",
2280                                                              "",10,-1,1);
2281   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer2Reject);
2282   TH1F *gPrimaryAntiProtonsPointOnITSLayer3Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer3Reject",
2283                                                              "",10,-1,1);
2284   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer3Reject);
2285   TH1F *gPrimaryAntiProtonsPointOnITSLayer4Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer4Reject",
2286                                                              "",10,-1,1);
2287   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer4Reject);
2288   TH1F *gPrimaryAntiProtonsPointOnITSLayer5Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer5Reject",
2289                                                              "",10,-1,1);
2290   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer5Reject);
2291   TH1F *gPrimaryAntiProtonsPointOnITSLayer6Reject = new TH1F("gPrimaryAntiProtonsPointOnITSLayer6Reject",
2292                                                              "",10,-1,1);
2293   fQAPrimaryAntiProtonsRejectedList->Add(gPrimaryAntiProtonsPointOnITSLayer6Reject);
2294   
2295   //________________________________________________________________//
2296   /*gDirectory->cd("../../");
2297
2298   TDirectory *dirAntiProtonsSecondary = gDirectory->mkdir("Secondaries");
2299   dirAntiProtonsSecondary->cd();
2300   TDirectory *dirAntiProtonsSecondaryAccepted = gDirectory->mkdir("Accepted");
2301   dirAntiProtonsSecondaryAccepted->cd();*/
2302
2303   //Accepted secondary antiprotons
2304   TH1F *gSecondaryAntiProtonsITSClustersPass = new TH1F("gSecondaryAntiProtonsITSClustersPass",
2305                                                         ";N_{clusters} (ITS);Entries",
2306                                                         7,0,7);
2307   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsITSClustersPass);
2308   TH1F *gSecondaryAntiProtonsChi2PerClusterITSPass = new TH1F("gSecondaryAntiProtonsChi2PerClusterITSPass",
2309                                                               ";x^{2}/N_{clusters} (ITS);Entries",
2310                                                               100,0,4);
2311   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsChi2PerClusterITSPass);
2312   TH1F *gSecondaryAntiProtonsTPCClustersPass = new TH1F("gSecondaryAntiProtonsTPCClustersPass",
2313                                                         ";N_{clusters} (TPC);Entries",
2314                                                         100,0,200);
2315   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsTPCClustersPass);
2316   TH1F *gSecondaryAntiProtonsChi2PerClusterTPCPass = new TH1F("gSecondaryAntiProtonsChi2PerClusterTPCPass",
2317                                                               ";x^{2}/N_{clusters} (TPC);Entries",
2318                                                               100,0,4);
2319   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsChi2PerClusterTPCPass);
2320   TH1F *gSecondaryAntiProtonsExtCov11Pass = new TH1F("gSecondaryAntiProtonsExtCov11Pass",
2321                                                      ";#sigma_{y} [cm];Entries",
2322                                                      100,0,4);
2323   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov11Pass);
2324   TH1F *gSecondaryAntiProtonsExtCov22Pass = new TH1F("gSecondaryAntiProtonsExtCov22Pass",
2325                                                      ";#sigma_{z} [cm];Entries",
2326                                                      100,0,4);
2327   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov22Pass);
2328   TH1F *gSecondaryAntiProtonsExtCov33Pass = new TH1F("gSecondaryAntiProtonsExtCov33Pass",
2329                                                      ";#sigma_{sin(#phi)};Entries",
2330                                                      100,0,4);
2331   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov33Pass);
2332   TH1F *gSecondaryAntiProtonsExtCov44Pass = new TH1F("gSecondaryAntiProtonsExtCov44Pass",
2333                                                      ";#sigma_{tan(#lambda)};Entries",
2334                                                      100,0,4);
2335   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov44Pass);
2336   TH1F *gSecondaryAntiProtonsExtCov55Pass = new TH1F("gSecondaryAntiProtonsExtCov55Pass",
2337                                                      ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2338                                                      100,0,4);
2339   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsExtCov55Pass);
2340   TH1F *gSecondaryAntiProtonsSigmaToVertexPass = new TH1F("gSecondaryAntiProtonsSigmaToVertexPass",
2341                                                           ";#sigma_{Vertex};Entries",
2342                                                           100,0,10);
2343   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsSigmaToVertexPass);
2344   TH1F *gSecondaryAntiProtonsSigmaToVertexTPCPass = new TH1F("gSecondaryAntiProtonsSigmaToVertexTPCPass",
2345                                                              ";#sigma_{Vertex};Entries",
2346                                                              100,0,10);
2347   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsSigmaToVertexTPCPass);
2348   TH1F *gSecondaryAntiProtonsDCAXYPass = new TH1F("gSecondaryAntiProtonsDCAXYPass",
2349                                                   ";DCA_{xy} [cm];Entries",
2350                                                   100,0,20);
2351   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsDCAXYPass);
2352   TH1F *gSecondaryAntiProtonsDCAXYTPCPass = new TH1F("gSecondaryAntiProtonsDCAXYTPCPass",
2353                                                      ";DCA_{xy} [cm];Entries",
2354                                                      100,0,20);
2355   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsDCAXYTPCPass);
2356   TH1F *gSecondaryAntiProtonsDCAZPass = new TH1F("gSecondaryAntiProtonsDCAZPass",
2357                                                  ";DCA_{z} [cm];Entries",
2358                                                  100,0,20);
2359   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsDCAZPass);
2360   TH1F *gSecondaryAntiProtonsDCAZTPCPass = new TH1F("gSecondaryAntiProtonsDCAZTPCPass",
2361                                                     ";DCA_{z} [cm];Entries",
2362                                                     100,0,20);
2363   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsDCAZTPCPass);
2364   TH1F *gSecondaryAntiProtonsConstrainChi2Pass = new TH1F("gSecondaryAntiProtonsConstrainChi2Pass",
2365                                                           ";Log_{10}(#chi^{2});Entries",
2366                                                           100,-10,10);
2367   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsConstrainChi2Pass);
2368   TH1F *gSecondaryAntiProtonsITSRefitPass = new TH1F("gSecondaryAntiProtonsITSRefitPass",
2369                                                      "",10,-1,1);
2370   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsITSRefitPass);
2371   TH1F *gSecondaryAntiProtonsTPCRefitPass = new TH1F("gSecondaryAntiProtonsTPCRefitPass",
2372                                                      "",10,-1,1);
2373   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsTPCRefitPass);
2374   TH1F *gSecondaryAntiProtonsESDpidPass = new TH1F("gSecondaryAntiProtonsESDpidPass",
2375                                                    "",10,-1,1);
2376   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsESDpidPass);
2377   TH1F *gSecondaryAntiProtonsTPCpidPass = new TH1F("gSecondaryAntiProtonsTPCpidPass",
2378                                                    "",10,-1,1);
2379   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsTPCpidPass);
2380   TH1F *gSecondaryAntiProtonsPointOnITSLayer1Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer1Pass",
2381                                                              "",10,-1,1);
2382   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer1Pass);
2383   TH1F *gSecondaryAntiProtonsPointOnITSLayer2Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer2Pass",
2384                                                              "",10,-1,1);
2385   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer2Pass);
2386   TH1F *gSecondaryAntiProtonsPointOnITSLayer3Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer3Pass",
2387                                                              "",10,-1,1);
2388   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer3Pass);
2389   TH1F *gSecondaryAntiProtonsPointOnITSLayer4Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer4Pass",
2390                                                              "",10,-1,1);
2391   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer4Pass);
2392   TH1F *gSecondaryAntiProtonsPointOnITSLayer5Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer5Pass",
2393                                                              "",10,-1,1);
2394   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer5Pass);
2395   TH1F *gSecondaryAntiProtonsPointOnITSLayer6Pass = new TH1F("gSecondaryAntiProtonsPointOnITSLayer6Pass",
2396                                                              "",10,-1,1);
2397   fQASecondaryAntiProtonsAcceptedList->Add(gSecondaryAntiProtonsPointOnITSLayer6Pass);
2398   
2399   //Rejected secondary antiprotons
2400   /*gDirectory->cd("../");
2401   TDirectory *dirAntiProtonsSecondaryRejected = gDirectory->mkdir("Rejected");
2402   dirAntiProtonsSecondaryRejected->cd();*/
2403
2404   TH1F *gSecondaryAntiProtonsITSClustersReject = new TH1F("gSecondaryAntiProtonsITSClustersReject",
2405                                                           ";N_{clusters} (ITS);Entries",
2406                                                           7,0,7);
2407   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsITSClustersReject);
2408   TH1F *gSecondaryAntiProtonsChi2PerClusterITSReject = new TH1F("gSecondaryAntiProtonsChi2PerClusterITSReject",
2409                                                                 ";x^{2}/N_{clusters} (ITS);Entries",
2410                                                                 100,0,4);
2411   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsChi2PerClusterITSReject);
2412   TH1F *gSecondaryAntiProtonsTPCClustersReject = new TH1F("gSecondaryAntiProtonsTPCClustersReject",
2413                                                           ";N_{clusters} (TPC);Entries",
2414                                                           100,0,200);
2415   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsTPCClustersReject);
2416   TH1F *gSecondaryAntiProtonsChi2PerClusterTPCReject = new TH1F("gSecondaryAntiProtonsChi2PerClusterTPCReject",
2417                                                                 ";x^{2}/N_{clusters} (TPC);Entries",
2418                                                                 100,0,4);
2419   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsChi2PerClusterTPCReject);
2420   TH1F *gSecondaryAntiProtonsExtCov11Reject = new TH1F("gSecondaryAntiProtonsExtCov11Reject",
2421                                                        ";#sigma_{y} [cm];Entries",
2422                                                        100,0,4);
2423   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov11Reject);
2424   TH1F *gSecondaryAntiProtonsExtCov22Reject = new TH1F("gSecondaryAntiProtonsExtCov22Reject",
2425                                                        ";#sigma_{z} [cm];Entries",
2426                                                        100,0,4);
2427   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov22Reject);
2428   TH1F *gSecondaryAntiProtonsExtCov33Reject = new TH1F("gSecondaryAntiProtonsExtCov33Reject",
2429                                                        ";#sigma_{sin(#phi)};Entries",
2430                                                        100,0,4);
2431   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov33Reject);
2432   TH1F *gSecondaryAntiProtonsExtCov44Reject = new TH1F("gSecondaryAntiProtonsExtCov44Reject",
2433                                                        ";#sigma_{tan(#lambda)};Entries",
2434                                                        100,0,4);
2435   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov44Reject);
2436   TH1F *gSecondaryAntiProtonsExtCov55Reject = new TH1F("gSecondaryAntiProtonsExtCov55Reject",
2437                                                        ";#sigma_{1/P_{T}} [GeV/c]^{-1};Entries",
2438                                                        100,0,4);
2439   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsExtCov55Reject);
2440   TH1F *gSecondaryAntiProtonsSigmaToVertexReject = new TH1F("gSecondaryAntiProtonsSigmaToVertexReject",
2441                                                             ";#sigma_{Vertex};Entries",
2442                                                             100,0,10);
2443   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsSigmaToVertexReject);
2444   TH1F *gSecondaryAntiProtonsSigmaToVertexTPCReject = new TH1F("gSecondaryAntiProtonsSigmaToVertexTPCReject",
2445                                                                ";#sigma_{Vertex};Entries",
2446                                                                100,0,10);
2447   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsSigmaToVertexTPCReject);
2448   TH1F *gSecondaryAntiProtonsDCAXYReject = new TH1F("gSecondaryAntiProtonsDCAXYReject",
2449                                                     ";DCA_{xy} [cm];Entries",
2450                                                     100,0,20);
2451   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsDCAXYReject);
2452   TH1F *gSecondaryAntiProtonsDCAXYTPCReject = new TH1F("gSecondaryAntiProtonsDCAXYTPCReject",
2453                                                        ";DCA_{xy} [cm];Entries",
2454                                                        100,0,20);
2455   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsDCAXYTPCReject);
2456   TH1F *gSecondaryAntiProtonsDCAZReject = new TH1F("gSecondaryAntiProtonsDCAZReject",
2457                                                    ";DCA_{z} [cm];Entries",
2458                                                    100,0,20);
2459   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsDCAZReject);
2460   TH1F *gSecondaryAntiProtonsDCAZTPCReject = new TH1F("gSecondaryAntiProtonsDCAZTPCReject",
2461                                                       ";DCA_{z} [cm];Entries",
2462                                                       100,0,20);
2463   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsDCAZTPCReject);
2464   TH1F *gSecondaryAntiProtonsConstrainChi2Reject = new TH1F("gSecondaryAntiProtonsConstrainChi2Reject",
2465                                                             ";Log_{10}(#chi^{2});Entries",
2466                                                             100,-10,10);
2467   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsConstrainChi2Reject);
2468   TH1F *gSecondaryAntiProtonsITSRefitReject = new TH1F("gSecondaryAntiProtonsITSRefitReject",
2469                                                        "",10,-1,1);
2470   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsITSRefitReject);
2471   TH1F *gSecondaryAntiProtonsTPCRefitReject = new TH1F("gSecondaryAntiProtonsTPCRefitReject",
2472                                                        "",10,-1,1);
2473   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsTPCRefitReject);
2474   TH1F *gSecondaryAntiProtonsESDpidReject = new TH1F("gSecondaryAntiProtonsESDpidReject",
2475                                                      "",10,-1,1);
2476   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsESDpidReject);
2477   TH1F *gSecondaryAntiProtonsTPCpidReject = new TH1F("gSecondaryAntiProtonsTPCpidReject",
2478                                                      "",10,-1,1);
2479   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsTPCpidReject);
2480   TH1F *gSecondaryAntiProtonsPointOnITSLayer1Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer1Reject",
2481                                                              "",10,-1,1);
2482   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer1Reject);
2483   TH1F *gSecondaryAntiProtonsPointOnITSLayer2Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer2Reject",
2484                                                              "",10,-1,1);
2485   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer2Reject);
2486   TH1F *gSecondaryAntiProtonsPointOnITSLayer3Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer3Reject",
2487                                                              "",10,-1,1);
2488   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer3Reject);
2489   TH1F *gSecondaryAntiProtonsPointOnITSLayer4Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer4Reject",
2490                                                              "",10,-1,1);
2491   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer4Reject);
2492   TH1F *gSecondaryAntiProtonsPointOnITSLayer5Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer5Reject",
2493                                                              "",10,-1,1);
2494   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer5Reject);
2495   TH1F *gSecondaryAntiProtonsPointOnITSLayer6Reject = new TH1F("gSecondaryAntiProtonsPointOnITSLayer6Reject",
2496                                                              "",10,-1,1);
2497   fQASecondaryAntiProtonsRejectedList->Add(gSecondaryAntiProtonsPointOnITSLayer6Reject);
2498 }
2499
2500 //____________________________________________________________________//
2501 void AliProtonQAAnalysis::RunEfficiencyAnalysis(AliStack *stack, 
2502                                                 AliESDEvent *esd) {
2503   //Runs the efficiency code
2504   //MC loop
2505   Int_t nMCProtons = 0, nESDProtons = 0;
2506   for(Int_t iParticle = 0; iParticle <= stack->GetNprimary(); iParticle++) {
2507     TParticle *particle = stack->Particle(iParticle);
2508     if(!particle) continue;
2509
2510     if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
2511     if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
2512     if((Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
2513
2514     Int_t pdgcode = particle->GetPdgCode();
2515     if(pdgcode == 2212) {
2516       nMCProtons += 1;
2517       ((TH2D *)(fEfficiencyList->At(0)))->Fill(Rapidity(particle->Px(),
2518                                                         particle->Py(),
2519                                                         particle->Pz()),
2520                                                particle->Pt());
2521     }
2522     if(pdgcode == -2212) 
2523       ((TH2D *)(fEfficiencyList->At(1)))->Fill(Rapidity(particle->Px(),
2524                                                         particle->Py(),
2525                                                         particle->Pz()),
2526                                                particle->Pt());
2527   }//MC loop
2528
2529   //ESD loop
2530   Int_t nGoodTracks = esd->GetNumberOfTracks();
2531   TArrayI labelArray(nGoodTracks);
2532   Int_t labelCounter = 0;
2533   for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) {
2534     AliESDtrack* track = esd->GetTrack(iTracks);
2535     if(!track) continue;
2536
2537     Int_t label = TMath::Abs(track->GetLabel());
2538     if(IsLabelUsed(labelArray,label)) continue;
2539     labelArray.AddAt(label,labelCounter);
2540     labelCounter += 1;
2541
2542     TParticle *particle = stack->Particle(label);
2543     if(!particle) continue;
2544     Int_t pdgcode = particle->GetPdgCode();
2545     
2546     Double_t Pt = 0.0, P = 0.0;
2547     Double_t probability[5];
2548     
2549     //TPC only
2550     if(fUseTPCOnly) {
2551       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
2552       if(!tpcTrack) continue;
2553       Pt = tpcTrack->Pt();
2554       P = tpcTrack->P();
2555
2556       if((tpcTrack->Pt() > fMaxPt)||(tpcTrack->Pt() < fMinPt)) continue;
2557       if((Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()) > fMaxY)||(Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz()) < fMinY)) continue;
2558
2559       //reconstructed primary (anti)protons
2560       if(pdgcode == 2212) {
2561         ((TH2D *)(fEfficiencyList->At(4)))->Fill(Rapidity(tpcTrack->Px(),
2562                                                           tpcTrack->Py(),
2563                                                           tpcTrack->Pz()),
2564                                                  Pt);
2565         if(label <= stack->GetNprimary()) {
2566           nESDProtons += 1;
2567           ((TH2D *)(fEfficiencyList->At(2)))->Fill(Rapidity(tpcTrack->Px(),
2568                                                             tpcTrack->Py(),
2569                                                             tpcTrack->Pz()),
2570                                                    Pt);
2571         }
2572       }//initial protons
2573       if(pdgcode == -2212) {
2574         ((TH2D *)(fEfficiencyList->At(4)))->Fill(Rapidity(tpcTrack->Px(),
2575                                                           tpcTrack->Py(),
2576                                                           tpcTrack->Pz()),
2577                                                  Pt);
2578         if(label <= stack->GetNprimary())
2579           ((TH2D *)(fEfficiencyList->At(3)))->Fill(Rapidity(tpcTrack->Px(),
2580                                                             tpcTrack->Py(),
2581                                                             tpcTrack->Pz()),
2582                                                    Pt);
2583       }//initial antiprotons
2584
2585       //pid
2586       track->GetTPCpid(probability);
2587       Double_t rcc = 0.0;
2588       for(Int_t i = 0; i < AliPID::kSPECIES; i++)
2589         rcc += probability[i]*GetParticleFraction(i,P);
2590       if(rcc == 0.0) continue;
2591       Double_t w[5];
2592       for(Int_t i = 0; i < AliPID::kSPECIES; i++)
2593         w[i] = probability[i]*GetParticleFraction(i,P)/rcc;
2594       Long64_t fParticleType = TMath::LocMax(AliPID::kSPECIES,w);
2595       if(fParticleType == 4) {
2596         ((TH2D *)(fEfficiencyList->At(6)))->Fill(Rapidity(tpcTrack->Px(),
2597                                                           tpcTrack->Py(),
2598                                                           tpcTrack->Pz()),
2599                                                  Pt);
2600         if(TMath::Abs(pdgcode) == 2212) 
2601           ((TH2D *)(fEfficiencyList->At(5)))->Fill(Rapidity(tpcTrack->Px(),
2602                                                             tpcTrack->Py(),
2603                                                             tpcTrack->Pz()),
2604                                                    Pt);
2605         else
2606           ((TH2D *)(fEfficiencyList->At(7)))->Fill(Rapidity(tpcTrack->Px(),
2607                                                             tpcTrack->Py(),
2608                                                             tpcTrack->Pz()),
2609                                                    Pt);
2610       }//identified as proton
2611     }//TPC only tracks
2612     else if(!fUseTPCOnly) {
2613       if((track->Pt() > fMaxPt)||(track->Pt() < fMinPt)) continue;
2614       if((Rapidity(track->Px(),track->Py(),track->Pz()) > fMaxY)||(Rapidity(track->Px(),track->Py(),track->Pz()) < fMinY)) continue;
2615
2616       //reconstructed primary (anti)protons
2617       if(pdgcode == 2212) {
2618         ((TH2D *)(fEfficiencyList->At(4)))->Fill(Rapidity(track->Px(),
2619                                                           track->Py(),
2620                                                           track->Pz()),
2621                                                  Pt);
2622         if(label <= stack->GetNprimary())
2623           ((TH2D *)(fEfficiencyList->At(2)))->Fill(Rapidity(track->Px(),
2624                                                             track->Py(),
2625                                                             track->Pz()),
2626                                                    Pt);
2627       }//initial protons
2628       if(pdgcode == -2212) {
2629         ((TH2D *)(fEfficiencyList->At(4)))->Fill(Rapidity(track->Px(),
2630                                                           track->Py(),
2631                                                           track->Pz()),
2632                                                  Pt);
2633         if(label <= stack->GetNprimary())
2634           ((TH2D *)(fEfficiencyList->At(3)))->Fill(Rapidity(track->Px(),
2635                                                             track->Py(),
2636                                                             track->Pz()),
2637                                                    Pt);
2638       }//initial antiprotons
2639       
2640       //pid
2641       track->GetESDpid(probability);
2642       Double_t rcc = 0.0;
2643       for(Int_t i = 0; i < AliPID::kSPECIES; i++)
2644         rcc += probability[i]*GetParticleFraction(i,P);
2645       if(rcc == 0.0) continue;
2646       Double_t w[5];
2647       for(Int_t i = 0; i < AliPID::kSPECIES; i++)
2648         w[i] = probability[i]*GetParticleFraction(i,P)/rcc;
2649       Long64_t fParticleType = TMath::LocMax(AliPID::kSPECIES,w);
2650       if(fParticleType == 4) {
2651         ((TH2D *)(fEfficiencyList->At(6)))->Fill(Rapidity(track->Px(),
2652                                                           track->Py(),
2653                                                           track->Pz()),
2654                                                  Pt);
2655         if(TMath::Abs(pdgcode) == 2212) 
2656           ((TH2D *)(fEfficiencyList->At(5)))->Fill(Rapidity(track->Px(),
2657                                                             track->Py(),
2658                                                             track->Pz()),
2659                                                    Pt);
2660         else
2661           ((TH2D *)(fEfficiencyList->At(7)))->Fill(Rapidity(track->Px(),
2662                                                             track->Py(),
2663                                                             track->Pz()),
2664                                                    Pt);
2665       }//identified as proton
2666     }//global tracking
2667   }//track loop
2668   
2669   //Printf("MC protons: %d - ESD protons: %d",nMCProtons,nESDProtons);
2670 }
2671
2672 //____________________________________________________________________//
2673 Bool_t AliProtonQAAnalysis::IsLabelUsed(TArrayI labelArray, 
2674                                         Int_t label) {
2675   //Checks if the label is used already
2676   Bool_t status = kFALSE;
2677   for(Int_t i = 0; i < labelArray.GetSize(); i++) {
2678     if(labelArray.At(i) == label)
2679       status = kTRUE;
2680   }
2681
2682   return status;
2683 }
2684
2685 //____________________________________________________________________//
2686 void AliProtonQAAnalysis::RunQAAnalysis(AliStack *stack, 
2687                                         AliESDEvent *esd) {
2688   //Runs the QA code
2689   //MC loop
2690   for(Int_t iParticle = 0; iParticle < stack->GetNprimary(); iParticle++) {
2691     TParticle *particle = stack->Particle(iParticle);
2692     if(!particle) continue;
2693
2694     if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
2695     if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
2696     if((Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
2697
2698     Int_t pdgcode = particle->GetPdgCode();
2699     if(pdgcode == 2212) 
2700       ((TH2D *)(fQA2DList->At(8)))->Fill(Rapidity(particle->Px(),
2701                                                   particle->Py(),
2702                                                   particle->Pz()),
2703                                          particle->Pt());
2704     if(pdgcode == -2212) 
2705       ((TH2D *)(fQA2DList->At(9)))->Fill(Rapidity(particle->Px(),
2706                                                   particle->Py(),
2707                                                   particle->Pz()),
2708                                          particle->Pt());
2709   }//MC loop
2710
2711   //ESD loop
2712   Int_t nGoodTracks = esd->GetNumberOfTracks();
2713   TArrayI labelArray(nGoodTracks);
2714   Int_t labelCounter = 0;
2715   for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) {
2716     AliESDtrack* track = esd->GetTrack(iTracks);
2717     if(!track) continue;
2718     
2719     Int_t label = TMath::Abs(track->GetLabel()); 
2720     if(IsLabelUsed(labelArray,label)) continue;
2721     labelArray.AddAt(label,labelCounter);
2722     labelCounter += 1;
2723
2724     Double_t Pt = 0.0, P = 0.0;
2725     Double_t probability[5];
2726     Float_t dcaXY = 0.0, dcaZ = 0.0;
2727     Double_t nSigmaToVertex = GetSigmaToVertex(track);
2728     Int_t  fIdxInt[200];
2729     Int_t nClustersITS = track->GetITSclusters(fIdxInt);
2730     Int_t nClustersTPC = track->GetTPCclusters(fIdxInt);
2731
2732     Float_t chi2PerClusterITS = -1;
2733     if (nClustersITS!=0)
2734       chi2PerClusterITS = track->GetITSchi2()/Float_t(nClustersITS);
2735     Float_t chi2PerClusterTPC = -1;
2736     if (nClustersTPC!=0)
2737       chi2PerClusterTPC = track->GetTPCchi2()/Float_t(nClustersTPC);
2738     Double_t chi2ConstrainVertex = TMath::Log(track->GetConstrainedChi2());    
2739     Double_t extCov[15];
2740     track->GetExternalCovariance(extCov);
2741
2742     //TPC only
2743     if(fUseTPCOnly) {
2744       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
2745       if(!tpcTrack) continue;
2746       Pt = tpcTrack->Pt();
2747       P = tpcTrack->P();
2748       if(fUseHybridTPC) track->GetImpactParameters(dcaXY,dcaZ);
2749       else track->GetImpactParametersTPC(dcaXY,dcaZ);
2750       
2751       //pid
2752       track->GetTPCpid(probability);
2753       Double_t rcc = 0.0;
2754       for(Int_t i = 0; i < AliPID::kSPECIES; i++)
2755         rcc += probability[i]*GetParticleFraction(i,P);
2756       if(rcc == 0.0) continue;
2757       Double_t w[5];
2758       for(Int_t i = 0; i < AliPID::kSPECIES; i++)
2759         w[i] = probability[i]*GetParticleFraction(i,P)/rcc;
2760       Long64_t fParticleType = TMath::LocMax(AliPID::kSPECIES,w);
2761       if(fParticleType == 4) {
2762         FillQA(track, stack);
2763         if(IsAccepted(track)) {
2764           if(label <= stack->GetNprimary()) {
2765             if(track->Charge() > 0) {
2766               for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
2767                 if(track->HasPointOnITSLayer(iLayer))
2768                   ((TH1F *)(fAcceptedCutList->At(0)))->Fill(iLayer+1);
2769               }
2770               ((TH1F *)(fAcceptedCutList->At(4)))->Fill(nClustersITS);
2771               ((TH1F *)(fAcceptedCutList->At(8)))->Fill(chi2PerClusterITS);
2772               ((TH1F *)(fAcceptedCutList->At(12)))->Fill(chi2ConstrainVertex);
2773               ((TH1F *)(fAcceptedCutList->At(16)))->Fill(nClustersTPC);
2774               ((TH1F *)(fAcceptedCutList->At(20)))->Fill(chi2PerClusterTPC);
2775               ((TH1F *)(fAcceptedCutList->At(24)))->Fill(extCov[0]);
2776               ((TH1F *)(fAcceptedCutList->At(28)))->Fill(extCov[2]);
2777               ((TH1F *)(fAcceptedCutList->At(32)))->Fill(extCov[5]);
2778               ((TH1F *)(fAcceptedCutList->At(36)))->Fill(extCov[9]);
2779               ((TH1F *)(fAcceptedCutList->At(40)))->Fill(extCov[14]);
2780
2781               ((TH1F *)(fAcceptedDCAList->At(0)))->Fill(TMath::Abs(dcaXY));
2782               ((TH1F *)(fAcceptedDCAList->At(4)))->Fill(TMath::Abs(dcaZ));
2783               ((TH1F *)(fAcceptedDCAList->At(8)))->Fill(nSigmaToVertex);
2784               ((TH2D *)(fQA2DList->At(0)))->Fill(Rapidity(tpcTrack->Px(),
2785                                                           tpcTrack->Py(),
2786                                                           tpcTrack->Pz()),
2787                                                  Pt);
2788             }
2789             else if(track->Charge() < 0) {
2790               for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
2791                 if(track->HasPointOnITSLayer(iLayer))
2792                   ((TH1F *)(fAcceptedCutList->At(1)))->Fill(iLayer+1);
2793               }
2794               ((TH1F *)(fAcceptedCutList->At(5)))->Fill(nClustersITS);
2795               ((TH1F *)(fAcceptedCutList->At(9)))->Fill(chi2PerClusterITS);
2796               ((TH1F *)(fAcceptedCutList->At(13)))->Fill(chi2ConstrainVertex);
2797               ((TH1F *)(fAcceptedCutList->At(17)))->Fill(nClustersTPC);
2798               ((TH1F *)(fAcceptedCutList->At(21)))->Fill(chi2PerClusterTPC);
2799               ((TH1F *)(fAcceptedCutList->At(25)))->Fill(extCov[0]);
2800               ((TH1F *)(fAcceptedCutList->At(29)))->Fill(extCov[2]);
2801               ((TH1F *)(fAcceptedCutList->At(33)))->Fill(extCov[5]);
2802               ((TH1F *)(fAcceptedCutList->At(37)))->Fill(extCov[9]);
2803               ((TH1F *)(fAcceptedCutList->At(41)))->Fill(extCov[14]);
2804
2805               ((TH1F *)(fAcceptedDCAList->At(1)))->Fill(TMath::Abs(dcaXY));
2806               ((TH1F *)(fAcceptedDCAList->At(5)))->Fill(TMath::Abs(dcaZ));
2807               ((TH1F *)(fAcceptedDCAList->At(9)))->Fill(nSigmaToVertex);
2808               ((TH2D *)(fQA2DList->At(4)))->Fill(Rapidity(tpcTrack->Px(),
2809                                                           tpcTrack->Py(),
2810                                                           tpcTrack->Pz()),
2811                                                  Pt);
2812             }
2813           }//primary particles
2814           else if(label > stack->GetNprimary()) {
2815             TParticle *particle = stack->Particle(label);
2816             if(!particle) continue;
2817
2818             Int_t lPartMother = -1;
2819             Int_t motherPDGCode = -1;
2820             if(particle) {
2821               lPartMother = particle->GetFirstMother();
2822               TParticle *motherParticle = stack->Particle(lPartMother);
2823               if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
2824             }
2825
2826             if(fMCProcessIdFlag)
2827               if(particle->GetUniqueID() != fMCProcessId) continue;
2828             if(fMotherParticlePDGCodeFlag)
2829               if(TMath::Abs(motherPDGCode) != fMotherParticlePDGCode) continue;
2830
2831             if(track->Charge() > 0) {
2832               for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
2833                 if(track->HasPointOnITSLayer(iLayer))
2834                   ((TH1F *)(fAcceptedCutList->At(2)))->Fill(iLayer+1);
2835               }
2836               ((TH1F *)(fAcceptedCutList->At(6)))->Fill(nClustersITS);
2837               ((TH1F *)(fAcceptedCutList->At(10)))->Fill(chi2PerClusterITS);
2838               ((TH1F *)(fAcceptedCutList->At(14)))->Fill(chi2ConstrainVertex);
2839               ((TH1F *)(fAcceptedCutList->At(18)))->Fill(nClustersTPC);
2840               ((TH1F *)(fAcceptedCutList->At(22)))->Fill(chi2PerClusterTPC);
2841               ((TH1F *)(fAcceptedCutList->At(26)))->Fill(extCov[0]);
2842               ((TH1F *)(fAcceptedCutList->At(30)))->Fill(extCov[2]);
2843               ((TH1F *)(fAcceptedCutList->At(34)))->Fill(extCov[5]);
2844               ((TH1F *)(fAcceptedCutList->At(38)))->Fill(extCov[9]);
2845               ((TH1F *)(fAcceptedCutList->At(42)))->Fill(extCov[14]);
2846
2847               ((TH1F *)(fAcceptedDCAList->At(2)))->Fill(TMath::Abs(dcaXY));
2848               ((TH1F *)(fAcceptedDCAList->At(6)))->Fill(TMath::Abs(dcaZ));
2849               ((TH1F *)(fAcceptedDCAList->At(10)))->Fill(nSigmaToVertex);
2850               ((TH2D *)(fQA2DList->At(2)))->Fill(Rapidity(tpcTrack->Px(),
2851                                                           tpcTrack->Py(),
2852                                                           tpcTrack->Pz()),
2853                                                  Pt);
2854               ((TH3F *)(fQA2DList->At(10)))->Fill(Rapidity(tpcTrack->Px(),
2855                                                            tpcTrack->Py(),
2856                                                            tpcTrack->Pz()),
2857                                                   Pt,
2858                                                   ConvertPDGToInt(motherPDGCode));
2859             }
2860             else if(track->Charge() < 0) {
2861               for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
2862                 if(track->HasPointOnITSLayer(iLayer))
2863                   ((TH1F *)(fAcceptedCutList->At(3)))->Fill(iLayer+1);
2864               }
2865               ((TH1F *)(fAcceptedCutList->At(7)))->Fill(nClustersITS);
2866               ((TH1F *)(fAcceptedCutList->At(11)))->Fill(chi2PerClusterITS);
2867               ((TH1F *)(fAcceptedCutList->At(15)))->Fill(chi2ConstrainVertex);
2868               ((TH1F *)(fAcceptedCutList->At(19)))->Fill(nClustersTPC);
2869               ((TH1F *)(fAcceptedCutList->At(23)))->Fill(chi2PerClusterTPC);
2870               ((TH1F *)(fAcceptedCutList->At(27)))->Fill(extCov[0]);
2871               ((TH1F *)(fAcceptedCutList->At(31)))->Fill(extCov[2]);
2872               ((TH1F *)(fAcceptedCutList->At(35)))->Fill(extCov[5]);
2873               ((TH1F *)(fAcceptedCutList->At(39)))->Fill(extCov[9]);
2874               ((TH1F *)(fAcceptedCutList->At(43)))->Fill(extCov[14]);
2875
2876               ((TH1F *)(fAcceptedDCAList->At(3)))->Fill(TMath::Abs(dcaXY));
2877               ((TH1F *)(fAcceptedDCAList->At(7)))->Fill(TMath::Abs(dcaZ));
2878               ((TH1F *)(fAcceptedDCAList->At(11)))->Fill(nSigmaToVertex);
2879               ((TH2D *)(fQA2DList->At(6)))->Fill(Rapidity(tpcTrack->Px(),
2880                                                           tpcTrack->Py(),
2881                                                           tpcTrack->Pz()),
2882                                                  Pt);
2883               ((TH3F *)(fQA2DList->At(11)))->Fill(Rapidity(tpcTrack->Px(),
2884                                                            tpcTrack->Py(),
2885                                                            tpcTrack->Pz()),
2886                                                   Pt,
2887                                                   ConvertPDGToInt(motherPDGCode));
2888             }
2889           }//secondary particles
2890         }//accepted - track cuts
2891         else if(!IsAccepted(track)) {
2892           if(label <= stack->GetNprimary()) {
2893             if(track->Charge() > 0)
2894               ((TH2D *)(fQA2DList->At(1)))->Fill(Rapidity(tpcTrack->Px(),
2895                                                           tpcTrack->Py(),
2896                                                           tpcTrack->Pz()),
2897                                                  Pt);
2898             else if(track->Charge() < 0)
2899               ((TH2D *)(fQA2DList->At(5)))->Fill(Rapidity(tpcTrack->Px(),
2900                                                           tpcTrack->Py(),
2901                                                           tpcTrack->Pz()),
2902                                                  Pt);
2903           }//primary particles
2904           else if(label > stack->GetNprimary()) {
2905             if(track->Charge() > 0)
2906               ((TH2D *)(fQA2DList->At(3)))->Fill(Rapidity(tpcTrack->Px(),
2907                                                           tpcTrack->Py(),
2908                                                           tpcTrack->Pz()),
2909                                                  Pt);
2910             else if(track->Charge() < 0)
2911               ((TH2D *)(fQA2DList->At(7)))->Fill(Rapidity(tpcTrack->Px(),
2912                                                           tpcTrack->Py(),
2913                                                           tpcTrack->Pz()),
2914                                                  Pt);
2915           }//secondary particles
2916         }//rejected - track cuts
2917       }//proton check
2918     }//TPC only tracks
2919     //combined tracking
2920     else if(!fUseTPCOnly) {
2921       Pt = track->Pt();
2922       P = track->P();
2923       track->GetImpactParameters(dcaXY,dcaZ);
2924
2925       //pid
2926       track->GetESDpid(probability);
2927       Double_t rcc = 0.0;
2928       for(Int_t i = 0; i < AliPID::kSPECIES; i++)
2929         rcc += probability[i]*GetParticleFraction(i,P);
2930       if(rcc == 0.0) continue;
2931       Double_t w[5];
2932       for(Int_t i = 0; i < AliPID::kSPECIES; i++)
2933         w[i] = probability[i]*GetParticleFraction(i,P)/rcc;
2934       Long64_t fParticleType = TMath::LocMax(AliPID::kSPECIES,w);
2935       if(fParticleType == 4) {
2936         FillQA(track, stack);
2937         if(IsAccepted(track)) {
2938           if(label <= stack->GetNprimary()) {
2939             if(track->Charge() > 0) {
2940               for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
2941                 if(track->HasPointOnITSLayer(iLayer))
2942                   ((TH1F *)(fAcceptedCutList->At(0)))->Fill(iLayer+1);
2943               }
2944               ((TH1F *)(fAcceptedCutList->At(4)))->Fill(nClustersITS);
2945               ((TH1F *)(fAcceptedCutList->At(8)))->Fill(chi2PerClusterITS);
2946               ((TH1F *)(fAcceptedCutList->At(12)))->Fill(chi2ConstrainVertex);
2947               ((TH1F *)(fAcceptedCutList->At(16)))->Fill(nClustersTPC);
2948               ((TH1F *)(fAcceptedCutList->At(20)))->Fill(chi2PerClusterTPC);
2949               ((TH1F *)(fAcceptedCutList->At(24)))->Fill(extCov[0]);
2950               ((TH1F *)(fAcceptedCutList->At(28)))->Fill(extCov[2]);
2951               ((TH1F *)(fAcceptedCutList->At(32)))->Fill(extCov[5]);
2952               ((TH1F *)(fAcceptedCutList->At(36)))->Fill(extCov[9]);
2953               ((TH1F *)(fAcceptedCutList->At(40)))->Fill(extCov[14]);
2954
2955               ((TH1F *)(fAcceptedDCAList->At(0)))->Fill(TMath::Abs(dcaXY));
2956               ((TH1F *)(fAcceptedDCAList->At(4)))->Fill(TMath::Abs(dcaZ));
2957               ((TH1F *)(fAcceptedDCAList->At(8)))->Fill(nSigmaToVertex);
2958               ((TH2D *)(fQA2DList->At(0)))->Fill(Rapidity(track->Px(),
2959                                                           track->Py(),
2960                                                           track->Pz()),
2961                                                  Pt);
2962             }
2963             else if(track->Charge() < 0) {
2964               for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
2965                 if(track->HasPointOnITSLayer(iLayer))
2966                   ((TH1F *)(fAcceptedCutList->At(1)))->Fill(iLayer+1);
2967               }
2968               ((TH1F *)(fAcceptedCutList->At(5)))->Fill(nClustersITS);
2969               ((TH1F *)(fAcceptedCutList->At(9)))->Fill(chi2PerClusterITS);
2970               ((TH1F *)(fAcceptedCutList->At(13)))->Fill(chi2ConstrainVertex);
2971               ((TH1F *)(fAcceptedCutList->At(17)))->Fill(nClustersTPC);
2972               ((TH1F *)(fAcceptedCutList->At(21)))->Fill(chi2PerClusterTPC);
2973               ((TH1F *)(fAcceptedCutList->At(25)))->Fill(extCov[0]);
2974               ((TH1F *)(fAcceptedCutList->At(29)))->Fill(extCov[2]);
2975               ((TH1F *)(fAcceptedCutList->At(33)))->Fill(extCov[5]);
2976               ((TH1F *)(fAcceptedCutList->At(37)))->Fill(extCov[9]);
2977               ((TH1F *)(fAcceptedCutList->At(41)))->Fill(extCov[14]);
2978
2979               ((TH1F *)(fAcceptedDCAList->At(1)))->Fill(TMath::Abs(dcaXY));
2980               ((TH1F *)(fAcceptedDCAList->At(5)))->Fill(TMath::Abs(dcaZ));
2981               ((TH1F *)(fAcceptedDCAList->At(9)))->Fill(nSigmaToVertex);
2982               ((TH2D *)(fQA2DList->At(4)))->Fill(Rapidity(track->Px(),
2983                                                           track->Py(),
2984                                                           track->Pz()),
2985                                                  Pt);
2986             }
2987           }//primary particles
2988           else if(label > stack->GetNprimary()) {
2989             TParticle *particle = stack->Particle(label);
2990             if(!particle) continue;
2991
2992             Int_t lPartMother = -1;
2993             Int_t motherPDGCode = -1;
2994             if(particle) {
2995               lPartMother = particle->GetFirstMother();
2996               TParticle *motherParticle = stack->Particle(lPartMother);
2997               if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
2998             }
2999
3000             if(fMCProcessIdFlag)
3001               if(particle->GetUniqueID() != fMCProcessId) continue;
3002             if(fMotherParticlePDGCodeFlag)
3003               if(TMath::Abs(motherPDGCode) != fMotherParticlePDGCode) continue;
3004
3005             if(track->Charge() > 0) {
3006               for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
3007                 if(track->HasPointOnITSLayer(iLayer))
3008                   ((TH1F *)(fAcceptedCutList->At(2)))->Fill(iLayer+1);
3009               }
3010               ((TH1F *)(fAcceptedCutList->At(6)))->Fill(nClustersITS);
3011               ((TH1F *)(fAcceptedCutList->At(10)))->Fill(chi2PerClusterITS);
3012               ((TH1F *)(fAcceptedCutList->At(14)))->Fill(chi2ConstrainVertex);
3013               ((TH1F *)(fAcceptedCutList->At(18)))->Fill(nClustersTPC);
3014               ((TH1F *)(fAcceptedCutList->At(22)))->Fill(chi2PerClusterTPC);
3015               ((TH1F *)(fAcceptedCutList->At(26)))->Fill(extCov[0]);
3016               ((TH1F *)(fAcceptedCutList->At(30)))->Fill(extCov[2]);
3017               ((TH1F *)(fAcceptedCutList->At(34)))->Fill(extCov[5]);
3018               ((TH1F *)(fAcceptedCutList->At(38)))->Fill(extCov[9]);
3019               ((TH1F *)(fAcceptedCutList->At(42)))->Fill(extCov[14]);
3020
3021               ((TH1F *)(fAcceptedDCAList->At(2)))->Fill(TMath::Abs(dcaXY));
3022               ((TH1F *)(fAcceptedDCAList->At(6)))->Fill(TMath::Abs(dcaZ));
3023               ((TH1F *)(fAcceptedDCAList->At(10)))->Fill(nSigmaToVertex);
3024               ((TH2D *)(fQA2DList->At(2)))->Fill(Rapidity(track->Px(),
3025                                                           track->Py(),
3026                                                           track->Pz()),
3027                                                  Pt);
3028               ((TH3F *)(fQA2DList->At(10)))->Fill(Rapidity(track->Px(),
3029                                                            track->Py(),
3030                                                            track->Pz()),
3031                                                   Pt,
3032                                                   ConvertPDGToInt(motherPDGCode));
3033             }
3034             else if(track->Charge() < 0) {
3035               for(Int_t iLayer = 0; iLayer < 6; iLayer++) {
3036                 if(track->HasPointOnITSLayer(iLayer))
3037                   ((TH1F *)(fAcceptedCutList->At(3)))->Fill(iLayer+1);
3038               }
3039               ((TH1F *)(fAcceptedCutList->At(7)))->Fill(nClustersITS);
3040               ((TH1F *)(fAcceptedCutList->At(11)))->Fill(chi2PerClusterITS);
3041               ((TH1F *)(fAcceptedCutList->At(15)))->Fill(chi2ConstrainVertex);
3042               ((TH1F *)(fAcceptedCutList->At(19)))->Fill(nClustersTPC);
3043               ((TH1F *)(fAcceptedCutList->At(23)))->Fill(chi2PerClusterTPC);
3044               ((TH1F *)(fAcceptedCutList->At(27)))->Fill(extCov[0]);
3045               ((TH1F *)(fAcceptedCutList->At(31)))->Fill(extCov[2]);
3046               ((TH1F *)(fAcceptedCutList->At(35)))->Fill(extCov[5]);
3047               ((TH1F *)(fAcceptedCutList->At(39)))->Fill(extCov[9]);
3048               ((TH1F *)(fAcceptedCutList->At(43)))->Fill(extCov[14]);
3049
3050               ((TH1F *)(fAcceptedDCAList->At(3)))->Fill(TMath::Abs(dcaXY));
3051               ((TH1F *)(fAcceptedDCAList->At(7)))->Fill(TMath::Abs(dcaZ));
3052               ((TH1F *)(fAcceptedDCAList->At(11)))->Fill(nSigmaToVertex);
3053               ((TH2D *)(fQA2DList->At(6)))->Fill(Rapidity(track->Px(),
3054                                                           track->Py(),
3055                                                           track->Pz()),
3056                                                  Pt);
3057
3058               ((TH3F *)(fQA2DList->At(11)))->Fill(Rapidity(track->Px(),
3059                                                           track->Py(),
3060                                                           track->Pz()),
3061                                                  Pt,
3062                                                  ConvertPDGToInt(motherPDGCode));
3063             }
3064           }//secondary particles
3065         }//accepted - track cuts
3066         else if(!IsAccepted(track)) {
3067           if(label <= stack->GetNprimary()) {
3068             if(track->Charge() > 0)
3069               ((TH2D *)(fQA2DList->At(1)))->Fill(Rapidity(track->Px(),
3070                                                           track->Py(),
3071                                                           track->Pz()),
3072                                                  Pt);
3073             else if(track->Charge() < 0)
3074               ((TH2D *)(fQA2DList->At(5)))->Fill(Rapidity(track->Px(),
3075                                                           track->Py(),
3076                                                           track->Pz()),
3077                                                  Pt);
3078           }//primary particles
3079           else if(label > stack->GetNprimary()) {
3080             if(track->Charge() > 0)
3081               ((TH2D *)(fQA2DList->At(3)))->Fill(Rapidity(track->Px(),
3082                                                           track->Py(),
3083                                                           track->Pz()),
3084                                                  Pt);
3085             else if(track->Charge() < 0)
3086               ((TH2D *)(fQA2DList->At(7)))->Fill(Rapidity(track->Px(),
3087                                                           track->Py(),
3088                                                           track->Pz()),
3089                                                  Pt);
3090           }//secondary particles
3091         }//rejected - track cuts
3092       }//proton check
3093     }//combined tracking
3094   }//track loop
3095     
3096 }
3097
3098 //____________________________________________________________________//
3099 void AliProtonQAAnalysis::InitMCAnalysis() {
3100   //MC analysis - 3D histograms: y-pT-pdg
3101   fPDGList = new TList();
3102   TH3F *gHistYPtPDGProtons = new TH3F("gHistYPtPDGProtons",
3103                                       ";y;P_{T} [GeV/c];PDG",
3104                                       fNBinsY,fMinY,fMaxY,
3105                                       fNBinsPt,fMinPt,fMaxPt,
3106                                       14,-0.5,13.5);
3107   fPDGList->Add(gHistYPtPDGProtons);
3108   TH3F *gHistYPtPDGAntiProtons = new TH3F("gHistYPtPDGAntiProtons",
3109                                           ";y;P_{T} [GeV/c];PDG",
3110                                           fNBinsY,fMinY,fMaxY,
3111                                           fNBinsPt,fMinPt,fMaxPt,
3112                                           14,-0.5,13.5);
3113   fPDGList->Add(gHistYPtPDGAntiProtons);
3114
3115   //MC processes
3116   fMCProcessesList = new TList();
3117   TH1F *gHistProtonsFromKLProcess = new TH1F("gHistProtonsFromKLProcess","",51,-0.5,50.5);
3118   fMCProcessesList->Add(gHistProtonsFromKLProcess);
3119   TH1F *gHistProtonsFromPionProcess = new TH1F("gHistProtonsFromPionProcess","",51,-0.5,50.5);
3120   fMCProcessesList->Add(gHistProtonsFromPionProcess);
3121   TH1F *gHistProtonsFromKSProcess = new TH1F("gHistProtonsFromKSProcess","",51,-0.5,50.5);
3122   fMCProcessesList->Add(gHistProtonsFromKSProcess);
3123   TH1F *gHistProtonsFromKaonProcess = new TH1F("gHistProtonsFromKaonProcess","",51,-0.5,50.5);
3124   fMCProcessesList->Add(gHistProtonsFromKaonProcess);
3125   TH1F *gHistProtonsFromNeutronProcess = new TH1F("gHistProtonsFromNeutronProcess","",51,-0.5,50.5);
3126   fMCProcessesList->Add(gHistProtonsFromNeutronProcess);
3127   TH1F *gHistProtonsFromProtonProcess = new TH1F("gHistProtonsFromProtonProcess","",51,-0.5,50.5);
3128   fMCProcessesList->Add(gHistProtonsFromProtonProcess);
3129   TH1F *gHistProtonsFromSigmaMinusProcess = new TH1F("gHistProtonsFromSigmaMinusProcess","",51,-0.5,50.5);
3130   fMCProcessesList->Add(gHistProtonsFromSigmaMinusProcess);
3131   TH1F *gHistProtonsFromLambda0Process = new TH1F("gHistProtonsFromLambda0Process","",51,-0.5,50.5);
3132   fMCProcessesList->Add(gHistProtonsFromLambda0Process);
3133   TH1F *gHistProtonsFromSigmaPlusProcess = new TH1F("gHistProtonsFromSigmaPlusProcess","",51,-0.5,50.5);
3134   fMCProcessesList->Add(gHistProtonsFromSigmaPlusProcess);
3135   TH1F *gHistProtonsFromXiMinusProcess = new TH1F("gHistProtonsFromXiMinusProcess","",51,-0.5,50.5);
3136   fMCProcessesList->Add(gHistProtonsFromXiMinusProcess);
3137   TH1F *gHistProtonsFromXi0Process = new TH1F("gHistProtonsFromXi0Process","",51,-0.5,50.5);                                        
3138   fMCProcessesList->Add(gHistProtonsFromXi0Process);
3139   TH1F *gHistProtonsFromOmegaProcess = new TH1F("gHistProtonsFromOmegaProcess","",51,-0.5,50.5); 
3140   fMCProcessesList->Add(gHistProtonsFromOmegaProcess);
3141
3142   TH1F *gHistAntiProtonsFromKLProcess = new TH1F("gHistAntiProtonsFromKLProcess","",51,-0.5,50.5); 
3143   fMCProcessesList->Add(gHistAntiProtonsFromKLProcess);
3144   TH1F *gHistAntiProtonsFromPionProcess = new TH1F("gHistAntiProtonsFromPionProcess","",51,-0.5,50.5); 
3145   fMCProcessesList->Add(gHistAntiProtonsFromPionProcess);
3146   TH1F *gHistAntiProtonsFromKSProcess = new TH1F("gHistAntiProtonsFromKSProcess","",51,-0.5,50.5); 
3147   fMCProcessesList->Add(gHistAntiProtonsFromKSProcess);
3148   TH1F *gHistAntiProtonsFromKaonProcess = new TH1F("gHistAntiProtonsFromKaonProcess","",51,-0.5,50.5); 
3149   fMCProcessesList->Add(gHistAntiProtonsFromKaonProcess);
3150   TH1F *gHistAntiProtonsFromNeutronProcess = new TH1F("gHistAntiProtonsFromNeutronProcess","",51,-0.5,50.5); 
3151   fMCProcessesList->Add(gHistAntiProtonsFromNeutronProcess);
3152   TH1F *gHistAntiProtonsFromProtonProcess = new TH1F("gHistAntiProtonsFromProtonProcess","",51,-0.5,50.5); 
3153   fMCProcessesList->Add(gHistAntiProtonsFromProtonProcess);
3154   TH1F *gHistAntiProtonsFromLambda0Process = new TH1F("gHistAntiProtonsFromLambda0Process","",51,-0.5,50.5); 
3155   fMCProcessesList->Add(gHistAntiProtonsFromLambda0Process);
3156   TH1F *gHistAntiProtonsFromSigmaPlusProcess = new TH1F("gHistAntiProtonsFromSigmaPlusProcess","",51,-0.5,50.5); 
3157   fMCProcessesList->Add(gHistAntiProtonsFromSigmaPlusProcess);
3158 }
3159
3160 //____________________________________________________________________//
3161 void AliProtonQAAnalysis::RunMCAnalysis(AliStack* stack) {
3162   //Main analysis part - MC 
3163   for(Int_t iParticle = 0; iParticle < stack->GetNtrack(); iParticle++) {
3164     TParticle *particle = stack->Particle(iParticle);
3165     if(!particle) continue;
3166
3167     if(TMath::Abs(particle->Eta()) > 1.0) continue;//acceptance
3168     if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt)) continue;
3169     if((Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(Rapidity(particle->Px(),particle->Py(),particle->Pz()) < fMinY)) continue;
3170
3171     Int_t pdgcode = particle->GetPdgCode();
3172     if(pdgcode == 2212) {
3173       if(iParticle <= stack->GetNprimary()) 
3174         ((TH3F *)(fPDGList->At(0)))->Fill(Rapidity(particle->Px(),
3175                                                    particle->Py(),
3176                                                    particle->Pz()),
3177                                           particle->Pt(),0);
3178       else if(iParticle > stack->GetNprimary()) {
3179         Int_t lPartMother = particle->GetFirstMother();
3180         TParticle *motherParticle = stack->Particle(lPartMother);
3181         if(!motherParticle) continue;
3182         Int_t motherPDGCode = motherParticle->GetPdgCode();
3183         if(fMCProcessIdFlag)
3184           if(particle->GetUniqueID() != fMCProcessId) continue;
3185         if(fMotherParticlePDGCodeFlag)
3186           if(TMath::Abs(motherPDGCode) != fMotherParticlePDGCode) continue;
3187
3188         ((TH3F *)(fPDGList->At(0)))->Fill(Rapidity(particle->Px(),
3189                                                    particle->Py(),
3190                                                    particle->Pz()),
3191                                           particle->Pt(),
3192                                           ConvertPDGToInt(motherParticle->GetPdgCode()));
3193         //processes
3194         if(TMath::Abs(motherParticle->GetPdgCode()) == 130)
3195           ((TH1F *)(fMCProcessesList->At(0)))->Fill(particle->GetUniqueID());
3196         if(TMath::Abs(motherParticle->GetPdgCode()) == 211)
3197           ((TH1F *)(fMCProcessesList->At(1)))->Fill(particle->GetUniqueID());
3198         if(TMath::Abs(motherParticle->GetPdgCode()) == 310)
3199           ((TH1F *)(fMCProcessesList->At(2)))->Fill(particle->GetUniqueID());
3200         if(TMath::Abs(motherParticle->GetPdgCode()) == 321)
3201           ((TH1F *)(fMCProcessesList->At(3)))->Fill(particle->GetUniqueID());
3202         if(TMath::Abs(motherParticle->GetPdgCode()) == 2112)
3203           ((TH1F *)(fMCProcessesList->At(4)))->Fill(particle->GetUniqueID());
3204         if(TMath::Abs(motherParticle->GetPdgCode()) == 2212)
3205           ((TH1F *)(fMCProcessesList->At(5)))->Fill(particle->GetUniqueID());
3206         if(TMath::Abs(motherParticle->GetPdgCode()) == 3112)
3207           ((TH1F *)(fMCProcessesList->At(6)))->Fill(particle->GetUniqueID());
3208         if(TMath::Abs(motherParticle->GetPdgCode()) == 3122)
3209           ((TH1F *)(fMCProcessesList->At(7)))->Fill(particle->GetUniqueID());
3210         if(TMath::Abs(motherParticle->GetPdgCode()) == 3222)
3211           ((TH1F *)(fMCProcessesList->At(8)))->Fill(particle->GetUniqueID());
3212         if(TMath::Abs(motherParticle->GetPdgCode()) == 3312)
3213           ((TH1F *)(fMCProcessesList->At(9)))->Fill(particle->GetUniqueID());
3214         if(TMath::Abs(motherParticle->GetPdgCode()) == 3322)
3215           ((TH1F *)(fMCProcessesList->At(10)))->Fill(particle->GetUniqueID());
3216         if(TMath::Abs(motherParticle->GetPdgCode()) == 3334)
3217           ((TH1F *)(fMCProcessesList->At(11)))->Fill(particle->GetUniqueID());
3218       }//secondary proton
3219     }//pdgcode of proton
3220
3221     if(pdgcode == -2212) {
3222       if(iParticle <= stack->GetNprimary()) 
3223         ((TH3F *)(fPDGList->At(1)))->Fill(Rapidity(particle->Px(),
3224                                                    particle->Py(),
3225                                                    particle->Pz()),
3226                                           particle->Pt(),0);
3227       else if(iParticle > stack->GetNprimary()) {
3228         Int_t lPartMother = particle->GetFirstMother();
3229         TParticle *motherParticle = stack->Particle(lPartMother);
3230         if(!motherParticle) continue;
3231         Int_t motherPDGCode = motherParticle->GetPdgCode();
3232         if(fMCProcessIdFlag)
3233           if(particle->GetUniqueID() != fMCProcessId) continue;
3234         if(fMotherParticlePDGCodeFlag)
3235           if(TMath::Abs(motherPDGCode) != fMotherParticlePDGCode) continue;
3236
3237         ((TH3F *)(fPDGList->At(1)))->Fill(Rapidity(particle->Px(),
3238                                                    particle->Py(),
3239                                                    particle->Pz()),
3240                                           particle->Pt(),
3241                                           ConvertPDGToInt(motherParticle->GetPdgCode()));
3242
3243         //processes
3244         if(TMath::Abs(motherParticle->GetPdgCode()) == 130)
3245           ((TH1F *)(fMCProcessesList->At(12)))->Fill(particle->GetUniqueID());
3246         if(TMath::Abs(motherParticle->GetPdgCode()) == 211)
3247           ((TH1F *)(fMCProcessesList->At(13)))->Fill(particle->GetUniqueID());
3248         if(TMath::Abs(motherParticle->GetPdgCode()) == 310)
3249           ((TH1F *)(fMCProcessesList->At(14)))->Fill(particle->GetUniqueID());
3250         if(TMath::Abs(motherParticle->GetPdgCode()) == 321)
3251           ((TH1F *)(fMCProcessesList->At(15)))->Fill(particle->GetUniqueID());
3252         if(TMath::Abs(motherParticle->GetPdgCode()) == 2112)
3253           ((TH1F *)(fMCProcessesList->At(16)))->Fill(particle->GetUniqueID());
3254         if(TMath::Abs(motherParticle->GetPdgCode()) == 2212)
3255           ((TH1F *)(fMCProcessesList->At(17)))->Fill(particle->GetUniqueID());
3256         if(TMath::Abs(motherParticle->GetPdgCode()) == 3122)
3257           ((TH1F *)(fMCProcessesList->At(18)))->Fill(particle->GetUniqueID());
3258         if(TMath::Abs(motherParticle->GetPdgCode()) == 3222)
3259           ((TH1F *)(fMCProcessesList->At(19)))->Fill(particle->GetUniqueID());
3260       }//secondary antiproton
3261     }//pdgcode of antiproton
3262
3263   }//particle loop
3264 }
3265
3266 //____________________________________________________________________//
3267 Int_t AliProtonQAAnalysis::ConvertPDGToInt(Int_t pdgCode) {
3268   //Converts the pdg code to an int based on the following scheme:
3269   //1: PDG code: 130 - Name: K_L0
3270   //2: PDG code: 211 - Name: pi+
3271   //3: PDG code: 310 - Name: K_S0
3272   //4: PDG code: 321 - Name: K+
3273   //5: PDG code: 2112 - Name: neutron
3274   //6: PDG code: 2212 - Name: proton
3275   //7: PDG code: 3112 - Name: Sigma-
3276   //8: PDG code: 3122 - Name: Lambda0
3277   //9: PDG code: 3222 - Name: Sigma+
3278   //10: PDG code: 3312 - Name: Xi-
3279   //11: PDG code: 3322 - Name: Xi0
3280   //12: PDG code: 3334 - Name: Omega-
3281   Int_t code = -1;
3282   switch (TMath::Abs(pdgCode)) {
3283   case 130: {
3284     code = 1;
3285     break;
3286   }
3287   case 211: {
3288     code = 2;
3289     break;
3290   }
3291   case 310: {
3292     code = 3;
3293     break;
3294   }
3295   case 321: {
3296     code = 4;
3297     break;
3298   }
3299   case 2112: {
3300     code = 5;
3301     break;
3302   }
3303   case 2212: {
3304     code = 6;
3305     break;
3306   }
3307   case 3112: {
3308     code = 7;
3309     break;
3310   }
3311   case 3122: {
3312     code = 8;
3313     break;
3314   }
3315   case 3222: {
3316     code = 9;
3317     break;
3318   }
3319   case 3312: {
3320     code = 10;
3321     break;
3322   }
3323   case 3322: {
3324     code = 11;
3325     break;
3326   }
3327   case 3334: {
3328     code = 12;
3329     break;
3330   }
3331   default: {
3332     code = -1;
3333     break;
3334   }
3335   }//switch
3336
3337   return code;
3338 }
3339
3340
3341
3342
3343
3344
3345
3346