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