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
Commits
af24950c
Commit
af24950c
authored
6 years ago
by
Hans Dembinski
Browse files
Options
Downloads
Patches
Plain Diff
demonstrating a tested example
parent
cae2f86f
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
Documentation/Examples/CMakeLists.txt
+2
-2
2 additions, 2 deletions
Documentation/Examples/CMakeLists.txt
Documentation/Examples/stack_example.cc
+11
-6
11 additions, 6 deletions
Documentation/Examples/stack_example.cc
with
13 additions
and
8 deletions
Documentation/Examples/CMakeLists.txt
+
2
−
2
View file @
af24950c
...
...
@@ -11,8 +11,9 @@ target_link_libraries (logger_example CORSIKAunits CORSIKAlogging)
install
(
TARGETS logger_example DESTINATION share/examples
)
add_executable
(
stack_example stack_example.cc
)
target_compile_options
(
stack_example PRIVATE -g
)
# do not skip asserts
target_link_libraries
(
stack_example SuperStupidStack CORSIKAunits CORSIKAlogging
)
install
(
TARGETS stack_example DESTINATION share/
example
s
)
add_test
(
stack_example stack_
example
)
add_executable
(
cascade_example cascade_example.cc
)
target_link_libraries
(
cascade_example SuperStupidStack CORSIKAunits CORSIKAlogging
...
...
@@ -34,4 +35,3 @@ target_link_libraries (staticsequence_example
CORSIKAgeometry
CORSIKAlogging
)
install
(
TARGETS staticsequence_example DESTINATION share/examples
)
This diff is collapsed.
Click to expand it.
Documentation/Examples/stack_example.cc
+
11
−
6
View file @
af24950c
...
...
@@ -13,6 +13,7 @@
#include
<corsika/stack/super_stupid/SuperStupidStack.h>
#include
<iomanip>
#include
<iostream>
#include
<cassert>
using
namespace
std
;
// using namespace corsika::literals;
...
...
@@ -30,14 +31,18 @@ void fill(corsika::stack::super_stupid::SuperStupidStack& s) {
}
void
read
(
corsika
::
stack
::
super_stupid
::
SuperStupidStack
&
s
)
{
cout
<<
"found Stack with "
<<
s
.
GetSize
()
<<
" particles. "
<<
endl
;
EnergyType
Etot
;
assert
(
s
.
GetSize
()
==
11
);
// stack has 11 particles
EnergyType
total_energy
;
int
i
=
0
;
for
(
auto
&
p
:
s
)
{
Etot
+=
p
.
GetEnergy
();
cout
<<
"particle: "
<<
p
.
GetPID
()
<<
" with "
<<
p
.
GetEnergy
()
/
1
_GeV
<<
" GeV"
<<
endl
;
total_energy
+=
p
.
GetEnergy
();
// particles are electrons with 1.5 GeV energy times i
assert
(
p
.
GetPID
()
==
corsika
::
particles
::
Code
::
Electron
);
assert
(
p
.
GetEnergy
()
==
i
++
*
1
_GeV
);
}
cout
<<
"Etot="
<<
Etot
<<
" = "
<<
Etot
/
1
_GeV
<<
" GeV"
<<
endl
;
assert
(
total_energy
==
16.5
_GeV
);
}
int
main
()
{
...
...
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