CMS 3D CMS Logo

AMC13Event.h
Go to the documentation of this file.
1 #ifndef DataFormats_GEMDigi_AMC13Event_h
2 #define DataFormats_GEMDigi_AMC13Event_h
3 #include <vector>
4 #include "AMCdata.h"
5 
6 namespace gem {
7 
8  union CDFHeader {
10  struct {
11  uint64_t fov : 8; // not used
12  uint64_t sourceId : 12; // FED number assigned by CDAQ
13  uint64_t bxId : 12; // BX number, Reset by BC0
14  uint64_t lv1Id : 24; // L1A / event number, Reset by EC0
15  uint64_t eventType : 4; // Event Type (1 for normal, 2 for calibration)
16  uint64_t cb5 : 4; // 0x5
17  };
18  };
19  union AMC13Header {
21  struct {
22  uint64_t cb0 : 4; // 0x0
23  uint64_t orbitN : 32; // Orbit Number
24  uint64_t reserved0 : 16; // reserved
25  uint64_t nAMC : 4; // Number of AMCs following (0 to 12)
26  uint64_t calType : 4; // Calibration event type
27  uint64_t uFov : 4; // Format version: 0x1
28  };
29  };
30  union AMC13Trailer {
32  struct {
33  uint64_t bxIdT : 12; // bx id
34  uint64_t lv1IdT : 8; // level 1 id
35  uint64_t blkN : 8; // block number
36  uint64_t : 4;
37  uint64_t crc32 : 32; // Overall CRC
38  };
39  };
40  union CDFTrailer {
42  struct {
46  uint64_t tts : 4; // tts
47  uint64_t evtStat : 4; // event status
51  uint64_t crcCDF : 16; // CDF crc
52  uint64_t evtLength : 24; // event length
53  uint64_t eventType : 4; // Event Type
54  uint64_t cbA : 4; // 0xA
55  };
56  };
57  union AMCHeader {
59  struct {
60  uint64_t boardId : 16; // board id
61  uint64_t amcNo : 4; // amc number
62  uint64_t blkNo : 8; // block number
63  uint64_t unused : 4; // unused
64  uint64_t amcSize : 24; // amc size
65  uint64_t errStrip : 8; // errStrip
66  };
67  };
68 
69  class AMC13Event {
70  public:
71  AMC13Event() : cdfh_(0), amc13h_(0), amc13t_(0), cdft_(0) {}
73  amcHeaders_.clear();
74  amcs_.clear();
75  }
76 
78  void setCDFHeader(uint8_t Evt_ty, uint32_t LV1_id, uint16_t BX_id, uint16_t Source_id);
79  uint64_t getCDFHeader() const { return cdfh_; }
80 
82  void setAMC13Header(uint8_t CalTyp, uint8_t nAMC, uint32_t OrN);
83  uint64_t getAMC13Header() const { return amc13h_; }
84 
86  void setAMC13Trailer(uint8_t Blk_NoT, uint8_t LV1_idT, uint16_t BX_idT);
87  uint64_t getAMC13Trailer() const { return amc13t_; }
88 
90  void setCDFTrailer(uint32_t EvtLength);
91  uint64_t getCDFTrailer() const { return cdft_; }
92  uint32_t fragmentLength() const { return CDFTrailer{cdft_}.evtLength; }
93  uint8_t evtStatus() const { return CDFTrailer{cdft_}.evtStat; }
94  uint8_t ttsBits() const { return CDFTrailer{cdft_}.tts; }
95 
96  uint16_t bunchCrossing() const { return CDFHeader{cdfh_}.bxId; }
97  uint32_t lv1Id() const { return CDFHeader{cdfh_}.lv1Id; }
98  uint16_t sourceId() const { return CDFHeader{cdfh_}.sourceId; }
99 
100  uint16_t orbitNumber() const { return AMC13Header{amc13h_}.orbitN; }
101  uint8_t nAMC() const { return AMC13Header{amc13h_}.nAMC; }
102 
103  const std::vector<uint64_t>* getAMCheaders() const { return &amcHeaders_; }
104  uint32_t getAMCsize(int i) const { return AMCHeader{amcHeaders_.at(i)}.amcSize; }
105  void addAMCheader(uint64_t word);
106  void addAMCheader(uint32_t AMC_size, uint8_t Blk_No, uint8_t AMC_No, uint16_t BoardID);
107 
108  uint32_t crc() const { return AMC13Trailer{amc13t_}.crc32; }
109 
110  const std::vector<AMCdata>* getAMCpayloads() const { return &amcs_; }
111  void addAMCpayload(const AMCdata& a) { amcs_.push_back(a); }
112  void clearAMCpayloads() { amcs_.clear(); }
113 
114  private:
115  uint64_t cdfh_; // CDFHeader
116  uint64_t amc13h_; // AMC13Header
117  uint64_t amc13t_; // AMC13Trailer
118  uint64_t cdft_; // CDFTrailer
119 
120  // AMC headers
121  std::vector<uint64_t> amcHeaders_;
122  // AMCs payload
123  std::vector<AMCdata> amcs_;
124  };
125 } // namespace gem
126 #endif
gem::CDFTrailer::word
uint64_t word
Definition: AMC13Event.h:41
gem::AMCHeader::word
uint64_t word
Definition: AMC13Event.h:58
gem::AMC13Header::uFov
uint64_t uFov
Definition: AMC13Event.h:27
mps_fire.i
i
Definition: mps_fire.py:428
gem::AMC13Event::addAMCpayload
void addAMCpayload(const AMCdata &a)
Definition: AMC13Event.h:111
gem::CDFTrailer::res2
uint64_t res2
Definition: AMC13Event.h:48
gem::AMC13Header::cb0
uint64_t cb0
Definition: AMC13Event.h:22
gem::CDFTrailer::res1
uint64_t res1
Definition: AMC13Event.h:43
gem::AMC13Event::crc
uint32_t crc() const
Definition: AMC13Event.h:108
gem::AMC13Event::cdft_
uint64_t cdft_
Definition: AMC13Event.h:118
gem::AMC13Event::amcHeaders_
std::vector< uint64_t > amcHeaders_
Definition: AMC13Event.h:121
gem::CDFTrailer::crcCDF
uint64_t crcCDF
Definition: AMC13Event.h:51
gem::AMC13Event::addAMCheader
void addAMCheader(uint64_t word)
Definition: AMC13Event.cc:41
gem::AMCHeader::amcNo
uint64_t amcNo
Definition: AMC13Event.h:61
gem::CDFTrailer::evtStat
uint64_t evtStat
Definition: AMC13Event.h:47
gem::AMC13Event::setCDFTrailer
void setCDFTrailer(uint64_t word)
Definition: AMC13Event.h:89
gem::AMC13Event::cdfh_
uint64_t cdfh_
Definition: AMC13Event.h:115
gem::AMC13Event::orbitNumber
uint16_t orbitNumber() const
Definition: AMC13Event.h:100
gem::AMC13Trailer::lv1IdT
uint64_t lv1IdT
Definition: AMC13Event.h:34
gem::AMC13Event
Definition: AMC13Event.h:69
gem::AMC13Event::bunchCrossing
uint16_t bunchCrossing() const
Definition: AMC13Event.h:96
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
gem::AMC13Event::getCDFTrailer
uint64_t getCDFTrailer() const
Definition: AMC13Event.h:91
gem::AMC13Event::setCDFHeader
void setCDFHeader(uint64_t word)
Definition: AMC13Event.h:77
gem::AMC13Trailer::blkN
uint64_t blkN
Definition: AMC13Event.h:35
gem::AMC13Event::lv1Id
uint32_t lv1Id() const
Definition: AMC13Event.h:97
gem::AMC13Event::evtStatus
uint8_t evtStatus() const
Definition: AMC13Event.h:93
gem::AMC13Event::amcs_
std::vector< AMCdata > amcs_
Definition: AMC13Event.h:123
gem::AMC13Header::nAMC
uint64_t nAMC
Definition: AMC13Event.h:25
gem::AMC13Event::getAMCheaders
const std::vector< uint64_t > * getAMCheaders() const
Definition: AMC13Event.h:103
gem::AMCHeader::amcSize
uint64_t amcSize
Definition: AMC13Event.h:64
gem::CDFHeader::cb5
uint64_t cb5
Definition: AMC13Event.h:16
gem::AMC13Event::getAMCsize
uint32_t getAMCsize(int i) const
Definition: AMC13Event.h:104
gem::CDFTrailer
Definition: AMC13Event.h:40
gem::CDFHeader::sourceId
uint64_t sourceId
Definition: AMC13Event.h:12
gem::AMC13Event::AMC13Event
AMC13Event()
Definition: AMC13Event.h:71
AMCdata.h
gem::AMC13Header::word
uint64_t word
Definition: AMC13Event.h:20
gem::AMCdata
Definition: AMCdata.h:67
a
double a
Definition: hdecay.h:119
gem::AMC13Event::clearAMCpayloads
void clearAMCpayloads()
Definition: AMC13Event.h:112
gem::AMCHeader
Definition: AMC13Event.h:57
gem::AMC13Event::~AMC13Event
~AMC13Event()
Definition: AMC13Event.h:72
gem::AMC13Event::ttsBits
uint8_t ttsBits() const
Definition: AMC13Event.h:94
gem::AMC13Event::getAMC13Header
uint64_t getAMC13Header() const
Definition: AMC13Event.h:83
gem::CDFHeader
Definition: AMC13Event.h:8
gem::AMC13Trailer::crc32
uint64_t crc32
Definition: AMC13Event.h:37
gem::AMC13Trailer
Definition: AMC13Event.h:30
gem::AMC13Trailer::word
uint64_t word
Definition: AMC13Event.h:31
gem::CDFTrailer::crcModified
uint64_t crcModified
Definition: AMC13Event.h:44
gem::CDFTrailer::wrongFedId
uint64_t wrongFedId
Definition: AMC13Event.h:50
gem::AMCHeader::blkNo
uint64_t blkNo
Definition: AMC13Event.h:62
gem
Definition: AMC13Event.h:6
gem::AMCHeader::boardId
uint64_t boardId
Definition: AMC13Event.h:60
gem::CDFTrailer::cbA
uint64_t cbA
Definition: AMC13Event.h:54
gem::AMC13Event::setAMC13Header
void setAMC13Header(uint64_t word)
Definition: AMC13Event.h:81
gem::AMC13Event::getAMC13Trailer
uint64_t getAMC13Trailer() const
Definition: AMC13Event.h:87
gem::AMC13Event::amc13t_
uint64_t amc13t_
Definition: AMC13Event.h:117
gem::AMC13Event::getCDFHeader
uint64_t getCDFHeader() const
Definition: AMC13Event.h:79
gem::AMCHeader::errStrip
uint64_t errStrip
Definition: AMC13Event.h:65
gem::CDFHeader::fov
uint64_t fov
Definition: AMC13Event.h:11
gem::AMC13Event::getAMCpayloads
const std::vector< AMCdata > * getAMCpayloads() const
Definition: AMC13Event.h:110
gem::CDFTrailer::eventType
uint64_t eventType
Definition: AMC13Event.h:53
gem::CDFTrailer::evtLength
uint64_t evtLength
Definition: AMC13Event.h:52
gem::CDFTrailer::tts
uint64_t tts
Definition: AMC13Event.h:46
gem::AMC13Event::sourceId
uint16_t sourceId() const
Definition: AMC13Event.h:98
gem::AMC13Event::fragmentLength
uint32_t fragmentLength() const
Definition: AMC13Event.h:92
gem::AMC13Trailer::bxIdT
uint64_t bxIdT
Definition: AMC13Event.h:33
gem::CDFHeader::bxId
uint64_t bxId
Definition: AMC13Event.h:13
gem::AMC13Header::reserved0
uint64_t reserved0
Definition: AMC13Event.h:24
gem::CDFHeader::lv1Id
uint64_t lv1Id
Definition: AMC13Event.h:14
gem::CDFHeader::eventType
uint64_t eventType
Definition: AMC13Event.h:15
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
gem::AMCHeader::unused
uint64_t unused
Definition: AMC13Event.h:63
gem::CDFTrailer::slinkError
uint64_t slinkError
Definition: AMC13Event.h:49
gem::AMC13Header::calType
uint64_t calType
Definition: AMC13Event.h:26
gem::AMC13Header::orbitN
uint64_t orbitN
Definition: AMC13Event.h:23
gem::CDFHeader::word
uint64_t word
Definition: AMC13Event.h:9
gem::AMC13Event::amc13h_
uint64_t amc13h_
Definition: AMC13Event.h:116
gem::CDFTrailer::moreTrailers
uint64_t moreTrailers
Definition: AMC13Event.h:45
gem::AMC13Event::setAMC13Trailer
void setAMC13Trailer(uint64_t word)
Definition: AMC13Event.h:85
gem::AMC13Event::nAMC
uint8_t nAMC() const
Definition: AMC13Event.h:101
gem::AMC13Header
Definition: AMC13Event.h:19