Diana Software
MTestFetchContinuousIO.cc
Go to the documentation of this file.
2 #include "QEvent.hh"
3 #include "QEventList.hh"
4 #include "QPulse.hh"
5 #include <sstream>
6 
7 
9 
10 using namespace Diana;
11 using namespace std;
12 
13 #define ASSERT_EQUAL(x,y)\
14 if(x==y) fTestOK++;\
15 else {\
16 fTestKO++;\
17 stringstream difference;\
18 difference<<x<<" vs "<<y;\
19 Error("Test failed: file %s; line %d: %s", __FILE__ , __LINE__,difference.str().c_str());\
20 }
21 
23 {
24  fTestOK=0;
25  fTestKO=0;
26 }
27 
28 
29 
31 {
32  fMode = GetString("Mode","Standard");
33 }
34 
35 //void MTestFetchContinuousIO::Do(QEvent& ev, const QEventList& neighbours)
37 {
38  const QPulse& pulse = ev.Get<QPulse>("DAQ","Pulse");
39  if(fMode == "Standard") {
40  QVector a;
41  a = pulse.GetSamplesADC();
42  } else if(fMode == "Continuous") {
43  pulse.GetSamples();
44  } else if(fMode == "Compare") {
45  QVector a;
46  a = pulse.GetSamplesADC();
47  const QVector& b = pulse.GetSamples();
48  for(size_t i = 0; i < a.Size(); i++) {
49  ASSERT_EQUAL(a[i],b[i]);
50  }
51  } else {
52  Panic("Odption Mode must be Standard or Continuous");
53  }
54 }
55 
57 {
58 }
59 
61 {
62  if(!isEnabled() || fMode != "Compare") return;
63  Info("----TEST SUMMARY-----");
64  Info("OK: %d", fTestOK);
65  if(fTestKO >0) Error("KO: %d", fTestKO);
66 
67  //if(fTestOK !=250137 ) Panic("Expected test %d vs %d",250137,fTestOK);
68 }
69 
70 
TF1 a
Definition: CheckOF.C:21
QVector b
Definition: CheckOF.C:21
#define ASSERT_EQUAL(x, y)
#define REGISTER_MODULE(clazz)
Definition: QDriver.hh:133
one-line description of your module
void Do(Diana::QEvent &ev)
Do method. Declare and implement only one of the two versions.
void Init(Diana::QEvent &ev)
Init method.
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: sampled waveform.
Definition: QPulse.hh:22
const Diana::QVectorI & GetSamplesADC() const
Get Samples acquired from ADC. Beware that fSamplesADC may by empty if fFiller is valid
Definition: QPulse.cc:69
const Diana::QVector & GetSamples() const
Get Samples casted to double (QVector instead of QVectorI). Use this method in place of GetSamplesADC...
Definition: QPulse.cc:49
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...