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
8bd4167c
Commit
8bd4167c
authored
5 years ago
by
Maximilian Reininghaus
Committed by
Maximilian Reininghaus
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
improved EnergyLoss, const-correctness & step-length limitation
parent
11f4bd2e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Processes/EnergyLoss/EnergyLoss.cc
+26
-14
26 additions, 14 deletions
Processes/EnergyLoss/EnergyLoss.cc
Processes/EnergyLoss/EnergyLoss.h
+5
-4
5 additions, 4 deletions
Processes/EnergyLoss/EnergyLoss.h
with
31 additions
and
18 deletions
Processes/EnergyLoss/EnergyLoss.cc
+
26
−
14
View file @
8bd4167c
...
@@ -24,9 +24,8 @@ using namespace std;
...
@@ -24,9 +24,8 @@ using namespace std;
using
namespace
corsika
;
using
namespace
corsika
;
using
namespace
corsika
::
units
::
si
;
using
namespace
corsika
::
units
::
si
;
using
namespace
corsika
::
setup
;
using
SetupParticle
=
corsika
::
setup
::
Stack
::
ParticleType
;
using
Particle
=
Stack
::
ParticleType
;
using
SetupTrack
=
corsika
::
setup
::
Trajectory
;
using
Track
=
Trajectory
;
namespace
corsika
::
process
::
energy_loss
{
namespace
corsika
::
process
::
energy_loss
{
...
@@ -53,7 +52,7 @@ namespace corsika::process::energy_loss {
...
@@ -53,7 +52,7 @@ namespace corsika::process::energy_loss {
* For shell correction, see Sec 6 of https://www.nap.edu/read/20066/chapter/8#115
* For shell correction, see Sec 6 of https://www.nap.edu/read/20066/chapter/8#115
*
*
*/
*/
HEPEnergyType
EnergyLoss
::
BetheBloch
(
Particle
&
p
,
GrammageType
const
dX
)
{
HEPEnergyType
EnergyLoss
::
BetheBloch
(
Setup
Particle
const
&
p
,
GrammageType
const
dX
)
{
// all these are material constants and have to come through Environment
// all these are material constants and have to come through Environment
// right now: values for nitrogen_D
// right now: values for nitrogen_D
...
@@ -70,20 +69,20 @@ namespace corsika::process::energy_loss {
...
@@ -70,20 +69,20 @@ namespace corsika::process::energy_loss {
// end of material constants
// end of material constants
// this is the Bethe-Bloch coefficiet 4pi N_A r_e^2 m_e c^2
// this is the Bethe-Bloch coefficiet 4pi N_A r_e^2 m_e c^2
auto
const
K
=
0.307075
_MeV
/
1
_mol
*
square
(
1
_cm
);
auto
const
expr
K
=
0.307075
_MeV
/
1
_mol
*
square
(
1
_cm
);
HEPEnergyType
const
E
=
p
.
GetEnergy
();
HEPEnergyType
const
E
=
p
.
GetEnergy
();
HEPMassType
const
m
=
p
.
GetMass
();
HEPMassType
const
m
=
p
.
GetMass
();
double
const
gamma
=
E
/
m
;
double
const
gamma
=
E
/
m
;
double
const
Z
=
p
.
GetChargeNumber
();
int
const
Z
=
p
.
GetChargeNumber
();
double
const
Z2
=
pow
(
Z
,
2
)
;
int
const
Z2
=
Z
*
Z
;
HEPMassType
const
me
=
particles
::
Electron
::
GetMass
();
HEPMassType
const
expr
me
=
particles
::
Electron
::
GetMass
();
auto
const
m2
=
m
*
m
;
auto
const
m2
=
m
*
m
;
auto
const
me2
=
me
*
me
;
auto
const
expr
me2
=
me
*
me
;
double
const
gamma2
=
pow
(
gamma
,
2
)
;
double
const
gamma2
=
gamma
*
gamma
;
double
const
beta2
=
(
gamma2
-
1
)
/
gamma2
;
// 1-1/gamma2 (1-1/gamma)*(1+1/gamma);
double
const
beta2
=
(
gamma2
-
1
)
/
gamma2
;
// 1-1/gamma2 (1-1/gamma)*(1+1/gamma);
// (gamma_2-1)/gamma_2 = (1-1/gamma2);
// (gamma_2-1)/gamma_2 = (1-1/gamma2);
double
const
c2
=
1
;
// HEP convention here c=c2=1
double
const
expr
c2
=
1
;
// HEP convention here c=c2=1
cout
<<
"BetheBloch beta2="
<<
beta2
<<
" gamma2="
<<
gamma2
<<
endl
;
cout
<<
"BetheBloch beta2="
<<
beta2
<<
" gamma2="
<<
gamma2
<<
endl
;
[[
maybe_unused
]]
double
const
eta2
=
beta2
/
(
1
-
beta2
);
[[
maybe_unused
]]
double
const
eta2
=
beta2
/
(
1
-
beta2
);
HEPMassType
const
Wmax
=
HEPMassType
const
Wmax
=
...
@@ -148,7 +147,7 @@ namespace corsika::process::energy_loss {
...
@@ -148,7 +147,7 @@ namespace corsika::process::energy_loss {
(
0.5
*
log
(
aux
)
-
beta2
-
Cadj
/
Z
-
delta
/
2
+
barkas
+
bloch
)
*
dX
;
(
0.5
*
log
(
aux
)
-
beta2
-
Cadj
/
Z
-
delta
/
2
+
barkas
+
bloch
)
*
dX
;
}
}
process
::
EProcessReturn
EnergyLoss
::
DoContinuous
(
Particle
&
p
,
Track
&
t
)
{
process
::
EProcessReturn
EnergyLoss
::
DoContinuous
(
Setup
Particle
&
p
,
Setup
Track
&
t
)
{
if
(
p
.
GetChargeNumber
()
==
0
)
return
process
::
EProcessReturn
::
eOk
;
if
(
p
.
GetChargeNumber
()
==
0
)
return
process
::
EProcessReturn
::
eOk
;
GrammageType
const
dX
=
GrammageType
const
dX
=
p
.
GetNode
()
->
GetModelProperties
().
IntegratedGrammage
(
t
,
t
.
GetLength
());
p
.
GetNode
()
->
GetModelProperties
().
IntegratedGrammage
(
t
,
t
.
GetLength
());
...
@@ -174,8 +173,21 @@ namespace corsika::process::energy_loss {
...
@@ -174,8 +173,21 @@ namespace corsika::process::energy_loss {
return
status
;
return
status
;
}
}
units
::
si
::
LengthType
EnergyLoss
::
MaxStepLength
(
Particle
&
,
Track
&
)
{
units
::
si
::
LengthType
EnergyLoss
::
MaxStepLength
(
SetupParticle
const
&
vParticle
,
return
units
::
si
::
meter
*
std
::
numeric_limits
<
double
>::
infinity
();
SetupTrack
const
&
vTrack
)
const
{
if
(
vParticle
.
GetChargeNumber
()
==
0
)
{
return
units
::
si
::
meter
*
std
::
numeric_limits
<
double
>::
infinity
();
}
auto
constexpr
dX
=
1
_g
/
square
(
1
_cm
);
auto
const
dE
=
-
BetheBloch
(
vParticle
,
dX
);
// dE > 0
//~ auto const Ekin = vParticle.GetEnergy() - vParticle.GetMass();
auto
const
maxLoss
=
0.01
*
vParticle
.
GetEnergy
();
auto
const
maxGrammage
=
maxLoss
/
dE
*
dX
;
return
vParticle
.
GetNode
()
->
GetModelProperties
().
ArclengthFromGrammage
(
vTrack
,
maxGrammage
)
*
1.0001
;
// to make sure particle gets absorbed when DoContinuous() is called
}
}
void
EnergyLoss
::
MomentumUpdate
(
corsika
::
setup
::
Stack
::
ParticleType
&
vP
,
void
EnergyLoss
::
MomentumUpdate
(
corsika
::
setup
::
Stack
::
ParticleType
&
vP
,
...
...
This diff is collapsed.
Click to expand it.
Processes/EnergyLoss/EnergyLoss.h
+
5
−
4
View file @
8bd4167c
...
@@ -36,15 +36,16 @@ namespace corsika::process::energy_loss {
...
@@ -36,15 +36,16 @@ namespace corsika::process::energy_loss {
corsika
::
process
::
EProcessReturn
DoContinuous
(
corsika
::
setup
::
Stack
::
ParticleType
&
,
corsika
::
process
::
EProcessReturn
DoContinuous
(
corsika
::
setup
::
Stack
::
ParticleType
&
,
corsika
::
setup
::
Trajectory
&
);
corsika
::
setup
::
Trajectory
&
);
corsika
::
units
::
si
::
LengthType
MaxStepLength
(
corsika
::
setup
::
Stack
::
ParticleType
&
,
corsika
::
units
::
si
::
LengthType
MaxStepLength
(
corsika
::
setup
::
Trajectory
&
);
corsika
::
setup
::
Stack
::
ParticleType
const
&
,
corsika
::
setup
::
Trajectory
const
&
)
const
;
corsika
::
units
::
si
::
HEPEnergyType
GetTotal
()
const
{
return
fEnergyLossTot
;
}
corsika
::
units
::
si
::
HEPEnergyType
GetTotal
()
const
{
return
fEnergyLossTot
;
}
void
PrintProfile
()
const
;
void
PrintProfile
()
const
;
private
:
private
:
corsika
::
units
::
si
::
HEPEnergyType
BetheBloch
(
static
corsika
::
units
::
si
::
HEPEnergyType
BetheBloch
(
corsika
::
setup
::
Stack
::
ParticleType
&
p
,
corsika
::
setup
::
Stack
::
ParticleType
const
&
p
,
const
corsika
::
units
::
si
::
GrammageType
dX
);
const
corsika
::
units
::
si
::
GrammageType
dX
);
int
GetXbin
(
corsika
::
setup
::
Stack
::
ParticleType
&
p
,
int
GetXbin
(
corsika
::
setup
::
Stack
::
ParticleType
&
p
,
...
...
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