CMS 3D CMS Logo

GEMVFATStatus.h
Go to the documentation of this file.
1 #ifndef DataFormats_GEMDigi_GEMVFATStatus_h
2 #define DataFormats_GEMDigi_GEMVFATStatus_h
3 #include "AMCdata.h"
4 #include "VFATdata.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 gem::AMCdata& amc, const gem::VFATdata& 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
GEMVFATStatus::Warnings::basicOFW
uint8_t basicOFW
Definition: GEMVFATStatus.h:22
GEMVFATStatus::Errors::InValidHeader
uint8_t InValidHeader
Definition: GEMVFATStatus.h:14
operator<<
std::ostream & operator<<(std::ostream &out, const GEMVFATStatus &status)
Definition: GEMVFATStatus.h:66
gem::VFATdata::vc
bool vc() const
Definition: VFATdata.h:103
GEMVFATStatus::Warnings
Definition: GEMVFATStatus.h:19
GEMVFATStatus::Errors::vc
uint8_t vc
Definition: GEMVFATStatus.h:13
GEMVFATStatus::vfatPosition_
uint16_t vfatPosition_
Definition: GEMVFATStatus.h:61
mps_update.status
status
Definition: mps_update.py:68
GEMVFATStatus
Definition: GEMVFATStatus.h:8
VFATdata.h
gem::VFATdata::version
int version() const
Definition: VFATdata.h:96
if
if(0==first)
Definition: CAHitNtupletGeneratorKernelsImpl.h:58
GEMVFATStatus::vfatPosition
uint16_t vfatPosition() const
Definition: GEMVFATStatus.h:55
relativeConstraints.error
error
Definition: relativeConstraints.py:53
gem::VFATdata::header
uint8_t header() const
v3
Definition: VFATdata.h:102
GEMVFATStatus::warnings
uint8_t warnings() const
Definition: GEMVFATStatus.h:58
GEMVFATStatus::Errors::EC
uint8_t EC
Definition: GEMVFATStatus.h:15
GEMVFATStatus::isBad
bool isBad() const
Definition: GEMVFATStatus.h:56
AMCdata.h
python.warn
def warn(*args, **kwargs)
Definition: __init__.py:21
gem::VFATdata::bc
uint16_t bc() const
Definition: VFATdata.h:79
GEMVFATStatus::Errors::codes
uint8_t codes
Definition: GEMVFATStatus.h:11
gem::AMCdata
Definition: AMCdata.h:67
muonGEMDigis_cfi.readMultiBX
readMultiBX
Definition: muonGEMDigis_cfi.py:11
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
GEMVFATStatus::Errors::BC
uint8_t BC
Definition: GEMVFATStatus.h:16
GEMVFATStatus::errors
uint16_t errors() const
Definition: GEMVFATStatus.h:57
gem::VFATdata
Definition: VFATdata.h:48
gem::VFATdata::ec
uint8_t ec() const
Definition: VFATdata.h:84
GEMVFATStatus::warnings_
uint8_t warnings_
Definition: GEMVFATStatus.h:63
GEMVFATStatus::GEMVFATStatus
GEMVFATStatus(const gem::AMCdata &amc, const gem::VFATdata &vfat, uint16_t position, bool readMultiBX)
Definition: GEMVFATStatus.h:28
GEMVFATStatus::Errors
Definition: GEMVFATStatus.h:10
amc
Definition: AMCSpec.h:8
GEMVFATStatus::GEMVFATStatus
GEMVFATStatus()
Definition: GEMVFATStatus.h:27
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
GEMVFATStatus::errors_
uint16_t errors_
Definition: GEMVFATStatus.h:62
GEMVFATStatus::Warnings::zeroSupOFW
uint8_t zeroSupOFW
Definition: GEMVFATStatus.h:23
GEMVFATStatus::Warnings::wcodes
uint8_t wcodes
Definition: GEMVFATStatus.h:20