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
c7101d7f
Commit
c7101d7f
authored
4 years ago
by
Nikos Karastathis
Browse files
Options
Downloads
Patches
Plain Diff
CoREAS & ZHS advancements
parent
64a4a9da
No related branches found
No related tags found
1 merge request
!329
Radio interface
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
corsika/modules/radio/CoREAS.hpp
+87
-13
87 additions, 13 deletions
corsika/modules/radio/CoREAS.hpp
corsika/modules/radio/RadioProcess.hpp
+38
-3
38 additions, 3 deletions
corsika/modules/radio/RadioProcess.hpp
corsika/modules/radio/ZHS.hpp
+17
-7
17 additions, 7 deletions
corsika/modules/radio/ZHS.hpp
with
142 additions
and
23 deletions
corsika/modules/radio/CoREAS.hpp
+
87
−
13
View file @
c7101d7f
...
@@ -15,13 +15,28 @@
...
@@ -15,13 +15,28 @@
namespace
corsika
{
namespace
corsika
{
/**
/**
*
*
A concrete implementation of the Enpoints formalism.
*/
*/
template
<
typename
T
Propagator
=
Straight
Propagator
>
template
<
typename
T
RadioDetector
,
typename
T
Propagator
>
class
CoREAS
final
:
public
RadioProcess
<
CoREAS
>
{
class
CoREAS
final
:
public
RadioProcess
<
TRadioDetector
,
CoREAS
<
TRadioDetector
,
TPropagator
>
,
TPropagator
>
{
using
Base
=
RadioProcess
<
TRadioDetector
,
CoREAS
<
TRadioDetector
,
TPropagator
>
,
TPropagator
>
;
using
Base
::
detector_
;
public:
public:
using
ElectricFieldVector
=
QuantityVector
<
ElectricFieldType
::
dimension_type
>
;
/**
* Construct a new CoREAS instance.
*
* This forwards the detector and other arguments to
* the RadioProcess parent.
*
*/
template
<
typename
...
TArgs
>
CoREAS
(
TRadioDetector
&
detector
,
TArgs
&&
...
args
)
:
RadioProcess
<
TRadioDetector
,
CoREAS
,
TPropagator
>
(
detector
,
args
...){}
/**
/**
* Simulate the radio emission from a particle across a track.
* Simulate the radio emission from a particle across a track.
*
*
...
@@ -32,20 +47,70 @@ namespace corsika {
...
@@ -32,20 +47,70 @@ namespace corsika {
*
*
*/
*/
template
<
typename
Particle
,
typename
Track
>
template
<
typename
Particle
,
typename
Track
>
EProcessReturn
simulate
(
Particle
&
,
Track
const
&
)
const
{
ProcessReturn
simulate
(
Particle
&
particle
,
Track
const
&
track
)
const
{
//get global simulation time for that track. (This is my best guess for now)
auto
startTime_
{
particle
.
getTime
()};
// time at start point of track.
auto
endTime_
{
particle
.
getTime
()
-
track
.
getDuration
()};
// time at end point of track.
// an alternative is the following which shouldn't work I think
// auto startTime_ {particle.getTime()};
// auto endTime_ {startTime_ + track.getDuration()};
// beta is defined as velocity / speed of light
auto
startBeta_
{
track
.
getVelocity
(
0
)
/
constants
::
c
};
auto
endBeta_
{
track
.
getVelocity
(
1
)
/
constants
::
c
};
// loop over every antenna
// calculate gamma factor using beta (the proper way would be with energy over mass but not yet :( )
for
(
auto
&
antenna
:
getAntennas
())
{
auto
startGamma_
{
1.
/
sqrt
(
1.
-
(
startBeta_
*
startBeta_
))};
auto
endGamma_
{
1.
/
sqrt
(
1.
-
(
endBeta_
*
endBeta_
))};
//
use TPropagator to calculate Path from track to antenna
//
we loop over each antenna in the collection
auto
paths
=
;
/* a collection of paths */
for
(
auto
&
antenna
:
detector_
.
getAntennas
())
{
// do endpoint + ZHS formalism
// auto startPoint = /* TODO: get Point from Track */;
auto
startPoint
=
track
.
getPosition
(
0
);
// this MIGHT work and also get it out of the for loop?
auto
endPoint
=
track
.
getPosition
(
1
);
// I think we should get these guys out of the for loop
// get the Path from the track to the antenna
// This is a SignalPathCollection
auto
paths1
{
this
->
propagator_
.
propagate
(
startPoint
,
antenna
.
getLocation
())};
// give the electric field and the direction to the antenna
// now loop over the paths that we got above
antenna
.
receive
(...);
// << something
// Note: for the StraightPropagator, there will only be a single
}
// path but other propagators may return more than one.
for
(
auto
const
&
path
:
paths1
)
{
// auto startPoint_ {path.total_time_ + startTime_};
// path.average_refractivity_;
// path.emit_;
// path.receive_;
// combination along this path.
// global time + time delay
// and pass it to the antenna.
// CoREAS calculation -> get ElectricFieldVector1
antenna
.
receive
(
/* startPoint_, receive vector, ElectricFieldVector1 */
);
}
// END: loop over paths
// get the Path from the track to the antenna
// This is a SignalPathCollection
auto
paths2
{
this
->
propagator_
.
propagate
(
endPoint
,
antenna
.
getLocation
())};
for
(
auto
const
&
path
:
paths2
)
{
// auto endPoint_ {path.total_time + endTime_};
// path.average_refractivity_;
// path.emit_;
// path.receive_;
// combination along this path.
// global time + time delay
// and pass it to the antenna.
//CoREAS calculation -> get ElectricFieldVector2
antenna
.
receive
(
/* endPoint_, receive vector, ElectricFieldVector2 */
);
}
// END: loop over paths
}
// END: loop over antennas
}
}
/**
/**
...
@@ -60,7 +125,16 @@ namespace corsika {
...
@@ -60,7 +125,16 @@ namespace corsika {
*/
*/
template
<
typename
Particle
,
typename
Track
>
template
<
typename
Particle
,
typename
Track
>
LengthType
MaxStepLength
(
Particle
const
&
particle
,
LengthType
MaxStepLength
(
Particle
const
&
particle
,
Track
const
&
track
)
const
;
Track
const
&
track
)
const
{
// TODO : This is where we control the maximum step size
// of a particle track in order to maintain the accuracy
// of the particular formalism.
//
// This is part of the ZHS / CoReas formalisms and can
// be related from the magnetic field / acceleration, charge,
// etc. of the particle.
}
};
// END: class RadioProcess
};
// END: class RadioProcess
...
...
This diff is collapsed.
Click to expand it.
corsika/modules/radio/RadioProcess.hpp
+
38
−
3
View file @
c7101d7f
...
@@ -7,13 +7,16 @@
...
@@ -7,13 +7,16 @@
*/
*/
#pragma once
#pragma once
#include
<corsika/framework/process/ContinuousProcess.hpp>
#include
<istream>
#include
<istream>
#include
<fstream>
#include
<fstream>
#include
<iostream>
#include
<iostream>
#include
<xtensor/xcsv.hpp>
#include
<xtensor/xcsv.hpp>
#include
<xtensor/xtensor.hpp>
#include
<xtensor/xtensor.hpp>
#include
<string>
#include
<string>
#include
<corsika/framework/process/ContinuousProcess.hpp>
#include
<corsika/setup/SetupStack.hpp>
#include
<corsika/setup/SetupTrajectory.hpp>
namespace
corsika
{
namespace
corsika
{
...
@@ -28,6 +31,14 @@ namespace corsika {
...
@@ -28,6 +31,14 @@ namespace corsika {
class
RadioProcess
:
public
ContinuousProcess
<
class
RadioProcess
:
public
ContinuousProcess
<
RadioProcess
<
TRadioDetector
,
TRadioImpl
,
TPropagator
>>
{
RadioProcess
<
TRadioDetector
,
TRadioImpl
,
TPropagator
>>
{
using
ParticleType
=
corsika
::
setup
::
Stack
::
particle_type
;
using
TrackType
=
corsika
::
LeapFrogTrajectory
;
/**
* A collection of filter objects for deciding on valid particles and tracks.
*/
std
::
vector
<
std
::
function
<
bool
(
ParticleType
&
,
TrackType
const
&
)
>>
filters_
;
/**
/**
* Get a reference to the underlying radio implementation.
* Get a reference to the underlying radio implementation.
*/
*/
...
@@ -64,14 +75,38 @@ namespace corsika {
...
@@ -64,14 +75,38 @@ namespace corsika {
*/
*/
template
<
typename
Particle
,
typename
Track
>
template
<
typename
Particle
,
typename
Track
>
ProcessReturn
doContinuous
(
Particle
&
particle
,
Track
const
&
track
)
const
{
ProcessReturn
doContinuous
(
Particle
&
particle
,
Track
const
&
track
)
const
{
//we want the following particles:
// Code::Electron & Code::Positron & Code::Gamma
// we wrap Simulate() in doContinuous as the plan is to add particle level
// we wrap Simulate() in doContinuous as the plan is to add particle level
// filtering or thinning for calculation of the radio emission. This is
// filtering or thinning for calculation of the radio emission. This is
// important for controlling the runtime of radio (by ignoring particles
// important for controlling the runtime of radio (by ignoring particles
// that aren't going to contribute i.e. heavy hadrons)
// that aren't going to contribute i.e. heavy hadrons)
return
this
->
implementation
().
simulate
(
particle
,
track
);
if
(
valid
(
particle
,
track
))
{
return
this
->
implementation
().
simulate
(
particle
,
track
);
}
}
/**
* Decide whether this particle and track is valid for radio emission.
*/
template
<
typename
Particle
,
typename
Track
>
auto
valid
(
Particle
&
particle
,
Track
const
&
track
)
const
{
// loop over the filters in the our collection
for
(
auto
&
filter
:
filters_
)
{
// evaluate the filter. If the filter returns false,
// then this track is not valid for radio emission.
if
(
!
filter
(
particle
,
track
))
return
false
;
}
}
}
/**
template
<
typename
Particle
,
typename
Track
>
void
addFilter
(
const
std
::
function
<
bool
(
Particle
&
,
Track
const
&
)
>
filter
)
{
filters_
.
push_back
(
filter
);
}
/**
* TODO: This is placeholder so we can use text output while
* TODO: This is placeholder so we can use text output while
* we wait for the true output formatting to be ready.
* we wait for the true output formatting to be ready.
**/
**/
...
...
This diff is collapsed.
Click to expand it.
corsika/modules/radio/ZHS.hpp
+
17
−
7
View file @
c7101d7f
...
@@ -9,6 +9,8 @@
...
@@ -9,6 +9,8 @@
#include
<corsika/modules/radio/RadioProcess.hpp>
#include
<corsika/modules/radio/RadioProcess.hpp>
#include
<corsika/modules/radio/propagators/StraightPropagator.hpp>
#include
<corsika/modules/radio/propagators/StraightPropagator.hpp>
#include
<corsika/framework/geometry/QuantityVector.hpp>
#include
<corsika/framework/core/PhysicalUnits.hpp>
namespace
corsika
{
namespace
corsika
{
...
@@ -22,6 +24,8 @@ namespace corsika {
...
@@ -22,6 +24,8 @@ namespace corsika {
using
Base
::
detector_
;
using
Base
::
detector_
;
public:
public:
using
ElectricFieldVector
=
QuantityVector
<
ElectricFieldType
::
dimension_type
>
;
/**
/**
* Construct a new ZHS instance.
* Construct a new ZHS instance.
*
*
...
@@ -45,26 +49,27 @@ namespace corsika {
...
@@ -45,26 +49,27 @@ namespace corsika {
template
<
typename
Particle
,
typename
Track
>
template
<
typename
Particle
,
typename
Track
>
ProcessReturn
simulate
(
Particle
&
particle
,
Track
const
&
track
)
const
{
ProcessReturn
simulate
(
Particle
&
particle
,
Track
const
&
track
)
const
{
auto
global_time
=
particle
.
getTime
();
// this is very shady at the moment...
auto
globalTime_
=
particle
.
getTime
();
// this is very shady at the moment...
//get global time for that track
//get global time for that track
auto
start
t
ime
=
track
.
getDuration
(
0
);
// time at start point of track.
//
auto start
T
ime
_
= track.getDuration(0); // time at start point of track.
auto
end
t
ime
=
track
.
getDuration
(
1
);
// time at end point of track.
//
auto end
T
ime
_
= track.getDuration(1); // time at end point of track.
// we loop over each antenna in the collection
// we loop over each antenna in the collection
for
(
auto
&
antenna
:
detector_
.
getAntennas
())
{
for
(
auto
&
antenna
:
detector_
.
getAntennas
())
{
// auto start = /* TODO: get Point from Track */;
// auto start = /* TODO: get Point from Track */;
auto
start
=
track
.
get
Start
();
// just another shady idea...
auto
start
Point
=
track
.
get
Position
(
0
);
// this MIGHT work and also get it out of the for loop?
// get the Path from the track to the antenna
// get the Path from the track to the antenna
// This is a SignalPathCollection
// This is a SignalPathCollection
auto
paths
{
this
->
propagator_
.
propagate
(
start
,
antenna
.
getLocation
())};
auto
paths
{
this
->
propagator_
.
propagate
(
start
Point
,
antenna
.
getLocation
())};
// now loop over the paths that we got above
// now loop over the paths that we got above
// Note: for the StraightPropagator, there will only be a single
// Note: for the StraightPropagator, there will only be a single
// path but other propagators may return more than one.
// path but other propagators may return more than one.
for
(
auto
const
&
path
:
paths
)
{
for
(
auto
const
&
path
:
paths
)
{
// path.total_time_ + global
_t
ime;
// path.total_time_ + global
T
ime
_
;
// path.average_refractivity_;
// path.average_refractivity_;
// path.emit_;
// path.emit_;
// path.receive_;
// path.receive_;
...
@@ -73,6 +78,11 @@ namespace corsika {
...
@@ -73,6 +78,11 @@ namespace corsika {
// combination along this path.
// combination along this path.
// global time + time delay
// global time + time delay
// and pass it to the antenna.
// and pass it to the antenna.
// ElectricFieldVector EV_ = -(constants)*(V_perpendicular)*
// (delta(global time + time delay - (1 - average_refractivity*beta*costheta)t1)
// - delta(global time + time delay- (1 - average_refractivity*beta*costheta)t1))
// /(1 - average_refractivity*beta*costheta);
antenna
.
receive
(
/* global time + time delay, receive vector, ElectricFieldVector */
);
antenna
.
receive
(
/* global time + time delay, receive vector, ElectricFieldVector */
);
}
// END: loop over paths
}
// END: loop over paths
...
@@ -94,7 +104,7 @@ namespace corsika {
...
@@ -94,7 +104,7 @@ namespace corsika {
LengthType
MaxStepLength
(
Particle
const
&
particle
,
LengthType
MaxStepLength
(
Particle
const
&
particle
,
Track
const
&
track
)
const
{
Track
const
&
track
)
const
{
// TODO : This is where
t
e control the maximum step size
// TODO : This is where
w
e control the maximum step size
// of a particle track in order to maintain the accuracy
// of a particle track in order to maintain the accuracy
// of the particular formalism.
// of the particular formalism.
//
//
...
...
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