Diana Software
MCheckTimeOrdering.cc
Go to the documentation of this file.
1 #include "MCheckTimeOrdering.hh"
2 #include "QEvent.hh"
3 #include "QEventList.hh"
4 #include "QHeader.hh"
5 
6 
8 
9 using namespace Diana;
10 
12 {
13  // ensure that no filter acts on this module.
14  GetBool("SkipEvents",false,false);
15  ev.Require<QHeader>("DAQ","Header");
16  fCurrentRun = -1;
17  fPreviousTime = 0;
18 }
19 
21 {
22  const QHeader& header = ev.Get<QHeader>("DAQ","Header");
23  const QTime& t = header.GetTime();
24  const int run = header.GetRun();
25  if(run != fCurrentRun) {
26  fPreviousTime = 0;
27  fCurrentRun = run;
28 
29  }
30  unsigned long long thisTime = t.GetFromStartRunNs();
31  if(thisTime < fPreviousTime) {
32  Panic("Events are not ordered in time");
33  } else {
34  fPreviousTime = thisTime;
35  }
36 
37 }
38 
40 {
41  Info("Events are ordered in time");
42 }
43 
#define REGISTER_MODULE(clazz)
Definition: QDriver.hh:133
check that events are ordered in time.
void Do(Diana::QEvent &ev)
Do method. Declare and implement only one of the two versions.
void Init(Diana::QEvent &ev)
Init method.
void Done()
Done method.
diana event
Definition: QEvent.hh:46
void Require(const std::string &owner, const std::string &name) const
notify the QEvent that we need a QObject, if not found an exception is thrown
Definition: QEvent.hh:232
void Get(const char *owner, ReadHandle< Q > &handle) const
Get a QObject Handle in read mode.
Definition: QEvent.hh:74
Raw event: basic information like run number and time.
Definition: QHeader.hh:16
const Diana::QTime & GetTime() const
get time
Definition: QHeader.hh:28
int GetRun() const
destructor
Definition: QHeader.hh:22
Diana time.
Definition: QTime.hh:17
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...