3 #include <fwk/CentralConfig.h>
4 #include <fwk/LocalCoordinateSystem.h>
6 #include <utl/TraceAlgorithm.h>
7 #include <utl/ErrorLogger.h>
8 #include <utl/Vector.h>
11 #include <evt/Event.h>
12 #include <evt/ShowerSimData.h>
14 #include <revt/REvent.h>
15 #include <revt/Station.h>
16 #include <revt/Channel.h>
18 #include <det/Detector.h>
20 #include <rdet/RDetector.h>
21 #include <rdet/Station.h>
22 #include <rdet/Channel.h>
24 #include <atm/Atmosphere.h>
25 #include <atm/ProfileResult.h>
37 Branch topBranch = CentralConfig::GetInstance()->
GetTopBranch(
"RdAntennaStationToChannelConverter");
42 std::string tmpstring = topBranch.
GetChild(
"Direction").
Get<std::string>();
43 fDirectionPerStation = tmpstring ==
"LineOfSightStationShowerMaximum";
45 topBranch.
GetChild(
"CalculateDistanceToXmaxOnTheFly").
GetData(fCalculateDistanceToXmaxOnTheFly);
48 std::ostringstream info;
49 info <<
"\n\tInterplation mode : " << fInterpolationMode
50 <<
"\n\tDirection used : " << tmpstring <<
"\n ";
58 RdAntennaStationToChannelConverter::Run(
evt::Event& event)
64 ERROR(
"Event has no simulated data.");
70 ERROR(
"SimShower has no radio simulation.");
76 const double zenith = simAxis.
GetTheta(localCS);
77 const double azimuth = simAxis.
GetPhi(localCS);
80 if (fDirectionPerStation) {
82 double distanceToXmax = -1;
84 if (fCalculateDistanceToXmaxOnTheFly) {
86 const double xmaxMC = gh.
GetXMax();
89 const atm::Atmosphere& theAtm = det::Detector::GetInstance().GetAtmosphere();
94 distanceToXmax =
abs(distanceFromDepth.
Y(xmaxMC));
97 if (distanceToXmax < 0) {
98 std::ostringstream err;
99 err <<
"Distance to shower maximum (as stored in the .reas file) is negative. "
100 "This might happens for mpi generated simulations. Using \"MCAxis\" in "
101 " the XML config does not need the distance to the shower maximum. Abort...";
106 posShowerMaximum = simShower.
GetPosition() + simAxis * distanceToXmax;
111 ERROR(
"Event has simulated shower but no radio event. Use RdStationAssociator!");
112 return eContinueLoop;
116 REvent& rEvent =
event.GetREvent();
117 const rdet::RDetector& rDetector = det::Detector::GetInstance().GetRDetector();
123 double stationZenith = -1;
124 double stationAzimuth = -1;
125 if (fDirectionPerStation) {
128 const Vector stationToShowerMaximum = posShowerMaximum - posStation;
129 stationZenith = stationToShowerMaximum.
GetTheta(stationCS);
130 stationAzimuth = stationToShowerMaximum.
GetPhi(stationCS);
132 stationZenith = zenith;
133 stationAzimuth = azimuth;
136 if (fInfoLevel >= eInfoIntermediate) {
137 std::ostringstream info;
138 info <<
"Direction used for station " << sIt->GetId() <<
": "
139 <<
"zenith = " << stationZenith /
utl::deg <<
" deg"
140 <<
", azimuth = " << stationZenith /
utl::deg <<
" deg";
156 ConvertToShowerCS(efield, eFieldSCS, stationZenith, stationAzimuth);
164 for (Station::ChannelIterator cIt = sIt->ChannelsBegin(); cIt != sIt->ChannelsEnd(); ++cIt) {
173 cChannelResponseSpectrum.
Clear();
176 cChannelResponseSpectrum.
SetBinning(sIt->GetStationFrequencySpectrum().GetBinning());
177 cIt->SetNyquistZone(sIt->GetNyquistZone());
183 std::pair<std::complex<double>, std::complex<double>> cEffectiveAntennaHeight;
189 const double frequency = StationDataSCS.GetFrequencyOfBin(i);
190 if (frequency >= designlowerfrequency && frequency <= designupperfrequency) {
192 StationDataSCS.GetFrequencyOfBin(i),
198 cEffectiveAntennaHeight.first * eFieldSCSSpec[i][0]
199 + cEffectiveAntennaHeight.second * eFieldSCSSpec[i][1]);
201 cChannelResponseSpectrum.
PushBack(std::complex<double>(0., 0.));
214 double sZen,
double sAzi)
220 double tmpVector[3] = {
221 (cos(sZen) * cos(sAzi) * eFieldXYZ[i][0] + cos(sZen) * sin(sAzi) * eFieldXYZ[i][1]
222 - sin(sZen) * eFieldXYZ[i][2]),
223 (-sin(sAzi) * eFieldXYZ[i][0] + cos(sAzi) * eFieldXYZ[i][1]),
224 (sin(sZen) * cos(sAzi) * eFieldXYZ[i][0] + sin(sZen) * sin(sAzi) * eFieldXYZ[i][1]
225 + cos(sZen) * eFieldXYZ[i][2])
233 RdAntennaStationToChannelConverter::Finish()
Branch GetTopBranch() const
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Get the Auger coordinate system associated to the shower core position.
Top of the interface to Atmosphere information.
double GetPhi(const CoordinateSystemPtr &coordinateSystem) const
azimuth (phi) angle in spherical and cylindrical coordinates
void InitSlantProfileModel(const utl::Point &core, const utl::Vector &dir, const double deltaX) const
double GetDesignUpperFreq() const
Get design value of the freq-band.
const evt::VGaisserHillasParameter & GetGHParameters() const
Get the Gaisser-Hillas parameters of the shower.
Interface class to access to the Radio part of an event.
double GetTheta(const CoordinateSystemPtr &coordinateSystem) const
zenith (theta) angle in spherical coordinates
double GetDesignLowerFreq() const
Get design value of the freq-band.
bool HasSimShower() const
double GetBinning() const
size of one slot
const atm::ProfileResult & EvaluateDistanceVsSlantDepth() const
Table of distance as a function of slant depth.
#define INFO(message)
Macro for logging informational messages.
bool HasRadioSimulation() const
Check initialization of the RadioSimulation.
utl::SVector< 3, double > Vector3D
StationIterator StationsEnd()
StationIterator StationsBegin()
void Init()
Initialise the registry.
Base class for exceptions trying to access non-existing components.
Detector description interface for Channel-related data.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
boost::filter_iterator< StationFilter, AllStationIterator > StationIterator
Iterator over all (non-exculded) stations.
double Y(const double x) const
Get the Y value (coordinate) for given X (ordinate)
Detector description interface for RDetector-related data.
Interface class to access Shower Simulated parameters.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Class representing a document branch.
double GetDistanceOfShowerMaximum() const
Get the geometrical distance of the shower maximum from the core.
const utl::Vector & GetDirection() const
Get the direction of the shower axis. This is the true direction of shower movement.
C< F > & GetFrequencySpectrum()
read out the frequency spectrum (write access)
std::vector< T >::size_type SizeType
Class describing the Atmospheric profile.
double abs(const SVector< n, T > &v)
const utl::Point & GetPosition() const
Get the position of the shower core.
C< T > & GetTimeSeries()
read out the time series (write access)
void GetData(bool &b) const
Overloads of the GetData member template function.
const Channel & GetChannel(const int id) const
Get specified Channel by id.
void SetBinning(const double binning)
Template class for a data container that offers and takes both time series and corresponding frequenc...
ResultFlag
Flag returned by module methods to the RunController.
Template class for a FADC data or calibrated data container. Use the typedefs (TraceD, TraceI, etc.) defined in Trace-fwd.h.
void SetNyquistZone(const unsigned int zone)
set the Nyquist zone
utl::Point GetPosition() const
Tank position in Site Cartesian Coordinates.
std::pair< std::complex< double >, std::complex< double > > GetElectricFieldResponse(const double theta, const double phi, const double freq, std::string interpolationMode) const
void PushBack(const T &value)
Insert a single value at the end.
#define ERROR(message)
Macro for logging error messages.
const Station & GetStation(const int stationId) const
Get station by Station Id.