Diana Software
QUnrollSidePulses.cc
Go to the documentation of this file.
1 #include "QUnrollSidePulses.hh"
2 #include "QBool.hh"
3 #include "QReader.hh"
4 #include "QEvent.hh"
5 #include "QHeader.hh"
6 #include "QPulse.hh"
7 #include "QPulseInfo.hh"
8 #include "QSidePulses.hh"
9 #include "QEventAssembler.hh"
10 #include "QCachedEventList.hh"
11 
13 
15  eva.GetEvent().Require<QSidePulses>("DAQ","SidePulses");
16 }
17 
19 {
20  ReadHandle<QSidePulses> sHandle("SidePulses");
21  ev.Get("",sHandle);
22  if(!sHandle.IsValid()) {
23  list.Push(ev);
24  return;
25  }
26 
27  const QHeader& header = ev.Get<QHeader>("DAQ","Header");
28  const std::list<QSidePulse>& sidePulses = sHandle.Get().Get();
29  std::list<QSidePulse>::const_iterator iter = sidePulses.begin();
30 
31  // the side event has the same structure of the main event
32  QEventAssembler eva;
33  eva.Assign(ev);
34 
35  while(iter != sidePulses.end()) {
36  // same structure but everything is not valid
37  eva.Clear();
38  // except for the raw event
39  QHeader& sHeader = eva.Get<QHeader>("DAQ","Header");
40  QPulse& sPulse = eva.Get<QPulse>("DAQ","Pulse");
41  QPulseInfo& sPulseInfo = eva.Get<QPulseInfo>("DAQ","PulseInfo");
42  QSampleInfo& sMaster = sPulseInfo.GetMasterSample();
43 
44  // Specify that this event has been generated in an event generator
45  eva.Get<QBool>("Reader","GeneratedEvent")=true;
46 
47  sHeader = header;
48  sPulse = iter->fPulse;
49  sPulseInfo = iter->fPulseInfo;
50  // overwrite the master sample
51  sMaster.SetIsSide();
52  sMaster.SetEventNumber(header.GetEventNumber());
53 
54  sHeader.Validate();
55  sPulse.Validate();
56  sPulseInfo.Validate();
57 
58  list.Push(eva.GetEvent());
59 
60  iter++;
61  }
62 
63  list.Push(ev);
64 }
65 
#define Q_END_NAMESPACE
Definition: QDiana.hh:22
#define Q_BEGIN_NAMESPACE
Definition: QDiana.hh:20
bool wrapped into a QObject
Definition: QBool.hh:17
void Push(const QEvent &obj)
Visitor class of QEvent that provides full handling of QEvent.
QEvent & GetEvent()
Get the QEvent.
void Get(const char *owner, WriteHandle< Q > &handle)
Get QObject from the event in write mode. This method has to be called in the event loop,...
void Assign(const QEvent &ev)
copies the underlying QEvent (calls QEvent::operator=)
void Clear()
clear the underlying QEvent (calls QEvent::Clear())
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
virtual bool IsValid() const
Check object validity.
Definition: QHandle.hh:34
Raw event: basic information like run number and time.
Definition: QHeader.hh:16
void SetEventNumber(unsigned int eventNumber)
Set EventNumber.
Definition: QHeader.hh:41
int GetEventNumber() const
get EventNumber
Definition: QHeader.hh:25
Raw event: bolometer channel, trigger positions and types.
Definition: QPulseInfo.hh:18
Raw event: sampled waveform.
Definition: QPulse.hh:22
Base class for diana event readers.
Definition: QReader.hh:50
contains information on flagged samples
Definition: QSampleInfo.hh:24
Raw event: neighbour bolometers waveforms.
Definition: QSidePulses.hh:18
void FillList(const QEvent &ev, QCachedEventList &list)
void Init(const QReader &reader, QEventAssembler &eva)
read handle to access QEvent QObject's.
Definition: QHandle.hh:126
const T & Get() const
Get Object.
Definition: QHandle.hh:133