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
8105f130
Commit
8105f130
authored
4 years ago
by
ralfulrich
Browse files
Options
Downloads
Patches
Plain Diff
improve test a bit
parent
92e8492a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Processes/ParticleCut/testParticleCut.cc
+63
-29
63 additions, 29 deletions
Processes/ParticleCut/testParticleCut.cc
with
63 additions
and
29 deletions
Processes/ParticleCut/testParticleCut.cc
+
63
−
29
View file @
8105f130
...
...
@@ -37,15 +37,16 @@ TEST_CASE("ParticleCut", "[processes]") {
const
HEPEnergyType
Eabove
=
1
_TeV
;
const
HEPEnergyType
Ebelow
=
10
_GeV
;
// list of arbitrary particles
std
::
vector
<
particles
::
Code
>
particleList
=
{
const
std
::
vector
<
particles
::
Code
>
particleList
=
{
particles
::
Code
::
PiPlus
,
particles
::
Code
::
PiMinus
,
particles
::
Code
::
KPlus
,
particles
::
Code
::
KMinus
,
particles
::
Code
::
K0Long
,
particles
::
Code
::
K0Short
,
particles
::
Code
::
Electron
,
particles
::
Code
::
MuPlus
,
particles
::
Code
::
NuE
,
particles
::
Code
::
Neutron
};
particles
::
Code
::
Neutron
,
particles
::
Code
::
NuMu
};
SECTION
(
"cut on particle type: inv"
)
{
ParticleCut
cut
(
20
_GeV
,
false
,
true
);
CHECK
(
cut
.
GetECut
()
==
20
_GeV
);
// add primary particle to stack
auto
particle
=
stack
.
AddParticle
(
...
...
@@ -62,15 +63,15 @@ TEST_CASE("ParticleCut", "[processes]") {
// add secondaries, all with energies above the threshold
// only cut is by species
for
(
auto
proType
:
particleList
)
projectile
.
AddSecondary
(
std
::
tuple
<
particles
::
Code
,
units
::
si
::
HEPEnergyType
,
corsika
::
stack
::
MomentumVector
,
geometry
::
Point
,
units
::
si
::
TimeType
>
{
projectile
.
AddSecondary
(
std
::
make_tuple
(
proType
,
Eabove
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
0
_ns
}
);
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
0
_ns
)
);
cut
.
DoSecondaries
(
view
);
CHECK
(
view
.
getEntries
()
==
9
);
CHECK
(
cut
.
GetNumberInvParticles
()
==
2
);
CHECK
(
cut
.
GetInvEnergy
()
/
1
_GeV
==
2000
);
}
SECTION
(
"cut on particle type: em"
)
{
...
...
@@ -79,11 +80,9 @@ TEST_CASE("ParticleCut", "[processes]") {
// add primary particle to stack
auto
particle
=
stack
.
AddParticle
(
std
::
tuple
<
particles
::
Code
,
units
::
si
::
HEPEnergyType
,
corsika
::
stack
::
MomentumVector
,
geometry
::
Point
,
units
::
si
::
TimeType
>
{
particles
::
Code
::
Proton
,
Eabove
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
0
_ns
});
std
::
make_tuple
(
particles
::
Code
::
Proton
,
Eabove
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
0
_ns
));
// view on secondary particles
corsika
::
setup
::
StackView
view
(
particle
);
// ref. to primary particle through the secondary view.
...
...
@@ -91,16 +90,16 @@ TEST_CASE("ParticleCut", "[processes]") {
auto
projectile
=
view
.
GetProjectile
();
// add secondaries, all with energies above the threshold
// only cut is by species
for
(
auto
proType
:
particleList
)
projectile
.
AddSecondary
(
std
::
tuple
<
particles
::
Code
,
units
::
si
::
HEPEnergyType
,
corsika
::
stack
::
MomentumVector
,
geometry
::
Point
,
units
::
si
::
TimeType
>
{
for
(
auto
proType
:
particleList
)
{
projectile
.
AddSecondary
(
std
::
make_tuple
(
proType
,
Eabove
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
0
_ns
}
);
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
0
_ns
)
);
}
cut
.
DoSecondaries
(
view
);
CHECK
(
view
.
getEntries
()
==
9
);
CHECK
(
view
.
getEntries
()
==
10
);
CHECK
(
cut
.
GetNumberEmParticles
()
==
1
);
CHECK
(
cut
.
GetEmEnergy
()
/
1
_GeV
==
1000
);
}
SECTION
(
"cut low energy"
)
{
...
...
@@ -108,11 +107,9 @@ TEST_CASE("ParticleCut", "[processes]") {
// add primary particle to stack
auto
particle
=
stack
.
AddParticle
(
std
::
tuple
<
particles
::
Code
,
units
::
si
::
HEPEnergyType
,
corsika
::
stack
::
MomentumVector
,
geometry
::
Point
,
units
::
si
::
TimeType
>
{
particles
::
Code
::
Proton
,
Eabove
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
0
_ns
});
std
::
make_tuple
(
particles
::
Code
::
Proton
,
Eabove
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
0
_ns
));
// view on secondary particles
setup
::
StackView
view
{
particle
};
// ref. to primary particle through the secondary view.
...
...
@@ -121,15 +118,52 @@ TEST_CASE("ParticleCut", "[processes]") {
// add secondaries, all with energies below the threshold
// only cut is by species
for
(
auto
proType
:
particleList
)
projectile
.
AddSecondary
(
std
::
tuple
<
particles
::
Code
,
units
::
si
::
HEPEnergyType
,
corsika
::
stack
::
MomentumVector
,
geometry
::
Point
,
units
::
si
::
TimeType
>
{
projectile
.
AddSecondary
(
std
::
make_tuple
(
proType
,
Ebelow
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
0
_ns
});
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
0
_ns
));
unsigned
short
A
=
18
;
unsigned
short
Z
=
8
;
projectile
.
AddSecondary
(
std
::
make_tuple
(
particles
::
Code
::
Nucleus
,
Eabove
*
A
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
0
_ns
,
A
,
Z
));
projectile
.
AddSecondary
(
std
::
make_tuple
(
particles
::
Code
::
Nucleus
,
Ebelow
*
A
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
0
_ns
,
A
,
Z
));
cut
.
DoSecondaries
(
view
);
CHECK
(
view
.
getEntries
()
==
1
);
CHECK
(
view
.
getSize
()
==
13
);
}
SECTION
(
"cut on time"
)
{
ParticleCut
cut
(
20
_GeV
,
false
,
false
);
const
TimeType
too_late
=
1
_s
;
// add primary particle to stack
auto
particle
=
stack
.
AddParticle
(
std
::
make_tuple
(
particles
::
Code
::
Proton
,
Eabove
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
1
_ns
));
// view on secondary particles
corsika
::
setup
::
StackView
view
(
particle
);
// ref. to primary particle through the secondary view.
// only this way the secondary view is populated
auto
projectile
=
view
.
GetProjectile
();
// add secondaries, all with energies above the threshold
// only cut is by species
for
(
auto
proType
:
particleList
)
{
projectile
.
AddSecondary
(
std
::
make_tuple
(
proType
,
Eabove
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
too_late
));
}
cut
.
DoSecondaries
(
view
);
REQUIRE
(
view
.
getEntries
()
==
0
);
REQUIRE
(
view
.
getSize
()
==
10
);
CHECK
(
view
.
getEntries
()
==
0
);
CHECK
(
cut
.
GetCutEnergy
()
/
1
_GeV
==
11000
);
cut
.
Reset
();
CHECK
(
cut
.
GetCutEnergy
()
==
0
_GeV
);
}
}
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