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