]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TTherminator/Therminator/Particle.cxx
Use TTimeStamp instead of TTime -- it is overflowing on 32-bit machines.
[u/mrichter/AliRoot.git] / TTherminator / Therminator / Particle.cxx
1 /******************************************************************************
2  *                      T H E R M I N A T O R                                 *
3  *                   THERMal heavy-IoN generATOR                              *
4  *                           version 1.0                                      *
5  *                                                                            *
6  * Authors of the model: Wojciech Broniowski, Wojciech.Broniowski@ifj.edu.pl, *
7  *                       Wojciech Florkowski, Wojciech.Florkowski@ifj.edu.pl  *
8  * Authors of the code:  Adam Kisiel, kisiel@if.pw.edu.pl                     *
9  *                       Tomasz Taluc, ttaluc@if.pw.edu.pl                    *
10  * Code designers: Adam Kisiel, Tomasz Taluc, Wojciech Broniowski,            *
11  *                 Wojciech Florkowski                                        *
12  *                                                                            *
13  * For the detailed description of the program and furhter references         * 
14  * to the description of the model plesase refer to: nucl-th/0504047,         *
15  * accessibile at: http://www.arxiv.org/nucl-th/0504047                       *
16  *                                                                            *
17  * Homepage: http://hirg.if.pw.edu.pl/en/therminator/                         *
18  *                                                                            *
19  * This code can be freely used and redistributed. However if you decide to   *
20  * make modifications to the code, please contact the authors, especially     *
21  * if you plan to publish the results obtained with such modified code.       *
22  * Any publication of results obtained using this code must include the       *
23  * reference to nucl-th/0504047 and the published version of it, when         *
24  * available.                                                                 *
25  *                                                                            *
26  *****************************************************************************/
27 #include "Particle.h"
28 #include "ParticleType.h"
29 #include <TMath.h>
30 #define FIELDWIDTH 15
31
32 Particle::Particle()
33 {
34 }
35
36 Particle::Particle(double aRapidity, double aPt, double aPhip, 
37                    double aAlfam, double aRho, double aPhis, double aTau,
38                    ParticleType *aType)
39 {
40   mPartType = aType;
41   mDecayed = 0;
42   mHasFather = -1;
43   
44   px = aPt*TMath::Cos(aPhip);
45   py = aPt*TMath::Sin(aPhip);
46   double tMt = TMath::Hypot(GetMass(),aPt);
47   pz = tMt*TMath::SinH(aRapidity);
48   
49   rx = aRho*TMath::Cos(aPhis);
50   ry = aRho*TMath::Sin(aPhis);
51
52 // New method of calculating rz, rt
53   rz = aTau*TMath::SinH(aAlfam);
54   rt = aTau*TMath::CosH(aAlfam);
55 }
56
57 Particle::Particle(ParticleType *aType, 
58                    double aPx, double aPy, double aPz, 
59                    double aRx, double aRy, double aRz,
60                    double aTime)
61 {
62   mPartType = aType;
63   mDecayed = 0;
64   mHasFather = -1;
65   
66   px = aPx;
67   py = aPy;
68   pz = aPz;
69
70   rx = aRx;
71   ry = aRy;
72   rz = aRz;
73   rt = aTime;
74 }
75
76
77 Particle::Particle(const Particle& aParticle)
78 {
79   mPartType = aParticle.GetParticleType();
80   mDecayed = 0;
81   mHasFather = aParticle.GetFather();
82   
83   px = aParticle.px;
84   py = aParticle.py;
85   pz = aParticle.pz;
86   
87   rx = aParticle.rx;
88   ry = aParticle.ry;
89   rz = aParticle.rz;
90   rt = aParticle.rt;
91 }
92
93 Particle::~Particle()
94 {
95   /* no-op */
96 }
97
98 void   
99 Particle::WriteParticle(ostream *aOuts)
100 {
101   aOuts->flags(ios::left | ios::scientific);
102   aOuts->width(10);
103   (*aOuts) << mPartType->GetPDGCode();
104   aOuts->width(FIELDWIDTH);
105   (*aOuts) << px;
106   aOuts->width(FIELDWIDTH);
107   (*aOuts) << py;
108   aOuts->width(FIELDWIDTH);
109   (*aOuts) << pz;
110   aOuts->width(FIELDWIDTH);
111   (*aOuts) << GetEnergy();
112   aOuts->width(FIELDWIDTH);
113   (*aOuts) << GetMass();
114   aOuts->width(FIELDWIDTH);
115   (*aOuts) << rx;
116   aOuts->width(FIELDWIDTH);
117   (*aOuts) << ry;
118   aOuts->width(FIELDWIDTH);
119   (*aOuts) << rz;
120   aOuts->width(FIELDWIDTH);
121   (*aOuts) << rt;
122 //  (*aOuts) << mPartType->GetCharge() << "   ";
123 //  if (mHasFather>-1) (*aOuts) << mHasFather << "   ";
124   aOuts->width(6);
125   (*aOuts) << (mHasFather);
126   aOuts->width(2);
127   (*aOuts) << (mDecayed);
128 }
129
130
131 double 
132 Particle::Pt()
133 {
134   return TMath::Hypot(px, py);
135 }
136
137 double 
138 Particle::Rapidity()
139 {
140   double tE = TMath::Sqrt(px*px+py*py+pz*pz+GetMass()*GetMass());
141   return 0.5*TMath::Log((tE-pz)/(tE+pz));
142 }
143
144 ParticleType* 
145 Particle::GetParticleType() const
146 {
147   return mPartType;
148 }
149
150 int 
151 Particle::HadDecayed()
152 {
153   return mDecayed;
154 }
155
156 double 
157 Particle::GetMass()
158 {
159   return mPartType->GetMass();
160 }
161
162 double        
163 Particle::GetEnergy()
164 {
165   return TMath::Sqrt(GetMass()*GetMass()+px*px+py*py+pz*pz);
166 }
167
168
169 double 
170 Particle::GetI3()
171 {
172   return mPartType->GetI3();
173 }
174
175 double        
176 Particle::GetBarionN()
177 {
178   return mPartType->GetBarionN();
179 }
180
181 double        
182 Particle::GetStrangeness()
183 {
184   return mPartType->GetStrangeness();
185 }
186
187 void
188 Particle::SetDecayed()
189 {
190   mDecayed = 1;
191 }
192
193 void          
194 Particle::SetFather(int aFather)
195 {
196   mHasFather = aFather;
197 }
198
199 int           
200 Particle::GetFather() const
201 {
202   return mHasFather;
203 }
204