3 #include <fwk/CentralConfig.h>
4 #include <fwk/RunController.h>
5 #include <fwk/LocalCoordinateSystem.h>
6 #include <fwk/CoordinateSystemRegistry.h>
7 #include <fwk/VModule.h>
9 #include <utl/ErrorLogger.h>
10 #include <utl/Reader.h>
11 #include <utl/config.h>
12 #include <utl/TraceAlgorithm.h>
13 #include <utl/PhysicalConstants.h>
14 #include <utl/AxialVector.h>
16 #include <utl/FFTDataContainerAlgorithm.h>
18 #include <evt/Event.h>
19 #include <revt/REvent.h>
20 #include <revt/Station.h>
21 #include <revt/Channel.h>
22 #include <revt/Header.h>
23 #include <revt/StationRecData.h>
25 #include <det/Detector.h>
26 #include <rdet/RDetector.h>
42 << g.GetX(cs)/
meter <<
", "
43 << g.GetY(cs)/
meter <<
", "
44 << g.GetZ(cs)/
meter <<
") [m]";
49 fBeaconFrequencies(vector<double>())
53 RdChannelBeaconSimulator::~RdChannelBeaconSimulator()
66 INFO(
"RdChannelBeaconSimulator::Init()");
70 CentralConfig::GetInstance()->
GetTopBranch(
"RdChannelBeaconSimulator");
84 stringstream fMessage;
87 WARNING(
"No radio event found!");
92 fMessage <<
"Start Beaconsimulator!!! ";
95 REvent& rEvent =
event.GetREvent();
113 const Point siteOrigin(0,0,0, referenceCS);
114 Vector vStationPosition(0,0,0, referenceCS);
116 Vector vPositionDifference(0,0,0, referenceCS);
121 sIt != rEvent.StationsEnd(); ++sIt) {
126 vStationPosition = dStation.
GetPosition() - siteOrigin;
129 vPositionDifference = vBeaconPosition - vStationPosition;
130 double distance =
sqrt(vPositionDifference * vPositionDifference);
133 fMessage <<
"Position of Station " << dStation.
GetId() <<
": " <<
ToString(vStationPosition, referenceCS)<< endl
134 <<
"Difference to Beacon: " <<
ToString(vPositionDifference, referenceCS)
135 <<
" => Distance to Beacon: " << distance <<
" [m]";
136 INFO(fMessage.str());
142 shift = (1/
sqrt(2)) *
fTimeJitterMean *
sqrt( -2. * log((
float)rand() / ((
float)RAND_MAX + 1.))) * sin( 2. *
kPi * ((
float)rand() / ((
float)RAND_MAX + 1.)) );
160 int result =
static_cast<int>(n_wav/1.);
161 double mod = n_wav -
static_cast<double>(
result);
162 double phase = mod *
kTwoPi;
168 <<
" Phase: " << phase <<
" Amplitude: " << amplitude;
169 INFO(fMessage.str());
174 WARNING(
"Beacon frequency must be inside of the spectrum!");
184 spectrum[bin] += amplitude * exp(complex<double>(0,1)*phase);
190 phase = arg(spectrum[round(bin)]);
191 amplitude =
abs(spectrum[round(bin)]);
195 if ( channel.
GetId() == 1 )
197 outputfile << shift << endl;
210 RdChannelBeaconSimulator::Finish()
215 INFO(
"RdChannelBeaconSimulator::Finish()");
ChannelFFTDataContainer & GetFFTDataContainer()
retrieve Channel FFTDataContainer (write access)
Branch GetTopBranch() const
int GetId() const
Return Id of the Channel.
Report success to RunController.
int fTimeJitter
Simulate GPS time jitter.
Detector description interface for Station-related data.
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...
#define INFO(message)
Macro for logging informational messages.
string ToString(const G &g, const CoordinateSystemPtr cs)
string ToString(const G &g, const CoordinateSystemPtr cs)
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
double pow(const double x, const unsigned int i)
boost::filter_iterator< StationFilter, AllStationIterator > StationIterator
Iterator over all (non-exculded) stations.
ChannelIterator ChannelsEnd()
end Channel iterator for read/write
Detector description interface for RDetector-related data.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Class representing a document branch.
class to hold data at the radio Station level.
std::vector< double >::size_type SizeType
double abs(const SVector< n, T > &v)
Top of the hierarchy of the detector description interface.
constexpr double megahertz
int GetId() const
Station ID.
#define WARNING(message)
Macro for logging warning messages.
void GetData(bool &b) const
Overloads of the GetData member template function.
std::string fOutputShiftFile
Name of file for ASCII output of shifts (not needed for normal analysis)
std::vector< double > fBeaconFrequencies
Vector of frequencies to simulate.
ResultFlag
Flag returned by module methods to the RunController.
utl::CoordinateSystemPtr GetReferenceCoordinateSystem() const
Get the reference coordinate system used for analysis (usually PampaAmarilla for Auger) ...
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.
double fTimeJitterMean
Mean of gaussian distibution for the time jitter.
Class that holds the data associated to an individual radio channel.
double fAmplitude
Amplitude of beacon signal.
const rdet::RDetector & GetRDetector() const
double mod(const double d, const double periode)
utl::Point GetPosition() const
Tank position in Site Cartesian Coordinates.
const Station & GetStation(const int stationId) const
Get station by Station Id.
std::vector< double > fBeaconPosition
Vector for the position of the beacon.