1 #ifndef AlidNdPtAnalysisPbPbAOD_H
2 #define AlidNdPtAnalysisPbPbAOD_H
5 //------------------------------------------------------------------------------
6 // AlidNdPtAnalysisPbPbAOD class used for dNdPt analysis in PbPb collision
9 // Author: P. Luettig, 15.05.2013
10 // last modified: 08.10.2013
11 //------------------------------------------------------------------------------
17 #include "AliAnalysisTaskSE.h"
24 #include "THnSparse.h"
26 #include "TClonesArray.h"
28 #include "TParticlePDG.h"
29 #include "TDatabasePDG.h"
32 #include "AliCentrality.h"
33 #include "AliAODEvent.h"
34 #include "AliVEvent.h"
36 #include "AliInputEventHandler.h"
37 #include "AliAODInputHandler.h"
38 #include "AliAnalysisManager.h"
39 #include "AliMCEventHandler.h"
40 #include "AliAODMCHeader.h"
41 #include "AliAODMCParticle.h"
42 #include "AliGenHijingEventHeader.h"
43 #include "AliGenPythiaEventHeader.h"
44 #include "AliExternalTrackParam.h"
45 #include "AliESDtrack.h"
46 #include "AliEventplane.h"
51 class AlidNdPtAnalysisPbPbAOD : public AliAnalysisTaskSE {
53 enum CheckQuantity { cqCrossedRows = 0, cqNcluster = 1, cqChi = 2, cqLength = 3, cqRowsOverFindable = 4 };
54 enum KinematicQuantity { kqPt = 0, kqEta = 1, kqPhi = 2 };
55 enum MaxCheckQuantity { cqMax = 5 };
56 enum MaxKinematicQuantity { kqMax = 3 };
58 AlidNdPtAnalysisPbPbAOD(const char *name = "dNdPtPbPbAOD");
59 ~AlidNdPtAnalysisPbPbAOD();
61 virtual void UserCreateOutputObjects();
62 virtual void UserExec(Option_t *option);
63 virtual void Terminate(Option_t *);
65 // Set binning for Histograms (if not set default binning is used)
66 void SetBinsMult(Int_t nbins, Double_t* edges) { Printf("[I] Setting Mult Bins"); fMultNbins = nbins; fBinsMult = GetArrayClone(nbins,edges); }
67 void SetBinsPt(Int_t nbins, Double_t* edges) { Printf("[I] Setting pT Bins"); fPtNbins = nbins; fBinsPt = GetArrayClone(nbins,edges); }
68 void SetBinsPtCorr(Int_t nbins, Double_t* edges) { Printf("[I] Setting pTcorr Bins"); fPtCorrNbins = nbins; fBinsPtCorr = GetArrayClone(nbins,edges); }
69 void SetBinsPtCheck(Int_t nbins, Double_t* edges) { Printf("[I] Setting pTcheck Bins"); fPtCheckNbins = nbins; fBinsPtCheck = GetArrayClone(nbins,edges); }
70 void SetBinsEta(Int_t nbins, Double_t* edges) { Printf("[I] Setting Eta Bins"); fEtaNbins = nbins; fBinsEta = GetArrayClone(nbins,edges); }
71 void SetBinsEtaCheck(Int_t nbins, Double_t* edges) { Printf("[I] Setting EtaCheck Bins"); fEtaCheckNbins = nbins; fBinsEtaCheck = GetArrayClone(nbins,edges); }
72 void SetBinsZv(Int_t nbins, Double_t* edges) { Printf("[I] Setting Zv Bins"); fZvNbins = nbins; fBinsZv= GetArrayClone(nbins,edges); }
73 void SetBinsCentrality(Int_t nbins, Double_t* edges) { Printf("[I] Setting Cent Bins"); fCentralityNbins = nbins; fBinsCentrality = GetArrayClone(nbins,edges); }
74 void SetBinsPhi(Int_t nbins, Double_t* edges) { Printf("[I] Setting Phi Bins"); fPhiNbins = nbins; fBinsPhi = GetArrayClone(nbins,edges); }
76 // set event cut variables
77 void SetCutMaxZVertex( Double_t d) { fCutMaxZVertex = d; }
78 Double_t GetCutMaxZVertex() { return fCutMaxZVertex; }
80 // set track kinematic cut parameters
81 void SetCutPtRange(Double_t ptmin, Double_t ptmax) { fCutPtMin = ptmin; fCutPtMax = ptmax; }
82 Double_t GetCutPtMin() { return fCutPtMin; }
83 Double_t GetCutPtMax() { return fCutPtMax; }
85 void SetCutEtaRange(Double_t etamin, Double_t etamax) { fCutEtaMin = etamin; fCutEtaMax = etamax; }
86 Double_t GetCutEtaMin() { return fCutEtaMin; }
87 Double_t GetCutEtaMax() { return fCutEtaMax; }
89 void EnableRelativeCuts() { Printf("[I] Relative Cuts enabled"); fUseRelativeCuts = kTRUE; }
90 Bool_t AreRelativeCutsEnabled() { return fUseRelativeCuts; }
92 // setter and getter track quality cut parameters
93 void SetFilterBit(Int_t b) { fFilterBit = b; };
94 Int_t GetFilterBit() { return fFilterBit; }
96 void SetCutRequireTPCRefit(Bool_t *b) { fCutRequireTPCRefit = b; }
97 Bool_t IsTPCRefitRequired() { return fCutRequireTPCRefit; }
99 void SetCutRequireITSRefit(Bool_t *b) { fCutRequireITSRefit = b; }
100 Bool_t IsITSRefitRequired() { return fCutRequireITSRefit; }
102 void SetCutMinNClustersTPC(Double_t d) { fCutMinNumberOfClusters = d; }
103 Double_t GetCutMinNClustersTPC() { return fCutMinNumberOfClusters; }
105 void SetCutPercMinNClustersTPC(Double_t d) { Printf("[I] Take only %.2f%% tracks with most clusters", d*100.); fCutPercMinNumberOfClusters = d; }
106 Double_t GetCutPercMinNClustersTPC() { return fCutPercMinNumberOfClusters; }
108 void SetCutMinNCrossedRowsTPC(Double_t d) { fCutMinNumberOfCrossedRows = d; }
109 Double_t GetCutMinNCrossedRowsTPC() { return fCutMinNumberOfCrossedRows; }
111 void SetCutPercMinNCrossedRowsTPC(Double_t d) { Printf("[I] Take only %.2f%% tracks with most crossedRows", d*100.); fCutPercMinNumberOfCrossedRows = d; }
112 Double_t GetCutPercMinNCrossedRowsTPC() { return fCutPercMinNumberOfCrossedRows; }
114 void SetCutMinRatioCrossedRowsOverFindableClustersTPC(Double_t d) { fCutMinRatioCrossedRowsOverFindableClustersTPC = d; }
115 Double_t GetCutMinRatioCrossedRowsOverFindableClustersTPC() { return fCutMinRatioCrossedRowsOverFindableClustersTPC; }
117 void SetCutLengthInTPCPtDependent(Bool_t b) { fCutLengthInTPCPtDependent = b; }
118 Bool_t DoCutLengthInTPCPtDependent() { return fCutLengthInTPCPtDependent; }
120 void SetPrefactorLengthInTPCPtDependent(Double_t d) { fPrefactorLengthInTPCPtDependent = d; }
121 Double_t GetPrefactorLengthInTPCPtDependent() { return fPrefactorLengthInTPCPtDependent; }
123 void SetCutMaxChi2PerClusterTPC(Double_t d) { fCutMaxChi2PerClusterTPC = d; }
124 void SetCutMaxFractionSharedTPCClusters(Double_t d) { fCutMaxFractionSharedTPCClusters = d; }
125 void SetCutMaxDCAToVertexZ(Double_t d) { fCutMaxDCAToVertexZ = d; }
126 void SetCutMaxDCAToVertexXY(Double_t d) { fCutMaxDCAToVertexXY = d; }
127 void SetCutMaxChi2PerClusterITS(Double_t d) { fCutMaxChi2PerClusterITS = d; }
128 void SetCutDCAToVertex2D(Bool_t *b) { fCutDCAToVertex2D = b; }
129 void SetCutRequireSigmaToVertex(Bool_t *b) { fCutRequireSigmaToVertex = b; }
130 void SetCutMaxDCAToVertexXYPtDep(Double_t d0, Double_t d1, Double_t d2)
132 fCutMaxDCAToVertexXYPtDepPar0 = d0;
133 fCutMaxDCAToVertexXYPtDepPar1 = d1;
134 fCutMaxDCAToVertexXYPtDepPar2 = d2;
136 void SetCutAcceptKinkDaughters(Bool_t *b) { fCutAcceptKinkDaughters = b; }
137 void SetCutMaxChi2TPCConstrainedGlobal(Double_t d) { fCutMaxChi2TPCConstrainedGlobal = d; }
139 // fill function for cross check histos
140 Bool_t FillDebugHisto(Double_t *dCrossCheckVar, Double_t *dKineVar, Double_t dCentrality, Bool_t bIsAccepted);
142 // fill function for cut settings
143 void StoreCutSettingsToHistogram();
146 Bool_t GetDCA(const AliAODTrack *track, AliAODEvent *evt, Double_t d0z0[2]);
148 THnSparseF * GetHistZvPtEtaCent() const { return fZvPtEtaCent; }
149 TH1F * GetHistEventStatistics() const { return fEventStatistics; }
151 const char * GetParticleName(Int_t pdg);
153 AliGenHijingEventHeader* GetHijingEventHeader(AliAODMCHeader *header);
154 AliGenPythiaEventHeader* GetPythiaEventHeader(AliAODMCHeader *header);
156 Double_t RotatePhi(Double_t phiTrack, Double_t phiEP);
157 Double_t MoveMCEventplane(Double_t dMCEP);
159 Bool_t SetRelativeCuts(AliAODEvent *event);
161 Bool_t IsTrackAccepted(AliAODTrack *tr, Double_t dCentrality, Double_t bMagZ);
162 Bool_t IsMCTrackAccepted(AliAODMCParticle *part);
164 Bool_t IsHijingParticle(const AliAODMCParticle *part, AliGenHijingEventHeader* hijingGenHeader);
165 Bool_t IsPythiaParticle(const AliAODMCParticle *part, AliGenPythiaEventHeader* pythiaGenHeader);
167 static Double_t* GetArrayClone(Int_t n, Double_t* source);
175 TH1F *fPt; // simple pT histogramm
176 TH1F *fMCPt; // simple pT truth histogramm
177 THnSparseF *fZvPtEtaCent; //-> Zv:Pt:Eta:Cent
178 THnSparseF *fDeltaphiPtEtaCent; //-> Phi:Pt:Eta:Cent
179 THnSparseF *fPtResptCent; //-> 1/pt:ResolutionPt:Cent
180 THnSparseF *fMCRecPrimZvPtEtaCent; //-> MC Zv:Pt:Eta:Cent
181 THnSparseF *fMCGenZvPtEtaCent; //-> MC Zv:Pt:Eta:Cent
182 THnSparseF *fMCRecSecZvPtEtaCent; //-> MC Zv:Pt:Eta:Cent, only secondaries
183 THnSparseF *fMCRecPrimDeltaphiPtEtaCent; //-> MC Phi:Pt:Eta:Cent
184 THnSparseF *fMCGenDeltaphiPtEtaCent; //-> MC Phi:Pt:Eta:Cent
185 THnSparseF *fMCRecSecDeltaphiPtEtaCent; //-> MC Phi:Pt:Eta:Cent, only secondaries
186 TH1F *fEventStatistics; // contains statistics of number of events after each cut
187 TH1F *fEventStatisticsCentrality; // contains number of events vs centrality, events need to have a track in kinematic range
188 TH1F *fMCEventStatisticsCentrality; // contains MC number of events vs centrality, events need to have a track in kinematic range
189 TH1F *fAllEventStatisticsCentrality; // contains number of events vs centrality, events need to be triggered
190 TH2F *fEventStatisticsCentralityTrigger; // contains number of events vs centrality in 1% bins vs trigger
191 THnSparseF *fZvMultCent; // Zv:Mult:Cent
192 TH1F *fTriggerStatistics; // contains number of events per trigger
193 TH1F *fCharge; // charge distribution in data
194 TH1F *fMCCharge; // charge distribution in MC
195 THnSparseF *fDCAPtAll; //control histo: DCAz:DCAxy:pT:eta:phi for all reconstructed tracks
196 THnSparseF *fDCAPtAccepted; //control histo: DCAz:DCAxy:pT:eta:phi for all accepted reco tracks
197 THnSparseF *fMCDCAPtSecondary; //control histo: DCAz:DCAxy:pT:eta:phi for all accepted reco track, which are secondaries (using MC info)
198 THnSparseF *fMCDCAPtPrimary; //control histo: DCAz:DCAxy:pT:eta:phi for all accepted reco track, which are primaries (using MC info)
199 THnF *fCrossCheckAll[5]; //control histo: {CrossedRows,Ncluster,Chi,Length,CrossedRows/Findable} vs pT,eta,phi,Centrality for all tracks
200 THnF *fCrossCheckAcc[5]; //control histo: {CrossedRows,Ncluster,Chi,Length,CrossedRows/Findable} vs pT,eta,phi,Centrality after cuts
201 TH1F *fCutPercClusters; // control histo: number of clusters, where the relative cut has been set e-by-e
202 TH1F *fCutPercCrossed; // control histo: number of crossed rows, where the relative cut has been set e-by-e
203 TH2F *fCrossCheckRowsLength; // control histo: number of crossed rows vs length in TPC
204 TH2F *fCrossCheckClusterLength; // control histo: number of clusters vs length in TPC
205 TH2F *fCrossCheckRowsLengthAcc; // control histo: number of crossed rows vs length in TPC for all accepted tracks
206 TH2F *fCrossCheckClusterLengthAcc; // control histo: number of clusters vs length in TPC for all accepted tracks
207 TH1F *fCutSettings; // control histo: cut settings
209 TH1F *fEventplaneDist; // event plane distribution in phi
210 TH1F *fMCEventplaneDist; // MC event plane distribution in phi
211 TH2F *fCorrelEventplaneMCDATA; // correlation between data and MC eventplane
213 Bool_t fIsMonteCarlo;
215 // event cut variables
216 Double_t fCutMaxZVertex;
218 // track kinematic cut variables
224 // track quality cut variables
226 Bool_t fUseRelativeCuts;
227 Bool_t fCutRequireTPCRefit;
228 Bool_t fCutRequireITSRefit;
229 Double_t fCutMinNumberOfClusters;
230 Double_t fCutPercMinNumberOfClusters;
231 Double_t fCutMinNumberOfCrossedRows;
232 Double_t fCutPercMinNumberOfCrossedRows;
233 Double_t fCutMinRatioCrossedRowsOverFindableClustersTPC;
234 Double_t fCutMaxChi2PerClusterTPC;
235 Double_t fCutMaxFractionSharedTPCClusters;
236 Double_t fCutMaxDCAToVertexZ;
237 Double_t fCutMaxDCAToVertexXY;
238 Double_t fCutMaxChi2PerClusterITS;
239 Bool_t fCutDCAToVertex2D;
240 Bool_t fCutRequireSigmaToVertex;
241 Double_t fCutMaxDCAToVertexXYPtDepPar0;
242 Double_t fCutMaxDCAToVertexXYPtDepPar1;
243 Double_t fCutMaxDCAToVertexXYPtDepPar2;
244 Bool_t fCutAcceptKinkDaughters;
245 Double_t fCutMaxChi2TPCConstrainedGlobal;
246 Bool_t fCutLengthInTPCPtDependent;
247 Double_t fPrefactorLengthInTPCPtDependent;
249 //binning for THNsparse
255 Int_t fEtaCheckNbins;
257 Int_t fCentralityNbins;
259 Double_t* fBinsMult; //[fMultNbins]
260 Double_t* fBinsPt; //[fPtNbins]
261 Double_t* fBinsPtCorr; //[fPtCorrNbins]
262 Double_t* fBinsPtCheck; //[fPtCheckNbins]
263 Double_t* fBinsEta; //[fEtaNbins]
264 Double_t* fBinsEtaCheck; //[fEtaCheckNbins]
265 Double_t* fBinsZv; //[fZvNbins]
266 Double_t* fBinsCentrality; //[fCentralityNbins]
267 Double_t* fBinsPhi; //[fPhiNbins]
269 AlidNdPtAnalysisPbPbAOD(const AlidNdPtAnalysisPbPbAOD&); // not implemented
270 AlidNdPtAnalysisPbPbAOD& operator=(const AlidNdPtAnalysisPbPbAOD&); // not implemented
272 ClassDef(AlidNdPtAnalysisPbPbAOD,7); // has to be at least 1, otherwise not streamable...