Jpp
JBuildL0.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGER__JBUILDL0__
2 #define __JTRIGGER__JBUILDL0__
3 
6 #include "JTrigger/JHit.hh"
7 #include "JTrigger/JHitL0.hh"
8 #include "JTrigger/JHitR0.hh"
10 #include "JTrigger/JBuild.hh"
11 #include "JGeometry3D/JAxis3D.hh"
13 #include "JDetector/JModule.hh"
14 
15 
16 /**
17  * \author mdejong
18  */
19 
20 namespace JTRIGGER {}
21 namespace JPP { using namespace JTRIGGER; }
22 
23 namespace JTRIGGER {
24 
26  using JDETECTOR::JModule;
27 
28  /**
29  * Template L0 hit builder.
30  *
31  * An L0 hit is a hit from a PMT.
32  */
33  template<class JHit_t>
34  class JBuildL0 :
35  public JBuildHelper< JBuildL0<JHit_t> >,
36  public JBuild<JHit_t>
37  {
38  public:
39 
40  using JBuildHelper< JBuildL0<JHit_t> >::operator();
41 
42  typedef JHit_t value_type;
43 
44 
45  /**
46  * Default constructor.
47  */
49  {}
50 
51 
52  /**
53  * Build hits from calibrated data.
54  *
55  * Note that the output data are not time sorted.
56  *
57  * \param input input L0 data
58  * \param out output L0 data
59  */
60  template<class JOutput_t>
61  void operator()(const JSuperFrame2D<JHit_t>& input, JOutput_t out) const
62  {
63  for (typename JSuperFrame2D<JHit_t>::const_iterator frame = input.begin(); frame != input.end(); ++frame) {
64 
65  int n = frame->u_size();
66 
67  for (typename JSuperFrame2D<JHit_t>::value_type::const_iterator i = frame->begin(); n != 0; ++i, --n) {
68  *out = *i;
69  ++out;
70  }
71  }
72  }
73 
74 
75  /**
76  * Build hits from uncalibrated DAQ data.
77  *
78  * The time calibration is applied.
79  * Note that the output data are not time sorted.
80  *
81  * \param input DAQ super frame
82  * \param module module
83  * \param out output L0 data
84  */
85  template<class JOutput_t>
86  void operator()(const JDAQSuperFrame& input,
87  const JModule& module,
88  JOutput_t out) const
89  {
90  if (!input.empty()) {
91  (*this)(this->demultiplex(input, module), out);
92  }
93  }
94  };
95 
96 
97  /**
98  * Template specialisation of L0 builder for JHitL0 data type.
99  */
100  template<>
101  class JBuildL0<JHitL0> :
102  public JBuildHelper< JBuildL0<JHitL0> >,
103  public JBuild<JHit>
104  {
105  public:
106 
107  using JBuildHelper< JBuildL0<JHitL0> >::operator();
108 
110 
111 
112  /**
113  * Default constructor.
114  */
116  {}
117 
118 
119  /**
120  * Build hits from calibrated data.
121  *
122  * Note that the output data are not time sorted.
123  *
124  * \param input input L0 data
125  * \param out output L0 data
126  */
127  template<class JOutput_t>
128  void operator()(const JSuperFrame2D<JHit>& input, JOutput_t out) const
129  {
130  using namespace JPP;
131 
132  for (typename JSuperFrame2D<JHit>::const_iterator frame = input.begin(); frame != input.end(); ++frame) {
133 
134  const JDAQPMTIdentifier& id = frame->getPMTIdentifier();
135  const JAxis3D& axis = frame->getAxis();
136 
137  int n = frame->u_size();
138 
139  for (typename JSuperFrame2D<JHit>::value_type::const_iterator i = frame->begin(); n != 0; ++i, --n) {
140  *out = JHitL0(id, axis, *i);
141  ++out;
142  }
143  }
144  }
145 
146 
147  /**
148  * Build hits from uncalibrated DAQ data.
149  *
150  * The time calibration is applied.
151  * Note that the output data are not time sorted.
152  *
153  * \param input DAQ super frame
154  * \param module module
155  * \param out output L0 data
156  */
157  template<class JOutput_t>
158  void operator()(const JDAQSuperFrame& input,
159  const JModule& module,
160  JOutput_t out) const
161  {
162  if (!input.empty()) {
163  (*this)(this->demultiplex(input, module), out);
164  }
165  }
166  };
167 
168 
169  /**
170  * Template specialisation of L0 builder for JHitR0 data type.
171  */
172  template<>
173  class JBuildL0<JHitR0> :
174  public JBuildHelper< JBuildL0<JHitR0> >,
175  public JBuild<JHit>
176  {
177  public:
178 
179  using JBuildHelper< JBuildL0<JHitR0> >::operator();
180 
182 
183 
184  /**
185  * Default constructor.
186  */
188  {}
189 
190 
191  /**
192  * Build hits from calibrated data.
193  *
194  * Note that the output data are not time sorted.
195  *
196  * \param input input L0 data
197  * \param out output L0 data
198  */
199  template<class JOutput_t>
200  void operator()(const JSuperFrame2D<JHit>& input, JOutput_t out) const
201  {
202  using namespace JPP;
203 
204  for (typename JSuperFrame2D<JHit>::const_iterator frame = input.begin(); frame != input.end(); ++frame) {
205 
206  const JDAQPMTIdentifier& id = frame->getPMTIdentifier();
207 
208  int n = frame->u_size();
209 
210  for (typename JSuperFrame2D<JHit>::value_type::const_iterator i = frame->begin(); n != 0; ++i, --n) {
211  *out = JHitR0(id.getPMTAddress(), *i);
212  ++out;
213  }
214  }
215  }
216 
217 
218  /**
219  * Build hits from uncalibrated DAQ data.
220  *
221  * The time calibration is applied.
222  * Note that the output data are not time sorted.
223  *
224  * \param input DAQ super frame
225  * \param module module
226  * \param out output L0 data
227  */
228  template<class JOutput_t>
229  void operator()(const JDAQSuperFrame& input,
230  const JModule& module,
231  JOutput_t out) const
232  {
233  if (!input.empty()) {
234  (*this)(this->demultiplex(input, module), out);
235  }
236  }
237  };
238 }
239 
240 #endif
JModule.hh
JAANET::JHit_t
Auxiliary class to set-up Hit.
Definition: JHit_t.hh:25
JTRIGGER::JBuildL0< JHitR0 >::operator()
void operator()(const JSuperFrame2D< JHit > &input, JOutput_t out) const
Build hits from calibrated data.
Definition: JBuildL0.hh:200
JSuperFrame2D.hh
JGEOMETRY3D::JAxis3D
Axis object.
Definition: JAxis3D.hh:38
JTOOLS::n
const int n
Definition: JPolint.hh:628
JGEOMETRY3D::JAxis3D::getAxis
const JAxis3D & getAxis() const
Get axis.
Definition: JAxis3D.hh:109
JTRIGGER::JFrame::const_iterator
container_type::const_iterator const_iterator
Definition: JFrame.hh:45
KM3NETDAQ::JDAQFrame::empty
bool empty() const
Definition: JDAQFrame.hh:152
JTRIGGER::JBuild::demultiplex
JSuperFrame2D< JHit_t > & demultiplex(const JDAQSuperFrame &input, const JModule &module) const
Demultiplex and pre-process DAQ super frame.
Definition: JBuild.hh:66
JTRIGGER::JBuildL0< JHitR0 >::value_type
JHitR0 value_type
Definition: JBuildL0.hh:181
JTRIGGER::JSuperFrame2D::const_iterator
std::vector< value_type >::const_iterator const_iterator
Definition: JSuperFrame2D.hh:51
KM3NETDAQ::JDAQPMTIdentifier::getPMTIdentifier
const JDAQPMTIdentifier & getPMTIdentifier() const
Get PMT identifier.
Definition: JDAQPMTIdentifier.hh:56
JAxis3D.hh
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JTRIGGER::JBuildL0
Template L0 hit builder.
Definition: JBuildL0.hh:34
JTRIGGER::JHitR0
Reduced data structure for L0 hit.
Definition: JHitR0.hh:25
JHitToolkit.hh
JTRIGGER::JBuildL0< JHitL0 >::value_type
JHitL0 value_type
Definition: JBuildL0.hh:109
JHit.hh
JDETECTOR::JModule
Data structure for a composite optical module.
Definition: JModule.hh:49
JTRIGGER::JBuildL0::operator()
void operator()(const JDAQSuperFrame &input, const JModule &module, JOutput_t out) const
Build hits from uncalibrated DAQ data.
Definition: JBuildL0.hh:86
JTRIGGER::JBuildHelper
Auxiliary class to extend hit building functionality to all DAQ data types.
Definition: JBuildHelper.hh:44
JTRIGGER::JBuildL0< JHitR0 >::JBuildL0
JBuildL0()
Default constructor.
Definition: JBuildL0.hh:187
JBuild.hh
JTRIGGER::JBuild
Auxiliary base class for hit building.
Definition: JBuild.hh:31
KM3NETDAQ::JDAQPMTIdentifier
PMT identifier.
Definition: JDAQPMTIdentifier.hh:20
JTRIGGER::JHitL0
Data structure for L0 hit.
Definition: JHitL0.hh:27
JTRIGGER::JBuildL0::operator()
void operator()(const JSuperFrame2D< JHit_t > &input, JOutput_t out) const
Build hits from calibrated data.
Definition: JBuildL0.hh:61
JDAQSuperFrame.hh
KM3NETDAQ::JDAQSuperFrame
Data frame of one optical module.
Definition: JDAQSuperFrame.hh:22
JHitR0.hh
JTRIGGER::JBuildL0< JHitL0 >::JBuildL0
JBuildL0()
Default constructor.
Definition: JBuildL0.hh:115
JTRIGGER
Checksum.
Definition: JSupport/JSupport.hh:35
JHitL0.hh
JTRIGGER::JSuperFrame2D
2-dimensional frame with time calibrated data from one optical module.
Definition: JSuperFrame2D.hh:41
JTRIGGER::JBuildL0< JHitR0 >::operator()
void operator()(const JDAQSuperFrame &input, const JModule &module, JOutput_t out) const
Build hits from uncalibrated DAQ data.
Definition: JBuildL0.hh:229
JTRIGGER::JBuildL0< JHitL0 >::operator()
void operator()(const JSuperFrame2D< JHit > &input, JOutput_t out) const
Build hits from calibrated data.
Definition: JBuildL0.hh:128
JTRIGGER::JBuildL0< JHitL0 >::operator()
void operator()(const JDAQSuperFrame &input, const JModule &module, JOutput_t out) const
Build hits from uncalibrated DAQ data.
Definition: JBuildL0.hh:158
JTRIGGER::JBuildL0::value_type
JHit_t value_type
Definition: JBuildL0.hh:42
JTRIGGER::JBuildL0::JBuildL0
JBuildL0()
Default constructor.
Definition: JBuildL0.hh:48
JBuildHelper.hh