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
d7da841f
Commit
d7da841f
authored
5 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
IsHadron & GetNucleusA/Z for Code::Nucleus
parent
e4dca006
No related branches found
No related tags found
1 merge request
!146
Resolve "cascade_example with nucleus primary doesn't work"
Pipeline
#837
passed
5 years ago
Stage: config
Stage: build
Stage: test
Stage: optional
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/Particles/ParticleProperties.h
+9
-1
9 additions, 1 deletion
Framework/Particles/ParticleProperties.h
Framework/Particles/testParticles.cc
+4
-1
4 additions, 1 deletion
Framework/Particles/testParticles.cc
with
13 additions
and
2 deletions
Framework/Particles/ParticleProperties.h
+
9
−
1
View file @
d7da841f
...
@@ -120,14 +120,22 @@ namespace corsika::particles {
...
@@ -120,14 +120,22 @@ namespace corsika::particles {
}
}
int
constexpr
GetNucleusA
(
Code
const
p
)
{
int
constexpr
GetNucleusA
(
Code
const
p
)
{
if
(
p
==
Code
::
Nucleus
)
{
throw
std
::
runtime_error
(
"GetNucleusA(Code::Nucleus) is impossible!"
);
}
return
detail
::
nucleusA
[
static_cast
<
CodeIntType
>
(
p
)];
return
detail
::
nucleusA
[
static_cast
<
CodeIntType
>
(
p
)];
}
}
int
constexpr
GetNucleusZ
(
Code
const
p
)
{
int
constexpr
GetNucleusZ
(
Code
const
p
)
{
if
(
p
==
Code
::
Nucleus
)
{
throw
std
::
runtime_error
(
"GetNucleusZ(Code::Nucleus) is impossible!"
);
}
return
detail
::
nucleusZ
[
static_cast
<
CodeIntType
>
(
p
)];
return
detail
::
nucleusZ
[
static_cast
<
CodeIntType
>
(
p
)];
}
}
bool
constexpr
IsNucleus
(
Code
const
p
)
{
return
GetNucleusA
(
p
)
!=
0
;
}
bool
constexpr
IsNucleus
(
Code
const
p
)
{
return
(
p
==
Code
::
Nucleus
)
||
(
GetNucleusA
(
p
)
!=
0
);
}
/**
/**
* the output operator for humand-readable particle codes
* the output operator for humand-readable particle codes
...
...
This diff is collapsed.
Click to expand it.
Framework/Particles/testParticles.cc
+
4
−
1
View file @
d7da841f
...
@@ -102,6 +102,7 @@ TEST_CASE("ParticleProperties", "[Particles]") {
...
@@ -102,6 +102,7 @@ TEST_CASE("ParticleProperties", "[Particles]") {
REQUIRE
(
IsHadron
(
Code
::
Proton
));
REQUIRE
(
IsHadron
(
Code
::
Proton
));
REQUIRE
(
IsHadron
(
Code
::
PiPlus
));
REQUIRE
(
IsHadron
(
Code
::
PiPlus
));
REQUIRE
(
IsHadron
(
Code
::
Oxygen
));
REQUIRE
(
IsHadron
(
Code
::
Oxygen
));
REQUIRE
(
IsHadron
(
Code
::
Nucleus
));
}
}
SECTION
(
"Particle groups: muons"
)
{
SECTION
(
"Particle groups: muons"
)
{
...
@@ -124,7 +125,6 @@ TEST_CASE("ParticleProperties", "[Particles]") {
...
@@ -124,7 +125,6 @@ TEST_CASE("ParticleProperties", "[Particles]") {
REQUIRE_FALSE
(
IsNeutrino
(
Code
::
Oxygen
));
REQUIRE_FALSE
(
IsNeutrino
(
Code
::
Oxygen
));
}
}
SECTION
(
"Nuclei"
)
{
SECTION
(
"Nuclei"
)
{
REQUIRE_FALSE
(
IsNucleus
(
Code
::
Gamma
));
REQUIRE_FALSE
(
IsNucleus
(
Code
::
Gamma
));
REQUIRE
(
IsNucleus
(
Code
::
Argon
));
REQUIRE
(
IsNucleus
(
Code
::
Argon
));
...
@@ -137,5 +137,8 @@ TEST_CASE("ParticleProperties", "[Particles]") {
...
@@ -137,5 +137,8 @@ TEST_CASE("ParticleProperties", "[Particles]") {
REQUIRE
(
GetNucleusA
(
Code
::
Tritium
)
==
3
);
REQUIRE
(
GetNucleusA
(
Code
::
Tritium
)
==
3
);
REQUIRE
(
Hydrogen
::
GetNucleusZ
()
==
1
);
REQUIRE
(
Hydrogen
::
GetNucleusZ
()
==
1
);
REQUIRE
(
Tritium
::
GetNucleusA
()
==
3
);
REQUIRE
(
Tritium
::
GetNucleusA
()
==
3
);
REQUIRE_THROWS
(
GetNucleusA
(
Code
::
Nucleus
));
REQUIRE_THROWS
(
GetNucleusZ
(
Code
::
Nucleus
));
}
}
}
}
This diff is collapsed.
Click to expand it.
Felix Riehn
@riehn
mentioned in commit
ddae3bdf
·
5 years ago
mentioned in commit
ddae3bdf
mentioned in commit ddae3bdf4484d075e22018e5bcfdb599a94ce708
Toggle commit list
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