Jpp
JSuperFrame1D.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGER__JSUPERFRAME1D__
2 #define __JTRIGGER__JSUPERFRAME1D__
3 
4 #include <vector>
5 
6 #include "JDAQ/JDAQSuperFrame.hh"
7 #include "JDetector/JModule.hh"
8 #include "JTools/JMergeSort.hh"
11 
12 
13 /**
14  * \author mdejong
15  */
16 
17 namespace JTRIGGER {}
18 namespace JPP { using namespace JTRIGGER; }
19 
20 namespace JTRIGGER {
21 
23  using JDETECTOR::JModule;
24 
25 
26  /**
27  * 1-dimensional frame with time calibrated data from one optical module.
28  *
29  * This class can be used to merge the data from different PMTs contained
30  * in a JSuperFrame2D object; the data will then be time sorted.
31  *
32  * The data member JSuperFrame1D::multiplex can be used as an I/O buffer.
33  */
34  template<class JElement_t, class JAllocator_t = std::allocator<JElement_t> >
35  class JSuperFrame1D :
36  public JModuleHeader,
37  public std::vector<JElement_t, JAllocator_t>,
38  public JHitToolkit<JElement_t>
39  {
40  public:
41  /**
42  * Default constructor.
43  */
45  JModuleHeader(),
46  std::vector<JElement_t, JAllocator_t>(),
47  JHitToolkit<JElement_t>()
48  {}
49 
50 
51  /**
52  * Constructor.
53  *
54  * \param chronometer DAQ chronometer
55  * \param id module identifier
56  * \param pos module position
57  */
58  JSuperFrame1D(const JDAQChronometer& chronometer,
59  const JDAQModuleIdentifier& id,
60  const JPosition3D& pos) :
61  JModuleHeader(chronometer, id, pos),
62  std::vector<JElement_t, JAllocator_t>(),
63  JHitToolkit<JElement_t>()
64  {}
65 
66 
67  /**
68  * Constructor.
69  *
70  * \param input 2D super frame
71  */
74  JHitToolkit<JElement_t>()
75  {
76  merge(input.begin(), input.end(), static_cast<std::vector<JElement_t, JAllocator_t>&>(*this), this->getToolkit());
77  }
78 
79 
80  /**
81  * Process 2D super frame.
82  *
83  * The data are sorted in time and an appropriate end marker is added.
84  *
85  * \param input 2D super frame
86  * \return this 1D super frame
87  */
89  {
90  this->setModuleHeader(input.getModuleHeader());
91 
92  merge(input.begin(), input.end(), static_cast<std::vector<JElement_t, JAllocator_t>&>(*this), this->getToolkit());
93 
94  return *this;
95  }
96 
97 
98  /**
99  * Process set of 2D super frame data.
100  *
101  * The data are sorted in time and an appropriate end marker is added.
102  * Note that this method only updates the data in the container.
103  *
104  * \param __begin begin of 2D super frame data
105  * \param __end end of 2D super frame data
106  * \return this 1D super frame
107  */
110  {
111  merge(__begin, __end, static_cast<std::vector<JElement_t, JAllocator_t>&>(*this), this->getToolkit());
112 
113  return *this;
114  }
115 
116 
117  /**
118  * Process DAQ super frame.
119  *
120  * The time calibration is applied, data are sorted in time and an appropriate end marker is added.
121  *
122  * \param input DAQ super frame
123  * \param module module data
124  * \return this 1D super frame
125  */
127  const JModule& module)
128  {
129  return (*this)(buffer(input, module));
130  }
131 
132 
133  /**
134  * Multiplexer.
135  */
137 
138 
139  private:
142  };
143 
144 
145  /**
146  * Internal merge method.
147  */
148  template<class JElement_t, class JAllocator_t>
150 
151 
152  /**
153  * Internal buffer.
154  */
155  template<class JElement_t, class JAllocator_t>
157 
158 
159  /**
160  * Multiplexer.
161  */
162  template<class JElement_t, class JAllocator_t>
164 }
165 
166 #endif
JTRIGGER::JSuperFrame1D::multiplex
static JSuperFrame1D< JElement_t, JAllocator_t > multiplex
Multiplexer.
Definition: JSuperFrame1D.hh:136
JModule.hh
JTRIGGER::JHitToolkit
Template definition of hit toolkit.
Definition: JHitToolkit.hh:60
JModuleHeader.hh
JSuperFrame2D.hh
JTRIGGER::JSuperFrame1D::buffer
static JSuperFrame2D< JElement_t > buffer
Internal buffer.
Definition: JSuperFrame1D.hh:141
JTRIGGER::JSuperFrame1D
1-dimensional frame with time calibrated data from one optical module.
Definition: JSuperFrame1D.hh:35
std::vector
Definition: JSTDTypes.hh:12
JTRIGGER::JSuperFrame1D::merge
static JTOOLS::JMergeSort< JElement_t > merge
Internal merge method.
Definition: JSuperFrame1D.hh:140
KM3NETDAQ::JDAQModuleIdentifier::id
int id
Definition: JDAQModuleIdentifier.hh:153
JTRIGGER::JModuleHeader::getModuleHeader
const JModuleHeader & getModuleHeader() const
Get module header.
Definition: JModuleHeader.hh:62
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JMergeSort.hh
JTRIGGER::JModuleHeader
Header for Module.
Definition: JModuleHeader.hh:26
JGEOMETRY3D::JPosition3D
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JTRIGGER::JSuperFrame1D::operator()
JSuperFrame1D & operator()(const JSuperFrame2D< JElement_t > &input)
Process 2D super frame.
Definition: JSuperFrame1D.hh:88
JTRIGGER::JModuleHeader::setModuleHeader
void setModuleHeader(const JModuleHeader &header)
Set module header.
Definition: JModuleHeader.hh:73
JDETECTOR::JModule
Data structure for a composite optical module.
Definition: JModule.hh:49
KM3NETDAQ::JDAQModuleIdentifier
Module identifier.
Definition: JDAQModuleIdentifier.hh:24
JTRIGGER::JSuperFrame1D::JSuperFrame1D
JSuperFrame1D()
Default constructor.
Definition: JSuperFrame1D.hh:44
JTRIGGER::JSuperFrame1D::JSuperFrame1D
JSuperFrame1D(const JSuperFrame2D< JElement_t > &input)
Constructor.
Definition: JSuperFrame1D.hh:72
JTOOLS::JMergeSort
This class implements a merge and sort algorithm based on the divide-and-conquer concept.
Definition: JMergeSort.hh:50
std
Definition: jaanetDictionary.h:36
JDAQSuperFrame.hh
KM3NETDAQ::JDAQSuperFrame
Data frame of one optical module.
Definition: JDAQSuperFrame.hh:27
JTRIGGER::JSuperFrame1D::operator()
JSuperFrame1D & operator()(typename JSuperFrame2D< JElement_t >::const_iterator __begin, typename JSuperFrame2D< JElement_t >::const_iterator __end)
Process set of 2D super frame data.
Definition: JSuperFrame1D.hh:108
JTRIGGER
Checksum.
Definition: JSupport/JSupport.hh:35
JTRIGGER::JSuperFrame2D< JElement_t >
JTRIGGER::JSuperFrame1D::JSuperFrame1D
JSuperFrame1D(const JDAQChronometer &chronometer, const JDAQModuleIdentifier &id, const JPosition3D &pos)
Constructor.
Definition: JSuperFrame1D.hh:58
JTRIGGER::JSuperFrame1D::operator()
JSuperFrame1D & operator()(const JDAQSuperFrame &input, const JModule &module)
Process DAQ super frame.
Definition: JSuperFrame1D.hh:126
KM3NETDAQ::JDAQChronometer
DAQ chronometer.
Definition: JDAQChronometer.hh:26