Belle II Software  release-08-01-10
PXDDAQPacketStatus.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/PXDDAQDHCStatus.h>
12 #include <pxd/dataobjects/PXDErrorFlags.h>
13 
14 namespace Belle2 {
21  using Belle2::PXD::PXDError::PXDErrorFlags;
22 
30  class PXDDAQPacketStatus final {
31  public:
32 
35 
39  explicit PXDDAQPacketStatus(unsigned short inx) : m_errorMask(0), m_critErrorMask(0), m_usable(true), m_index(inx) {}
40 
42  virtual ~PXDDAQPacketStatus() {};
43 
47  bool isUsable() const { return m_usable; }
48 
53  void setErrorMask(const PXDErrorFlags& mask) { m_errorMask = mask; }
54 
59  PXDErrorFlags getErrorMask(void) const { return m_errorMask; }
60 
64  void setCritErrorMask(const PXDErrorFlags& mask) { m_critErrorMask = mask; }
65 
69  PXDErrorFlags getCritErrorMask(void) const { return m_critErrorMask; }
70 
76  void Decide(void) {m_usable = (m_errorMask & m_critErrorMask) == PXDErrorFlags(0);}
77 
81  void setPktIndex(unsigned short inx) { m_index = inx;};
82 
86  unsigned short getPktIndex(void) const { return m_index;};
87 
91  void addDHC(PXDDAQDHCStatus& daqdhcstat) {m_pxdDHC.push_back(daqdhcstat);};
92 
97  template<class ...Args> PXDDAQDHCStatus& newDHC(Args&& ... params)
98  {
99  /*return*/ m_pxdDHC.emplace_back(std::forward<Args>(params)...);
100  return m_pxdDHC.back();
101  }
102 
104  std::vector<PXDDAQDHCStatus>::iterator begin() { return m_pxdDHC.begin(); };
106  std::vector<PXDDAQDHCStatus>::iterator end() { return m_pxdDHC.end(); };
107 
109  std::vector<PXDDAQDHCStatus>::const_iterator cbegin() const { return m_pxdDHC.cbegin(); };
111  std::vector<PXDDAQDHCStatus>::const_iterator cend() const { return m_pxdDHC.cend(); };
113  PXDDAQDHCStatus& dhc_back() { return m_pxdDHC.back(); };
115  size_t dhc_size() const { return m_pxdDHC.size(); };
116 
117  private:
118  PXDErrorFlags m_errorMask;
119  PXDErrorFlags m_critErrorMask;
120  bool m_usable;
122  unsigned short m_index;
125  std::vector <PXDDAQDHCStatus> m_pxdDHC;
126 
129 
130  }; // class PXDDAQPacketStatus
131 
133 } // end namespace Belle2
The PXD DAQ DHC Status class.
The PXD DAQ Packet Status class.
std::vector< PXDDAQDHCStatus > m_pxdDHC
Vector of DHC informations beloning to this event.
unsigned short m_index
Packet index as delivered by DAQ.
unsigned short getPktIndex(void) const
Return Packet index.
void setCritErrorMask(const PXDErrorFlags &mask)
Set Critical Error bit mask.
PXDDAQPacketStatus(unsigned short inx)
constructor setting the error mask and packet index.
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
PXDDAQDHCStatus & newDHC(Args &&... params)
Add new DHC information.
std::vector< PXDDAQDHCStatus >::iterator end()
iterator-based iteration for DHCs
PXDDAQPacketStatus()
Default constructor for the ROOT IO.
size_t dhc_size() const
Returns number of DHCs.
PXDErrorFlags getCritErrorMask(void) const
Return Critical Error bit mask.
PXDErrorFlags getErrorMask(void) const
Return Error bit mask This is the OR of error masks of all sub-objects (DHC, DHE)
std::vector< PXDDAQDHCStatus >::const_iterator cend() const
const iterator-based iteration for DHCs
PXDErrorFlags m_errorMask
errors found in this packets sensors
ClassDef(PXDDAQPacketStatus, 3)
necessary for ROOT
void setPktIndex(unsigned short inx)
Set Packet index.
virtual ~PXDDAQPacketStatus()
destructor
std::vector< PXDDAQDHCStatus >::const_iterator cbegin() const
const iterator-based iteration for DHCs
void Decide(void)
Calculate the usability decision If any of the critical bits is set in the error mask the PXD data fr...
std::vector< PXDDAQDHCStatus >::iterator begin()
iterator-based iteration for DHCs
PXDDAQDHCStatus & dhc_back()
Returns PXDDAQDHCStatus for last DHC.
bool isUsable() const
Return Usability of data.
void addDHC(PXDDAQDHCStatus &daqdhcstat)
Add DHC information including its DHE tree.
bool m_usable
data is useable.
Abstract base class for different kinds of events.