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 
72  void setAMCheader1(uint32_t dataLength, uint16_t bxID, uint32_t l1AID, uint8_t AMCnum);
73  uint64_t getAMCheader1() const { return amch1_; }
74 
76  void setAMCheader2(uint16_t boardID, uint16_t orbitNum, uint8_t runType);
77  uint64_t getAMCheader2() const { return amch2_; }
78 
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
gem::AMCheader1::AMCnum
uint64_t AMCnum
Definition: AMCdata.h:14
gem::AMCdata::setAMCheader2
void setAMCheader2(uint64_t word)
Definition: AMCdata.h:75
gem::AMCdata::ttsState
uint16_t ttsState() const
Definition: AMCdata.h:102
gem::AMCdata::dataLength
uint32_t dataLength() const
Definition: AMCdata.h:89
gem::EventTrailer::linkTo
uint64_t linkTo
Definition: AMCdata.h:62
gem::AMCheader2
Definition: AMCdata.h:18
gem::AMCdata::et_
uint64_t et_
Definition: AMCdata.h:125
gem::EventHeader::davCnt
uint64_t davCnt
Definition: AMCdata.h:46
gem::AMCdata::amct_
uint64_t amct_
Definition: AMCdata.h:123
gem::GEBdata
Definition: GEBdata.h:45
gem::AMCdata::orbitNum
uint16_t orbitNum() const
Definition: AMCdata.h:95
gem::EventTrailer
Definition: AMCdata.h:51
gem::AMCdata::davList
uint32_t davList() const
Definition: AMCdata.h:105
gem::AMCheader2::formatVer
uint64_t formatVer
Definition: AMCdata.h:27
gem::AMCheader2::param2
uint64_t param2
Definition: AMCdata.h:24
gem::AMCdata::bx
uint16_t bx() const
Definition: AMCdata.h:90
gem::EventHeader::buffState
uint64_t buffState
Definition: AMCdata.h:47
gem::AMCheader2::word
uint64_t word
Definition: AMCdata.h:19
gem::EventHeader::pType
uint64_t pType
Definition: AMCdata.h:42
gem::AMCdata::amcNum
uint8_t amcNum() const
Definition: AMCdata.h:92
gem::AMCheader1::bxID
uint64_t bxID
Definition: AMCdata.h:12
gem::EventHeader::pVer
uint64_t pVer
Definition: AMCdata.h:45
gem::EventHeader
Definition: AMCdata.h:38
gem::AMCTrailer::dataLength
uint64_t dataLength
Definition: AMCdata.h:33
gem::AMCdata::runType
uint8_t runType() const
Definition: AMCdata.h:99
gem::AMCdata::mmcmLocked
uint8_t mmcmLocked() const
Definition: AMCdata.h:110
gem::AMCdata::linkTo
uint32_t linkTo() const
Definition: AMCdata.h:113
gem::AMCdata::getGEMeventHeader
uint64_t getGEMeventHeader() const
Definition: AMCdata.h:84
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
gem::AMCdata::buffState
uint32_t buffState() const
Definition: AMCdata.h:104
gem::EventTrailer::BP
uint64_t BP
Definition: AMCdata.h:59
gem::AMCdata::eh_
uint64_t eh_
Definition: AMCdata.h:124
gem::AMCdata::gebs
const std::vector< GEBdata > * gebs() const
Returns a vector of GEB data.
Definition: AMCdata.h:118
gem::AMCdata::amch2_
uint64_t amch2_
Definition: AMCdata.h:122
gem::AMCheader2::param1
uint64_t param1
Definition: AMCdata.h:25
gem::AMCTrailer::l1AIDT
uint64_t l1AIDT
Definition: AMCdata.h:34
gem::AMCdata::getAMCTrailer
uint64_t getAMCTrailer() const
Definition: AMCdata.h:80
gem::AMCdata::setAMCTrailer
void setAMCTrailer(uint64_t word)
Definition: AMCdata.h:79
gem::AMCdata::setAMCheader1
void setAMCheader1(uint64_t word)
Definition: AMCdata.h:71
gem::AMCdata::setGEMeventHeader
void setGEMeventHeader(uint64_t word)
Definition: AMCdata.h:82
gem::AMCdata::formatVer
uint8_t formatVer() const
Definition: AMCdata.h:100
gem::AMCdata::davCnt
uint8_t davCnt() const
Definition: AMCdata.h:103
gem::AMCdata::oosGlib
uint8_t oosGlib() const
Definition: AMCdata.h:112
gem::AMCdata::param1
uint8_t param1() const
Definition: AMCdata.h:98
gem::AMCdata::getAMCheader2
uint64_t getAMCheader2() const
Definition: AMCdata.h:77
gem::AMCdata
Definition: AMCdata.h:66
gem::EventTrailer::BCL
uint64_t BCL
Definition: AMCdata.h:54
gem::EventHeader::ttsState
uint64_t ttsState
Definition: AMCdata.h:41
gem::AMCheader2::runType
uint64_t runType
Definition: AMCdata.h:26
gem::AMCdata::amch1_
uint64_t amch1_
Definition: AMCdata.h:121
gem::AMCheader1::word
uint64_t word
Definition: AMCdata.h:9
gem::EventTrailer::CL
uint64_t CL
Definition: AMCdata.h:57
gem::AMCheader1::reserved
uint64_t reserved
Definition: AMCdata.h:15
gem::AMCdata::l1A
uint32_t l1A() const
Definition: AMCdata.h:91
gem::AMCdata::backPressure
uint8_t backPressure() const
Definition: AMCdata.h:111
gem::AMCdata::daqClockLocked
uint8_t daqClockLocked() const
Definition: AMCdata.h:109
gem::AMCdata::gebd_
std::vector< GEBdata > gebd_
Vector of GEB data.
Definition: AMCdata.h:127
gem
Definition: AMC13Event.h:6
gem::AMCdata::AMCdata
AMCdata()
Definition: AMCdata.h:68
gem::AMCheader1::dataLength
uint64_t dataLength
Definition: AMCdata.h:11
gem::AMCdata::setGEMeventTrailer
void setGEMeventTrailer(uint64_t word)
Definition: AMCdata.h:86
gem::AMCheader2::orbitNum
uint64_t orbitNum
Definition: AMCdata.h:22
gem::EventTrailer::word
uint64_t word
Definition: AMCdata.h:52
gem::AMCdata::param3
uint8_t param3() const
Definition: AMCdata.h:96
gem::AMCdata::~AMCdata
~AMCdata()
Definition: AMCdata.h:69
GEBdata.h
gem::AMCTrailer::word
uint64_t word
Definition: AMCdata.h:31
gem::EventHeader::word
uint64_t word
Definition: AMCdata.h:39
gem::AMCdata::boardId
uint16_t boardId() const
Definition: AMCdata.h:94
gem::AMCTrailer::crc
uint64_t crc
Definition: AMCdata.h:35
gem::AMCheader1::l1AID
uint64_t l1AID
Definition: AMCdata.h:13
gem::AMCheader2::boardID
uint64_t boardID
Definition: AMCdata.h:21
gem::AMCdata::getAMCheader1
uint64_t getAMCheader1() const
Definition: AMCdata.h:73
gem::AMCdata::addGEB
void addGEB(GEBdata g)
Adds GEB data to vector.
Definition: AMCdata.h:116
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
gem::AMCheader1
Definition: AMCdata.h:8
gem::EventTrailer::oosGlib
uint64_t oosGlib
Definition: AMCdata.h:60
gem::AMCdata::param2
uint8_t param2() const
Definition: AMCdata.h:97
gem::AMCheader2::param3
uint64_t param3
Definition: AMCdata.h:23
gem::AMCTrailer
Definition: AMCdata.h:30
gem::EventTrailer::DR
uint64_t DR
Definition: AMCdata.h:56
gem::AMCdata::bc0locked
uint8_t bc0locked() const
Definition: AMCdata.h:107
gem::AMCdata::daqReady
uint8_t daqReady() const
Definition: AMCdata.h:108
gem::AMCdata::getGEMeventTrailer
uint64_t getGEMeventTrailer() const
Definition: AMCdata.h:87
g
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
gem::EventHeader::davList
uint64_t davList
Definition: AMCdata.h:48
gem::EventTrailer::ML
uint64_t ML
Definition: AMCdata.h:58