IAP GITLAB

Skip to content
Snippets Groups Projects
Commit c9eaa2df authored by Nikos Karastathis's avatar Nikos Karastathis :ocean:
Browse files

adjust radio to use the step object

parent 0d3e1440
No related branches found
No related tags found
1 merge request!329Radio interface
......@@ -13,15 +13,14 @@
namespace corsika {
template <typename TRadioDetector, typename TPropagator>
template <typename Particle, typename Track>
template <typename Particle>
inline ProcessReturn CoREAS<TRadioDetector, TPropagator>::simulate(
Particle const& particle, Track const& track) {
Step<Particle> const& step) {
// get the global simulation time for that track.
auto const startTime_{
track.getTime(particle, 0)}; // time at the start point of the track hopefully. I
auto const startTime_{step.getTimePre()}; // time at the start point of the track. I
// should use something similar to fCoreHitTime (?)
auto const endTime_{track.getTime(particle, 1)}; // time at end point of track.
auto const endTime_{step.getTimePost()}; // time at end point of track.
trackcounter_ += 1;
// CORSIKA_LOG_DEBUG("Number of total tracks for radio: {} ", trackcounter_);
......@@ -32,8 +31,8 @@ namespace corsika {
} else {
// get start and end position of the track
Point const startPoint_{track.getPosition(0)};
Point const endPoint_{track.getPosition(1)};
Point const startPoint_{step.getPositionPre()};
Point const endPoint_{step.getPositionPost()};
// get the coordinate system of the startpoint and hence the track
auto const cs_ {startPoint_.getCoordinateSystem()};
......@@ -47,7 +46,7 @@ namespace corsika {
auto const beta_{currDirection * corrBetaValue};
// get particle charge
auto const charge_{get_charge(particle.getPID())};
auto const charge_{get_charge(step.getParticlePre().getPID())};
// constants for electric field vector calculation
auto const constants_{charge_ / (4 * M_PI) / (constants::epsilonZero) /
......
......@@ -31,10 +31,9 @@ namespace corsika {
, propagator_(args...) {}
template <typename TAntennaCollection, typename TRadioImpl, typename TPropagator>
template <typename Particle, typename Track>
template <typename Particle>
inline ProcessReturn RadioProcess<TAntennaCollection, TRadioImpl,
TPropagator>::doContinuous(const Particle& particle,
const Track& track,
TPropagator>::doContinuous(const Step<Particle>& step,
const bool) {
// we want the following particles:
// Code::Electron & Code::Positron & Code::Gamma
......@@ -44,10 +43,10 @@ namespace corsika {
// important for controlling the runtime of radio (by ignoring particles
// that aren't going to contribute i.e. heavy hadrons)
// if (valid(particle, track)) {
auto const particleID_{particle.getPID()};
auto const particleID_{step.getParticlePre().getPID()};
if ((particleID_ == Code::Electron) || (particleID_ == Code::Positron)) {
CORSIKA_LOG_DEBUG("Particle for radio calculation: {} ", particleID_);
return this->implementation().simulate(particle, track);
return this->implementation().simulate(step);
} else {
CORSIKA_LOG_DEBUG("Particle {} is irrelevant for radio", particleID_);
return ProcessReturn::Ok;
......
......@@ -13,25 +13,25 @@
namespace corsika {
template <typename TRadioDetector, typename TPropagator>
template <typename Particle, typename Track>
template <typename Particle>
inline ProcessReturn ZHS<TRadioDetector, TPropagator>::simulate(
Particle const& particle, Track const& track) const {
auto const startTime{particle.getTime()};
auto const endTime{particle.getTime() + track.getDuration()};
Step<Particle> const& step) const {
auto const startTime{step.getTimePre()};
auto const endTime{step.getTimePost()};
if (startTime == endTime) {
return ProcessReturn::Ok;
} else {
auto const startPoint{track.getPosition(0)};
auto const endPoint{track.getPosition(1)};
auto const startPoint{step.getPositionPre()};
auto const endPoint{step.getPositionPost()};
LengthType const trackLength{(startPoint - endPoint).getNorm()};
auto const betaModule{(endPoint - startPoint).getNorm() /
(constants::c * (endTime - startTime))};
auto const beta{(endPoint - startPoint).normalized() * betaModule};
auto const charge{get_charge(particle.getPID())};
auto const charge{get_charge(step.getParticlePre().getPID())};
// // get "mid" position of the track geometrically
......@@ -54,14 +54,14 @@ namespace corsika {
if (fraunhLimit > 1.0) {
/// code for dividing track and calculating field.
double const nSubTracks{sqrt(fraunhLimit) + 1};
auto const step{(endPoint - startPoint) / nSubTracks};
auto const step_{(endPoint - startPoint) / nSubTracks};
TimeType const timeStep{(endTime - startTime) / nSubTracks};
// energy should be divided up when it is possible to get the energy at end of
// track!!!!
auto point1{startPoint};
TimeType time1{startTime};
for (int j{0}; j < nSubTracks; j++) {
auto const point2{point1 + step};
auto const point2{point1 + step_};
TimeType const time2{time1 + timeStep};
auto const newHalfVector{(point1 - point2) / 2.};
auto const newMidPoint{point2 + newHalfVector};
......@@ -144,7 +144,7 @@ namespace corsika {
} // end of loop over newMidPaths
// update points for next sub track
point1 = point1 + step;
point1 = point1 + step_;
time1 = time1 + timeStep;
}
......
......@@ -45,8 +45,8 @@ namespace corsika {
* @param track The current track.
*
*/
template <typename Particle, typename Track>
ProcessReturn simulate(Particle const& particle, Track const& track);
template <typename Particle>
ProcessReturn simulate(Step<Particle> const& step);
private:
int tinycounter_{0};
......
......@@ -13,6 +13,7 @@
#include <string>
#include <corsika/output/BaseOutput.hpp>
#include <corsika/framework/process/ContinuousProcess.hpp>
#include <corsika/framework/core/Step.hpp>
#include <corsika/setup/SetupStack.hpp>
#include <corsika/setup/SetupTrajectory.hpp>
......@@ -66,8 +67,8 @@ namespace corsika {
* @param particle The current particle.
* @param track The current track.
*/
template <typename Particle, typename Track>
ProcessReturn doContinuous(Particle const& particle, Track const& track, bool const);
template <typename Particle>
ProcessReturn doContinuous(Step<Particle> const& step, bool const);
/**
* Return the maximum step length for this particle and track.
......
......@@ -47,8 +47,8 @@ namespace corsika {
* @param track The current track.
*
*/
template <typename Particle, typename Track>
ProcessReturn simulate(Particle const& particle, Track const& track) const;
template <typename Particle>
ProcessReturn simulate(Step<Particle> const& step) const;
private:
using Base =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment