Jpp  18.0.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JSuperFrame1D.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGER__JSUPERFRAME1D__
2 #define __JTRIGGER__JSUPERFRAME1D__
3 
4 #include <vector>
5 
7 #include "JDetector/JModule.hh"
8 #include "JTools/JMergeSort.hh"
10 #include "JTrigger/JFrame_t.hh"
12 
13 
14 
15 /**
16  * \author mdejong
17  */
18 
19 namespace JTRIGGER {}
20 namespace JPP { using namespace JTRIGGER; }
21 
22 namespace JTRIGGER {
23 
25  using JDETECTOR::JModule;
26 
27 
28  /**
29  * 1-dimensional frame with time calibrated data from one optical module.
30  *
31  * This class can be used to merge the data from different PMTs contained in a JSuperFrame2D object.\n
32  * The data will then be time sorted.
33  *
34  * The static data member JSuperFrame1D::multiplex can be used as an I/O buffer.
35  */
36  template<class JElement_t, class JAllocator_t = std::allocator<JElement_t> >
37  class JSuperFrame1D :
38  public JModuleHeader,
39  public JFrame_t<JElement_t, JAllocator_t>
40  {
41  public:
42 
44 
45 
46  /**
47  * Default constructor.
48  */
50  {}
51 
52 
53  /**
54  * Constructor.
55  *
56  * \param chronometer DAQ chronometer
57  * \param id module identifier
58  * \param pos module position
59  */
60  JSuperFrame1D(const JDAQChronometer& chronometer,
61  const JDAQModuleIdentifier& id,
62  const JPosition3D& pos) :
63  JModuleHeader(chronometer, id, pos)
64  {}
65 
66 
67  /**
68  * Constructor.
69  *
70  * \param input 2D super frame
71  */
74  {
75  merge(input.begin(), input.end(), *this, this->getToolkit());
76  }
77 
78 
79  /**
80  * Process 2D super frame.
81  *
82  * The data are sorted in time and an appropriate end marker is added.
83  *
84  * \param input 2D super frame
85  * \return this 1D super frame
86  */
88  {
89  this->setModuleHeader(input.getModuleHeader());
90 
91  merge(input.begin(), input.end(), static_cast<std::vector<JElement_t, JAllocator_t>&>(*this), this->getToolkit());
92 
93  return *this;
94  }
95 
96 
97  /**
98  * Process set of 2D super frame data.
99  *
100  * The data are sorted in time and an appropriate end marker is added.
101  * Note that this method only updates the data in the container.
102  *
103  * \param __begin begin of 2D super frame data
104  * \param __end end of 2D super frame data
105  * \return this 1D super frame
106  */
109  {
110  merge(__begin, __end, static_cast<std::vector<JElement_t, JAllocator_t>&>(*this), this->getToolkit());
111 
112  return *this;
113  }
114 
115 
116  /**
117  * Process DAQ super frame.
118  *
119  * The time calibration is applied, data are sorted in time and an appropriate end marker is added.
120  *
121  * \param input DAQ super frame
122  * \param module module data
123  * \return this 1D super frame
124  */
126  const JModule& module)
127  {
128  return (*this)(buffer(input, module));
129  }
130 
131 
132  /**
133  * Multiplexer.
134  */
136 
137 
138  private:
141  };
142 
143 
144  /**
145  * Internal merge method.
146  */
147  template<class JElement_t, class JAllocator_t>
149 
150 
151  /**
152  * Internal buffer.
153  */
154  template<class JElement_t, class JAllocator_t>
156 
157 
158  /**
159  * Multiplexer.
160  */
161  template<class JElement_t, class JAllocator_t>
163 }
164 
165 #endif
Data frame with end marker.
Definition: JFrame_t.hh:27
JSuperFrame1D & operator()(const JDAQSuperFrame &input, const JModule &module)
Process DAQ super frame.
Data structure for a composite optical module.
Definition: JModule.hh:68
static JSuperFrame1D< JElement_t, JAllocator_t > multiplex
Multiplexer.
JSuperFrame1D(const JDAQChronometer &chronometer, const JDAQModuleIdentifier &id, const JPosition3D &pos)
Constructor.
1-dimensional frame with time calibrated data from one optical module.
void setModuleHeader(const JModuleHeader &header)
Set module header.
JSuperFrame1D & operator()(typename JSuperFrame2D< JElement_t >::const_iterator __begin, typename JSuperFrame2D< JElement_t >::const_iterator __end)
Process set of 2D super frame data.
JSuperFrame1D(const JSuperFrame2D< JElement_t > &input)
Constructor.
JFrame_t< JElement_t, JAllocator_t > container_type
const JModuleHeader & getModuleHeader() const
Get module header.
Header for Module.
JSuperFrame1D()
Default constructor.
static JTOOLS::JMergeSort< JElement_t > merge
Internal merge method.
JSuperFrame1D & operator()(const JSuperFrame2D< JElement_t > &input)
Process 2D super frame.
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
Data frame of one optical module.
static JSuperFrame2D< JElement_t > buffer
Internal buffer.
Data structure for optical module.