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
19a2abce
Commit
19a2abce
authored
5 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
added example for energy loss
parent
e759951f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!131
Stopping power
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Documentation/Examples/CMakeLists.txt
+11
-0
11 additions, 0 deletions
Documentation/Examples/CMakeLists.txt
Documentation/Examples/stopping_power.cc
+82
-0
82 additions, 0 deletions
Documentation/Examples/stopping_power.cc
with
93 additions
and
0 deletions
Documentation/Examples/CMakeLists.txt
+
11
−
0
View file @
19a2abce
...
@@ -106,6 +106,17 @@ target_link_libraries (vertical_EAS
...
@@ -106,6 +106,17 @@ target_link_libraries (vertical_EAS
)
)
install
(
TARGETS vertical_EAS DESTINATION share/examples
)
install
(
TARGETS vertical_EAS DESTINATION share/examples
)
CORSIKA_ADD_TEST
(
stopping_power
)
target_link_libraries
(
stopping_power
SuperStupidStack
CORSIKAunits
ProcessEnergyLoss
CORSIKAparticles
CORSIKAgeometry
CORSIKAenvironment
)
install
(
TARGETS vertical_EAS DESTINATION share/examples
)
CORSIKA_ADD_TEST
(
staticsequence_example
)
CORSIKA_ADD_TEST
(
staticsequence_example
)
target_link_libraries
(
staticsequence_example
target_link_libraries
(
staticsequence_example
CORSIKAprocesssequence
CORSIKAprocesssequence
...
...
This diff is collapsed.
Click to expand it.
Documentation/Examples/stopping_power.cc
0 → 100644
+
82
−
0
View file @
19a2abce
/*
* (c) Copyright 2019 CORSIKA Project, corsika-project@lists.kit.edu
*
* See file AUTHORS for a list of contributors.
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#include
<corsika/environment/Environment.h>
#include
<corsika/geometry/Sphere.h>
#include
<corsika/process/energy_loss/EnergyLoss.h>
#include
<corsika/setup/SetupStack.h>
#include
<corsika/units/PhysicalUnits.h>
#include
<corsika/utl/CorsikaFenv.h>
#include
<fstream>
#include
<iostream>
#include
<limits>
using
namespace
corsika
;
using
namespace
corsika
::
process
;
using
namespace
corsika
::
particles
;
using
namespace
corsika
::
geometry
;
using
namespace
corsika
::
environment
;
using
namespace
std
;
using
namespace
corsika
::
units
::
si
;
//
// This example demonstrates the energy loss of muons as function of beta*gamma (=p/m)
//
int
main
()
{
feenableexcept
(
FE_INVALID
);
// setup environment, geometry
using
EnvType
=
Environment
<
setup
::
IEnvironmentModel
>
;
EnvType
env
;
const
CoordinateSystem
&
rootCS
=
env
.
GetCoordinateSystem
();
process
::
energy_loss
::
EnergyLoss
eLoss
;
setup
::
Stack
stack
;
std
::
ofstream
file
(
"dEdX.dat"
);
file
<<
"# beta*gamma, dE/dX / eV/(g/cm²)"
<<
std
::
endl
;
for
(
HEPEnergyType
E0
=
300
_MeV
;
E0
<
1
_PeV
;
E0
*=
1.05
)
{
stack
.
Clear
();
const
Code
beamCode
=
Code
::
MuPlus
;
const
HEPMassType
mass
=
GetMass
(
beamCode
);
double
theta
=
0.
;
double
phi
=
0.
;
auto
elab2plab
=
[](
HEPEnergyType
Elab
,
HEPMassType
m
)
{
return
sqrt
((
Elab
-
m
)
*
(
Elab
+
m
));
};
HEPMomentumType
P0
=
elab2plab
(
E0
,
mass
);
auto
momentumComponents
=
[](
double
theta
,
double
phi
,
HEPMomentumType
ptot
)
{
return
std
::
make_tuple
(
ptot
*
sin
(
theta
)
*
cos
(
phi
),
ptot
*
sin
(
theta
)
*
sin
(
phi
),
-
ptot
*
cos
(
theta
));
};
auto
const
[
px
,
py
,
pz
]
=
momentumComponents
(
theta
/
180.
*
M_PI
,
phi
/
180.
*
M_PI
,
P0
);
auto
plab
=
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
px
,
py
,
pz
});
cout
<<
"input particle: "
<<
beamCode
<<
endl
;
cout
<<
"input angles: theta="
<<
theta
<<
" phi="
<<
phi
<<
endl
;
cout
<<
"input momentum: "
<<
plab
.
GetComponents
()
/
1
_GeV
<<
endl
;
Point
pos
(
rootCS
,
0
_m
,
0
_m
,
112.8
_km
);
// this is the CORSIKA 7 start of atmosphere/universe
stack
.
AddParticle
(
std
::
tuple
<
particles
::
Code
,
units
::
si
::
HEPEnergyType
,
corsika
::
stack
::
MomentumVector
,
geometry
::
Point
,
units
::
si
::
TimeType
>
{
beamCode
,
E0
,
plab
,
pos
,
0
_ns
});
auto
const
p
=
stack
.
GetNextParticle
();
HEPEnergyType
dE
=
eLoss
.
BetheBloch
(
p
,
1
_g
/
square
(
1
_cm
));
file
<<
P0
/
mass
<<
"
\t
"
<<
-
dE
/
1
_eV
<<
std
::
endl
;
}
}
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