Improved Print() function
[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           Print(Option_t *option = "") const;
61         void           SetIndex(UShort_t value) {fIndex = value;}
62         void           SetIndex(Int_t value) {fIndex = (UShort_t)value;}
63         void           SetLabel(Int_t l) {fLabel = l;}
64         void           SetMass(Double_t m) {fMass = m;}
65         void           SetMother(Int_t l) {fMother = l;}
66         void           SetMotherPDG(Short_t pdg) {fMotherPDG = pdg;}
67         void           SetPDG(UShort_t pdg) {fPDG = TMath::Abs(pdg);}
68         void           SetPDG(Int_t pdg) {fPDG = (UShort_t)TMath::Abs(pdg);}
69         void           SetPIDweights(const Double_t *pid) {Int_t i;for(i=0;i<AliPID::kSPECIES;i++)fPIDwgt[i]=pid[i];}
70         void           SetPxPyPz(Double_t px,Double_t py,Double_t pz) {fP[0]=px;fP[1]=py;fP[2]=pz;}
71         void           SetSign(Char_t value) {fSign = value;}
72         void           SetSign(Int_t value) {fSign = (Char_t)value;}
73         void           SetTruePDG(Short_t pdg) {fTruePDG = pdg;}
74         void           SetVxVyVz(Double_t vx,Double_t vy,Double_t vz) {fV[0]=vx;fV[1]=vy;fV[2]=vz;}
75         
76         static AliRsnDaughter Sum(AliRsnDaughter t1, AliRsnDaughter t2);
77         
78 private:
79         
80         Char_t     fSign;                     // charge sign
81         UShort_t   fPDG;                      // assigned PDG code from PID (0=undefined)
82         UShort_t   fIndex;                    // reference index in AliESD container
83
84         Double_t   fP[3];                     // vector momentum
85         Double_t   fV[3];                     // production vertex
86         Double_t   fMass;                     // mass
87         
88         Double_t   fPIDwgt[AliPID::kSPECIES]; // particle PID weights
89         
90         // The following data are useful for simulated events only
91         // and can be left blank when using real or 'realistic' data
92         
93         Int_t      fLabel;        // GEANT label of corresponding particle
94         Short_t    fTruePDG;      // PDG code of corresponding particle
95         Int_t      fMother;       // GEANT label of mother particle
96         Short_t    fMotherPDG;    // PDG code of mother particle
97         
98         ClassDef(AliRsnDaughter,1)
99 };
100
101 #endif