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"
31 #include "TParticlePDG.h"
32 #include "TDatabasePDG.h"
35 #include "AliCentrality.h"
36 #include "AliAODEvent.h"
37 #include "AliVEvent.h"
39 #include "AliInputEventHandler.h"
40 #include "AliAODInputHandler.h"
41 #include "AliAnalysisManager.h"
42 #include "AliMCEventHandler.h"
43 #include "AliAODMCHeader.h"
44 #include "AliAODMCParticle.h"
45 #include "AliGenHijingEventHeader.h"
46 #include "AliGenPythiaEventHeader.h"
47 #include "AliExternalTrackParam.h"
48 #include "AliESDtrack.h"
49 #include "AliEventplane.h"
54 class AlidNdPtAnalysisPbPbAOD : public AliAnalysisTaskSE {
56 enum CheckQuantity { cqCrossedRows = 0, cqNcluster = 1, cqChi = 2, cqLength = 3, cqRowsOverFindable = 4 };
57 enum KinematicQuantity { kqPt = 0, kqEta = 1, kqPhi = 2 };
58 enum MaxCheckQuantity { cqMax = 5 };
59 enum MaxKinematicQuantity { kqMax = 3 };
61 AlidNdPtAnalysisPbPbAOD(const char *name = "dNdPtPbPbAOD");
62 ~AlidNdPtAnalysisPbPbAOD();
64 virtual void UserCreateOutputObjects();
65 virtual void UserExec(Option_t *option);
66 virtual void Terminate(Option_t *);
68 // Set binning for Histograms (if not set default binning is used)
69 void SetBinsMult(Int_t nbins, Double_t* edges) { Printf("[I] Setting Mult Bins"); fMultNbins = nbins; fBinsMult = GetArrayClone(nbins,edges); }
70 void SetBinsPt(Int_t nbins, Double_t* edges) { Printf("[I] Setting pT Bins"); fPtNbins = nbins; fBinsPt = GetArrayClone(nbins,edges); }
71 void SetBinsPtCorr(Int_t nbins, Double_t* edges) { Printf("[I] Setting pTcorr Bins"); fPtCorrNbins = nbins; fBinsPtCorr = GetArrayClone(nbins,edges); }
72 void SetBinsPtCheck(Int_t nbins, Double_t* edges) { Printf("[I] Setting pTcheck Bins"); fPtCheckNbins = nbins; fBinsPtCheck = GetArrayClone(nbins,edges); }
73 void SetBinsEta(Int_t nbins, Double_t* edges) { Printf("[I] Setting Eta Bins"); fEtaNbins = nbins; fBinsEta = GetArrayClone(nbins,edges); }
74 void SetBinsEtaCheck(Int_t nbins, Double_t* edges) { Printf("[I] Setting EtaCheck Bins"); fEtaCheckNbins = nbins; fBinsEtaCheck = GetArrayClone(nbins,edges); }
75 void SetBinsZv(Int_t nbins, Double_t* edges) { Printf("[I] Setting Zv Bins"); fZvNbins = nbins; fBinsZv= GetArrayClone(nbins,edges); }
76 void SetBinsCentrality(Int_t nbins, Double_t* edges) { Printf("[I] Setting Cent Bins"); fCentralityNbins = nbins; fBinsCentrality = GetArrayClone(nbins,edges); }
77 void SetBinsPhi(Int_t nbins, Double_t* edges) { Printf("[I] Setting Phi Bins"); fPhiNbins = nbins; fBinsPhi = GetArrayClone(nbins,edges); }
78 void SetBinsRunNumber(Int_t nbins, Double_t* edges) { Printf("[I] Setting RunNumber Bins"); fRunNumberNbins = nbins; fBinsRunNumber = GetArrayClone(nbins,edges); }
80 // set event cut variables
81 void SetCutMaxZVertex( Double_t d) { fCutMaxZVertex = d; }
82 Double_t GetCutMaxZVertex() { return fCutMaxZVertex; }
84 // set track kinematic cut parameters
85 void SetCutPtRange(Double_t ptmin, Double_t ptmax) { fCutPtMin = ptmin; fCutPtMax = ptmax; }
86 Double_t GetCutPtMin() { return fCutPtMin; }
87 Double_t GetCutPtMax() { return fCutPtMax; }
89 void SetCutEtaRange(Double_t etamin, Double_t etamax) { fCutEtaMin = etamin; fCutEtaMax = etamax; }
90 Double_t GetCutEtaMin() { return fCutEtaMin; }
91 Double_t GetCutEtaMax() { return fCutEtaMax; }
93 void EnableRelativeCuts() { Printf("[I] Relative Cuts enabled"); fUseRelativeCuts = kTRUE; }
94 Bool_t AreRelativeCutsEnabled() { return fUseRelativeCuts; }
96 // setter and getter track quality cut parameters
97 void SetFilterBit(Int_t b) { fFilterBit = b; };
98 Int_t GetFilterBit() { return fFilterBit; }
100 void SetCutRequireTPCRefit(Bool_t *b) { fCutRequireTPCRefit = b; }
101 Bool_t IsTPCRefitRequired() { return fCutRequireTPCRefit; }
103 void SetCutRequireITSRefit(Bool_t *b) { fCutRequireITSRefit = b; }
104 Bool_t IsITSRefitRequired() { return fCutRequireITSRefit; }
106 void SetCutMinNClustersTPC(Double_t d) { fCutMinNumberOfClusters = d; }
107 Double_t GetCutMinNClustersTPC() { return fCutMinNumberOfClusters; }
109 void SetCutPercMinNClustersTPC(Double_t d) { Printf("[I] Take only %.2f%% tracks with most clusters", d*100.); fCutPercMinNumberOfClusters = d; }
110 Double_t GetCutPercMinNClustersTPC() { return fCutPercMinNumberOfClusters; }
112 void SetCutMinNCrossedRowsTPC(Double_t d) { fCutMinNumberOfCrossedRows = d; }
113 Double_t GetCutMinNCrossedRowsTPC() { return fCutMinNumberOfCrossedRows; }
115 void SetCutPercMinNCrossedRowsTPC(Double_t d) { Printf("[I] Take only %.2f%% tracks with most crossedRows", d*100.); fCutPercMinNumberOfCrossedRows = d; }
116 Double_t GetCutPercMinNCrossedRowsTPC() { return fCutPercMinNumberOfCrossedRows; }
118 void SetCutMinRatioCrossedRowsOverFindableClustersTPC(Double_t d) { fCutMinRatioCrossedRowsOverFindableClustersTPC = d; }
119 Double_t GetCutMinRatioCrossedRowsOverFindableClustersTPC() { return fCutMinRatioCrossedRowsOverFindableClustersTPC; }
121 void SetCutLengthInTPCPtDependent(Bool_t b) { fCutLengthInTPCPtDependent = b; }
122 Bool_t DoCutLengthInTPCPtDependent() { return fCutLengthInTPCPtDependent; }
124 void SetPrefactorLengthInTPCPtDependent(Double_t d) { fPrefactorLengthInTPCPtDependent = d; }
125 Double_t GetPrefactorLengthInTPCPtDependent() { return fPrefactorLengthInTPCPtDependent; }
127 void SetCutMaxChi2PerClusterTPC(Double_t d) { fCutMaxChi2PerClusterTPC = d; }
128 void SetCutMaxFractionSharedTPCClusters(Double_t d) { fCutMaxFractionSharedTPCClusters = d; }
129 void SetCutMaxDCAToVertexZ(Double_t d) { fCutMaxDCAToVertexZ = d; }
130 void SetCutMaxDCAToVertexXY(Double_t d) { fCutMaxDCAToVertexXY = d; }
131 void SetCutMaxChi2PerClusterITS(Double_t d) { fCutMaxChi2PerClusterITS = d; }
132 void SetCutDCAToVertex2D(Bool_t *b) { fCutDCAToVertex2D = b; }
133 void SetCutRequireSigmaToVertex(Bool_t *b) { fCutRequireSigmaToVertex = b; }
134 void SetCutMaxDCAToVertexXYPtDep(Double_t d0, Double_t d1, Double_t d2)
136 fCutMaxDCAToVertexXYPtDepPar0 = d0;
137 fCutMaxDCAToVertexXYPtDepPar1 = d1;
138 fCutMaxDCAToVertexXYPtDepPar2 = d2;
140 void SetCutAcceptKinkDaughters(Bool_t *b) { fCutAcceptKinkDaughters = b; }
141 void SetCutMaxChi2TPCConstrainedGlobal(Double_t d) { fCutMaxChi2TPCConstrainedGlobal = d; }
143 // fill function for cross check histos
144 Bool_t FillDebugHisto(Double_t *dCrossCheckVar, Double_t *dKineVar, Double_t dCentrality, Bool_t bIsAccepted);
146 // fill function for cut settings
147 void StoreCutSettingsToHistogram();
150 Bool_t GetDCA(const AliAODTrack *track, AliAODEvent *evt, Double_t d0z0[2]);
152 THnSparseF * GetHistZvPtEtaCent() const { return fZvPtEtaCent; }
153 TH1F * GetHistEventStatistics() const { return fEventStatistics; }
155 const char * GetParticleName(Int_t pdg);
157 AliGenHijingEventHeader* GetHijingEventHeader(AliAODMCHeader *header);
158 AliGenPythiaEventHeader* GetPythiaEventHeader(AliAODMCHeader *header);
160 Double_t RotatePhi(Double_t phiTrack, Double_t phiEP);
161 // Double_t MoveEventplane(Double_t dMCEP);
163 Bool_t SetRelativeCuts(AliAODEvent *event);
165 Bool_t IsTrackAccepted(AliAODTrack *tr, Double_t dCentrality, Double_t bMagZ);
166 Bool_t IsMCTrackAccepted(AliAODMCParticle *part);
168 Bool_t IsHijingParticle(const AliAODMCParticle *part, AliGenHijingEventHeader* hijingGenHeader);
169 Bool_t IsPythiaParticle(const AliAODMCParticle *part, AliGenPythiaEventHeader* pythiaGenHeader);
171 static Double_t* GetArrayClone(Int_t n, Double_t* source);
173 void SetEventplaneSelector(char *c) { fEPselector = c; }
174 TString GetEventplaneSelector() { return fEPselector; }
182 TH1F *fPt; // simple pT histogramm
183 TH1F *fMCPt; // simple pT truth histogramm
184 THnSparseF *fZvPtEtaCent; //-> Zv:Pt:Eta:Cent
185 THnSparseF *fDeltaphiPtEtaCent; //-> DeltaPhi:Pt:Eta:Cent
186 THnSparseF *fPtResptCent; //-> 1/pt:ResolutionPt:Cent
187 THnSparseF *fMCRecPrimZvPtEtaCent; //-> MC Zv:Pt:Eta:Cent
188 THnSparseF *fMCGenZvPtEtaCent; //-> MC Zv:Pt:Eta:Cent
189 THnSparseF *fMCRecSecZvPtEtaCent; //-> MC Zv:Pt:Eta:Cent, only secondaries
190 THnSparseF *fMCRecPrimDeltaphiPtEtaCent; //-> MC Phi:Pt:Eta:Cent
191 THnSparseF *fMCGenDeltaphiPtEtaCent; //-> MC Phi:Pt:Eta:Cent
192 THnSparseF *fMCRecSecDeltaphiPtEtaCent; //-> MC Phi:Pt:Eta:Cent, only secondaries
193 TH1F *fEventStatistics; // contains statistics of number of events after each cut
194 TH1F *fEventStatisticsCentrality; // contains number of events vs centrality, events need to have a track in kinematic range
195 TH1F *fMCEventStatisticsCentrality; // contains MC number of events vs centrality, events need to have a track in kinematic range
196 TH1F *fAllEventStatisticsCentrality; // contains number of events vs centrality, events need to be triggered
197 TH2F *fEventStatisticsCentralityTrigger; // contains number of events vs centrality in 1% bins vs trigger
198 THnSparseF *fZvMultCent; // Zv:Mult:Cent
199 TH1F *fTriggerStatistics; // contains number of events per trigger
200 TH1F *fCharge; // charge distribution in data
201 TH1F *fMCCharge; // charge distribution in MC
202 THnSparseF *fDCAPtAll; //control histo: DCAz:DCAxy:pT:eta:phi for all reconstructed tracks
203 THnSparseF *fDCAPtAccepted; //control histo: DCAz:DCAxy:pT:eta:phi for all accepted reco tracks
204 THnSparseF *fMCDCAPtSecondary; //control histo: DCAz:DCAxy:pT:eta:phi for all accepted reco track, which are secondaries (using MC info)
205 THnSparseF *fMCDCAPtPrimary; //control histo: DCAz:DCAxy:pT:eta:phi for all accepted reco track, which are primaries (using MC info)
206 THnF *fCrossCheckAll[5]; //control histo: {CrossedRows,Ncluster,Chi,Length,CrossedRows/Findable} vs pT,eta,phi,Centrality for all tracks
207 THnF *fCrossCheckAcc[5]; //control histo: {CrossedRows,Ncluster,Chi,Length,CrossedRows/Findable} vs pT,eta,phi,Centrality after cuts
208 TH1F *fCutPercClusters; // control histo: number of clusters, where the relative cut has been set e-by-e
209 TH1F *fCutPercCrossed; // control histo: number of crossed rows, where the relative cut has been set e-by-e
210 TH2F *fCrossCheckRowsLength; // control histo: number of crossed rows vs length in TPC
211 TH2F *fCrossCheckClusterLength; // control histo: number of clusters vs length in TPC
212 TH2F *fCrossCheckRowsLengthAcc; // control histo: number of crossed rows vs length in TPC for all accepted tracks
213 TH2F *fCrossCheckClusterLengthAcc; // control histo: number of clusters vs length in TPC for all accepted tracks
214 TH2F *fCrossCheckPtresLength; // control histo: relative pt resolution in 1/pt vs lenght in TPC
215 TH2F *fCrossCheckPtresRows; // control histo: relative pt resolution in 1/pt vs number of crossed rows in TPC
216 TH1F *fCutSettings; // control histo: cut settings
218 TH1F *fEventplaneDist; // event plane distribution in phi
219 TH2F *fEventplaneRunDist; // event plane distribution in phi
220 TH1F *fMCEventplaneDist; // MC event plane distribution in phi
221 TH2F *fCorrelEventplaneMCDATA; // correlation between data and MC eventplane
222 THnSparseF *fCorrelEventplaneDefaultCorrected; // correlation between default and corrected (== subtraction of current track) eventplane
223 TH2F *fEventplaneSubtractedPercentage; // percentage of subtracted tracks
225 // cross check for event plane resolution
226 TH2F *fEPDistCent; // event plane distribution vs centrality
227 TH2F *fPhiCent; // particle phi distribution vs centrality
228 TProfile *fPcosEPCent; // < cos 2 psi_ep > vs centrality
229 TProfile *fPsinEPCent; // < sin 2 psi_ep > vs centrality
230 TProfile *fPcosPhiCent; // < cos 2 phi > vs centrality
231 TProfile *fPsinPhiCent; // < sin 2 phi > vs centrality
233 // cross check for event plane determination
234 TH2F *fDeltaPhiCent; // DeltaPhi:Cent - DeltaPhi in the range from -pi to pi
237 Bool_t fIsMonteCarlo;
241 // event cut variables
242 Double_t fCutMaxZVertex;
244 // track kinematic cut variables
250 // track quality cut variables
252 Bool_t fUseRelativeCuts;
253 Bool_t fCutRequireTPCRefit;
254 Bool_t fCutRequireITSRefit;
255 Double_t fCutMinNumberOfClusters;
256 Double_t fCutPercMinNumberOfClusters;
257 Double_t fCutMinNumberOfCrossedRows;
258 Double_t fCutPercMinNumberOfCrossedRows;
259 Double_t fCutMinRatioCrossedRowsOverFindableClustersTPC;
260 Double_t fCutMaxChi2PerClusterTPC;
261 Double_t fCutMaxFractionSharedTPCClusters;
262 Double_t fCutMaxDCAToVertexZ;
263 Double_t fCutMaxDCAToVertexXY;
264 Double_t fCutMaxChi2PerClusterITS;
265 Bool_t fCutDCAToVertex2D;
266 Bool_t fCutRequireSigmaToVertex;
267 Double_t fCutMaxDCAToVertexXYPtDepPar0;
268 Double_t fCutMaxDCAToVertexXYPtDepPar1;
269 Double_t fCutMaxDCAToVertexXYPtDepPar2;
270 Bool_t fCutAcceptKinkDaughters;
271 Double_t fCutMaxChi2TPCConstrainedGlobal;
272 Bool_t fCutLengthInTPCPtDependent;
273 Double_t fPrefactorLengthInTPCPtDependent;
275 //binning for THNsparse
281 Int_t fEtaCheckNbins;
283 Int_t fCentralityNbins;
285 Int_t fRunNumberNbins;
286 Double_t* fBinsMult; //[fMultNbins]
287 Double_t* fBinsPt; //[fPtNbins]
288 Double_t* fBinsPtCorr; //[fPtCorrNbins]
289 Double_t* fBinsPtCheck; //[fPtCheckNbins]
290 Double_t* fBinsEta; //[fEtaNbins]
291 Double_t* fBinsEtaCheck; //[fEtaCheckNbins]
292 Double_t* fBinsZv; //[fZvNbins]
293 Double_t* fBinsCentrality; //[fCentralityNbins]
294 Double_t* fBinsPhi; //[fPhiNbins]
295 Double_t* fBinsRunNumber; //[fRunNumberNbins]
297 AlidNdPtAnalysisPbPbAOD(const AlidNdPtAnalysisPbPbAOD&); // not implemented
298 AlidNdPtAnalysisPbPbAOD& operator=(const AlidNdPtAnalysisPbPbAOD&); // not implemented
300 ClassDef(AlidNdPtAnalysisPbPbAOD,12); // has to be at least 1, otherwise not streamable...