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
d1fdbfdd
Commit
d1fdbfdd
authored
4 years ago
by
Ralf Ulrich
Browse files
Options
Downloads
Patches
Plain Diff
Delete testTrackingLeapFrogCurved.cc
parent
66183d9c
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/TrackingLeapFrogCurved/testTrackingLeapFrogCurved.cc
+0
-128
0 additions, 128 deletions
...sses/TrackingLeapFrogCurved/testTrackingLeapFrogCurved.cc
with
0 additions
and
128 deletions
Processes/TrackingLeapFrogCurved/testTrackingLeapFrogCurved.cc
deleted
100644 → 0
+
0
−
128
View file @
66183d9c
/*
* (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
*
* 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.
*/
#include
<corsika/process/tracking_leapfrog_curved/Tracking.h>
#include
<corsika/particles/ParticleProperties.h>
#include
<corsika/geometry/Point.h>
#include
<corsika/geometry/Sphere.h>
#include
<corsika/geometry/Vector.h>
#include
<corsika/setup/SetupEnvironment.h>
#include
<corsika/setup/SetupStack.h>
#include
<corsika/setup/SetupTrajectory.h>
using
corsika
::
setup
::
Trajectory
;
#include
<catch2/catch.hpp>
using
namespace
corsika
;
using
namespace
corsika
::
particles
;
using
namespace
corsika
::
process
;
using
namespace
corsika
::
units
;
using
namespace
corsika
::
geometry
;
using
namespace
corsika
::
units
::
si
;
template
<
typename
T
>
int
sgn
(
T
val
)
{
return
(
T
(
0
)
<
val
)
-
(
val
<
T
(
0
));
}
TEST_CASE
(
"TrackingLeapfrog_Curved"
)
{
logging
::
SetLevel
(
logging
::
level
::
trace
);
const
HEPEnergyType
P0
=
10
_GeV
;
auto
PID
=
GENERATE
(
as
<
Code
>
{},
Code
::
MuPlus
,
Code
::
MuPlus
,
Code
::
Gamma
);
auto
Bfield
=
GENERATE
(
as
<
MagneticFluxType
>
{},
0
_T
,
50
_uT
,
-
50
_uT
);
auto
outer
=
GENERATE
(
as
<
bool
>
{},
true
,
false
);
SECTION
(
fmt
::
format
(
"Tracking PID={}, Bfield={} uT, from outside={}"
,
PID
,
Bfield
/
1
_uT
,
outer
))
{
C8LOG_DEBUG
(
"********************
\n
TEST section PID={}, Bfield={} "
"uT, outer (?)={}"
,
PID
,
Bfield
/
1
_uT
,
outer
);
const
int
chargeNumber
=
GetChargeNumber
(
PID
);
LengthType
radius
=
10
_m
;
int
deflect
=
0
;
if
(
chargeNumber
!=
0
and
Bfield
!=
0
_T
)
{
deflect
=
-
sgn
(
chargeNumber
)
*
sgn
(
Bfield
/
1
_T
);
// direction of deflection
LengthType
const
gyroradius
=
P0
*
1
_V
/
(
constants
::
c
*
abs
(
chargeNumber
)
*
abs
(
Bfield
)
*
1
_eV
);
radius
=
gyroradius
;
}
auto
[
env
,
csPtr
,
worldPtr
]
=
setup
::
testing
::
setupEnvironment
(
Code
::
Oxygen
,
Bfield
);
{
[[
maybe_unused
]]
const
auto
&
env_dummy
=
env
;
}
auto
const
&
cs
=
*
csPtr
;
tracking_leapfrog_curved
::
Tracking
tracking
;
using
tracking_leapfrog_curved
::
MagneticFieldVector
;
Point
const
center
(
cs
,
{
0
_m
,
0
_m
,
0
_m
});
auto
target
=
setup
::
Environment
::
CreateNode
<
geometry
::
Sphere
>
(
center
,
radius
);
using
MyHomogeneousModel
=
environment
::
MediumPropertyModel
<
environment
::
UniformMagneticField
<
environment
::
HomogeneousMedium
<
setup
::
EnvironmentInterface
>>>
;
MagneticFieldVector
magneticfield
(
cs
,
0
_T
,
0
_T
,
Bfield
);
target
->
SetModelProperties
<
MyHomogeneousModel
>
(
environment
::
Medium
::
AirDry1Atm
,
magneticfield
,
1
_g
/
(
1
_m
*
1
_m
*
1
_m
),
environment
::
NuclearComposition
(
std
::
vector
<
Code
>
{
Code
::
Oxygen
},
std
::
vector
<
float
>
{
1.
}));
auto
*
targetPtr
=
target
.
get
();
worldPtr
->
AddChild
(
std
::
move
(
target
));
auto
[
stack
,
viewPtr
]
=
setup
::
testing
::
setupStack
(
PID
,
0
,
0
,
P0
,
targetPtr
,
cs
);
{
[[
maybe_unused
]]
auto
&
viewPtr_dum
=
viewPtr
;
}
auto
particle
=
stack
->
first
();
// Note: momentum in X-direction
// magnetic field in Z-direction
// put particle on x_start, 0, 0
// expect intersections somewere in +-y_start
if
(
outer
)
{
particle
.
SetNode
(
worldPtr
);
// set particle inside "target" volume
}
else
{
particle
.
SetNode
(
targetPtr
);
// set particle outside "target" volume
}
particle
.
SetPosition
(
Point
(
cs
,
-
radius
,
0
_m
,
0
_m
));
auto
[
traj
,
nextVol
]
=
tracking
.
GetTrack
(
particle
);
particle
.
SetNode
(
nextVol
);
particle
.
SetPosition
(
traj
.
GetPosition
(
1
));
particle
.
SetMomentum
(
traj
.
GetDirection
(
1
)
*
particle
.
GetMomentum
().
norm
());
if
(
outer
)
{
// now we know we are in target volume, depending on "outer"
CHECK
(
traj
.
GetLength
(
1
)
==
0
_m
);
CHECK
(
nextVol
==
targetPtr
);
}
// move forward, until we leave target volume
while
(
nextVol
==
targetPtr
)
{
const
auto
[
traj2
,
nextVol2
]
=
tracking
.
GetTrack
(
particle
);
nextVol
=
nextVol2
;
particle
.
SetNode
(
nextVol
);
particle
.
SetPosition
(
traj2
.
GetPosition
(
1
));
particle
.
SetMomentum
(
traj2
.
GetDirection
(
1
)
*
particle
.
GetMomentum
().
norm
());
}
CHECK
(
nextVol
==
worldPtr
);
Point
pointCheck
(
cs
,
(
deflect
==
0
?
radius
:
0
_m
),
(
deflect
*
radius
),
0
_m
);
C8LOG_DEBUG
(
"testTrackingLineStack: deflect={}, momentum={}, pos={}, pos_check={}"
,
deflect
,
particle
.
GetMomentum
().
GetComponents
(),
particle
.
GetPosition
().
GetCoordinates
(),
pointCheck
.
GetCoordinates
());
CHECK
((
particle
.
GetPosition
()
-
pointCheck
).
norm
()
/
radius
==
Approx
(
0
).
margin
(
1e-3
));
}
}
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