Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JDAQTriggeredHit.hh
Go to the documentation of this file.
1 #ifndef __JDAQTRIGGEREDHIT__
2 #define __JDAQTRIGGEREDHIT__
3 
4 #include "JIO/JSerialisable.hh"
5 #include "JDAQ/JDAQRoot.hh"
7 #include "JDAQ/JDAQHit.hh"
8 #include "JDAQ/JDAQKeyHit.hh"
10 
11 
12 /**
13  * \author mdejong
14  */
15 
16 namespace KM3NETDAQ {
17 
18  using JIO::JReader;
19  using JIO::JWriter;
20 
21 
22  /**
23  * DAQ triggered hit
24  */
26  public JDAQKeyHit,
27  public JDAQTriggerMask
28  {
29  public:
30 
31 
32  /**
33  * Default constructor.
34  */
36  JDAQKeyHit (),
38  {}
39 
40 
41  /**
42  * Constructor.
43  *
44  * \param ID module identifier
45  * \param hit PMT hit
46  * \param mask trigger mask
47  */
49  const JDAQHit& hit,
50  const JDAQTriggerMask& mask) :
51  JDAQKeyHit(ID,hit),
52  JDAQTriggerMask(mask)
53  {}
54 
55 
56  /**
57  * Virtual destructor.
58  */
60  {}
61 
62 
63  /**
64  * Read JDAQTriggeredHit from input.
65  *
66  * \param in JReader
67  * \param hit JDAQTriggeredHit
68  * \return JReader
69  */
70  friend inline JReader& operator>>(JReader& in, JDAQTriggeredHit& hit)
71  {
72  in >> static_cast<JDAQKeyHit&> (hit);
73  in >> static_cast<JDAQTriggerMask&>(hit);
74 
75  return in;
76  }
77 
78 
79  /**
80  * Write JDAQTriggeredHit to output.
81  *
82  * \param out JWriter
83  * \param hit JDAQTriggeredHit
84  * \return JWriter
85  */
86  friend inline JWriter& operator<<(JWriter& out, const JDAQTriggeredHit& hit)
87  {
88  out << static_cast<const JDAQKeyHit&> (hit);
89  out << static_cast<const JDAQTriggerMask&>(hit);
90 
91  return out;
92  }
93 
94 
95  /**
96  * Get size of object.
97  *
98  * \return number of bytes
99  */
100  static int sizeOf()
101  {
102  return (JDAQKeyHit ::sizeOf() +
104  }
105 
106 
108  };
109 
110 
111  /**
112  * Equal operator for DAQ triggered hits.
113  *
114  * \param first triggered hit
115  * \param second triggered hit
116  * \result true if first triggered hit equal to second; else false
117  */
118  inline bool operator==(const JDAQTriggeredHit& first,
119  const JDAQTriggeredHit& second)
120  {
121  return (static_cast<const JDAQKeyHit&> (first) == static_cast<const JDAQKeyHit&> (second) &&
122  static_cast<const JDAQTriggerMask&>(first) == static_cast<const JDAQTriggerMask&>(second));
123  }
124 
125 
126  /**
127  * Not-equal operator for DAQ triggered hits.
128  *
129  * \param first triggered hit
130  * \param second triggered hit
131  * \result true if first triggered hit not equal to second; else false
132  */
133  inline bool operator!=(const JDAQTriggeredHit& first,
134  const JDAQTriggeredHit& second)
135  {
136  return !(first == second);
137  }
138 }
139 
140 #endif
bool operator==(const JDAQChronometer &first, const JDAQChronometer &second)
Equal operator for DAQ chronometers.
DAQ key hit.
Definition: JDAQKeyHit.hh:24
Interface for binary output.
static int sizeOf()
Get size of object.
Auxiliary class for trigger mask.
friend JReader & operator>>(JReader &in, JDAQTriggeredHit &hit)
Read JDAQTriggeredHit from input.
JDAQTriggeredHit()
Default constructor.
friend JWriter & operator<<(JWriter &out, const JDAQTriggeredHit &hit)
Write JDAQTriggeredHit to output.
Hit data structure.
Definition: JDAQHit.hh:36
static int sizeOf()
Get size of object.
Definition: JDAQKeyHit.hh:108
ClassDef(JDAQTriggeredHit, 2)
Interface for binary input.
static int sizeOf()
Get size of object.
virtual ~JDAQTriggeredHit()
Virtual destructor.
bool operator!=(const JDAQChronometer &first, const JDAQChronometer &second)
Not-equal operator for DAQ chronometers.
JDAQTriggeredHit(const JDAQModuleIdentifier &ID, const JDAQHit &hit, const JDAQTriggerMask &mask)
Constructor.