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
d9beb8ae
Commit
d9beb8ae
authored
3 years ago
by
ralfulrich
Browse files
Options
Downloads
Patches
Plain Diff
more tracking test
parent
abcf2348
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
tests/modules/testTracking.cpp
+32
-0
32 additions, 0 deletions
tests/modules/testTracking.cpp
with
32 additions
and
0 deletions
tests/modules/testTracking.cpp
+
32
−
0
View file @
d9beb8ae
...
...
@@ -113,13 +113,25 @@ TEMPLATE_TEST_CASE("Tracking", "tracking", tracking_leapfrog_curved::Tracking,
TestType
tracking
;
Point
const
center
(
cs
,
{
0
_m
,
0
_m
,
0
_m
});
auto
target
=
setup
::
Environment
::
createNode
<
Sphere
>
(
center
,
radius
);
// every particle should hit target_2
// it is very close to injection and not so small
auto
target_2
=
setup
::
Environment
::
createNode
<
Sphere
>
(
Point
(
cs
,
{
-
radius
*
3
/
4
,
0
_m
,
0
_m
}),
radius
*
0.2
);
// only neutral particles hit_target_neutral
// this is far from injection and really small
auto
target_neutral
=
setup
::
Environment
::
createNode
<
Sphere
>
(
Point
(
cs
,
{
radius
/
2
,
0
_m
,
0
_m
}),
radius
*
0.1
);
// target to be overlapped entirely by target_2
auto
target_2_behind
=
setup
::
Environment
::
createNode
<
Sphere
>
(
Point
(
cs
,
{
-
radius
*
3
/
4
,
0
_m
,
0
_m
}),
radius
*
0.1
);
// target to be overlapped partly by target_2
auto
target_2_partly_behind
=
setup
::
Environment
::
createNode
<
Sphere
>
(
Point
(
cs
,
{
-
radius
*
3
/
4
+
radius
*
0.1
,
0
_m
,
0
_m
}),
radius
*
0.2
);
using
MyHomogeneousModel
=
MediumPropertyModel
<
UniformMagneticField
<
HomogeneousMedium
<
setup
::
EnvironmentInterface
>>>
;
...
...
@@ -133,12 +145,24 @@ TEMPLATE_TEST_CASE("Tracking", "tracking", tracking_leapfrog_curved::Tracking,
target_2
->
setModelProperties
<
MyHomogeneousModel
>
(
Medium
::
AirDry1Atm
,
magneticfield
,
1
_g
/
(
1
_m
*
1
_m
*
1
_m
),
NuclearComposition
(
std
::
vector
<
Code
>
{
Code
::
Oxygen
},
std
::
vector
<
float
>
{
1.
}));
target_2_behind
->
setModelProperties
<
MyHomogeneousModel
>
(
Medium
::
AirDry1Atm
,
magneticfield
,
1
_g
/
(
1
_m
*
1
_m
*
1
_m
),
NuclearComposition
(
std
::
vector
<
Code
>
{
Code
::
Oxygen
},
std
::
vector
<
float
>
{
1.
}));
target_2_partly_behind
->
setModelProperties
<
MyHomogeneousModel
>
(
Medium
::
AirDry1Atm
,
magneticfield
,
1
_g
/
(
1
_m
*
1
_m
*
1
_m
),
NuclearComposition
(
std
::
vector
<
Code
>
{
Code
::
Oxygen
},
std
::
vector
<
float
>
{
1.
}));
auto
*
targetPtr
=
target
.
get
();
auto
*
targetPtr_2
=
target_2
.
get
();
auto
*
targetPtr_neutral
=
target_neutral
.
get
();
auto
*
targetPtr_2_behind
=
target_2_behind
.
get
();
auto
*
targetPtr_2_partly_behind
=
target_2_partly_behind
.
get
();
target_2_behind
->
excludeOverlapWith
(
target_2
);
target_2_partly_behind
->
excludeOverlapWith
(
target_2
);
worldPtr
->
addChild
(
std
::
move
(
target
));
targetPtr
->
addChild
(
std
::
move
(
target_2
));
targetPtr
->
addChild
(
std
::
move
(
target_neutral
));
targetPtr
->
addChild
(
std
::
move
(
target_2_behind
));
targetPtr
->
addChild
(
std
::
move
(
target_2_partly_behind
));
auto
[
stack
,
viewPtr
]
=
setup
::
testing
::
setup_stack
(
PID
,
0
,
0
,
P0
,
targetPtr
,
cs
);
{
[[
maybe_unused
]]
auto
&
viewPtr_dum
=
viewPtr
;
}
...
...
@@ -167,9 +191,13 @@ TEMPLATE_TEST_CASE("Tracking", "tracking", tracking_leapfrog_curved::Tracking,
// move forward, until we leave target volume
bool
hit_neutral
=
false
;
bool
hit_2nd
=
false
;
bool
hit_2nd_behind
=
false
;
[[
maybe_unused
]]
bool
hit_2nd_partly_behind
=
false
;
while
(
nextVol
!=
worldPtr
)
{
if
(
nextVol
==
targetPtr_neutral
)
hit_neutral
=
true
;
if
(
nextVol
==
targetPtr_2
)
hit_2nd
=
true
;
if
(
nextVol
==
targetPtr_2_behind
)
hit_2nd_behind
=
true
;
if
(
nextVol
==
targetPtr_2_partly_behind
)
hit_2nd_partly_behind
=
true
;
const
auto
[
traj2
,
nextVol2
]
=
tracking
.
getTrack
(
particle
);
nextVol
=
nextVol2
;
particle
.
setNode
(
nextVol
);
...
...
@@ -181,6 +209,10 @@ TEMPLATE_TEST_CASE("Tracking", "tracking", tracking_leapfrog_curved::Tracking,
particle
.
getVelocity
().
getNorm
(),
traj2
.
getLength
(
1
),
traj2
.
getLength
(
1
)
/
particle
.
getVelocity
().
getNorm
());
}
CHECK_FALSE
(
hit_2nd_behind
);
// this can never happen
// the next line is maybe an actual BUG: this should be investigated and eventually
// fixed:
// CHECK(hit_2nd == hit_2nd_partly_behind); // if one is hit, the other also must be
CHECK
(
nextVol
==
worldPtr
);
CHECK
(
hit_2nd
==
true
);
CHECK
(
hit_neutral
==
(
deflect
==
0
?
true
:
false
));
...
...
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