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
3171920e
Commit
3171920e
authored
4 years ago
by
Andre Schmidt
Committed by
ralfulrich
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
update Magnetic movement
parent
7666c11b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!278
Magnetic Tracking
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/Cascade/Cascade.h
+32
-29
32 additions, 29 deletions
Framework/Cascade/Cascade.h
Processes/ObservationPlane/ObservationPlane.cc
+14
-17
14 additions, 17 deletions
Processes/ObservationPlane/ObservationPlane.cc
with
46 additions
and
46 deletions
Framework/Cascade/Cascade.h
+
32
−
29
View file @
3171920e
...
@@ -227,6 +227,10 @@ namespace corsika::cascade {
...
@@ -227,6 +227,10 @@ namespace corsika::cascade {
std
::
cout
<<
"distance_max="
<<
distance_max
<<
std
::
endl
;
std
::
cout
<<
"distance_max="
<<
distance_max
<<
std
::
endl
;
// take minimum of geometry, interaction, decay for next step
// 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
(
auto
const
min_distance
=
std
::
min
(
{
distance_interact
,
distance_decay
,
distance_max
,
geomMaxLength
});
{
distance_interact
,
distance_decay
,
distance_max
,
geomMaxLength
});
...
@@ -234,44 +238,43 @@ namespace corsika::cascade {
...
@@ -234,44 +238,43 @@ namespace corsika::cascade {
// determine displacement by the magnetic field
// determine displacement by the magnetic field
auto
const
*
currentLogicalVolumeNode
=
vParticle
.
GetNode
();
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
;
int
chargeNumber
;
if
(
corsika
::
particles
::
IsNucleus
(
vParticle
.
GetPID
()))
{
if
(
corsika
::
particles
::
IsNucleus
(
vParticle
.
GetPID
()))
{
chargeNumber
=
vParticle
.
GetNuclearZ
();
chargeNumber
=
vParticle
.
GetNuclearZ
();
}
else
{
}
else
{
chargeNumber
=
corsika
::
particles
::
GetChargeNumber
(
vParticle
.
GetPID
());
chargeNumber
=
corsika
::
particles
::
GetChargeNumber
(
vParticle
.
GetPID
());
}
}
if
(
chargeNumber
!=
0
)
{
auto
k
=
chargeNumber
*
corsika
::
units
::
constants
::
cSquared
*
1
_eV
/
auto
magneticfield
=
currentLogicalVolumeNode
->
GetModelProperties
().
GetMagneticField
(
vParticle
.
GetPosition
());
(
velocity
.
GetNorm
()
*
vParticle
.
GetEnergy
()
*
1
_V
);
geometry
::
Vector
<
SpeedType
::
dimension_type
>
velocity
=
vParticle
.
GetMomentum
()
/
vParticle
.
GetEnergy
()
*
corsika
::
units
::
constants
::
c
;
// First Movement
geometry
::
Vector
<
dimensionless_d
>
const
directionBefore
=
velocity
.
normalized
();
// assuming magnetic field does not change during movement
auto
k
=
chargeNumber
*
corsika
::
units
::
constants
::
cSquared
*
1
_eV
/
auto
position
=
vParticle
.
GetPosition
()
+
directionBefore
*
min_distance
/
2
;
(
velocity
.
GetNorm
()
*
vParticle
.
GetEnergy
()
*
1
_V
);
// Change of direction by magnetic field
// First Movement
geometry
::
Vector
<
dimensionless_d
>
const
directionAfter
=
directionBefore
+
directionBefore
.
cross
(
magneticfield
)
*
// assuming magnetic field does not change during movement
min_distance
*
k
;
auto
position
=
vParticle
.
GetPosition
()
+
directionBefore
*
min_distance
/
2
;
// Second Movement
// Change of direction by magnetic field
position
=
position
+
directionAfter
*
min_distance
/
2
;
geometry
::
Vector
<
dimensionless_d
>
const
directionAfter
=
directionBefore
+
directionBefore
.
cross
(
magneticfield
)
*
auto
distance
=
position
-
vParticle
.
GetPosition
();
min_distance
*
k
;
//distance.norm() != min_distance for distance_interact, distance_decay if q != 0
// Second Movement
//small error can be neglected
position
=
position
+
directionAfter
*
min_distance
/
2
;
velocity
=
distance
.
normalized
()
*
velocity
.
norm
();
// here the particle is actually moved along the trajectory to new position:
// std::visit(setup::ParticleUpdate<Particle>{vParticle}, step);
// here the particle is actually moved along the trajectory to new position:
vParticle
.
SetMomentum
(
directionAfter
.
normalized
()
*
vParticle
.
GetMomentum
().
GetNorm
());
// std::visit(setup::ParticleUpdate<Particle>{vParticle}, step);
vParticle
.
SetPosition
(
position
);
vParticle
.
SetMomentum
(
directionAfter
.
normalized
()
*
vParticle
.
GetMomentum
().
GetNorm
());
}
else
{
geometry
::
Line
line
(
vParticle
.
GetPosition
(),
velocity
);
vParticle
.
SetPosition
(
stepWithoutB
.
PositionFromArclength
(
min_distance
));
geometry
::
Trajectory
<
geometry
::
Line
>
stepNew
(
line
,
distance
.
norm
()
/
velocity
.
GetNorm
());
}
vParticle
.
SetPosition
(
position
);
// .... also update time, momentum, direction, ...
vParticle
.
SetTime
(
vParticle
.
GetTime
()
+
distance
.
norm
()
/
units
::
constants
::
c
);
vParticle
.
SetTime
(
vParticle
.
GetTime
()
+
min_distance
/
units
::
constants
::
c
);
std
::
cout
<<
"New Position: "
<<
vParticle
.
GetPosition
().
GetCoordinates
()
<<
std
::
endl
;
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
// 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
)
{
if
(
status
==
process
::
EProcessReturn
::
eParticleAbsorbed
)
{
C8LOG_DEBUG
(
"Cascade: delete absorbed particle PID={} E={} GeV"
,
C8LOG_DEBUG
(
"Cascade: delete absorbed particle PID={} E={} GeV"
,
...
...
This diff is collapsed.
Click to expand it.
Processes/ObservationPlane/ObservationPlane.cc
+
14
−
17
View file @
3171920e
...
@@ -88,27 +88,24 @@ LengthType ObservationPlane::MaxStepLength(setup::Stack::ParticleType const& vPa
...
@@ -88,27 +88,24 @@ LengthType ObservationPlane::MaxStepLength(setup::Stack::ParticleType const& vPa
plane_
.
GetNormal
().
dot
(
velocity
.
cross
(
magneticfield
))
*
2
*
k
))
-
plane_
.
GetNormal
().
dot
(
velocity
.
cross
(
magneticfield
))
*
2
*
k
))
-
velocity
.
dot
(
plane_
.
GetNormal
())
/
velocity
.
GetNorm
()
)
/
velocity
.
dot
(
plane_
.
GetNormal
())
/
velocity
.
GetNorm
()
)
/
(
plane_
.
GetNormal
().
dot
(
velocity
.
cross
(
magneticfield
))
*
k
);
(
plane_
.
GetNormal
().
dot
(
velocity
.
cross
(
magneticfield
))
*
k
);
std
::
cout
<<
"Test: "
<<
MaxStepLength1
<<
" "
<<
MaxStepLength2
<<
std
::
endl
;
if
(
MaxStepLength1
<=
0
_m
&&
MaxStepLength2
<=
0
_m
)
{
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
())
{
return
std
::
numeric_limits
<
double
>::
infinity
()
*
1
_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
);
if
(
timeOfIntersection
<
TimeType
::
zero
())
{
return
(
trajectory
.
GetR0
()
-
pointOfIntersection
).
norm
()
*
1.0001
;
return
std
::
numeric_limits
<
double
>::
infinity
()
*
1
_m
;
//why is it *1.0001? should i do that too?
}
}
auto
const
pointOfIntersection
=
trajectory
.
GetPosition
(
timeOfIntersection
);
return
(
trajectory
.
GetR0
()
-
pointOfIntersection
).
norm
()
*
1.0001
;
}
}
void
ObservationPlane
::
ShowResults
()
const
{
void
ObservationPlane
::
ShowResults
()
const
{
...
...
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