Diana Software
QSideOrSameTimeTrigger.cc
Go to the documentation of this file.
2 #include "QReader.hh"
3 #include "QEvent.hh"
4 #include "QRawEvent.hh"
5 
7 
8 void QSideOrSameTimeTrigger::Init(const QReader& reader) {}
9 
11 ::GetNeighbourInfo(const QEvent& thisEvent,const QEvent& otherEvent) {
12 
14  const QHeader& thisHeader = thisEvent.Get<QHeader>("DAQ","Header");
15  const QHeader& otherHeader = otherEvent.Get<QHeader>("DAQ","Header");
16 
17  const QPulseInfo& P1 = thisEvent.Get <QPulseInfo>("DAQ","PulseInfo");
18  const QPulseInfo& P2 = otherEvent.Get<QPulseInfo>("DAQ","PulseInfo");
19 
20  long long time = thisHeader.GetTime().GetFromStartRunNs();
21  long long othertime = otherHeader.GetTime().GetFromStartRunNs();
22  unsigned long long stime = thisHeader.GetTime().GetStartRunUnix();
23  unsigned long long sothertime = otherHeader.GetTime().GetStartRunUnix();
24 
25  info.fIsInWindow = false;
26  info.fIsNeighbour = false;
27 
28  // They have to be in the same run
29  if(thisHeader.GetRun() == otherHeader.GetRun()) {
30  // If they have the same event number
31  if(thisHeader.GetEventNumber() == otherHeader.GetEventNumber()){
32  // They are in window
33  info.fIsInWindow = true;
34  // If they are not BOTH side pulses
35  if(!P1.GetIsSide() || !P2.GetIsSide())
36  // They are neighbours
37  info.fIsNeighbour = true;
38  }
39  // If they are in the same run but have different event numbers,
40  // do they have the same event time?
41  else if (time == othertime && stime == sothertime){
42  info.fIsInWindow = true;
43  // If they are both NOT side pulses
44  if(!P1.GetIsSide() && !P2.GetIsSide())
45  info.fIsNeighbour = true;
46  }
47  }
48  return info;
49 }
50 
#define Q_END_NAMESPACE
Definition: QDiana.hh:22
#define Q_BEGIN_NAMESPACE
Definition: QDiana.hh:20
diana event
Definition: QEvent.hh:46
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
int GetEventNumber() const
get EventNumber
Definition: QHeader.hh:25
Raw event: bolometer channel, trigger positions and types.
Definition: QPulseInfo.hh:18
Base class for diana event readers.
Definition: QReader.hh:50
QReaderNeighbour::NeighbourInfo GetNeighbourInfo(const QEvent &thisEvent, const QEvent &otherEvent)
Gett the neighbour info for two events.
void Init(const QReader &reader)
Initialization (empty)