]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/GParticle.h
Small change to avoid compiler warnings.
[u/mrichter/AliRoot.git] / STEER / GParticle.h
1 #ifndef ROOT_GParticle
2 #define ROOT_GParticle
3  
4 #include "TObject.h"
5 #include "TMath.h"
6  
7 #define Keep_Bit     1
8 #define Children_Bit 2
9 #define Done_Bit     4
10
11 class GParticle : public TObject {
12  
13 private:
14   
15   Int_t    fKS;            // status of particle       ( LUJETS K[1] )
16   Int_t    fKF;            // Geant3 particle type
17   Int_t    fParent;        // parent id 
18   Int_t    fFirstChild;    // id of first child 
19   Int_t    fLastChild;     // id of last  child 
20   
21   Float_t  fPx;            // X momentum [GeV/c]
22   Float_t  fPy;            // Y momentum [GeV/c]
23   Float_t  fPz;            // Z momentum [GeV/c]
24   Float_t  fEnergy;        // Energy    [GeV]
25   Float_t  fMass;          // Mass      [Gev/c^2]
26   
27   Float_t  fVx;            // X vertex  [cm]
28   Float_t  fVy;            // Y vertex  [cm]
29   Float_t  fVz;            // Z vertex  [cm]
30   
31   Float_t  fPolx;          // X component of polarisation 
32   Float_t  fPoly;          // Y component of polarisation 
33   Float_t  fPolz;          // Z component of polarisation 
34   
35   Float_t  fTime;          // time of procuction
36   Float_t  fLifeTime;      // proper lifetime
37   Float_t  fProcessTime;   // Cpu Time to process this track
38   
39   char     fOrigin[11];    // generation mechanism
40   Float_t  fWgt;
41   Float_t  fPT;
42   Float_t  fTheta;
43   Float_t  fPhi;
44   Float_t  fEta;
45   
46 public:
47   GParticle() { }
48   
49   GParticle(const GParticle &p);
50   
51   GParticle(const Int_t kS, const Int_t kF, 
52             const Int_t parent, const Int_t firstchild, const Int_t lastchild, 
53             const Float_t px, const Float_t py, const Float_t pz,
54             const Float_t energy, const Float_t mass,
55             const Float_t vx, const Float_t vy, const Float_t vz, 
56             const Float_t polx, const Float_t poly, const Float_t polz,
57             const Float_t time, const Float_t lifetime, 
58             const char *Origin="Unknown",Float_t wgt=1.) :
59     
60     fKS(kS),
61     fKF(kF),
62     fParent(parent),
63     fFirstChild(firstchild),
64     fLastChild(lastchild),
65     fPx(px),
66     fPy(py),
67     fPz(pz),
68     fEnergy(energy),
69     fMass(mass),
70     fVx(vx),
71     fVy(vy),
72     fVz(vz),
73     fPolx(polx),
74     fPoly(poly),
75     fPolz(polz),
76     fTime(time),
77     fLifeTime(lifetime),
78       fProcessTime(-0.1),
79       fWgt(wgt)
80     {Int_t p=0; 
81     while((fOrigin[p]=Origin[p]) && p++<10);fOrigin[10]=0;
82     fPT    =TMath::Sqrt(fPx*fPx+fPy*fPy);
83     fTheta =Float_t(TMath::ATan2(Double_t(fPT),Double_t(fPz)));
84     fPhi   =Float_t(TMath::ATan2(Double_t(fPy),Double_t(fPx)))+TMath::Pi();
85     fEta   =-TMath::Log(TMath::Tan(fTheta/2));
86     }
87   
88   virtual             ~GParticle() { }
89   
90   inline Int_t       GetKS() const {return fKS;}
91   inline Int_t       GetKF() const {return fKF;}
92   inline Int_t       GetParent() const {return fParent;}
93   inline Int_t       GetFirstChild() const {return fFirstChild;}
94   inline Int_t       GetLastChild() const {return fLastChild;}
95   
96   inline Float_t     GetPx() const {return fPx;}
97   inline Float_t     GetPy() const {return fPy;}
98   inline Float_t     GetPz() const {return fPz;}
99   
100   inline Float_t     GetPolx() const {return fPolx;}
101   inline Float_t     GetPoly() const {return fPoly;}
102   inline Float_t     GetPolz() const {return fPolz;}
103   
104   inline Float_t     GetEnergy() const {return fEnergy;}
105   inline Float_t     GetMass() const {return fMass;}
106   inline Float_t     GetMomentum() const {return TMath::Sqrt(fPx*fPx+fPy*fPy+fPz*fPz);}
107   inline void        GetOrigin(char *Origin) {strcpy(Origin,fOrigin);}
108   inline Float_t     GetPT()  const {return  fPT;}
109   inline Float_t     GetTheta()  const {return  fTheta;}
110   inline Float_t     GetEta() const {return fEta;}
111   inline Float_t     GetPhi() const {return fPhi;}
112   
113   inline Float_t     GetVx() const {return fVx;}
114   inline Float_t     GetVy() const {return fVy;}
115   inline Float_t     GetVz() const {return fVz;}
116   inline Float_t     GetTime() const {return fTime;}
117   inline Float_t     GetLifeTime() const {return fLifeTime;}
118   inline Float_t     GetWgt() const {return fWgt;}
119   inline void        SetWgt(Float_t wgt) {fWgt=wgt;}  
120   inline Float_t     GetProcessTime() const {return fProcessTime;}
121   virtual const Text_t     *GetName()  const;
122   virtual const Text_t     *GetTitle() const;
123   
124   inline void        SetKS(Int_t KS) {fKS=KS;}
125   inline void        SetFirstChild(const Int_t firstchild) {fFirstChild=firstchild;}
126   inline void        SetLastChild(const Int_t lastchild) {fLastChild=lastchild;}
127   inline void        SetParent(const Int_t parent) {fParent=parent;}
128   inline void        SetProcessTime(Float_t cputime) {fProcessTime=cputime;}
129   
130   GParticle           &operator=(const GParticle &p);
131   
132   ClassDef(GParticle,1)  // MonteCarlo Particle Class
133 };
134  
135 inline GParticle &GParticle::operator = (const GParticle &p)
136 {
137   fKS                   = p.fKS;
138   fKF                   = p.fKF;
139   fParent               = p.fParent;
140   fFirstChild           = p.fFirstChild;
141   fLastChild            = p.fLastChild;
142   fPx                   = p.fPx;
143   fPy                   = p.fPy;
144   fPz                   = p.fPz;
145   fEnergy               = p.fEnergy;
146   fMass                 = p.fMass;
147   fVx                   = p.fVx;
148   fVy                   = p.fVy;
149   fVz                   = p.fVz;
150   fPolx                 = p.fPolx;
151   fPoly                 = p.fPoly;
152   fPolz                 = p.fPolz;
153   fTime                 = p.fTime;
154   fLifeTime             = p.fLifeTime;
155   fProcessTime          = p.fProcessTime;
156   fWgt                  = p.fWgt;
157   fPT                   = p.fPT;
158   fTheta                = p.fTheta;
159   fPhi                  = p.fPhi;
160   fEta                  = p.fEta;
161   strcpy(fOrigin,p.fOrigin);
162   return *this;
163 }
164
165
166 inline GParticle::GParticle(const GParticle &p) { *this = p; }
167
168 #endif
169
170