IAP GITLAB
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
corsika
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
André Schmidt
corsika
Commits
a3fc176b
Commit
a3fc176b
authored
Aug 12, 2020
by
Andre Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Magnetic movement
parent
4f3abf30
Pipeline
#2019
failed with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
48 deletions
+48
-48
Documentation/Examples/vertical_EAS.cc
Documentation/Examples/vertical_EAS.cc
+2
-2
Framework/Cascade/Cascade.h
Framework/Cascade/Cascade.h
+32
-29
Processes/ObservationPlane/ObservationPlane.cc
Processes/ObservationPlane/ObservationPlane.cc
+14
-17
No files found.
Documentation/Examples/vertical_EAS.cc
View file @
a3fc176b
...
...
@@ -97,7 +97,7 @@ int main(int argc, char** argv) {
node1
->
SetModelProperties
<
UniformMagneticField
<
HomogeneousMedium
<
IEnvModel
>>>
(
B
,
1
_g
/
(
1
_cm
*
1
_cm
*
1e9
_cm
),
composition
);
/*
auto node2 = std::make_unique<VolumeTreeNode<IEnvModel>>(
auto
node2
=
std
::
make_unique
<
VolumeTreeNode
<
IEnvModel
>>
(
std
::
make_unique
<
geometry
::
Sphere
>
(
center
,
seaLevel
+
100.0
_km
));
node2
->
SetModelProperties
<
UniformMagneticField
<
SlidingPlanarExponential
<
IEnvModel
>>>
(
B
,
center
,
540.1778
_g
/
(
1
_cm
*
1
_cm
)
/
772170.16
_cm
,
-
772170.16
_cm
,
composition
,
...
...
@@ -124,7 +124,7 @@ int main(int argc, char** argv) {
node4
->
AddChild
(
std
::
move
(
node5
));
node3
->
AddChild
(
std
::
move
(
node4
));
node2
->
AddChild
(
std
::
move
(
node3
));
node1->AddChild(std::move(node2));
*/
node1
->
AddChild
(
std
::
move
(
node2
));
env
.
GetUniverse
()
->
AddChild
(
std
::
move
(
node1
));
// setup particle stack, and add primary particle
...
...
Framework/Cascade/Cascade.h
View file @
a3fc176b
...
...
@@ -209,6 +209,10 @@ namespace corsika::cascade {
std
::
cout
<<
"distance_max="
<<
distance_max
<<
std
::
endl
;
// take minimum of geometry, interaction, decay for next step
std
::
cout
<<
"Interaction: "
<<
distance_interact
<<
std
::
endl
;
std
::
cout
<<
"Decay: "
<<
distance_decay
<<
std
::
endl
;
std
::
cout
<<
"ObsPlane: "
<<
distance_max
<<
std
::
endl
;
std
::
cout
<<
"Transition: "
<<
geomMaxLength
<<
std
::
endl
;
auto
const
min_distance
=
std
::
min
(
{
distance_interact
,
distance_decay
,
distance_max
,
geomMaxLength
});
...
...
@@ -216,44 +220,43 @@ namespace corsika::cascade {
// determine displacement by the magnetic field
auto
const
*
currentLogicalVolumeNode
=
vParticle
.
GetNode
();
auto
magneticfield
=
currentLogicalVolumeNode
->
GetModelProperties
().
GetMagneticField
(
vParticle
.
GetPosition
());
geometry
::
Vector
<
SpeedType
::
dimension_type
>
velocity
=
vParticle
.
GetMomentum
()
/
vParticle
.
GetEnergy
()
*
corsika
::
units
::
constants
::
c
;
geometry
::
Vector
<
dimensionless_d
>
const
directionBefore
=
velocity
.
normalized
();
int
chargeNumber
;
if
(
corsika
::
particles
::
IsNucleus
(
vParticle
.
GetPID
()))
{
chargeNumber
=
vParticle
.
GetNuclearZ
();
}
else
{
chargeNumber
=
corsika
::
particles
::
GetChargeNumber
(
vParticle
.
GetPID
());
}
if
(
chargeNumber
!=
0
)
{
auto
magneticfield
=
currentLogicalVolumeNode
->
GetModelProperties
().
GetMagneticField
(
vParticle
.
GetPosition
());
geometry
::
Vector
<
SpeedType
::
dimension_type
>
velocity
=
vParticle
.
GetMomentum
()
/
vParticle
.
GetEnergy
()
*
corsika
::
units
::
constants
::
c
;
geometry
::
Vector
<
dimensionless_d
>
const
directionBefore
=
velocity
.
normalized
();
auto
k
=
chargeNumber
*
corsika
::
units
::
constants
::
cSquared
*
1
_eV
/
(
velocity
.
GetNorm
()
*
vParticle
.
GetEnergy
()
*
1
_V
);
// First Movement
// assuming magnetic field does not change during movement
auto
position
=
vParticle
.
GetPosition
()
+
directionBefore
*
min_distance
/
2
;
// Change of direction by magnetic field
geometry
::
Vector
<
dimensionless_d
>
const
directionAfter
=
directionBefore
+
directionBefore
.
cross
(
magneticfield
)
*
min_distance
*
k
;
// Second Movement
position
=
position
+
directionAfter
*
min_distance
/
2
;
// here the particle is actually moved along the trajectory to new position:
// std::visit(setup::ParticleUpdate<Particle>{vParticle}, step);
vParticle
.
SetMomentum
(
directionAfter
.
normalized
()
*
vParticle
.
GetMomentum
().
GetNorm
());
vParticle
.
SetPosition
(
position
);
}
else
{
vParticle
.
SetPosition
(
stepWithoutB
.
PositionFromArclength
(
min_distance
));
}
// .... also update time, momentum, direction, ...
vParticle
.
SetTime
(
vParticle
.
GetTime
()
+
min_distance
/
units
::
constants
::
c
);
auto
k
=
chargeNumber
*
corsika
::
units
::
constants
::
cSquared
*
1
_eV
/
(
velocity
.
GetNorm
()
*
vParticle
.
GetEnergy
()
*
1
_V
);
// First Movement
// assuming magnetic field does not change during movement
auto
position
=
vParticle
.
GetPosition
()
+
directionBefore
*
min_distance
/
2
;
// Change of direction by magnetic field
geometry
::
Vector
<
dimensionless_d
>
const
directionAfter
=
directionBefore
+
directionBefore
.
cross
(
magneticfield
)
*
min_distance
*
k
;
// Second Movement
position
=
position
+
directionAfter
*
min_distance
/
2
;
auto
distance
=
position
-
vParticle
.
GetPosition
();
//distance.norm() != min_distance for distance_interact, distance_decay if q != 0
//small error can be neglected
velocity
=
distance
.
normalized
()
*
velocity
.
norm
();
// here the particle is actually moved along the trajectory to new position:
// std::visit(setup::ParticleUpdate<Particle>{vParticle}, step);
vParticle
.
SetMomentum
(
directionAfter
.
normalized
()
*
vParticle
.
GetMomentum
().
GetNorm
());
geometry
::
Line
line
(
vParticle
.
GetPosition
(),
velocity
);
geometry
::
Trajectory
<
geometry
::
Line
>
stepNew
(
line
,
distance
.
norm
()
/
velocity
.
GetNorm
());
vParticle
.
SetPosition
(
position
);
vParticle
.
SetTime
(
vParticle
.
GetTime
()
+
distance
.
norm
()
/
units
::
constants
::
c
);
std
::
cout
<<
"New Position: "
<<
vParticle
.
GetPosition
().
GetCoordinates
()
<<
std
::
endl
;
// is this necessary?
stepWithoutB
.
LimitEndTo
(
min_distance
);
stepWithB
.
LimitEndTo
(
min_distance
);
// apply all continuous processes on particle + track
process
::
EProcessReturn
status
=
fProcessSequence
.
DoContinuous
(
vParticle
,
step
WithoutB
);
process
::
EProcessReturn
status
=
fProcessSequence
.
DoContinuous
(
vParticle
,
step
New
);
if
(
status
==
process
::
EProcessReturn
::
eParticleAbsorbed
)
{
std
::
cout
<<
"Cascade: delete absorbed particle "
<<
vParticle
.
GetPID
()
<<
" "
...
...
Processes/ObservationPlane/ObservationPlane.cc
View file @
a3fc176b
...
...
@@ -82,25 +82,22 @@ LengthType ObservationPlane::MaxStepLength(setup::Stack::ParticleType const& vPa
plane_
.
GetNormal
().
dot
(
velocity
.
cross
(
magneticfield
))
*
2
*
k
))
-
velocity
.
dot
(
plane_
.
GetNormal
())
/
velocity
.
GetNorm
()
)
/
(
plane_
.
GetNormal
().
dot
(
velocity
.
cross
(
magneticfield
))
*
k
);
std
::
cout
<<
"Test: "
<<
MaxStepLength1
<<
" "
<<
MaxStepLength2
<<
std
::
endl
;
if
(
MaxStepLength1
<
0
_m
&&
MaxStepLength2
<
0
_m
)
{
return
std
::
numeric_limits
<
double
>::
infinity
()
*
1
_m
;
}
else
if
(
MaxStepLength1
<
0
_m
||
MaxStepLength2
<
MaxStepLength1
)
{
return
MaxStepLength2
;
}
else
if
(
MaxStepLength2
<
0
_m
||
MaxStepLength1
<
MaxStepLength2
)
{
return
MaxStepLength1
;
}
}
else
{
TimeType
const
timeOfIntersection
=
(
plane_
.
GetCenter
()
-
trajectory
.
GetR0
()).
dot
(
plane_
.
GetNormal
())
/
trajectory
.
GetV0
().
dot
(
plane_
.
GetNormal
());
if
(
timeOfIntersection
<
TimeType
::
zero
())
{
if
(
MaxStepLength1
<=
0
_m
&&
MaxStepLength2
<=
0
_m
)
{
return
std
::
numeric_limits
<
double
>::
infinity
()
*
1
_m
;
}
else
if
(
MaxStepLength1
<=
0
_m
||
MaxStepLength2
<
MaxStepLength1
)
{
return
MaxStepLength2
*
1.0001
;
}
else
if
(
MaxStepLength2
<=
0
_m
||
MaxStepLength1
<
MaxStepLength2
)
{
return
MaxStepLength1
*
1.0001
;
}
}
TimeType
const
timeOfIntersection
=
(
plane_
.
GetCenter
()
-
trajectory
.
GetR0
()).
dot
(
plane_
.
GetNormal
())
/
trajectory
.
GetV0
().
dot
(
plane_
.
GetNormal
());
auto
const
pointOfIntersection
=
trajectory
.
GetPosition
(
timeOfIntersection
);
return
(
trajectory
.
GetR0
()
-
pointOfIntersection
).
norm
()
*
1.0001
;
//why is it *1.0001? should i do that too?
if
(
timeOfIntersection
<
TimeType
::
zero
())
{
return
std
::
numeric_limits
<
double
>::
infinity
()
*
1
_m
;
}
auto
const
pointOfIntersection
=
trajectory
.
GetPosition
(
timeOfIntersection
);
return
(
trajectory
.
GetR0
()
-
pointOfIntersection
).
norm
()
*
1.0001
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment