RdChannelPedestalRemover.cc
Go to the documentation of this file.
2 
3 #include <fwk/CentralConfig.h>
4 
5 #include <utl/ErrorLogger.h>
6 #include <utl/Reader.h>
7 #include <utl/config.h>
8 #include <utl/TraceAlgorithm.h>
9 
10 #include <evt/Event.h>
11 #include <revt/REvent.h>
12 #include <revt/Station.h>
13 #include <revt/Channel.h>
14 
15 
16 using namespace revt;
17 using namespace fwk;
18 using namespace utl;
19 using namespace std;
20 
21 
23 
26  {
27  return eSuccess;
28  }
29 
30 
32  RdChannelPedestalRemover::Run(evt::Event& event)
33  {
34  // Check if there are events at all
35  if(!event.HasREvent()) {
36  WARNING("No radio event found!");
37  return eContinueLoop;
38  }
39 
40  REvent& rEvent = event.GetREvent();
41 
42  // loop through stations and for every station through every channel
43  for (auto& station : rEvent.StationsRange()) {
44  for (auto& channel : station.ChannelsRange()) {
45 
46  if (!channel.IsActive())
47  continue;
48 
49  // Work on the trace of this channel
50  revt::ChannelTimeSeries& trace = channel.GetChannelTimeSeries();
51 
52  if (trace.GetSize() == 0)
53  continue;
54 
55  RemoveDCOffset(trace);
56  }
57  }
58 
59  return eSuccess;
60  }
61 
62 
64  RdChannelPedestalRemover::Finish()
65  {
66  return eSuccess;
67  }
68 
69 
70  void
71  RdChannelPedestalRemover::RemoveDCOffset(revt::ChannelTimeSeries& trace) {
72  double mean = TraceAlgorithm::Mean(trace, 0, trace.GetSize()-1 );
73  for (auto& binValue : trace) {
74  binValue -= mean;
75  }
76  }
77 
78 }
Interface class to access to the Radio part of an event.
Definition: REvent.h:42
void Init()
Initialise the registry.
bool HasREvent() const
SizeType GetSize() const
Definition: Trace.h:156
#define WARNING(message)
Macro for logging warning messages.
Definition: ErrorLogger.h:163
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
double Mean(const std::vector< double > &v)
Definition: Functions.h:31

, generated on Tue Sep 26 2023.