RdStationTimeSeriesTaperer.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/HannWindow.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 
23 
26  {
27  Branch topBranch =
28  CentralConfig::GetInstance()->GetTopBranch("RdStationTimeSeriesTaperer");
29  topBranch.GetChild("InfoLevel").GetData(fInfoLevel);
30 
31  topBranch.GetChild("RelativeWindowWidthOnEachSide").GetData(fWindowSizeOnEachSide);
32  topBranch.GetChild("Renormalize").GetData(fRenormalize);
33 
34  string tmpstring = topBranch.GetChild("WindowType").Get<string>();
35  if (tmpstring == "Hann") {
36  fWindowType = Hann;
37  fWindow = new HannWindow(fWindowSizeOnEachSide);
38  }
39 /* else if (tmpstring== "Hamming") {
40  fWindowType = Hamming;
41  fWindow = new HammingWindow(fWindowSizeOnEachSide);
42  } */
43 
44  ostringstream info;
45  info << "Station TimeSeries Windower is set up as " << tmpstring
46  << " window with a relative width of " << fWindowSizeOnEachSide
47  << " on each side.";
48  INFO(info);
49 
50  return eSuccess;
51  }
52 
53 
55  RdStationTimeSeriesTaperer::Run(evt::Event& event)
56  {
57  // Check if there are events at all
58  if(!event.HasREvent()) {
59  WARNING("No radio event found!");
60  return eContinueLoop;
61  }
62 
63  REvent& rEvent = event.GetREvent();
64  for (auto& station : rEvent.StationsRange()) {
65  // Work on the time series this station
66  StationTimeSeries& timeSeries = station.GetStationTimeSeries();
67 
68  // set the trace length of the window for the specific station
69  fWindow->SetTraceLength(timeSeries.GetSize());
70 
71  // apply the window
72  for (StationTimeSeries::SizeType i = 0; i < timeSeries.GetSize(); ++i) {
73  timeSeries[i] *= fWindow->GetWeightAtBin(i);
74  if (fRenormalize)
75  timeSeries[i] *= fWindow->GetRenormalizationFactor();
76  }
77  }
78 
79  return eSuccess;
80  }
81 
82 
84  RdStationTimeSeriesTaperer::Finish()
85  {
86  delete fWindow;
87  return eSuccess;
88  }
89 
90 }
Branch GetTopBranch() const
Definition: Branch.cc:63
Abstract base class for analytic windows.
Definition: HannWindow.h:27
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
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.