Diana Software
MTestDriver.cc
Go to the documentation of this file.
1 #include "MTestDriver.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  Action act;
23  act.fActionId = ACT_NEXTEV;
24  std::cout<<"[next \'return\'; quit \'q\'; prev \'p\'; go to ev \'e\'; rerun \'r\': ] ";
25  char p = getchar();
26  if(p == 'q') { getchar(); act.fActionId = ACT_QUIT; }
27  if(p == 'p') { getchar(); act.fActionId = ACT_PREVEV; }
28  if(p == 'e') { getchar(); std::cout<<"Event Number: "; std::cin>>act.fEventNumber; act.fActionId = ACT_GOTOEV; getchar();}
29  if(p == 'r') { getchar(); act.fActionId = ACT_RERUN;}
30 
31  return act;
32 
33 }
34 
36 {
37  // called before event loop
38  const std::vector<QBaseModule*>& modList = GetModulesList();
39  for(size_t m = 0; m < modList.size(); m++) {
40  std::string moduleName = modList.at(m)->GetName();
41  std::map<std::string, QVdt*> params = GetModuleParameters(moduleName, 0);
42  Error("Parameters for %s %d",moduleName.c_str(), params.size());
43  std::map<std::string, QVdt*>::iterator p = params.begin();
44  while(p != params.end()) {
45  switch(p->second->GetType()) {
46  case QVdt::Int_QVdt :
47  Info("\"%s\": %d",p->first.c_str(), (p->second)->GetInt());
48  break;
49  case QVdt::Double_QVdt :
50  Info("\"%s\": %f",p->first.c_str(), (p->second)->GetDouble());
51  break;
52  case QVdt::String_QVdt :
53  Info("\"%s\": %s",p->first.c_str(), (p->second)->GetString().c_str());
54  break;
55  case QVdt::Vector_QVdt :
57  default:
58  Warn("Cannot handle parameter of type %c",char(p->second->GetType()));
59  break;
60  }
61  p++;
62  }
63  }
64  Action act = Menu();
65  return act;
66 }
67 
69 {
70  QEvent& ev = eva.GetEvent();
71  // called event by event
72  const QHeader& hdr = ev.Get<QHeader>("","Header");;
73  const QPulseInfo& pi = ev.Get<QPulseInfo>("","PulseInfo");;
74  Info("****************************************");
75  Info("EventNumber: %d",hdr.GetEventNumber());
76  Info("ChannelId : %d",pi.GetChannelId());
77  Action act = Menu();
78  return act;
79 }
80 
82 {
83  // called at the end of the event loop
84  Action act = Menu();
85  return act;
86 }
87 
#define REGISTER_MODULE(clazz)
Definition: QDriver.hh:133
one-line description of your module
Definition: MTestDriver.hh:43
Action Do(Diana::QEventAssembler &eva)
Do method.
Definition: MTestDriver.cc:68
~MTestDriver()
destructor
Definition: MTestDriver.cc:15
Action Init(Diana::QEventAssembler &eva)
Init method.
Definition: MTestDriver.cc:35
Action Menu()
Definition: MTestDriver.cc:20
Action Done()
Done method.
Definition: MTestDriver.cc:81
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.
diana event
Definition: QEvent.hh:46
void Get(const char *owner, ReadHandle< Q > &handle) const
Get a QObject Handle in read mode.
Definition: QEvent.hh:74
Raw event: basic information like run number and time.
Definition: QHeader.hh:16
int GetEventNumber() const
get EventNumber
Definition: QHeader.hh:25
Raw event: bolometer channel, trigger positions and types.
Definition: QPulseInfo.hh:18
const int & GetChannelId() const
Get ChannelId.
Definition: QPulseInfo.hh:22
@ Vector_QVdt
Definition: QVdt.hh:34
@ String_QVdt
Definition: QVdt.hh:33
@ Double_QVdt
Definition: QVdt.hh:32
@ Int_QVdt
Definition: QVdt.hh:31
@ Unassigned_QVdt
Definition: QVdt.hh:35
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...