CMS 3D CMS Logo

HPTDCErrorFlags.h
Go to the documentation of this file.
1 #ifndef DataFormats_CTPPSDigi_HPTDCErrorFlags_h
2 #define DataFormats_CTPPSDigi_HPTDCErrorFlags_h
3 
4 #include <string>
5 
16 {
17  public:
18 
19  HPTDCErrorFlags( unsigned short flags=0 ) : error_flags( flags ) {}
20 
21  bool getErrorId( unsigned short id ) const {
22  switch (id) {
23  case 0: return getInternalFatalChipError();
24  case 1: return getEventLost();
25  case 2: return getHitRejectedByEventSizeLimit();
26  case 3: return getHitErrorGroup3();
27  case 4: return getHitLostL1OverflowGroup3();
28  case 5: return getHitLostROFifoOverflowGroup3();
29  case 6: return getHitErrorGroup2();
30  case 7: return getHitLostL1OverflowGroup2();
31  case 8: return getHitLostROFifoOverflowGroup2();
32  case 9: return getHitErrorGroup1();
33  case 10: return getHitLostL1OverflowGroup1();
34  case 11: return getHitLostROFifoOverflowGroup1();
35  case 12: return getHitErrorGroup0();
36  case 13: return getHitLostL1OverflowGroup0();
37  case 14: return getHitLostROFifoOverflowGroup0();
38  default: return true;
39  }
40  }
41 
42  bool getInternalFatalChipError() const { return error_flags & 0x1; }
43  bool getEventLost() const { return ( error_flags>> 1 ) & 0x1; }
44  bool getHitRejectedByEventSizeLimit() const { return ( error_flags>> 2 ) & 0x1; }
45  bool getHitErrorGroup3() const { return ( error_flags>> 3 ) & 0x1; }
46  bool getHitLostL1OverflowGroup3() const { return ( error_flags>> 4 ) & 0x1; }
47  bool getHitLostROFifoOverflowGroup3() const { return ( error_flags>> 5 ) & 0x1; }
48  bool getHitErrorGroup2() const { return ( error_flags>> 6 ) & 0x1; }
49  bool getHitLostL1OverflowGroup2() const { return ( error_flags>> 7 ) & 0x1; }
50  bool getHitLostROFifoOverflowGroup2() const { return ( error_flags>> 8 ) & 0x1; }
51  bool getHitErrorGroup1() const { return ( error_flags>> 9 ) & 0x1; }
52  bool getHitLostL1OverflowGroup1() const { return ( error_flags>>10 ) & 0x1; }
53  bool getHitLostROFifoOverflowGroup1() const { return ( error_flags>>11 ) & 0x1; }
54  bool getHitErrorGroup0() const { return ( error_flags>>12 ) & 0x1; }
55  bool getHitLostL1OverflowGroup0() const { return ( error_flags>>13 ) & 0x1; }
56  bool getHitLostROFifoOverflowGroup0() const { return ( error_flags>>14 ) & 0x1; }
57 
58  inline unsigned short getErrorFlag() const {
59  return error_flags;
60  }
61 
62  static std::string getHPTDCErrorName( const unsigned short id ) {
63  switch ( id ) {
64  case 0: return "InternalFatalChipError";
65  case 1: return "EventLost";
66  case 2: return "HitRejectedByEventSizeLimit";
67  case 3: return "HitErrorGroup3";
68  case 4: return "HitLostL1OverflowGroup3";
69  case 5: return "HitLostROFifoOverflowGroup3";
70  case 6: return "HitErrorGroup2";
71  case 7: return "HitLostL1OverflowGroup2";
72  case 8: return "HitLostROFifoOverflowGroup2";
73  case 9: return "HitErrorGroup1";
74  case 10: return "HitLostL1OverflowGroup1";
75  case 11: return "HitLostROFifoOverflowGroup1";
76  case 12: return "HitErrorGroup0";
77  case 13: return "HitLostL1OverflowGroup0";
78  case 14: return "HitLostROFifoOverflowGroup0";
79  default: return "NONE";
80  }
81  }
82 
83  private:
84  unsigned short error_flags;
85 };
86 
87 #endif
88 
bool getHitLostROFifoOverflowGroup3() const
unsigned short getErrorFlag() const
bool getHitLostL1OverflowGroup3() const
bool getInternalFatalChipError() const
bool getHitErrorGroup2() const
bool getErrorId(unsigned short id) const
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
bool getHitErrorGroup0() const
bool getEventLost() const
bool getHitLostROFifoOverflowGroup2() const
bool getHitLostL1OverflowGroup0() const
unsigned short error_flags
bool getHitLostROFifoOverflowGroup1() const
bool getHitLostL1OverflowGroup1() const
bool getHitLostROFifoOverflowGroup0() const
bool getHitLostL1OverflowGroup2() const
bool getHitErrorGroup3() const
static std::string getHPTDCErrorName(const unsigned short id)
bool getHitErrorGroup1() const
bool getHitRejectedByEventSizeLimit() const
HPTDCErrorFlags(unsigned short flags=0)