CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GEMOptoHybrid.h
Go to the documentation of this file.
1 #ifndef DataFormats_GEMDigi_GEMOptoHybrid_h
2 #define DataFormats_GEMDigi_GEMOptoHybrid_h
3 #include "GEMVFAT.h"
4 #include <vector>
5 
6 class GEMOptoHybrid {
7 public:
10  struct {
11  uint64_t : 10; // unused
12  uint64_t BxmVvV : 1; // 1st bit BX mismatch VFAT vs VFAT
13  uint64_t BxmAvV : 1; // BX mismatch AMC vs VFAT
14  uint64_t OOScVvV : 1; // Out of Sync (EC mismatch) VFAT vs VFAT
15  uint64_t OOScAvV : 1; // Out of Sync (EC mismatch) AMC vs VFAT
16  uint64_t Inv : 1; // Invalid event
17  uint64_t EvtSzW : 1; // Event size warning
18  uint64_t L1aNF : 1; // L1A FIFO near full
19  uint64_t InNF : 1; // Input FIFO near full
20  uint64_t EvtNF : 1; // Event FIFO near full
21  uint64_t EvtSzOFW : 1; // Event size overflow
22  uint64_t L1aF : 1; // L1A FIFO full
23  uint64_t InF : 1; // Input FIFO full
24  uint64_t EvtF : 1; // Event FIFO full
25  uint64_t VfWdCnt : 12; // VFAT word count (in number of 64-bit words)
26  uint64_t InputID : 5; // Input link ID
27  uint64_t CALIB_CHAN : 7; // Calibration channel number
28  uint64_t : 17; // unused
29  };
30  };
31 
34  struct {
35  uint64_t ecOH : 20; // NOT USED - OptoHybrid event counter
36  uint64_t bcOH : 13; // NOT USED - OptoHybrid bunch crossing
37  uint64_t InUfw : 1; // Input FIFO underflow
38  uint64_t SkD : 1; // NOT USED - Stuck data
39  uint64_t EvUfw : 1; // NOT USED - Event FIFO underflow
40  uint64_t VfWdCntT : 12; // VFAT word count (in number of 64-bit words)
41  uint64_t crc16 : 16; // CRC of OptoHybrid data (currently not available – filled with 0)
42  };
43  };
44 
45  GEMOptoHybrid() : ch_(0), ct_(0){};
46  ~GEMOptoHybrid() { vfatd_.clear(); }
47 
50  void setChamberHeader(uint16_t vfatWordCnt, uint8_t inputID) {
51  GEBchamberHeader u{0};
52  u.VfWdCnt = vfatWordCnt;
53  u.InputID = inputID;
54  ch_ = u.word;
55  }
56  uint64_t getChamberHeader() const { return ch_; }
57 
60  void setChamberTrailer(uint32_t ecOH, uint16_t bcOH, uint16_t vfatWordCntT) {
61  GEBchamberTrailer u{0};
62  u.ecOH = ecOH;
63  u.bcOH = bcOH;
64  u.VfWdCntT = vfatWordCntT;
65  ct_ = u.word;
66  }
67  uint64_t getChamberTrailer() const { return ct_; }
68 
69  uint16_t vfatWordCnt() const { return GEBchamberHeader{ch_}.VfWdCnt; }
70  uint8_t inputID() const { return GEBchamberHeader{ch_}.InputID; }
71  uint16_t vfatWordCntT() const { return GEBchamberTrailer{ct_}.VfWdCntT; }
72 
73  bool bxmVvV() const { return GEBchamberHeader{ch_}.BxmVvV; }
74  bool bxmAvV() const { return GEBchamberHeader{ch_}.BxmAvV; }
75  bool oOScVvV() const { return GEBchamberHeader{ch_}.OOScVvV; }
76  bool oOScAvV() const { return GEBchamberHeader{ch_}.OOScAvV; }
77  bool inv() const { return GEBchamberHeader{ch_}.Inv; }
78  bool evtSzW() const { return GEBchamberHeader{ch_}.EvtSzW; }
79  bool l1aNF() const { return GEBchamberHeader{ch_}.L1aNF; }
80  bool inNF() const { return GEBchamberHeader{ch_}.InNF; }
81  bool evtNF() const { return GEBchamberHeader{ch_}.EvtNF; }
82  bool evtSzOFW() const { return GEBchamberHeader{ch_}.EvtSzOFW; }
83  bool l1aF() const { return GEBchamberHeader{ch_}.L1aF; }
84  bool inF() const { return GEBchamberHeader{ch_}.InF; }
85  bool evtF() const { return GEBchamberHeader{ch_}.EvtF; }
86  bool inUfw() const { return GEBchamberTrailer{ct_}.InUfw; }
87 
88  bool noVFAT() const { return false; } // to be removed
89  bool stuckData() const { return false; } // to be removed
90  bool evUfw() const { return false; } // to be removed
91 
93  void addVFAT(GEMVFAT v) { vfatd_.push_back(v); }
95  const std::vector<GEMVFAT>* vFATs() const { return &vfatd_; }
97  void clearVFATs() { vfatd_.clear(); }
98 
99  static const int sizeGebID = 5;
100 
101 private:
102  uint64_t ch_; // GEBchamberHeader
103  uint64_t ct_; // GEBchamberTrailer
104 
105  std::vector<GEMVFAT> vfatd_;
106 };
107 #endif
uint8_t inputID() const
Definition: GEMOptoHybrid.h:70
void clearVFATs()
Clear the vector rof VFAT data.
Definition: GEMOptoHybrid.h:97
static const int sizeGebID
Definition: GEMOptoHybrid.h:99
void addVFAT(GEMVFAT v)
Adds VFAT data to the vector.
Definition: GEMOptoHybrid.h:93
bool l1aNF() const
Definition: GEMOptoHybrid.h:79
uint64_t getChamberHeader() const
Definition: GEMOptoHybrid.h:56
const std::vector< GEMVFAT > * vFATs() const
Returns the vector of VFAT data.
Definition: GEMOptoHybrid.h:95
std::vector< GEMVFAT > vfatd_
bool evtF() const
Definition: GEMOptoHybrid.h:85
bool evUfw() const
Definition: GEMOptoHybrid.h:90
uint64_t word
Definition: GEMVFAT.h:5
void setChamberTrailer(uint32_t ecOH, uint16_t bcOH, uint16_t vfatWordCntT)
Definition: GEMOptoHybrid.h:60
bool oOScVvV() const
Definition: GEMOptoHybrid.h:75
uint64_t getChamberTrailer() const
Definition: GEMOptoHybrid.h:67
bool stuckData() const
Definition: GEMOptoHybrid.h:89
void setChamberTrailer(uint64_t word)
Read chamberTrailer from the block.
Definition: GEMOptoHybrid.h:59
bool inF() const
Definition: GEMOptoHybrid.h:84
unsigned long long uint64_t
Definition: Time.h:13
void setChamberHeader(uint16_t vfatWordCnt, uint8_t inputID)
Definition: GEMOptoHybrid.h:50
bool bxmVvV() const
Definition: GEMOptoHybrid.h:73
uint16_t vfatWordCnt() const
Definition: GEMOptoHybrid.h:69
uint16_t vfatWordCntT() const
Definition: GEMOptoHybrid.h:71
bool oOScAvV() const
Definition: GEMOptoHybrid.h:76
bool bxmAvV() const
Definition: GEMOptoHybrid.h:74
bool inNF() const
Definition: GEMOptoHybrid.h:80
bool inUfw() const
Definition: GEMOptoHybrid.h:86
void setChamberHeader(uint64_t word)
Read chamberHeader from the block.
Definition: GEMOptoHybrid.h:49
bool inv() const
Definition: GEMOptoHybrid.h:77
bool evtSzOFW() const
Definition: GEMOptoHybrid.h:82
bool evtNF() const
Definition: GEMOptoHybrid.h:81
bool noVFAT() const
Definition: GEMOptoHybrid.h:88
bool evtSzW() const
Definition: GEMOptoHybrid.h:78
bool l1aF() const
Definition: GEMOptoHybrid.h:83