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
d699c781
Commit
d699c781
authored
3 years ago
by
ralfulrich
Browse files
Options
Downloads
Patches
Plain Diff
further unit testing
parent
d9beb8ae
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
corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl
+4
-1
4 additions, 1 deletion
corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl
tests/modules/testTracking.cpp
+9
-6
9 additions, 6 deletions
tests/modules/testTracking.cpp
with
13 additions
and
7 deletions
corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl
+
4
−
1
View file @
d699c781
...
...
@@ -112,11 +112,13 @@ namespace corsika {
constants
::
c
/
(
abs
(
charge
)
*
magnitudeB
);
if
(
gyroradius
>
1e9
_m
)
{
// this cannot be really unit-tested. It is hidden. LCOV_EXCL_START
CORSIKA_LOG_WARN
(
"CurvedLeapFrog is not very stable for extremely high gyroradius steps. "
"Rg={} -> straight tracking."
,
gyroradius
);
return
getLinearTrajectory
(
particle
);
// LCOV_EXCL_STOP
}
double
const
maxRadians
=
0.01
;
// maximally allowed deflection
...
...
@@ -168,7 +170,8 @@ namespace corsika {
CORSIKA_LOG_TRACE
(
"projectedDirectionSqrNorm={} T^2"
,
projectedDirectionSqrNorm
/
square
(
1
_T
));
if
((
charge
==
0
*
constants
::
e
)
||
magneticfield
.
getNorm
()
==
0
_T
||
isParallel
)
{
if
(
isParallel
)
{
// particle moves parallel to field -> no deflection
return
tracking_line
::
Tracking
::
intersect
<
TParticle
>
(
particle
,
sphere
);
}
...
...
This diff is collapsed.
Click to expand it.
tests/modules/testTracking.cpp
+
9
−
6
View file @
d699c781
...
...
@@ -70,6 +70,8 @@ TEMPLATE_TEST_CASE("Tracking", "tracking", tracking_leapfrog_curved::Tracking,
const
HEPEnergyType
P0
=
10
_GeV
;
auto
PID
=
GENERATE
(
as
<
Code
>
{},
Code
::
MuPlus
,
Code
::
MuPlus
,
Code
::
Photon
);
// test also special case: movement parallel to field (along x)
auto
isParallel
=
GENERATE
(
as
<
bool
>
{},
true
,
false
);
// for algorithms that know magnetic deflections choose: +-50uT, 0uT
// otherwise just 0uT
auto
Bfield
=
GENERATE
(
filter
(
...
...
@@ -79,25 +81,26 @@ TEMPLATE_TEST_CASE("Tracking", "tracking", tracking_leapfrog_curved::Tracking,
else
return
true
;
},
values
<
MagneticFluxType
>
({
50
_uT
,
0
_uT
,
-
50
_uT
})));
values
<
MagneticFluxType
>
({
50
_uT
,
0
_uT
,
(
isParallel
?
0
:
-
50
_uT
)
})));
// particle --> (world) --> | --> (target)
// true: start inside "world" volume
// false: start inside "target" volume
auto
outer
=
GENERATE
(
as
<
bool
>
{},
true
,
false
);
SECTION
(
fmt
::
format
(
"Tracking PID={}, Bfield={} uT, from outside={}"
,
PID
,
Bfield
/
1
_uT
,
outer
))
{
SECTION
(
fmt
::
format
(
"Tracking PID={}, Bfield={} uT,
isParallel={},
from outside={}"
,
PID
,
Bfield
/
1
_uT
,
isParallel
,
outer
))
{
CORSIKA_LOG_DEBUG
(
"********************
\n
TEST algo={} section PID={}, "
"Bfield={} "
"uT, start_outside={}"
,
boost
::
typeindex
::
type_id
<
TestType
>
().
pretty_name
(),
PID
,
Bfield
/
1
_uT
,
outer
);
"uT, field is parallel={}, start_outside={}"
,
boost
::
typeindex
::
type_id
<
TestType
>
().
pretty_name
(),
PID
,
Bfield
/
1
_uT
,
isParallel
,
outer
);
const
int
chargeNumber
=
get_charge_number
(
PID
);
LengthType
radius
=
10
_m
;
int
deflect
=
0
;
if
(
chargeNumber
!=
0
and
Bfield
!=
0
_T
)
{
if
(
chargeNumber
!=
0
&&
Bfield
!=
0
_T
&&
!
isParallel
)
{
deflect
=
-
sgn
(
chargeNumber
)
*
sgn
(
Bfield
/
1
_T
);
// direction of deflection
LengthType
const
gyroradius
=
(
convert_HEP_to_SI
<
MassType
::
dimension_type
>
(
P0
)
*
constants
::
c
/
(
abs
(
get_charge
(
PID
))
*
abs
(
Bfield
)));
...
...
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