Jpp  master_rocky
the software that should make you happy
Functions
JPreprocessor.cc File Reference

Example program to test JTRIGGER::JPreprocessor. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include "km3net-dataformat/online/JDAQHit.hh"
#include "JDAQ/JDAQSuperFrameIO.hh"
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JDetectorSupportkit.hh"
#include "JDetector/JModuleRouter.hh"
#include "JTrigger/JSuperFrame2D.hh"
#include "JTrigger/JHitR0.hh"
#include "JTrigger/JHitR1.hh"
#include "JTrigger/JHitR2.hh"
#include "JTrigger/JMatchL0.hh"
#include "JTrigger/JBuildL0.hh"
#include "JTrigger/JBuildL1.hh"
#include "JTrigger/JBuildL2.hh"
#include "JTrigger/JPreprocessor.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

template<class T >
void print (std::ostream &out, const char *const title, T __begin, T __end)
 Print data. More...
 
int main (int argc, char **argv)
 

Detailed Description

Example program to test JTRIGGER::JPreprocessor.

Author
mdejong

Definition in file JPreprocessor.cc.

Function Documentation

◆ print()

template<class T >
void print ( std::ostream &  out,
const char *const  title,
__begin,
__end 
)
inline

Print data.

Parameters
outoutput stream
titletitle
__beginbegin of data
__endend of data

Definition at line 38 of file JPreprocessor.cc.

39 {
40  using namespace std;
41 
42  out << title;
43 
44  for (T i = __begin; i != __end; ++i) {
45  out << ' ' << setw(4) << (int) i->getT();
46  }
47 
48  out << endl;
49 }
Definition: JSTDTypes.hh:14

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 58 of file JPreprocessor.cc.

59 {
60  using namespace std;
61  using namespace KM3NETDAQ;
62  using namespace JPP;
63 
65  double Tmax_ns;
66  JPreprocessor option;
67  int debug;
68 
69  try {
70 
71  JParser<> zap("Example program to test hit pre-processing with user data."\
72  "\nformat: -u \"(<PMT> <time> <time-over-threshold>)+\"");
73 
74  zap['u'] = make_field(data);
75  zap['T'] = make_field(Tmax_ns);
76  zap['O'] = make_field(option) = JPreprocessor::getOptions();
77  zap['d'] = make_field(debug) = 0;
78 
79  zap(argc, argv);
80  }
81  catch(const exception &error) {
82  FATAL(error.what() << endl);
83  }
84 
85 
87 
89 
90  const JModule module = getModule<JKM3NeT_t>(1001);
91 
92  detector.push_back(module);
93 
94  const JModuleRouter router(detector);
95 
96  JHit::setSlewing(false);
97 
98  JDAQTimeslice timeslice;
99 
100  JDAQSuperFrame frame(JDAQSuperFrameHeader(timeslice.getDAQChronometer(), module.getID()));
101 
102  frame.add(data.size(), data.data());
103 
104  timeslice.push_back(frame);
105 
106  DEBUG(timeslice);
107 
108  {
109  typedef JSuperFrame2D<JHit> JSuperFrame2D_t;
110 
111  JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(timeslice[0], module);
112 
113  buffer.preprocess(option, JMatchL0<JHit>(Tmax_ns));
114 
115  JBuildL0<JHitR0> buildL0;
116  vector <JHitR0> output;
117 
118  buildL0(buffer, back_inserter(output));
119 
120  print(cout, "L0:", output.begin(), output.end());
121  }
122 
123  {
124  JBuildL0<JHitL0> buildL0;
125  vector <JHitL0> output;
126 
127  buildL0.setPreprocessor(option, JMatchL0<JHit>(Tmax_ns));
128 
129  buildL0(timeslice, router, back_inserter(output));
130 
131  print(cout, "L0:", output.begin(), output.end());
132  }
133  {
134  JBuildL1<JHitR1> buildL1(JBuildL1Parameters(Tmax_ns, true));
135  vector <JHitR1> output;
136 
137  buildL1.setPreprocessor(option, JMatchL0<JHit>(Tmax_ns));
138 
139  buildL1(timeslice, router, back_inserter(output));
140 
141  print(cout, "L1:", output.begin(), output.end());
142  }
143  {
144  JBuildL2<JHitR2> buildL2(JL2Parameters(2, Tmax_ns, -1.0));
145  vector <JHitR2> output;
146 
147  buildL2.setPreprocessor(option, JMatchL0<JHit>(Tmax_ns));
148 
149  buildL2(timeslice, router, back_inserter(output));
150 
151  print(cout, "L2:", output.begin(), output.end());
152  }
153 
154  return 0;
155 }
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
#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
void print(std::ostream &out, const char *const title, T __begin, T __end)
Print data.
Detector data structure.
Definition: JDetector.hh:96
Router for direct addressing of module data in detector data structure.
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 specialisation of L0 builder for JHitL0 data type.
Definition: JBuildL0.hh:105
Template specialisation of L0 builder for JHitR0 data type.
Definition: JBuildL0.hh:177
Template specialisation of L1 builder for JHitR1 data type.
Definition: JBuildL1.hh:287
Template specialisation of L2 builder for JHitR2 data type.
Definition: JBuildL2.hh:342
L0 match criterion.
Definition: JMatchL0.hh:29
2-dimensional frame with time calibrated data from one optical module.
const JDAQChronometer & getDAQChronometer() const
Get DAQ chronometer.
Data frame of one optical module.
@ debug_t
debug
Definition: JMessage.hh:29
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
Definition: DataQueue.cc:39
void setDAQLongprint(const bool option)
Set DAQ print option.
Definition: JDAQPrint.hh:28
Detector file.
Definition: JHead.hh:227
Auxiliary data structure for L1 build parameters.
Definition: JBuildL1.hh:38
void setPreprocessor(const JPreprocessor::JOption_t option, const match_type &match)
Set pre-processor of consecutive hits.
Definition: JBuild.hh:59
Data structure for L2 parameters.
Auxiliary class for specifying the way of pre-processing of hits.