3 #include <fwk/CentralConfig.h>
5 #include <utl/config.h>
6 #include <utl/AugerUnits.h>
7 #include <utl/ErrorLogger.h>
8 #include <utl/Reader.h>
10 #include <evt/Event.h>
11 #include <revt/REvent.h>
12 #include <revt/Station.h>
13 #include <revt/Channel.h>
15 #include <rdet/RDetector.h>
16 #include <rdet/Station.h>
17 #include <rdet/Channel.h>
39 WARNING(
"No radio event found!");
44 REvent& rEvent =
event.GetREvent();
47 for (
auto& station : rEvent.StationsRange()) {
48 for (
auto& channel : station.ChannelsRange()) {
58 const double voltagePerCount = (maxVoltage - minVoltage) /
pow(2, bitDepth);
61 const double voltagePedestal = 0.5 * (minVoltage + maxVoltage);
64 const double traceBinning = trace.
GetBinning();
66 if (!
CloseTo(1.0 / traceBinning, samplingFrequency, 1e-5)) {
67 std::ostringstream warning;
68 warning <<
"\n\tVoltage Sampling Frequency of "
70 <<
" MHz does not match sampling frequency of data, which is "
72 <<
" MHz. Aborting ...";
83 for (
const auto& entry : trace) {
84 int adcCount = floor((entry + voltagePedestal - minVoltage) / voltagePerCount);
85 adcCount += int(minVoltage / voltagePerCount);
88 if (adcCount < (minVoltage / voltagePerCount))
89 adcCount = minVoltage / voltagePerCount;
91 if (adcCount > maxVoltage / voltagePerCount -1)
92 adcCount = maxVoltage / voltagePerCount - 1;
105 RdChannelVoltageToADCConverter::Finish()
112 RdChannelVoltageToADCConverter::CloseTo(
const double a,
const double b,
const double tolerance)
114 return fabs(a - b) < tolerance;
int GetBitDepth() const
Get number of bits of ADC.
Interface class to access to the Radio part of an event.
double GetBinning() const
size of one slot
double GetMaxVoltage() const
Get voltage corresponding to max number of counts.
void Init()
Initialise the registry.
Detector description interface for Channel-related data.
double pow(const double x, const unsigned int i)
double GetMinVoltage() const
Get voltage corresponding to 0 counts.
Top of the hierarchy of the detector description interface.
#define WARNING(message)
Macro for logging warning messages.
void SetBinning(const double binning)
ResultFlag
Flag returned by module methods to the RunController.
const rdet::RDetector & GetRDetector() const
double GetSamplingFrequency() const
Get sampling Frequency of ADC (unit?)
void PushBack(const T &value)
Insert a single value at the end.
const Station & GetStation(const int stationId) const
Get station by Station Id.
Predicate for approximate equality (for floating point)