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