RdDoubleEventRejector.cc
Go to the documentation of this file.
1 
10 
11 #include <fwk/CentralConfig.h>
12 #include <fwk/VModule.h>
13 
14 #include <utl/ErrorLogger.h>
15 #include <utl/Reader.h>
16 #include <utl/config.h>
17 
18 #include <evt/Event.h>
19 #include <revt/REvent.h>
20 #include <revt/Header.h>
21 
22 
23 using namespace fwk;
24 using namespace std;
25 using namespace revt;
26 
28 
30  fInfoLevel(0),
31  fNRejected(0)
32 {
33 }
34 
36 {
37  // Initialize your module here. This method
38  // is called once at the beginning of the run.
39  // The eSuccess flag indicates the method ended
40  // successfully. For other possible return types,
41  // see the VModule documentation.
42 
43  INFO("RdDoubleEventRejector::Init()");
44 
45  // Read in the configurations of the xml file
46  utl::Branch topBranch = CentralConfig::GetInstance()->GetTopBranch("RdDoubleEventRejector");
47 
48  topBranch.GetChild("InfoLevel").GetData(fInfoLevel);
49 
50  return eSuccess;
51 }
52 
53 VModule::ResultFlag RdDoubleEventRejector::Run(evt::Event& event)
54 {
55  if (fInfoLevel >= eObscure)
56  INFO("RdDoubleEventRejector::Run()");
57 
58  // Check if there is an radio event at all
59  if (!event.HasREvent()) {
60  WARNING("No radio event found!");
61  return eContinueLoop;
62  }
63 
64  // get the event
65  REvent& rEvent = event.GetREvent();
66 
67  stringstream info;
68 
69  const std::pair<int, int> eventIdentifier(rEvent.GetHeader().GetRunNumber(),
70  rEvent.GetHeader().GetId());
71  if (fEventList.size() > 0 && fEventList.find(eventIdentifier) != fEventList.end()) {
72  if (fInfoLevel >= eFinal) {
73  info.str("");
74  info << "The current event " << eventIdentifier.first << "." << eventIdentifier.second
75  << " has already been read in before.";
76  INFO(info.str());
77  }
78  fNRejected++;
79  return eContinueLoop;
80  }
81  fEventList.insert(eventIdentifier);
82  return eSuccess;
83 }
84 
85 VModule::ResultFlag RdDoubleEventRejector::Finish()
86 {
87  // Put any termination or cleanup code here.
88  // This method is called once at the end of the run.
89 
90  INFO("RdDoubleEventRejector::Finish()");
91  stringstream sstr;
92  sstr << fNRejected << " events have been rejected" << endl;
93  INFO(sstr.str());
94  return eSuccess;
95 }
96 
97 }
Branch GetTopBranch() const
Definition: Branch.cc:63
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
#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
Class representing a document branch.
Definition: Branch.h:107
Header & GetHeader()
access to REvent Header
Definition: REvent.h:239
std::set< std::pair< int, int > > fEventList
List of allowed allowed combination of run and event IDs.
#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
int GetRunNumber() const
Event id in the run (Start at zero at the beginning of each run) /provided by the daq...
Definition: REvent/Header.h:22
int fInfoLevel
xml settings: info level (verbosity)
int GetId() const
Definition: REvent/Header.h:21

, generated on Tue Sep 26 2023.