CMS 3D CMS Logo

GEMOHStatus.h
Go to the documentation of this file.
1 #ifndef DataFormats_GEMDigi_GEMOHStatus_h
2 #define DataFormats_GEMDigi_GEMOHStatus_h
3 #include "GEMOptoHybrid.h"
4 #include <bitset>
5 #include <ostream>
6 
7 // GEM OptoHybrid status
8 class GEMOHStatus {
9 public:
10  union Errors {
11  uint16_t codes;
12  struct {
13  uint16_t EvtF : 1; // Event FIFO full
14  uint16_t InF : 1; // Input FIFO full
15  uint16_t L1aF : 1; // L1A FIFO full
16  uint16_t EvtSzOFW : 1; // Event size overflow
17  uint16_t Inv : 1; // Invalid event
18  uint16_t OOScAvV : 1; // Out of Sync (EC mismatch) AMC vs VFAT
19  uint16_t OOScVvV : 1; // Out of Sync (EC mismatch) VFAT vs VFAT
20  uint16_t BxmAvV : 1; // BX mismatch AMC vs VFAT
21  uint16_t BxmVvV : 1; // 1st bit BX mismatch VFAT vs VFAT
22  uint16_t InUfw : 1; // Input FIFO underflow
23  uint16_t badVFatCount : 1;
24  };
25  };
26  union Warnings {
27  uint8_t wcodes;
28  struct {
29  uint8_t EvtNF : 1; // Event FIFO near full
30  uint8_t InNF : 1; // Input FIFO near full
31  uint8_t L1aNF : 1; // L1A FIFO near full
32  uint8_t EvtSzW : 1; // Event size warning
33  uint8_t InValidVFAT : 1;
34  };
35  };
36 
39  Errors error{0};
40  error.EvtF = oh.evtF();
41  error.InF = oh.inF();
42  error.L1aF = (oh.l1aF() and (oh.version() == 0));
43  error.EvtSzOFW = oh.evtSzOFW();
44  error.Inv = oh.inv();
45  error.OOScAvV = oh.oOScAvV();
46  error.OOScVvV = oh.oOScVvV();
47  error.BxmAvV = oh.bxmAvV();
48  error.BxmVvV = oh.bxmVvV();
49  error.InUfw = oh.inUfw();
50  error.badVFatCount = oh.vfatWordCnt() != oh.vfatWordCntT();
51  errors_ = error.codes;
52 
53  Warnings warn{0};
54  warn.EvtNF = oh.evtNF();
55  warn.InNF = oh.inNF();
56  warn.L1aNF = (oh.l1aNF() and (oh.version() == 0));
57  warn.EvtSzW = oh.evtSzW();
58  warnings_ = warn.wcodes;
59  }
60 
61  void inValidVFAT() {
63  warn.InValidVFAT = 1;
64  warnings_ = warn.wcodes;
65  }
66 
67  bool isBad() const { return errors_ != 0; }
68  uint16_t errors() const { return errors_; }
69  uint8_t warnings() const { return warnings_; }
70 
71 private:
72  uint16_t errors_;
73  uint8_t warnings_;
74 };
75 
76 inline std::ostream& operator<<(std::ostream& out, const GEMOHStatus& status) {
77  out << "GEMOHStatus errors " << std::bitset<16>(status.errors()) << " warnings " << std::bitset<8>(status.warnings());
78  return out;
79 }
80 
81 #endif
uint8_t warnings() const
Definition: GEMOHStatus.h:69
bool l1aNF() const
std::ostream & operator<<(std::ostream &out, const GEMOHStatus &status)
Definition: GEMOHStatus.h:76
bool oOScVvV() const
uint16_t badVFatCount
Definition: GEMOHStatus.h:23
uint16_t vfatWordCntT() const
bool evtF() const
def warn(args, kwargs)
Definition: __init__.py:21
uint16_t vfatWordCnt() const
void inValidVFAT()
Definition: GEMOHStatus.h:61
uint8_t version() const
Definition: GEMOptoHybrid.h:80
bool bxmAvV() const
bool bxmVvV() const
bool inUfw() const
bool evtNF() const
uint16_t errors_
Definition: GEMOHStatus.h:72
bool oOScAvV() const
bool isBad() const
Definition: GEMOHStatus.h:67
bool evtSzW() const
bool inv() const
bool inNF() const
GEMOHStatus(const GEMOptoHybrid &oh)
Definition: GEMOHStatus.h:38
uint16_t errors() const
Definition: GEMOHStatus.h:68
uint8_t warnings_
Definition: GEMOHStatus.h:73
bool inF() const
bool evtSzOFW() const
bool l1aF() const