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
08dd75ef
Commit
08dd75ef
authored
8 months ago
by
Felix Riehn
Browse files
Options
Downloads
Patches
Plain Diff
cleanup tests, add test for cross section bug
parent
c02a4eb1
No related branches found
No related tags found
1 merge request
!549
Draft: "Use Pythia for interactions"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/modules/testPythia8Interaction.inl
+33
-63
33 additions, 63 deletions
tests/modules/testPythia8Interaction.inl
with
33 additions
and
63 deletions
tests/modules/testPythia8Interaction.inl
+
33
−
63
View file @
08dd75ef
...
@@ -35,57 +35,18 @@ SECTION("pythia interaction configurations") {
...
@@ -35,57 +35,18 @@ SECTION("pythia interaction configurations") {
REQUIRE
(
collision
.
canInteract
(
Code
::
PiMinus
));
REQUIRE
(
collision
.
canInteract
(
Code
::
PiMinus
));
REQUIRE
(
collision
.
canInteract
(
Code
::
PiPlus
));
REQUIRE
(
collision
.
canInteract
(
Code
::
PiPlus
));
REQUIRE_FALSE
(
collision
.
canInteract
(
Code
::
Electron
));
REQUIRE_FALSE
(
collision
.
canInteract
(
Code
::
Electron
));
REQUIRE_FALSE
(
collision
.
canInteract
(
Code
::
MuPlus
));
}
}
corsika
::
units
::
si
::
HEPMomentumType
P0
=
400
_TeV
;
corsika
::
units
::
si
::
HEPMomentumType
P0
=
400
_TeV
;
SECTION
(
"pythia interaction
: proton
"
)
{
SECTION
(
"pythia interaction"
)
{
// test some combinations of valid target and projectile particles
// test some combinations of valid target and projectile particles
// so far only hadron-hadron and hadron-Nucleus is allowed
// so far only hadron-hadron and hadron-Nucleus is allowed
Code
const
target
=
GENERATE
(
Code
::
Proton
,
Code
::
Nitrogen
,
Code
::
Oxygen
,
Code
::
Argon
);
Code
const
projectile
=
Code
::
Proton
;
CORSIKA_LOG_INFO
(
"testing: {}-{}"
,
projectile
,
target
);
REQUIRE
(
collision
.
getCrossSection
(
projectile
,
target
,
{
calculate_total_energy
(
P0
,
get_mass
(
projectile
)),
{
rootCS
,
{
0
_eV
,
0
_eV
,
P0
}}},
{
get_mass
(
target
),
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}})
>
0
_mb
);
collision
.
doInteraction
(
view
,
projectile
,
target
,
{
corsika
::
calculate_total_energy
(
P0
,
get_mass
(
projectile
)),
{
rootCS
,
{
0
_eV
,
0
_eV
,
P0
}}},
{
get_mass
(
target
),
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}});
REQUIRE
(
view
.
getSize
()
>=
2
);
}
SECTION
(
"pythia interaction: PiPlus"
)
{
// test some combinations of valid target and projectile particles
//
Code
const
target
=
GENERATE
(
Code
::
Nitrogen
,
Code
::
Oxygen
,
Code
::
Argon
);
Code
const
target
=
GENERATE
(
Code
::
Nitrogen
,
Code
::
Oxygen
,
Code
::
Argon
);
Code
const
projectile
=
Code
::
PiPlus
;
Code
const
projectile
=
GENERATE
(
Code
::
Proton
,
Code
::
PiPlus
,
Code
::
KPlus
)
;
CORSIKA_LOG_INFO
(
"testing: {}-{}"
,
projectile
,
target
);
CORSIKA_LOG_INFO
(
"testing: {} - {}"
,
projectile
,
target
);
REQUIRE
(
collision
.
getCrossSection
(
projectile
,
target
,
{
calculate_total_energy
(
P0
,
get_mass
(
projectile
)),
{
rootCS
,
{
0
_eV
,
0
_eV
,
P0
}}},
{
get_mass
(
target
),
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}})
>
0
_mb
);
collision
.
doInteraction
(
view
,
projectile
,
target
,
{
corsika
::
calculate_total_energy
(
P0
,
get_mass
(
projectile
)),
{
rootCS
,
{
0
_eV
,
0
_eV
,
P0
}}},
{
get_mass
(
target
),
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}});
REQUIRE
(
view
.
getSize
()
>=
2
);
}
SECTION
(
"pythia interaction: KPlus"
)
{
// test some combinations of valid target and projectile particles
// so far only hadron-hadron and hadron-Nucleus is allowed
Code
const
target
=
GENERATE
(
Code
::
Nitrogen
,
Code
::
Oxygen
,
Code
::
Argon
);
Code
const
projectile
=
Code
::
KPlus
;
CORSIKA_LOG_INFO
(
"testing: {}-{}"
,
projectile
,
target
);
REQUIRE
(
REQUIRE
(
collision
.
getCrossSection
(
collision
.
getCrossSection
(
projectile
,
target
,
projectile
,
target
,
...
@@ -100,17 +61,12 @@ SECTION("pythia interaction: KPlus") {
...
@@ -100,17 +61,12 @@ SECTION("pythia interaction: KPlus") {
}
}
SECTION
(
"pythia interaction: angantyr fail"
)
{
SECTION
(
"pythia interaction: angantyr fail"
)
{
//
test some combinations of valid target and projectile particles
//
when initializing pythia with angantyr, kaon-proton or pion-proton interactions do
//
so far only hadron-hadron and hadron-Nucleus is allowed
//
not seem to work
Code
const
target
=
Code
::
Proton
;
Code
const
target
=
Code
::
Proton
;
Code
const
projectile
=
GENERATE
(
Code
::
KPlus
,
Code
::
PiPlus
);
Code
const
projectile
=
GENERATE
(
Code
::
KPlus
,
Code
::
PiPlus
);
CORSIKA_LOG_INFO
(
"testing: {}-{}"
,
projectile
,
target
);
CORSIKA_LOG_INFO
(
"testing: {}-{}"
,
projectile
,
target
);
REQUIRE
(
collision
.
getCrossSection
(
projectile
,
target
,
{
calculate_total_energy
(
P0
,
get_mass
(
projectile
)),
{
rootCS
,
{
0
_eV
,
0
_eV
,
P0
}}},
{
get_mass
(
target
),
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}})
>
0
_mb
);
REQUIRE_THROWS
(
REQUIRE_THROWS
(
collision
.
doInteraction
(
view
,
projectile
,
target
,
collision
.
doInteraction
(
view
,
projectile
,
target
,
...
@@ -119,6 +75,22 @@ SECTION("pythia interaction: angantyr fail") {
...
@@ -119,6 +75,22 @@ SECTION("pythia interaction: angantyr fail") {
{
get_mass
(
target
),
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}}));
{
get_mass
(
target
),
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}}));
}
}
SECTION
(
"pythia cross section bug"
)
{
// there is a problem with the interpolation of the energies.
// 80GeV lab should work!
Code
const
target
=
Code
::
Oxygen
;
Code
const
projectile
=
Code
::
Proton
;
corsika
::
units
::
si
::
HEPMomentumType
P1
=
80
_GeV
;
CORSIKA_LOG_INFO
(
"testing: {} - {}"
,
projectile
,
target
);
REQUIRE
(
collision
.
getCrossSection
(
projectile
,
target
,
{
calculate_total_energy
(
P1
,
get_mass
(
projectile
)),
{
rootCS
,
{
0
_eV
,
0
_eV
,
P1
}}},
{
get_mass
(
target
),
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}})
>
0
_mb
);
}
SECTION
(
"pythia too low energy"
)
{
SECTION
(
"pythia too low energy"
)
{
// this is a projectile neutron with very little energy
// this is a projectile neutron with very little energy
...
@@ -189,25 +161,23 @@ SECTION("pythia wrong projectile") {
...
@@ -189,25 +161,23 @@ SECTION("pythia wrong projectile") {
corsika
::
pythia8
::
Interaction
collision
;
corsika
::
pythia8
::
Interaction
collision
;
REQUIRE
(
collision
.
getCrossSectionInelEla
(
REQUIRE
(
collision
.
getCrossSectionInelEla
(
Code
::
Electron
,
Code
::
Electron
,
Code
::
Electron
,
Code
::
Electron
,
{
sqrt
(
static_pow
<
2
>
(
Electron
::
mass
)
+
static_pow
<
2
>
(
100
_GeV
)),
{
sqrt
(
static_pow
<
2
>
(
Electron
::
mass
)
+
static_pow
<
2
>
(
P0
)),
{
rootCS
,
{
0
_eV
,
0
_eV
,
100
_GeV
}}},
{
rootCS
,
{
0
_eV
,
0
_eV
,
P0
}}},
{
Proton
::
mass
,
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}})
==
std
::
tuple
{
0
_mb
,
0
_mb
});
{
Proton
::
mass
,
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}})
==
std
::
tuple
{
0
_mb
,
0
_mb
});
REQUIRE_THROWS
(
REQUIRE_THROWS
(
collision
.
doInteraction
(
collision
.
doInteraction
(
*
secViewPtr
,
Code
::
Helium
,
Code
::
Nitrogen
,
*
secViewPtr
,
Code
::
Helium
,
Code
::
Nitrogen
,
{
sqrt
(
static_pow
<
2
>
(
Helium
::
mass
)
+
static_pow
<
2
>
(
100
_GeV
)),
{
sqrt
(
static_pow
<
2
>
(
Helium
::
mass
)
+
static_pow
<
2
>
(
P0
)),
{
rootCS
,
{
0
_eV
,
0
_eV
,
P0
}}},
{
rootCS
,
{
0
_eV
,
0
_eV
,
100
_GeV
}}},
{
Nitrogen
::
mass
,
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}}));
{
Nitrogen
::
mass
,
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}}));
// gamma+p not possible
// gamma+p not possible
REQUIRE
(
REQUIRE
(
collision
.
getCrossSection
(
collision
.
getCrossSection
(
Code
::
H0
,
Code
::
Proton
,
Code
::
H0
,
Code
::
Proton
,
{
calculate_total_energy
(
P0
,
H0
::
mass
),
{
rootCS
,
{
0
_eV
,
0
_eV
,
P0
}}},
{
calculate_total_energy
(
100
_GeV
,
H0
::
mass
),
{
rootCS
,
{
0
_eV
,
0
_eV
,
100
_GeV
}}},
{
Proton
::
mass
,
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}})
==
CrossSectionType
::
zero
());
{
Proton
::
mass
,
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}})
==
CrossSectionType
::
zero
());
REQUIRE
(
collision
.
getCrossSectionInelEla
(
REQUIRE
(
collision
.
getCrossSectionInelEla
(
Code
::
Photon
,
Code
::
Proton
,
{
100
_GeV
,
{
rootCS
,
{
0
_eV
,
0
_eV
,
100
_GeV
}}},
Code
::
Photon
,
Code
::
Proton
,
{
P0
,
{
rootCS
,
{
0
_eV
,
0
_eV
,
P0
}}},
{
Proton
::
mass
,
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}})
==
{
Proton
::
mass
,
{
rootCS
,
{
0
_eV
,
0
_eV
,
0
_eV
}}})
==
std
::
make_tuple
(
CrossSectionType
::
zero
(),
CrossSectionType
::
zero
()));
std
::
make_tuple
(
CrossSectionType
::
zero
(),
CrossSectionType
::
zero
()));
}
}
\ No newline at end of file
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