Jpp  16.0.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JDAQKeyHit.hh
Go to the documentation of this file.
1 #ifndef __JDAQKEYHIT__
2 #define __JDAQKEYHIT__
3 
8 
9 
10 /**
11  * \author mdejong
12  */
13 
14 namespace KM3NETDAQ {
15 
16  /**
17  * DAQ key hit
18  */
19  class JDAQKeyHit :
20  public JDAQModuleIdentifier,
21  public JDAQHit
22  {
23  public:
24 
25  friend size_t getSizeof<JDAQKeyHit>();
27  friend JWriter& operator<<(JWriter&, const JDAQKeyHit&);
28 
29  /**
30  * Default constructor.
31  */
34  JDAQHit()
35  {}
36 
37 
38  /**
39  * Constructor.
40  *
41  * \param id module identifier
42  * \param hit PMT hit
43  */
45  const JDAQHit& hit) :
47  JDAQHit(hit)
48  {}
49 
50 
51  /**
52  * Virtual destructor.
53  */
54  virtual ~JDAQKeyHit()
55  {}
56 
57 
58  /**
59  * Type conversion operator.
60  *
61  * \return axis
62  */
63  operator JDAQPMTIdentifier () const
64  {
65  return JDAQPMTIdentifier(this->getModuleID(), this->getPMT());
66  }
67 
68 
70  };
71 
72 
73 
74  /**
75  * Less than operator for DAQ hits.
76  *
77  * The less than operator is applied first to the module idientifier then to the PMT channel and then to the time of the hits.
78  *
79  * \param first hit
80  * \param second hit
81  * \result true if first hit before than second; else false
82  */
83  inline bool operator<(const JDAQKeyHit& first,
84  const JDAQKeyHit& second)
85  {
86  if (first.getModuleID() == second.getModuleID()) {
87  if (first.getPMT() == second.getPMT())
88  return first.getT() < second.getT();
89  else
90  return first.getPMT() < second.getPMT();
91  } else
92  return first.getModuleID() < second.getModuleID();
93  }
94 
95 
96 
97  /**
98  * Equal operator for DAQ hits.
99  *
100  * The equal operator is applied to the module idientifier, to the PMT channel and to the time of the hits.
101  *
102  * \param first hit
103  * \param second hit
104  * \result t rue if first hit equal to second; else false
105  */
106  inline bool operator==(const JDAQKeyHit& first,
107  const JDAQKeyHit& second)
108  {
109  return (first.getModuleID() == second.getModuleID() &&
110  first.getPMT() == second.getPMT() &&
111  first.getT() == second.getT());
112  }
113 
114 
115  /**
116  * Not-equal operator for DAQ hits.
117  *
118  * \param first hit
119  * \param second hit
120  * \result true if first hit not equal to second; else false
121  */
122  inline bool operator!=(const JDAQKeyHit& first,
123  const JDAQKeyHit& second)
124  {
125  return !(first == second);
126  }
127 }
128 
129 #endif
JDAQKeyHit()
Default constructor.
Definition: JDAQKeyHit.hh:32
bool operator==(const JDAQChronometer &first, const JDAQChronometer &second)
Equal operator for DAQ chronometers.
DAQ key hit.
Definition: JDAQKeyHit.hh:19
Interface for binary output.
int getModuleID() const
Get module identifier.
ClassDef(JDAQKeyHit, 1)
JDAQKeyHit(const JDAQModuleIdentifier &id, const JDAQHit &hit)
Constructor.
Definition: JDAQKeyHit.hh:44
JTDC_t getT() const
Get time.
Definition: JDAQHit.hh:86
JPMT_t getPMT() const
Get PMT.
Definition: JDAQHit.hh:75
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
Hit data structure.
Definition: JDAQHit.hh:34
Interface for binary input.
virtual ~JDAQKeyHit()
Virtual destructor.
Definition: JDAQKeyHit.hh:54
friend JReader & operator>>(JReader &, JDAQKeyHit &)
Read JDAQKeyHit from input.
Definition: JDAQKeyHitIO.hh:36
friend JWriter & operator<<(JWriter &, const JDAQKeyHit &)
Write JDAQKeyHit to output.
Definition: JDAQKeyHitIO.hh:52
bool operator!=(const JDAQChronometer &first, const JDAQChronometer &second)
Not-equal operator for DAQ chronometers.
bool operator<(const JDAQHit &first, const JDAQHit &second)
Less than operator for DAQ hits.
Definition: JDAQHit.hh:174
size_t getSizeof< JDAQKeyHit >()
Get size of type.
Definition: JDAQKeyHitIO.hh:22