CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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();
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();
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
uint16_t badVFatCount
Definition: GEMOHStatus.h:23
bool l1aNF() const
Definition: GEMOptoHybrid.h:79
list status
Definition: mps_update.py:107
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
void inValidVFAT()
Definition: GEMOHStatus.h:61
bool evtF() const
Definition: GEMOptoHybrid.h:85
uint16_t errors() const
Definition: GEMOHStatus.h:68
bool oOScVvV() const
Definition: GEMOptoHybrid.h:75
bool isBad() const
Definition: GEMOHStatus.h:67
bool inF() const
Definition: GEMOptoHybrid.h:84
uint8_t warnings() const
Definition: GEMOHStatus.h:69
uint16_t errors_
Definition: GEMOHStatus.h:72
bool bxmVvV() const
Definition: GEMOptoHybrid.h:73
uint16_t vfatWordCnt() const
Definition: GEMOptoHybrid.h:69
GEMOHStatus(const GEMOptoHybrid &oh)
Definition: GEMOHStatus.h:38
uint16_t vfatWordCntT() const
Definition: GEMOptoHybrid.h:71
bool oOScAvV() const
Definition: GEMOptoHybrid.h:76
uint8_t warnings_
Definition: GEMOHStatus.h:73
bool bxmAvV() const
Definition: GEMOptoHybrid.h:74
bool inNF() const
Definition: GEMOptoHybrid.h:80
bool inUfw() const
Definition: GEMOptoHybrid.h:86
def warn
Definition: __init__.py:21
bool inv() const
Definition: GEMOptoHybrid.h:77
bool evtSzOFW() const
Definition: GEMOptoHybrid.h:82
bool evtNF() const
Definition: GEMOptoHybrid.h:81
bool evtSzW() const
Definition: GEMOptoHybrid.h:78
bool l1aF() const
Definition: GEMOptoHybrid.h:83