implementing centrality flattening for 2011 data (copied from AliAnalysisTaskPhiCorre...
[u/mrichter/AliRoot.git] / PWGCF / EBYE / BalanceFunctions / AliAnalysisTaskBFPsi.h
CommitLineData
9fd4b54e 1#ifndef ALIANALYSISTASKBFPSI_H\r
2#define ALIANALYSISTASKBFPSI_H\r
0879e280 3\r
4// Analysis task for the BF vs Psi code\r
5// Authors: Panos Cristakoglou@cern.ch\r
6\r
7class TList;\r
8class TH1F;\r
9class TH2F;\r
f2e8af26 10class TH3F; \r
0879e280 11class TF1;\r
35aff0f3 12class TH3D;\r
0879e280 13\r
14class AliBalancePsi;\r
15class AliESDtrackCuts;\r
f06d59b3 16class AliEventPoolManager;\r
17\r
0879e280 18\r
19#include "AliAnalysisTaskSE.h"\r
20#include "AliBalancePsi.h"\r
21\r
22#include "AliPID.h" \r
23#include "AliPIDResponse.h"\r
24#include "AliPIDCombined.h"\r
25 \r
35aff0f3 26//================================correction\r
6fa567bd 27#define kCENTRALITY 101 \r
28//const Double_t centralityArrayForPbPb[kCENTRALITY+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.};\r
29//const TString centralityArrayForPbPb_string[kCENTRALITY] = {"0-5","5-10","10-20","20-30","30-40","40-50","50-60","60-70","70-80"};\r
35aff0f3 30//================================correction\r
0879e280 31\r
32class AliAnalysisTaskBFPsi : public AliAnalysisTaskSE {\r
33 public:\r
34 AliAnalysisTaskBFPsi(const char *name = "AliAnalysisTaskBFPsi");\r
35 virtual ~AliAnalysisTaskBFPsi(); \r
35aff0f3 36 \r
0879e280 37 virtual void UserCreateOutputObjects();\r
38 virtual void UserExec(Option_t *option);\r
39 virtual void FinishTaskOutput();\r
40 virtual void Terminate(Option_t *);\r
41\r
35aff0f3 42 //========================correction\r
c3b1f1a5 43 virtual void SetInputCorrection(TString filename, \r
44 Int_t nCentralityBins, \r
45 Double_t *centralityArrayForCorrections);\r
35aff0f3 46 //========================correction\r
c16b246d 47 // void SetDebugLevel() {fDebugLevel = kTRUE;} //hides overloaded virtual function\r
35aff0f3 48\r
0879e280 49 void SetAnalysisObject(AliBalancePsi *const analysis) {\r
50 fBalance = analysis;\r
51 }\r
52 void SetShufflingObject(AliBalancePsi *const analysisShuffled) {\r
53 fRunShuffling = kTRUE;\r
54 fShuffledBalance = analysisShuffled;\r
55 }\r
f06d59b3 56 void SetMixingObject(AliBalancePsi *const analysisMixed) {\r
57 fRunMixing = kTRUE;\r
58 fMixedBalance = analysisMixed;\r
59 }\r
8cdfbf52 60 void SetMixingWithEventPlane(Bool_t bMixingWithEventPlane = kTRUE) { fRunMixingEventPlane = bMixingWithEventPlane; }\r
f06d59b3 61 void SetMixingTracks(Int_t tracks) { fMixingTracks = tracks; }\r
0879e280 62 void SetAnalysisCutObject(AliESDtrackCuts *const trackCuts) {\r
63 fESDtrackCuts = trackCuts;}\r
64 void SetVertexDiamond(Double_t vx, Double_t vy, Double_t vz) {\r
65 fVxMax = vx;\r
66 fVyMax = vy;\r
67 fVzMax = vz;\r
68 }\r
69\r
70 //==============AOD analysis==============//\r
71 void SetAODtrackCutBit(Int_t bit){\r
4d528efb 72 fnAODtrackCutBit = bit;\r
0879e280 73 }\r
74\r
75 void SetKinematicsCutsAOD(Double_t ptmin, Double_t ptmax, Double_t etamin, Double_t etamax){\r
9fd4b54e 76 fPtMin = ptmin; fPtMax = ptmax;\r
77 fEtaMin = etamin; fEtaMax = etamax;\r
0879e280 78 }\r
79\r
80 void SetExtraDCACutsAOD(Double_t DCAxy, Double_t DCAz){\r
81 fDCAxyCut = DCAxy;\r
82 fDCAzCut = DCAz;\r
83 }\r
84\r
85 void SetExtraTPCCutsAOD(Double_t maxTPCchi2, Int_t minNClustersTPC){\r
86 fTPCchi2Cut = maxTPCchi2;\r
87 fNClustersTPCCut = minNClustersTPC;\r
88 }\r
89\r
90 //==============MC analysis==============//\r
91 void SetKinematicsCutsMC(Double_t ptmin, Double_t ptmax,\r
92 Double_t etamin, Double_t etamax){\r
93 fPtMin = ptmin; fPtMax = ptmax;\r
94 fEtaMin = etamin; fEtaMax = etamax;\r
95 }\r
96 void UseFlowAfterBurner(TF1 *gDifferentialV2) {\r
97 fDifferentialV2 = gDifferentialV2;\r
98 fUseFlowAfterBurner = kTRUE;\r
99 }\r
100 void ExcludeResonancesInMC() {fExcludeResonancesInMC = kTRUE;}\r
8b3da35d 101 void ExcludeElectronsInMC() {fExcludeElectronsInMC = kTRUE;}\r
0879e280 102\r
103 void SetPDGCode(Int_t gPdgCode) {\r
104 fUseMCPdgCode = kTRUE;\r
105 fPDGCodeToBeAnalyzed = gPdgCode;\r
106 }\r
107\r
108 //Centrality\r
109 void SetCentralityEstimator(const char* centralityEstimator) {fCentralityEstimator = centralityEstimator;}\r
9fd4b54e 110 const char* GetCentralityEstimator(void) const {return fCentralityEstimator;}\r
0879e280 111 void SetCentralityPercentileRange(Double_t min, Double_t max) { \r
112 fUseCentrality = kTRUE;\r
113 fCentralityPercentileMin=min;\r
114 fCentralityPercentileMax=max;\r
115 }\r
116 void SetImpactParameterRange(Double_t min, Double_t max) { \r
117 fUseCentrality = kTRUE;\r
118 fImpactParameterMin=min;\r
119 fImpactParameterMax=max;\r
120 }\r
121\r
122 //multiplicity\r
4d528efb 123 void SetMultiplicityEstimator(const char* multiplicityEstimator) {fMultiplicityEstimator = multiplicityEstimator;}\r
124 const char* GetMultiplicityEstimator(void) const {return fMultiplicityEstimator;}\r
9efce966 125 void SetMultiplicityRange(Double_t min, Double_t max) {\r
0879e280 126 fUseMultiplicity = kTRUE;\r
127 fNumberOfAcceptedTracksMin = min;\r
128 fNumberOfAcceptedTracksMax = max;}\r
129 \r
7556a0f0 130 // additional event cuts (default = kFALSE)\r
0879e280 131 void UseOfflineTrigger() {fUseOfflineTrigger = kTRUE;}\r
7556a0f0 132 void CheckFirstEventInChunk() {fCheckFirstEventInChunk = kTRUE;}\r
133 void CheckPileUp() {fCheckPileUp = kTRUE;}\r
0b4a14ee 134 void CheckPrimaryFlagAOD() {fCheckPrimaryFlagAOD = kTRUE;}\r
d9eb282c 135 void UseMCforKinematics() {fUseMCforKinematics = kTRUE;}\r
bdb652a1
MW
136 void SetCentralityWeights(TH1* hist) { fCentralityWeights = hist; }\r
137 Bool_t AcceptEventCentralityWeight(Double_t centrality);\r
138\r
0879e280 139 \r
140 //Acceptance filter\r
141 void SetAcceptanceParameterization(TF1 *parameterization) {\r
142 fAcceptanceParameterization = parameterization;}\r
143\r
144 //pid\r
145 enum kDetectorUsedForPID { kTPCpid, kTOFpid, kTPCTOF }; // default TPC & TOF pid (via GetTPCpid & GetTOFpid) \r
146 enum kParticleOfInterest { kMuon, kElectron, kPion, kKaon, kProton }; \r
147\r
148 void SetUseBayesianPID(Double_t gMinProbabilityValue) {\r
149 fUsePID = kTRUE; fUsePIDnSigma = kFALSE; fUsePIDPropabilities = kTRUE;\r
150 fMinAcceptedPIDProbability = gMinProbabilityValue; }\r
151\r
152 void SetUseNSigmaPID(Double_t gMaxNSigma) {\r
153 fUsePID = kTRUE; fUsePIDPropabilities = kFALSE; fUsePIDnSigma = kTRUE;\r
154 fPIDNSigma = gMaxNSigma; }\r
155\r
156 void SetParticleOfInterest(kParticleOfInterest poi) {\r
157 fParticleOfInterest = poi;}\r
158 void SetDetectorUsedForPID(kDetectorUsedForPID detConfig) {\r
159 fPidDetectorConfig = detConfig;}\r
f0fb4ac1 160 void SetEventClass(TString receivedEventClass){\r
161 fEventClass = receivedEventClass;\r
162 }\r
ea9867da 163 \r
164 void SetCustomBinning(TString receivedCustomBinning) { fCustomBinning = receivedCustomBinning; }\r
165\r
0879e280 166\r
c443da34 167 // electron rejection\r
168 void SetElectronRejection(Double_t gMaxNSigma){\r
169 fElectronRejection = kTRUE;\r
170 fElectronRejectionNSigma = gMaxNSigma;\r
171 }\r
172\r
8b3da35d 173 void SetElectronOnlyRejection(Double_t gMaxNSigma){\r
174 fElectronRejection = kTRUE;\r
175 fElectronOnlyRejection = kTRUE;\r
176 fElectronRejectionNSigma = gMaxNSigma;\r
177 }\r
178\r
179 void SetElectronRejectionPt(Double_t minPt,Double_t maxPt){\r
180 fElectronRejectionMinPt = minPt;\r
181 fElectronRejectionMaxPt = maxPt;\r
182 }\r
183\r
91e5e210 184 void SetVZEROCalibrationFile(const char* filename, const char* lhcPeriod);\r
35aff0f3 185\r
0879e280 186 private:\r
f06d59b3 187 Double_t IsEventAccepted(AliVEvent* event);\r
f0fb4ac1 188 Double_t GetRefMultiOrCentrality(AliVEvent* event);\r
4d528efb 189 Double_t GetReferenceMultiplicityFromAOD(AliVEvent* event);\r
f06d59b3 190 Double_t GetEventPlane(AliVEvent* event);\r
35aff0f3 191 //===============================correction\r
6fa567bd 192 Double_t GetTrackbyTrackCorrectionMatrix(Double_t vEta, \r
193 Double_t vPhi, \r
194 Double_t vPt, \r
195 Short_t vCharge, \r
196 Double_t gCentrality);\r
35aff0f3 197 //===============================correction\r
198 TObjArray* GetAcceptedTracks(AliVEvent* event, Double_t gCentrality, Double_t gReactionPlane);\r
199 TObjArray* GetShuffledTracks(TObjArray* tracks, Double_t gCentrality);\r
91e5e210 200\r
201 Double_t GetChannelEqualizationFactor(Int_t run, Int_t channel);\r
202 Double_t GetEqualizationFactor(Int_t run, const char *side);\r
6f719a5b 203 \r
a3ed6fc1 204 Bool_t fDebugLevel; // debug level\r
205\r
6f719a5b 206 TClonesArray* fArrayMC; //! AOD object //+++++++++++++++++++++\r
0879e280 207 AliBalancePsi *fBalance; //BF object\r
208 Bool_t fRunShuffling;//run shuffling or not\r
209 AliBalancePsi *fShuffledBalance; //BF object (shuffled)\r
f06d59b3 210 Bool_t fRunMixing;//run mixing or not\r
8cdfbf52 211 Bool_t fRunMixingEventPlane;//run mixing with Event Plane\r
f06d59b3 212 Int_t fMixingTracks;\r
213 AliBalancePsi *fMixedBalance; //TriggeredBF object (mixed)\r
214 AliEventPoolManager* fPoolMgr; //! event pool manager\r
215\r
0879e280 216 TList *fList; //fList object\r
217 TList *fListBF; //fList object\r
218 TList *fListBFS; //fList object\r
f06d59b3 219 TList *fListBFM; //fList object\r
0879e280 220 TList *fHistListPIDQA; //! list of histograms\r
221\r
6b046844 222 TH2F *fHistEventStats; //event stats\r
0879e280 223 TH2F *fHistCentStats; //centrality stats\r
2213e863 224 TH2F *fHistCentStatsUsed; //centrality stats USED +++++++++++++++++++++++\r
0879e280 225 TH1F *fHistTriggerStats; //trigger stats\r
226 TH1F *fHistTrackStats; //Track filter bit stats\r
227 TH1F *fHistVx; //x coordinate of the primary vertex\r
228 TH1F *fHistVy; //y coordinate of the primary vertex\r
6b046844 229 TH2F *fHistVz; //z coordinate of the primary vertex\r
0879e280 230\r
4d528efb 231 TH2F *fHistTPCvsVZEROMultiplicity; //VZERO vs TPC reference multiplicity\r
232 TH2F *fHistVZEROSignal; //VZERO channel vs signal\r
233\r
6b046844 234 TH2F *fHistEventPlane; //event plane distribution\r
0879e280 235\r
9fd4b54e 236 TH2F *fHistClus;//number of clusters (QA histogram)\r
237 TH2F *fHistDCA;//DCA (QA histogram)\r
238 TH2F *fHistChi2;//track chi2 (QA histogram)\r
239 TH2F *fHistPt;//transverse momentum (QA histogram)\r
240 TH2F *fHistEta;//pseudorapidity (QA histogram)\r
241 TH2F *fHistRapidity;//rapidity (QA histogram)\r
242 TH2F *fHistPhi;//phi (QA histogram)\r
f2e8af26 243 TH3F *fHistEtaPhiPos;//eta-phi pos particles (QA histogram) \r
244 TH3F *fHistEtaPhiNeg;//eta-phi neg particles (QA histogram)\r
9fd4b54e 245 TH2F *fHistPhiBefore;//phi before v2 afterburner (QA histogram)\r
246 TH2F *fHistPhiAfter;//phi after v2 afterburner (QA histogram)\r
247 TH2F *fHistPhiPos;//phi for positive particles (QA histogram)\r
248 TH2F *fHistPhiNeg;//phi for negative particles (QA histogram)\r
249 TH2F *fHistV0M;//V0 multiplicities (QA histogram)\r
250 TH2F *fHistRefTracks;//reference track multiplicities (QA histogram)\r
0879e280 251\r
252 //============PID============//\r
9fd4b54e 253 TH2D *fHistdEdxVsPTPCbeforePID;//TPC dEdx vs momentum before PID cuts (QA histogram)\r
254 TH2D *fHistBetavsPTOFbeforePID;//beta vs momentum before PID cuts (QA histogram)\r
255 TH2D *fHistProbTPCvsPtbeforePID; //TPC probability vs pT before PID cuts (QA histogram)\r
256 TH2D *fHistProbTOFvsPtbeforePID;//TOF probability vs pT before PID cuts (QA histogram)\r
257 TH2D *fHistProbTPCTOFvsPtbeforePID;//TOF/TPC probability vs pT before PID cuts (QA histogram)\r
258 TH2D *fHistNSigmaTPCvsPtbeforePID;//TPC nsigma vs pT before PID cuts (QA histogram)\r
259 TH2D *fHistNSigmaTOFvsPtbeforePID;//TOF nsigma vs pT before PID cuts (QA histogram)\r
90bec8c5 260 TH2D *fHistBetaVsdEdXbeforePID;//TPCTOF before PID cuts (QA histogram)//+++++++++++++++++++++\r
261 TH2D *fHistNSigmaTPCTOFvsPtbeforePID;//TPCTOF before PID cuts (QA histogram)//+++++++++++++++++++++\r
9fd4b54e 262 TH2D *fHistdEdxVsPTPCafterPID;//TPC dEdx vs momentum after PID cuts (QA histogram)\r
263 TH2D *fHistBetavsPTOFafterPID;//beta vs momentum after PID cuts (QA histogram)\r
264 TH2D *fHistProbTPCvsPtafterPID; //TPC probability vs pT after PID cuts (QA histogram)\r
265 TH2D *fHistProbTOFvsPtafterPID;//TOF probability vs pT after PID cuts (QA histogram)\r
266 TH2D *fHistProbTPCTOFvsPtafterPID;//TOF/TPC probability vs pT after PID cuts (QA histogram)\r
267 TH2D *fHistNSigmaTPCvsPtafterPID;//TPC nsigma vs pT after PID cuts (QA histogram)\r
268 TH2D *fHistNSigmaTOFvsPtafterPID;//TOF nsigma vs pT after PID cuts (QA histogram)\r
90bec8c5 269 TH2D *fHistBetaVsdEdXafterPID;//TPCTOF before PID cuts (QA histogram)//+++++++++++++++++++++\r
270 TH2D *fHistNSigmaTPCTOFvsPtafterPID;//TPCTOF before PID cuts (QA histogram)//+++++++++++++++++++++\r
385ff67e 271\r
272 TH2D *fHistdEdxVsPTPCbeforePIDelectron; //+++++++\r
273 TH2D *fHistNSigmaTPCvsPtbeforePIDelectron; //+++++++\r
274 TH2D *fHistdEdxVsPTPCafterPIDelectron; //+++++++\r
275 TH2D *fHistNSigmaTPCvsPtafterPIDelectron; //+++++++\r
35aff0f3 276 \r
d79d2934 277 TH3F *fHistCorrectionPlus[kCENTRALITY]; //====correction\r
278 TH3F *fHistCorrectionMinus[kCENTRALITY]; //===correction\r
6fa567bd 279 Double_t fCentralityArrayForCorrections[kCENTRALITY];\r
280 Int_t fCentralityArrayBinsForCorrections;\r
0879e280 281\r
bdb652a1
MW
282 TH1* fCentralityWeights; // for centrality flattening\r
283\r
0879e280 284 AliPIDResponse *fPIDResponse; //! PID response object\r
285 AliPIDCombined *fPIDCombined; //! combined PID object\r
286 \r
9fd4b54e 287 kParticleOfInterest fParticleOfInterest;//analyzed particle\r
288 kDetectorUsedForPID fPidDetectorConfig;//used detector for PID\r
289\r
290 Bool_t fUsePID; //flag to use PID \r
291 Bool_t fUsePIDnSigma;//flag to use nsigma method for PID\r
292 Bool_t fUsePIDPropabilities;//flag to use probability method for PID\r
293 Double_t fPIDNSigma;//nsigma cut for PID\r
294 Double_t fMinAcceptedPIDProbability;//probability cut for PID\r
1cb2a06e 295\r
c443da34 296 Bool_t fElectronRejection;//flag to use electron rejection\r
8b3da35d 297 Bool_t fElectronOnlyRejection;//flag to use electron rejection with exclusive electron PID (no other particle in nsigma range)\r
c443da34 298 Double_t fElectronRejectionNSigma;//nsigma cut for electron rejection\r
8b3da35d 299 Double_t fElectronRejectionMinPt;//minimum pt for electron rejection (default = 0.)\r
300 Double_t fElectronRejectionMaxPt;//maximum pt for electron rejection (default = 1000.)\r
0879e280 301 //============PID============//\r
302\r
303 AliESDtrackCuts *fESDtrackCuts; //ESD track cuts\r
304\r
305 TString fCentralityEstimator; //"V0M","TRK","TKL","ZDC","FMD"\r
306 Bool_t fUseCentrality;//use the centrality (PbPb) or not (pp)\r
307 Double_t fCentralityPercentileMin;//centrality percentile min\r
308 Double_t fCentralityPercentileMax;//centrality percentile max\r
309 Double_t fImpactParameterMin;//impact parameter min (used for MC)\r
310 Double_t fImpactParameterMax;//impact parameter max (used for MC)\r
311\r
4d528efb 312 TString fMultiplicityEstimator;//"V0M","V0A","V0C","TPC"\r
0879e280 313 Bool_t fUseMultiplicity;//use the multiplicity cuts\r
9efce966 314 Double_t fNumberOfAcceptedTracksMin;//min. number of number of accepted tracks (used for the multiplicity dependence study - pp)\r
315 Double_t fNumberOfAcceptedTracksMax;//max. number of number of accepted tracks (used for the multiplicity dependence study - pp)\r
6b046844 316 TH2F *fHistNumberOfAcceptedTracks;//hisot to store the number of accepted tracks\r
6ec16c49 317 TH1F *fHistMultiplicity;//hisot to store the number of accepted tracks //++++++++++++++++++\r
0879e280 318\r
319 Bool_t fUseOfflineTrigger;//Usage of the offline trigger selection\r
7556a0f0 320 Bool_t fCheckFirstEventInChunk;//Usage of the "First Event in Chunk" check (not needed for new productions)\r
321 Bool_t fCheckPileUp;//Usage of the "Pile-Up" event check\r
0b4a14ee 322 Bool_t fCheckPrimaryFlagAOD;// Usage of check on AliAODtrack::kPrimary (default = OFF)\r
d9eb282c 323 Bool_t fUseMCforKinematics;//Usage of MC information for filling the kinematics information of particles (only in MCAODrec mode)\r
0879e280 324\r
325 Double_t fVxMax;//vxmax\r
326 Double_t fVyMax;//vymax\r
327 Double_t fVzMax;//vzmax\r
328\r
4d528efb 329 Int_t fnAODtrackCutBit;//track cut bit from track selection (only used for AODs)\r
0879e280 330\r
331 Double_t fPtMin;//only used for AODs\r
332 Double_t fPtMax;//only used for AODs\r
35aff0f3 333 Double_t fPtMinForCorrections;//only used for AODs\r
334 Double_t fPtMaxForCorrections;//only used for AODs\r
335 Double_t fPtBinForCorrections; //=================================correction\r
0879e280 336 Double_t fEtaMin;//only used for AODs\r
337 Double_t fEtaMax;//only used for AODs\r
35aff0f3 338 Double_t fEtaMinForCorrections;//only used for AODs\r
339 Double_t fEtaMaxForCorrections;//only used for AODs\r
340 Double_t fEtaBinForCorrections; //=================================correction\r
341 Double_t fPhiMin; //=================================correction \r
342 Double_t fPhiMax; //=================================correction\r
343 Double_t fPhiMinForCorrections;//only used for AODs\r
344 Double_t fPhiMaxForCorrections;//only used for AODs\r
345 Double_t fPhiBinForCorrections; //=================================correction\r
0879e280 346\r
347 Double_t fDCAxyCut;//only used for AODs\r
348 Double_t fDCAzCut;//only used for AODs\r
349\r
350 Double_t fTPCchi2Cut;//only used for AODs\r
351 Int_t fNClustersTPCCut;//only used for AODs\r
352\r
353 TF1 *fAcceptanceParameterization;//acceptance filter used for MC\r
354\r
355 TF1 *fDifferentialV2;//pt-differential v2 (from real data)\r
356 Bool_t fUseFlowAfterBurner;//Usage of a flow after burner\r
357\r
8b3da35d 358 Bool_t fExcludeResonancesInMC;//flag to exclude the resonances' decay products (and conversion) from the MC analysis\r
359 Bool_t fExcludeElectronsInMC;//flag to exclude the electrons from the MC analysis\r
0879e280 360 Bool_t fUseMCPdgCode; //Boolean to analyze a set of particles in MC\r
361 Int_t fPDGCodeToBeAnalyzed; //Analyze a set of particles in MC\r
f0fb4ac1 362 TString fEventClass; //Can be "EventPlane", "Centrality", "Multiplicity"\r
ea9867da 363 TString fCustomBinning;//for setting customized binning (for output AliTHn of AliBalancePsi)\r
0879e280 364 \r
91e5e210 365 //VZERO calibration\r
366 TH1F *fHistVZEROAGainEqualizationMap;//VZERO calibration map\r
367 TH1F *fHistVZEROCGainEqualizationMap;//VZERO calibration map\r
368 TH2F *fHistVZEROChannelGainEqualizationMap; //VZERO calibration map\r
0879e280 369\r
370 AliAnalysisTaskBFPsi(const AliAnalysisTaskBFPsi&); // not implemented\r
371 AliAnalysisTaskBFPsi& operator=(const AliAnalysisTaskBFPsi&); // not implemented\r
372 \r
5c01a71f 373 ClassDef(AliAnalysisTaskBFPsi, 6); // example of analysis\r
0879e280 374};\r
375\r
f06d59b3 376\r
377\r
0879e280 378#endif\r