IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
corsika
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pranav Sampathkumar
corsika
Commits
aa573737
Commit
aa573737
authored
6 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
changed implementation to PYTHIA-like
parent
b1a1ac53
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/Units/PhysicalConstants.h
+3
-0
3 additions, 0 deletions
Framework/Units/PhysicalConstants.h
Processes/HadronicElasticModel/HadronicElasticModel.h
+33
-37
33 additions, 37 deletions
Processes/HadronicElasticModel/HadronicElasticModel.h
with
36 additions
and
37 deletions
Framework/Units/PhysicalConstants.h
+
3
−
0
View file @
aa573737
...
@@ -53,9 +53,12 @@ namespace corsika::units::constants {
...
@@ -53,9 +53,12 @@ namespace corsika::units::constants {
constexpr
quantity
<
speed_d
>
c
{
Rep
(
299792458L
)
*
meter
/
second
};
constexpr
quantity
<
speed_d
>
c
{
Rep
(
299792458L
)
*
meter
/
second
};
constexpr
auto
cSquared
=
c
*
c
;
constexpr
auto
cSquared
=
c
*
c
;
// hbar * c
constexpr
quantity
<
dimensions
<
1
,
0
,
0
,
0
,
0
,
0
,
0
,
1
>>
hBarC
{
constexpr
quantity
<
dimensions
<
1
,
0
,
0
,
0
,
0
,
0
,
0
,
1
>>
hBarC
{
Rep
(
1.973'269'78e-7L
)
*
electronvolt
*
meter
};
// from RPP 2018
Rep
(
1.973'269'78e-7L
)
*
electronvolt
*
meter
};
// from RPP 2018
auto
constexpr
invGeVsq
=
1e-18
/
(
electronvolt
*
electronvolt
);
// unified atomic mass unit
// unified atomic mass unit
constexpr
quantity
<
mass_d
>
u
{
Rep
(
1.6605402e-27L
)
*
kilogram
};
constexpr
quantity
<
mass_d
>
u
{
Rep
(
1.6605402e-27L
)
*
kilogram
};
...
...
This diff is collapsed.
Click to expand it.
Processes/HadronicElasticModel/HadronicElasticModel.h
+
33
−
37
View file @
aa573737
...
@@ -36,8 +36,10 @@ namespace corsika::process::HadronicElasticModel {
...
@@ -36,8 +36,10 @@ namespace corsika::process::HadronicElasticModel {
:
public
corsika
::
process
::
InteractionProcess
<
HadronicElasticInteraction
>
{
:
public
corsika
::
process
::
InteractionProcess
<
HadronicElasticInteraction
>
{
private:
private:
corsika
::
units
::
si
::
CrossSectionType
const
fX
,
fY
;
corsika
::
units
::
si
::
CrossSectionType
const
fX
,
fY
;
static
double
constexpr
fEpsilon
=
0.0808
;
static
double
constexpr
fEta
=
0.4525
;
static
double
constexpr
gfEpsilon
=
0.0808
;
static
double
constexpr
gfEta
=
0.4525
;
// Froissart-Martin is not violated up for sqrt s < 10^32 eV with these values [DL].
using
SquaredHEPEnergyType
=
decltype
(
corsika
::
units
::
si
::
HEPEnergyType
()
*
using
SquaredHEPEnergyType
=
decltype
(
corsika
::
units
::
si
::
HEPEnergyType
()
*
corsika
::
units
::
si
::
HEPEnergyType
());
corsika
::
units
::
si
::
HEPEnergyType
());
...
@@ -47,33 +49,32 @@ namespace corsika::process::HadronicElasticModel {
...
@@ -47,33 +49,32 @@ namespace corsika::process::HadronicElasticModel {
"HadronicElasticModel"
);
"HadronicElasticModel"
);
corsika
::
environment
::
Environment
const
&
fEnvironment
;
corsika
::
environment
::
Environment
const
&
fEnvironment
;
auto
B
(
corsika
::
units
::
si
::
HEPEnergyType
sqrtS
)
const
{
auto
B
(
decltype
(
units
::
si
::
detail
::
static_pow
<
2
>
(
units
::
si
::
electronvolt
))
s
)
const
{
using
namespace
corsika
::
units
::
si
;
using
namespace
corsika
::
units
::
constants
;
auto
constexpr
a
=
auto
constexpr
b_p
=
2.3
;
2.5
/
(
1
_GeV
*
1
_GeV
);
// read off by eye from Gaisser, Engel, Resconi, fig. 4.9
return
(
2
*
b_p
+
2
*
b_p
+
4
*
pow
(
s
*
invGeVsq
,
gfEpsilon
)
-
4.2
)
*
invGeVsq
;
auto
constexpr
b
=
10
/
(
1
_GeV
*
1
_GeV
);
return
a
*
std
::
log10
(
sqrtS
/
10
_GeV
)
+
b
;
}
}
corsika
::
units
::
si
::
CrossSectionType
CrossSection
(
SquaredHEPEnergyType
s
)
const
{
corsika
::
units
::
si
::
CrossSectionType
CrossSection
(
SquaredHEPEnergyType
s
)
const
{
using
namespace
corsika
::
units
::
si
;
using
namespace
corsika
::
units
::
si
;
// according to Gaisser, Engel, Resconi, eq. (4.41)
using
namespace
corsika
::
units
::
constants
;
// assuming every target behaves like a proton
// assuming every target behaves like a proton
, fX and fY are universal
CrossSectionType
const
sigmaTot
=
fX
*
pow
(
s
*
(
1
/
(
1
_GeV
*
1
_GeV
)),
fEpsilon
)
+
CrossSectionType
const
sigmaTot
=
fY
*
pow
(
s
*
(
1
/
(
1
_GeV
*
1
_GeV
))
,
-
fEta
);
fX
*
pow
(
s
*
invGeVsq
,
gfEpsilon
)
+
fY
*
pow
(
s
*
invGeVsq
,
-
g
fEta
);
// we ignore rho because rho^2 is just ~2 %
// according to Schuler & Sjöstrand, PRD 49, 2257 (1994)
// (we ignore rho because rho^2 is just ~2 %)
auto
const
sigmaElastic
=
auto
const
sigmaElastic
=
sigmaTot
*
sigmaTot
/
units
::
si
::
detail
::
static_pow
<
2
>
(
sigmaTot
)
/
(
16
*
M_PI
*
ConvertHEPToSI
<
CrossSectionType
::
dimension_type
>
(
B
(
s
qrt
(
s
)
)));
(
16
*
M_PI
*
ConvertHEPToSI
<
CrossSectionType
::
dimension_type
>
(
B
(
s
)));
return
sigmaElastic
;
return
sigmaElastic
;
}
}
public
:
public
:
HadronicElasticInteraction
(
corsika
::
environment
::
Environment
const
&
,
HadronicElasticInteraction
(
corsika
::
environment
::
Environment
const
&
,
units
::
si
::
CrossSectionType
x
=
2.17e-5
*
units
::
si
::
barn
,
// x & y values taken from Pythia8 for pp collisions
units
::
si
::
CrossSectionType
y
=
5.608e-5
*
units
::
si
::
CrossSectionType
x
=
0.217
*
units
::
si
::
barn
,
units
::
si
::
barn
);
units
::
si
::
CrossSectionType
y
=
0.5608
*
units
::
si
::
barn
);
void
Init
();
void
Init
();
template
<
typename
Particle
,
typename
Track
>
template
<
typename
Particle
,
typename
Track
>
...
@@ -126,6 +127,7 @@ namespace corsika::process::HadronicElasticModel {
...
@@ -126,6 +127,7 @@ namespace corsika::process::HadronicElasticModel {
}
}
using
namespace
units
::
si
;
using
namespace
units
::
si
;
using
namespace
units
::
constants
;
const
auto
*
currentNode
=
const
auto
*
currentNode
=
fEnvironment
.
GetUniverse
()
->
GetContainingNode
(
p
.
GetPosition
());
fEnvironment
.
GetUniverse
()
->
GetContainingNode
(
p
.
GetPosition
());
...
@@ -166,8 +168,8 @@ namespace corsika::process::HadronicElasticModel {
...
@@ -166,8 +168,8 @@ namespace corsika::process::HadronicElasticModel {
auto
const
sqrtS
=
eProjectileCoM
+
eTargetCoM
;
auto
const
sqrtS
=
eProjectileCoM
+
eTargetCoM
;
auto
const
s
=
units
::
si
::
detail
::
static_pow
<
2
>
(
sqrtS
);
auto
const
s
=
units
::
si
::
detail
::
static_pow
<
2
>
(
sqrtS
);
auto
const
B
=
this
->
B
(
s
qrtS
);
auto
const
B
=
this
->
B
(
s
);
std
::
cout
<<
B
<<
std
::
endl
;
std
::
cout
<<
B
<<
std
::
endl
;
corsika
::
random
::
ExponentialDistribution
tDist
(
1
/
B
);
corsika
::
random
::
ExponentialDistribution
tDist
(
1
/
B
);
...
@@ -176,41 +178,35 @@ namespace corsika::process::HadronicElasticModel {
...
@@ -176,41 +178,35 @@ namespace corsika::process::HadronicElasticModel {
auto
const
maxT
=
4
*
pProjectileCoMSqNorm
;
auto
const
maxT
=
4
*
pProjectileCoMSqNorm
;
do
{
do
{
// |t| cannot become arbitrarily large, max. given by GE
N
eq. (4.16), so we just
// |t| cannot become arbitrarily large, max. given by GE
R
eq. (4.16), so we just
// throw again until we have an acceptable value
n
ote that the formula holds in
// throw again until we have an acceptable value
. N
ote that the formula holds in
// any frame despite of what is stated
there
// any frame despite of what is stated
in the book.
absT
=
tDist
(
fRNG
);
absT
=
tDist
(
fRNG
);
}
while
(
absT
>=
maxT
);
}
while
(
absT
>=
maxT
);
return
absT
;
return
absT
;
}();
}();
auto
constexpr
GeVsq
=
1
_GeV
*
1
_
GeV
;
std
::
cout
<<
"HadronicElasticInteraction: s = "
<<
s
*
inv
GeV
sq
std
::
cout
<<
"s = "
<<
s
/
GeVsq
<<
" GeV²; absT = "
<<
absT
/
GeVsq
<<
" GeV²; absT = "
<<
absT
*
inv
GeVsq
<<
" GeV² (max./GeV² = "
<<
4
*
projectileMomentumSquaredNorm
/
GeVsq
<<
" GeV² (max./GeV² = "
<<
4
*
invGeVsq
*
projectileMomentumSquaredNorm
<<
')'
<<
std
::
endl
;
<<
')'
<<
std
::
endl
;
auto
const
theta
=
auto
const
theta
=
2
*
asin
(
sqrt
(
absT
/
(
4
*
pProjectileCoMSqNorm
)));
// would work for in any frame
2
*
asin
(
sqrt
(
absT
/
(
4
*
pProjectileCoMSqNorm
)));
// would work for in any frame
auto
const
phi
=
phiDist
(
fRNG
);
auto
const
phi
=
phiDist
(
fRNG
);
geometry
::
QuantityVector
<
units
::
si
::
hepmomentum_d
>
const
scatteredMomentum
{
geometry
::
QuantityVector
<
units
::
si
::
hepmomentum_d
>
const
scatteredMomentum
{
pProjectileCoMNorm
*
sin
(
theta
)
*
cos
(
phi
),
pProjectileCoMNorm
*
sin
(
theta
)
*
cos
(
phi
),
pProjectileCoMNorm
*
sin
(
theta
)
*
sin
(
phi
),
pProjectileCoMNorm
*
cos
(
theta
)};
pProjectileCoMNorm
*
sin
(
theta
)
*
sin
(
phi
),
pProjectileCoMNorm
*
cos
(
theta
)};
auto
const
[
eProjectileScatteredLab
,
pProjectileScatteredLab
]
=
auto
const
[
eProjectileScatteredLab
,
pProjectileScatteredLab
]
=
boost
.
fromCoM
(
eProjectileCoM
,
scatteredMomentum
);
boost
.
fromCoM
(
eProjectileCoM
,
scatteredMomentum
);
std
::
cout
<<
"xxx: "
<<
pProjectileScatteredLab
.
squaredNorm
()
/
p
.
GetMomentum
().
squaredNorm
()
<<
std
::
endl
;
p
.
SetMomentum
(
pProjectileScatteredLab
);
p
.
SetMomentum
(
pProjectileScatteredLab
);
p
.
SetEnergy
(
eProjectileScatteredLab
);
// alternatively recalculate energy from
// alternatives: 1. do not touch energy
// momentum and mass
// 2. take back-boosted energy
// 3. recalculate energy from momentum
//~ p.SetEnergy(sqrt(pProjectileScatteredLab.squaredNorm() +
//~ units::si::detail::static_pow<2>(corsika::particles::GetMass(p.GetPID()))));
return
process
::
EProcessReturn
::
eOk
;
return
process
::
EProcessReturn
::
eOk
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment