294b05f9311f07d0be168b4a5cb321cfe4975373
[u/mrichter/AliRoot.git] / HBTAN / AliHBTParticle.cxx
1 //Simplified TParticle class
2
3
4 #include "AliHBTParticle.h"
5
6 #include <TParticle.h>
7
8 ClassImp(AliHBTParticle)
9
10 //______________________________________________________________________________
11 AliHBTParticle::AliHBTParticle():  
12                 fPdgCode(0), fPx(0), fPy(0),fPz(0),fE(0), fVx(0), fVy(0),fVz(0),fVt(0)
13 {//empty particle
14 }
15
16
17 //______________________________________________________________________________
18 AliHBTParticle::AliHBTParticle(Int_t pdg, Double_t px, Double_t py, Double_t pz, Double_t etot,
19                      Double_t vx, Double_t vy, Double_t vz, Double_t time):
20   fPdgCode(pdg), fPx(px), fPy(py),fPz(pz),fE(etot), 
21                  fVx(vx), fVy(vy),fVz(vz),fVt(time)
22 {
23 //mormal constructor
24   
25   if (GetPDG()) {
26      fCalcMass    = GetPDG()->Mass();
27   } else {
28      Double_t a2 = fE*fE -fPx*fPx -fPy*fPy -fPz*fPz;
29      if (a2 >= 0) fCalcMass =  TMath::Sqrt(a2);
30      else         fCalcMass = -TMath::Sqrt(-a2);
31   }
32 }
33
34 //______________________________________________________________________________
35 AliHBTParticle::AliHBTParticle(const TParticle &p):
36    fPdgCode(p.GetPdgCode()),fCalcMass(p.GetCalcMass()),
37    fPx(p.Px()),fPy(p.Py()),fPz(p.Pz()),fE(p.Energy()), 
38    fVx(p.Vx()),fVy(p.Vy()),fVz(p.Vz()),fVt(p.T())
39 {
40  //all copied in the initialization
41  
42 }
43
44 //______________________________________________________________________________
45 const Char_t* AliHBTParticle::GetName() const 
46 {
47    static char def[4] = "XXX";
48    const TParticlePDG *ap = TDatabasePDG::Instance()->GetParticle(fPdgCode);
49    if (ap) return ap->GetName();
50    else    return def;
51 }
52
53
54 //______________________________________________________________________________
55
56