]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnDaughter.h
407548720e43672eb1c8434ffcc32141df082499
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnDaughter.h
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * See cxx source for full Copyright notice                               *
4  **************************************************************************/
5
6 // ***********************
7 // *** AliRsnDaughter ****
8 // ***********************
9 // 
10 // Light-weight 'track' object into an internal format used
11 // for further steps of resonance analysis.
12 // Provides converters from all kinds of input track type
13 // (ESD, AOD and MC).
14 // Contains also a facility to compute invariant mass of a pair.
15 //
16 // author: A. Pulvirenti --- email: alberto.pulvirenti@ct.infn.it
17
18 #ifndef ALIRSNDAUGHTER_H
19 #define ALIRSNDAUGHTER_H
20
21 #include <TMath.h>
22
23 #include "AliVParticle.h"
24 #include "AliRsnPID.h"
25
26 class TParticle;
27
28 class AliESDtrack;
29 class AliAODTrack;
30 class AliMCParticle;
31
32 class AliRsnParticle;
33
34 class AliRsnDaughter : public AliVParticle
35 {
36 public:
37
38     AliRsnDaughter();
39     AliRsnDaughter(const AliRsnDaughter &copy);
40     AliRsnDaughter(AliESDtrack *track);
41     AliRsnDaughter(AliAODTrack *track);
42     AliRsnDaughter(AliMCParticle *track);
43     virtual ~AliRsnDaughter();
44     AliRsnDaughter& operator=(const AliRsnDaughter& copy);
45
46     // 4-momentum
47     virtual Double_t E()  const {return TMath::Sqrt(fMass*fMass + P2());}
48     virtual Double_t M()  const {return fMass;}
49     virtual Double_t P2() const {return Px()*Px() + Py()*Py() + Pz()*Pz();}
50     virtual Double_t P()  const {return TMath::Sqrt(P2());}
51     virtual Double_t Px() const {return fP[0];}
52     virtual Double_t Py() const {return fP[1];}
53     virtual Double_t Pz() const {return fP[2];}
54     virtual Double_t Pt() const {return TMath::Sqrt(Px()*Px() + Py()*Py());}
55     virtual Double_t OneOverPt() const {return 1.0 / Pt();}
56     virtual Bool_t   PxPyPz(Double_t p[3]) const {p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE;}
57     void             SetPx(Double_t value) {fP[0] = value;}
58     void             SetPy(Double_t value) {fP[1] = value;}
59     void             SetPz(Double_t value) {fP[2] = value;}
60     void             SetP(Double_t px, Double_t py, Double_t pz) {SetPx(px); SetPy(py); SetPz(pz);}
61     void             SetM(Double_t m) {fMass = m;}
62
63     // DCA vertex
64     virtual Double_t Xv() const {return fV[0];}
65     virtual Double_t Yv() const {return fV[1];}
66     virtual Double_t Zv() const {return fV[2];}
67     virtual Double_t Vt() const {return TMath::Sqrt(Xv()*Xv() + Yv()*Yv());}
68     virtual Bool_t   XvYvZv(Double_t x[3]) const {x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE;}
69     void             SetVx(Double_t value) {fV[0] = value;}
70     void             SetVy(Double_t value) {fV[1] = value;}
71     void             SetVz(Double_t value) {fV[2] = value;}
72     void             SetV(Double_t vx, Double_t vy, Double_t vz) {SetVx(vx); SetVy(vy); SetVz(vz);}
73
74     // Orientation
75     virtual Double_t Phi() const {return TMath::ATan2(Py(), Px());}
76     virtual Double_t Theta() const {return TMath::ATan2(Pt(), Pz());}
77     virtual Double_t Eta() const {return -TMath::Log(TMath::Tan(0.5*Theta()));}
78     virtual Double_t Y() const {return TMath::Log((E() + Pz()) / (E() - Pz()));}
79
80     // Charge
81     virtual Short_t Charge() const {return fCharge;}
82     void            SetCharge(Short_t value) {fCharge = value;}
83
84     // PID
85     virtual const Double_t* PID() const {return fPIDWeight;}
86     AliRsnPID::EType        PIDType() const {return fPIDType;}
87     Double_t                PIDProb() {return fPIDProb;}
88     void                    SetPIDType(AliRsnPID::EType type) {fPIDType = type;}
89     void                    SetPIDProb(Double_t value) {fPIDProb = value;}
90     void                    SetPIDWeight(Int_t i, Double_t value);
91     void                    SetPIDWeights(const Double_t *pid);
92
93     // check that contains a given ESD flag
94     Bool_t    CheckFlag(ULong_t flag) {return (fFlags & flag);}
95
96     // information getters from objects
97     Bool_t    Adopt(AliESDtrack *track);
98     Bool_t    Adopt(AliAODTrack *track);
99     Bool_t    Adopt(AliMCParticle *track);
100
101     // position in stack/array
102     Int_t Index() const {return fIndex;}
103     Int_t Label() const {return fLabel;}
104     void  SetIndex(Int_t value) {fIndex = value;}
105     void  SetLabel(Int_t value) {fLabel = value;}
106
107     // Utilities
108     void                   Print(Option_t *option = "ALL") const;
109     static AliRsnDaughter  Sum(AliRsnDaughter t1, AliRsnDaughter t2);
110     AliRsnParticle        *GetParticle() {return fParticle;}
111     void                   InitParticle();
112     Bool_t                 InitParticle(TParticle *particle);
113     Bool_t                 InitParticle(AliMCParticle *mcParticle);
114
115 private:
116
117     Int_t              fIndex;    // index of source object (ESD/AOD/MC) in its collection
118     Int_t              fLabel;    // label assigned to the track (act. by GEANT3)
119
120     Short_t            fCharge;   // charge sign
121     ULong_t            fFlags;    // status flags
122
123     Double_t           fP[3];     // vector momentum (x, y, z)
124     Double_t           fV[3];     // DCA vertex (x, y, z)
125
126     AliRsnPID::EType   fPIDType;  // assigned PID
127     Double_t           fPIDProb;  // probability related to assigned PID
128     Double_t           fPIDWeight[AliRsnPID::kSpecies]; // PID weights
129     Double_t           fMass;     // mass (defined by PID)
130
131     AliRsnParticle    *fParticle; // reference to particle object (if any)
132
133     ClassDef(AliRsnDaughter, 3)
134 };
135
136 #endif