Diana Software
MQVectorToQPulse.cc
Go to the documentation of this file.
1 #include "MQVectorToQPulse.hh"
2 #include "QEvent.hh"
3 #include "QEventList.hh"
4 #include "QHeader.hh"
5 #include "QPulseInfo.hh"
6 #include "QPulse.hh"
7 #include "QRunDataHandle.hh"
8 #include "QVector.hh"
9 
10 
12 
13 using namespace Diana;
14 
16 {
17  fQVectorLabel = GetString("QVectorLabel",Q_STRING_DEFAULT);
18  fName = GetString("QPulseName",Q_STRING_DEFAULT);
19  fConversion = GetBool("ConvertmVToADC","true");
20  ev.RequireByLabel<QVector>(fQVectorLabel);
21  ev.Add<QPulse>(fName).SetWrite(GetBool("Save",false));
22 }
23 
25 {
26  double scale = 1.;
27  if(fConversion) {
28  const QHeader& header = ev.Get<QHeader>("DAQ","Header");
29  QRunDataHandle rHandle(header.GetRun());
30  GlobalData().Get("",&rHandle,"");
31  const QPulseInfo& pi = ev.Get<QPulseInfo>("DAQ","PulseInfo");
32  scale = 1./rHandle.Get().GetChannelRunData(pi.GetChannelId()).fADC2mV;
33  }
34 
35  const QVector& vec = ev.GetByLabel<QVector>(fQVectorLabel);
36  ev.Get<QPulse>(fName.c_str()).SetSamplesADC(vec*scale);
37 }
38 
40 {
41 }
42 
QRunDataHandle rHandle(753)
QVector vec(3)
#define Q_STRING_DEFAULT
Definition: QDiana.hh:38
#define REGISTER_MODULE(clazz)
Definition: QDriver.hh:133
convert a QVector event member to a QPulse
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
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
int GetRun() const
destructor
Definition: QHeader.hh:22
Raw event: bolometer channel, trigger positions and types.
Definition: QPulseInfo.hh:18
const int & GetChannelId() const
Get ChannelId.
Definition: QPulseInfo.hh:22
Raw event: sampled waveform.
Definition: QPulse.hh:22
global handle for QRunData
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...