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