Belle II Software  release-05-01-25
PXDDAQDHCStatus.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: bjoern.spruck@belle2.org *
7  * Created: Dez 2017 *
8  * *
9  * This software is provided "as is" without any warranty. *
10  **************************************************************************/
11 
12 #pragma once
13 
14 #include <pxd/dataobjects/PXDDAQDHEStatus.h>
15 #include <pxd/dataobjects/PXDErrorFlags.h>
16 
17 namespace Belle2 {
24  using Belle2::PXD::PXDError::PXDErrorFlags;
25 
26 
34  class PXDDAQDHCStatus {
35  public:
36 
39 
44  PXDDAQDHCStatus(int dhcid, PXDErrorFlags mask) : m_errorMask(mask),
45  m_critErrorMask(0), m_usable(true), m_dhcID(dhcid), m_rawCount(0), m_redCount(0), m_errorinfo(0) {}
46 
50  bool isUsable() const { return m_usable; }
51 
56  void setErrorMask(PXDErrorFlags m) { m_errorMask = m; }
57 
62  PXDErrorFlags getErrorMask(void) const { return m_errorMask; }
63 
67  void setCritErrorMask(PXDErrorFlags m) { m_critErrorMask = m; }
68 
72  PXDErrorFlags getCritErrorMask(void) const { return m_critErrorMask; }
73 
79  void Decide(void) {m_usable = (m_errorMask & m_critErrorMask) == 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(uint32_t e) { m_gated_mode = e;};
102  bool getGatedFlag(void) const { return m_gated_mode;};
104  void setGatedHER(uint32_t e) { m_gated_her = e;};
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
Belle2::PXDDAQDHCStatus::ClassDef
ClassDef(PXDDAQDHCStatus, 4)
necessary for ROOT
Belle2::PXDDAQDHCStatus::m_redCount
uint32_t m_redCount
reduced byte count for monitoring
Definition: PXDDAQDHCStatus.h:154
Belle2::PXDDAQDHCStatus::isUsable
bool isUsable() const
Return Usability of data.
Definition: PXDDAQDHCStatus.h:59
Belle2::PXDDAQDHCStatus::setGatedFlag
void setGatedFlag(uint32_t e)
set gating info from the DHC END
Definition: PXDDAQDHCStatus.h:109
Belle2::PXDDAQDHCStatus
The PXD DAQ DHC Status class.
Definition: PXDDAQDHCStatus.h:43
Belle2::PXDDAQDHCStatus::dhe_back
PXDDAQDHEStatus & dhe_back()
Returns PXDDAQDHEStatus for last DHE.
Definition: PXDDAQDHCStatus.h:143
Belle2::PXDDAQDHCStatus::setCritErrorMask
void setCritErrorMask(PXDErrorFlags m)
Set Critical Error bit mask.
Definition: PXDDAQDHCStatus.h:76
Belle2::PXDDAQDHCStatus::end
std::vector< PXDDAQDHEStatus >::iterator end()
iterator-based iteration for DHEs
Definition: PXDDAQDHCStatus.h:136
Belle2::PXDDAQDHCStatus::getEndErrorInfo
uint32_t getEndErrorInfo(void) const
get errorinfo from the DHC END
Definition: PXDDAQDHCStatus.h:106
Belle2::PXDDAQDHCStatus::m_gated_her
bool m_gated_her
gated info from the DHC START - true HER, 0 LER
Definition: PXDDAQDHCStatus.h:157
Belle2::PXDDAQDHCStatus::m_errorinfo
uint32_t m_errorinfo
errorinfo from the DHC END
Definition: PXDDAQDHCStatus.h:155
Belle2::PXDDAQDHCStatus::newDHE
PXDDAQDHEStatus & newDHE(Args &&... params)
Add new DHE information.
Definition: PXDDAQDHCStatus.h:127
Belle2::PXDDAQDHCStatus::cbegin
std::vector< PXDDAQDHEStatus >::const_iterator cbegin() const
const iterator-based iteration for DHEs
Definition: PXDDAQDHCStatus.h:139
Belle2::PXDDAQDHCStatus::getRedCnt
uint32_t getRedCnt(void) const
Set Reduced Data counter for reduction calculation.
Definition: PXDDAQDHCStatus.h:102
Belle2::PXDDAQDHCStatus::setEndErrorInfo
void setEndErrorInfo(uint32_t e)
set errorinfo from the DHC END
Definition: PXDDAQDHCStatus.h:104
Belle2::PXDDAQDHCStatus::getCounters
void getCounters(uint32_t &raw, uint32_t &red) const
Get Data counters for reduction calculation.
Definition: PXDDAQDHCStatus.h:98
Belle2::PXDDAQDHCStatus::getRawCnt
uint32_t getRawCnt(void) const
Set Raw Data counter for reduction calculation.
Definition: PXDDAQDHCStatus.h:100
Belle2::PXDDAQDHCStatus::cend
std::vector< PXDDAQDHEStatus >::const_iterator cend() const
const iterator-based iteration for DHEs
Definition: PXDDAQDHCStatus.h:141
Belle2::PXDDAQDHCStatus::m_gated_mode
bool m_gated_mode
gated info from the DHC START
Definition: PXDDAQDHCStatus.h:156
Belle2::PXDDAQDHCStatus::m_dhcID
unsigned short m_dhcID
DHC ID as delivered by DAQ.
Definition: PXDDAQDHCStatus.h:152
Belle2::PXDDAQDHCStatus::m_usable
bool m_usable
data is useable.
Definition: PXDDAQDHCStatus.h:150
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::PXDDAQDHCStatus::dhe_size
size_t dhe_size() const
Returns number of DHEs.
Definition: PXDDAQDHCStatus.h:145
Belle2::PXDDAQDHCStatus::m_critErrorMask
PXDErrorFlags m_critErrorMask
critical error mask
Definition: PXDDAQDHCStatus.h:149
Belle2::PXDDAQDHCStatus::Decide
void Decide(void)
Calculate the usability decision If any of the critical bits is set in the error mask the PXD data fr...
Definition: PXDDAQDHCStatus.h:88
Belle2::PXDDAQDHCStatus::addDHE
void addDHE(PXDDAQDHEStatus &daqdhe)
Add DHE information.
Definition: PXDDAQDHCStatus.h:121
Belle2::PXDDAQDHCStatus::m_errorMask
PXDErrorFlags m_errorMask
errors found in this DHC/sensor
Definition: PXDDAQDHCStatus.h:145
Belle2::PXDDAQDHCStatus::getCritErrorMask
PXDErrorFlags getCritErrorMask(void) const
Return Critical Error bit mask.
Definition: PXDDAQDHCStatus.h:81
Belle2::PXDDAQDHCStatus::setGatedHER
void setGatedHER(uint32_t e)
set HER/LER gating info from the DHC END
Definition: PXDDAQDHCStatus.h:113
Belle2::PXDDAQDHEStatus
The PXD DAQ DHE Status class.
Definition: PXDDAQDHEStatus.h:46
Belle2::PXDDAQDHCStatus::setErrorMask
void setErrorMask(PXDErrorFlags m)
Set Error bit mask This should be the OR of error masks of all sub-objects (DHC, DHE)
Definition: PXDDAQDHCStatus.h:65
Belle2::PXDDAQDHCStatus::PXDDAQDHCStatus
PXDDAQDHCStatus()
Default constructor for the ROOT IO.
Definition: PXDDAQDHCStatus.h:47
Belle2::PXDDAQDHCStatus::begin
std::vector< PXDDAQDHEStatus >::iterator begin()
iterator-based iteration for DHEs
Definition: PXDDAQDHCStatus.h:134
Belle2::PXDDAQDHCStatus::getGatedFlag
bool getGatedFlag(void) const
get gating info from the DHC END
Definition: PXDDAQDHCStatus.h:111
Belle2::PXDDAQDHCStatus::m_rawCount
uint32_t m_rawCount
raw byte count for monitoring
Definition: PXDDAQDHCStatus.h:153
Belle2::PXDDAQDHCStatus::getDHCID
unsigned short getDHCID(void) const
Get DHC ID.
Definition: PXDDAQDHCStatus.h:91
Belle2::PXDDAQDHCStatus::setDHCID
void setDHCID(int dhcid)
Set DHC ID.
Definition: PXDDAQDHCStatus.h:93
Belle2::PXDDAQDHCStatus::m_pxdDHE
std::vector< PXDDAQDHEStatus > m_pxdDHE
Vector of DHE informations belonging to this event.
Definition: PXDDAQDHCStatus.h:160
Belle2::PXDDAQDHCStatus::setCounters
void setCounters(uint32_t raw, uint32_t red)
Set Data counters for reduction calculation.
Definition: PXDDAQDHCStatus.h:96
Belle2::PXDDAQDHCStatus::getErrorMask
PXDErrorFlags getErrorMask(void) const
Return Error bit mask This is the OR of error masks of all sub-objects (DHC, DHE)
Definition: PXDDAQDHCStatus.h:71
Belle2::PXDDAQDHCStatus::getGatedHER
bool getGatedHER(void) const
get HER/LER gating info from the DHC END
Definition: PXDDAQDHCStatus.h:115