Belle II Software  release-08-01-10
PXDDAQStatus.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/PXDDAQPacketStatus.h>
12 #include <TObject.h>
13 #include <pxd/dataobjects/PXDErrorFlags.h>
14 
15 namespace Belle2 {
22  using Belle2::PXD::PXDError::PXDErrorFlags;
23 
33  class PXDDAQStatus : public TObject {
34  public:
35 
37  PXDDAQStatus() : m_errorMask(0), m_critErrorMask(0), m_usable(false), m_gated(false), m_unfiltered(false) {}
38 
42  explicit PXDDAQStatus(const PXDErrorFlags& mask) : m_errorMask(mask), m_critErrorMask(0), m_usable(false), m_gated(false),
43  m_unfiltered(false) {}
44 
46  virtual ~PXDDAQStatus() {};
47 
52  const PXDDAQDHEStatus* findDHE(const VxdID& id) const;
53 
57  bool isUsable() const { return m_usable; }
58 
62  void setUnfiltered(bool b) { m_unfiltered = b; }
63 
67  bool isUnfiltered() const { return m_unfiltered; }
68 
72  void setGated(bool b) { m_gated = b; }
73 
77  bool isGated() const { return m_gated; }
78 
83  void setErrorMask(const PXDErrorFlags& mask) { m_errorMask = mask; }
84 
89  void addErrorMask(const PXDErrorFlags& mask) { m_errorMask |= mask; }
90 
95  PXDErrorFlags getErrorMask(void) const { return m_errorMask; }
96 
100  void setCritErrorMask(const PXDErrorFlags& mask) { m_critErrorMask = mask; }
101 
105  PXDErrorFlags getCritErrorMask(void) const { return m_critErrorMask; }
106 
112  void Decide(void) {m_usable = (m_errorMask & m_critErrorMask) == PXDErrorFlags(0) && !m_gated;}
113 
117  void addPacket(PXDDAQPacketStatus& daqpktstat) {m_pxdPacket.push_back(daqpktstat);};
118 
123  template<class ...Args> PXDDAQPacketStatus& newPacket(Args&& ... params)
124  {
125  /*return*/ m_pxdPacket.emplace_back(std::forward<Args>(params)...);
126  return m_pxdPacket.back();
127  }
128 
132  std::map <VxdID, bool> getUsable() const;
133 
134 
136  std::vector<PXDDAQPacketStatus>::iterator begin() { return m_pxdPacket.begin(); };
138  std::vector<PXDDAQPacketStatus>::iterator end() { return m_pxdPacket.end(); };
139 
141  std::vector<PXDDAQPacketStatus>::const_iterator cbegin() const { return m_pxdPacket.cbegin(); };
143  std::vector<PXDDAQPacketStatus>::const_iterator cend() const { return m_pxdPacket.cend(); };
145  PXDDAQPacketStatus& pkt_back() { return m_pxdPacket.back(); };
147  size_t pkt_size() const { return m_pxdPacket.size(); };
148 
149  private:
150  PXDErrorFlags m_errorMask;
151  PXDErrorFlags m_critErrorMask;
153  bool m_usable;
154  bool m_gated;
158  std::vector <PXDDAQPacketStatus> m_pxdPacket;
159 
160  ClassDef(PXDDAQStatus, 3)
161 
162  }; // class PXDDAQStatus
163 
165 } // end namespace Belle2
The PXD DAQ DHE Status class.
The PXD DAQ Packet Status class.
The PXD DAQ Status class.
Definition: PXDDAQStatus.h:33
PXDDAQStatus(const PXDErrorFlags &mask)
constructor setting the error mask.
Definition: PXDDAQStatus.h:42
void addPacket(PXDDAQPacketStatus &daqpktstat)
Add Data packet information including its DHC/DHE tree.
Definition: PXDDAQStatus.h:117
void setCritErrorMask(const PXDErrorFlags &mask)
Set Critical Error bit mask.
Definition: PXDDAQStatus.h:100
PXDDAQStatus()
Default constructor for the ROOT IO.
Definition: PXDDAQStatus.h:37
void setErrorMask(const PXDErrorFlags &mask)
Set Error bit mask This should be the OR of error masks of all sub-objects (DHC, DHE)
Definition: PXDDAQStatus.h:83
PXDErrorFlags m_critErrorMask
critical error mask
Definition: PXDDAQStatus.h:151
bool isGated() const
Return if data was recorded while detector was gated.
Definition: PXDDAQStatus.h:77
size_t pkt_size() const
Returns number of packets in this event
Definition: PXDDAQStatus.h:147
void addErrorMask(const PXDErrorFlags &mask)
Add (OR) Error bit mask This should be the OR of error masks of all sub-objects (DHC,...
Definition: PXDDAQStatus.h:89
void setUnfiltered(bool b)
Set flag that data was recorded without ROI filtering.
Definition: PXDDAQStatus.h:62
std::vector< PXDDAQPacketStatus >::const_iterator cend() const
const iterator-based iteration for packets
Definition: PXDDAQStatus.h:143
PXDErrorFlags getCritErrorMask(void) const
Return Critical Error bit mask.
Definition: PXDDAQStatus.h:105
virtual ~PXDDAQStatus()
destructor
Definition: PXDDAQStatus.h:46
bool m_unfiltered
Data was not ROI filtered.
Definition: PXDDAQStatus.h:155
PXDDAQPacketStatus & newPacket(Args &&... params)
Add new Packet information.
Definition: PXDDAQStatus.h:123
std::vector< PXDDAQPacketStatus >::iterator begin()
iterator-based iteration for packets
Definition: PXDDAQStatus.h:136
std::vector< PXDDAQPacketStatus >::const_iterator cbegin() const
const iterator-based iteration for packets
Definition: PXDDAQStatus.h:141
void setGated(bool b)
Set flag that data was while detector was gated.
Definition: PXDDAQStatus.h:72
PXDErrorFlags getErrorMask(void) const
Return Error bit mask This is the OR of error masks of all sub-objects (DHC, DHE)
Definition: PXDDAQStatus.h:95
PXDErrorFlags m_errorMask
errors found in any packet/DHC/DHE
Definition: PXDDAQStatus.h:147
PXDDAQPacketStatus & pkt_back()
Returns PXDDAQPacketStatus for last packet in this event
Definition: PXDDAQStatus.h:145
std::vector< PXDDAQPacketStatus > m_pxdPacket
Vector of packet informations beloning to this event.
Definition: PXDDAQStatus.h:158
void Decide(void)
Calculate the usability decision If any of the critical bits is set in the error mask,...
Definition: PXDDAQStatus.h:112
std::vector< PXDDAQPacketStatus >::iterator end()
iterator-based iteration for packets
Definition: PXDDAQStatus.h:138
bool m_gated
Sensor was in gated mode.
Definition: PXDDAQStatus.h:154
std::map< VxdID, bool > getUsable() const
Return map of module usability.
Definition: PXDDAQStatus.cc:29
bool isUnfiltered() const
Return if data was recorded without ROI filtering.
Definition: PXDDAQStatus.h:67
const PXDDAQDHEStatus * findDHE(const VxdID &id) const
Return pointer to PXDDAQDHEStatus for the DHE connected to sensor with VxdID id If id not found,...
Definition: PXDDAQStatus.cc:15
bool isUsable() const
Return Usability of data.
Definition: PXDDAQStatus.h:57
bool m_usable
Data is useable.
Definition: PXDDAQStatus.h:153
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
Abstract base class for different kinds of events.