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  uint8_t missingVFAT : 1;
35  };
36  };
37 
40  Errors error{0};
41  error.EvtF = oh.evtF();
42  error.InF = oh.inF();
43  error.L1aF = (oh.l1aF() and (oh.version() == 0));
44  error.EvtSzOFW = oh.evtSzOFW();
45  error.Inv = oh.inv();
46  error.OOScAvV = oh.oOScAvV();
47  error.OOScVvV = oh.oOScVvV();
48  error.BxmAvV = oh.bxmAvV();
49  error.BxmVvV = oh.bxmVvV();
50  error.InUfw = oh.inUfw();
51  error.badVFatCount = oh.vfatWordCnt() != oh.vfatWordCntT();
52  errors_ = error.codes;
53 
54  Warnings warn{0};
55  existVFATs_ = oh.existVFATs();
56  vfatMask_ = oh.vfatMask();
57  zsMask_ = oh.zsMask();
58  missingVFATs_ = (existVFATs_ ^ 0xffffff) & (vfatMask_ & (zsMask_ ^ 0xffffff));
59  warn.EvtNF = oh.evtNF();
60  warn.InNF = oh.inNF();
61  warn.L1aNF = (oh.l1aNF() and (oh.version() == 0));
62  warn.EvtSzW = oh.evtSzW();
63  warn.missingVFAT = (oh.version() != 0) and (missingVFATs_ != 0);
64  warnings_ = warn.wcodes;
65  }
66 
67  void inValidVFAT() {
69  warn.InValidVFAT = 1;
70  warnings_ = warn.wcodes;
71  }
72 
73  bool isBad() const { return errors_ != 0; }
74  uint16_t errors() const { return errors_; }
75  uint8_t warnings() const { return warnings_; }
76  uint32_t missingVFATs() const { return missingVFATs_; }
77  uint32_t vfatMask() const { return vfatMask_; }
78  uint32_t zsMask() const { return zsMask_; }
79  uint32_t existVFATs() const { return existVFATs_; }
80 
81 private:
82  uint16_t errors_;
83  uint8_t warnings_;
84  uint32_t missingVFATs_;
85  uint32_t vfatMask_;
86  uint32_t zsMask_;
87  uint32_t existVFATs_;
88 };
89 
90 inline std::ostream& operator<<(std::ostream& out, const GEMOHStatus& status) {
91  out << "GEMOHStatus errors " << std::bitset<16>(status.errors()) << " warnings " << std::bitset<8>(status.warnings());
92  return out;
93 }
94 
95 #endif
uint8_t warnings() const
Definition: GEMOHStatus.h:75
bool l1aNF() const
std::ostream & operator<<(std::ostream &out, const GEMOHStatus &status)
Definition: GEMOHStatus.h:90
bool oOScVvV() const
uint16_t badVFatCount
Definition: GEMOHStatus.h:23
uint16_t vfatWordCntT() const
bool evtF() const
uint32_t zsMask() const
def warn(args, kwargs)
Definition: __init__.py:21
uint16_t vfatWordCnt() const
void inValidVFAT()
Definition: GEMOHStatus.h:67
uint8_t version() const
Definition: GEMOptoHybrid.h:80
bool bxmAvV() const
uint32_t existVFATs() const
Definition: GEMOHStatus.h:79
bool bxmVvV() const
uint32_t existVFATs() const
bool inUfw() const
uint32_t zsMask_
Definition: GEMOHStatus.h:86
uint32_t vfatMask() const
Definition: GEMOHStatus.h:77
bool evtNF() const
uint32_t vfatMask_
Definition: GEMOHStatus.h:85
uint16_t errors_
Definition: GEMOHStatus.h:82
bool oOScAvV() const
bool isBad() const
Definition: GEMOHStatus.h:73
bool evtSzW() const
bool inv() const
uint32_t missingVFATs_
Definition: GEMOHStatus.h:84
uint32_t existVFATs_
Definition: GEMOHStatus.h:87
bool inNF() const
GEMOHStatus(const GEMOptoHybrid &oh)
Definition: GEMOHStatus.h:39
uint32_t missingVFATs() const
Definition: GEMOHStatus.h:76
uint32_t vfatMask() const
uint16_t errors() const
Definition: GEMOHStatus.h:74
uint8_t warnings_
Definition: GEMOHStatus.h:83
bool inF() const
bool evtSzOFW() const
bool l1aF() const
uint32_t zsMask() const
Definition: GEMOHStatus.h:78