Jpp  19.1.0
the software that should make you happy
JBuildHelper.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGER__JBUILDHELPER__
2 #define __JTRIGGER__JBUILDHELPER__
3 
7 #include "JDetector/JModule.hh"
9 
10 
11 /**
12  * \author mdejong
13  */
14 
15 namespace JTRIGGER {}
16 namespace JPP { using namespace JTRIGGER; }
17 
18 namespace JTRIGGER {
19 
23  using JDETECTOR::JModule;
25 
26 
27  /**
28  * Auxiliary class to extend hit building functionality to all DAQ data types.\n
29  * The implementation of this functionality is based on a static cast of
30  * the given template parameter (known as "curiously recurring template pattern").\n
31  * The template parameter should refer to a class which provides for
32  * an implementation of the following operator:
33  * <pre>
34  * template<class JOutput_t>
35  * void operator()(const JDAQSuperFrame& super_frame,
36  * const JModule& module,
37  * JOutput_t out) const
38  * </pre>
39  * where <tt>out</tt> refers to an STL compatible output iterator.\n
40  * The data type of the <tt>JBuild_t</tt> class corresponds to
41  * the pointed-to element of the output iterator.
42  */
43  template<class JBuild_t>
44  struct JBuildHelper
45  {
46  /**
47  * Build hits from uncalibrated DAQ data.
48  *
49  * The time calibration is applied.
50  * Note that the output data are not time sorted.
51  *
52  * \param timeslice DAQ time slice
53  * \param router module router
54  * \param out output data
55  */
56  template<class JOutput_t>
57  void operator()(const JDAQTimeslice& timeslice,
58  const JModuleRouter& router,
59  JOutput_t out) const
60  {
61  for (JDAQTimeslice::const_iterator i = timeslice.begin(); i != timeslice.end(); ++i) {
62  if (router.hasModule(i->getModuleID())) {
63  static_cast<const JBuild_t&>(*this)(*i, router.getModule(i->getModuleID()), out);
64  }
65  }
66  }
67 
68 
69  /**
70  * Build hits from uncalibrated DAQ data.
71  *
72  * The time calibration is applied.
73  * Note that the output data are not time sorted.
74  *
75  * \param event DAQ event
76  * \param router module router
77  * \param snapshot use shapshot hits (else use triggered hits)
78  * \param out output data
79  */
80  template<class JOutput_t>
81  void operator()(const JDAQEvent& event,
82  const JModuleRouter& router,
83  const bool snapshot,
84  JOutput_t out) const
85  {
86  static_cast<const JBuild_t&>(*this)(JDAQTimeslice(event, snapshot), router, out);
87  }
88 
89 
90  /**
91  * Build hits from uncalibrated DAQ data.
92  *
93  * The snapshot data of the DAQ event are used.
94  * The time calibration is applied.
95  * Note that the output data are not time sorted.
96  *
97  * \param event DAQ event
98  * \param router module router
99  * \param out output data
100  */
101  template<class JOutput_t>
102  void operator()(const JDAQEvent& event,
103  const JModuleRouter& router,
104  JOutput_t out) const
105  {
106  static_cast<const JBuild_t&>(*this)(JDAQTimeslice(event, true), router, out);
107  }
108  };
109 }
110 
111 #endif
Direct access to module in detector data structure.
Data structure for optical module.
Router for direct addressing of module data in detector data structure.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
bool hasModule(const JObjectID &id) const
Has module.
Data structure for a composite optical module.
Definition: JModule.hh:75
Data frame of one optical module.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for triggering.
Auxiliary class to extend hit building functionality to all DAQ data types.
Definition: JBuildHelper.hh:45
void operator()(const JDAQTimeslice &timeslice, const JModuleRouter &router, JOutput_t out) const
Build hits from uncalibrated DAQ data.
Definition: JBuildHelper.hh:57
void operator()(const JDAQEvent &event, const JModuleRouter &router, const bool snapshot, JOutput_t out) const
Build hits from uncalibrated DAQ data.
Definition: JBuildHelper.hh:81
void operator()(const JDAQEvent &event, const JModuleRouter &router, JOutput_t out) const
Build hits from uncalibrated DAQ data.