]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnDaughter.h
Renamed classes: these with old name are removed and newly named will be added in...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnDaughter.h
1 //
2 // Class AliRsnDaughter
3 //
4 // Light-weight AOD object which contains all required track details
5 // which are used for resonance analysis.
6 // Provides converters from all kinds of input track type: ESD, AOD and MC.
7 //
8 // author: A. Pulvirenti --- email: alberto.pulvirenti@ct.infn.it
9 //
10
11 #ifndef ALIRSNDAUGHTER_H
12 #define ALIRSNDAUGHTER_H
13
14 #include <TMath.h>
15
16 #include "AliVParticle.h"
17 #include "AliRsnPID.h"
18
19 class TParticle;
20
21 class AliESDtrack;
22 class AliAODTrack;
23 class AliMCParticle;
24
25 class AliRsnMCInfo;
26
27 class AliRsnDaughter : public AliVParticle
28 {
29   public:
30   
31     enum EPIDMethod {
32         kNoPID = 0,
33         kRealistic,
34         kWeighted,
35         kPerfect,
36         kMethods
37     };
38
39     AliRsnDaughter();
40     AliRsnDaughter (const AliRsnDaughter &copy);
41     AliRsnDaughter (AliESDtrack *track, Bool_t useTPCInnerParam = kFALSE);
42     AliRsnDaughter (AliAODTrack *track);
43     AliRsnDaughter (AliMCParticle *track);
44     virtual ~AliRsnDaughter();
45     AliRsnDaughter& operator= (const AliRsnDaughter& copy);
46
47     // 4-momentum
48     virtual Double_t E()  const {return TMath::Sqrt (fMass*fMass + P2());}
49     virtual Double_t E(Double_t mass) {SetM(mass); return E();}
50     virtual Double_t M()  const {return fMass;}
51     virtual Double_t P2() const {return Px()*Px() + Py()*Py() + Pz()*Pz();}
52     virtual Double_t P()  const {return TMath::Sqrt (P2());}
53     virtual Double_t Px() const {return fP[0];}
54     virtual Double_t Py() const {return fP[1];}
55     virtual Double_t Pz() const {return fP[2];}
56     virtual Double_t Pt() const {return TMath::Sqrt (Px()*Px() + Py()*Py());}
57     virtual Double_t OneOverPt() const {return 1.0 / Pt();}
58     virtual Bool_t   PxPyPz (Double_t p[3]) const {p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE;}
59     void             SetPx (Double_t value) {fP[0] = value;}
60     void             SetPy (Double_t value) {fP[1] = value;}
61     void             SetPz (Double_t value) {fP[2] = value;}
62     void             SetP (Double_t px, Double_t py, Double_t pz) {SetPx (px); SetPy (py); SetPz (pz);}
63     void             SetM (Double_t m) {fMass = m;}
64
65     // DCA vertex
66     virtual Double_t Xv() const {return fV[0];}
67     virtual Double_t Yv() const {return fV[1];}
68     virtual Double_t Zv() const {return fV[2];}
69     virtual Double_t Dr() const {return TMath::Sqrt (Xv()*Xv() + Yv()*Yv());}
70     virtual Bool_t   XvYvZv (Double_t x[3]) const {x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE;}
71     void             SetVx (Double_t value) {fV[0] = value;}
72     void             SetVy (Double_t value) {fV[1] = value;}
73     void             SetVz (Double_t value) {fV[2] = value;}
74     void             SetV (Double_t vx, Double_t vy, Double_t vz) {SetVx (vx); SetVy (vy); SetVz (vz);}
75
76     // Orientation
77     virtual Double_t Phi() const {return TMath::ATan2 (Py(), Px());}
78     virtual Double_t Theta() const {return TMath::ATan2 (Pt(), Pz());}
79     virtual Double_t Eta() const {return -TMath::Log (TMath::Tan (0.5*Theta()));}
80     virtual Double_t Y() const {return TMath::Log ((E() + Pz()) / (E() - Pz()));}
81
82     // Charge
83     virtual Short_t Charge() const {return fCharge;}
84     void            SetCharge (Short_t value) {fCharge = value;}
85
86     // PID
87     virtual const Double_t* PID() const {return fPIDWeight;}
88     const Double_t*         PIDProb() const {return fPIDProb;}
89     void                    SetPIDProb (Int_t i, Double_t value);
90     void                    SetPIDWeight (Int_t i, Double_t value);
91     static void             SetPIDMethod(EPIDMethod method) {fgPIDMethod = method;}
92     void                    AssignRealisticPID();
93     AliRsnPID::EType        PIDType(Double_t &prob);
94
95     // check that contains a given ESD flag
96     Bool_t  CheckFlag (ULong_t flag) {return (fFlags & flag);}
97
98     // information getters from objects
99     Bool_t  Adopt (AliESDtrack *track, Bool_t useTPCInnerParam = kFALSE);
100     Bool_t  Adopt (AliAODTrack *track);
101     Bool_t  Adopt (AliMCParticle *track);
102
103     // position in stack/array
104     Int_t   Index() const {return fIndex;}
105     Int_t   Label() const {return fLabel;}
106     Int_t   GetLabel() const {return -1;}
107     void    SetIndex (Int_t value) {fIndex = value;}
108     void    SetLabel (Int_t value) {fLabel = value;}
109
110     // Utilities
111     void    Print (Option_t *option = "ALL") const;
112     void    InitMCInfo();
113     Bool_t  InitMCInfo (TParticle *particle);
114     Bool_t  InitMCInfo (AliMCParticle *mcParticle);
115
116     // MC info
117     AliRsnMCInfo* GetMCInfo() const { return fMCInfo; }
118     
119     // sorting (with respect to Pt)
120     virtual Bool_t IsSortable() const {return kTRUE;}
121     virtual Int_t  Compare(const TObject* obj) const;
122
123   private:
124
125     Int_t              fIndex;    // index of source object (ESD/AOD/MC) in its collection
126     Int_t              fLabel;    // label assigned to the track (act. by GEANT3)
127
128     Short_t            fCharge;   // charge sign
129     ULong_t            fFlags;    // status flags
130
131     Double_t           fP[3];     // vector momentum (x, y, z)
132     Double_t           fV[3];     // DCA vertex (x, y, z)
133     Double_t           fMass;     // mass (assigned externally)
134
135     AliRsnPID::EType   fRealisticPID;                   // PID from Bayesian probs (largest one)
136     Double_t           fPIDProb[AliRsnPID::kSpecies];   // PID probabilities (Bayesian comp.)
137     Double_t           fPIDWeight[AliRsnPID::kSpecies]; // PID weights
138
139     AliRsnMCInfo      *fMCInfo;     // reference to particle object (if any)
140     static EPIDMethod  fgPIDMethod; // flag to define how the PID is computed for this object
141
142     ClassDef (AliRsnDaughter, 4);
143 };
144
145 #endif