CMS 3D CMS Logo

GEMAMCStatus.h
Go to the documentation of this file.
1 #ifndef DataFormats_GEMDigi_GEMAMCStatus_h
2 #define DataFormats_GEMDigi_GEMAMCStatus_h
3 #include "AMC13Event.h"
4 #include "AMCdata.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 
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 = (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
operator<<
std::ostream & operator<<(std::ostream &out, const GEMAMCStatus &status)
Definition: GEMAMCStatus.h:68
GEMAMCStatus::warnings_
uint8_t warnings_
Definition: GEMAMCStatus.h:65
GEMAMCStatus::errors_
uint16_t errors_
Definition: GEMAMCStatus.h:64
mps_update.status
status
Definition: mps_update.py:68
GEMAMCStatus::Errors::badBC
uint16_t badBC
Definition: GEMAMCStatus.h:14
GEMAMCStatus::Errors::badCRC
uint16_t badCRC
Definition: GEMAMCStatus.h:17
GEMAMCStatus::Errors::ecodes
uint16_t ecodes
Definition: GEMAMCStatus.h:11
amc13
Definition: AMC13Spec.h:14
relativeConstraints.error
error
Definition: relativeConstraints.py:53
gem::AMC13Event
Definition: AMC13Event.h:69
GEMAMCStatus::amcNum_
uint8_t amcNum_
Definition: GEMAMCStatus.h:63
GEMAMCStatus::Warnings::wcodes
uint8_t wcodes
Definition: GEMAMCStatus.h:25
GEMAMCStatus::Errors
Definition: GEMAMCStatus.h:10
GEMAMCStatus::Warnings::backPressure
uint8_t backPressure
Definition: GEMAMCStatus.h:28
AMCdata.h
python.warn
def warn(*args, **kwargs)
Definition: __init__.py:21
GEMAMCStatus
Definition: GEMAMCStatus.h:8
gem::AMCdata
Definition: AMCdata.h:67
GEMAMCStatus::Errors::BC0locked
uint16_t BC0locked
Definition: GEMAMCStatus.h:21
GEMAMCStatus::inValidOH
void inValidOH()
Definition: GEMAMCStatus.h:51
GEMAMCStatus::Warnings::InValidOH
uint8_t InValidOH
Definition: GEMAMCStatus.h:27
GEMAMCStatus::Errors::badOC
uint16_t badOC
Definition: GEMAMCStatus.h:15
GEMAMCStatus::amcNumber
uint8_t amcNumber() const
Definition: GEMAMCStatus.h:57
GEMAMCStatus::Errors::MMCMlocked
uint16_t MMCMlocked
Definition: GEMAMCStatus.h:18
GEMAMCStatus::warnings
uint8_t warnings() const
Definition: GEMAMCStatus.h:60
GEMAMCStatus::Errors::DAQnotReday
uint16_t DAQnotReday
Definition: GEMAMCStatus.h:20
GEMAMCStatus::GEMAMCStatus
GEMAMCStatus()
Definition: GEMAMCStatus.h:32
amc
Definition: AMCSpec.h:8
AMC13Event.h
GEMAMCStatus::GEMAMCStatus
GEMAMCStatus(const gem::AMC13Event *amc13, const gem::AMCdata &amc)
Definition: GEMAMCStatus.h:33
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
GEMAMCStatus::Errors::badEC
uint16_t badEC
Definition: GEMAMCStatus.h:13
GEMAMCStatus::Warnings
Definition: GEMAMCStatus.h:24
GEMAMCStatus::Errors::DAQclocklocked
uint16_t DAQclocklocked
Definition: GEMAMCStatus.h:19
GEMAMCStatus::Errors::badRunType
uint16_t badRunType
Definition: GEMAMCStatus.h:16
GEMAMCStatus::isBad
bool isBad() const
Definition: GEMAMCStatus.h:58
GEMAMCStatus::errors
uint16_t errors() const
Definition: GEMAMCStatus.h:59