Jpp
 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"
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
JSuperFrame1D & operator()(const JDAQSuperFrame &input, const JModule &module)
Process DAQ super frame.
Data structure for a composite optical module.
Definition: JModule.hh:57
static JSuperFrame1D< JElement_t, JAllocator_t > multiplex
Multiplexer.
JSuperFrame1D(const JDAQChronometer &chronometer, const JDAQModuleIdentifier &id, const JPosition3D &pos)
Constructor.
This class implements a merge and sort algorithm based on the divide-and-conquer concept.
Definition: JMergeSort.hh:50
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.
const JModuleHeader & getModuleHeader() const
Get module header.
Header for Module.
JSuperFrame1D()
Default constructor.
static JTOOLS::JMergeSort< JElement_t > merge
Internal merge method.
Template definition of hit toolkit.
Definition: JHitToolkit.hh:60
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 a composite optical module.