RdChannelNoiseASCIIExporter.cc
Go to the documentation of this file.
2 #include <utl/ErrorLogger.h>
3 
4 #include <evt/Event.h>
5 #include <revt/REvent.h>
6 #include <revt/Header.h>
7 #include <revt/Station.h>
8 #include <revt/Channel.h>
9 
10 #include <utl/Trace.h>
11 #include <utl/TraceAlgorithm.h>
12 #include <utl/ErrorLogger.h>
13 #include <utl/Reader.h>
14 #include <utl/config.h>
15 #include <utl/AugerUnits.h>
16 #include <fwk/CentralConfig.h>
17 
18 using namespace std;
19 
20 
21 using namespace std;
22 using namespace utl;
23 using namespace fwk;
24 using namespace revt;
25 
26 
28 
30  fNumber(0),
31  fNumberOfTracestoPrepare(0),
32  fInfoLevel(0),
33  fpath("")
34  {
35  }
36 
37 
38  RdChannelNoiseASCIIExporter::~RdChannelNoiseASCIIExporter()
39  {
40  }
41 
42 
45  {
46  // Initialize your module here. This method
47  // is called once at the beginning of the run.
48  // The eSuccess flag indicates the method ended
49  // successfully. For other possible return types,
50  // see the VModule documentation.
51 
52  INFO("RdChannelNoiseASCIIExporter::Init()");
53  Branch topBranch = CentralConfig::GetInstance()->GetTopBranch("RdChannelNoiseASCIIExporter");
54  topBranch.GetChild("NoiseFilePath").GetData(fpath);
55  topBranch.GetChild("InfoLevel").GetData(fInfoLevel);
56  topBranch.GetChild("firstNumber").GetData(fNumber);
57  topBranch.GetChild("NumberOfTraces").GetData(fNumberOfTracestoPrepare);
58  cout << " MM DEBUG " << fpath << " " << *(--fpath.end()) << endl;
59  if (fpath.compare(fpath.size()-1,fpath.size() ,"/")!=0)
60  fpath.append("/");
61 
62 
63 
64  return eSuccess;
65  }
66 
67 
69  RdChannelNoiseASCIIExporter::Run(evt::Event& event)
70  {
71 
72  INFO("RdChannelNoiseASCIIExporter::Run()");
73  ++fNumber;
74  ostringstream fname;
75  fname.str("");
76  fname << fpath << "Traces_"<<AddZero(fNumber)<<fNumber<<".dat";
77  ofstream outf(fname.str().c_str());
78 
79 
80  // Check if there are events at all
81  if(!event.HasREvent())
82  {
83  WARNING("RdChannelNoiseASCIIExporter::No radio event found!");
84  return eContinueLoop;
85  } else {
86  REvent& rEvent = event.GetREvent();
87  // loop through stations and for every station through every channel
88  for (REvent::StationIterator sIt = rEvent.StationsBegin();
89  sIt != rEvent.StationsEnd(); ++sIt) {
90  Station& station = *sIt;
91  for (Station::ChannelIterator cIt = station.ChannelsBegin();
92  cIt != station.ChannelsEnd(); ++cIt) {
93  Channel& channel = *cIt;
94  outf << station.GetId() << " " << channel.GetId();
95 
96  const revt::ChannelTimeSeries& timeSeries =
97  channel.GetConstChannelTimeSeries();
98  outf << " " << timeSeries.GetBinning()/nanosecond;
99  for (unsigned int i = 0; i < timeSeries.GetSize(); ++i)
100  outf << " " << timeSeries[i];
101  outf << endl;
102  }
103  }
104  }
105  outf.close();
106 
108  if (fNumberOfTracestoPrepare<=0) {
109  INFO("We've done enough for today");
110  return eBreakLoop;
111  }
112  return eSuccess;
113  }
114 
115 
117  RdChannelNoiseASCIIExporter::Finish()
118  {
119  // Put any termination or cleanup code here.
120  // This method is called once at the end of the run.
121 
122  INFO("RdChannelNoiseASCIIExporter::Finish()");
123 
124  return eSuccess;
125  }
126 
127 }
Branch GetTopBranch() const
Definition: Branch.cc:63
int GetId() const
Return Id of the Channel.
Report success to RunController.
Definition: VModule.h:62
Interface class to access to the Radio part of an event.
Definition: REvent.h:42
Skip remaining modules in the current loop and continue with next iteration of the loop...
Definition: VModule.h:68
double GetBinning() const
size of one slot
Definition: Trace.h:138
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
StationIterator StationsEnd()
Definition: REvent.h:130
StationIterator StationsBegin()
Definition: REvent.h:128
void Init()
Initialise the registry.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Definition: Branch.cc:211
ChannelIterator ChannelsBegin()
begin Channel iterator for read/write
boost::filter_iterator< StationFilter, AllStationIterator > StationIterator
Iterator over all (non-exculded) stations.
Definition: REvent.h:125
bool HasREvent() const
ChannelIterator ChannelsEnd()
end Channel iterator for read/write
Class representing a document branch.
Definition: Branch.h:107
Break current loop. It works for nested loops too!
Definition: VModule.h:66
class to hold data at the radio Station level.
constexpr double nanosecond
Definition: AugerUnits.h:143
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
int GetId() const
Get the station Id.
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
Class that holds the data associated to an individual radio channel.

, generated on Tue Sep 26 2023.