Diana Software
MExpandEventToBaseTypes.cc
Go to the documentation of this file.
2 #include "QEvent.hh"
3 #include "QRawEvent.hh"
4 #include "QBool.hh"
5 #include "QBaseType.hh"
6 
7 
9 
10 using namespace Diana;
11 
13 {
14  fExpandHeader = GetBool("ExpandHeader",false);
15  fExpandPulseInfo = GetBool("ExpandPulseInfo",false);
16  fExpandPulse= GetBool("ExpandPulse",false);
17 
18  if(fExpandHeader) {
19  ev.RequireByLabel<QHeader>("DAQ@Header");
20  ev.Add<QDouble>("Time");
21  }
22  if(fExpandPulseInfo) {
23  ev.RequireByLabel<QPulseInfo>("DAQ@PulseInfo");
24  ev.Add<QBool>("IsNoise");
25  ev.Add<QBool>("IsSignal");
26  ev.Add<QBool>("IsPulser");
27  ev.Add<QBool>("IsSide");
28  }
29  if(fExpandPulse) {
30  ev.RequireByLabel<QPulse>("DAQ@Pulse");
31  Warn("Option ExpandPulse not implemented!");
32  }
33 }
34 
36 {
37  if(fExpandHeader) {
38  const QHeader& header = ev.GetByLabel<QHeader>("DAQ@Header");
39  ev.Get<QDouble>("Time") = double(header.GetTime().GetFromStartRunNs())/1e9;
40  }
41  if(fExpandPulseInfo) {
42  const QPulseInfo& pulseInfo = ev.GetByLabel<QPulseInfo>("DAQ@PulseInfo");
43  ev.Get<QBool>("IsNoise") = pulseInfo.GetIsNoise();
44  ev.Get<QBool>("IsSignal") = pulseInfo.GetIsSignal();
45  ev.Get<QBool>("IsPulser") = pulseInfo.GetIsPulser();
46  ev.Get<QBool>("IsSide") = pulseInfo.GetIsSide();
47  }
48 
49 
50 }
51 
53 {
54 }
55 
#define REGISTER_MODULE(clazz)
Definition: QDriver.hh:133
expand event objects into base type objects
void Do(Diana::QEvent &ev)
Do method. Declare and implement only one of the two versions.
void Init(Diana::QEvent &ev)
Init method.
base types wrapped into a QObject. Currently implemented types are QInt QDouble and QFloat....
Definition: QBaseType.hh:17
bool wrapped into a QObject
Definition: QBool.hh:17
diana event
Definition: QEvent.hh:46
const Q & GetByLabel(const QEventLabel &label) const
Get a QObject in read mode by label.
Definition: QEvent.hh:135
void RequireByLabel(const QEventLabel &label) const
notify the QEvent that we need a QObject, if not found an exception is thrown
Definition: QEvent.hh:242
void Get(const char *owner, ReadHandle< Q > &handle) const
Get a QObject Handle in read mode.
Definition: QEvent.hh:74
void Add(WriteHandle< Q > &handle)
Add a QObject to the event.
Definition: QEvent.hh:193
Raw event: basic information like run number and time.
Definition: QHeader.hh:16
const Diana::QTime & GetTime() const
get time
Definition: QHeader.hh:28
Raw event: bolometer channel, trigger positions and types.
Definition: QPulseInfo.hh:18
bool GetIsSignal() const
Get IsSignal.
Definition: QPulseInfo.hh:48
bool GetIsSide() const
Get IsSide.
Definition: QPulseInfo.hh:56
bool GetIsNoise() const
Get IsNoise.
Definition: QPulseInfo.hh:54
bool GetIsPulser() const
Get IsPulser.
Definition: QPulseInfo.hh:44
Raw event: sampled waveform.
Definition: QPulse.hh:22
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...