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
7320b195
Commit
7320b195
authored
6 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
energy recalculation
parent
2b0a9ee7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Processes/HadronicElasticModel/HadronicElasticModel.h
+27
-18
27 additions, 18 deletions
Processes/HadronicElasticModel/HadronicElasticModel.h
with
27 additions
and
18 deletions
Processes/HadronicElasticModel/HadronicElasticModel.h
+
27
−
18
View file @
7320b195
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include
<corsika/environment/Environment.h>
#include
<corsika/environment/Environment.h>
#include
<corsika/environment/NuclearComposition.h>
#include
<corsika/environment/NuclearComposition.h>
#include
<corsika/geometry/FourVector.h>
#include
<corsika/particles/ParticleProperties.h>
#include
<corsika/particles/ParticleProperties.h>
#include
<corsika/process/InteractionProcess.h>
#include
<corsika/process/InteractionProcess.h>
#include
<corsika/random/ExponentialDistribution.h>
#include
<corsika/random/ExponentialDistribution.h>
...
@@ -156,16 +157,22 @@ namespace corsika::process::HadronicElasticModel {
...
@@ -156,16 +157,22 @@ namespace corsika::process::HadronicElasticModel {
std
::
uniform_real_distribution
phiDist
(
0.
,
2
*
M_PI
);
std
::
uniform_real_distribution
phiDist
(
0.
,
2
*
M_PI
);
utl
::
COMBoost
const
boost
(
projectileEnergy
,
projectileMomentum
,
targetMass
);
geometry
::
FourVector
const
projectileLab
(
projectileEnergy
,
projectileMomentum
);
auto
const
[
eProjectileCoM
,
pProjectileCoM
]
=
geometry
::
FourVector
const
targetLab
(
boost
.
toCoM
(
projectileEnergy
,
projectileMomentum
);
auto
const
[
eTargetCoM
,
pTargetCoM
]
=
boost
.
toCoM
(
targetMass
,
geometry
::
Vector
<
units
::
si
::
hepmomentum_d
>
(
targetMass
,
geometry
::
Vector
<
units
::
si
::
hepmomentum_d
>
(
projectileMomentum
.
GetCoordinateSystem
(),
{
0
_eV
,
0
_eV
,
0
_eV
}));
projectileMomentum
.
GetCoordinateSystem
(),
{
0
_eV
,
0
_eV
,
0
_eV
}));
utl
::
COMBoost
const
boost
(
projectileLab
,
targetMass
);
auto
const
pProjectileCoMSqNorm
=
pProjectileCoM
.
squaredNorm
();
auto
const
projectileCoM
=
boost
.
toCoM
(
projectileLab
);
auto
const
targetCoM
=
boost
.
toCoM
(
targetLab
);
auto
const
pProjectileCoMSqNorm
=
projectileCoM
.
GetSpaceLikeComponents
().
squaredNorm
();
auto
const
pProjectileCoMNorm
=
sqrt
(
pProjectileCoMSqNorm
);
auto
const
pProjectileCoMNorm
=
sqrt
(
pProjectileCoMSqNorm
);
auto
const
eProjectileCoM
=
projectileCoM
.
GetTimeLikeComponent
();
auto
const
eTargetCoM
=
targetCoM
.
GetTimeLikeComponent
();
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
);
...
@@ -192,21 +199,23 @@ namespace corsika::process::HadronicElasticModel {
...
@@ -192,21 +199,23 @@ namespace corsika::process::HadronicElasticModel {
<<
" GeV² (max./GeV² = "
<<
4
*
invGeVsq
*
projectileMomentumSquaredNorm
<<
" GeV² (max./GeV² = "
<<
4
*
invGeVsq
*
projectileMomentumSquaredNorm
<<
')'
<<
std
::
endl
;
<<
')'
<<
std
::
endl
;
auto
const
theta
=
auto
const
theta
=
2
*
asin
(
sqrt
(
absT
/
(
4
*
pProjectileCoMSqNorm
)));
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
{
auto
const
projectileScatteredLab
=
boost
.
fromCoM
(
pProjectileCoMNorm
*
sin
(
theta
)
*
cos
(
phi
),
geometry
::
FourVector
<
HEPEnergyType
,
geometry
::
Vector
<
hepmomentum_d
>>
(
pProjectileCoMNorm
*
sin
(
theta
)
*
sin
(
phi
),
pProjectileCoMNorm
*
cos
(
theta
)};
eProjectileCoM
,
geometry
::
Vector
<
hepmomentum_d
>
(
projectileMomentum
.
GetCoordinateSystem
(),
auto
const
[
eProjectileScatteredLab
,
pProjectileScatteredLab
]
=
{
pProjectileCoMNorm
*
sin
(
theta
)
*
cos
(
phi
),
boost
.
fromCoM
(
eProjectileCoM
,
scatteredMomentum
);
pProjectileCoMNorm
*
sin
(
theta
)
*
sin
(
phi
),
pProjectileCoMNorm
*
cos
(
theta
)})));
p
.
SetMomentum
(
pProjectileScatteredLab
);
p
.
SetEnergy
(
eProjectileScatteredLab
);
// alternatively recalculate energy from
p
.
SetMomentum
(
projectileScatteredLab
.
GetSpaceLikeComponents
());
// momentum and mass
p
.
SetEnergy
(
sqrt
(
projectileScatteredLab
.
GetSpaceLikeComponents
().
squaredNorm
()
+
units
::
si
::
detail
::
static_pow
<
2
>
(
corsika
::
particles
::
GetMass
(
p
.
GetPID
()))));
// Don't use energy from boost. It can be smaller than
// the momentum due to limited numerical accuracy.
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