IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
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
Model registry
Operate
Environments
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
Air Shower Physics
corsika
Commits
2f61e672
Commit
2f61e672
authored
4 years ago
by
ralfulrich
Browse files
Options
Downloads
Patches
Plain Diff
synchronized energy loss codes a bit
parent
63d562a0
No related branches found
No related tags found
1 merge request
!321
Resolve "Weird LongitudinalProfile"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
corsika/detail/modules/energy_loss/BetheBlochPDG.inl
+29
-26
29 additions, 26 deletions
corsika/detail/modules/energy_loss/BetheBlochPDG.inl
corsika/detail/modules/proposal/ContinuousProcess.inl
+9
-13
9 additions, 13 deletions
corsika/detail/modules/proposal/ContinuousProcess.inl
with
38 additions
and
39 deletions
corsika/detail/modules/energy_loss/BetheBlochPDG.inl
+
29
−
26
View file @
2f61e672
...
...
@@ -64,18 +64,18 @@ namespace corsika {
double
const
beta2
=
(
gamma2
-
1
)
/
gamma2
;
// 1-1/gamma2 (1-1/gamma)*(1+1/gamma);
// (gamma_2-1)/gamma_2 = (1-1/gamma2);
double
constexpr
c2
=
1
;
// HEP convention here c=c2=1
CORSIKA_LOG_
DEBUG
(
"BetheBloch beta2={}, gamma2={}"
,
beta2
,
gamma2
);
CORSIKA_LOG_
TRACE
(
"BetheBloch beta2={}, gamma2={}"
,
beta2
,
gamma2
);
[[
maybe_unused
]]
double
const
eta2
=
beta2
/
(
1
-
beta2
);
HEPMassType
const
Wmax
=
2
*
me
*
c2
*
beta2
*
gamma2
/
(
1
+
2
*
gamma
*
me
/
m
+
me2
/
m2
);
// approx, but <<1% HEPMassType const Wmax = 2*me*c2*beta2*gamma2; for HEAVY
// PARTICLES Wmax ~ 2me v2 for non-relativistic particles
CORSIKA_LOG_
DEBUG
(
"BetheBloch Wmax={}"
,
Wmax
);
CORSIKA_LOG_
TRACE
(
"BetheBloch Wmax={}"
,
Wmax
);
// Sternheimer parameterization, density corrections towards high energies
// NOTE/TODO: when Cbar is 0 it needs to be approximated from parameterization ->
// MISSING
CORSIKA_LOG_
DEBUG
(
"BetheBloch p.getMomentum().getNorm()/m{}="
,
CORSIKA_LOG_
TRACE
(
"BetheBloch p.getMomentum().getNorm()/m{}="
,
p
.
getMomentum
().
getNorm
()
/
m
);
double
const
x
=
log10
(
p
.
getMomentum
().
getNorm
()
/
m
);
double
delta
=
0
;
...
...
@@ -86,7 +86,7 @@ namespace corsika {
}
else
if
(
x
<
x0
)
{
// and IF conductor (otherwise, this is 0)
delta
=
delta0
*
pow
(
100
,
2
*
(
x
-
x0
));
}
CORSIKA_LOG_
DEBUG
(
"BetheBloch delta={}"
,
delta
);
CORSIKA_LOG_
TRACE
(
"BetheBloch delta={}"
,
delta
);
// with further low energies correction, accurary ~1% down to beta~0.05 (1MeV for p)
...
...
@@ -141,18 +141,26 @@ namespace corsika {
inline
ProcessReturn
BetheBlochPDG
::
doContinuous
(
setup
::
Stack
::
particle_type
&
p
,
setup
::
Trajectory
const
&
t
,
bool
const
)
{
bool
const
limitStep
)
{
// if this step was limiting the CORSIKA stepping, the particle is lost
if
(
limitStep
)
{
fillProfile
(
t
,
p
.
getEnergy
());
p
.
setEnergy
(
p
.
getMass
());
return
ProcessReturn
::
ParticleAbsorbed
;
}
if
(
p
.
getChargeNumber
()
==
0
)
return
ProcessReturn
::
Ok
;
GrammageType
const
dX
=
p
.
getNode
()
->
getModelProperties
().
getIntegratedGrammage
(
t
,
t
.
getLength
());
CORSIKA_LOG_
DEBUG
(
"EnergyLoss pid={}, z={}, dX={} g/cm2"
,
p
.
getPID
(),
CORSIKA_LOG_
TRACE
(
"EnergyLoss pid={}, z={}, dX={} g/cm2"
,
p
.
getPID
(),
p
.
getChargeNumber
(),
dX
/
1
_g
*
square
(
1
_cm
));
HEPEnergyType
dE
=
getTotalEnergyLoss
(
p
,
dX
);
auto
E
=
p
.
getEnergy
();
[[
maybe_unused
]]
const
auto
Ekin
=
E
-
p
.
getMass
();
auto
Enew
=
E
+
dE
;
CORSIKA_LOG_
DEBUG
(
"EnergyLoss dE={} MeV, E={} GeV, Ekin={} GeV, Enew={} GeV"
,
CORSIKA_LOG_
TRACE
(
"EnergyLoss dE={} MeV, E={} GeV, Ekin={} GeV, Enew={} GeV"
,
dE
/
1
_MeV
,
E
/
1
_GeV
,
Ekin
/
1
_GeV
,
Enew
/
1
_GeV
);
p
.
setEnergy
(
Enew
);
updateMomentum
(
p
,
Enew
);
...
...
@@ -168,22 +176,17 @@ namespace corsika {
}
auto
constexpr
dX
=
1
_g
/
square
(
1
_cm
);
auto
const
dEdX
=
-
getTotalEnergyLoss
(
vParticle
,
dX
)
/
dX
;
// dE > 0
//~ auto const Ekin = vParticle.getEnergy() - vParticle.getMass();
auto
const
emCut
=
get_energy_threshold
(
vParticle
.
getPID
());
// in any case: never go below 0.99*emCut This needs to be
// slightly smaller than emCut since, either this Step is limited
// by energy_lim, then the particle is stopped in a very short
// range (before doing anythin else) and is then removed
// instantly. The exact 3D position where it reaches emCut is not very
// important, the important fact is that its E_kin is zero
// afterwards.
//
const
auto
energy
=
vParticle
.
getEnergy
();
auto
energy_lim
=
std
::
max
(
0.9
*
energy
,
0.99
*
emCut
);
auto
const
maxGrammage
=
(
energy
-
energy_lim
)
/
dEdX
;
auto
const
dEdX
=
-
getTotalEnergyLoss
(
vParticle
,
dX
)
/
dX
;
auto
const
energy
=
vParticle
.
getEnergy
();
auto
const
energy_lim
=
std
::
max
(
energy
*
0.9
,
// either 10% relative loss max., or
get_energy_threshold
(
vParticle
.
getPID
())
// energy thresholds globally defined for
// individual particles
*
0.99
// need to go 1% below global e-cut to assure removal in ParticleCut. The
// 1% does not matter since at cut-time the entire energy is removed.
);
auto
const
maxGrammage
=
(
vParticle
.
getEnergy
()
-
energy_lim
)
/
dEdX
;
return
vParticle
.
getNode
()
->
getModelProperties
().
getArclengthFromGrammage
(
vTrack
,
maxGrammage
);
...
...
@@ -219,7 +222,7 @@ namespace corsika {
if
(
binEnd
<
0
)
binEnd
=
0
;
if
(
binEnd
>
maxBin
)
binEnd
=
maxBin
;
CORSIKA_LOG_
DEBUG
(
"energy deposit of -dE={} between {} and {}"
,
-
dE
,
grammageStart
,
CORSIKA_LOG_
TRACE
(
"energy deposit of -dE={} between {} and {}"
,
-
dE
,
grammageStart
,
grammageEnd
);
auto
energyCount
=
HEPEnergyType
::
zero
();
...
...
@@ -230,7 +233,7 @@ namespace corsika {
profile_
[
bin
]
+=
increment
;
energyCount
+=
increment
;
CORSIKA_LOG_
DEBUG
(
"filling bin {} with weight {} : {} "
,
bin
,
weight
,
increment
);
CORSIKA_LOG_
TRACE
(
"filling bin {} with weight {} : {} "
,
bin
,
weight
,
increment
);
};
// fill longitudinal profile
...
...
@@ -242,7 +245,7 @@ namespace corsika {
for
(
int
bin
=
binStart
+
1
;
bin
<
binEnd
;
++
bin
)
{
fill
(
bin
,
dX_
);
}
}
CORSIKA_LOG_
DEBUG
(
"total energy added to histogram: {} "
,
energyCount
);
CORSIKA_LOG_
TRACE
(
"total energy added to histogram: {} "
,
energyCount
);
}
inline
void
BetheBlochPDG
::
printProfile
()
const
{
...
...
This diff is collapsed.
Click to expand it.
corsika/detail/modules/proposal/ContinuousProcess.inl
+
9
−
13
View file @
2f61e672
...
...
@@ -124,23 +124,19 @@ namespace corsika::proposal {
// Limit the step size of a conitnuous loss. The maximal continuous loss seems to be a
// hyper parameter which must be adjusted.
//
auto
const
emCut
=
get_energy_threshold
(
code
);
//! energy thresholds globally defined for individual particles
// in any case: never go below 0.99*emCut This needs to be
// slightly smaller than emCut since, either this Step is limited
// by energy_lim, then the particle is stopped in a very short
// range (before doing anythin else) and is then removed
// instantly. The exact position where it reaches emCut is not
// important, the important fact is that its E_kin is zero
// afterwards.
//
auto
energy_lim
=
std
::
max
(
0.9
*
vP
.
getEnergy
(),
0.99
*
emCut
);
auto
const
energy
=
vP
.
getEnergy
();
auto
const
energy_lim
=
std
::
max
(
energy
*
0.9
,
// either 10% relative loss max., or
get_energy_threshold
(
code
)
// energy thresholds globally defined for individual particles
*
0.99
// need to go 1% below global e-cut to assure removal in ParticleCut. The
// 1% does not matter since at cut-time the entire energy is removed.
);
// solving the track integral for giving energy lim
auto
c
=
getCalculator
(
vP
,
calc
);
auto
grammage
=
get
<
eDISPLACEMENT
>
(
c
->
second
)
->
SolveTrackIntegral
(
vP
.
getE
nergy
()
/
1
_MeV
,
energy_lim
/
1
_MeV
)
*
e
nergy
/
1
_MeV
,
energy_lim
/
1
_MeV
)
*
1
_g
/
square
(
1
_cm
);
// return it in distance aequivalent
...
...
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