Belle II Software development
PXDDAQDHCStatus.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <pxd/dataobjects/PXDDAQDHEStatus.h>
12#include <pxd/dataobjects/PXDErrorFlags.h>
13
14namespace Belle2 {
21 using Belle2::PXD::PXDError::PXDErrorFlags;
22
23
31 class PXDDAQDHCStatus final {
32 public:
33
36
41 explicit PXDDAQDHCStatus(int dhcid, PXDErrorFlags& mask) : m_errorMask(mask),
42 m_critErrorMask(0), m_usable(true), m_dhcID(dhcid), m_rawCount(0), m_redCount(0), m_errorinfo(0) {}
43
45 virtual ~PXDDAQDHCStatus() {};
46
50 bool isUsable() const { return m_usable; }
51
56 void setErrorMask(const PXDErrorFlags& mask) { m_errorMask = mask; }
57
62 PXDErrorFlags getErrorMask(void) const { return m_errorMask; }
63
67 void setCritErrorMask(const PXDErrorFlags& mask) { m_critErrorMask = mask; }
68
72 PXDErrorFlags getCritErrorMask(void) const { return m_critErrorMask; }
73
79 void Decide(void) {m_usable = (m_errorMask & m_critErrorMask) == PXDErrorFlags(0);}
80
82 unsigned short getDHCID(void) const { return m_dhcID;};
84 void setDHCID(int dhcid) {m_dhcID = dhcid;};
85
87 void setCounters(uint32_t raw, uint32_t red) {m_rawCount = raw; m_redCount = red;};
89 void getCounters(uint32_t& raw, uint32_t& red) const { raw = m_rawCount; red = m_redCount;};
91 uint32_t getRawCnt(void) const { return m_rawCount;};
93 uint32_t getRedCnt(void) const { return m_redCount;};
95 void setEndErrorInfo(uint32_t e) { m_errorinfo = e;};
97 uint32_t getEndErrorInfo(void) const { return m_errorinfo;};
98
100 void setGatedFlag(bool gm) { m_gated_mode = gm;};
102 bool getGatedFlag(void) const { return m_gated_mode;};
104 void setGatedHER(bool isher) { m_gated_her = isher;};
106 bool getGatedHER(void) const { return m_gated_her;};
107
108
112 void addDHE(PXDDAQDHEStatus& daqdhe) { m_pxdDHE.push_back(daqdhe);};
113
118 template<class ...Args> PXDDAQDHEStatus& newDHE(Args&& ... params)
119 {
120 /*return*/ m_pxdDHE.emplace_back(std::forward<Args>(params)...);
121 return m_pxdDHE.back();
122 }
123
125 std::vector<PXDDAQDHEStatus>::iterator begin() { return m_pxdDHE.begin(); };
127 std::vector<PXDDAQDHEStatus>::iterator end() { return m_pxdDHE.end(); };
128
130 std::vector<PXDDAQDHEStatus>::const_iterator cbegin() const { return m_pxdDHE.cbegin(); };
132 std::vector<PXDDAQDHEStatus>::const_iterator cend() const { return m_pxdDHE.cend(); };
134 PXDDAQDHEStatus& dhe_back() { return m_pxdDHE.back(); };
136 size_t dhe_size() const { return m_pxdDHE.size(); };
137
138 private:
139 PXDErrorFlags m_errorMask;
140 PXDErrorFlags m_critErrorMask;
141 bool m_usable;
143 unsigned short m_dhcID;
144 uint32_t m_rawCount;
145 uint32_t m_redCount;
146 uint32_t m_errorinfo;
147 bool m_gated_mode{false};
148 bool m_gated_her{false};
151 std::vector <PXDDAQDHEStatus> m_pxdDHE;
152
155
156 }; // class PXDDAQDHCStatus
157
159} // end namespace Belle2
The PXD DAQ DHC Status class.
virtual ~PXDDAQDHCStatus()
destructor
ClassDef(PXDDAQDHCStatus, 5)
necessary for ROOT
unsigned short getDHCID(void) const
Get DHC ID.
void setCritErrorMask(const PXDErrorFlags &mask)
Set Critical Error bit mask.
void setErrorMask(const PXDErrorFlags &mask)
Set Error bit mask This should be the OR of error masks of all sub-objects (DHC, DHE)
PXDErrorFlags m_critErrorMask
critical error mask
std::vector< PXDDAQDHEStatus >::iterator end()
iterator-based iteration for DHEs
uint32_t m_redCount
reduced byte count for monitoring
void setDHCID(int dhcid)
Set DHC ID.
std::vector< PXDDAQDHEStatus >::const_iterator cbegin() const
const iterator-based iteration for DHEs
PXDErrorFlags getCritErrorMask(void) const
Return Critical Error bit mask.
uint32_t getRawCnt(void) const
Set Raw Data counter for reduction calculation.
void setGatedFlag(bool gm)
set gating info from the DHC END
PXDErrorFlags getErrorMask(void) const
Return Error bit mask This is the OR of error masks of all sub-objects (DHC, DHE)
PXDErrorFlags m_errorMask
errors found in this DHC/sensor
std::vector< PXDDAQDHEStatus >::const_iterator cend() const
const iterator-based iteration for DHEs
std::vector< PXDDAQDHEStatus > m_pxdDHE
Vector of DHE informations belonging to this event.
void Decide(void)
Calculate the usability decision If any of the critical bits is set in the error mask the PXD data fr...
void addDHE(PXDDAQDHEStatus &daqdhe)
Add DHE information.
PXDDAQDHEStatus & newDHE(Args &&... params)
Add new DHE information.
uint32_t m_errorinfo
errorinfo from the DHC END
bool getGatedHER(void) const
get HER/LER gating info from the DHC END
bool m_gated_mode
gated info from the DHC START
bool m_gated_her
gated info from the DHC START - true HER, 0 LER
void setGatedHER(bool isher)
set HER/LER gating info from the DHC END
PXDDAQDHCStatus(int dhcid, PXDErrorFlags &mask)
constructor setting the error mask, dhcid, raw and reduced data counters
std::vector< PXDDAQDHEStatus >::iterator begin()
iterator-based iteration for DHEs
PXDDAQDHEStatus & dhe_back()
Returns PXDDAQDHEStatus for last DHE.
void setEndErrorInfo(uint32_t e)
set errorinfo from the DHC END
uint32_t m_rawCount
raw byte count for monitoring
size_t dhe_size() const
Returns number of DHEs.
unsigned short m_dhcID
DHC ID as delivered by DAQ.
uint32_t getRedCnt(void) const
Set Reduced Data counter for reduction calculation.
void getCounters(uint32_t &raw, uint32_t &red) const
Get Data counters for reduction calculation.
bool getGatedFlag(void) const
get gating info from the DHC END
PXDDAQDHCStatus()
Default constructor for the ROOT IO.
void setCounters(uint32_t raw, uint32_t red)
Set Data counters for reduction calculation.
bool isUsable() const
Return Usability of data.
uint32_t getEndErrorInfo(void) const
get errorinfo from the DHC END
bool m_usable
data is useable.
The PXD DAQ DHE Status class.
Abstract base class for different kinds of events.