Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JDAQSummaryslice.hh
Go to the documentation of this file.
1#ifndef __JDAQSUMMARYSLICE__
2#define __JDAQSUMMARYSLICE__
3
4#include <ostream>
5#include <iomanip>
6#include <vector>
7
14
15
16/**
17 * \author mdejong
18 */
19
20namespace KM3NETDAQ {
21
22 /**
23 * Data summary slice.
24 */
26 public JDAQPreamble,
28 public std::vector<JDAQSummaryFrame>
29 {
30 public:
31
32 friend size_t getSizeof(const JDAQSummaryslice&);
35
36 /**
37 * Default constructor.
38 */
44
45
46 /**
47 * Constructor.
48 *
49 * \param chronometer DAQ chronometer
50 */
56
57
58 /**
59 * Constructor.
60 *
61 * \param timeslice time slice
62 */
63 JDAQSummaryslice(const JDAQTimeslice& timeslice) :
65 JDAQSummarysliceHeader(timeslice),
67 {
68 for (JDAQTimeslice::const_iterator i = timeslice.begin(); i != timeslice.end(); ++i) {
69 this->push_back(JDAQSummaryFrame(*i));
70 }
71 }
72
73
74 /**
75 * Virtual destructor.
76 */
78 {}
79
80
81 /**
82 * Print DAQ summary.
83 *
84 * \param out output stream
85 * \param lpr long print
86 * \return output stream
87 */
88 std::ostream& print(std::ostream& out, const bool lpr = false) const
89 {
90 using namespace std;
91
92 out << this->ClassName() << endl;
93 out << dynamic_cast<const JDAQPreamble&> (*this) << endl;
94 out << dynamic_cast<const JDAQChronometer&>(*this) << endl;
95
96 for (JDAQSummaryslice::const_iterator module = this->begin(); module != this->end(); ++module) {
97
98 out << ' ' << setw(10) << module->getModuleID();
99 out << ' ' << setw(8) << setfill('0') << hex << module->getStatus() << dec << setfill(' ');
100 out << '|' << setw(8) << setfill('0') << hex << module->getFIFOStatus() << dec << setfill(' ');
101 out << ' ' << setw(2) << module->getUDPNumberOfReceivedPackets();
102 out << ' ' << setw(2) << module->getUDPMaximalSequenceNumber();
103
104 if (lpr) {
105 for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
106 out << ' ' << fixed << showpoint << setw(4) << setprecision(1) << module->getRate(pmt) * 1.0e-3;
107 }
108 }
109
110 out << endl;
111 }
112
113 return out;
114 }
115
116
117 /**
118 * Action method at file open.
119 *
120 * \param version version
121 */
122 static void actionAtFileOpen(int version)
123 {
125 }
126
127
129 };
130
131
132 /**
133 * Print DAQ summary.
134 *
135 * \param out output stream
136 * \param summary summary
137 * \return output stream
138 */
139 inline std::ostream& operator<<(std::ostream& out, const KM3NETDAQ::JDAQSummaryslice& summary)
140 {
141 return summary.print(out, getDAQLongprint());
142 }
143
144
145 /**
146 * Equal operator for DAQ summary slices.
147 *
148 * \param first summary slice
149 * \param second summary slice
150 * \result true if first summary slice equal to second; else false
151 */
152 inline bool operator==(const JDAQSummaryslice& first,
153 const JDAQSummaryslice& second)
154 {
155 return (first.getDAQSummarysliceHeader() == second.getDAQSummarysliceHeader() &&
156 static_cast<const std::vector<JDAQSummaryFrame>&>(first) == static_cast<const std::vector<JDAQSummaryFrame>&>(second));
157 }
158
159
160 /**
161 * Not-equal operator for DAQ summary slices.
162 *
163 * \param first summary slice
164 * \param second summary slice
165 * \result true if first summary slice not equal to second; else false
166 */
167 inline bool operator!=(const JDAQSummaryslice& first,
168 const JDAQSummaryslice& second)
169 {
170 return !(first == second);
171 }
172}
173
174#endif
Interface for binary input.
Interface for binary output.
Data storage class for rate measurements of all PMTs in one module.
static int ROOT_IO_VERSION
Streamer version of JDAQSummaryslice as obtained from ROOT file.
const JDAQSummarysliceHeader & getDAQSummarysliceHeader() const
Get DAQ summary slice header.
friend JReader & operator>>(JReader &, JDAQSummaryslice &)
Read DAQ summary slice from input.
JDAQSummaryslice(const JDAQTimeslice &timeslice)
Constructor.
JDAQSummaryslice(const JDAQChronometer &chronometer)
Constructor.
friend size_t getSizeof(const JDAQSummaryslice &)
Get size of object.
virtual ~JDAQSummaryslice()
Virtual destructor.
ClassDef(JDAQSummaryslice, 6)
std::ostream & print(std::ostream &out, const bool lpr=false) const
Print DAQ summary.
static void actionAtFileOpen(int version)
Action method at file open.
friend JWriter & operator<<(JWriter &, const JDAQSummaryslice &)
Write DAQ summary slice to output.
JDAQSummaryslice()
Default constructor.
bool operator==(const Head &first, const Head &second)
Equal operator.
Definition JHead.hh:1801
bool operator!=(const JTag &first, const JTag &second)
Not equal operator for JTag.
Definition JTag.hh:291
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition JDAQ.hh:26
JWriter & operator<<(JWriter &out, const JDAQChronometer &chronometer)
Write DAQ chronometer to output.
bool & getDAQLongprint()
Get DAQ print option.
Definition JDAQPrint.hh:15
Auxiliary class for a DAQ type holder.