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
24bc10e4
Commit
24bc10e4
authored
6 years ago
by
Felix Riehn
Browse files
Options
Downloads
Patches
Plain Diff
read target components from environment
parent
6552cb6e
No related branches found
No related tags found
1 merge request
!84
Resolve "generalize nuclear cross sections"
Pipeline
#342
passed
6 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Documentation/Examples/cascade_example.cc
+4
-2
4 additions, 2 deletions
Documentation/Examples/cascade_example.cc
Processes/Sibyll/NuclearInteraction.cc
+25
-6
25 additions, 6 deletions
Processes/Sibyll/NuclearInteraction.cc
with
29 additions
and
8 deletions
Documentation/Examples/cascade_example.cc
+
4
−
2
View file @
24bc10e4
...
...
@@ -252,8 +252,10 @@ int main() {
if
(
auto
const
mp
=
vtn
.
GetModelPropertiesPtr
();
mp
!=
nullptr
)
{
// do not query Universe it self, it has no ModelProperties
auto
const
&
comp
=
mp
->
GetNuclearComposition
().
GetComponents
();
std
::
for_each
(
comp
.
cbegin
(),
comp
.
cend
(),
[
&
](
particles
::
Code
c
)
{
allElementsInUniverse
.
insert
(
c
);
});
for
(
auto
const
c
:
comp
)
allElementsInUniverse
.
insert
(
c
);
// std::for_each(comp.cbegin(), comp.cend(),
// [&](particles::Code c) { allElementsInUniverse.insert(c); });
}
};
universe
.
walk
(
collectElements
);
...
...
This diff is collapsed.
Click to expand it.
Processes/Sibyll/NuclearInteraction.cc
+
25
−
6
View file @
24bc10e4
...
...
@@ -22,6 +22,8 @@
#include
<corsika/setup/SetupStack.h>
#include
<corsika/setup/SetupTrajectory.h>
#include
<set>
using
std
::
cout
;
using
std
::
endl
;
using
std
::
tuple
;
...
...
@@ -69,15 +71,31 @@ namespace corsika::process::sibyll {
{
using
namespace
corsika
::
particles
;
using
namespace
units
::
si
;
// TODO: get composition of target volumes from environment
// now: hard coded list for air
constexpr
Code
target_nuclei
[]
=
{
Code
::
Oxygen
,
Code
::
Nitrogen
};
auto
&
universe
=
*
(
fEnvironment
.
GetUniverse
());
auto
const
allElementsInUniverse
=
std
::
invoke
([
&
]()
{
std
::
set
<
particles
::
Code
>
allElementsInUniverse
;
auto
collectElements
=
[
&
](
auto
&
vtn
)
{
if
(
auto
const
mp
=
vtn
.
GetModelPropertiesPtr
();
mp
!=
nullptr
)
{
// do not query Universe it self, it has no ModelProperties
auto
const
&
comp
=
mp
->
GetNuclearComposition
().
GetComponents
();
for
(
auto
const
c
:
comp
)
allElementsInUniverse
.
insert
(
c
);
// std::for_each(comp.cbegin(), comp.cend(),
// [&](particles::Code c) { allElementsInUniverse.insert(c); });
}
};
universe
.
walk
(
collectElements
);
return
allElementsInUniverse
;
});
cout
<<
"NuclearInteraction: initializing nuclear cross sections..."
<<
endl
;
// loop over target components, at most 4!!
int
k
=-
1
;
for
(
auto
&
ptarg
:
target_nuclei
){
for
(
auto
&
ptarg
:
allElementsInUniverse
){
++
k
;
cout
<<
"NuclearInteraction: init target component: "
<<
ptarg
<<
endl
;
const
int
ib
=
GetNucleusA
(
ptarg
);
...
...
@@ -109,7 +127,7 @@ namespace corsika::process::sibyll {
}
}
cout
<<
"NuclearInteraction: cross sections for "
<<
fTargetComponentsIndex
.
size
()
<<
" components initialized!"
<<
endl
;
for
(
auto
&
ptarg
:
target_nuclei
){
for
(
auto
&
ptarg
:
allElementsInUniverse
){
cout
<<
"cross section table: "
<<
ptarg
<<
endl
;
PrintCrossSectionTable
(
ptarg
);
}
...
...
@@ -120,7 +138,8 @@ namespace corsika::process::sibyll {
{
using
namespace
corsika
::
particles
;
const
int
k
=
fTargetComponentsIndex
.
at
(
pCode
);
Code
pNuclei
[]
=
{
Code
::
Helium
,
Code
::
Lithium7
,
Code
::
Oxygen
,
Code
::
Neon
,
Code
::
Argon
,
Code
::
Iron
};
Code
pNuclei
[]
=
{
Code
::
Helium
,
Code
::
Lithium7
,
Code
::
Oxygen
,
Code
::
Neon
,
Code
::
Argon
,
Code
::
Iron
};
cout
<<
"en/A "
;
for
(
auto
&
j
:
pNuclei
)
cout
<<
std
::
setw
(
9
)
<<
j
;
...
...
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