Jpp  18.0.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
20 namespace 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&);
34  friend JWriter& operator<<(JWriter&, const JDAQSummaryslice&);
35 
36  /**
37  * Default constructor.
38  */
42  std::vector<JDAQSummaryFrame>()
43  {}
44 
45 
46  /**
47  * Constructor.
48  *
49  * \param chronometer DAQ chronometer
50  */
51  JDAQSummaryslice(const JDAQChronometer& chronometer) :
53  JDAQSummarysliceHeader(chronometer),
54  std::vector<JDAQSummaryFrame>()
55  {}
56 
57 
58  /**
59  * Constructor.
60  *
61  * \param timeslice time slice
62  */
63  JDAQSummaryslice(const JDAQTimeslice& timeslice) :
65  JDAQSummarysliceHeader(timeslice),
66  std::vector<JDAQSummaryFrame>()
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
JDAQSummaryslice()
Default constructor.
bool operator==(const JDAQChronometer &first, const JDAQChronometer &second)
Equal operator for DAQ chronometers.
Interface for binary output.
Auxiliary class for a DAQ type holder.
version
Definition: JEditTuneHV.sh:5
virtual ~JDAQSummaryslice()
Virtual destructor.
friend JWriter & operator<<(JWriter &, const JDAQSummaryslice &)
Write DAQ summary slice to output.
friend size_t getSizeof()
Definition of method to get size of data type.
JDAQSummaryslice(const JDAQTimeslice &timeslice)
Constructor.
static int ROOT_IO_VERSION
Streamer version of JDAQSummaryslice as obtained from ROOT file.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
static void actionAtFileOpen(int version)
Action method at file open.
ClassDef(JDAQSummaryslice, 6)
Data storage class for rate measurements of all PMTs in one module.
Data time slice.
std::ostream & print(std::ostream &out, const bool lpr=false) const
Print DAQ summary.
Interface for binary input.
const JDAQSummarysliceHeader & getDAQSummarysliceHeader() const
Get DAQ summary slice header.
JDAQSummaryslice(const JDAQChronometer &chronometer)
Constructor.
bool operator!=(const JDAQChronometer &first, const JDAQChronometer &second)
Not-equal operator for DAQ chronometers.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
bool & getDAQLongprint()
Get DAQ print option.
Definition: JDAQPrint.hh:15
friend JReader & operator>>(JReader &, JDAQSummaryslice &)
Read DAQ summary slice from input.