CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GEMVFATStatus.h
Go to the documentation of this file.
1 #ifndef DataFormats_GEMDigi_GEMVFATStatus_h
2 #define DataFormats_GEMDigi_GEMVFATStatus_h
3 #include "GEMAMC.h"
4 #include "GEMVFAT.h"
5 #include <bitset>
6 #include <ostream>
7 
8 class GEMVFATStatus {
9 public:
10  union Errors {
11  uint8_t codes;
12  struct {
13  uint8_t vc : 1; // VFAT CRC error
14  uint8_t InValidHeader : 1;
15  uint8_t EC : 1; // does not match AMC EC
16  uint8_t BC : 1; // does not match AMC BC
17  };
18  };
19  union Warnings {
20  uint8_t wcodes;
21  struct {
22  uint8_t basicOFW : 1; // Basic overflow warning
23  uint8_t zeroSupOFW : 1; // Zero-sup overflow warning
24  };
25  };
26 
28  GEMVFATStatus(const GEMAMC& amc, const GEMVFAT& vfat, uint16_t position, bool readMultiBX) {
29  Errors error{0};
30  Warnings warn{0};
31 
32  error.EC = vfat.ec() != amc.lv1Idt();
33  if (!readMultiBX)
34  error.BC = vfat.bc() != amc.bunchCrossing();
35 
36  if (vfat.version() > 2) {
37  error.vc = vfat.vc();
38  if (vfat.header() == 0x1E)
39  warn.basicOFW = 0;
40  else if (vfat.header() == 0x5E)
41  warn.basicOFW = 1;
42  else if (vfat.header() == 0x1A)
43  warn.zeroSupOFW = 0;
44  else if (vfat.header() == 0x56)
45  warn.zeroSupOFW = 1;
46  else
47  error.InValidHeader = 1;
48  }
50 
51  errors_ = error.codes;
52  warnings_ = warn.wcodes;
53  }
54 
55  uint16_t vfatPosition() const { return vfatPosition_; }
56  bool isBad() const { return errors_ != 0; }
57  uint16_t errors() const { return errors_; }
58  uint8_t warnings() const { return warnings_; }
59 
60 private:
61  uint16_t vfatPosition_;
62  uint16_t errors_;
63  uint8_t warnings_;
64 };
65 
66 inline std::ostream& operator<<(std::ostream& out, const GEMVFATStatus& status) {
67  out << "GEMVFATStatus errors " << std::bitset<8>(status.errors()) << " warnings "
68  << std::bitset<8>(status.warnings());
69  return out;
70 }
71 #endif
uint16_t vfatPosition() const
Definition: GEMVFATStatus.h:55
bool vc() const
Definition: GEMVFAT.h:101
uint16_t errors() const
Definition: GEMVFATStatus.h:57
uint8_t lv1Idt() const
Definition: GEMAMC.h:103
list status
Definition: mps_update.py:107
uint16_t errors_
Definition: GEMVFATStatus.h:62
uint8_t warnings_
Definition: GEMVFATStatus.h:63
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
GEMVFATStatus(const GEMAMC &amc, const GEMVFAT &vfat, uint16_t position, bool readMultiBX)
Definition: GEMVFATStatus.h:28
Definition: GEMVFAT.h:5
bool isBad() const
Definition: GEMVFATStatus.h:56
uint8_t ec() const
Definition: GEMVFAT.h:82
uint16_t vfatPosition_
Definition: GEMVFATStatus.h:61
double amc
Definition: hdecay.h:20
if(conf_.getParameter< bool >("UseStripCablingDB"))
uint8_t warnings() const
Definition: GEMVFATStatus.h:58
Definition: GEMAMC.h:6
static int position[264][3]
Definition: ReadPGInfo.cc:289
uint16_t bc() const
Definition: GEMVFAT.h:77
def warn
Definition: __init__.py:21
int version() const
Definition: GEMVFAT.h:94
uint8_t header() const
v3
Definition: GEMVFAT.h:100
uint16_t bunchCrossing() const
Definition: GEMAMC.h:91