RdStationBandpassFilter.cc
Go to the documentation of this file.
2 
3 #include <fwk/CentralConfig.h>
4 
5 #include <utl/config.h>
6 #include <utl/ErrorLogger.h>
7 #include <utl/Reader.h>
8 #include <utl/RectangleFilter.h>
9 
10 #include <evt/Event.h>
11 #include <revt/REvent.h>
12 #include <revt/Station.h>
13 
14 
15 using namespace revt;
16 using namespace fwk;
17 using namespace utl;
18 using namespace std;
19 
20 
22 
25  {
26  Branch topBranch =
27  CentralConfig::GetInstance()->GetTopBranch("RdStationBandpassFilter");
28  topBranch.GetChild("LowerCutoffFrequency").GetData(fLowerCutoffFrequency);
29  topBranch.GetChild("UpperCutoffFrequency").GetData(fUpperCutoffFrequency);
30  topBranch.GetChild("Delay").GetData(fDelay);
31 
32  fFilterTypeString = topBranch.GetChild("FilterType").Get<string>();
33  if (fFilterTypeString == "Rectangle") {
34  fFilterType = Rectangle;
35  fFilter = new RectangleFilter(fLowerCutoffFrequency, fUpperCutoffFrequency, fDelay);
36  } /* else if (fFilterTypeString == "Gauss") {
37  fFilterType = Gauss;
38  fFilter = new GaussFilter(fLowerCutoffFrequency, fUpperCutoffFreqeuncy, fDelay);
39  } */
40 
41  ostringstream info;
42  info << "\n Station Bandpass Filter is set up as " << fFilterTypeString
43  << " filter spanning " << fLowerCutoffFrequency/megahertz
44  << " MHz to " << fUpperCutoffFrequency/megahertz
45  << " MHz with delay of " << fDelay/ns << " ns.";
46  INFO(info);
47 
48  return eSuccess;
49  }
50 
51 
53  RdStationBandpassFilter::Run(evt::Event& event)
54  {
55 
56  // Check if there are events at all
57  if(!event.HasREvent()) {
58  WARNING("No radio event found!");
59  return eContinueLoop;
60  }
61 
62  REvent& rEvent = event.GetREvent();
63 
64  // loop through stations
65  for (auto& station : rEvent.StationsRange()) {
66 
67  // Work on the frequency spectrum of this station and apply the bandpass filter
68  StationFrequencySpectrum& spectrum = station.GetStationFrequencySpectrum();
69 
70  complex<double> currentTransmissivity;
71  for (StationFrequencySpectrum::SizeType i = 0; i < spectrum.GetSize(); ++i) {
72  currentTransmissivity = fFilter->TransmissivityAtFrequency(station.GetFrequencyOfBin(i));
73  spectrum[i] *= currentTransmissivity;
74  }
75  }
76  return eSuccess;
77  }
78 
79 
81  RdStationBandpassFilter::Finish()
82  {
83  delete fFilter;
84  return eSuccess;
85  }
86 
87 }
Branch GetTopBranch() const
Definition: Branch.cc:63
Interface class to access to the Radio part of an event.
Definition: REvent.h:42
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
void Init()
Initialise the registry.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Definition: Branch.cc:211
bool HasREvent() const
T Get() const
Definition: Branch.h:271
Class representing a document branch.
Definition: Branch.h:107
std::vector< T >::size_type SizeType
Definition: Trace.h:58
const double ns
An idealised rectangle filter.
constexpr double megahertz
Definition: AugerUnits.h:155
SizeType GetSize() const
Definition: Trace.h:156
#define WARNING(message)
Macro for logging warning messages.
Definition: ErrorLogger.h:163
void GetData(bool &b) const
Overloads of the GetData member template function.
Definition: Branch.cc:644
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
Template class for a FADC data or calibrated data container. Use the typedefs (TraceD, TraceI, etc.) defined in Trace-fwd.h.
Definition: Trace-fwd.h:19

, generated on Tue Sep 26 2023.