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
c65a84c8
Commit
c65a84c8
authored
5 years ago
by
ralfulrich
Committed by
Maximilian Reininghaus
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
added unit test for ObservationPlane
parent
b18d0dc0
No related branches found
No related tags found
1 merge request
!133
added ObservationPlane
Pipeline
#806
passed with warnings
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
Processes/ObservationPlane/CMakeLists.txt
+7
-7
7 additions, 7 deletions
Processes/ObservationPlane/CMakeLists.txt
Processes/ObservationPlane/testObservationPlane.cc
+96
-0
96 additions, 0 deletions
Processes/ObservationPlane/testObservationPlane.cc
with
103 additions
and
7 deletions
Processes/ObservationPlane/CMakeLists.txt
+
7
−
7
View file @
c65a84c8
...
@@ -34,11 +34,11 @@ install (FILES ${MODEL_HEADERS} DESTINATION include/${MODEL_NAMESPACE})
...
@@ -34,11 +34,11 @@ install (FILES ${MODEL_HEADERS} DESTINATION include/${MODEL_NAMESPACE})
# --------------------
# --------------------
# code unit testing
# code unit testing
#
CORSIKA_ADD_TEST(testObservationPlane)
CORSIKA_ADD_TEST
(
testObservationPlane
)
#
target_link_libraries (
target_link_libraries
(
#
testObservationPlane
testObservationPlane
#
ProcessObservationPlane
ProcessObservationPlane
#
CORSIKAstackinterface
CORSIKAstackinterface
#
CORSIKAthirdparty # for catch2
CORSIKAthirdparty
# for catch2
#
)
)
This diff is collapsed.
Click to expand it.
Processes/ObservationPlane/testObservationPlane.cc
0 → 100644
+
96
−
0
View file @
c65a84c8
/*
* (c) Copyright 2019 CORSIKA Project, corsika-project@lists.kit.edu
*
* See file AUTHORS for a list of contributors.
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one
// cpp file
#include
<catch2/catch.hpp>
#include
<corsika/process/observation_plane/ObservationPlane.h>
#include
<corsika/geometry/Point.h>
#include
<corsika/geometry/RootCoordinateSystem.h>
#include
<corsika/geometry/Vector.h>
#include
<corsika/particles/ParticleProperties.h>
#include
<corsika/units/PhysicalUnits.h>
using
namespace
corsika
::
units
::
si
;
using
namespace
corsika
::
process
::
observation_plane
;
using
namespace
corsika
;
using
namespace
corsika
::
geometry
;
using
namespace
corsika
::
particles
;
TEST_CASE
(
"ContinuousProcess interface"
,
"[proccesses][observation_plane]"
)
{
auto
const
&
rootCS
=
RootCoordinateSystem
::
GetInstance
().
GetRootCoordinateSystem
();
/*
Test with downward going 1_GeV neutrino, starting at 0,1_m,10m
ObservationPlane has origin at 0,0,0
*/
Point
const
start
(
rootCS
,
{
0
_m
,
1
_m
,
10
_m
});
Vector
<
units
::
si
::
SpeedType
::
dimension_type
>
vec
(
rootCS
,
0
_m
/
second
,
0
_m
/
second
,
-
units
::
constants
::
c
);
Line
line
(
start
,
vec
);
Trajectory
<
Line
>
track
(
line
,
10
_m
/
units
::
constants
::
c
);
// setup particle stack, and add primary particle
setup
::
Stack
stack
;
stack
.
Clear
();
{
auto
elab2plab
=
[](
HEPEnergyType
Elab
,
HEPMassType
m
)
{
return
sqrt
((
Elab
-
m
)
*
(
Elab
+
m
));
};
stack
.
AddParticle
(
std
::
tuple
<
Code
,
units
::
si
::
HEPEnergyType
,
corsika
::
stack
::
MomentumVector
,
Point
,
units
::
si
::
TimeType
>
{
Code
::
NuMu
,
1
_GeV
,
corsika
::
stack
::
MomentumVector
(
rootCS
,
{
0
_GeV
,
0
_GeV
,
-
elab2plab
(
1
_GeV
,
NuMu
::
GetMass
())}),
Point
(
rootCS
,
{
1
_m
,
1
_m
,
10
_m
}),
0
_ns
});
}
auto
particle
=
stack
.
GetNextParticle
();
SECTION
(
"horizontal plane"
)
{
Plane
const
obsPlane
(
Point
(
rootCS
,
{
0
_m
,
0
_m
,
0
_m
}),
Vector
<
dimensionless_d
>
(
rootCS
,
{
0.
,
0.
,
1.
}));
ObservationPlane
obs
(
obsPlane
,
"particles.dat"
);
obs
.
Init
();
[[
maybe_unused
]]
const
LengthType
length
=
obs
.
MaxStepLength
(
particle
,
track
);
[[
maybe_unused
]]
const
process
::
EProcessReturn
ret
=
obs
.
DoContinuous
(
particle
,
track
);
SECTION
(
"steplength"
)
{
REQUIRE
(
length
==
10
_m
);
}
/*
SECTION("horizontal plane") {
REQUIRE(true); // todo: we have to check content of output file...
}
*/
}
SECTION
(
"inclined plane"
)
{
Plane
const
obsPlane
(
Point
(
rootCS
,
{
0
_m
,
0
_m
,
0
_m
}),
Vector
<
dimensionless_d
>
(
rootCS
,
{
1.
,
1.
,
0.5
}));
ObservationPlane
obs
(
obsPlane
,
"particles.dat"
);
obs
.
Init
();
[[
maybe_unused
]]
const
LengthType
length
=
obs
.
MaxStepLength
(
particle
,
track
);
[[
maybe_unused
]]
const
process
::
EProcessReturn
ret
=
obs
.
DoContinuous
(
particle
,
track
);
SECTION
(
"steplength"
)
{
REQUIRE
(
length
==
12
_m
);
}
}
}
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