-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathYSCollision.cpp
252 lines (203 loc) · 8.02 KB
/
YSCollision.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
//
// YSCollision.cpp
// Collision class for A+A
//
// Created by Yves Schutz on 09/12/13.
// Copyright (c) 2013 Yves Schutz. All rights reserved.
//
#include <QDebug>
#include <QtMath>
#include "YSCollision.h"
#include "YSCrossSectionpp.h"
#include "YSNucleus.h"
//______________________________________________________________________________
YSCollision::YSCollision() : mb(0.0), mbMax(0.0), mbMin(0.0), mNcoll(0), mNpart(0), mTAA(0.0)
{
mNucleus[0] = new YSNucleus();
mNucleus[1] = new YSNucleus();
mEnergy[0] = 0.0;
mEnergy[1] = 0.0;
MakeCollision();
}
//______________________________________________________________________________
YSCollision::~YSCollision()
{
delete mNucleus[0];
delete Nucleus(1);
}
//______________________________________________________________________________
qreal YSCollision::Beta(int id) const
{
// calculates velocity of beam: beta = p/E
qreal m = 0.0, p = 0.0, e = 0.0 ;
qreal rv = -1.0 ;
if (id == 1) {
m = Nucleus(1)->Mass(YSIsotope::U_TEV) ; // in TeV
p = BeamEnergy(1) * Nucleus(1)->A() ;
}
else if (id == 2) {
m = Nucleus(2)->Mass(YSIsotope::U_TEV) ; // in TeV
p = BeamEnergy(2) * Nucleus(2)->A() ;
}
e = qSqrt(p * p + m * m) ;
if (e != 0 )
rv = p / e ;
return rv ;
}
//______________________________________________________________________________
qreal YSCollision::CMEnergy() const
{
// calculate center of mass energy of the collision Ecm = (m1^2+m2^2 + 2E1E2(1-beta1*beta2*cos(theta)))^1/2; theta = 180°
qreal m1 = Nucleus(1)->Mass(YSIsotope::U_TEV) ;
qreal m2 = Nucleus(2)->Mass(YSIsotope::U_TEV) ;
qreal p1 = BeamEnergy(1) * Nucleus(1)->A() ;
qreal p2 = BeamEnergy(2) * Nucleus(2)->A() ;
qreal e1 = qSqrt(m1 * m1 + p1 * p1) ;
qreal e2 = qSqrt(m2 * m2 + p2 * p2) ;
qreal ecm = qSqrt( m1 * m1 + m2 * m2 + 2 * e1 * e2 * (1 + Beta(1) * Beta(2)) ) ;
return ecm ;
}
//______________________________________________________________________________
qreal YSCollision::CMEnergyNN() const
{
// calculates the nuclean-nucleon center of mass energy Ecm = (m1^2+m2^2 + 2E1E2(1-beta1*beta2*cos(theta)))^1/2; theta = 180°
qreal m1 = Nucleus(1)->Mass(YSIsotope::U_TEV) / Nucleus(1)->A() ;
qreal m2 = Nucleus(2)->Mass(YSIsotope::U_TEV) / Nucleus(2)->A() ;
qreal e1 = qSqrt(m1 * m1 + BeamEnergy(1) * BeamEnergy(1)) ;
qreal e2 = qSqrt(m2 * m2 + BeamEnergy(2) * BeamEnergy(2)) ;
qreal ecm = qSqrt( m1 * m1 + m2 * m2 + 2 * e1 * e2 * (1 + Beta(1) * Beta(2)) ) ;
return ecm ;
}
qreal YSCollision::CrossSectionGeo() const
{
// Geometric cross section
return 1E-2 * M_PI * qPow(Nucleus(1)->Radius() + Nucleus(2)->Radius(), 2);
}
//______________________________________________________________________________
//qreal YSCollision::CrossSectionpp(qreal ecm, const QString type) const
//{
// // calculates the pp cross section from systematics data in mb
// // energy (√s) in GeV
// qreal rv = 0.0 ;
// qreal ecm2 = ecm * ecm;
// if (type.compare("total") == 0) {
// //[0]+[1]*pow(x*x,[2])+[3]*pow(log(x*x/[4]),2.)+[5]*pow(x*x,[6]) ;
// qreal par[7] = {3.55E1, 4.259E1, -4.6E-1, 3.076E-1, 2.92E1, -3.336E1, -5.454E-1} ;
// rv = par[0]+par[1]*qPow(ecm2,par[2])+par[3]*qPow(qLn(ecm2/par[4]),2.)+par[5]*qPow(ecm2,par[6]);
// }
// else if (type.compare("elastic") == 0) {
// //[0]+[1]*pow(x*x,[2])+[3]*pow(log(x*x/[4]),2.)
// qreal par[5] = {5.166342, 1.287805E1, -4.059868E-1, 9.028824E-2, 2.92E1} ;
// rv = par[0]+par[1]*qPow(ecm2,par[2])+par[3]*qPow(qLn(ecm2/par[4]),2.);
// }
// else if (type.compare("inelastic") == 0) {
// //[0]+[1]*pow(x*x,[2])+[3]*pow(log(x*x/[4]),2.)+[5]*pow(x*x,[6]))-([7]+[8]*pow(x*x,[9])+[10]*pow(log(x*x/[11]),2.)+[12]*pow(x*x,[13]))
// qreal par[14] = {35.5, 42.59, -0.46, 0.3076, 29.2, -33.36, -0.5454, 5.166342, 12.87805, -0.4059868, 0.09028824, 29.2, 0.0, 0.0};
// rv = (par[0]+par[1]*qPow(ecm2,par[2])+par[3]*qPow(qLn(ecm2/par[4]),2.)+par[5]*qPow(ecm2,par[6]))-
// (par[7]+par[8]*qPow(ecm2,par[9])+par[10]*qPow(qLn(ecm2/par[11]),2.)+par[12]*qPow(ecm2,par[13]));
// } else {
// qCritical() << QString("%1::GetppCrossSection: option error, choose among total, elastic, inelastic").arg(objectName());
// }
// return rv ; // mbarn
//}
//______________________________________________________________________________
qreal YSCollision::Gamma(int id) const
{
// Lorentz gamma factor : γ = 1/√(1-β**2); L = L0/γ
return (1 / qSqrt(1-Beta(id)*Beta(id))) ;
}
//______________________________________________________________________________
void YSCollision::MakeCollision()
{
// Nuclei collide, mark wounded nucleons
YSCrossSectionpp cspp;
cspp.SetType(YSCrossSectionpp::kInelastic);
qreal cs = cspp.Eval(CMEnergyNNGeV());
// Two nucleons from different nuclei collide if the relative transverse distance between
// centers is less than the distance corresponding to the inelatic nucleon-nucleon
// cross section dtXY << 1/√(cspp/π)
qreal dtMin = 1E13 * qSqrt(cs * 1E-27 / M_PI); // cs in cm2; dtMin in fm
qreal ximpact = 0.; // 0.0 + (qreal)(qrand()) / (qreal)RAND_MAX * (Getb()/2 - 0.0);
qreal yimpact = qSqrt(Getb()/2*Getb()/2 - ximpact*ximpact);
mNcoll = 0; // number of binary nucleon-nucleon collisions
for (int nucleon1 = 0; nucleon1 < Nucleus(1)->A(); nucleon1++)
Nucleus(1)->SetWounded(nucleon1, false);
for (int nucleon2 = 0; nucleon2 < Nucleus(2)->A(); nucleon2++)
Nucleus(2)->SetWounded(nucleon2, false);
for (int nucleon1 = 0; nucleon1 < Nucleus(1)->A(); nucleon1++) {
QVector3D vec1 = (Nucleus(1)->GetNucleons())[nucleon1];
for (int nucleon2 = 0; nucleon2 < Nucleus(2)->A(); nucleon2++) {
QVector3D vec2 = (Nucleus(2)->GetNucleons())[nucleon2];
double dtX = (vec1.x() - ximpact) - (vec2.x() + ximpact);
double dtY = (vec1.y() - yimpact) - (vec2.y() + yimpact);
double dtXY = qSqrt(dtX * dtX + dtY * dtY);
if (dtXY < dtMin) {
mNcoll++;
Nucleus(1)->SetWounded(nucleon1, true);
Nucleus(2)->SetWounded(nucleon2, true);
}
}
}
mTAA = mNcoll / cs;
mNpart = 0;
for (int nucleon1 = 0; nucleon1 < Nucleus(1)->A(); nucleon1++) {
if(Nucleus(1)->IsWounded(nucleon1))
mNpart++;
}
for (int nucleon2 = 0; nucleon2 < Nucleus(2)->A(); nucleon2++) {
if(Nucleus(2)->IsWounded(nucleon2))
mNpart++;
}
}
//______________________________________________________________________________
void YSCollision::Print() const
{
// print some information on the collising system
qDebug() << Nucleus(1)->A() << " + " << Nucleus(2)->A();
}
//______________________________________________________________________________
void YSCollision::SetbMM()
{
// set the values of b, bmax and bmin
mbMax = (Nucleus(1)->Radius() + Nucleus(1)->Skin() +
Nucleus(2)->Radius() + Nucleus(2)->Skin()) * 1.10;
mbMin = 0.0;
}
//______________________________________________________________________________
void YSCollision::SetNucleus(YSIsotope *iso)
{
// set one of the two nuclei of the colliding system
static int count = 0;
if(count > 1)
count = 0;
delete mNucleus[count];
mNucleus[count] = new YSNucleus(*iso);
count++;
if (count > 1)
SetbMM();
}
//______________________________________________________________________________
qreal YSCollision::YBeam(int index) const
{
//Calculates beta max of beam
YSNucleus * nuc = NULL;
qreal energy = 0.0;
if (index == 1) {
nuc = Nucleus(1);
energy = BeamEnergy(1);
}
else if (index == 2) {
nuc = Nucleus(2);
energy = BeamEnergy(2);
}
else
return 0.0 ;
qreal m = nuc->Mass(YSIsotope::U_TEV) ;
qreal p = energy * nuc->A() ;
qreal e = qSqrt(m * m + p * p) ;
qreal yBeam = 0.5 * log( (e-p) / (e+p) ) ;
if (mNucleus[0] == mNucleus[1])
return qAbs(yBeam) ;
else
return yBeam ;
}