Jpp  master_rocky
the software that should make you happy
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 "JDetector/JDetectorSupportkit.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

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 26 of file JDAQHitSelector.cc.

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 }
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
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
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.
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.