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
Snippets
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
Antonio Augusto Alves Junior
corsika
Compare revisions
master to b5f4c7a0811d9c0ce57022162cf95336e10d4a31
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
AAAlvesJr/corsika
Select target project
No results found
b5f4c7a0811d9c0ce57022162cf95336e10d4a31
Select Git revision
Swap
Target
AirShowerPhysics/corsika
Select target project
AirShowerPhysics/corsika
rulrich/corsika
AAAlvesJr/corsika
Andre/corsika
arrabito/corsika
Nikos/corsika
olheiser73/corsika
AirShowerPhysics/papers/corsika
pranav/corsika
9 results
master
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (1)
workshop example
· b5f4c7a0
Maximilian Reininghaus
authored
5 years ago
b5f4c7a0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Documentation/Examples/CMakeLists.txt
+20
-0
20 additions, 0 deletions
Documentation/Examples/CMakeLists.txt
Documentation/Examples/workshop_example.cc
+185
-0
185 additions, 0 deletions
Documentation/Examples/workshop_example.cc
Tools/plot_tracks.sh
+8
-1
8 additions, 1 deletion
Tools/plot_tracks.sh
with
213 additions
and
1 deletion
Documentation/Examples/CMakeLists.txt
View file @
b5f4c7a0
...
@@ -37,6 +37,26 @@ target_link_libraries (cascade_example
...
@@ -37,6 +37,26 @@ target_link_libraries (cascade_example
)
)
install
(
TARGETS cascade_example DESTINATION share/examples
)
install
(
TARGETS cascade_example DESTINATION share/examples
)
add_executable
(
workshop_example workshop_example.cc
)
target_link_libraries
(
workshop_example
SuperStupidStack
CORSIKAunits
CORSIKAlogging
CORSIKArandom
ProcessSibyll
CORSIKAcascade
ProcessTrackWriter
ProcessParticleCut
ProcessTrackingLine
CORSIKAprocesses
CORSIKAparticles
CORSIKAgeometry
CORSIKAenvironment
CORSIKAprocesssequence
)
install
(
TARGETS workshop_example DESTINATION share/examples
)
CORSIKA_ADD_TEST
(
boundary_example
)
CORSIKA_ADD_TEST
(
boundary_example
)
target_link_libraries
(
boundary_example
target_link_libraries
(
boundary_example
SuperStupidStack
SuperStupidStack
...
...
This diff is collapsed.
Click to expand it.
Documentation/Examples/workshop_example.cc
0 → 100644
View file @
b5f4c7a0
/*
* (c) Copyright 2018 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/cascade/Cascade.h>
#include
<corsika/process/ProcessSequence.h>
#include
<corsika/process/tracking_line/TrackingLine.h>
#include
<corsika/setup/SetupEnvironment.h>
#include
<corsika/setup/SetupStack.h>
#include
<corsika/setup/SetupTrajectory.h>
#include
<corsika/environment/Environment.h>
#include
<corsika/environment/FlatExponential.h>
#include
<corsika/environment/HomogeneousMedium.h>
#include
<corsika/environment/NuclearComposition.h>
#include
<corsika/geometry/Sphere.h>
#include
<corsika/process/sibyll/Decay.h>
#include
<corsika/process/sibyll/Interaction.h>
#include
<corsika/process/sibyll/NuclearInteraction.h>
#include
<corsika/process/track_writer/TrackWriter.h>
#include
<corsika/process/particle_cut/ParticleCut.h>
#include
<corsika/units/PhysicalUnits.h>
#include
<corsika/random/RNGManager.h>
#include
<corsika/utl/CorsikaFenv.h>
#include
<iostream>
#include
<limits>
#include
<typeinfo>
using
namespace
corsika
;
using
namespace
corsika
::
process
;
using
namespace
corsika
::
units
;
using
namespace
corsika
::
particles
;
using
namespace
corsika
::
random
;
using
namespace
corsika
::
setup
;
using
namespace
corsika
::
geometry
;
using
namespace
corsika
::
environment
;
using
namespace
std
;
using
namespace
corsika
::
units
::
si
;
// example boundary crossing process
template
<
bool
deleteParticle
>
struct
MyBoundaryCrossingProcess
:
public
BoundaryCrossingProcess
<
MyBoundaryCrossingProcess
<
deleteParticle
>>
{
MyBoundaryCrossingProcess
(
std
::
string
const
&
filename
)
{
fFile
.
open
(
filename
);
}
template
<
typename
Particle
>
EProcessReturn
DoBoundaryCrossing
(
Particle
&
p
,
typename
Particle
::
BaseNodeType
const
&
from
,
typename
Particle
::
BaseNodeType
const
&
to
)
{
std
::
cout
<<
"boundary crossing! from: "
<<
&
from
<<
"; to: "
<<
&
to
<<
std
::
endl
;
auto
const
&
name
=
particles
::
GetName
(
p
.
GetPID
());
auto
const
pos
=
p
.
GetPosition
().
GetCoordinates
();
fFile
<<
name
<<
" "
<<
pos
[
0
]
/
1
_m
<<
' '
<<
pos
[
1
]
/
1
_m
<<
' '
<<
pos
[
2
]
/
1
_m
<<
'\n'
;
if
constexpr
(
deleteParticle
)
{
p
.
Delete
();
}
return
EProcessReturn
::
eOk
;
}
void
Init
()
{}
private
:
std
::
ofstream
fFile
;
};
//
// The example main program for a particle cascade
//
int
main
()
{
feenableexcept
(
FE_INVALID
);
// initialize random number sequence(s)
random
::
RNGManager
::
GetInstance
().
RegisterRandomStream
(
"cascade"
);
random
::
RNGManager
::
GetInstance
().
RegisterRandomStream
(
"s_rndm"
);
using
EnvType
=
Environment
<
setup
::
IEnvironmentModel
>
;
// inheritance from IMediumModel to implement the pure virtual methods
using
FlatExp
=
environment
::
FlatExponential
<
setup
::
IEnvironmentModel
>
;
using
Homogeneous
=
environment
::
HomogeneousMedium
<
setup
::
IEnvironmentModel
>
;
EnvType
env
;
auto
&
universe
=
*
(
env
.
GetUniverse
());
// obtain the root coordinate system provided by environment object
const
CoordinateSystem
&
rootCS
=
env
.
GetCoordinateSystem
();
auto
outerMedium
=
EnvType
::
CreateNode
<
Sphere
>
(
Point
{
rootCS
,
0
_m
,
0
_m
,
0
_km
},
500
_km
);
outerMedium
->
SetModelProperties
<
FlatExp
>
(
Point
{
rootCS
,
0
_m
,
0
_m
,
5
_km
},
Vector
<
dimensionless_d
>
{
rootCS
,
{
0.
,
0.
,
1.
}},
1
_kg
/
cube
(
1
_m
),
8
_km
,
environment
::
NuclearComposition
{
{
particles
::
Code
::
Nitrogen
,
particles
::
Code
::
Oxygen
},
{
0.7847
f
,
1.
f
-
0.7847
f
}});
auto
innerMedium
=
EnvType
::
CreateNode
<
Sphere
>
(
Point
{
rootCS
,
0
_m
,
0
_m
,
0
_m
},
5
_km
);
auto
const
props
=
innerMedium
->
SetModelProperties
<
Homogeneous
>
(
1
_g
/
cube
(
1
_m
),
environment
::
NuclearComposition
{{
particles
::
Code
::
Proton
},
{
1.
f
}});
universe
.
SetModelProperties
(
props
);
outerMedium
->
AddChild
(
std
::
move
(
innerMedium
));
universe
.
AddChild
(
std
::
move
(
outerMedium
));
// setup processes, decays and interactions
tracking_line
::
TrackingLine
tracking
;
process
::
sibyll
::
Interaction
sibyll
;
process
::
sibyll
::
Decay
decay
;
process
::
particle_cut
::
ParticleCut
cut
(
55
_GeV
);
process
::
track_writer
::
TrackWriter
trackWriter
(
"tracks.dat"
);
MyBoundaryCrossingProcess
<
false
>
boundaryCrossing
(
"crossings.dat"
);
// assemble all processes into an ordered process list
auto
sequence
=
sibyll
<<
decay
<<
cut
<<
boundaryCrossing
<<
trackWriter
;
// setup particle stack, and add primary particles
setup
::
Stack
stack
;
stack
.
Clear
();
const
Code
beamCode
=
Code
::
Proton
;
const
HEPMassType
mass
=
particles
::
GetMass
(
Code
::
Proton
);
const
HEPEnergyType
E0
=
500
_TeV
;
for
(
int
N
=
2
,
i
=
0
;
i
<
N
;
++
i
)
{
auto
const
phi
=
0
;
auto
const
theta
=
i
*
360
/
N
;
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
,
0
_m
);
stack
.
AddParticle
(
std
::
tuple
<
particles
::
Code
,
units
::
si
::
HEPEnergyType
,
corsika
::
stack
::
MomentumVector
,
geometry
::
Point
,
units
::
si
::
TimeType
>
{
beamCode
,
E0
,
plab
,
pos
,
0
_ns
});
}
// define air shower object, run simulation
cascade
::
Cascade
EAS
(
env
,
tracking
,
sequence
,
stack
);
EAS
.
Init
();
EAS
.
Run
();
cout
<<
"Result: E0="
<<
E0
/
1
_GeV
<<
endl
;
cut
.
ShowResults
();
const
HEPEnergyType
Efinal
=
cut
.
GetCutEnergy
()
+
cut
.
GetInvEnergy
()
+
cut
.
GetEmEnergy
();
cout
<<
"total energy (GeV): "
<<
Efinal
/
1
_GeV
<<
endl
<<
"relative difference (%): "
<<
(
Efinal
/
E0
-
1.
)
*
100
<<
endl
;
}
This diff is collapsed.
Click to expand it.
Tools/plot_tracks.sh
View file @
b5f4c7a0
...
@@ -28,10 +28,17 @@ set output "$output"
...
@@ -28,10 +28,17 @@ set output "$output"
set xlabel "x / m"
set xlabel "x / m"
set ylabel "y / m"
set ylabel "y / m"
set zlabel "z / m"
set zlabel "z / m"
d = 200
set xrange [-d:d]
set yrange [-d:d]
set zrange [-15e3:15e3]
set title "CORSIKA 8 preliminary"
set title "CORSIKA 8 preliminary"
do for [t=0:360:1] {
do for [t=0:360:1] {
set view
60
, t
set view
85
, t
splot "
$track_dat
" u 3:4:5:6:7:8 w vectors nohead t ""
splot "
$track_dat
" u 3:4:5:6:7:8 w vectors nohead t ""
}
}
EOF
EOF
...
...
This diff is collapsed.
Click to expand it.