Jpp  18.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JTriggeredHit.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGEREDHIT__
2 #define __JTRIGGEREDHIT__
3 
4 #include <functional>
5 
8 #include "JTrigger/JHit.hh"
9 
10 
11 /**
12  * \author mdejong
13  */
14 
15 namespace JTRIGGER {}
16 namespace JPP { using namespace JTRIGGER; }
17 
18 namespace JTRIGGER {
19 
22 
23 
24  /**
25  * Data structure for triggered hit.
26  */
27  class JTriggeredHit :
28  public JDAQPMTIdentifier,
29  public JHit,
30  public JDAQTriggerMask
31  {
32  public:
33  /**
34  * Default constructor.
35  */
38  JHit (),
40  {}
41 
42 
43  /**
44  * Constructor.
45  *
46  * \param pmt PMT identifier
47  * \param hit hit
48  * \param mask trigger mask
49  */
51  const JHit& hit,
52  const JDAQTriggerMask& mask) :
53  JDAQPMTIdentifier(pmt),
54  JHit (hit),
55  JDAQTriggerMask (mask)
56  {}
57 
58 
59  /**
60  * Constructor.
61  *
62  * \param hit hit
63  * \param mask trigger mask
64  */
65  template<class JHit_t>
66  JTriggeredHit(const JHit_t& hit,
67  const JDAQTriggerMask& mask) :
69  JHit (hit.getHit()),
70  JDAQTriggerMask (mask)
71  {}
72  };
73 
74 
75  /**
76  * Less than operator for triggered hits.
77  *
78  * The less than operator is applied first to JTRIGGER::JHit and then to the KM3NETDAQ::JDAQPMTIdentifier.
79  * Hence, the ordering by JTRIGGER::JHit is maintained.
80  * This allows for the use of STL sort() and set_union() algorithms.
81  *
82  * \param first first hit
83  * \param second second hit
84  * \result true if first hit earlier or lower PMT identifier if equal; else false
85  */
86  inline bool operator<(const JTriggeredHit& first, const JTriggeredHit& second)
87  {
88  if (std::equal_to<JHit>()(first,second))
89  return std::less<JDAQPMTIdentifier>()(first,second);
90  else
91  return std::less<JHit> ()(first,second);
92  }
93 
94 
95  /**
96  * Equal operator for triggered hits.
97  *
98  * The equal operator is applied to JTRIGGER::JHit and to the KM3NETDAQ::JDAQPMTIdentifier.
99  *
100  * \param first first hit
101  * \param second second hit
102  * \result true if first hit equal second hit; else false
103  */
104  inline bool operator==(const JTriggeredHit& first, const JTriggeredHit& second)
105  {
106  return (std::equal_to<JDAQPMTIdentifier>()(first,second) &&
107  std::equal_to<JHit> ()(first,second));
108  }
109 }
110 
111 #endif
Data structure for triggered hit.
Auxiliary class for trigger mask.
const JDAQPMTIdentifier & getPMTIdentifier() const
Get PMT identifier.
bool operator<(const Head &first, const Head &second)
Less than operator.
Definition: JHead.hh:1799
Hit data structure.
Basic data structure for time and time over threshold information of hit.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
JTriggeredHit(const JHit_t &hit, const JDAQTriggerMask &mask)
Constructor.
JTriggeredHit()
Default constructor.
JTriggeredHit(const JDAQPMTIdentifier &pmt, const JHit &hit, const JDAQTriggerMask &mask)
Constructor.
bool operator==(Packet const &p, ID const &id)
const JHit & getHit() const
Get hit.
Auxiliary class to set-up Hit.
Definition: JSirene.hh:57