]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTParticle.h
Add support for 64 bits
[u/mrichter/AliRoot.git] / HBTAN / AliHBTParticle.h
1 #ifndef ALIHBTPARTICLE
2 #define ALIHBTPARTICLE
3
4 //Ali HBT Particle: simplified class TParticle
5 //Simplified in order to minimize the size of object
6 //  - we want to keep a lot of such a objects in memory
7
8 #include <TObject.h>
9 #include <TLorentzVector.h>
10 #include <TMath.h>
11 #include <TDatabasePDG.h>
12
13 #include "AliConst.h"
14
15 class TParticle;
16
17 class AliHBTParticle : public TObject
18 {
19
20 public:
21                                 // ****** constructors and destructor
22   AliHBTParticle();
23   AliHBTParticle(const AliHBTParticle& in); 
24  
25   AliHBTParticle(Int_t pdg, Int_t idx, Double_t px, Double_t py, Double_t pz, Double_t etot,
26                  Double_t vx, Double_t vy, Double_t vz, Double_t time);
27
28   AliHBTParticle(Int_t pdg, Float_t prob, Int_t idx, Double_t px, Double_t py, Double_t pz, Double_t etot,
29                  Double_t vx, Double_t vy, Double_t vz, Double_t time);
30
31   AliHBTParticle(const TParticle& p,Int_t idx);
32
33   virtual ~AliHBTParticle();
34   
35   AliHBTParticle& operator=(const AliHBTParticle& in); 
36   
37   void           SetPIDprobability(Int_t pdg, Float_t prob = 1.0);
38   Float_t        GetPIDprobability(Int_t pdg);
39   
40   Int_t          GetPdgCode      () const { return (fPids)?fPids[fPdgIdx]:0;}
41   Int_t          GetPid          () const { return GetPdgCode();}
42   Float_t        GetPidProb      () const { return (fPidProb)?fPidProb[fPdgIdx]:0;}
43   
44   Int_t          GetUID          () const { return fIdxInEvent;}
45   Int_t          GetNumberOfPids () const { return fNPids;}
46   Int_t          GetNthPid         (Int_t idx) const;
47   Float_t        GetNthPidProb     (Int_t idx) const;
48       
49   void           SetPdgCode(Int_t pdg, Float_t prob = 1.0);
50   Double_t       GetCalcMass     () const { return fCalcMass; }
51   Double_t       GetMass         ()       { return (GetPDG())?GetPDG()->Mass():-1.;}
52
53   TParticlePDG*  GetPDG          (){return TDatabasePDG::Instance()->GetParticle(GetPdgCode());}
54
55   Int_t          Beauty          ()  { return GetPDG()->Beauty(); }
56   Int_t          Charm           ()  { return GetPDG()->Charm(); }
57   Int_t          Strangeness     ()  { return GetPDG()->Strangeness();}
58   void ProductionVertex(TLorentzVector &v) { v.SetXYZT(fVx,fVy,fVz,fVt);}
59
60
61   Double_t         Vx    () const { return fVx;}
62   Double_t         Vy    () const { return fVy;}
63   Double_t         Vz    () const { return fVz;}
64   Double_t         T     () const { return fVt;}
65
66   Double_t         Px    () const { return fPx; } //X coordinate of the momentum
67   Double_t         Py    () const { return fPy; } //Y coordinate of the momentum
68   Double_t         Pz    () const { return fPz; } //Z coordinate of the momentum
69   Double_t         P     () const                 //momentum
70     { return TMath::Sqrt(fPx*fPx+fPy*fPy+fPz*fPz); }
71   
72   void Momentum(TLorentzVector &v) { v.SetPxPyPzE(fPx,fPy,fPz,fE);}
73     
74   Double_t         Pt    () const  //transverse momentum
75     { return TMath::Sqrt(fPx*fPx+fPy*fPy); }
76   Double_t         Energy() const { return fE; }
77   
78                                    //Pseudo Rapidity
79   Double_t         Eta   () const { if (P() != fPz) return 0.5*TMath::Log((P()+fPz)/(P()-fPz)); 
80                                     else return 1.e30;}
81
82                                    //Rapidity
83   Double_t         Y     () const { if (fE  != fPz) return 0.5*TMath::Log((fE+fPz)/(fE-fPz));
84                                     else return 1.e30;}
85
86   Double_t         Phi   () const { return TMath::Pi()+TMath::ATan2(-fPy,-fPx); }
87
88   Double_t         Theta () const { return (fPz==0)?TMath::PiOver2():TMath::ACos(fPz/P()); }
89
90   // setters
91
92   void           SetMomentum(Double_t px, Double_t py, Double_t pz, Double_t e)
93                              {fPx=px; fPy=py; fPz=pz; fE=e;}
94   void           SetMomentum(const TLorentzVector& p)
95                              {SetMomentum(p.Px(),p.Py(),p.Pz(),p.Energy());}
96
97   void           SetProductionVertex(Double_t vx, Double_t vy, Double_t vz, Double_t t)
98                              {fVx=vx; fVy=vy; fVz=vz; fVt=t;}
99   void           SetProductionVertex(const TLorentzVector& v)
100                              {SetProductionVertex(v.X(),v.Y(),v.Z(),v.T());}
101   void           SetCalcMass(Double_t mass) {fCalcMass = mass;}
102   const Char_t*  GetName() const; 
103   void           Print() const;
104
105   static void    SetDebug(Int_t dbg=1){fgDebug=dbg;}
106   static Int_t   GetDebug(){return fgDebug;}
107   static Int_t   fgDebug; //debug printout level
108   
109 protected:
110   Int_t          GetPidSlot(Int_t pdg) const;//returns position of the given PID in fPids (and fPidProb) array.
111
112 private:
113   Char_t         fPdgIdx;               // index of PDG code of the particle in fPids
114   Int_t          fIdxInEvent;           // index of a particle: the same particle can appear in the event
115                                         //  many times with different pid's. Idx allows to check that they are the same particles
116   Int_t          fNPids;                // number of non-zero proboble Pids
117   Int_t         *fPids;                 // [fNPids] Array with PIDs
118   Float_t       *fPidProb;              // [fNPids] PIDs probabilities
119   Double_t       fCalcMass;             // Calculated mass
120
121   Double_t       fPx;                   // x component of momentum
122   Double_t       fPy;                   // y component of momentum
123   Double_t       fPz;                   // z component of momentum
124   Double_t       fE;                    // Energy
125
126   Double_t       fVx;                   // x of production vertex
127   Double_t       fVy;                   // y of production vertex
128   Double_t       fVz;                   // z of production vertex
129   Double_t       fVt;                   // t of production vertex
130
131   ClassDef(AliHBTParticle,2)  // TParticle vertex particle information
132 };
133
134 #endif