3 #include <fwk/CentralConfig.h>
5 #include <utl/ErrorLogger.h>
6 #include <utl/Reader.h>
7 #include <utl/config.h>
8 #include <utl/TraceAlgorithm.h>
10 #include <evt/Event.h>
11 #include <revt/REvent.h>
12 #include <revt/Station.h>
13 #include <revt/Channel.h>
14 #include <rdet/RDetector.h>
15 #include <rdet/Channel.h>
31 RdDummyChannelToStationConverter::~RdDummyChannelToStationConverter()
45 INFO(
"RdDummyChannelToStationConverter::Init()");
47 CentralConfig::GetInstance()->
GetTopBranch(
"RdDummyChannelToStationConverter");
49 topBranch.
GetChild(
"UseIntegratedAntennaPattern").
GetData(fUseIntegratedAntennaPattern);
60 WARNING(
"No radio event found!");
64 REvent& rEvent =
event.GetREvent();
67 VDZero = 0.0, 0.0, 0.0;
68 stringstream fMessage;
74 bool firststationchannel =
true;
84 fMessage <<
"Copying channel "
88 <<
" to the StationTimeSeries.";
96 if (firststationchannel) {
97 firststationchannel =
false;
99 newstationtimeseries =
StationTimeSeries(channeltrace.GetSize(),channeltrace.GetBinning(),VDZero);
105 if (newstationtimeseries.
GetSize() != channeltrace.GetSize()) {
107 fMessage <<
"Number of samples in trace of "
109 <<
" belonging to station "
111 <<
" is different than the number of samples in other channels of that station.";
117 det::Detector::GetInstance().GetRDetector();
123 if (orientAzimuth < 0 && orientAzimuth > -360 *
deg)
124 orientAzimuth += 360 *
deg;
130 double alignMargin = 5*
deg;
131 if ( orientZenith > alignMargin ) {
132 fMessage <<
"Encountering a channel that seems to be vertically aligned, not converting.";
137 double correspondingCoordinate;
138 double correspondingSign;
140 fMessage <<
"Associating channel " << channel.
GetId() <<
" for station " << station.
GetId() <<
" at " <<
141 orientAzimuth/
deg <<
" deg azimuthal angle";
142 if ( orientAzimuth < alignMargin or orientAzimuth > 360 *
deg - alignMargin ) {
143 fMessage <<
" with a positive x coordinate.";
144 INFO(fMessage.str());
145 correspondingCoordinate = 0;
146 correspondingSign = 1;
147 }
else if ( orientAzimuth > 90 *
deg - alignMargin or orientAzimuth < 90 *
deg + alignMargin ) {
148 fMessage <<
" with a positive y coordinate.";
149 INFO(fMessage.str());
150 correspondingCoordinate = 1;
151 correspondingSign = 1;
152 }
else if ( orientAzimuth > 180 *
deg - alignMargin or orientAzimuth < 180 *
deg + alignMargin ) {
153 fMessage <<
" with a negative x coordinate.";
154 INFO(fMessage.str());
155 correspondingCoordinate = 0;
156 correspondingSign = -1;
157 }
else if ( orientAzimuth > 270 *
deg - alignMargin or orientAzimuth < 270 *
deg + alignMargin ) {
158 fMessage <<
" with a negative y coordinate.";
159 INFO(fMessage.str());
160 correspondingCoordinate = 1;
161 correspondingSign = -1;
164 fMessage <<
"No good dodgy conversion possible because the antenna does not seem to be aligned with " <<
165 "any spatial coordinate within " << alignMargin/
deg <<
"deg.";
171 if (fUseIntegratedAntennaPattern) {
182 if ((freq >= lowerDesignFreq) && (freq <= upperDesignFreq))
185 channelspectrum[i] = 0.0;
194 newstationtimeseries[i][correspondingCoordinate] = correspondingSign * newchanneltrace[i];
206 RdDummyChannelToStationConverter::Finish()
211 INFO(
"RdDummyChannelToStationConverter::Finish()");
Branch GetTopBranch() const
int GetId() const
Return Id of the Channel.
double GetDesignUpperFreq() const
Get design value of the freq-band.
boost::indirect_iterator< InternalChannelIterator, Channel & > ChannelIterator
Iterator over station for read/write.
utl::TraceV3D StationTimeSeries
Interface class to access to the Radio part of an event.
double GetDesignLowerFreq() const
Get design value of the freq-band.
#define INFO(message)
Macro for logging informational messages.
StationIterator StationsEnd()
StationIterator StationsBegin()
void Init()
Initialise the registry.
Detector description interface for Channel-related data.
double GetOrientationZenith() const
Get zenith-direction of Antenna for this Channel.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
ChannelIterator ChannelsBegin()
begin Channel iterator for read/write
boost::filter_iterator< StationFilter, AllStationIterator > StationIterator
Iterator over all (non-exculded) stations.
int GetStationId() const
Return Id of the station to which this Channel belongs.
StationTimeSeries & GetStationTimeSeries()
retrieve Station Time Series (write access, only use this if you intend to change the data) ...
unsigned int GetNyquistZone() const
Get the Nyquist zone.
ChannelTimeSeries & GetChannelTimeSeries()
retrieve Channel Time Series (write access, only use this if you intend to change the data) ...
ChannelIterator ChannelsEnd()
end Channel iterator for read/write
Detector description interface for RDetector-related data.
Class representing a document branch.
class to hold data at the radio Station level.
std::vector< std::complex< double > >::size_type SizeType
void SetNyquistZone(const unsigned int zone)
Set the Nyquist zone.
#define WARNING(message)
Macro for logging warning messages.
void GetData(bool &b) const
Overloads of the GetData member template function.
int GetId() const
Get the station Id.
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.
ChannelFrequencySpectrum & GetChannelFrequencySpectrum()
retrieve Channel Frequency Spectrum (write access, only use this if you intend to change the data) ...
double GetFrequencyOfBin(const ChannelFrequencySpectrum::SizeType bin) const
Get the frequency corresponding to a bin of the frequency spectrum.
Class that holds the data associated to an individual radio channel.
const Station & GetStation(const int stationId) const
Get station by Station Id.
double GetIntegratedEffectiveAntennaHeight(const double freq) const
double GetOrientationAzimuth() const
Get azimuth-direction of Antenna for this Channel.