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
4900e746
Commit
4900e746
authored
4 years ago
by
ralfulrich
Committed by
Ralf Ulrich
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
testParticleCut
parent
6277b744
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Processes/ParticleCut/ParticleCut.cc
+2
-0
2 additions, 0 deletions
Processes/ParticleCut/ParticleCut.cc
Processes/ParticleCut/testParticleCut.cc
+47
-20
47 additions, 20 deletions
Processes/ParticleCut/testParticleCut.cc
with
49 additions
and
20 deletions
Processes/ParticleCut/ParticleCut.cc
+
2
−
0
View file @
4900e746
...
...
@@ -119,6 +119,7 @@ namespace corsika::process {
fEnergy
=
0
_GeV
;
}
// LCOV_EXCL_START
void
ParticleCut
::
ShowResults
()
const
{
C8LOG_INFO
(
fmt
::
format
(
" ******************************
\n
"
...
...
@@ -131,6 +132,7 @@ namespace corsika::process {
" ******************************"
,
fEmEnergy
/
1
_GeV
,
uiEmCount
,
fInvEnergy
/
1
_GeV
,
uiInvCount
,
fEnergy
/
1
_GeV
));
}
// LCOV_EXCL_STOP
void
ParticleCut
::
Reset
()
{
fEmEnergy
=
0
_GeV
;
...
...
This diff is collapsed.
Click to expand it.
Processes/ParticleCut/testParticleCut.cc
+
47
−
20
View file @
4900e746
...
...
@@ -16,6 +16,7 @@
#include
<corsika/utl/CorsikaFenv.h>
#include
<corsika/setup/SetupStack.h>
#include
<corsika/setup/SetupTrajectory.h>
#include
<catch2/catch.hpp>
...
...
@@ -44,6 +45,9 @@ TEST_CASE("ParticleCut", "[processes]") {
particles
::
Code
::
Electron
,
particles
::
Code
::
MuPlus
,
particles
::
Code
::
NuE
,
particles
::
Code
::
Neutron
,
particles
::
Code
::
NuMu
};
// common staring point
const
geometry
::
Point
point0
(
rootCS
,
0
_m
,
0
_m
,
0
_m
);
SECTION
(
"cut on particle type: inv"
)
{
ParticleCut
cut
(
20
_GeV
,
false
,
true
);
...
...
@@ -54,8 +58,7 @@ TEST_CASE("ParticleCut", "[processes]") {
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
});
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
point0
,
0
_ns
});
// view on secondary particles
setup
::
StackView
view
(
particle
);
// ref. to primary particle through the secondary view.
...
...
@@ -66,7 +69,9 @@ TEST_CASE("ParticleCut", "[processes]") {
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
));
point0
,
0
_ns
));
CHECK
(
view
.
getEntries
()
==
11
);
CHECK
(
stack
.
getEntries
()
==
12
);
cut
.
DoSecondaries
(
view
);
...
...
@@ -80,10 +85,9 @@ TEST_CASE("ParticleCut", "[processes]") {
ParticleCut
cut
(
20
_GeV
,
true
,
false
);
// 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
),
0
_ns
));
auto
particle
=
stack
.
AddParticle
(
std
::
make_tuple
(
particles
::
Code
::
Proton
,
Eabove
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
point0
,
0
_ns
));
// view on secondary particles
corsika
::
setup
::
StackView
view
(
particle
);
// ref. to primary particle through the secondary view.
...
...
@@ -94,7 +98,7 @@ TEST_CASE("ParticleCut", "[processes]") {
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
));
point0
,
0
_ns
));
}
cut
.
DoSecondaries
(
view
);
...
...
@@ -107,10 +111,9 @@ TEST_CASE("ParticleCut", "[processes]") {
ParticleCut
cut
(
20
_GeV
,
true
,
true
);
// 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
),
0
_ns
));
auto
particle
=
stack
.
AddParticle
(
std
::
make_tuple
(
particles
::
Code
::
Proton
,
Eabove
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
point0
,
0
_ns
));
// view on secondary particles
setup
::
StackView
view
{
particle
};
// ref. to primary particle through the secondary view.
...
...
@@ -121,17 +124,17 @@ TEST_CASE("ParticleCut", "[processes]") {
for
(
auto
proType
:
particleList
)
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
));
point0
,
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
));
point0
,
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
));
point0
,
0
_ns
,
A
,
Z
));
cut
.
DoSecondaries
(
view
);
...
...
@@ -144,10 +147,9 @@ TEST_CASE("ParticleCut", "[processes]") {
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
));
auto
particle
=
stack
.
AddParticle
(
std
::
make_tuple
(
particles
::
Code
::
Proton
,
Eabove
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
point0
,
1
_ns
));
// view on secondary particles
corsika
::
setup
::
StackView
view
(
particle
);
// ref. to primary particle through the secondary view.
...
...
@@ -158,7 +160,7 @@ TEST_CASE("ParticleCut", "[processes]") {
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
));
point0
,
too_late
));
}
cut
.
DoSecondaries
(
view
);
...
...
@@ -167,4 +169,29 @@ TEST_CASE("ParticleCut", "[processes]") {
cut
.
Reset
();
CHECK
(
cut
.
GetCutEnergy
()
==
0
_GeV
);
}
corsika
::
setup
::
Trajectory
const
track
{
geometry
::
Line
{
point0
,
geometry
::
Vector
<
units
::
si
::
SpeedType
::
dimension_type
>
{
rootCS
,
{
0
_m
/
second
,
0
_m
/
second
,
-
units
::
constants
::
c
}}},
12
_m
/
units
::
constants
::
c
};
SECTION
(
"cut on DoContinous, just invisibles"
)
{
ParticleCut
cut
(
20
_GeV
,
false
,
true
);
CHECK
(
cut
.
GetECut
()
==
20
_GeV
);
// add particles, all with energies above the threshold
// only cut is by species
for
(
auto
proType
:
particleList
)
{
auto
particle
=
stack
.
AddParticle
(
std
::
make_tuple
(
proType
,
Eabove
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
0
_GeV
}),
point0
,
0
_ns
));
cut
.
DoContinuous
(
particle
,
track
);
}
CHECK
(
stack
.
getEntries
()
==
9
);
CHECK
(
cut
.
GetNumberInvParticles
()
==
2
);
CHECK
(
cut
.
GetInvEnergy
()
/
1
_GeV
==
2000
);
}
}
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