2 #include <fwk/CentralConfig.h>
3 #include <utl/ErrorLogger.h>
6 #include <revt/REvent.h>
7 #include <revt/Header.h>
8 #include <revt/Station.h>
9 #include <revt/Channel.h>
10 #include <revt/StationRecData.h>
12 #include <utl/Trace.h>
13 #include <utl/TraceAlgorithm.h>
14 #include <utl/ErrorLogger.h>
15 #include <utl/Reader.h>
16 #include <utl/config.h>
17 #include <utl/AugerUnits.h>
18 #include <utl/MathConstants.h>
19 #include <utl/TimeStamp.h>
20 #include <utl/TimeInterval.h>
21 #include <utl/FFTDataContainerAlgorithm.h>
22 #include <utl/AugerException.h>
24 #include <det/Detector.h>
25 #include <rdet/RDetector.h>
49 fBeaconFrequencies(vector<double>()),
55 RdChannelBeaconSignalExtractor::~RdChannelBeaconSignalExtractor()
69 INFO(
"RdChannelBeaconSignalExtractor::Init()");
73 CentralConfig::GetInstance()->
GetTopBranch(
"RdChannelBeaconSignalExtractor");
75 if (fInfoLevel < eNone || fInfoLevel >
eDebug) {
76 ERROR(
"<infoLevel> out of bounds");
90 INFO(
"RdChannelBeaconSignalExtractor::Run()");
94 WARNING(
"RdChannelBeaconSignalExtractor::No radio event found!");
101 fBeaconFrequencies = det::Detector::GetInstance().GetRDetector().GetBeaconFrequencies();
105 stringstream fMessage;
107 fMessage <<
"Number of beacon frequencies to look at: "
109 INFO(fMessage.str());
112 WARNING(
"You must provide at least one frequency!");
117 REvent& rEvent =
event.GetREvent();
123 double referenceAmplitude = 0;
140 fMessage <<
"Reading data from station "
145 INFO(fMessage.str());
152 set<int> beaconFrequencyBins;
158 fMessage <<
"Beacon frequency: "
161 INFO(fMessage.str());
164 fMessage <<
"Spectrum reaches from "
168 <<
" MHz, binning = "
171 INFO(fMessage.str());
176 if ( ((spectrum.
GetSize()-1) % 1024) != 0 ) {
178 fMessage <<
"Trace of station " << station.
GetId() <<
" does not consist of 2048 samples or an integer multiple of it! "
179 <<
"It has " << (spectrum.
GetSize()-1)*2 <<
" samples.";
187 WARNING(
"Beacon frequency must be inside of the spectrum!");
195 beaconFrequencyBins.insert(round(bin));
200 phase = arg(spectrum[round(bin)]);
203 fMessage <<
"Looking at frequency: "
206 <<
"Phase: " << phase;
207 INFO(fMessage.str());
210 if ((i==0) && (referenceAmplitude == 0))
211 referenceAmplitude =
abs(spectrum[round(bin)]);
217 fMessage <<
"Found: "
218 << beaconFrequencyBins.size()
219 <<
" beacon frequency bins.";
220 INFO(fMessage.str());
223 WARNING(
"Number of found beacon frequency bins differs from number of provided beacon frequencies.");
229 for (
unsigned int i=0; i < spectrum.
GetSize(); ++i) {
230 if ( beaconFrequencyBins.find(i) == beaconFrequencyBins.end() ) {
231 spectrum[i] *= 1.e-3;
233 spectrum[i] *= referenceAmplitude /
abs(spectrum[i]);
245 RdChannelBeaconSignalExtractor::Finish()
247 stringstream fMessage;
251 INFO(
"RdChannelBeaconSignalExtractor::Finish()");
257 RdChannelBeaconSignalExtractor::matchStationTimeStamps(
revt::REvent& rEvent)
const
268 if (stationTimeStamp != firstTimeStamp) {
274 FFTDataContainerAlgorithm::ShiftTimeSeries(channel.
GetFFTDataContainer(), stationTimeStamp-firstTimeStamp);
ChannelFFTDataContainer & GetFFTDataContainer()
retrieve Channel FFTDataContainer (write access)
Branch GetTopBranch() const
boost::filter_iterator< CandidateStationFilter, AllStationIterator > CandidateStationIterator
Iterator over all CandidateStations (i.e., HasSignal, HasNoSignal)
int GetId() const
Return Id of the Channel.
Report success to RunController.
StationRecData & GetRecData()
Get station level reconstructed data.
CandidateStationIterator CandidateStationsEnd()
Interface class to access to the Radio part of an event.
Skip remaining modules in the current loop and continue with next iteration of the loop...
double GetBinning() const
size of one slot
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
ChannelIterator ChannelsBegin()
begin Channel iterator for read/write
int GetStationId() const
Return Id of the station to which this Channel belongs.
ChannelIterator ChannelsEnd()
end Channel iterator for read/write
Class representing a document branch.
Break current loop. It works for nested loops too!
class to hold data at the radio Station level.
std::vector< double >::size_type SizeType
double abs(const SVector< n, T > &v)
CandidateStationIterator CandidateStationsBegin()
constexpr double megahertz
#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.
double GetParameter(const Parameter i) const
ResultFlag
Flag returned by module methods to the RunController.
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.
void SetParameter(Parameter i, double value, bool lock=true)
Class that holds the data associated to an individual radio channel.
Report failure to RunController, causing RunController to terminate execution.
#define ERROR(message)
Macro for logging error messages.