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