Update master to aliroot
[u/mrichter/AliRoot.git] / TTherminator / Therminator / Particle.cxx
CommitLineData
2e967919 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
32Particle::Particle()
33{
f12dabf0 34 mPartType = 0;
2f2cf807 35 px = 0; py = 0; pz = 0;
36 rx = 0; ry = 0; rz = 0; rt = 0;
37 mDecayed = 0;
38 mHasFather = -1;
2e967919 39}
40
41Particle::Particle(double aRapidity, double aPt, double aPhip,
42 double aAlfam, double aRho, double aPhis, double aTau,
43 ParticleType *aType)
44{
45 mPartType = aType;
46 mDecayed = 0;
47 mHasFather = -1;
48
49 px = aPt*TMath::Cos(aPhip);
50 py = aPt*TMath::Sin(aPhip);
51 double tMt = TMath::Hypot(GetMass(),aPt);
52 pz = tMt*TMath::SinH(aRapidity);
53
54 rx = aRho*TMath::Cos(aPhis);
55 ry = aRho*TMath::Sin(aPhis);
56
57// New method of calculating rz, rt
58 rz = aTau*TMath::SinH(aAlfam);
59 rt = aTau*TMath::CosH(aAlfam);
60}
61
62Particle::Particle(ParticleType *aType,
63 double aPx, double aPy, double aPz,
64 double aRx, double aRy, double aRz,
65 double aTime)
66{
67 mPartType = aType;
68 mDecayed = 0;
69 mHasFather = -1;
70
71 px = aPx;
72 py = aPy;
73 pz = aPz;
74
75 rx = aRx;
76 ry = aRy;
77 rz = aRz;
78 rt = aTime;
79}
80
81
82Particle::Particle(const Particle& aParticle)
83{
84 mPartType = aParticle.GetParticleType();
85 mDecayed = 0;
86 mHasFather = aParticle.GetFather();
87
88 px = aParticle.px;
89 py = aParticle.py;
90 pz = aParticle.pz;
91
92 rx = aParticle.rx;
93 ry = aParticle.ry;
94 rz = aParticle.rz;
95 rt = aParticle.rt;
96}
97
98Particle::~Particle()
99{
100 /* no-op */
101}
102
103void
104Particle::WriteParticle(ostream *aOuts)
105{
106 aOuts->flags(ios::left | ios::scientific);
107 aOuts->width(10);
108 (*aOuts) << mPartType->GetPDGCode();
109 aOuts->width(FIELDWIDTH);
110 (*aOuts) << px;
111 aOuts->width(FIELDWIDTH);
112 (*aOuts) << py;
113 aOuts->width(FIELDWIDTH);
114 (*aOuts) << pz;
115 aOuts->width(FIELDWIDTH);
116 (*aOuts) << GetEnergy();
117 aOuts->width(FIELDWIDTH);
118 (*aOuts) << GetMass();
119 aOuts->width(FIELDWIDTH);
120 (*aOuts) << rx;
121 aOuts->width(FIELDWIDTH);
122 (*aOuts) << ry;
123 aOuts->width(FIELDWIDTH);
124 (*aOuts) << rz;
125 aOuts->width(FIELDWIDTH);
126 (*aOuts) << rt;
127// (*aOuts) << mPartType->GetCharge() << " ";
128// if (mHasFather>-1) (*aOuts) << mHasFather << " ";
129 aOuts->width(6);
130 (*aOuts) << (mHasFather);
131 aOuts->width(2);
132 (*aOuts) << (mDecayed);
133}
134
135
136double
137Particle::Pt()
138{
139 return TMath::Hypot(px, py);
140}
141
142double
143Particle::Rapidity()
144{
145 double tE = TMath::Sqrt(px*px+py*py+pz*pz+GetMass()*GetMass());
146 return 0.5*TMath::Log((tE-pz)/(tE+pz));
147}
148
149ParticleType*
150Particle::GetParticleType() const
151{
152 return mPartType;
153}
154
155int
156Particle::HadDecayed()
157{
158 return mDecayed;
159}
160
161double
162Particle::GetMass()
163{
164 return mPartType->GetMass();
165}
166
167double
168Particle::GetEnergy()
169{
170 return TMath::Sqrt(GetMass()*GetMass()+px*px+py*py+pz*pz);
171}
172
173
174double
175Particle::GetI3()
176{
177 return mPartType->GetI3();
178}
179
180double
181Particle::GetBarionN()
182{
183 return mPartType->GetBarionN();
184}
185
186double
187Particle::GetStrangeness()
188{
189 return mPartType->GetStrangeness();
190}
191
192void
193Particle::SetDecayed()
194{
195 mDecayed = 1;
196}
197
198void
199Particle::SetFather(int aFather)
200{
201 mHasFather = aFather;
202}
203
204int
205Particle::GetFather() const
206{
207 return mHasFather;
208}
209