CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GEMAMCStatus.h
Go to the documentation of this file.
1 #ifndef DataFormats_GEMDigi_GEMAMCStatus_h
2 #define DataFormats_GEMDigi_GEMAMCStatus_h
3 #include "GEMAMC13.h"
4 #include "GEMAMC.h"
5 #include <bitset>
6 #include <ostream>
7 
8 class GEMAMCStatus {
9 public:
10  union Errors {
11  uint16_t ecodes;
12  struct {
13  uint16_t badEC : 1; // event counter
14  uint16_t badBC : 1; // bunch crossing
15  uint16_t badOC : 1; // orbit number
16  uint16_t badRunType : 1;
17  uint16_t badCRC : 1;
18  uint16_t MMCMlocked : 1;
19  uint16_t DAQclocklocked : 1;
20  uint16_t DAQnotReday : 1;
21  uint16_t BC0locked : 1;
22  };
23  };
24  union Warnings {
25  uint8_t wcodes;
26  struct {
27  uint8_t InValidOH : 1;
28  uint8_t backPressure : 1;
29  };
30  };
31 
33  GEMAMCStatus(const GEMAMC13* amc13, const GEMAMC& amc) {
34  amcNum_ = amc.amcNum();
35  Errors error{0};
36  error.badEC = (amc13->lv1Id() != amc.lv1Id());
37  error.badBC = (amc13->bunchCrossing() != amc.bunchCrossing());
38  error.badRunType = amc.runType() != 0x1;
39  error.badOC = (uint16_t(amc13->orbitNumber()) != amc.orbitNumber());
40  error.MMCMlocked = !amc.mmcmLocked();
41  error.DAQclocklocked = !amc.daqClockLocked();
42  error.DAQnotReday = !amc.daqReady();
43  error.BC0locked = !amc.bc0locked();
44  errors_ = error.ecodes;
45 
46  Warnings warn{0};
47  warn.backPressure = amc.backPressure();
48  warnings_ = warn.wcodes;
49  }
50 
51  void inValidOH() {
53  warn.InValidOH = 1;
54  warnings_ = warn.wcodes;
55  }
56 
57  uint8_t amcNumber() const { return amcNum_; };
58  bool isBad() const { return errors_ != 0; }
59  uint16_t errors() const { return errors_; }
60  uint8_t warnings() const { return warnings_; }
61 
62 private:
63  uint8_t amcNum_;
64  uint16_t errors_;
65  uint8_t warnings_;
66 };
67 
68 inline std::ostream& operator<<(std::ostream& out, const GEMAMCStatus& status) {
69  out << "GEMAMCStatus errors " << std::bitset<16>(status.errors()) << " warnings "
70  << std::bitset<8>(status.warnings());
71  return out;
72 }
73 
74 #endif
uint8_t bc0locked() const
Definition: GEMAMC.h:111
uint8_t daqReady() const
Definition: GEMAMC.h:112
uint8_t warnings() const
Definition: GEMAMCStatus.h:60
void inValidOH()
Definition: GEMAMCStatus.h:51
bool isBad() const
Definition: GEMAMCStatus.h:58
list status
Definition: mps_update.py:107
uint32_t lv1Id() const
Definition: GEMAMC.h:92
uint8_t mmcmLocked() const
Definition: GEMAMC.h:114
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
uint8_t amcNum() const
Definition: GEMAMC.h:93
GEMAMCStatus(const GEMAMC13 *amc13, const GEMAMC &amc)
Definition: GEMAMCStatus.h:33
double amc
Definition: hdecay.h:20
uint16_t orbitNumber() const
Definition: GEMAMC.h:96
uint16_t errors() const
Definition: GEMAMCStatus.h:59
uint8_t runType() const
Definition: GEMAMC.h:100
uint8_t warnings_
Definition: GEMAMCStatus.h:65
uint16_t errors_
Definition: GEMAMCStatus.h:64
uint32_t orbitNumber() const
Definition: GEMAMC13.h:98
Definition: GEMAMC.h:6
uint8_t daqClockLocked() const
Definition: GEMAMC.h:113
uint32_t lv1Id() const
Definition: GEMAMC13.h:95
uint8_t amcNum_
Definition: GEMAMCStatus.h:63
uint8_t amcNumber() const
Definition: GEMAMCStatus.h:57
def warn
Definition: __init__.py:21
uint16_t bunchCrossing() const
Definition: GEMAMC13.h:94
uint16_t bunchCrossing() const
Definition: GEMAMC.h:91
uint8_t backPressure() const
Definition: GEMAMC.h:115