]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGDQ/dielectron/AliReducedEvent.h
o Updates (Ionut)
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / AliReducedEvent.h
1 // Classes used for creating a reduced information tree
2 // Author: Ionut-Cristian Arsene (i.c.arsene@gsi.de)
3 // 
4 //  Basic structure:
5 //  1. Event wise information
6 //  2. List of tracks in the event
7 //  3. List of resonance candidates
8
9 #ifndef ALIREDUCEDEVENT_H
10 #define ALIREDUCEDEVENT_H
11
12 #include <TClonesArray.h>
13 #include <TBits.h>
14 #include <TMath.h>
15
16
17 const Int_t fgkNMaxHarmonics = 10;
18
19 //_____________________________________________________________________
20 class AliReducedTrack : public TObject {
21
22   friend class AliAnalysisTaskReducedTree;  // friend analysis task which fills the object
23
24  public:
25   AliReducedTrack();
26   ~AliReducedTrack();
27
28   // getters
29   UShort_t TrackId()                     const {return fTrackId;}
30   ULong_t  Status()                      const {return fStatus;}
31   Bool_t   CheckTrackStatus(UInt_t flag) const {return (flag<8*sizeof(ULong_t) ? (fStatus&(1<<flag)) : kFALSE);}
32   Int_t    Charge()                      const {return (fGlobalPt>0.0 ? +1 : -1);}
33   Float_t  Px()                          const {return TMath::Abs(fGlobalPt)*TMath::Cos(fGlobalPhi);}
34   Float_t  Py()                          const {return TMath::Abs(fGlobalPt)*TMath::Sin(fGlobalPhi);}
35   Float_t  Pz()                          const {return TMath::Abs(fGlobalPt)*TMath::SinH(fGlobalEta);}
36   Float_t  P()                           const {return TMath::Abs(fGlobalPt)*TMath::CosH(fGlobalEta);};
37   Float_t  Phi()                         const {return fGlobalPhi;}
38   Float_t  Pt()                          const {return TMath::Abs(fGlobalPt);}
39   Float_t  Eta()                         const {return fGlobalEta;}
40   Float_t  Theta()                       const {return TMath::ACos(TMath::TanH(fGlobalEta));}
41   Float_t  PxTPC()                       const {return fTPCPt*TMath::Cos(fTPCPhi);}
42   Float_t  PyTPC()                       const {return fTPCPt*TMath::Sin(fTPCPhi);}
43   Float_t  PzTPC()                       const {return fTPCPt*TMath::SinH(fTPCEta);}
44   Float_t  PTPC()                        const {return fTPCPt*TMath::CosH(fTPCEta);};
45   Float_t  PhiTPC()                      const {return fTPCPhi;}
46   Float_t  PtTPC()                       const {return fTPCPt;}
47   Float_t  EtaTPC()                      const {return fTPCEta;}
48   Float_t  ThetaTPC()                    const {return TMath::ACos(TMath::TanH(fTPCEta));}
49   Float_t  Pin()                         const {return fMomentumInner;}
50   Float_t  DCAxy()                       const {return fDCA[0];}
51   Float_t  DCAz()                        const {return fDCA[1];}
52   
53   UShort_t ITSncls()                const;
54   UChar_t  ITSclusterMap()          const {return fITSclusterMap;}
55   Bool_t   ITSLayerHit(Int_t layer) const {return (layer>=0 && layer<6 ? (fITSclusterMap&(1<<layer)) : kFALSE);};
56   Float_t  ITSsignal()              const {return fITSsignal;}
57   Float_t  ITSnSig(Int_t specie)    const {return (specie>=0 && specie<=3 ? fITSnSig[specie] : -999.);}
58   
59   UChar_t TPCncls()                        const {return fTPCNcls;}
60   UChar_t TPCFindableNcls()                const {return fTPCNclsF;}
61   UChar_t TPCCrossedRows()                 const {return fTPCCrossedRows;}
62   UChar_t TPCnclsIter1()                   const {return fTPCNclsIter1;}
63   UChar_t TPCClusterMap()                  const {return fTPCClusterMap;}
64   Int_t   TPCClusterMapBitsFired()         const;
65   Bool_t  TPCClusterMapBitFired(Int_t bit) const {return (bit>=0 && bit<8 ? (fTPCClusterMap&(1<<bit)) : kFALSE);};
66   Float_t TPCsignal()                      const {return fTPCsignal;}
67   Float_t TPCnSig(Int_t specie)            const {return (specie>=0 && specie<=3 ? fTPCnSig[specie] : -999.);}
68   
69   Float_t  TOFbeta()             const {return fTOFbeta;}    
70   Float_t  TOFnSig(Int_t specie) const {return (specie>=0 && specie<=3 ? fTOFnSig[specie] : -999.);}
71   
72   Int_t    TRDntracklets(Int_t type)  const {return (type==0 || type==1 ? fTRDntracklets[type] : -1);}
73   Float_t  TRDpid(Int_t specie)       const {return (specie>=0 && specie<=1 ? fTRDpid[specie] : -999.);}
74   
75   Int_t    CaloClusterId() const {return fCaloClusterId;}
76     
77   Float_t  BayesPID(Int_t specie) const {return (specie>=0 && specie<=2 ? fBayesPID[specie] : -999.);}
78   
79   Bool_t UsedForQvector()             const {return fFlags&(1<<0);}
80   Bool_t TestFlag(UShort_t iflag)     const {return (iflag<sizeof(UShort_t) ? fFlags&(1<<iflag) : kFALSE);}
81   Bool_t SetFlag(UShort_t iflag)            {if (iflag>=sizeof(UShort_t)) return kFALSE; fFlags|=(1<<iflag); return kTRUE;}
82   Bool_t IsGammaLeg()                 const {return fFlags&(1<<1);}
83   Bool_t IsK0sLeg()                   const {return fFlags&(1<<2);}
84   Bool_t IsLambdaLeg()                const {return fFlags&(1<<3);}
85   Bool_t IsALambdaLeg()               const {return fFlags&(1<<4);}
86   Bool_t IsKink(Int_t i=0)            const {return (i>=0 && i<3 ? fFlags&(1<<(5+i)) : kFALSE);}
87   Bool_t TestFlagMore(UShort_t iflag) const {return (iflag<sizeof(ULong_t) ? fMoreFlags&(1<<iflag) : kFALSE);}
88   Bool_t SetFlagMore(UShort_t iflag)        {if(iflag>=sizeof(ULong_t)) return kFALSE; fMoreFlags|=(1<<iflag); return kTRUE;}
89   
90  private:
91   UShort_t fTrackId;            // track id 
92   ULong_t fStatus;              // tracking status
93   Float_t fGlobalPhi;           // phi at the vertex from global track, in the [0,2pi) interval
94   Float_t fGlobalPt;            // pt*charge at the vertex from global track
95   Float_t fGlobalEta;           // eta at the vertex from global track
96   Float_t fTPCPhi;              // phi at the vertex from TPC alone tracking , in the [0,2pi) interval
97   Float_t fTPCPt;               // pt at the vertex from TPC alone tracking  
98   Float_t fTPCEta;              // eta at the vertex from TPC alone tracking 
99   Float_t fMomentumInner;       // inner param momentum (only the magnitude)
100   Float_t fDCA[2];              // DCA xy,z
101   
102   // ITS
103   UChar_t  fITSclusterMap;      // ITS cluster map
104   Float_t  fITSsignal;          // ITS signal
105   Float_t  fITSnSig[4];         // 0-electron; 1-pion; 2-kaon; 3-proton
106   
107   // TPC
108   UChar_t fTPCNcls;            // TPC ncls                          
109   UChar_t fTPCCrossedRows;     // TPC crossed rows                  
110   UChar_t fTPCNclsF;           // TPC findable ncls                 
111   UChar_t fTPCNclsIter1;       // TPC no clusters after first iteration
112   UChar_t fTPCClusterMap;      // TPC cluster distribution map
113   Float_t fTPCsignal;          // TPC de/dx
114   Float_t fTPCnSig[4];         // 0-electron; 1-pion; 2-kaon; 3-proton
115     
116   // TOF
117   Float_t fTOFbeta;             // TOF pid info
118   Float_t fTOFnSig[4];          // TOF n-sigma deviation from expected signal
119   
120   // TRD
121   UChar_t fTRDntracklets[2];       // 0 - AliESDtrack::GetTRDntracklets(); 1 - AliESDtrack::GetTRDntrackletsPID()   TODO: use only 1 char
122   Float_t fTRDpid[2];              // TRD electron probabilities, [0]- 1D likelihood, [1]- 2D likelihood
123   
124   // EMCAL/PHOS
125   Int_t  fCaloClusterId;          // ID for the calorimeter cluster (if any)
126   
127   // Bayesian PID
128   Float_t fBayesPID[3];           // Combined Bayesian PID   pi/K/p
129   
130   UShort_t fFlags;                // BIT0 toggled if track used for TPC event plane
131                                   // BIT1 toggled if track belongs to a gamma conversion
132                                   // BIT2 toggled if track belongs to a K0s
133                                   // BIT3 toggled if track belongs to a Lambda
134                                   // BIT4 toggled if track belongs to an Anti-Lambda
135                                   // BIT5 toggled if the track has kink0 index > 0
136                                   // BIT6 toggled if the track has kink1 index > 0
137                                   // BIT7 toggled if the track has kink2 index > 0
138   ULong_t  fMoreFlags;            // Space reserved for more information which might be needed later for analysis
139     
140   AliReducedTrack(const AliReducedTrack &c);
141   AliReducedTrack& operator= (const AliReducedTrack &c);
142
143   ClassDef(AliReducedTrack, 3);
144 };
145
146
147 //_____________________________________________________________________
148 class AliReducedPair : public TObject {
149
150   friend class AliAnalysisTaskReducedTree;  // friend analysis task which fills the object
151
152  public:
153   enum CandidateType {
154     kK0sToPiPi=0,
155     kPhiToKK,
156     kLambda0ToPPi,
157     kALambda0ToPPi,
158     kJpsiToEE,
159     kUpsilon,
160     kGammaConv,
161     kNMaxCandidateTypes
162   };
163   AliReducedPair();
164   AliReducedPair(const AliReducedPair &c);
165   ~AliReducedPair();
166
167   // getters
168   Char_t   CandidateId()         const {return fCandidateId;}
169   Char_t   PairType()            const {return fPairType;}
170   Int_t    LegId(Int_t leg)      const {return (leg==0 || leg==1 ? fLegIds[leg] : -1);}
171   Float_t  Mass(Int_t idx=0)     const {return (idx>=0 && idx<4 ? fMass[idx] : -999.);}
172   Float_t  Px()                  const {return fPt*TMath::Cos(fPhi);}
173   Float_t  Py()                  const {return fPt*TMath::Sin(fPhi);}
174   Float_t  Pz()                  const {return fPt*TMath::SinH(fEta);}
175   Float_t  P()                   const {return fPt*TMath::CosH(fEta);}
176   Float_t  Phi()                 const {return fPhi;}
177   Float_t  Pt()                  const {return fPt;}
178   Float_t  Eta()                 const {return fEta;}
179   Float_t  Energy()              const;
180   Float_t  Rapidity()            const;
181   Float_t  Theta()               const {return TMath::ACos(TMath::TanH(fEta));}
182   Float_t  Lxy()                 const {return fLxy;}
183   Float_t  LxyErr()              const {return fLxyErr;}
184   Float_t  PointingAngle()       const {return fPointingAngle;}
185   Bool_t   IsOnTheFly()          const {return fPairType;}
186   UInt_t   MCid()                const {return fMCid;}
187   Bool_t   CheckMC(const Int_t flag) const {return (flag<32 ? (fMCid&(1<<flag)) : kFALSE);}
188   
189  private:
190   Char_t  fCandidateId;         // candidate type (K0s, Lambda, J/psi, phi, etc)
191   Char_t  fPairType;            // 0 ++; 1 +-; 2 -- for dielectron pairs; 0- offline, 1- on the fly for V0 candidates
192   UShort_t fLegIds[2];          // leg ids 
193   Float_t fMass[4];             // invariant mass for pairs (3 extra mass values for other V0 pid assumptions)
194                                 // idx=0 -> K0s assumption; idx=1 -> Lambda; idx=2 -> anti-Lambda; idx=3 -> gamma conversion
195   Float_t fPhi;                 // pair phi in the [0,2*pi) interval
196   Float_t fPt;                  // pair pt
197   Float_t fEta;                 // pair eta 
198   Float_t fLxy;                 // pseudo-proper decay length
199   Float_t fLxyErr;              // error on Lxy
200   Float_t fPointingAngle;       // angle between the pair momentum vector and the secondary vertex position vector
201   UInt_t  fMCid;                // Bit map with Monte Carlo info about the pair
202
203   AliReducedPair& operator= (const AliReducedPair &c);
204
205   ClassDef(AliReducedPair, 2);
206 };
207
208
209 //_________________________________________________________________________
210 class AliReducedEventFriend : public TObject {
211   
212   friend class AliAnalysisTaskReducedTree;    // friend analysis task which fills the object
213   
214  public: 
215   enum EventPlaneStatus {
216     kRaw=0,
217     kCalibrated,
218     kRecentered,
219     kShifted,
220     kNMaxFlowFlags
221   };
222   enum EventPlaneDetector {
223     kTPC=0,       
224     kTPCptWeights,
225     kTPCpos,
226     kTPCneg,
227     kVZEROA,
228     kVZEROC,
229     kFMD,
230     kZDCA,
231     kZDCC,
232     kNdetectors
233   };
234   
235   AliReducedEventFriend();
236   ~AliReducedEventFriend();
237   
238   Double_t Qx(Int_t det, Int_t harmonic)  const {return (det>=0 && det<kNdetectors && harmonic>0 && harmonic<=fgkNMaxHarmonics ? fQvector[det][harmonic-1][0] : -999.);}
239   Double_t Qy(Int_t det, Int_t harmonic)  const {return (det>=0 && det<kNdetectors && harmonic>0 && harmonic<=fgkNMaxHarmonics ? fQvector[det][harmonic-1][1] : -999.);}
240   Double_t EventPlane(Int_t det, Int_t h) const;
241   UChar_t GetEventPlaneStatus(Int_t det, Int_t h) const {return (det>=0 && det<kNdetectors && h>0 && h<=fgkNMaxHarmonics ? fEventPlaneStatus[det][h] : 999);} 
242   Bool_t  CheckEventPlaneStatus(Int_t det, Int_t h, EventPlaneStatus flag) const;
243   void    CopyEvent(const AliReducedEventFriend* event);
244
245   void SetQx(Int_t det, Int_t harmonic, Float_t qx) { if(det>=0 && det<kNdetectors && harmonic>0 && harmonic<=fgkNMaxHarmonics) fQvector[det][harmonic-1][0]=qx;}
246   void SetQy(Int_t det, Int_t harmonic, Float_t qy) { if(det>=0 && det<kNdetectors && harmonic>0 && harmonic<=fgkNMaxHarmonics) fQvector[det][harmonic-1][1]=qy;}
247   void SetEventPlaneStatus(Int_t det, Int_t harmonic, EventPlaneStatus status) { 
248     if(det>=0 && det<kNdetectors && harmonic>0 && harmonic<=fgkNMaxHarmonics) 
249       fEventPlaneStatus[det][harmonic-1] |= (1<<status);
250   }
251   
252  private:
253   // Q-vectors for the first 10 harmonics from TPC, VZERO, FMD and ZDC detectors
254   Double_t fQvector[kNdetectors][fgkNMaxHarmonics][2];     // Q vector components for all detectors and 6 harmonics
255   UChar_t fEventPlaneStatus[kNdetectors][fgkNMaxHarmonics];  // Bit maps for the event plane status (1 char per detector and per harmonic)
256    
257   void ClearEvent();
258   AliReducedEventFriend(const AliReducedEventFriend &c);
259   AliReducedEventFriend& operator= (const AliReducedEventFriend &c);
260
261   ClassDef(AliReducedEventFriend, 1);
262 };
263
264
265 //_________________________________________________________________________
266 class AliReducedCaloCluster : public TObject {
267   
268   friend class AliAnalysisTaskReducedTree;         // friend analysis task which fills the object
269   
270  public:
271   enum ClusterType {
272     kUndefined=0, kEMCAL, kPHOS  
273   };
274    
275   AliReducedCaloCluster();
276   ~AliReducedCaloCluster();
277   
278   Bool_t  IsEMCAL() const {return (fType==kEMCAL ? kTRUE : kFALSE);}
279   Bool_t  IsPHOS()  const {return (fType==kPHOS ? kTRUE : kFALSE);}
280   Float_t Energy()  const {return fEnergy;}
281   Float_t Dx()      const {return fTrackDx;}
282   Float_t Dz()      const {return fTrackDz;}
283   
284  private:
285   Char_t  fType;         // cluster type (EMCAL/PHOS)
286   Float_t fEnergy;       // cluster energy
287   Float_t fTrackDx;      // distance to closest track in phi
288   Float_t fTrackDz;      // distance to closest track in z
289   
290   AliReducedCaloCluster(const AliReducedCaloCluster &c);
291   AliReducedCaloCluster& operator= (const AliReducedCaloCluster &c);
292
293   ClassDef(AliReducedCaloCluster, 1);
294 };
295
296
297 //_________________________________________________________________________
298 class AliReducedEvent : public TObject {
299
300   friend class AliAnalysisTaskReducedTree;     // friend analysis task which fills the object
301
302  public:
303   AliReducedEvent();
304   AliReducedEvent(const Char_t* name);
305   ~AliReducedEvent();
306
307   // getters
308   Int_t     RunNo()                           const {return fRunNo;}
309   UShort_t  BC()                              const {return fBC;}
310   ULong64_t TriggerMask()                     const {return fTriggerMask;}
311   Bool_t    IsPhysicsSelection()              const {return fIsPhysicsSelection;}
312   Float_t   Vertex(Int_t axis)                const {return (axis>=0 && axis<=2 ? fVtx[axis] : 0);}
313   Int_t     VertexNContributors()             const {return fNVtxContributors;}
314   Float_t   VertexTPC(Int_t axis)             const {return (axis>=0 && axis<=2 ? fVtxTPC[axis] : 0);}
315   Int_t     VertexTPCContributors()           const {return fNVtxTPCContributors;}
316   Float_t   CentralityVZERO()                 const {return fCentrality[0];}
317   Float_t   CentralitySPD()                   const {return fCentrality[1];}
318   Float_t   CentralityTPC()                   const {return fCentrality[2];}
319   Float_t   CentralityZEMvsZDC()              const {return fCentrality[3];}
320   Int_t     CentralityQuality()               const {return fCentQuality;}
321   Int_t     NV0CandidatesTotal()              const {return fNV0candidates[0];}
322   Int_t     NV0Candidates()                   const {return fNV0candidates[1];}
323   Int_t     NDielectrons()                    const {return fNDielectronCandidates;}
324   Int_t     NTracksTotal()                    const {return fNtracks[0];}
325   Int_t     NTracks()                         const {return fNtracks[1];}
326   Int_t     SPDntracklets()                   const {return fSPDntracklets;}
327   
328   Float_t   MultChannelVZERO(Int_t channel)   const {return (channel>=0 && channel<=63 ? fVZEROMult[channel] : -999.);}
329   Float_t   MultVZEROA()                      const;
330   Float_t   MultVZEROC()                      const;
331   Float_t   MultVZERO()                       const;
332   Float_t   MultRingVZEROA(Int_t ring)        const;
333   Float_t   MultRingVZEROC(Int_t ring)        const;
334   
335   Float_t   EnergyZDC(Int_t channel)   const {return (channel>=0 && channel<8 ? fZDCnEnergy[channel] : -999.);}
336   Float_t   EnergyZDCnA(Int_t channel) const {return (channel>=0 && channel<4 ? fZDCnEnergy[channel+4] : -999.);}
337   Float_t   EnergyZDCnC(Int_t channel) const {return (channel>=0 && channel<4 ? fZDCnEnergy[channel] : -999.);}
338   
339   AliReducedTrack* GetTrack(Int_t i)         const 
340     {return (i<fNtracks[1] ? (AliReducedTrack*)fTracks->At(i) : 0x0);}
341   AliReducedPair* GetV0Pair(Int_t i)         const 
342     {return (i>=0 && i<fNV0candidates[1] ? (AliReducedPair*)fCandidates->At(i) : 0x0);}
343   AliReducedPair* GetDielectronPair(Int_t i) const 
344     {return (i>=0 && i<fNDielectronCandidates ? (AliReducedPair*)fCandidates->At(i+fNV0candidates[1]) : 0x0);}
345   TClonesArray* GetPairs()                              const {return fCandidates;}
346   TClonesArray* GetTracks()                             const {return fTracks;}
347
348   Int_t GetNCaloClusters() const {return fNCaloClusters;}
349   AliReducedCaloCluster* GetCaloCluster(Int_t i) const 
350     {return (i>=0 && i<fNCaloClusters ? (AliReducedCaloCluster*)fCaloClusters->At(i) : 0x0);}
351   
352   void  GetQvector(Double_t Qvec[][2], Int_t det, Float_t etaMin=-0.8, Float_t etaMax=+0.8, Bool_t (*IsTrackSelected)(AliReducedTrack*)=NULL);
353   Int_t GetTPCQvector(Double_t Qvec[][2], Int_t det, Float_t etaMin=-0.8, Float_t etaMax=+0.8, Bool_t (*IsTrackSelected)(AliReducedTrack*)=NULL);
354   void  GetVZEROQvector(Double_t Qvec[][2], Int_t det) ;
355   void  GetVZEROQvector(Double_t Qvec[][2], Int_t det, Float_t* vzeroMult);
356   void  GetZDCQvector(Double_t Qvec[][2], Int_t det) const;
357   void  SubtractParticleFromQvector(AliReducedTrack* particle, Double_t Qvec[][2], Int_t det,
358                                     Float_t etaMin=-0.8, Float_t etaMax=+0.8,
359                                     Bool_t (*IsTrackSelected)(AliReducedTrack*)=NULL);
360
361  private:
362   Int_t     fRunNo;                 // run number
363   UShort_t  fBC;                    // bunch crossing
364   ULong64_t fTriggerMask;           // trigger mask
365   Bool_t    fIsPhysicsSelection;    // PhysicsSelection passed event
366   Float_t   fVtx[3];                // global event vertex vector in cm
367   Int_t     fNVtxContributors;      // global event vertex contributors
368   Float_t   fVtxTPC[3];             // TPC only event vertex           
369   Int_t     fNVtxTPCContributors;   // TPC only event vertex contributors
370   Float_t   fCentrality[4];         // centrality; 0-VZERO, 1-SPD, 2-TPC, 3-ZEMvsZDC 
371   Int_t     fCentQuality;           // quality flag for the centrality 
372   Int_t     fNV0candidates[2];      // number of V0 candidates, [0]-total, [1]-selected for the tree
373   Int_t     fNDielectronCandidates; // number of pairs selected as dielectrons
374   Int_t     fNtracks[2];            // number of tracks, [0]-total, [1]-selected for the tree
375   Int_t     fSPDntracklets;         // number of SPD tracklets in |eta|<1.0 
376
377   Float_t   fVZEROMult[64];         // VZERO multiplicity in all 64 channels
378   Float_t   fZDCnEnergy[8];         // neutron ZDC energy in all 8 channels
379     
380   TClonesArray* fTracks;            //->   array containing global tracks
381   static TClonesArray* fgTracks;    //       global tracks
382   
383   TClonesArray* fCandidates;        //->   array containing pair candidates
384   static TClonesArray* fgCandidates;  // pair candidates
385   
386   Int_t     fNCaloClusters;         // number of calorimeter clusters  
387   TClonesArray* fCaloClusters;        //->   array containing calorimeter clusters
388   static TClonesArray* fgCaloClusters;     // calorimeter clusters
389   
390   void ClearEvent();
391   AliReducedEvent(const AliReducedEvent &c);
392   AliReducedEvent& operator= (const AliReducedEvent &c);
393
394   ClassDef(AliReducedEvent, 2);
395 };
396
397 //_______________________________________________________________________________
398 inline UShort_t AliReducedTrack::ITSncls() const
399 {
400   //
401   // ITS number of clusters from the cluster map
402   //
403   UShort_t ncls=0;
404   for(Int_t i=0; i<6; ++i) ncls += (ITSLayerHit(i) ? 1 : 0);
405   return ncls;
406 }
407
408
409 //_______________________________________________________________________________
410 inline Int_t AliReducedTrack::TPCClusterMapBitsFired()  const
411 {
412   //
413   // Count the number of bits fired in the TPC cluster map
414   //
415   Int_t nbits=0;
416   for(Int_t i=0; i<8; ++i) nbits += (TPCClusterMapBitFired(i) ? 1 : 0);
417   return nbits;
418 }
419
420
421 //_______________________________________________________________________________
422 inline Float_t AliReducedPair::Energy() const 
423 {
424   //
425   // Return the energy
426   //
427   Float_t mass=fMass[0];
428   switch (fCandidateId) {
429     case kK0sToPiPi:
430       mass = fMass[0];
431       break;
432     case kLambda0ToPPi:
433       mass = fMass[1];
434       break;
435     case kALambda0ToPPi:
436       mass = fMass[2];
437       break;
438     case kGammaConv:
439       mass = fMass[3];
440       break;
441     default:
442       mass = fMass[0];
443       break;    
444   }
445   Float_t p = P();
446   return TMath::Sqrt(mass*mass+p*p);
447 }
448
449
450 //_______________________________________________________________________________
451 inline Float_t AliReducedPair::Rapidity() const
452 {
453   //
454   // return rapidity
455   //
456   Float_t e = Energy();
457   Float_t pz = Pz();
458   if(e-TMath::Abs(pz)>1.0e-10)
459     return 0.5*TMath::Log((e+pz)/(e-pz));
460   else 
461     return -999.;
462 }
463
464
465 //_______________________________________________________________________________
466 inline Double_t AliReducedEventFriend::EventPlane(Int_t det, Int_t harmonic) const
467 {
468   //
469   // Event plane from detector "det" and harmonic "harmonic"
470   //
471   if(det<0 || det>=kNdetectors || harmonic<1 || harmonic>fgkNMaxHarmonics) return -999.;
472   return TMath::ATan2(fQvector[det][harmonic-1][1], fQvector[det][harmonic-1][0])/Double_t(harmonic);
473 }
474
475 //_______________________________________________________________________________
476 inline Bool_t AliReducedEventFriend::CheckEventPlaneStatus(Int_t det, Int_t h, EventPlaneStatus flag) const {
477   //
478   // Check the status of the event plane for a given detector and harmonic
479   //
480   if(det<0 || det>=kNdetectors || h<1 || h>fgkNMaxHarmonics) return kFALSE;
481   return (flag<kNMaxFlowFlags ? (fEventPlaneStatus[det][h]&(1<<flag)) : kFALSE);
482 }
483
484 #endif