Diana Software
MTestNeighboursContinuousIO.cc
Go to the documentation of this file.
2 #include "QEvent.hh"
3 #include "QPulseInfo.hh"
4 #include "QPulse.hh"
5 #include "QEventList.hh"
6 #include <sstream>
7 
8 
10 
11 using namespace Diana;
12 using namespace std;
13 
14 #define ASSERT_EQUAL(x,y)\
15 if(x==y) fTestOK++;\
16 else {\
17 fTestKO++;\
18 stringstream difference;\
19 difference<<x<<" vs "<<y;\
20 Error("Test failed: file %s; line %d: %s", __FILE__ , __LINE__,difference.str().c_str());\
21 }
22 
24 {
25  fTestOK=0;
26  fTestKO=0;
27 }
28 
29 
30 
31 
33 {
34 }
35 
37 {
38  const QPulseInfo& pulseInfo = ev.Get<QPulseInfo>("DAQ","PulseInfo");
39  int mainChannel = pulseInfo.GetChannelId();
40  if(mainChannel == 500) {
41  const QEvent& other = neighbours[0];
42  const QPulseInfo& pInfo = other.Get<QPulseInfo>("DAQ","PulseInfo");
43  int sideChannel = pInfo.GetChannelId();
44  ASSERT_EQUAL(mainChannel,sideChannel);
45  const QVector& pulse = ev.Get<QPulse>("DAQ","Pulse").GetSamples();
46  const QVector& opulse = other.Get<QPulse>("DAQ","Pulse").GetSamples();
47  for(size_t i = 0; i < pulse.Size(); i++) {
48  ASSERT_EQUAL(pulse[i],opulse[i]);
49  }
50  } else {
51  for(size_t i = 0 ; i < neighbours.Size(); i++) {
52  const QEvent& other = neighbours[i];
53  const QPulseInfo& pInfo = other.Get<QPulseInfo>("DAQ","PulseInfo");
54  size_t sideChannel = pInfo.GetChannelId();
55  ASSERT_EQUAL(mainChannel+1+i,sideChannel);
56  }
57  }
58 
59 }
60 
62 {
63 }
64 
66 {
67  if(!isEnabled()) return;
68  Info("----TEST SUMMARY-----");
69  Info("OK: %d", fTestOK);
70  if(fTestKO >0) Error("KO: %d", fTestKO);
71 
72  //if(fTestOK !=250137 ) Panic("Expected test %d vs %d",250137,fTestOK);
73 }
74 
75 
#define ASSERT_EQUAL(x, y)
#define REGISTER_MODULE(clazz)
Definition: QDriver.hh:133
one-line description of your module
void Init(Diana::QEvent &ev)
Init method.
void Do(Diana::QEvent &ev, const Diana::QEventList &neighbours)
Do method. Declare and implement only one of the two versions.
list of references to const QEvent (s)
Definition: QEventList.hh:21
size_t Size() const
number of QEvent (s)
Definition: QEventList.hh:36
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: 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
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...