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
b7fc8685
Commit
b7fc8685
authored
6 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
a few little changes
parent
341fa77c
No related branches found
No related tags found
1 merge request
!57
Cleanup
Pipeline
#197
failed
6 years ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Documentation/Examples/cascade_example.cc
+2
-0
2 additions, 0 deletions
Documentation/Examples/cascade_example.cc
Environment/NuclearComposition.h
+3
-0
3 additions, 0 deletions
Environment/NuclearComposition.h
Processes/Sibyll/Interaction.h
+28
-24
28 additions, 24 deletions
Processes/Sibyll/Interaction.h
with
33 additions
and
24 deletions
Documentation/Examples/cascade_example.cc
+
2
−
0
View file @
b7fc8685
...
@@ -229,6 +229,8 @@ int main() {
...
@@ -229,6 +229,8 @@ int main() {
// setup processes, decays and interactions
// setup processes, decays and interactions
tracking_line
::
TrackingLine
<
setup
::
Stack
>
tracking
(
env
);
tracking_line
::
TrackingLine
<
setup
::
Stack
>
tracking
(
env
);
stack_inspector
::
StackInspector
<
setup
::
Stack
>
p0
(
true
);
stack_inspector
::
StackInspector
<
setup
::
Stack
>
p0
(
true
);
corsika
::
random
::
RNGManager
::
GetInstance
().
RegisterRandomStream
(
"s_rndm"
);
corsika
::
process
::
sibyll
::
Interaction
sibyll
(
env
);
corsika
::
process
::
sibyll
::
Interaction
sibyll
(
env
);
corsika
::
process
::
sibyll
::
Decay
decay
;
corsika
::
process
::
sibyll
::
Decay
decay
;
ProcessCut
cut
(
8
_GeV
);
ProcessCut
cut
(
8
_GeV
);
...
...
This diff is collapsed.
Click to expand it.
Environment/NuclearComposition.h
+
3
−
0
View file @
b7fc8685
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#include
<corsika/particles/ParticleProperties.h>
#include
<corsika/particles/ParticleProperties.h>
#include
<numeric>
#include
<numeric>
#include
<stdexcept>
#include
<stdexcept>
#include
<cassert>
#include
<vector>
#include
<vector>
namespace
corsika
::
environment
{
namespace
corsika
::
environment
{
...
@@ -28,6 +29,8 @@ namespace corsika::environment {
...
@@ -28,6 +29,8 @@ namespace corsika::environment {
std
::
vector
<
float
>
pFractions
)
std
::
vector
<
float
>
pFractions
)
:
fNumberFractions
(
pFractions
)
:
fNumberFractions
(
pFractions
)
,
fComponents
(
pComponents
)
{
,
fComponents
(
pComponents
)
{
assert
(
pComponents
.
size
()
==
pFractions
.
size
());
auto
const
sumFractions
=
auto
const
sumFractions
=
std
::
accumulate
(
pFractions
.
cbegin
(),
pFractions
.
cend
(),
0.
f
);
std
::
accumulate
(
pFractions
.
cbegin
(),
pFractions
.
cend
(),
0.
f
);
...
...
This diff is collapsed.
Click to expand it.
Processes/Sibyll/Interaction.h
+
28
−
24
View file @
b7fc8685
...
@@ -45,16 +45,13 @@ namespace corsika::process::sibyll {
...
@@ -45,16 +45,13 @@ namespace corsika::process::sibyll {
using
std
::
cout
;
using
std
::
cout
;
using
std
::
endl
;
using
std
::
endl
;
corsika
::
random
::
RNGManager
&
rmng
=
corsika
::
random
::
RNGManager
::
GetInstance
();
rmng
.
RegisterRandomStream
(
"s_rndm"
);
// initialize Sibyll
// initialize Sibyll
sibyll_ini_
();
sibyll_ini_
();
}
}
std
::
tuple
<
corsika
::
units
::
si
::
CrossSectionType
,
int
>
GetCrossSection
(
std
::
tuple
<
corsika
::
units
::
si
::
CrossSectionType
,
int
>
GetCrossSection
(
const
corsika
::
particles
::
Code
&
BeamId
,
const
corsika
::
particles
::
Code
&
TargetId
,
const
corsika
::
particles
::
Code
BeamId
,
const
corsika
::
particles
::
Code
TargetId
,
const
corsika
::
units
::
si
::
HEPEnergyType
&
CoMenergy
)
{
const
corsika
::
units
::
si
::
HEPEnergyType
CoMenergy
)
{
using
namespace
corsika
::
units
::
si
;
using
namespace
corsika
::
units
::
si
;
double
sigProd
,
dummy
,
dum1
,
dum2
,
dum3
,
dum4
;
double
sigProd
,
dummy
,
dum1
,
dum2
,
dum3
,
dum4
;
double
dumdif
[
3
];
double
dumdif
[
3
];
...
@@ -67,19 +64,18 @@ namespace corsika::process::sibyll {
...
@@ -67,19 +64,18 @@ namespace corsika::process::sibyll {
"Sibyll target outside range. Only nuclei with A<18 are allowed."
);
"Sibyll target outside range. Only nuclei with A<18 are allowed."
);
sib_sigma_hnuc_
(
iBeam
,
iTarget
,
dEcm
,
sigProd
,
dummy
);
sib_sigma_hnuc_
(
iBeam
,
iTarget
,
dEcm
,
sigProd
,
dummy
);
return
std
::
make_tuple
(
sigProd
*
1
_mbarn
,
iTarget
);
return
std
::
make_tuple
(
sigProd
*
1
_mbarn
,
iTarget
);
}
else
if
(
TargetId
==
corsika
::
particles
::
Proton
::
GetCode
())
{
sib_sigma_hp_
(
iBeam
,
dEcm
,
dum1
,
dum2
,
sigProd
,
dumdif
,
dum3
,
dum4
);
return
std
::
make_tuple
(
sigProd
*
1
_mbarn
,
1
);
}
else
{
}
else
{
if
(
TargetId
==
corsika
::
particles
::
Proton
::
GetCode
())
{
// no interaction in sibyll possible, return infinite cross section? or throw?
sib_sigma_hp_
(
iBeam
,
dEcm
,
dum1
,
dum2
,
sigProd
,
dumdif
,
dum3
,
dum4
);
sigProd
=
std
::
numeric_limits
<
double
>::
infinity
();
return
std
::
make_tuple
(
sigProd
*
1
_mbarn
,
1
);
}
else
// no interaction in sibyll possible, return infinite cross section? or throw?
sigProd
=
std
::
numeric_limits
<
double
>::
infinity
();
return
std
::
make_tuple
(
sigProd
*
1
_mbarn
,
0
);
return
std
::
make_tuple
(
sigProd
*
1
_mbarn
,
0
);
}
}
}
}
template
<
typename
Particle
,
typename
Track
>
template
<
typename
Particle
,
typename
Track
>
corsika
::
units
::
si
::
GrammageType
GetInteractionLength
(
Particle
&
p
,
Track
&
)
{
corsika
::
units
::
si
::
GrammageType
GetInteractionLength
(
Particle
const
&
p
,
Track
&
)
{
using
namespace
corsika
::
units
;
using
namespace
corsika
::
units
;
using
namespace
corsika
::
units
::
si
;
using
namespace
corsika
::
units
::
si
;
...
@@ -105,11 +101,13 @@ namespace corsika::process::sibyll {
...
@@ -105,11 +101,13 @@ namespace corsika::process::sibyll {
// total momentum and energy
// total momentum and energy
HEPEnergyType
Elab
=
p
.
GetEnergy
()
+
nucleon_mass
;
HEPEnergyType
Elab
=
p
.
GetEnergy
()
+
nucleon_mass
;
MomentumVector
Ptot
(
rootCS
,
{
0.0
_GeV
,
0.0
_GeV
,
0.0
_GeV
});
MomentumVector
pTotLab
(
rootCS
,
{
0.0
_GeV
,
0.0
_GeV
,
0.0
_GeV
});
Ptot
+=
p
.
GetMomentum
();
pTotLab
+=
p
.
GetMomentum
();
Ptot
+=
pTarget
;
pTotLab
+=
pTarget
;
auto
const
pTotLabNorm
=
pTotLab
.
norm
();
// calculate cm. energy
// calculate cm. energy
const
HEPEnergyType
ECoM
=
sqrt
(
Elab
*
Elab
-
Ptot
.
squaredNorm
());
const
HEPEnergyType
ECoM
=
sqrt
(
(
Elab
+
pTotLabNorm
)
*
(
Elab
-
pTotLabNorm
));
// binomial for numerical accuracy
std
::
cout
<<
"Interaction: LambdaInt:
\n
"
std
::
cout
<<
"Interaction: LambdaInt:
\n
"
<<
" input energy: "
<<
p
.
GetEnergy
()
/
1
_GeV
<<
endl
<<
" input energy: "
<<
p
.
GetEnergy
()
/
1
_GeV
<<
endl
...
@@ -136,7 +134,7 @@ namespace corsika::process::sibyll {
...
@@ -136,7 +134,7 @@ namespace corsika::process::sibyll {
// get weights of components from environment/medium
// get weights of components from environment/medium
const
auto
w
=
mediumComposition
.
GetFractions
();
const
auto
w
=
mediumComposition
.
GetFractions
();
// loop over components in medium
// loop over components in medium
for
(
auto
targetId
:
mediumComposition
.
GetComponents
())
{
for
(
auto
const
targetId
:
mediumComposition
.
GetComponents
())
{
i
++
;
i
++
;
cout
<<
"Interaction: get interaction length for target: "
<<
targetId
<<
endl
;
cout
<<
"Interaction: get interaction length for target: "
<<
targetId
<<
endl
;
...
@@ -155,7 +153,7 @@ namespace corsika::process::sibyll {
...
@@ -155,7 +153,7 @@ namespace corsika::process::sibyll {
// calculate interaction length in medium
// calculate interaction length in medium
#warning check interaction length units
#warning check interaction length units
GrammageType
int_length
=
GrammageType
const
int_length
=
avgTargetMassNumber
*
corsika
::
units
::
constants
::
u
/
weightedProdCrossSection
;
avgTargetMassNumber
*
corsika
::
units
::
constants
::
u
/
weightedProdCrossSection
;
std
::
cout
<<
"Interaction: "
std
::
cout
<<
"Interaction: "
<<
"interaction length (g/cm2): "
<<
"interaction length (g/cm2): "
...
@@ -238,7 +236,7 @@ namespace corsika::process::sibyll {
...
@@ -238,7 +236,7 @@ namespace corsika::process::sibyll {
// sample target mass number
// sample target mass number
const
auto
currentNode
=
fEnvironment
.
GetUniverse
()
->
GetContainingNode
(
pOrig
);
const
auto
currentNode
=
fEnvironment
.
GetUniverse
()
->
GetContainingNode
(
pOrig
);
const
auto
mediumComposition
=
const
auto
&
mediumComposition
=
currentNode
->
GetModelProperties
().
GetNuclearComposition
();
currentNode
->
GetModelProperties
().
GetNuclearComposition
();
// get cross sections for target materials
// get cross sections for target materials
/*
/*
...
@@ -246,14 +244,18 @@ namespace corsika::process::sibyll {
...
@@ -246,14 +244,18 @@ namespace corsika::process::sibyll {
should be passed from GetInteractionLength if possible
should be passed from GetInteractionLength if possible
*/
*/
#warning reading interaction cross section again, should not be necessary
#warning reading interaction cross section again, should not be necessary
std
::
vector
<
si
::
CrossSectionType
>
cross_section_of_components
;
auto
const
&
compVec
=
mediumComposition
.
GetComponents
();
for
(
auto
targetId
:
mediumComposition
.
GetComponents
())
{
std
::
vector
<
si
::
CrossSectionType
>
cross_section_of_components
(
mediumComposition
.
GetComponents
().
size
());
for
(
size_t
i
=
0
;
i
<
compVec
.
size
();
++
i
)
{
auto
const
targetId
=
compVec
[
i
];
const
auto
[
sigProd
,
nNuc
]
=
GetCrossSection
(
corsikaBeamId
,
targetId
,
Ecm
);
const
auto
[
sigProd
,
nNuc
]
=
GetCrossSection
(
corsikaBeamId
,
targetId
,
Ecm
);
cross_section_of_components
.
push_back
(
sigProd
)
;
cross_section_of_components
[
i
]
=
sigProd
;
}
}
const
auto
targetCode
=
const
auto
targetCode
=
currentNode
->
GetModelProperties
().
SampleTarget
(
currentNode
->
GetModelProperties
().
GetTarget
(
cross_section_of_components
);
cross_section_of_components
,
fRNG
);
cout
<<
"Interaction: target selected: "
<<
targetCode
<<
endl
;
cout
<<
"Interaction: target selected: "
<<
targetCode
<<
endl
;
/*
/*
FOR NOW: allow nuclei with A<18 or protons only.
FOR NOW: allow nuclei with A<18 or protons only.
...
@@ -336,6 +338,8 @@ namespace corsika::process::sibyll {
...
@@ -336,6 +338,8 @@ namespace corsika::process::sibyll {
private
:
private
:
corsika
::
environment
::
Environment
const
&
fEnvironment
;
corsika
::
environment
::
Environment
const
&
fEnvironment
;
corsika
::
random
::
RNG
&
fRNG
=
corsika
::
random
::
RNGManager
::
GetInstance
().
GetRandomStream
(
"s_rndm"
);
};
};
}
// namespace corsika::process::sibyll
}
// namespace corsika::process::sibyll
...
...
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