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