Jpp
JTriggerInput.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGER__JTRIGGERINPUT__
2 #define __JTRIGGER__JTRIGGERINPUT__
3 
4 #include <vector>
5 #include <algorithm>
6 
8 #include "JTrigger/JTimeslice.hh"
9 #include "JTrigger/JHitR1.hh"
10 #include "JTrigger/JHitToolkit.hh"
12 
13 
14 /**
15  * \author mdejong
16  */
17 
18 namespace JTRIGGER {}
19 namespace JPP { using namespace JTRIGGER; }
20 
21 namespace JTRIGGER {
22 
25 
26 
27  /**
28  * Data structure for input to trigger algorithm.
29  * The input data for the trigger are time ordered and contain an end marker.
30  * The member methods JTriggerInput::size() and JTriggerInput::end() refer to the position before the end marker.
31  */
32  class JTriggerInput :
33  public JDAQChronometer,
34  public std::vector<JHitR1>,
35  public JHitToolkit<JHit>
36  {
37  public:
38  /**
39  * Constructor.
40  *
41  * \param input input data
42  */
43  template<class JHit_t>
46  std::vector<JHitR1>()
47  {
48  int n = 0;
49 
50  for (typename JTimeslice<JHit_t>::const_iterator frame = input.begin(); frame != input.end(); ++frame) {
51  n += frame->size();
52  }
53 
54  this->resize(n + 1); // reserve space for end marker
55 
56  __end = this->begin();
57 
58  for (typename JTimeslice<JHit_t>::const_iterator frame = input.begin(); frame != input.end(); ++frame) {
59 
60  const JDAQModuleIdentifier& id = frame->getModuleID();
61  const JPosition3D& pos = frame->getPosition();
62 
63  for (typename JFrame<JHit_t>::const_iterator i = frame->begin(); i != frame->end(); ++i, ++__end) {
64  *__end = JHitR1(id, pos, getJHit(*i));
65  }
66  }
67 
68  *__end = JHitR1(JDAQPMTIdentifier(), JPosition3D(), getEndMarker());
69 
70  std::sort(this->begin(), this->end(), getToolkit());
71  }
72 
73 
74  const_iterator end() const { return __end; } //!< get iterator to end of data (without end marker)
75  iterator end() { return __end; } //!< get iterator to end of data (without end marker)
76 
77  int size() const { return std::distance(this->begin(), this->end()); } //!< get size of data (without end marker)
78  bool empty() const { return size() == 0; } //!< test emptyness (without end marker)
79 
80 
81  private:
83  };
84 }
85 
86 #endif
JTRIGGER::JHitToolkit
Template definition of hit toolkit.
Definition: JHitToolkit.hh:60
std::iterator
Definition: JSTDTypes.hh:18
JPosition3D.hh
JTRIGGER::JTriggerInput::__end
std::vector< JHitR1 >::iterator __end
Definition: JTriggerInput.hh:82
JTimeslice.hh
JTOOLS::n
const int n
Definition: JPolint.hh:628
std::vector
Definition: JSTDTypes.hh:12
JTRIGGER::JFrame::const_iterator
container_type::const_iterator const_iterator
Definition: JFrame.hh:45
KM3NETDAQ::JDAQModuleIdentifier::getModuleID
int getModuleID() const
Get module identifier.
Definition: JDAQModuleIdentifier.hh:72
distance
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Definition: PhysicsEvent.hh:434
JTRIGGER::JTriggerInput
Data structure for input to trigger algorithm.
Definition: JTriggerInput.hh:32
JDAQChronometer.hh
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JTRIGGER::JTriggerInput::empty
bool empty() const
test emptyness (without end marker)
Definition: JTriggerInput.hh:78
JGEOMETRY3D::JPosition3D
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JHitToolkit.hh
JTRIGGER::JTriggerInput::JTriggerInput
JTriggerInput(const JTimeslice< JHit_t > &input)
Constructor.
Definition: JTriggerInput.hh:44
JTRIGGER::JTimeslice
Time slice with calibrated data.
Definition: JTimeslice.hh:26
KM3NETDAQ::JDAQModuleIdentifier
Module identifier.
Definition: JDAQModuleIdentifier.hh:19
JTRIGGER::JTriggerInput::end
iterator end()
get iterator to end of data (without end marker)
Definition: JTriggerInput.hh:75
JHitR1.hh
JTRIGGER::JHitR1
Reduced data structure for L1 hit.
Definition: JHitR1.hh:31
JTRIGGER::JTimeslice::const_iterator
std::vector< value_type >::const_iterator const_iterator
Definition: JTimeslice.hh:34
KM3NETDAQ::JDAQPMTIdentifier
PMT identifier.
Definition: JDAQPMTIdentifier.hh:20
JGEOMETRY3D::JPosition3D::getPosition
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
KM3NETDAQ::JDAQChronometer::getDAQChronometer
const JDAQChronometer & getDAQChronometer() const
Get DAQ chronometer.
Definition: JDAQChronometer.hh:88
std
Definition: jaanetDictionary.h:36
JTRIGGER::JTriggerInput::end
const_iterator end() const
get iterator to end of data (without end marker)
Definition: JTriggerInput.hh:74
JTRIGGER
Checksum.
Definition: JSupport/JSupport.hh:35
JTRIGGER::JTriggerInput::size
int size() const
get size of data (without end marker)
Definition: JTriggerInput.hh:77
KM3NETDAQ::JDAQChronometer
DAQ chronometer.
Definition: JDAQChronometer.hh:21