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
6ac477d7
Commit
6ac477d7
authored
6 years ago
by
Felix Riehn
Browse files
Options
Downloads
Patches
Plain Diff
added sampling of target nucleus from environment in sibyll interface
parent
61691cdc
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Documentation/Examples/cascade_example.cc
+2
-2
2 additions, 2 deletions
Documentation/Examples/cascade_example.cc
Processes/Sibyll/Interaction.h
+56
-20
56 additions, 20 deletions
Processes/Sibyll/Interaction.h
Processes/Sibyll/testSibyll.cc
+4
-4
4 additions, 4 deletions
Processes/Sibyll/testSibyll.cc
with
62 additions
and
26 deletions
Documentation/Examples/cascade_example.cc
+
2
−
2
View file @
6ac477d7
...
...
@@ -216,8 +216,8 @@ int main() {
theMedium
->
SetModelProperties
<
MyHomogeneousModel
>
(
1
_kg
/
(
1
_m
*
1
_m
*
1
_m
),
corsika
::
environment
::
NuclearComposition
(
std
::
vector
<
corsika
::
particles
::
Code
>
{
corsika
::
particles
::
Code
::
Oxyge
n
},
std
::
vector
<
float
>
{
1.
}));
std
::
vector
<
corsika
::
particles
::
Code
>
{
corsika
::
particles
::
Code
::
Nitrogen
,
corsika
::
particles
::
Code
::
Oxygen
,
corsika
::
particles
::
Code
::
Proto
n
},
std
::
vector
<
float
>
{
0.5
,
0.3
,
0.2
}));
universe
.
AddChild
(
std
::
move
(
theMedium
));
...
...
This diff is collapsed.
Click to expand it.
Processes/Sibyll/Interaction.h
+
56
−
20
View file @
6ac477d7
...
...
@@ -22,6 +22,7 @@
#include
<corsika/random/RNGManager.h>
#include
<corsika/units/PhysicalUnits.h>
#include
<corsika/environment/Environment.h>
#include
<corsika/environment/NuclearComposition.h>
namespace
corsika
::
process
::
sibyll
{
...
...
@@ -29,6 +30,7 @@ namespace corsika::process::sibyll {
int
fCount
=
0
;
int
fNucCount
=
0
;
int
kTarget
=
0
;
public:
Interaction
(
corsika
::
environment
::
Environment
const
&
env
)
:
fEnvironment
(
env
)
{
}
~
Interaction
()
{
...
...
@@ -44,7 +46,7 @@ namespace corsika::process::sibyll {
corsika
::
random
::
RNGManager
&
rmng
=
corsika
::
random
::
RNGManager
::
GetInstance
();
rmng
.
RegisterRandomStream
(
"s_rndm"
);
// initialize Sibyll
sibyll_ini_
();
}
...
...
@@ -69,26 +71,67 @@ namespace corsika::process::sibyll {
const
int
kBeam
=
process
::
sibyll
::
GetSibyllXSCode
(
corsikaBeamId
);
const
bool
kInteraction
=
process
::
sibyll
::
CanInteract
(
corsikaBeamId
);
// get target from environment
/*
the target should be defined by the Environment,
ideally as full particle object so that the four momenta
and the boosts can be defined..
*/
// target nuclei: A < 18
// FOR NOW: assume target is oxygen
const
int
kTarget
=
corsika
::
particles
::
Oxygen
::
GetNucleusA
();
const
auto
currentNode
=
fEnvironment
.
GetUniverse
()
->
GetContainingNode
(
p
.
GetPosition
());
const
auto
sample_target
=
[](
const
corsika
::
environment
::
NuclearComposition
&
comp
)
{
double
prev
=
0.
;
std
::
vector
<
float
>
cumFrac
;
for
(
auto
f
:
comp
.
GetFractions
()){
cumFrac
.
push_back
(
prev
+
f
);
prev
=
cumFrac
.
back
();
}
int
a
=
1
;
const
double
r
=
s_rndm_
(
a
);
int
i
=
-
1
;
//cout << "rndm: " << r << endl;
for
(
auto
cf
:
cumFrac
){
++
i
;
//cout << "cf: " << cf << " " << comp.GetComponents()[i] << endl;
if
(
r
<
cf
)
break
;
}
return
comp
.
GetComponents
()[
i
];
};
const
auto
compo
=
currentNode
->
GetModelProperties
().
GetNuclearComposition
();
for
(
auto
tid
:
compo
.
GetComponents
()){
cout
<<
"Interaction: possible targets: "
<<
tid
<<
endl
;
}
const
auto
tg
=
sample_target
(
compo
);
cout
<<
"Interaction: target selected: "
<<
tg
<<
endl
;
// test if valid in sibyll
// FOR NOW: throw error if not, may need workaround for atmosphere, contains small argon fraction
if
(
IsNucleus
(
tg
))
kTarget
=
GetNucleusA
(
tg
);
else
if
(
tg
==
corsika
::
particles
::
Proton
::
GetCode
())
kTarget
=
1
;
else
throw
std
::
runtime_error
(
"Sibyll target particle unknown. Only nuclei with A<18 or protons are allowed."
);
cout
<<
"Interaction: kTarget: "
<<
kTarget
<<
endl
;
// redundant check
if
(
kTarget
>
18
||
kTarget
==
0
)
throw
std
::
runtime_error
(
"Sibyll target outside range. Only nuclei with A<18 are allowed."
);
const
HEPMassType
nucleon_mass
=
0.5
*
(
corsika
::
particles
::
Proton
::
GetMass
()
+
corsika
::
particles
::
Neutron
::
GetMass
());
HEPEnergyType
const
Elab
=
p
.
GetEnergy
();
HEPEnergyType
const
Etot
=
Elab
+
nucleon_mass
;
MomentumVector
Ptot
(
rootCS
,
{
0.0
_GeV
,
0.0
_GeV
,
0.0
_GeV
});
corsika
::
particles
::
Neutron
::
GetMass
());
// FOR NOW: assume target is at rest
MomentumVector
pTarget
(
rootCS
,
{
0.0
_GeV
,
0.0
_GeV
,
0.0
_GeV
});
// total momentum and energy
HEPEnergyType
Elab
=
p
.
GetEnergy
()
+
nucleon_mass
;
MomentumVector
Ptot
(
rootCS
,
{
0.0
_GeV
,
0.0
_GeV
,
0.0
_GeV
});
Ptot
+=
p
.
GetMomentum
();
Ptot
+=
pTarget
;
// calculate cm. energy
const
HEPEnergyType
sqs
=
sqrt
(
E
tot
*
E
tot
-
Ptot
.
squaredNorm
());
const
HEPEnergyType
sqs
=
sqrt
(
E
lab
*
E
lab
-
Ptot
.
squaredNorm
());
const
double
Ecm
=
sqs
/
1
_GeV
;
std
::
cout
<<
"Interaction: LambdaInt:
\n
"
...
...
@@ -172,17 +215,10 @@ namespace corsika::process::sibyll {
const
CoordinateSystem
tempCS
=
rootCS
.
rotate
(
zAxis
,
phi
);
const
CoordinateSystem
sibyllCS
=
tempCS
.
rotate
(
yAxis
,
theta
);
/*
the target should be defined by the Environment,
ideally as full particle object so that the four momenta
and the boosts can be defined..
here we need: GetTargetMassNumber() or GetTargetPID()??
GetTargetMomentum() (zero in EAS)
*/
// FOR NOW: set target to oxygen
const
int
kTarget
=
corsika
::
particles
::
Oxygen
::
GetNucleusA
();
// env.GetTargetParticle().GetPID();
// redundant check if target code is valid
if
(
kTarget
>
18
||
kTarget
==
0
)
throw
std
::
runtime_error
(
"Interaction: Sibyll target outside range. Only nuclei with A<18 are allowed."
);
// FOR NOW: target is always at rest
auto
constexpr
nucleon_mass
=
0.5
*
(
corsika
::
particles
::
Proton
::
GetMass
()
+
...
...
This diff is collapsed.
Click to expand it.
Processes/Sibyll/testSibyll.cc
+
4
−
4
View file @
6ac477d7
...
...
@@ -18,10 +18,6 @@
#include
<corsika/geometry/Point.h>
#include
<corsika/units/PhysicalUnits.h>
#include
<corsika/environment/Environment.h>
#include
<corsika/environment/HomogeneousMedium.h>
#include
<corsika/environment/NuclearComposition.h>
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one
// cpp file
#include
<catch2/catch.hpp>
...
...
@@ -78,6 +74,10 @@ TEST_CASE("Sibyll", "[processes]") {
#include
<corsika/setup/SetupTrajectory.h>
#include
<corsika/particles/ParticleProperties.h>
#include
<corsika/environment/Environment.h>
#include
<corsika/environment/HomogeneousMedium.h>
#include
<corsika/environment/NuclearComposition.h>
using
namespace
corsika
::
units
::
si
;
using
namespace
corsika
::
units
;
...
...
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