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: 10.06.2014
11 //------------------------------------------------------------------------------
17 #include "AliAnalysisTaskSE.h"
24 #include "THnSparse.h"
26 #include "TClonesArray.h"
30 #include "TParticlePDG.h"
31 #include "TDatabasePDG.h"
34 #include "AliCentrality.h"
35 #include "AliAODEvent.h"
36 #include "AliVEvent.h"
38 #include "AliInputEventHandler.h"
39 #include "AliAODInputHandler.h"
40 #include "AliAnalysisManager.h"
41 #include "AliMCEventHandler.h"
42 #include "AliAODMCHeader.h"
43 #include "AliAODMCParticle.h"
44 #include "AliGenHijingEventHeader.h"
45 #include "AliGenPythiaEventHeader.h"
46 #include "AliExternalTrackParam.h"
47 #include "AliESDtrack.h"
48 #include "AliEventplane.h"
53 class AlidNdPtAnalysisPbPbAOD : public AliAnalysisTaskSE {
55 enum CheckQuantity { cqCrossedRows = 0, cqNcluster = 1, cqChi = 2, cqLength = 3, cqRowsOverFindable = 4 };
56 enum KinematicQuantity { kqPt = 0, kqEta = 1, kqPhi = 2 };
57 enum MaxCheckQuantity { cqMax = 5 };
58 enum MaxKinematicQuantity { kqMax = 3 };
60 AlidNdPtAnalysisPbPbAOD(const char *name = "dNdPtPbPbAOD");
61 ~AlidNdPtAnalysisPbPbAOD();
63 virtual void UserCreateOutputObjects();
64 virtual void UserExec(Option_t *option);
65 virtual void Terminate(Option_t *);
67 // Set binning for Histograms (if not set default binning is used)
68 void SetBinsMult(Int_t nbins, Double_t* edges) { Printf("[I] Setting Mult Bins"); fMultNbins = nbins; fBinsMult = GetArrayClone(nbins,edges); }
69 void SetBinsPt(Int_t nbins, Double_t* edges) { Printf("[I] Setting pT Bins"); fPtNbins = nbins; fBinsPt = GetArrayClone(nbins,edges); }
70 void SetBinsPtCorr(Int_t nbins, Double_t* edges) { Printf("[I] Setting pTcorr Bins"); fPtCorrNbins = nbins; fBinsPtCorr = GetArrayClone(nbins,edges); }
71 void SetBinsPtCheck(Int_t nbins, Double_t* edges) { Printf("[I] Setting pTcheck Bins"); fPtCheckNbins = nbins; fBinsPtCheck = GetArrayClone(nbins,edges); }
72 void SetBinsEta(Int_t nbins, Double_t* edges) { Printf("[I] Setting Eta Bins"); fEtaNbins = nbins; fBinsEta = GetArrayClone(nbins,edges); }
73 void SetBinsEtaCheck(Int_t nbins, Double_t* edges) { Printf("[I] Setting EtaCheck Bins"); fEtaCheckNbins = nbins; fBinsEtaCheck = GetArrayClone(nbins,edges); }
74 void SetBinsZv(Int_t nbins, Double_t* edges) { Printf("[I] Setting Zv Bins"); fZvNbins = nbins; fBinsZv= GetArrayClone(nbins,edges); }
75 void SetBinsCentrality(Int_t nbins, Double_t* edges) { Printf("[I] Setting Cent Bins"); fCentralityNbins = nbins; fBinsCentrality = GetArrayClone(nbins,edges); }
76 void SetBinsPhi(Int_t nbins, Double_t* edges) { Printf("[I] Setting Phi Bins"); fPhiNbins = nbins; fBinsPhi = GetArrayClone(nbins,edges); }
78 // set event cut variables
79 void SetCutMaxZVertex( Double_t d) { fCutMaxZVertex = d; }
80 Double_t GetCutMaxZVertex() { return fCutMaxZVertex; }
82 // set track kinematic cut parameters
83 void SetCutPtRange(Double_t ptmin, Double_t ptmax) { fCutPtMin = ptmin; fCutPtMax = ptmax; }
84 Double_t GetCutPtMin() { return fCutPtMin; }
85 Double_t GetCutPtMax() { return fCutPtMax; }
87 void SetCutEtaRange(Double_t etamin, Double_t etamax) { fCutEtaMin = etamin; fCutEtaMax = etamax; }
88 Double_t GetCutEtaMin() { return fCutEtaMin; }
89 Double_t GetCutEtaMax() { return fCutEtaMax; }
91 void EnableRelativeCuts() { Printf("[I] Relative Cuts enabled"); fUseRelativeCuts = kTRUE; }
92 Bool_t AreRelativeCutsEnabled() { return fUseRelativeCuts; }
94 // setter and getter track quality cut parameters
95 void SetFilterBit(Int_t b) { fFilterBit = b; };
96 Int_t GetFilterBit() { return fFilterBit; }
98 void SetCutRequireTPCRefit(Bool_t *b) { fCutRequireTPCRefit = b; }
99 Bool_t IsTPCRefitRequired() { return fCutRequireTPCRefit; }
101 void SetCutRequireITSRefit(Bool_t *b) { fCutRequireITSRefit = b; }
102 Bool_t IsITSRefitRequired() { return fCutRequireITSRefit; }
104 void SetCutMinNClustersTPC(Double_t d) { fCutMinNumberOfClusters = d; }
105 Double_t GetCutMinNClustersTPC() { return fCutMinNumberOfClusters; }
107 void SetCutPercMinNClustersTPC(Double_t d) { Printf("[I] Take only %.2f%% tracks with most clusters", d*100.); fCutPercMinNumberOfClusters = d; }
108 Double_t GetCutPercMinNClustersTPC() { return fCutPercMinNumberOfClusters; }
110 void SetCutMinNCrossedRowsTPC(Double_t d) { fCutMinNumberOfCrossedRows = d; }
111 Double_t GetCutMinNCrossedRowsTPC() { return fCutMinNumberOfCrossedRows; }
113 void SetCutPercMinNCrossedRowsTPC(Double_t d) { Printf("[I] Take only %.2f%% tracks with most crossedRows", d*100.); fCutPercMinNumberOfCrossedRows = d; }
114 Double_t GetCutPercMinNCrossedRowsTPC() { return fCutPercMinNumberOfCrossedRows; }
116 void SetCutMinRatioCrossedRowsOverFindableClustersTPC(Double_t d) { fCutMinRatioCrossedRowsOverFindableClustersTPC = d; }
117 Double_t GetCutMinRatioCrossedRowsOverFindableClustersTPC() { return fCutMinRatioCrossedRowsOverFindableClustersTPC; }
119 void SetCutLengthInTPCPtDependent(Bool_t b) { fCutLengthInTPCPtDependent = b; }
120 Bool_t DoCutLengthInTPCPtDependent() { return fCutLengthInTPCPtDependent; }
122 void SetPrefactorLengthInTPCPtDependent(Double_t d) { fPrefactorLengthInTPCPtDependent = d; }
123 Double_t GetPrefactorLengthInTPCPtDependent() { return fPrefactorLengthInTPCPtDependent; }
125 void SetCutMaxChi2PerClusterTPC(Double_t d) { fCutMaxChi2PerClusterTPC = d; }
126 void SetCutMaxFractionSharedTPCClusters(Double_t d) { fCutMaxFractionSharedTPCClusters = d; }
127 void SetCutMaxDCAToVertexZ(Double_t d) { fCutMaxDCAToVertexZ = d; }
128 void SetCutMaxDCAToVertexXY(Double_t d) { fCutMaxDCAToVertexXY = d; }
129 void SetCutMaxChi2PerClusterITS(Double_t d) { fCutMaxChi2PerClusterITS = d; }
130 void SetCutDCAToVertex2D(Bool_t *b) { fCutDCAToVertex2D = b; }
131 void SetCutRequireSigmaToVertex(Bool_t *b) { fCutRequireSigmaToVertex = b; }
132 void SetCutMaxDCAToVertexXYPtDep(Double_t d0, Double_t d1, Double_t d2)
134 fCutMaxDCAToVertexXYPtDepPar0 = d0;
135 fCutMaxDCAToVertexXYPtDepPar1 = d1;
136 fCutMaxDCAToVertexXYPtDepPar2 = d2;
138 void SetCutAcceptKinkDaughters(Bool_t *b) { fCutAcceptKinkDaughters = b; }
139 void SetCutMaxChi2TPCConstrainedGlobal(Double_t d) { fCutMaxChi2TPCConstrainedGlobal = d; }
141 // fill function for cross check histos
142 Bool_t FillDebugHisto(Double_t *dCrossCheckVar, Double_t *dKineVar, Double_t dCentrality, Bool_t bIsAccepted);
144 // fill function for cut settings
145 void StoreCutSettingsToHistogram();
148 Bool_t GetDCA(const AliAODTrack *track, AliAODEvent *evt, Double_t d0z0[2]);
150 THnSparseF * GetHistZvPtEtaCent() const { return fZvPtEtaCent; }
151 TH1F * GetHistEventStatistics() const { return fEventStatistics; }
153 const char * GetParticleName(Int_t pdg);
155 AliGenHijingEventHeader* GetHijingEventHeader(AliAODMCHeader *header);
156 AliGenPythiaEventHeader* GetPythiaEventHeader(AliAODMCHeader *header);
158 Double_t RotatePhi(Double_t phiTrack, Double_t phiEP);
159 Double_t MoveEventplane(Double_t dMCEP);
161 Bool_t SetRelativeCuts(AliAODEvent *event);
163 Bool_t IsTrackAccepted(AliAODTrack *tr, Double_t dCentrality, Double_t bMagZ);
164 Bool_t IsMCTrackAccepted(AliAODMCParticle *part);
166 Bool_t IsHijingParticle(const AliAODMCParticle *part, AliGenHijingEventHeader* hijingGenHeader);
167 Bool_t IsPythiaParticle(const AliAODMCParticle *part, AliGenPythiaEventHeader* pythiaGenHeader);
169 static Double_t* GetArrayClone(Int_t n, Double_t* source);
171 void SetEventplaneSelector(char *c) { fEPselector = c; }
172 TString GetEventplaneSelector() { return fEPselector; }
180 TH1F *fPt; // simple pT histogramm
181 TH1F *fMCPt; // simple pT truth histogramm
182 THnSparseF *fZvPtEtaCent; //-> Zv:Pt:Eta:Cent
183 THnSparseF *fDeltaphiPtEtaCent; //-> Phi:Pt:Eta:Cent
184 THnSparseF *fPtResptCent; //-> 1/pt:ResolutionPt:Cent
185 THnSparseF *fMCRecPrimZvPtEtaCent; //-> MC Zv:Pt:Eta:Cent
186 THnSparseF *fMCGenZvPtEtaCent; //-> MC Zv:Pt:Eta:Cent
187 THnSparseF *fMCRecSecZvPtEtaCent; //-> MC Zv:Pt:Eta:Cent, only secondaries
188 THnSparseF *fMCRecPrimDeltaphiPtEtaCent; //-> MC Phi:Pt:Eta:Cent
189 THnSparseF *fMCGenDeltaphiPtEtaCent; //-> MC Phi:Pt:Eta:Cent
190 THnSparseF *fMCRecSecDeltaphiPtEtaCent; //-> MC Phi:Pt:Eta:Cent, only secondaries
191 TH1F *fEventStatistics; // contains statistics of number of events after each cut
192 TH1F *fEventStatisticsCentrality; // contains number of events vs centrality, events need to have a track in kinematic range
193 TH1F *fMCEventStatisticsCentrality; // contains MC number of events vs centrality, events need to have a track in kinematic range
194 TH1F *fAllEventStatisticsCentrality; // contains number of events vs centrality, events need to be triggered
195 TH2F *fEventStatisticsCentralityTrigger; // contains number of events vs centrality in 1% bins vs trigger
196 THnSparseF *fZvMultCent; // Zv:Mult:Cent
197 TH1F *fTriggerStatistics; // contains number of events per trigger
198 TH1F *fCharge; // charge distribution in data
199 TH1F *fMCCharge; // charge distribution in MC
200 THnSparseF *fDCAPtAll; //control histo: DCAz:DCAxy:pT:eta:phi for all reconstructed tracks
201 THnSparseF *fDCAPtAccepted; //control histo: DCAz:DCAxy:pT:eta:phi for all accepted reco tracks
202 THnSparseF *fMCDCAPtSecondary; //control histo: DCAz:DCAxy:pT:eta:phi for all accepted reco track, which are secondaries (using MC info)
203 THnSparseF *fMCDCAPtPrimary; //control histo: DCAz:DCAxy:pT:eta:phi for all accepted reco track, which are primaries (using MC info)
204 THnF *fCrossCheckAll[5]; //control histo: {CrossedRows,Ncluster,Chi,Length,CrossedRows/Findable} vs pT,eta,phi,Centrality for all tracks
205 THnF *fCrossCheckAcc[5]; //control histo: {CrossedRows,Ncluster,Chi,Length,CrossedRows/Findable} vs pT,eta,phi,Centrality after cuts
206 TH1F *fCutPercClusters; // control histo: number of clusters, where the relative cut has been set e-by-e
207 TH1F *fCutPercCrossed; // control histo: number of crossed rows, where the relative cut has been set e-by-e
208 TH2F *fCrossCheckRowsLength; // control histo: number of crossed rows vs length in TPC
209 TH2F *fCrossCheckClusterLength; // control histo: number of clusters vs length in TPC
210 TH2F *fCrossCheckRowsLengthAcc; // control histo: number of crossed rows vs length in TPC for all accepted tracks
211 TH2F *fCrossCheckClusterLengthAcc; // control histo: number of clusters vs length in TPC for all accepted tracks
212 TH1F *fCutSettings; // control histo: cut settings
214 TH1F *fEventplaneDist; // event plane distribution in phi
215 TH1F *fMCEventplaneDist; // MC event plane distribution in phi
216 TH2F *fCorrelEventplaneMCDATA; // correlation between data and MC eventplane
218 // cross check for event plane resolution
219 TH2F *fEPDistCent; // event plane distribution vs centrality
220 TH2F *fPhiCent; // particle phi distribution vs centrality
221 TProfile *fPcosEPCent; // < cos 2 psi_ep > vs centrality
222 TProfile *fPsinEPCent; // < sin 2 psi_ep > vs centrality
223 TProfile *fPcosPhiCent; // < cos 2 phi > vs centrality
224 TProfile *fPsinPhiCent; // < sin 2 phi > vs centrality
227 Bool_t fIsMonteCarlo;
231 // event cut variables
232 Double_t fCutMaxZVertex;
234 // track kinematic cut variables
240 // track quality cut variables
242 Bool_t fUseRelativeCuts;
243 Bool_t fCutRequireTPCRefit;
244 Bool_t fCutRequireITSRefit;
245 Double_t fCutMinNumberOfClusters;
246 Double_t fCutPercMinNumberOfClusters;
247 Double_t fCutMinNumberOfCrossedRows;
248 Double_t fCutPercMinNumberOfCrossedRows;
249 Double_t fCutMinRatioCrossedRowsOverFindableClustersTPC;
250 Double_t fCutMaxChi2PerClusterTPC;
251 Double_t fCutMaxFractionSharedTPCClusters;
252 Double_t fCutMaxDCAToVertexZ;
253 Double_t fCutMaxDCAToVertexXY;
254 Double_t fCutMaxChi2PerClusterITS;
255 Bool_t fCutDCAToVertex2D;
256 Bool_t fCutRequireSigmaToVertex;
257 Double_t fCutMaxDCAToVertexXYPtDepPar0;
258 Double_t fCutMaxDCAToVertexXYPtDepPar1;
259 Double_t fCutMaxDCAToVertexXYPtDepPar2;
260 Bool_t fCutAcceptKinkDaughters;
261 Double_t fCutMaxChi2TPCConstrainedGlobal;
262 Bool_t fCutLengthInTPCPtDependent;
263 Double_t fPrefactorLengthInTPCPtDependent;
265 //binning for THNsparse
271 Int_t fEtaCheckNbins;
273 Int_t fCentralityNbins;
275 Double_t* fBinsMult; //[fMultNbins]
276 Double_t* fBinsPt; //[fPtNbins]
277 Double_t* fBinsPtCorr; //[fPtCorrNbins]
278 Double_t* fBinsPtCheck; //[fPtCheckNbins]
279 Double_t* fBinsEta; //[fEtaNbins]
280 Double_t* fBinsEtaCheck; //[fEtaCheckNbins]
281 Double_t* fBinsZv; //[fZvNbins]
282 Double_t* fBinsCentrality; //[fCentralityNbins]
283 Double_t* fBinsPhi; //[fPhiNbins]
285 AlidNdPtAnalysisPbPbAOD(const AlidNdPtAnalysisPbPbAOD&); // not implemented
286 AlidNdPtAnalysisPbPbAOD& operator=(const AlidNdPtAnalysisPbPbAOD&); // not implemented
288 ClassDef(AlidNdPtAnalysisPbPbAOD,8); // has to be at least 1, otherwise not streamable...