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
a6166bbb
Commit
a6166bbb
authored
5 years ago
by
felix@home
Browse files
Options
Downloads
Patches
Plain Diff
added ParticleCut test
parent
4dfeb6cf
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
+57
-20
57 additions, 20 deletions
Processes/ParticleCut/testParticleCut.cc
with
57 additions
and
20 deletions
Processes/ParticleCut/testParticleCut.cc
+
57
−
20
View file @
a6166bbb
...
@@ -34,39 +34,76 @@ TEST_CASE("ParticleCut", "[processes]") {
...
@@ -34,39 +34,76 @@ TEST_CASE("ParticleCut", "[processes]") {
using
EnvType
=
environment
::
Environment
<
setup
::
IEnvironmentModel
>
;
using
EnvType
=
environment
::
Environment
<
setup
::
IEnvironmentModel
>
;
EnvType
env
;
EnvType
env
;
const
geometry
::
CoordinateSystem
&
rootCS
=
env
.
GetCoordinateSystem
();
const
geometry
::
CoordinateSystem
&
rootCS
=
env
.
GetCoordinateSystem
();
SECTION
(
"cut"
)
{
// setup empty particle stack
setup
::
Stack
stack
;
stack
.
Clear
();
// two energies
const
HEPEnergyType
Eabove
=
1
_TeV
;
const
HEPEnergyType
Ebelow
=
10
_GeV
;
// list of arbitrary particles
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
};
SECTION
(
"cut invisible"
)
{
ParticleCut
cut
(
20
_GeV
);
ParticleCut
cut
(
20
_GeV
);
// setup particle stack, and add primary particle
// add primary particle to stack
setup
::
Stack
stack
;
stack
.
Clear
();
const
HEPEnergyType
Eabove
=
1
_TeV
;
const
HEPEnergyType
Ebelow
=
10
_GeV
;
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
};
auto
particle
=
stack
.
AddParticle
(
auto
particle
=
stack
.
AddParticle
(
std
::
tuple
<
particles
::
Code
,
units
::
si
::
HEPEnergyType
,
std
::
tuple
<
particles
::
Code
,
units
::
si
::
HEPEnergyType
,
corsika
::
stack
::
MomentumVector
,
geometry
::
Point
,
units
::
si
::
TimeType
>
{
corsika
::
stack
::
MomentumVector
,
geometry
::
Point
,
units
::
si
::
TimeType
>
{
particles
::
Code
::
Proton
,
Eabove
,
particles
::
Code
::
Proton
,
Eabove
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
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
});
// view on secondary particles
corsika
::
stack
::
SecondaryView
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
)
for
(
auto
proType
:
particleList
)
projectile
.
AddSecondary
(
std
::
tuple
<
particles
::
Code
,
units
::
si
::
HEPEnergyType
,
particle
.
AddSecondary
(
std
::
tuple
<
particles
::
Code
,
units
::
si
::
HEPEnergyType
,
corsika
::
stack
::
MomentumVector
,
geometry
::
Point
,
corsika
::
stack
::
MomentumVector
,
geometry
::
Point
,
units
::
si
::
TimeType
>
{
units
::
si
::
TimeType
>
{
proType
,
Eabove
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
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
});
// auto secViewPtr = corsika::stack::SecondaryView(particle);
cut
.
DoSecondaries
(
view
);
REQUIRE
(
view
.
GetSize
()
==
6
);
}
SECTION
(
"cut low energy"
)
{
ParticleCut
cut
(
20
_GeV
);
// 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
});
// view on secondary particles
corsika
::
stack
::
SecondaryView
view
(
particle
);
corsika
::
stack
::
SecondaryView
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 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
>
{
proType
,
Ebelow
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
geometry
::
Point
(
rootCS
,
0
_m
,
0
_m
,
0
_m
),
0
_ns
});
cut
.
DoSecondaries
(
view
);
cut
.
DoSecondaries
(
view
);
REQUIRE
(
stack
.
GetSize
()
==
1
);
REQUIRE
(
view
.
GetSize
()
==
0
);
}
}
}
}
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