Jpp  17.3.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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/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

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

Print data.

Parameters
outoutput stream
titletitle
__beginbegin of data
__endend of data

Definition at line 37 of file JPreprocessor.cc.

38 {
39  using namespace std;
40 
41  out << title;
42 
43  for (T i = __begin; i != __end; ++i) {
44  out << ' ' << setw(4) << (int) i->getT();
45  }
46 
47  out << endl;
48 }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
int main ( int  argc,
char **  argv 
)

Definition at line 57 of file JPreprocessor.cc.

58 {
59  using namespace std;
60  using namespace KM3NETDAQ;
61  using namespace JPP;
62 
63  vector<JDAQHit> data;
64  double Tmax_ns;
65  JPreprocessor option;
66  int debug;
67 
68  try {
69 
70  JParser<> zap("Example program to test hit pre-processing with user data."\
71  "\nformat: -u \"(<PMT> <time> <time-over-threshold>)+\"");
72 
73  zap['u'] = make_field(data);
74  zap['T'] = make_field(Tmax_ns);
75  zap['O'] = make_field(option) = JPreprocessor::getOptions();
76  zap['d'] = make_field(debug) = 0;
77 
78  zap(argc, argv);
79  }
80  catch(const exception &error) {
81  FATAL(error.what() << endl);
82  }
83 
84 
86 
88 
89  const JModule module = getModule<JKM3NeT_t>(1001);
90 
91  detector.push_back(module);
92 
93  const JModuleRouter router(detector);
94 
95  JHit::setSlewing(false);
96 
97  JDAQTimeslice timeslice;
98 
99  JDAQSuperFrame frame(JDAQSuperFrameHeader(timeslice.getDAQChronometer(), module.getID()));
100 
101  frame.add(data.size(), data.data());
102 
103  timeslice.push_back(frame);
104 
105  DEBUG(timeslice);
106 
107  {
108  typedef JSuperFrame2D<JHit> JSuperFrame2D_t;
109 
110  JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(timeslice[0], module);
111 
112  buffer.preprocess(option, JMatchL0<JHit>(Tmax_ns));
113 
114  JBuildL0<JHitR0> buildL0;
115  vector <JHitR0> output;
116 
117  buildL0(buffer, back_inserter(output));
118 
119  print(cout, "L0:", output.begin(), output.end());
120  }
121 
122  {
123  JBuildL0<JHitL0> buildL0;
124  vector <JHitL0> output;
125 
126  buildL0.setPreprocessor(option, JMatchL0<JHit>(Tmax_ns));
127 
128  buildL0(timeslice, router, back_inserter(output));
129 
130  print(cout, "L0:", output.begin(), output.end());
131  }
132  {
133  JBuildL1<JHitR1> buildL1(JBuildL1Parameters(Tmax_ns, true));
134  vector <JHitR1> output;
135 
136  buildL1.setPreprocessor(option, JMatchL0<JHit>(Tmax_ns));
137 
138  buildL1(timeslice, router, back_inserter(output));
139 
140  print(cout, "L1:", output.begin(), output.end());
141  }
142  {
143  JBuildL2<JHitR2> buildL2(JL2Parameters(2, Tmax_ns, -1.0));
144  vector <JHitR2> output;
145 
146  buildL2.setPreprocessor(option, JMatchL0<JHit>(Tmax_ns));
147 
148  buildL2(timeslice, router, back_inserter(output));
149 
150  print(cout, "L2:", output.begin(), output.end());
151  }
152 
153  return 0;
154 }
Utility class to parse command line options.
Definition: JParser.hh:1517
debug
Definition: JMessage.hh:29
Data structure for a composite optical module.
Definition: JModule.hh:68
void setPreprocessor(const JPreprocessor::JOption_t option, const match_type &match)
Set pre-processor of consecutive hits.
Definition: JBuild.hh:59
Template specialisation of L0 builder for JHitL0 data type.
Definition: JBuildL0.hh:102
L0 match criterion.
Definition: JMatchL0.hh:27
Detector data structure.
Definition: JDetector.hh:89
Router for direct addressing of module data in detector data structure.
void setDAQLongprint(const bool option)
Set DAQ print option.
Definition: JDAQPrint.hh:28
Template specialisation of L0 builder for JHitR0 data type.
Definition: JBuildL0.hh:174
Detector file.
Definition: JHead.hh:226
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
Data time slice.
Template specialisation of L1 builder for JHitR1 data type.
Definition: JBuildL1.hh:284
print
Definition: JConvertDusj.sh:44
#define FATAL(A)
Definition: JMessage.hh:67
Data structure for L2 parameters.
Auxiliary data structure for L1 build parameters.
Definition: JBuildL1.hh:37
Template specialisation of L2 builder for JHitR2 data type.
Definition: JBuildL2.hh:339
2-dimensional frame with time calibrated data from one optical module.
do set_variable DETECTOR_TXT $WORKDIR detector
Auxiliary class for specifying the way of pre-processing of hits.
Data frame of one optical module.
int debug
debug level
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62