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
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
Pranav Sampathkumar
corsika
Commits
e2641191
Commit
e2641191
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
24614536
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Documentation/Examples/cascade_example.cc
+3
-3
3 additions, 3 deletions
Documentation/Examples/cascade_example.cc
Processes/Sibyll/Interaction.h
+54
-17
54 additions, 17 deletions
Processes/Sibyll/Interaction.h
Processes/Sibyll/testSibyll.cc
+4
-4
4 additions, 4 deletions
Processes/Sibyll/testSibyll.cc
with
61 additions
and
24 deletions
Documentation/Examples/cascade_example.cc
+
3
−
3
View file @
e2641191
...
@@ -213,8 +213,8 @@ int main() {
...
@@ -213,8 +213,8 @@ int main() {
theMedium
->
SetModelProperties
<
MyHomogeneousModel
>
(
theMedium
->
SetModelProperties
<
MyHomogeneousModel
>
(
1
_kg
/
(
1
_m
*
1
_m
*
1
_m
),
1
_kg
/
(
1
_m
*
1
_m
*
1
_m
),
corsika
::
environment
::
NuclearComposition
(
corsika
::
environment
::
NuclearComposition
(
std
::
vector
<
corsika
::
particles
::
Code
>
{
corsika
::
particles
::
Code
::
Oxyge
n
},
std
::
vector
<
corsika
::
particles
::
Code
>
{
corsika
::
particles
::
Code
::
Nitrogen
,
corsika
::
particles
::
Code
::
Oxygen
,
corsika
::
particles
::
Code
::
Proto
n
},
std
::
vector
<
float
>
{
1.
}));
std
::
vector
<
float
>
{
0.5
,
0.3
,
0.2
}));
universe
.
AddChild
(
std
::
move
(
theMedium
));
universe
.
AddChild
(
std
::
move
(
theMedium
));
...
@@ -237,7 +237,7 @@ int main() {
...
@@ -237,7 +237,7 @@ int main() {
// setup particle stack, and add primary particle
// setup particle stack, and add primary particle
setup
::
Stack
stack
;
setup
::
Stack
stack
;
stack
.
Clear
();
stack
.
Clear
();
const
hep
::
EnergyType
E0
=
100
_
T
eV
;
const
hep
::
EnergyType
E0
=
100
_
G
eV
;
double
theta
=
0.
;
double
theta
=
0.
;
double
phi
=
0.
;
double
phi
=
0.
;
{
{
...
...
This diff is collapsed.
Click to expand it.
Processes/Sibyll/Interaction.h
+
54
−
17
View file @
e2641191
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include
<corsika/random/RNGManager.h>
#include
<corsika/random/RNGManager.h>
#include
<corsika/units/PhysicalUnits.h>
#include
<corsika/units/PhysicalUnits.h>
#include
<corsika/environment/Environment.h>
#include
<corsika/environment/Environment.h>
#include
<corsika/environment/NuclearComposition.h>
namespace
corsika
::
process
::
sibyll
{
namespace
corsika
::
process
::
sibyll
{
...
@@ -29,6 +30,7 @@ namespace corsika::process::sibyll {
...
@@ -29,6 +30,7 @@ namespace corsika::process::sibyll {
int
fCount
=
0
;
int
fCount
=
0
;
int
fNucCount
=
0
;
int
fNucCount
=
0
;
int
kTarget
=
0
;
public:
public:
Interaction
(
corsika
::
environment
::
Environment
const
&
env
)
:
fEnvironment
(
env
)
{
}
Interaction
(
corsika
::
environment
::
Environment
const
&
env
)
:
fEnvironment
(
env
)
{
}
~
Interaction
()
{
~
Interaction
()
{
...
@@ -44,7 +46,7 @@ namespace corsika::process::sibyll {
...
@@ -44,7 +46,7 @@ namespace corsika::process::sibyll {
corsika
::
random
::
RNGManager
&
rmng
=
corsika
::
random
::
RNGManager
::
GetInstance
();
corsika
::
random
::
RNGManager
&
rmng
=
corsika
::
random
::
RNGManager
::
GetInstance
();
rmng
.
RegisterRandomStream
(
"s_rndm"
);
rmng
.
RegisterRandomStream
(
"s_rndm"
);
// initialize Sibyll
// initialize Sibyll
sibyll_ini_
();
sibyll_ini_
();
}
}
...
@@ -70,21 +72,63 @@ namespace corsika::process::sibyll {
...
@@ -70,21 +72,63 @@ namespace corsika::process::sibyll {
const
int
kBeam
=
process
::
sibyll
::
GetSibyllXSCode
(
corsikaBeamId
);
const
int
kBeam
=
process
::
sibyll
::
GetSibyllXSCode
(
corsikaBeamId
);
const
bool
kInteraction
=
process
::
sibyll
::
CanInteract
(
corsikaBeamId
);
const
bool
kInteraction
=
process
::
sibyll
::
CanInteract
(
corsikaBeamId
);
// get target from environment
/*
/*
the target should be defined by the Environment,
the target should be defined by the Environment,
ideally as full particle object so that the four momenta
ideally as full particle object so that the four momenta
and the boosts can be defined..
and the boosts can be defined..
*/
*/
// target nuclei: A < 18
const
auto
currentNode
=
fEnvironment
.
GetUniverse
()
->
GetContainingNode
(
p
.
GetPosition
());
// FOR NOW: assume target is oxygen
const
auto
sample_target
=
[](
const
corsika
::
environment
::
NuclearComposition
&
comp
)
const
int
kTarget
=
corsika
::
particles
::
Oxygen
::
GetNucleusA
();
{
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
hep
::
MassType
nucleon_mass
=
0.5
*
(
corsika
::
particles
::
Proton
::
GetMass
()
+
const
hep
::
MassType
nucleon_mass
=
0.5
*
(
corsika
::
particles
::
Proton
::
GetMass
()
+
corsika
::
particles
::
Neutron
::
GetMass
());
corsika
::
particles
::
Neutron
::
GetMass
());
hep
::
EnergyType
Etot
=
p
.
GetEnergy
()
+
nucleon_mass
;
MomentumVector
Ptot
(
rootCS
,
{
0.0
_GeV
,
0.0
_GeV
,
0.0
_GeV
});
// FOR NOW: assume target is at rest
// FOR NOW: assume target is at rest
MomentumVector
pTarget
(
rootCS
,
{
0.0
_GeV
,
0.0
_GeV
,
0.0
_GeV
});
MomentumVector
pTarget
(
rootCS
,
{
0.0
_GeV
,
0.0
_GeV
,
0.0
_GeV
});
// total momentum and energy
hep
::
EnergyType
Etot
=
p
.
GetEnergy
()
+
nucleon_mass
;
MomentumVector
Ptot
(
rootCS
,
{
0.0
_GeV
,
0.0
_GeV
,
0.0
_GeV
});
Ptot
+=
p
.
GetMomentum
();
Ptot
+=
p
.
GetMomentum
();
Ptot
+=
pTarget
;
Ptot
+=
pTarget
;
// calculate cm. energy
// calculate cm. energy
...
@@ -175,17 +219,10 @@ namespace corsika::process::sibyll {
...
@@ -175,17 +219,10 @@ namespace corsika::process::sibyll {
const
CoordinateSystem
tempCS
=
rootCS
.
rotate
(
zAxis
,
phi
);
const
CoordinateSystem
tempCS
=
rootCS
.
rotate
(
zAxis
,
phi
);
const
CoordinateSystem
sibyllCS
=
tempCS
.
rotate
(
yAxis
,
theta
);
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()??
// redundant check if target code is valid
GetTargetMomentum() (zero in EAS)
if
(
kTarget
>
18
||
kTarget
==
0
)
*/
throw
std
::
runtime_error
(
"Interaction: Sibyll target outside range. Only nuclei with A<18 are allowed."
);
// FOR NOW: set target to oxygen
const
int
kTarget
=
corsika
::
particles
::
Oxygen
::
GetNucleusA
();
// env.GetTargetParticle().GetPID();
// FOR NOW: target is always at rest
// FOR NOW: target is always at rest
const
hep
::
MassType
nucleon_mass
=
0.5
*
(
corsika
::
particles
::
Proton
::
GetMass
()
+
const
hep
::
MassType
nucleon_mass
=
0.5
*
(
corsika
::
particles
::
Proton
::
GetMass
()
+
...
...
This diff is collapsed.
Click to expand it.
Processes/Sibyll/testSibyll.cc
+
4
−
4
View file @
e2641191
...
@@ -18,10 +18,6 @@
...
@@ -18,10 +18,6 @@
#include
<corsika/geometry/Point.h>
#include
<corsika/geometry/Point.h>
#include
<corsika/units/PhysicalUnits.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
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one
// cpp file
// cpp file
#include
<catch2/catch.hpp>
#include
<catch2/catch.hpp>
...
@@ -78,6 +74,10 @@ TEST_CASE("Sibyll", "[processes]") {
...
@@ -78,6 +74,10 @@ TEST_CASE("Sibyll", "[processes]") {
#include
<corsika/setup/SetupTrajectory.h>
#include
<corsika/setup/SetupTrajectory.h>
#include
<corsika/particles/ParticleProperties.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
::
si
;
using
namespace
corsika
::
units
;
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