Diana Software
MQPulseManager.cc
Go to the documentation of this file.
1 #include "MQPulseManager.hh"
2 #include "QEventAssembler.hh"
3 #include "QRawEvent.hh"
4 #include <iostream>
5 
6 using namespace Diana;
7 
9 
11 {
12  // called once in a sequence
13 }
14 
16 {
17  // called once in a sequence
18 }
19 
21 {
22  std::vector<QEventLabel> evDataLabels = eva.GetWriteLabels();
23  std::vector<QEventLabel>::const_iterator evLabelIter = evDataLabels.begin();
24  bool inclusive = GetBool("InclusiveMode",true);
25  fAction = GetString("Action","Consolidate",true);
26  while(evLabelIter != evDataLabels.end()) {
27  QEventLabel label = *evLabelIter;
28  if(GetBool(label.GetStringLabel(),inclusive,false) ) {
29  QObject** peventData = eva.Get(label.owner.c_str(),label.name.c_str());
30  QObject* eventData = (*peventData);
31  std::string type = eventData->GetName();
32  if(type == "QPulse") {
33  fLabelsToStore.push_back(label);
34  eva.GetEvent().RequireByLabel<QPulse>(label);
35  }
36  }
37  evLabelIter++;
38  }
39 
40 
41  return ACT_NEXTEV;
42 }
43 
45 {
46  // called event by event
47  std::vector<QEventLabel>::const_iterator iter = fLabelsToStore.begin();
48  while(iter != fLabelsToStore.end()) {
49  QPulse& pulse = eva.Get<QPulse>(iter->owner.c_str(),iter->name.c_str());
50  if(fAction == "Consolidate") {
51  pulse.Consolidate();
52  } else if(fAction == "DeleteADC") {
53  pulse.DeleteADC();
54  } else {
55  Panic("Action %s is not valid",fAction.c_str());
56  }
57  iter++;
58  }
59 
60  return ACT_NEXTEV;
61 }
62 
64 {
65  // called at the end of the event loop
66  return ACT_NEXTEV;
67 }
68 
#define REGISTER_MODULE(clazz)
Definition: QDriver.hh:133
Manages QPulse waveform in the event.
Action Do(Diana::QEventAssembler &eva)
Do method.
Action Done()
Done method.
~MQPulseManager()
destructor
Action Init(Diana::QEventAssembler &eva)
Init method.
class to store ActionId and fEventNumber (in case fActionId=ACT_GOTOEV)
Definition: QDriver.hh:59
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,...
std::vector< QEventLabel > GetWriteLabels() const
Get the list of all writable QObject labels.
label for QObject in the QEvent
Definition: QEventLabel.hh:23
std::string GetStringLabel() const
get string in the format "owner@name"
Definition: QEventLabel.cc:48
std::string owner
owner of the QObject
Definition: QEventLabel.hh:60
std::string name
name of the QObject
Definition: QEventLabel.hh:62
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
Raw event: sampled waveform.
Definition: QPulse.hh:22
void DeleteADC()
Consolidate. Store samples from the fFiller into fSamplesADC
Definition: QPulse.cc:98
void Consolidate()
Consolidate. Store samples from the fFiller into fSamplesADC
Definition: QPulse.cc:90
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...