Jpp 20.0.0-27-g39925593c-D
the software that should make you happy
Loading...
Searching...
No Matches
JTrigger/JSummaryRouter.hh
Go to the documentation of this file.
1#ifndef __JTRIGGER__JSUMMARYSLICEROUTER__
2#define __JTRIGGER__JSUMMARYSLICEROUTER__
3
7#include "JTools/JRouter.hh"
8
9
10/**
11 * \author mdejong
12 */
13
14namespace JTRIGGER {}
15namespace JPP { using namespace JTRIGGER; }
16
17namespace JTRIGGER {
18
23
24
25 /**
26 * Router for fast addressing of summary data in JDAQSummaryslice data structure
27 * as a function of the optical module identifier.
28 *
29 * Note that this class derives from KM3NETDAQ::JSummaryslice
30 * which in turn derives from KM3NETDAQ::JDAQSummaryslice so that:
31 * - standard summary data can efficiently be updated via method JSummaryRouter::update; and
32 * - a posteriori corrected for use in simulations via method JSummaryslice::correct.
33 */
35 public JSummaryslice
36 {
37 public:
38 /**
39 * Default constructor.
40 */
42 router(-1) // default address
43 {}
44
45
46 /**
47 * Update router.
48 *
49 * \param ps pointer to new summary slice
50 */
51 void update(const JDAQSummaryslice* const ps)
52 {
53 if (ps != NULL) {
54
55 // reset internal router
56
57 for (iterator i = this->begin(); i != this->end(); ++i) {
58 router.put(i->getModuleID(), router.getDefaultAddress());
59 }
60
61 static_cast<JDAQSummaryslice&>(*this) = *ps;
62
63 // set internal router
64
65 for (iterator i = this->begin(); i != this->end(); ++i) {
66 router.put(i->getModuleID(), std::distance(this->begin(), i));
67 }
68 }
69 }
70
71
72 /**
73 * Get address of module.
74 *
75 * \param module module
76 * \return address
77 */
78 const int getAddress(const JDAQModuleIdentifier& module) const
79 {
80 return router.get(module.getModuleID());
81 }
82
83
84 /**
85 * Get summary frame.
86 *
87 * \param module module
88 * \return summary frame
89 */
91 {
92 return (*this)[getAddress(module)];
93 }
94
95
96 /**
97 * Has summary frame.
98 *
99 * \param module module
100 * \return true if module present; else false
101 */
103 {
104 return router.has(module.getModuleID());
105 }
106
107
108 private:
110 };
111}
112
113#endif
Auxiliaries for creation of summary data.
Template definition of a multi-dimensional oscillation probability interpolation table.
Direct addressing of elements with unique identifiers.
Definition JRouter.hh:27
Router for fast addressing of summary data in JDAQSummaryslice data structure as a function of the op...
bool hasSummaryFrame(const JDAQModuleIdentifier &module) const
Has summary frame.
void update(const JDAQSummaryslice *const ps)
Update router.
const int getAddress(const JDAQModuleIdentifier &module) const
Get address of module.
const JDAQSummaryFrame & getSummaryFrame(const JDAQModuleIdentifier &module) const
Get summary frame.
JSummaryRouter()
Default constructor.
Data storage class for rate measurements of all PMTs in one module.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for triggering.
Auxiliary class to create summary data.