Diana Software
MExtractVariableFromObject.cc
Go to the documentation of this file.
2 #include "QEvent.hh"
3 #include "QRawEvent.hh"
4 #include "QBaseType.hh"
5 #include "QEventList.hh"
6 
8 
9 using namespace Diana;
10 
12 {
13  /* This method is called before event loop.
14  * Here you can:
15  * 1) Get parameters from cfg (see QBaseModule.hh):
16  *
17  * GetDouble("parname",defaultVal);
18  * GetInt("parname",defaultVal);
19  * GetBool("parname",defaultVal);
20  * GetString("parname",defaultVal);
21  *
22  */
23 
24  ev.Add<QInt>("Channel");
25  ev.Add<QInt>("Run");
26  ev.Add<QInt>("Dataset");
27  ev.Add<QInt>("EventNumber");
28  ev.Require<QHeader>("DAQ","Header");
29  ev.Require<QPulseInfo>("DAQ","PulseInfo");
30 
31  ev.SetAlias("Channel","fValue","Channel");
32  ev.SetAlias("Run","fValue","Run");
33  ev.SetAlias("Dataset","fValue","Dataset");
34  ev.SetAlias("EVentNumber","fValue","EventNumber");
35 }
36 
37 //void MExtractVariableFromObject::Do(QEvent& ev, const QEventList& neighbours)
39 {
40  // get dataset
41  GlobalHandle<QInt> dHandle("Dataset");
42  GlobalData().Get("",&dHandle,"");
43  const int dataset = dHandle.Get();
44 
45  const QHeader& header = ev.Get<QHeader>("DAQ","Header");
46  const QPulseInfo& pulseInfo = ev.Get<QPulseInfo>("DAQ","PulseInfo");
47  const int channel = pulseInfo.GetChannelId();
48  const int run = header.GetRun();
49  const int eventnumber = header.GetEventNumber();
50 
51  // Write QObjects owned by this module
52 
53  ev.Get<QInt>("Channel") = channel;
54  ev.Get<QInt>("Dataset") = dataset;
55  ev.Get<QInt>("Run") = run;
56  ev.Get<QInt>("EventNumber") = eventnumber;
57 }
58 
60 {
61 }
62 
const int channel
#define REGISTER_MODULE(clazz)
Definition: QDriver.hh:133
one-line description of your module
void Do(Diana::QEvent &ev)
Do method.
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
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
void Add(WriteHandle< Q > &handle)
Add a QObject to the event.
Definition: QEvent.hh:193
void SetAlias(const std::string &name, const std::string &pathInObject, const std::string &alias)
set alias for objects or variables in objects owned by currentmodule.
Definition: QEvent.hh:261
Raw event: basic information like run number and time.
Definition: QHeader.hh:16
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
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...