Jpp  16.0.3
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JDAQHitSelector.cc File Reference

Example program to test DAQ hit selection using JTRIGGER::JBuildL0. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include "km3net-dataformat/online/JDAQHit.hh"
#include "JDetector/JModule.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JTrigger/JHit.hh"
#include "JTrigger/JHitR0.hh"
#include "JTrigger/JBuildL0.hh"
#include "JTrigger/JDAQHitToTSelector.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test DAQ hit selection using JTRIGGER::JBuildL0.

Author
mdejong

Definition in file JDAQHitSelector.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 25 of file JDAQHitSelector.cc.

26 {
27  using namespace std;
28  using namespace JPP;
29  using namespace KM3NETDAQ;
30 
31  int debug;
32 
33  try {
34 
35  JParser<> zap("Example program to test DAQ hit selection using JTRIGGER::JBuildL0.");
36 
37  zap['d'] = make_field(debug) = 3;
38 
39  zap(argc, argv);
40  }
41  catch(const exception &error) {
42  FATAL(error.what() << endl);
43  }
44 
45  cout.tie(&cerr);
46 
47 
48  const JModule module = getModule<JKM3NeT_t>(1001);
49 
50  const JDAQHit::JTOT_t tot = 5;
51  const JDAQHit::JTOT_t tot_min = 10;
52  const JDAQHit::JTOT_t tot_max = 20;
53 
54  JDAQSuperFrame frame(JDAQSuperFrameHeader(JDAQChronometer(), module.getID()));
55 
56  {
57  vector<JDAQHit> buffer;
58 
59  for (int i = 0; i != 100; ++i) {
60  buffer.push_back(JDAQHit(0, 0, tot));
61  }
62 
63  frame.add(buffer.size(), buffer.data());
64  }
65 
66  ASSERT(!frame.empty());
67 
68 
69  JBuildL0<double> buildL0;
70  vector <double> buffer;
71 
72 
73  buildL0(frame, module, back_inserter(buffer));
74 
75  ASSERT(buffer.size() == (size_t) frame.size(), "Test of L0 hit building w/o DAQ hit selection " << buffer.size() << " ?= " << frame.size());
76 
77 
78  buildL0.setDAQHitSelector(JDAQHitToTSelector(tot_min, tot_max));
79 
80  buffer.clear();
81 
82  buildL0(frame, module, back_inserter(buffer));
83 
84  ASSERT(buffer.size() == 0u, "Test of L0 hit building with DAQ hit selection " << buffer.size() << " ?= " << 0u);
85 
86 
87  buildL0.resetDAQHitSelector();
88 
89  buffer.clear();
90 
91  buildL0(frame, module, back_inserter(buffer));
92 
93  ASSERT(buffer.size() == (size_t) frame.size(), "Test of L0 hit building w/o DAQ hit selection " << buffer.size() << " ?= " << frame.size());
94 
95  return 0;
96 }
Utility class to parse command line options.
Definition: JParser.hh:1500
Data structure for a composite optical module.
Definition: JModule.hh:68
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
unsigned char JTOT_t
time over threshold [ns]
Definition: JDAQHit.hh:40
Hit data structure.
Definition: JDAQHit.hh:34
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
Auxiliary class to select DAQ hits based on time-over-treshold value.
Template L0 hit builder.
Definition: JBuildL0.hh:35
double u[N+1]
Definition: JPolint.hh:755
Data frame of one optical module.