89018cfaf7f607e1ddcc7a2722cd930f699248a4
[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 //                      Class AliRsnDaughter
8 //  
9 //           A simple object which describes a reconstructed track
10 //           with some references to its related generated particle
11 //           and some facilities which could help in composing its
12 //           4-momentum, for resonance study.
13 // 
14 // author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
15 //-------------------------------------------------------------------------
16
17 #ifndef ALIRSNDAUGHTER_H
18 #define ALIRSNDAUGHTER_H
19
20 #include "AliPID.h"
21 #include <TVector3.h>
22 #include <TLorentzVector.h>
23
24 class TParticle;
25 class AliESDtrack;
26
27 class AliRsnDaughter : public TObject
28 {
29 public:
30                                AliRsnDaughter();
31                        AliRsnDaughter(const AliRsnDaughter &copy);
32                                 
33         virtual       ~AliRsnDaughter() { }
34                 
35         Bool_t         Adopt(TParticle* particle);
36         Bool_t         Adopt(const AliESDtrack* track, Bool_t checkRefit = kTRUE);
37         TVector3       Get3Momentum() const                                               {TVector3 v(fP[0],fP[1],fP[2]); return v;}
38         TLorentzVector Get4Momentum() const                                       {TLorentzVector v(fP[0],fP[1],fP[2],GetEnergy()); return v;}
39         Double_t       GetEnergy() const                                              {return TMath::Sqrt(fMass*fMass + GetP2());}
40         UShort_t       GetIndex() const                                                           {return fIndex;}
41         Int_t          GetLabel() const                                                           {return fLabel;}
42         Double_t       GetMass() const                                {return fMass;}
43         Int_t          GetMother() const                                                          {return fMother;}
44         Short_t        GetMotherPDG() const                                               {return fMotherPDG;}
45         UShort_t       GetPDG() const                                                             {return fPDG;}
46         Double_t       GetPIDweight(Int_t i) const                                {return ( (i>=0&&i<AliPID::kSPECIES)?fPIDwgt[i]:-1.0 );}
47         Char_t         GetSign() const                                                            {return fSign;}
48         Double_t       GetP2() const                                                              {return fP[0]*fP[0] + fP[1]*fP[1] + fP[2]*fP[2];}
49         Double_t       GetP() const                                                               {return TMath::Sqrt(GetP2());}
50         Double_t       GetPx() const                                                              {return fP[0];}
51         Double_t       GetPy() const                                                              {return fP[1];}
52         Double_t       GetPz() const                                                              {return fP[2];}
53         Double_t       GetPt() const                                                              {return TMath::Sqrt(fP[0]*fP[0] + fP[1]*fP[1]);}
54         Short_t        GetTruePDG() const                                                         {return fTruePDG;}
55         TVector3       GetVertex() const                                                          {TVector3 v(fV[0],fV[1],fV[2]); return v;}
56         Double_t       GetVx() const                                                              {return fV[0];}
57         Double_t       GetVy() const                                                              {return fV[1];}
58         Double_t       GetVz() const                                                              {return fV[2];}
59         Double_t       GetVt() const                                                              {return TMath::Sqrt(fV[0]*fV[0] + fV[1]*fV[1]);}
60         void           SetIndex(UShort_t value)                                           {fIndex = value;}
61         void           SetIndex(Int_t value)                                              {fIndex = (UShort_t)value;}
62         void           SetLabel(Int_t l)                                                          {fLabel = l;}
63         void           SetMass(Double_t m)                            {fMass = m;}
64         void           SetMother(Int_t l)                                                         {fMother = l;}
65         void           SetMotherPDG(Short_t pdg)                                          {fMotherPDG = pdg;}
66         void           SetPDG(UShort_t pdg)                           {fPDG = TMath::Abs(pdg);}
67         void           SetPDG(Int_t pdg)                              {fPDG = (UShort_t)TMath::Abs(pdg);}
68         void           SetPIDweights(const Double_t *pid)                         {Int_t i;for(i=0;i<AliPID::kSPECIES;i++)fPIDwgt[i]=pid[i];}
69         void           SetPxPyPz(Double_t px,Double_t py,Double_t pz) {fP[0]=px;fP[1]=py;fP[2]=pz;}
70         void           SetSign(Char_t value)                                              {fSign = value;}
71         void           SetSign(Int_t value)                                               {fSign = (Char_t)value;}
72         void           SetTruePDG(Short_t pdg)                                            {fTruePDG = pdg;}
73         void           SetVxVyVz(Double_t vx,Double_t vy,Double_t vz) {fV[0]=vx;fV[1]=vy;fV[2]=vz;}
74         
75         static AliRsnDaughter Sum(AliRsnDaughter t1, AliRsnDaughter t2);
76         
77 private:
78         
79         Char_t     fSign;                     // charge sign
80         UShort_t   fPDG;                      // assigned PDG code from PID (0=undefined)
81         UShort_t   fIndex;                    // reference index in AliESD container
82
83         Double_t   fP[3];                     // vector momentum
84         Double_t   fV[3];                     // production vertex
85         Double_t   fMass;                     // mass
86         
87         Double_t   fPIDwgt[AliPID::kSPECIES]; // particle PID weights
88         
89         // The following data are useful for simulated events only
90         // and can be left blank when using real or 'realistic' data
91         
92         Int_t      fLabel;        // GEANT label of corresponding particle
93         Short_t    fTruePDG;      // PDG code of corresponding particle
94         Int_t      fMother;       // GEANT label of mother particle
95         Short_t    fMotherPDG;    // PDG code of mother particle
96         
97         ClassDef(AliRsnDaughter,1)
98 };
99
100 #endif