Jpp  18.4.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JCLBRunByRunSimulator.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGER__JCLBRUNBYRUNSIMULATOR__
2 #define __JTRIGGER__JCLBRUNBYRUNSIMULATOR__
3 
6 
10 
11 
12 /**
13  * \author mdejong
14  */
15 
16 namespace JTRIGGER {}
17 namespace JPP { using namespace JTRIGGER; }
18 
19 namespace JTRIGGER {
20 
24 
25 
26  /**
27  * CLB simulation based on run-by-run information.
28  *
29  * This class overwrites the method JCLBDefaultSimulator::getHighRateVeto.
30  * The actual high-rate veto is obtained from summary data.
31  */
34  {
35  public:
36  /**
37  * Constructor.
38  *
39  * \param router summary router
40  */
43  summary_router(router)
44  {}
45 
46 
47  /**
48  * Get number of received UDP packets.
49  *
50  * \param id module identifier
51  * \return number of received UDP packets
52  */
53  virtual int getUDPNumberOfReceivedPackets(const JModuleIdentifier& id) const override
54  {
55  using namespace KM3NETDAQ;
56 
57  if (summary_router.hasSummaryFrame(id.getID())) {
58 
59  const JDAQSummaryFrame& frame = summary_router.getSummaryFrame(id.getID());
60 
61  return frame.getUDPNumberOfReceivedPackets();
62  }
63 
64  return 1;
65  }
66 
67 
68  /**
69  * Get maximal sequence number of UDP packet.
70  *
71  * \param id module identifier
72  * \return maximal sequence number
73  */
74  virtual int getUDPMaximalSequenceNumber(const JModuleIdentifier& id) const override
75  {
76  using namespace KM3NETDAQ;
77 
78  if (summary_router.hasSummaryFrame(id.getID())) {
79 
80  const JDAQSummaryFrame& frame = summary_router.getSummaryFrame(id.getID());
81 
82  return frame.getUDPMaximalSequenceNumber();
83  }
84 
85  return 0;
86  }
87 
88 
89  /**
90  * Get UDP trailer status.
91  *
92  * \param id module identifier
93  * \return true
94  */
95  virtual bool hasUDPTrailer(const JModuleIdentifier& id) const override
96  {
97  using namespace KM3NETDAQ;
98 
99  if (summary_router.hasSummaryFrame(id.getID())) {
100 
101  const JDAQSummaryFrame& frame = summary_router.getSummaryFrame(id.getID());
102 
103  return frame.hasUDPTrailer();
104  }
105 
106  return false;
107  }
108 
109 
110  /**
111  * Get high-rate veto of given PMT.
112  *
113  * \param id PMT identifier
114  * \return true if high-rate veto; else false
115  */
116  virtual bool getHighRateVeto(const JPMTIdentifier& id) const override
117  {
118  using namespace KM3NETDAQ;
119 
120  if (summary_router.hasSummaryFrame(id.getModuleID())) {
121 
122  const JDAQSummaryFrame& frame = summary_router.getSummaryFrame(id.getModuleID());
123 
124  return !getPMTStatus(frame, JStatus(), id.getPMTAddress());
125  }
126 
127  return false;
128  }
129 
130 
131  protected:
133  };
134 }
135 
136 #endif
Router for fast addressing of summary data in JDAQSummaryslice data structure as a function of the op...
bool hasUDPTrailer() const
Get UDP trailer status.
virtual int getUDPMaximalSequenceNumber(const JModuleIdentifier &id) const override
Get maximal sequence number of UDP packet.
virtual bool hasUDPTrailer(const JModuleIdentifier &id) const override
Get UDP trailer status.
virtual int getUDPNumberOfReceivedPackets(const JModuleIdentifier &id) const override
Get number of received UDP packets.
int getUDPNumberOfReceivedPackets() const
Get number of received UDP packets.
JLANG::JObjectID JModuleIdentifier
int getUDPMaximalSequenceNumber() const
Get maximal sequence number of UDP packet.
CLB simulation based on run-by-run information.
Data storage class for rate measurements of all PMTs in one module.
Auxiliary class for handling status.
Definition: JStatus.hh:37
const JDAQSummaryFrame & getSummaryFrame(const JDAQModuleIdentifier &module) const
Get summary frame.
bool getPMTStatus(const JStatus &status)
Test status of PMT.
virtual bool getHighRateVeto(const JPMTIdentifier &id) const override
Get high-rate veto of given PMT.
bool hasSummaryFrame(const JDAQModuleIdentifier &module) const
Has summary frame.
JCLBRunByRunSimulator(const JSummaryRouter &router)
Constructor.