]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/PHOSTasks/PHOS_PbPb/AliAnalysisTaskPi0Flow.h
Added particle weighting to MC task.
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / PHOS_PbPb / AliAnalysisTaskPi0Flow.h
1 #ifndef AliAnalysisTaskPi0Flow_cxx
2 #define AliAnalysisTaskPi0Flow_cxx
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 // Analysis task to fill histograms with PHOS ESD or AOD clusters and cells
8 // Authors : Dmitri Peressounko
9 // Date    : 28.05.2011
10 // Modified: 03.08.2012 Henrik Qvigstad
11 /* $Id$ */
12
13 class TObjArray;
14 class TH1F;
15 class TH2I;
16 class TH2F;
17 class TH3F;
18 class TF1 ;
19 class AliStack ;
20 class AliESDtrackCuts;
21 class AliPHOSGeometry;
22 class AliESDEvent ;
23 class AliPHOSCalibData;
24 class AliESDtrack ;
25 class AliESDCaloCluster ;
26 class AliEPFlattener;
27
28 #include "TArrayD.h"
29
30 #include "AliAnalysisTaskSE.h"
31
32 class AliAnalysisTaskPi0Flow : public AliAnalysisTaskSE {
33 public:
34     enum Period { kUndefinedPeriod, kLHC10h, kLHC11h, kLHC13 };
35
36 public:
37     AliAnalysisTaskPi0Flow(const char *name = "AliAnalysisTaskPi0Flow", Period period = kUndefinedPeriod);
38     virtual ~AliAnalysisTaskPi0Flow();
39
40     virtual void   UserCreateOutputObjects();
41     virtual void   UserExec(Option_t *option);
42     /* virtual void   Terminate(Option_t *); */
43
44     void SetPeriod(Period period) { fPeriod = period;}
45     
46     void SetCentralityBinning(const TArrayD& edges, const TArrayI& nMixed);
47     void SetEventMixingRPBinning(UInt_t nBins) { fNEMRPBins = nBins; }
48     void SetMaxAbsVertexZ(Float_t z) { fMaxAbsVertexZ = z; }
49     void SetManualV0EPCalc(Bool_t manCalc = true) {fManualV0EPCalc = manCalc;}
50     void SetEnablePHOSModule(int module, Bool_t enable = true);
51     
52     void SetPHOSBadMap(Int_t mod,TH2I * badMapHist);
53     //Where to read AODB object with EP calibration if not default
54     void SetEPcalibFileName(const TString filename) {fEPcalibFileName = filename; }   
55
56
57 protected:
58     AliAnalysisTaskPi0Flow(const AliAnalysisTaskPi0Flow&); // not implemented
59     AliAnalysisTaskPi0Flow& operator=(const AliAnalysisTaskPi0Flow&); // not implemented
60
61     // Step 0:
62     AliVEvent* GetEvent();
63
64     // Step 1:
65     void SetGeometry();
66     void SetMisalignment();
67     void SetV0Calibration(); //V0 calibration
68     void SetESDTrackCuts(); // AliESDtrack cuts ( for esd data )
69     void SetPHOSCalibData(); // phos re-calibration ( for esd data)
70     void SetFlatteningData(); // phos flattening
71
72     // Step 2:
73     void SetVertex();
74     Bool_t RejectEventVertex();
75
76     // Step 4:
77     void SetCentrality();
78     Bool_t RejectCentrality();
79
80     // Step 5:
81     void EvalReactionPlane();
82     void EvalV0ReactionPlane();
83
84     // Step 7: QA PHOS cells
85     void FillPHOSCellQAHists();
86
87     // Step 8: Event Photons (PHOS Clusters) selection
88     virtual void SelectPhotonClusters();
89     virtual void FillSelectedClusterHistograms();
90
91     // Step 9: Consider pi0 (photon/cluster) pairs.
92     virtual void ConsiderPi0s();
93
94     // Step 10; Mixing
95     virtual void ConsiderPi0sMix();
96
97     // Step 11: MC
98     virtual void ProcessMC();
99
100     // Step 12: Update lists
101     void UpdateLists();
102
103     Bool_t AreNeibors(Int_t id1,Int_t id2) ;
104     Double_t ApplyFlattening(Double_t phi, Double_t c) ; //Apply centrality-dependent flattening
105     Double_t ApplyFlatteningV0A(Double_t phi, Double_t c) ; //Apply centrality-dependent flattening
106     Double_t ApplyFlatteningV0C(Double_t phi, Double_t c) ; //Apply centrality-dependent flattening
107     Int_t ConvertToInternalRunNumber(Int_t run) ;
108     Double_t CoreEnergy(AliVCluster * clu, AliVCaloCells * cells);
109     void EvalCoreLambdas(AliVCluster * clu, AliVCaloCells * cells, Double_t &m02, Double_t &m20) ; 
110     Bool_t TestCoreLambda(Double_t pt,Double_t l1,Double_t l2) ;
111
112
113
114
115     void FillHistogram(const char * key,Double_t x) const ; //Fill 1D histogram witn name key
116     void FillHistogram(const char * key,Double_t x, Double_t y) const ; //Fill 2D histogram witn name key
117     void FillHistogram(const char * key,Double_t x, Double_t y, Double_t z) const ; //Fill 3D histogram witn name key
118     void FillHistogram(const char * key,Double_t x, Double_t y, Double_t z, Double_t w) const ; //Fill 3D histogram witn name key
119
120     TVector3 GetVertexVector(const AliVVertex* vertex);
121     Int_t GetCentralityBin(Float_t centralityV0M);
122     Int_t GetRPBin();
123
124     void LogProgress(int step);
125     void LogSelection(int step, int internalRunNumber);
126
127     Bool_t IsGoodChannel(const char * det, Int_t mod,Int_t ix, Int_t iz); //Use addisional bad map for PHOS
128
129
130     void Reclusterize(AliVCluster * clu) ;
131     Double_t TestCPV(Double_t dx, Double_t dz, Double_t pt, Int_t charge);
132     Bool_t TestLambda(Double_t pt,Double_t l1,Double_t l2) ;  //Evaluate Dispersion cuts for photons
133     Bool_t TestLambda2(Double_t pt,Double_t l1,Double_t l2) ;  //Evaluate Dispersion cuts for photons
134     
135     UInt_t GetNumberOfCentralityBins() { return fCentEdges.GetSize()-1; }
136     TList* GetCaloPhotonsPHOSList(UInt_t vtxBin, UInt_t centBin, UInt_t rpBin);
137     
138
139
140
141 protected:
142     // transiant constants
143     static const Int_t kNMod = 5;
144
145     // constants:
146     static const Double_t kLogWeight= 4.5 ; // log weight for recalibration.
147     static const Double_t kAlphaCut=0.7 ;
148     static const Bool_t doESDReCalibration = kTRUE;
149     static const Int_t kNCenBins = 9; // see EvalV0ReactionPlane()
150
151     // cluster cut variables:
152     static const Double_t kMinClusterEnergy = 0.3;
153     static const Double_t kMinBCDistance = 2.5;  //distance to nearest bad channel
154     static const Int_t kMinNCells = 3;
155     static const Double_t kMinM02 = 0.2;
156
157     // Binning, [vtx, centrality, reaction-plane]
158     static const Int_t kNVtxZBins = 1;
159     static const Double_t kCentCutoff = 90.; // Ignore Centrality over 90%
160     TArrayD fCentEdges;  // Centrality Bin Lower edges
161     TArrayI fCentNMixed; // Number of mixed events for each centrality bin
162     UInt_t fNEMRPBins;
163     
164
165     // Behavior / cuts
166     Period fPeriod;
167     Float_t fMaxAbsVertexZ; // in cm
168     Bool_t fManualV0EPCalc;
169     Bool_t fModuleEnabled[kNMod]; //[kNMod]
170
171
172     TList * fOutputContainer;        //final histogram container
173
174     TF1 *fNonLinCorr;          // Non-linearity correction
175 //TF1 * fRecent[5][12] ;//Recentering corrections
176     TH2I *fPHOSBadMap[6] ;    //Container for PHOS bad channels map
177
178     // Run variables
179
180     // Step 0: Event Objects
181     // fEvent, fMCStack
182     AliVEvent* fEvent; //! Current event
183     AliESDEvent* fEventESD; //! Current event, if ESD.
184     AliAODEvent* fEventAOD; //! Current event, if AOD.
185
186     // Step 1: Run Number, Misalignment Matrix, and Calibration
187     Int_t fRunNumber; // run number
188     Int_t fInternalRunNumber ;    //Current internal run number
189     AliPHOSGeometry  *fPHOSGeo;  //! PHOS geometry
190     TProfile *fMultV0;                  // object containing VZERO calibration information
191     Float_t fV0Cpol,fV0Apol;            // loaded by OADB
192     Float_t fMeanQ[kNCenBins][2][2];    // and recentering
193     Float_t fWidthQ[kNCenBins][2][2];   // ...
194     AliESDtrackCuts *fESDtrackCuts; // Track cut
195     AliPHOSCalibData *fPHOSCalibData; // PHOS calibration object
196     TString fEPcalibFileName; 
197     AliEPFlattener * fTPCFlat ; //Object for flattening of TPC
198     AliEPFlattener * fV0AFlat ; //Object for flattening of V0A
199     AliEPFlattener * fV0CFlat ; //Object for flattening of V0C
200     
201     
202     // Step 2: Vertex
203     Double_t fVertex[3];
204     TVector3 fVertexVector;
205     Int_t fVtxBin;
206
207     // Step 4: Centrality
208     Float_t fCentralityV0M ; //!Centrality of the currecnt event
209     Int_t fCentBin ;       //! Current centrality bin
210
211     // Step 5: Reaction Plane
212     Bool_t fHaveTPCRP ; //! Is TPC RP defined?
213     Float_t fRP ;       //!Reaction plane calculated with full TPC
214     Float_t fRPV0A ;    //!Reaction plain calculated with A-side TPC: eta>0.15
215     Float_t fRPV0C ;    //!Reaction plain calculated with C-side TPC: eta<-0.15
216     Int_t fEMRPBin;       //! Event Mixing Reaction Plane Bin
217
218     // Step 8: Event Photons (PHOS Clusters) selection
219     TObjArray * fCaloPhotonsPHOS ;      //PHOS photons in current event
220
221     // Step 12: Update lists for mixing.
222     TObjArray* fCaloPhotonsPHOSLists; //! array of TList, Containers for events with PHOS photons
223
224
225     ClassDef(AliAnalysisTaskPi0Flow, 2); // PHOS analysis task
226 };
227
228 #endif