Jpp  19.1.0
the software that should make you happy
JDAQHitSelector.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 #include <vector>
6 
8 #include "JDetector/JModule.hh"
11 #include "JTrigger/JHit.hh"
12 #include "JTrigger/JHitR0.hh"
13 #include "JTrigger/JBuildL0.hh"
15 
16 #include "Jeep/JParser.hh"
17 #include "Jeep/JMessage.hh"
18 
19 
20 /**
21  * \file
22  *
23  * Example program to test DAQ hit selection using JTRIGGER::JBuildL0.
24  * \author mdejong
25  */
26 int main(int argc, char **argv)
27 {
28  using namespace std;
29  using namespace JPP;
30  using namespace KM3NETDAQ;
31 
32  int debug;
33 
34  try {
35 
36  JParser<> zap("Example program to test DAQ hit selection using JTRIGGER::JBuildL0.");
37 
38  zap['d'] = make_field(debug) = 3;
39 
40  zap(argc, argv);
41  }
42  catch(const exception &error) {
43  FATAL(error.what() << endl);
44  }
45 
46 
47  const JModule module = getModule<JKM3NeT_t>(1001);
48 
49  const JDAQHit::JTOT_t tot = 5;
50  const JDAQHit::JTOT_t tot_min = 10;
51  const JDAQHit::JTOT_t tot_max = 20;
52 
54 
55  {
56  vector<JDAQHit> buffer;
57 
58  for (int i = 0; i != 100; ++i) {
59  buffer.push_back(JDAQHit(0, 0, tot));
60  }
61 
62  frame.add(buffer.size(), buffer.data());
63  }
64 
65  ASSERT(!frame.empty());
66 
67 
68  JBuildL0<double> buildL0;
69  vector <double> buffer;
70 
71 
72  buildL0(frame, module, back_inserter(buffer));
73 
74  ASSERT(buffer.size() == (size_t) frame.size(), "Test of L0 hit building w/o DAQ hit selection " << buffer.size() << " ?= " << frame.size());
75 
76 
77  buildL0.setDAQHitSelector(JDAQHitToTSelector(tot_min, tot_max));
78 
79  buffer.clear();
80 
81  buildL0(frame, module, back_inserter(buffer));
82 
83  ASSERT(buffer.size() == 0u, "Test of L0 hit building with DAQ hit selection " << buffer.size() << " ?= " << 0u);
84 
85 
86  buildL0.resetDAQHitSelector();
87 
88  buffer.clear();
89 
90  buildL0(frame, module, back_inserter(buffer));
91 
92  ASSERT(buffer.size() == (size_t) frame.size(), "Test of L0 hit building w/o DAQ hit selection " << buffer.size() << " ?= " << frame.size());
93 
94  return 0;
95 }
int main(int argc, char **argv)
Detector support kit.
Basic data structure for L0 hit.
General purpose messaging.
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
Data structure for optical module.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
Basic data structure for time and time over threshold information of hit.
Data structure for a composite optical module.
Definition: JModule.hh:75
int getID() const
Get identifier.
Definition: JObjectID.hh:50
Utility class to parse command line options.
Definition: JParser.hh:1698
Template L0 hit builder.
Definition: JBuildL0.hh:38
int size() const
Definition: JDAQFrame.hh:183
bool empty() const
Definition: JDAQFrame.hh:181
Hit data structure.
Definition: JDAQHit.hh:35
unsigned char JTOT_t
time over threshold [ns]
Definition: JDAQHit.hh:40
Data frame of one optical module.
JDAQSuperFrame & add(const JDAQSuperFrame &super_frame)
Add data from same optical module.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double u[N+1]
Definition: JPolint.hh:865
KM3NeT DAQ data structures and auxiliaries.
Definition: DataQueue.cc:39
Definition: JSTDTypes.hh:14
void setDAQHitSelector(const JDAQHitSelector &selector)
Set DAQ hit selector.
Definition: JBuild.hh:81
void resetDAQHitSelector()
Reset DAQ hit selector.
Definition: JBuild.hh:90
Auxiliary class to select DAQ hits based on time-over-treshold value.