CMS 3D CMS Logo

AMCdata.h
Go to the documentation of this file.
1 #ifndef EventFilter_GEMRawToDigi_AMCdata_h
2 #define EventFilter_GEMRawToDigi_AMCdata_h
3 #include "GEBdata.h"
4 #include <vector>
5 
6 namespace gem {
7 
8  union AMCheader1 {
10  struct {
11  uint64_t dataLength : 20; // Always 0xfffff, use trailer dataLengthT
12  uint64_t bxID : 12; // Bunch crossing ID
13  uint64_t l1AID : 24; // L1A number – basically this is like event number, but reset by resync
14  uint64_t AMCnum : 4; // Slot number of the AMC
15  uint64_t reserved : 4; // not used
16  };
17  };
18  union AMCheader2 {
20  struct {
21  uint64_t boardID : 16; // 8bit long GLIB serial number
22  uint64_t orbitNum : 16; // Orbit number, Reset by EC0
23  uint64_t param3 : 8; // RunPar - Controlled by software, normally used only for calibrations
24  uint64_t param2 : 8; // RunPar - Controlled by software, normally used only for calibrations
25  uint64_t param1 : 8; // RunPar - Controlled by software, normally used only for calibrations
26  uint64_t runType : 4; // run types like physics, cosmics, threshold scan, latency scan, etc..
27  uint64_t formatVer : 4; // Current format version = 0x0
28  };
29  };
30  union AMCTrailer {
32  struct {
33  uint64_t dataLength : 20; // Number of 64bit words in this event
34  uint64_t l1AIDT : 12; // 8bit long GLIB serial number (first 8 bits)
35  uint64_t crc : 32; // CRC added by the AMC13
36  };
37  };
38  union EventHeader {
40  struct {
41  uint64_t ttsState : 4; // GLIB TTS state at the moment when this event was built.
42  uint64_t pType : 4; // Payload type: can be one refering to different zero suppression schemes
43  // in normal data taking or calibration type.
44  // Note in calibration type the entire GCT (GEM Chamber Trailer) is skipped
45  uint64_t pVer : 3; // Version of the payload type
46  uint64_t davCnt : 5; // Number of chamber blocks in this event
47  uint64_t buffState : 24; // Buffer status, Always 0 in current fw
48  uint64_t davList : 24; // Data Available list: a bitmask indicating which chambers have data in this event
49  };
50  };
51  union EventTrailer {
53  struct {
54  uint64_t BCL : 4; // 1st bit, BC0 locked - If 0, this is a bad condition indicating a
55  // problem in the clock or TTC command stream (critical condition)
56  uint64_t DR : 1; // DAQ Ready - If 0, this means that AMC13 is not ready to take data (critical condition)
57  uint64_t CL : 1; // DAQ clock locked- If 0, this indicates a problem in the DAQ clock (critical condition)
58  uint64_t ML : 1; // MMCM locked - Should always be 1
59  uint64_t BP : 1; // Backpressure - If this is 1, it means that we are receiving backpressure from AMC13
60  uint64_t oosGlib : 32; // GLIB is out‐of‐sync (critical): L1A ID is different for
61  // different chambers in this event (1 bit)
62  uint64_t linkTo : 24; // Link timeout flags (one bit for each link indicating timeout condition)
63  };
64  };
65 
66  class AMCdata {
67  public:
68  AMCdata() : amch1_(0), amch2_(0), amct_(0), eh_(0), et_(0){};
69  ~AMCdata() { gebd_.clear(); }
70 
71  void setAMCheader1(uint64_t word) { amch1_ = word; }
72  void setAMCheader1(uint32_t dataLength, uint16_t bxID, uint32_t l1AID, uint8_t AMCnum);
73  uint64_t getAMCheader1() const { return amch1_; }
74 
75  void setAMCheader2(uint64_t word) { amch2_ = word; }
76  void setAMCheader2(uint16_t boardID, uint16_t orbitNum, uint8_t runType);
77  uint64_t getAMCheader2() const { return amch2_; }
78 
79  void setAMCTrailer(uint64_t word) { amct_ = word; }
80  uint64_t getAMCTrailer() const { return amct_; }
81 
83  void setGEMeventHeader(uint8_t davCnt, uint32_t davList);
84  uint64_t getGEMeventHeader() const { return eh_; }
85 
87  uint64_t getGEMeventTrailer() const { return et_; }
88 
89  uint32_t dataLength() const { return AMCTrailer{amct_}.dataLength; }
90  uint16_t bx() const { return AMCheader1{amch1_}.bxID; }
91  uint32_t l1A() const { return AMCheader1{amch1_}.l1AID; }
92  uint8_t amcNum() const { return AMCheader1{amch1_}.AMCnum; }
93 
94  uint16_t boardId() const { return AMCheader2{amch2_}.boardID; }
95  uint16_t orbitNum() const { return AMCheader2{amch2_}.orbitNum; }
96  uint8_t param3() const { return AMCheader2{amch2_}.param3; }
97  uint8_t param2() const { return AMCheader2{amch2_}.param2; }
98  uint8_t param1() const { return AMCheader2{amch2_}.param1; }
99  uint8_t runType() const { return AMCheader2{amch2_}.runType; }
100  uint8_t formatVer() const { return AMCheader2{amch2_}.formatVer; }
101 
102  uint16_t ttsState() const { return EventHeader{eh_}.ttsState; }
103  uint8_t davCnt() const { return EventHeader{eh_}.davCnt; }
104  uint32_t buffState() const { return EventHeader{eh_}.buffState; }
105  uint32_t davList() const { return EventHeader{eh_}.davList; }
106 
107  uint8_t bc0locked() const { return EventTrailer{et_}.BCL; }
108  uint8_t daqReady() const { return EventTrailer{et_}.DR; }
109  uint8_t daqClockLocked() const { return EventTrailer{et_}.CL; }
110  uint8_t mmcmLocked() const { return EventTrailer{et_}.ML; }
111  uint8_t backPressure() const { return EventTrailer{et_}.BP; }
112  uint8_t oosGlib() const { return EventTrailer{et_}.oosGlib; }
113  uint32_t linkTo() const { return EventTrailer{et_}.linkTo; }
114 
116  void addGEB(GEBdata g) { gebd_.push_back(g); }
118  const std::vector<GEBdata>* gebs() const { return &gebd_; }
119 
120  private:
126 
127  std::vector<GEBdata> gebd_;
128  };
129 } // namespace gem
130 #endif
uint64_t getAMCTrailer() const
Definition: AMCdata.h:80
uint64_t bxID
Definition: AMCdata.h:12
uint64_t linkTo
Definition: AMCdata.h:62
const std::vector< GEBdata > * gebs() const
Returns a vector of GEB data.
Definition: AMCdata.h:118
uint8_t daqClockLocked() const
Definition: AMCdata.h:109
uint8_t amcNum() const
Definition: AMCdata.h:92
uint64_t word
Definition: AMCdata.h:52
uint64_t oosGlib
Definition: AMCdata.h:60
uint16_t orbitNum() const
Definition: AMCdata.h:95
uint64_t ML
Definition: AMCdata.h:58
uint8_t backPressure() const
Definition: AMCdata.h:111
uint32_t dataLength() const
Definition: AMCdata.h:89
uint64_t param1
Definition: AMCdata.h:25
uint64_t CL
Definition: AMCdata.h:57
uint64_t word
Definition: AMCdata.h:19
uint64_t davList
Definition: AMCdata.h:48
uint64_t amch2_
Definition: AMCdata.h:122
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
uint16_t boardId() const
Definition: AMCdata.h:94
uint64_t param2
Definition: AMCdata.h:24
uint8_t bc0locked() const
Definition: AMCdata.h:107
uint64_t dataLength
Definition: AMCdata.h:33
Definition: AMC13Event.h:6
uint64_t et_
Definition: AMCdata.h:125
uint16_t bx() const
Definition: AMCdata.h:90
uint8_t daqReady() const
Definition: AMCdata.h:108
uint64_t amct_
Definition: AMCdata.h:123
uint8_t runType() const
Definition: AMCdata.h:99
uint64_t word
void setAMCheader1(uint64_t word)
Definition: AMCdata.h:71
void setGEMeventHeader(uint64_t word)
Definition: AMCdata.h:82
uint64_t getGEMeventTrailer() const
Definition: AMCdata.h:87
uint8_t oosGlib() const
Definition: AMCdata.h:112
uint32_t l1A() const
Definition: AMCdata.h:91
uint8_t param2() const
Definition: AMCdata.h:97
uint64_t eh_
Definition: AMCdata.h:124
uint64_t amch1_
Definition: AMCdata.h:121
uint64_t dataLength
Definition: AMCdata.h:11
uint32_t davList() const
Definition: AMCdata.h:105
void setAMCTrailer(uint64_t word)
Definition: AMCdata.h:79
std::vector< GEBdata > gebd_
Vector of GEB data.
Definition: AMCdata.h:127
uint64_t buffState
Definition: AMCdata.h:47
uint64_t runType
Definition: AMCdata.h:26
uint64_t orbitNum
Definition: AMCdata.h:22
uint64_t getAMCheader2() const
Definition: AMCdata.h:77
uint8_t param3() const
Definition: AMCdata.h:96
uint32_t linkTo() const
Definition: AMCdata.h:113
unsigned long long uint64_t
Definition: Time.h:13
uint64_t DR
Definition: AMCdata.h:56
uint8_t param1() const
Definition: AMCdata.h:98
uint8_t davCnt() const
Definition: AMCdata.h:103
uint64_t BP
Definition: AMCdata.h:59
uint64_t davCnt
Definition: AMCdata.h:46
uint64_t word
Definition: AMCdata.h:9
uint64_t BCL
Definition: AMCdata.h:54
uint64_t reserved
Definition: AMCdata.h:15
uint16_t ttsState() const
Definition: AMCdata.h:102
uint32_t buffState() const
Definition: AMCdata.h:104
void setGEMeventTrailer(uint64_t word)
Definition: AMCdata.h:86
uint64_t ttsState
Definition: AMCdata.h:41
uint64_t boardID
Definition: AMCdata.h:21
uint8_t formatVer() const
Definition: AMCdata.h:100
uint64_t l1AID
Definition: AMCdata.h:13
uint8_t mmcmLocked() const
Definition: AMCdata.h:110
uint64_t getGEMeventHeader() const
Definition: AMCdata.h:84
void setAMCheader2(uint64_t word)
Definition: AMCdata.h:75
uint64_t word
Definition: AMCdata.h:39
uint64_t word
Definition: AMCdata.h:31
void addGEB(GEBdata g)
Adds GEB data to vector.
Definition: AMCdata.h:116
uint64_t param3
Definition: AMCdata.h:23
uint64_t AMCnum
Definition: AMCdata.h:14
uint64_t formatVer
Definition: AMCdata.h:27
uint64_t getAMCheader1() const
Definition: AMCdata.h:73