CMS 3D CMS Logo

AMCdata.h
Go to the documentation of this file.
1 #ifndef DataFormats_GEMDigi_AMCdata_h
2 #define DataFormats_GEMDigi_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 : 4;
35  uint64_t l1AID : 8; // L1A number (first 8 bits)
36  uint64_t crc : 32; // CRC added by the AMC13
37  };
38  };
39  union EventHeader {
41  struct {
42  uint64_t ttsState : 4; // GLIB TTS state at the moment when this event was built.
43  uint64_t pType : 4; // Payload type: can be one refering to different zero suppression schemes
44  // in normal data taking or calibration type.
45  // Note in calibration type the entire GCT (GEM Chamber Trailer) is skipped
46  uint64_t pVer : 3; // Version of the payload type
47  uint64_t davCnt : 5; // Number of chamber blocks in this event
48  uint64_t buffState : 24; // Buffer status, Always 0 in current fw
49  uint64_t davList : 24; // Data Available list: a bitmask indicating which chambers have data in this event
50  };
51  };
52  union EventTrailer {
54  struct {
55  uint64_t BCL : 4; // 1st bit, BC0 locked - If 0, this is a bad condition indicating a
56  // problem in the clock or TTC command stream (critical condition)
57  uint64_t DR : 1; // DAQ Ready - If 0, this means that AMC13 is not ready to take data (critical condition)
58  uint64_t CL : 1; // DAQ clock locked- If 0, this indicates a problem in the DAQ clock (critical condition)
59  uint64_t ML : 1; // MMCM locked - Should always be 1
60  uint64_t BP : 1; // Backpressure - If this is 1, it means that we are receiving backpressure from AMC13
61  uint64_t oosGlib : 32; // GLIB is out‐of‐sync (critical): L1A ID is different for
62  // different chambers in this event (1 bit)
63  uint64_t linkTo : 24; // Link timeout flags (one bit for each link indicating timeout condition)
64  };
65  };
66 
67  class AMCdata {
68  public:
69  AMCdata() : amch1_(0), amch2_(0), amct_(0), eh_(0), et_(0){};
70  ~AMCdata() { gebd_.clear(); }
71 
72  int status();
73 
75  void setAMCheader1(uint32_t dataLength, uint16_t bxID, uint32_t l1AID, uint8_t AMCnum);
76  uint64_t getAMCheader1() const { return amch1_; }
77 
79  void setAMCheader2(uint16_t boardID, uint16_t orbitNum, uint8_t runType);
80  uint64_t getAMCheader2() const { return amch2_; }
81 
83  uint64_t getAMCTrailer() const { return amct_; }
84 
86  void setGEMeventHeader(uint8_t davCnt, uint32_t davList);
87  uint64_t getGEMeventHeader() const { return eh_; }
88 
90  uint64_t getGEMeventTrailer() const { return et_; }
91 
92  uint32_t dataLength() const { return AMCTrailer{amct_}.dataLength; }
93  uint16_t bunchCrossing() const { return AMCheader1{amch1_}.bxID; }
94  uint32_t lv1Id() const { return AMCheader1{amch1_}.l1AID; }
95  uint8_t amcNum() const { return AMCheader1{amch1_}.AMCnum; }
96 
97  uint16_t boardId() const { return AMCheader2{amch2_}.boardID; }
98  uint16_t orbitNumber() const { return AMCheader2{amch2_}.orbitNum; }
99  uint8_t param3() const { return AMCheader2{amch2_}.param3; }
100  uint8_t param2() const { return AMCheader2{amch2_}.param2; }
101  uint8_t param1() const { return AMCheader2{amch2_}.param1; }
102  uint8_t runType() const { return AMCheader2{amch2_}.runType; }
103  uint8_t formatVer() const { return AMCheader2{amch2_}.formatVer; }
104 
105  uint8_t lv1Idt() const { return AMCTrailer{amct_}.l1AID; }
106  uint32_t crc() const { return AMCTrailer{amct_}.crc; }
107 
108  uint16_t ttsState() const { return EventHeader{eh_}.ttsState; }
109  uint8_t davCnt() const { return EventHeader{eh_}.davCnt; }
110  uint32_t buffState() const { return EventHeader{eh_}.buffState; }
111  uint32_t davList() const { return EventHeader{eh_}.davList; }
112 
113  uint8_t bc0locked() const { return EventTrailer{et_}.BCL; }
114  uint8_t daqReady() const { return EventTrailer{et_}.DR; }
115  uint8_t daqClockLocked() const { return EventTrailer{et_}.CL; }
116  uint8_t mmcmLocked() const { return EventTrailer{et_}.ML; }
117  uint8_t backPressure() const { return EventTrailer{et_}.BP; }
118  uint8_t oosGlib() const { return EventTrailer{et_}.oosGlib; }
119  uint32_t linkTo() const { return EventTrailer{et_}.linkTo; }
120 
122  void addGEB(GEBdata g) { gebd_.push_back(g); }
124  const std::vector<GEBdata>* gebs() const { return &gebd_; }
126  void clearGEBs() { gebd_.clear(); }
127 
128  private:
134 
135  std::vector<GEBdata> gebd_;
136  };
137 } // namespace gem
138 #endif
gem::AMCdata::bunchCrossing
uint16_t bunchCrossing() const
Definition: AMCdata.h:93
gem::AMCheader1::AMCnum
uint64_t AMCnum
Definition: AMCdata.h:14
gem::AMCdata::setAMCheader2
void setAMCheader2(uint64_t word)
Definition: AMCdata.h:78
gem::AMCdata::ttsState
uint16_t ttsState() const
Definition: AMCdata.h:108
gem::AMCdata::dataLength
uint32_t dataLength() const
Definition: AMCdata.h:92
gem::EventTrailer::linkTo
uint64_t linkTo
Definition: AMCdata.h:63
gem::AMCheader2
Definition: AMCdata.h:18
gem::AMCdata::et_
uint64_t et_
Definition: AMCdata.h:133
gem::AMCdata::crc
uint32_t crc() const
Definition: AMCdata.h:106
gem::AMCdata::lv1Idt
uint8_t lv1Idt() const
Definition: AMCdata.h:105
gem::EventHeader::davCnt
uint64_t davCnt
Definition: AMCdata.h:47
gem::AMCdata::amct_
uint64_t amct_
Definition: AMCdata.h:131
gem::GEBdata
Definition: GEBdata.h:45
gem::EventTrailer
Definition: AMCdata.h:52
gem::AMCdata::davList
uint32_t davList() const
Definition: AMCdata.h:111
gem::AMCheader2::formatVer
uint64_t formatVer
Definition: AMCdata.h:27
gem::AMCheader2::param2
uint64_t param2
Definition: AMCdata.h:24
gem::EventHeader::buffState
uint64_t buffState
Definition: AMCdata.h:48
gem::AMCheader2::word
uint64_t word
Definition: AMCdata.h:19
gem::EventHeader::pType
uint64_t pType
Definition: AMCdata.h:43
gem::AMCdata::amcNum
uint8_t amcNum() const
Definition: AMCdata.h:95
gem::AMCheader1::bxID
uint64_t bxID
Definition: AMCdata.h:12
gem::EventHeader::pVer
uint64_t pVer
Definition: AMCdata.h:46
gem::EventHeader
Definition: AMCdata.h:39
gem::AMCTrailer::dataLength
uint64_t dataLength
Definition: AMCdata.h:33
gem::AMCdata::runType
uint8_t runType() const
Definition: AMCdata.h:102
gem::AMCdata::mmcmLocked
uint8_t mmcmLocked() const
Definition: AMCdata.h:116
gem::AMCdata::linkTo
uint32_t linkTo() const
Definition: AMCdata.h:119
gem::AMCdata::getGEMeventHeader
uint64_t getGEMeventHeader() const
Definition: AMCdata.h:87
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
gem::AMCdata::buffState
uint32_t buffState() const
Definition: AMCdata.h:110
gem::EventTrailer::BP
uint64_t BP
Definition: AMCdata.h:60
gem::AMCdata::eh_
uint64_t eh_
Definition: AMCdata.h:132
gem::AMCdata::gebs
const std::vector< GEBdata > * gebs() const
Returns a vector of GEB data.
Definition: AMCdata.h:124
gem::AMCdata::amch2_
uint64_t amch2_
Definition: AMCdata.h:130
gem::AMCheader2::param1
uint64_t param1
Definition: AMCdata.h:25
gem::AMCdata::getAMCTrailer
uint64_t getAMCTrailer() const
Definition: AMCdata.h:83
gem::AMCdata::setAMCTrailer
void setAMCTrailer(uint64_t word)
Definition: AMCdata.h:82
gem::AMCdata::setAMCheader1
void setAMCheader1(uint64_t word)
Definition: AMCdata.h:74
gem::AMCdata::setGEMeventHeader
void setGEMeventHeader(uint64_t word)
Definition: AMCdata.h:85
gem::AMCdata::formatVer
uint8_t formatVer() const
Definition: AMCdata.h:103
gem::AMCdata::davCnt
uint8_t davCnt() const
Definition: AMCdata.h:109
gem::AMCdata::oosGlib
uint8_t oosGlib() const
Definition: AMCdata.h:118
gem::AMCdata::param1
uint8_t param1() const
Definition: AMCdata.h:101
gem::AMCdata::getAMCheader2
uint64_t getAMCheader2() const
Definition: AMCdata.h:80
gem::AMCdata
Definition: AMCdata.h:67
gem::EventTrailer::BCL
uint64_t BCL
Definition: AMCdata.h:55
gem::AMCdata::orbitNumber
uint16_t orbitNumber() const
Definition: AMCdata.h:98
gem::EventHeader::ttsState
uint64_t ttsState
Definition: AMCdata.h:42
gem::AMCheader2::runType
uint64_t runType
Definition: AMCdata.h:26
gem::AMCdata::amch1_
uint64_t amch1_
Definition: AMCdata.h:129
gem::AMCheader1::word
uint64_t word
Definition: AMCdata.h:9
gem::EventTrailer::CL
uint64_t CL
Definition: AMCdata.h:58
gem::AMCheader1::reserved
uint64_t reserved
Definition: AMCdata.h:15
gem::AMCdata::backPressure
uint8_t backPressure() const
Definition: AMCdata.h:117
gem::AMCdata::clearGEBs
void clearGEBs()
Clear a vector of GEB data.
Definition: AMCdata.h:126
gem::AMCdata::daqClockLocked
uint8_t daqClockLocked() const
Definition: AMCdata.h:115
gem::AMCdata::gebd_
std::vector< GEBdata > gebd_
Vector of GEB data.
Definition: AMCdata.h:135
gem
Definition: AMC13Event.h:6
gem::AMCdata::AMCdata
AMCdata()
Definition: AMCdata.h:69
gem::AMCheader1::dataLength
uint64_t dataLength
Definition: AMCdata.h:11
gem::AMCdata::setGEMeventTrailer
void setGEMeventTrailer(uint64_t word)
Definition: AMCdata.h:89
gem::AMCheader2::orbitNum
uint64_t orbitNum
Definition: AMCdata.h:22
gem::EventTrailer::word
uint64_t word
Definition: AMCdata.h:53
gem::AMCdata::param3
uint8_t param3() const
Definition: AMCdata.h:99
gem::AMCdata::~AMCdata
~AMCdata()
Definition: AMCdata.h:70
GEBdata.h
gem::AMCTrailer::word
uint64_t word
Definition: AMCdata.h:31
gem::EventHeader::word
uint64_t word
Definition: AMCdata.h:40
gem::AMCdata::boardId
uint16_t boardId() const
Definition: AMCdata.h:97
gem::AMCTrailer::crc
uint64_t crc
Definition: AMCdata.h:36
gem::AMCheader1::l1AID
uint64_t l1AID
Definition: AMCdata.h:13
gem::AMCheader2::boardID
uint64_t boardID
Definition: AMCdata.h:21
gem::AMCdata::lv1Id
uint32_t lv1Id() const
Definition: AMCdata.h:94
gem::AMCdata::getAMCheader1
uint64_t getAMCheader1() const
Definition: AMCdata.h:76
gem::AMCdata::addGEB
void addGEB(GEBdata g)
Adds GEB data to vector.
Definition: AMCdata.h:122
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:61
gem::AMCdata::param2
uint8_t param2() const
Definition: AMCdata.h:100
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:57
gem::AMCdata::bc0locked
uint8_t bc0locked() const
Definition: AMCdata.h:113
gem::AMCdata::daqReady
uint8_t daqReady() const
Definition: AMCdata.h:114
gem::AMCdata::status
int status()
gem::AMCdata::getGEMeventTrailer
uint64_t getGEMeventTrailer() const
Definition: AMCdata.h:90
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:49
gem::AMCTrailer::l1AID
uint64_t l1AID
Definition: AMCdata.h:35
gem::EventTrailer::ML
uint64_t ML
Definition: AMCdata.h:59