]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/PHOSTasks/PHOS_Correlation/AliPHOSCorrelations.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / PHOS_Correlation / AliPHOSCorrelations.h
1 #ifndef AliPHOSCorrelations_cxx
2 #define AliPHOSCorrelations_cxx
3
4 /* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice     */
6
7 // Analysis task for identifion PHOS cluster from Pi0 and extracting pi0-hadron correlation.
8 // Author:  Daniil Ponomarenko <Daniil.Ponomarenko@cern.ch>
9 // 20-Sept-2014
10
11 class TClonesArray;
12 class AliStack ;
13 class AliESDtrackCuts;
14 class AliPHOSGeometry;
15 class AliTriggerAnalysis;
16 class AliESDEvent ;
17 class AliPIDResponse;
18 class AliPHOSCalibData ;
19 class AliESDCaloCluster ;
20 class AliESDEvent ;
21 class AliESDtrack ;
22 class AliAODTrack ;
23 class AliVCluster ;
24 class AliAnalysisUtils;
25 class AliEPFlattener;
26 class AliAODInputHandler;
27 class AliESDInputHandler;
28 class AliVTrack;
29
30
31 #include "TArrayD.h"
32 #include "AliAnalysisTaskSE.h"
33
34 class AliPHOSCorrelations : public AliAnalysisTaskSE 
35 {
36 public:
37   enum EventSelection       { kTotal, kEvent, kEventHandler, 
38                               kTriggerMaskSelection, kHasVertex, kHasCentrality, 
39                               kHasPHOSClusters, kHasTPCTracks, kPHOSEvent, 
40                               kMBEvent, kTotalSelected, kHasAbsVertex } ;
41   enum PID                  { kPidAll, kPidCPV, kPidDisp, kPidBoth} ;
42
43
44 public:
45   AliPHOSCorrelations() ;
46   AliPHOSCorrelations(const char *name) ;
47   virtual ~AliPHOSCorrelations() ;
48
49   virtual void   UserCreateOutputObjects() ;
50   virtual void   UserExec(Option_t *option) ;
51
52   void SetPeriodName(const TString str)                                           { fPeriod = str                    ; }
53   TString GetPeriod()                                                       const { return fPeriod                   ; }
54
55   void SetCentralityEstimator(const char * centr)                                 { fCentralityEstimator = centr         ; }
56   void SetEventMixingRPBinning(const UInt_t nBins)                                { fNEMRPBins = nBins                   ; }
57   void SetMaxAbsVertexZ(const Float_t z)                                          { fMaxAbsVertexZ = z                   ; }
58  
59   void SwitchOnPionEfficiency()                                                   { fUseEfficiency = kTRUE               ; }
60   void SwitchOffPionEfficiency()                                                  { fUseEfficiency = kFALSE              ; }
61
62   void EnableTOFCut(const Bool_t enable, const Double_t TOFCut)                   { fTOFCutEnabled=enable; fTOFCut=TOFCut; }
63   
64   void SetSigmaWidth(const Double_t sigmaWidth)                                   { fNSigmaWidth = sigmaWidth            ; }
65   void SetMassMeanParametrs(const Double_t par[2])  ;
66   void SetMassSigmaParametrs(const Double_t par[4]) ;
67   void SetMassWindow(const Double_t min, const Double_t max)                      { fMassInvMeanMin = min; fMassInvMeanMax = max    ; }
68   void SetPtAssocBins(TArrayD * arr)                                              { fAssocBins.Set(arr->GetSize(), arr->GetArray()) ; } 
69   void SetCentralityBinning(const TArrayD& edges, const TArrayI& nMixed) ;
70   void SetCentralityBorders(const Double_t& downLimit , const Double_t& upLimit) ;
71   void SwitchOnMassParametrisation()                                              { fUseMassWindowParametrisation = true ; }
72   void SwitchOffMassParametrisation()                                             { fUseMassWindowParametrisation = false; }
73
74   ULong_t  GetTrackStatus()                                                 const { return fTrackStatus          ; }
75   void     SetTrackStatus(ULong_t bit)                                            { fTrackStatus = bit           ; }   
76
77   ULong_t  GetTrackFilterMask()                                             const { return fTrackFilterMask      ; }
78   void     SetTrackFilterMask(ULong_t bit)                                        { fTrackFilterMask = bit       ; }
79
80   void     SwitchOnTrackHitSPDSelection()                                         { fSelectSPDHitTracks = kTRUE  ; }
81   void     SwitchOffTrackHitSPDSelection()                                        { fSelectSPDHitTracks = kFALSE ; }
82
83   void     SwitchOnAODTrackSharedClusterSelection()                               { fSelectFractionTPCSharedClusters = kTRUE  ; }
84   void     SwitchOffAODTrackSharedClusterSelection()                              { fSelectFractionTPCSharedClusters = kFALSE ; }
85
86   Float_t  GetTPCSharedClusterFraction()                                    const { return fCutTPCSharedClustersFraction ; }
87   void     SetTPCSharedClusterFraction(Float_t fr)                                { fCutTPCSharedClustersFraction = fr   ; }
88
89   void     SwitchOnAODHybridTrackSelection()                                      { fSelectHybridTracks = kTRUE  ; } 
90   void     SwitchOffAODHybridTrackSelection()                                     { fSelectHybridTracks = kFALSE ; } 
91   
92
93 protected: 
94   AliPHOSCorrelations           ( const AliPHOSCorrelations& ) ;                                 // not implemented
95   AliPHOSCorrelations& operator=( const AliPHOSCorrelations& ) ;                                 // not implemented
96
97   // Filling hists.
98   void FillHistogram( const char * key,Double_t x ) const ;                                      // Fill 1D histogram witn name key
99   void FillHistogram( const char * key,Double_t x, Double_t y ) const ;                          // Fill 2D histogram witn name key
100   void FillHistogram( const char * key,Double_t x, Double_t y, Double_t z ) const ;              // Fill 3D histogram witn name key
101   void FillHistogram( const char * key,Double_t x, Double_t y, Double_t z, Double_t w ) const ;  // Fill 3D histogram witn name key
102
103   // Setup hists.
104   void SetHistPtNumTrigger( const Int_t& ptMult, const Double_t& ptMin, const Double_t& ptMax ) const ; // Set trigger's number of histograms (1-5).
105   void SetHistPtAssoc     ( const Int_t& ptMult, const Double_t& ptMin, const Double_t& ptMax ) const ; // Set pt associated of histograms (1-5).
106   void SetHistMass        ( const Int_t& ptMult, const Double_t& ptMin, const Double_t& ptMax ) const ; // Set mass histograms.
107   void SetHistEtaPhi      ( const Int_t& ptMult, const Double_t& ptMin, const Double_t& ptMax ) const ; // Set hists with track's (pt depend.) and cluster's angle distributions.
108   void SetHistPHOSClusterMap() ;                                                                        // XZE distribution in PHOS.
109
110   // Logical and debug.
111   void LogProgress    ( int step ) ;
112   void LogSelection   ( const int& step , const int& internalRunNumber ) const ;
113
114   // Step 1(done once):
115   Int_t ConvertToInternalRunNumber(const Int_t& run) const ;                                     // Convert run number to local number. 
116   void  SetESDTrackCuts() ;                                                                      // AliESDtrack cuts ( for esd data )
117
118   // Step 2: Preparation variables for new event
119   void ZeroingVariables() ;
120   void SetGeometry();                                                                            // Initialize the PHOS geometry
121
122   // Step 3: Event trigger selection
123   Bool_t RejectTriggerMaskSelection() ;                                                          // Select event trigger and reject.
124
125   // Step 4: Vertex
126   void   SetVertex() ;                                                                           // Find vertex of event.
127   Bool_t RejectEventVertex()         const ;
128
129   void   SetVertexBinning() ;                                                                    // Define vertex bins by their edges
130   Int_t  GetVertexBin(const TVector3&  vertexVector) ;                                           // Find vertex bin
131   UInt_t GetNumberOfVertexBins()     const { return fNVtxZBins ; }                               // Get number of vertex bins.
132
133   // Step 5: Centrality
134   void   SetCentrality() ;                                                                       // Find centrality of event.
135   Bool_t RejectEventCentrality()     const; 
136
137   Int_t  GetCentralityBin(const Float_t& centralityV0M) ;                                        // Find centrality bin.
138   UInt_t GetNumberOfCentralityBins() const { return fCentEdges.GetSize()-1 ; }                   // Get number of centrality bins.
139
140   // Step 6: Reaction Plane
141   void   EvalReactionPlane() ;                                                                   // Find RP of event.
142   Int_t  GetRPBin() ;                                                                            // Return RP (rad).
143   UInt_t GetNumberOfRPBins()         const { return fNEMRPBins ; }                               // Get number of RP bins.
144
145   // Step 7: Event Photons (PHOS Clusters) selection
146   void SelectPhotonClusters() ;
147
148   // Step 8: Event Associated particles (TPC Tracks) selection
149   void SelectAccosiatedTracks() ;
150
151   // Step 9: Fill TPC's track mask and control bining hists.
152   void FillTrackEtaPhi()             const;                                                      // Distribution by track's angles.
153   void FillEventBiningProperties()   const ;                                                     // Fill fCentBin, fEMRPBin, fVtxBin.
154
155   // Step 10: Extract one most energetic pi0 candidate in this event. 
156   void SelectTriggerPi0ME() ;                                                                    // Select most energetic Pi0 in event.
157
158   void  TestPi0ME(const Int_t& ipid, const TLorentzVector& p12, const Int_t& modCase) ;          // Compare Pi0 particles and remember most energetic in current event.
159  
160   void  SetMEExists(const Int_t pid)                        { fMEExists[pid] = true     ; }
161   void  SetMEPhi(const Int_t pid, const Double_t phi)       { fMEPhi[pid] = phi         ; }
162   void  SetMEEta(const Int_t pid, const Double_t eta)       { fMEEta[pid] = eta         ; }
163   void  SetMEPt( const Int_t pid, const Double_t pT)        { fMEPt[pid] = pT           ; }
164   void  SetMEModCase(const Int_t pid, const Int_t modcase)  { fMEModCase[pid] = modcase ; }
165
166   Bool_t   GetMEExists(const Int_t pid)               const { return fMEExists[pid]     ; }
167   Double_t GetMEPhi(const Int_t pid)                  const { return fMEPhi[pid]        ; }
168   Double_t GetMEEta(const Int_t pid)                  const { return fMEEta[pid]        ; }
169   Double_t GetMEPt(const Int_t pid)                   const { return fMEPt[pid]         ; }
170   Int_t    GetMEModCase(const Int_t pid)              const { return fMEModCase[pid]    ; }
171
172   // Step 11: Start correlation analysis.
173   void ConsiderPi0s() ;                       // Consider the most energetic Pi0 in this event with all tracks of this event.
174   void ConsiderPi0s_MBSelection() ;           // Consider the most energetic Pi0 in this event with all tracks of this event using MB events.
175   
176   void ConsiderPi0sMix() ;                    // Use MIX for catch mass peck.
177   void ConsiderTracksMix() ;                  // Consider the most energetic Pi0 in this event with all tracks from MIXing pull.
178
179   void UpdatePhotonLists() ;                  // Fill photons in MIXing pull.
180   void UpdateTrackLists() ;                   // Fill Tracks in MIXing pull.
181
182
183   Bool_t TestMass(const Double_t& m, const Double_t& pt)  const ;                                // Check if mair in pi0 peak window.
184
185   Double_t MassMeanFunction(const Double_t &pt)           const ;                                // Parametrization mean of mass window.
186   Double_t MassSigmaFunction(const Double_t &pt)          const ;                                // Parametrization sigma of mass window.
187   Double_t GetAssocBin(const Double_t& pt)                const ;                                // Calculates bin for current associated particle pT.
188   Double_t GetEfficiency(const Double_t& pt)              const ;                                // Return Pi0 efficiency for current pT (PID: both2core only).
189   Int_t GetModCase(const Int_t &mod1, const Int_t &mod2)  const ;                                // Produce part of module neme for pTetaPhi histogram.
190
191   TList* GetCaloPhotonsPHOSList(const UInt_t vtxBin, const UInt_t centBin, const UInt_t rpBin) ; // Return photons from PHOS list from previous events.
192   TList* GetTracksTPCList(const UInt_t vtxBin, const UInt_t centBin, const UInt_t rpBin) ;       // Return tracks from TPC list from previous events.
193
194   Bool_t SelectESDTrack(const AliESDtrack * t) const ;                                           // Estimate if this track can be used for the RP calculation.
195   Bool_t SelectAODTrack(const AliAODTrack * t) const ;                                           // Estimate if this track can be used for the RP calculation.
196
197   AliAnalysisUtils* GetAnalysisUtils() ;
198
199
200 private:
201   //General Data members
202   AliPHOSGeometry *   fPHOSGeo ;                        //! Geometry
203   TList *   fOutputContainer ;                          //! Output histograms container 
204
205   AliVEvent   *           fEvent;                       //! Current event
206   AliESDEvent *           fEventESD;                    //! Current event, if ESD.
207   AliAODEvent *           fEventAOD;                    //! Current event, if AOD.
208   AliInputEventHandler *  fEventHandler;                //! Event trigger bit.
209
210   TClonesArray *  fCaloPhotonsPHOS ;                    //! PHOS photons in current event
211   TClonesArray *  fTracksTPC ;                          //! TPC tracks in current event
212   TObjArray *     fCaloPhotonsPHOSLists;                //! array of TList, Containers for events with PHOS photons
213   TObjArray *     fTracksTPCLists;                      //! array of TList, Containers for events with TPC tracks
214
215   Int_t     fRunNumber;                                 //! Run number
216   Int_t     fInternalRunNumber ;                        //! Current internal run number 
217   TString   fPeriod;
218
219   Bool_t    fPHOSEvent;                                 //! PHOS event trigger.
220   Bool_t    fMBEvent;                                   //! MB event trigger.
221
222   // Binning [vtx, centrality, reaction-plane]
223   Int_t     fNVtxZBins;                                 // Number of Z vertex bins
224   TArrayD   fVtxEdges;                                  //! Vertex bin Lower edges
225   TArrayD   fCentEdges;                                 //! Centrality Bin Lower edges
226   TArrayI   fCentNMixed;                                // Number of mixed events for each centrality bin
227   UInt_t    fNEMRPBins;                                 // Binning of Reaction plane
228   TArrayD   fAssocBins;                                 //! Assoc Pt Bin Lower edges  
229
230   Double_t  fVertex[3];                                 //! Event vertex
231   TVector3  fVertexVector;                              //! The same
232   Int_t     fVtxBin;                                    //! Vertex bin
233
234   TString   fCentralityEstimator;                       //! Centrality estimator ("V0M", "ZNA")
235   Float_t   fCentrality ;                               //! Centrality of the current event
236   Int_t     fCentBin ;                                  //! Current centrality bin
237
238   Bool_t    fHaveTPCRP ;                                //! Is TPC RP defined?
239   Float_t   fRP ;                                       //! Reaction plane calculated with full TPC
240   Int_t     fEMRPBin;                                   //! Event Mixing Reaction Plane Bin
241
242   // Behavior / cuts
243   Float_t   fMaxAbsVertexZ;                             // Maximum distence Z component of vertix in cm
244   Double_t  fCentralityLowLimit;                        // Ignore Centrality less % 
245   Double_t  fCentralityHightLimit;                      // Ignore Centrality over % 
246
247   Double_t  fMinClusterEnergy;                          // Min energy PHOS's cluster
248   Double_t  fMinBCDistance;                             // Min distance to nearest bad channel
249   Int_t     fMinNCells;                                 // Min count of Cells in cluster
250   Double_t  fMinM02;                                    // Min size of M02 in claster
251   Bool_t    fTOFCutEnabled;                             // Use time of flight or not?
252   Double_t  fTOFCut;                                    // Max time of flight
253
254   Bool_t   fUseMassWindowParametrisation;               // Use parametrization? (Else use fixed mass borders)
255   Double_t fMassInvMeanMin ;                            // Mass Pi0 minimum window value
256   Double_t fMassInvMeanMax ;                            // Mass Pi0 maximum window value
257   Double_t fNSigmaWidth;                                // Width in sigma (*N). If fNSigmaWidth = 0 code will use window fMassInvMeanMin fMassInvMeanMax
258
259   // Funktion of mass window parametrs: [mass, pt]
260   Double_t  fMassMean[2];                               // Mass mean parametrisation
261   Double_t  fMassSigma[3];                              // Mass sigma parametrisation
262
263   // ME Pi0 selection veriables ([n] = pid).
264   Bool_t    fMEExists[4];                               // Does trigger Pi0 candidate exists?
265   Double_t  fMEPhi[4];                                  // Phi of ME Pi0 candidate
266   Double_t  fMEEta[4];                                  // Eta of ME Pi0 candidate
267   Double_t  fMEPt[4];                                   // pT of ME Pi0 candidate
268   Int_t     fMEModCase[4];                              // Pair of modules where photons are observed
269
270   Bool_t    fUseEfficiency ;                            // Use efficiensy correction during analysis
271
272   AliESDtrackCuts *  fESDtrackCuts ;                    // Track cut
273   
274   Bool_t    fSelectHybridTracks ;                       // Select CTS tracks of type hybrid (only for AODs)
275
276   ULong_t   fTrackStatus        ;                       // the statusflag contains a set of flags  which show which parts of the tracking algorithm were successful.
277   ULong_t   fTrackFilterMask    ;                       // The filterbits encode combinations of cuts on the AOD, such as the hybrid track selection.
278   Bool_t    fSelectSPDHitTracks ;                       // Ensure that track hits SPD layers
279   Bool_t    fSelectFractionTPCSharedClusters ;          // Accept only TPC tracks with over a given fraction of shared clusters
280   Float_t   fCutTPCSharedClustersFraction    ;          // Fraction of TPC shared clusters to be accepted.
281
282
283   ClassDef(AliPHOSCorrelations, 2);                     // PHOS analysis task
284 };
285
286 #endif
287