3 #include <fwk/CentralConfig.h>
4 #include <fwk/RunController.h>
5 #include <fwk/VModule.h>
8 #include <revt/REvent.h>
9 #include <revt/Header.h>
10 #include <revt/Station.h>
11 #include <revt/Channel.h>
12 #include <utl/AugerUnits.h>
13 #include <utl/TimeStamp.h>
14 #include <utl/ModifiedJulianDate.h>
15 #include <utl/UTCDateTime.h>
16 #include <utl/TimeInterval.h>
17 #include <utl/Branch.h>
18 #include<utl/SVector.h>
19 #include <det/Detector.h>
20 #include <rdet/RDetector.h>
21 #include <rdet/Channel.h>
22 #include <rdet/Station.h>
23 #include <utl/AugerUnits.h>
25 #include <utl/ErrorLogger.h>
32 #include <TTimeStamp.h>
44 using std::stringstream;
45 using std::ostringstream;
53 mod(
const double d,
const double periode)
56 return d - floor(d/periode) * periode;
58 return d - ceil(d/periode) * periode + periode;
63 ct2lst(
double longitude,
double jd,
double& lst)
65 const double J2000 = 2451545.0;
66 const double sidereal_coeff[4] = { 280.46061837, 360.98564736629, 0.000387933, 38710000 };
68 double dt = jd -
J2000;
69 double dt0 = dt / 36525.;
70 double theta = sidereal_coeff[0] + dt * sidereal_coeff[1] + dt0 * dt0 * (sidereal_coeff[2] - dt0 / sidereal_coeff[3]);
71 lst =
mod(theta + longitude, 360.) * 0.066666666666666;
114 INFO(
"RdStationNoiseAnalyser::Init()");
116 Branch topBranch = CentralConfig::GetInstance()->
GetTopBranch(
"RdStationNoiseAnalyser");
129 ostringstream outinfo;
130 outinfo <<
"\n-----------------------------------------------------------------------------\n" ;
133 outinfo << totestmin.
GetYear() <<
"-"<<totestmin.GetMonth()<<
"-"<<totestmin.GetDay() <<
"\n";
134 outinfo <<
"-------------------------------------------------------------------------------\n";
135 fNDay = TMath::Ceil((Ts_Max - Ts_Min)/(24*3600));
136 INFO(outinfo.str().c_str());
138 ERROR(
"Error Number of day cannot be negative");
141 std::cout <<
fNDay << std::endl;
146 fH_RMSLST1 =
new TH1F(
"RMSLST1",
"RMSLST1", fNbinTime, 0,24);
147 fH_RMSLST2 =
new TH1F(
"RMSLST2",
"RMSLST2", fNbinTime, 0,24);
148 fH_RMSLocT1 =
new TH1F(
"RMSLocT1",
"RMSLocT1", fNbinTime, 0,24);
149 fH_RMSLocT2 =
new TH1F(
"RMSLocT2",
"RMSLocT2", fNbinTime, 0,24);
159 fH2_RMSLocT2D1 =
new TH2F(
"RMSLocT2D1",
"RMSLocT2D1", fNbinTime, 0, 24,
fNDay, Ts_Min, Ts_Max);
160 fH2_RMSLocT2D2 =
new TH2F(
"RMSLocT2D2",
"RMSLocT2D2", fNbinTime, 0, 24,
fNDay, Ts_Min, Ts_Max);
161 fH2_RateLocT2D =
new TH2F(
"RateLocT2D",
"RateLocT2D", fNbinTime, 0, 24,
fNDay, Ts_Min, Ts_Max);
168 <<
" Number Of Time Bin (0h-24h)" << fNbinTime <<
"\n"
180 det::Detector::GetInstance().GetRDetector();
182 vector<double> v_RMS1;
183 vector<double> v_RMS2;
203 loctime = double(utcdate.GetHour()) +
double(utcdate.GetMinute())/60.;
216 WARNING(
"Channel 0 or 1 not present \n");
234 for (
unsigned int i = binmin; i < stseries.
GetSize(); ++i) {
237 Value = stseries[i][0], stseries[i][1], stseries[i][2];
246 float normfactorsp = 0;
252 for (
unsigned int i = 0; i < stspectr.
GetSize(); ++i) {
261 double Rms1 = TMath::RMS(v_RMS1.size(), &v_RMS1.front());
262 double Rms2 = TMath::RMS(v_RMS2.size(), &v_RMS1.front());
285 INFO(
"RdStationNoiseAnalyser::Finish");
286 INFO(
"Writing outfile");
314 Prof_TimeSinceLastEventLST->Write();
315 delete Prof_TimeSinceLastEventLST;
318 Prof_TimeSinceLastEventLocT->Write();
319 delete Prof_TimeSinceLastEventLocT;
324 info <<
"Total data Time " << TotTime <<
" (s) ";
331 bool firststationchannel =
true;
333 V3CZero= complex<double>(0.0),complex<double>(0.0),complex<double>( 0.0);
337 if (channel.
GetId()>2)
continue ;
350 channel.GetConstChannelFrequencySpectrum();
353 if (firststationchannel) {
354 firststationchannel =
false;
363 stringstream fMessage;
364 fMessage <<
"Number of samples in spectrum of "
366 <<
" belonging to station "
368 <<
" is different than the number of samples in other channels of that station.";
376 double response= rDet.
GetStation(stat.
GetId()).GetChannel(channel.
GetId()).GetIntegratedEffectiveAntennaHeight(channelfrequency);
381 warn <<
" Detector response is zero !! \n";
382 warn <<
" Frequency is " << channelfrequency/
megahertz ;
386 stspectr[i][channel.
GetId()-1]=channelspectr[i]/response;
Branch GetTopBranch() const
void ConvertChannelToStation(revt::Station &stat, const rdet::RDetector &rDet)
double ModifiedJulianDate(const time_t unixSecond)
TH1F * fH_TimeSinceLastEvent
StationFrequencySpectrum & GetStationFrequencySpectrum()
retrieve Station Frequency Spectrum (write access, only use this if you intend to change the data) ...
int GetId() const
Return Id of the Channel.
Report success to RunController.
~RdStationNoiseAnalyser()
Station & GetStationByName(const std::string &name)
retrieve station by name, throw utl::NonExistentComponentException if n.a.
Interface class to access to the Radio part of an event.
VModule::ResultFlag Run(evt::Event &theevent)
Run: invoked once per event.
double GetBinning() const
size of one slot
#define INFO(message)
Macro for logging informational messages.
void ct2lst(double longitude, double jd, double &lst)
revt::REvent & GetREvent()
Base class for exceptions trying to access non-existing components.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
ChannelIterator ChannelsBegin()
begin Channel iterator for read/write
unsigned int GetNyquistZone() const
Get the Nyquist zone.
int GetStationId() const
Return Id of the station to which this Channel belongs.
long GetSecond() const
Get the seconds floor for the interval.
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.
utl::TimeStamp fLastEventTS
ChannelIterator ChannelsEnd()
end Channel iterator for read/write
Detector description interface for RDetector-related data.
TH2F * fH2_TimeSinceLastEventLocT
bool HasChannel(const int pmtId) const
Check if a particular Channel object exists.
Class representing a document branch.
class to hold data at the radio Station level.
C< F > & GetFrequencySpectrum()
read out the frequency spectrum (write access)
std::vector< std::complex< double > >::size_type SizeType
double abs(const SVector< n, T > &v)
Header & GetHeader()
access to REvent Header
C< T > & GetTimeSeries()
read out the time series (write access)
constexpr double megahertz
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
void SetNyquistZone(const unsigned int zone)
Set the Nyquist zone.
unsigned long int fTimeMax
#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.
VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
static const int kGPS_UTC_Offset
void SetBinning(const double binning)
Template class for a data container that offers and takes both time series and corresponding frequenc...
A TimeInterval is used to represent time elapsed between two events.
ResultFlag
Flag returned by module methods to the RunController.
unsigned long GetGPSSecond() const
GPS second.
float fPartOfTheTraceToUse
Template class for a FADC data or calibrated data container. Use the typedefs (TraceD, TraceI, etc.) defined in Trace-fwd.h.
unsigned long int fTimeMin
utl::TraceV3C StationFrequencySpectrum
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.
Report failure to RunController, causing RunController to terminate execution.
void SetNyquistZone(const unsigned int zone)
set the Nyquist zone
TH2F * fH2_TimeSinceLastEventLST
double mod(const double d, const double periode)
double GetNanoSecond() const
Get integer number of nanoseconds past seconds boundary.
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.