Jpp  18.3.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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"
9 #include "JTrigger/JHitR1.hh"
10 #include "JTrigger/JBuildHelper.hh"
11 #include "JTrigger/JBuild.hh"
12 #include "JGeometry3D/JAxis3D.hh"
14 #include "JDetector/JModule.hh"
15 
16 
17 /**
18  * \author mdejong
19  */
20 
21 namespace JTRIGGER {}
22 namespace JPP { using namespace JTRIGGER; }
23 
24 namespace JTRIGGER {
25 
27  using JDETECTOR::JModule;
28 
29  /**
30  * Template L0 hit builder.
31  *
32  * An L0 hit is a hit from a PMT.
33  */
34  template<class JHit_t>
35  class JBuildL0 :
36  public JBuildHelper< JBuildL0<JHit_t> >,
37  public JBuild<JHit_t>
38  {
39  public:
40 
41  using JBuildHelper< JBuildL0<JHit_t> >::operator();
42 
43  typedef JHit_t value_type;
44 
45 
46  /**
47  * Default constructor.
48  */
50  {}
51 
52 
53  /**
54  * Build hits from calibrated data.
55  *
56  * Note that the output data are not time sorted.
57  *
58  * \param input input L0 data
59  * \param out output L0 data
60  */
61  template<class JOutput_t>
62  void operator()(const JSuperFrame2D<JHit_t>& input, JOutput_t out) const
63  {
64  for (typename JSuperFrame2D<JHit_t>::const_iterator frame = input.begin(); frame != input.end(); ++frame) {
65 
66  int n = frame->size();
67 
68  for (typename JSuperFrame2D<JHit_t>::value_type::const_iterator i = frame->begin(); n != 0; ++i, --n) {
69  *out = *i;
70  ++out;
71  }
72  }
73  }
74 
75 
76  /**
77  * Build hits from uncalibrated DAQ data.
78  *
79  * The time calibration is applied.
80  * Note that the output data are not time sorted.
81  *
82  * \param input DAQ super frame
83  * \param module module
84  * \param out output L0 data
85  */
86  template<class JOutput_t>
87  void operator()(const JDAQSuperFrame& input,
88  const JModule& module,
89  JOutput_t out) const
90  {
91  if (!input.empty()) {
92  (*this)(this->demultiplex(input, module), out);
93  }
94  }
95  };
96 
97 
98  /**
99  * Template specialisation of L0 builder for JHitL0 data type.
100  */
101  template<>
102  class JBuildL0<JHitL0> :
103  public JBuildHelper< JBuildL0<JHitL0> >,
104  public JBuild<JHit>
105  {
106  public:
107 
108  using JBuildHelper< JBuildL0<JHitL0> >::operator();
109 
111 
112 
113  /**
114  * Default constructor.
115  */
117  {}
118 
119 
120  /**
121  * Build hits from calibrated data.
122  *
123  * Note that the output data are not time sorted.
124  *
125  * \param input input L0 data
126  * \param out output L0 data
127  */
128  template<class JOutput_t>
129  void operator()(const JSuperFrame2D<JHit>& input, JOutput_t out) const
130  {
131  using namespace JPP;
132 
133  for (typename JSuperFrame2D<JHit>::const_iterator frame = input.begin(); frame != input.end(); ++frame) {
134 
135  const JDAQPMTIdentifier& id = frame->getPMTIdentifier();
136  const JAxis3D& axis = frame->getAxis();
137 
138  int n = frame->size();
139 
140  for (typename JSuperFrame2D<JHit>::value_type::const_iterator i = frame->begin(); n != 0; ++i, --n) {
141  *out = JHitL0(id, axis, *i);
142  ++out;
143  }
144  }
145  }
146 
147 
148  /**
149  * Build hits from uncalibrated DAQ data.
150  *
151  * The time calibration is applied.
152  * Note that the output data are not time sorted.
153  *
154  * \param input DAQ super frame
155  * \param module module
156  * \param out output L0 data
157  */
158  template<class JOutput_t>
159  void operator()(const JDAQSuperFrame& input,
160  const JModule& module,
161  JOutput_t out) const
162  {
163  if (!input.empty()) {
164  (*this)(this->demultiplex(input, module), out);
165  }
166  }
167  };
168 
169 
170  /**
171  * Template specialisation of L0 builder for JHitR0 data type.
172  */
173  template<>
174  class JBuildL0<JHitR0> :
175  public JBuildHelper< JBuildL0<JHitR0> >,
176  public JBuild<JHit>
177  {
178  public:
179 
180  using JBuildHelper< JBuildL0<JHitR0> >::operator();
181 
183 
184 
185  /**
186  * Default constructor.
187  */
189  {}
190 
191 
192  /**
193  * Build hits from calibrated data.
194  *
195  * Note that the output data are not time sorted.
196  *
197  * \param input input L0 data
198  * \param out output L0 data
199  */
200  template<class JOutput_t>
201  void operator()(const JSuperFrame2D<JHit>& input, JOutput_t out) const
202  {
203  using namespace JPP;
204 
205  for (typename JSuperFrame2D<JHit>::const_iterator frame = input.begin(); frame != input.end(); ++frame) {
206 
207  const JDAQPMTIdentifier& id = frame->getPMTIdentifier();
208 
209  int n = frame->size();
210 
211  for (typename JSuperFrame2D<JHit>::value_type::const_iterator i = frame->begin(); n != 0; ++i, --n) {
212  *out = JHitR0(id.getPMTAddress(), *i);
213  ++out;
214  }
215  }
216  }
217 
218 
219  /**
220  * Build hits from uncalibrated DAQ data.
221  *
222  * The time calibration is applied.
223  * Note that the output data are not time sorted.
224  *
225  * \param input DAQ super frame
226  * \param module module
227  * \param out output L0 data
228  */
229  template<class JOutput_t>
230  void operator()(const JDAQSuperFrame& input,
231  const JModule& module,
232  JOutput_t out) const
233  {
234  if (!input.empty()) {
235  (*this)(this->demultiplex(input, module), out);
236  }
237  }
238  };
239 
240 
241  /**
242  * Template specialisation of L0 builder for JHitR1 data type.
243  */
244  template<>
245  class JBuildL0<JHitR1> :
246  public JBuildHelper< JBuildL0<JHitR1> >,
247  public JBuild<JHit>
248  {
249  public:
250 
251  using JBuildHelper< JBuildL0<JHitR1> >::operator();
252 
254 
255 
256  /**
257  * Default constructor.
258  */
260  {}
261 
262 
263  /**
264  * Build hits from calibrated data.
265  *
266  * Note that the output data are not time sorted.
267  *
268  * \param input input L0 data
269  * \param out output L0 data
270  */
271  template<class JOutput_t>
272  void operator()(const JSuperFrame2D<JHit>& input, JOutput_t out) const
273  {
274  using namespace JPP;
275 
276  for (typename JSuperFrame2D<JHit>::const_iterator frame = input.begin(); frame != input.end(); ++frame) {
277 
278  const JDAQModuleIdentifier& id = frame->getModuleIdentifier();
279  const JPosition3D& pos = frame->getPosition();
280 
281  int n = frame->size();
282 
283  for (typename JSuperFrame2D<JHit>::value_type::const_iterator i = frame->begin(); n != 0; ++i, --n) {
284  *out = JHitR1(id, pos, *i);
285  ++out;
286  }
287  }
288  }
289 
290 
291  /**
292  * Build hits from uncalibrated DAQ data.
293  *
294  * The time calibration is applied.
295  * Note that the output data are not time sorted.
296  *
297  * \param input DAQ super frame
298  * \param module module
299  * \param out output L0 data
300  */
301  template<class JOutput_t>
302  void operator()(const JDAQSuperFrame& input,
303  const JModule& module,
304  JOutput_t out) const
305  {
306  if (!input.empty()) {
307  (*this)(this->demultiplex(input, module), out);
308  }
309  }
310  };
311 }
312 
313 #endif
void operator()(const JSuperFrame2D< JHit > &input, JOutput_t out) const
Build hits from calibrated data.
Definition: JBuildL0.hh:272
container_type::const_iterator const_iterator
Definition: JFrame.hh:46
bool empty() const
Definition: JDAQFrame.hh:181
Basic data structure for L0 hit.
void operator()(const JSuperFrame2D< JHit > &input, JOutput_t out) const
Build hits from calibrated data.
Definition: JBuildL0.hh:201
Data structure for a composite optical module.
Definition: JModule.hh:67
JBuildL0()
Default constructor.
Definition: JBuildL0.hh:116
Auxiliary base class for hit building.
Definition: JBuild.hh:36
const JDAQPMTIdentifier & getPMTIdentifier() const
Get PMT identifier.
JBuildL0()
Default constructor.
Definition: JBuildL0.hh:49
JBuildL0()
Default constructor.
Definition: JBuildL0.hh:188
Basic data structure for time and time over threshold information of hit.
Tools for handling different hit types.
void operator()(const JDAQSuperFrame &input, const JModule &module, JOutput_t out) const
Build hits from uncalibrated DAQ data.
Definition: JBuildL0.hh:87
Basic data structure for L0 hit.
Axis object.
Definition: JAxis3D.hh:38
const int n
Definition: JPolint.hh:786
Reduced data structure for L0 hit.
Definition: JHitR0.hh:25
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:130
JSuperFrame2D< JHit_t > & demultiplex(const JDAQSuperFrame &input, const JModule &module) const
Demultiplex and pre-process DAQ super frame.
Definition: JBuild.hh:103
void operator()(const JSuperFrame2D< JHit_t > &input, JOutput_t out) const
Build hits from calibrated data.
Definition: JBuildL0.hh:62
Reduced data structure for L1 hit.
void operator()(const JDAQSuperFrame &input, const JModule &module, JOutput_t out) const
Build hits from uncalibrated DAQ data.
Definition: JBuildL0.hh:159
Data structure for L0 hit.
Definition: JHitL0.hh:27
void operator()(const JDAQSuperFrame &input, const JModule &module, JOutput_t out) const
Build hits from uncalibrated DAQ data.
Definition: JBuildL0.hh:230
Auxiliary class to set-up Hit.
Definition: JSirene.hh:57
const JAxis3D & getAxis() const
Get axis.
Definition: JAxis3D.hh:98
void operator()(const JDAQSuperFrame &input, const JModule &module, JOutput_t out) const
Build hits from uncalibrated DAQ data.
Definition: JBuildL0.hh:302
Reduced data structure for L1 hit.
Definition: JHitR1.hh:31
2-dimensional frame with time calibrated data from one optical module.
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
std::vector< value_type >::const_iterator const_iterator
const JDAQModuleIdentifier & getModuleIdentifier() const
Get Module identifier.
Template L0 hit builder.
Definition: JBuildL0.hh:35
JBuildL0()
Default constructor.
Definition: JBuildL0.hh:259
Auxiliary class to extend hit building functionality to all DAQ data types.
Definition: JBuildHelper.hh:44
void operator()(const JSuperFrame2D< JHit > &input, JOutput_t out) const
Build hits from calibrated data.
Definition: JBuildL0.hh:129
Data frame of one optical module.
Data structure for optical module.