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 crc32 : 36; // Overall CRC (first 32 bits)
37  };
38  };
39  union CDFTrailer {
41  struct {
45  uint64_t tts : 4; // tts
46  uint64_t evtStat : 4; // event status
50  uint64_t crcCDF : 16; // CDF crc
51  uint64_t evtLength : 24; // event length
52  uint64_t eventType : 4; // Event Type
53  uint64_t cbA : 4; // 0xA
54  };
55  };
56  union AMCHeader {
58  struct {
59  uint64_t boardId : 16; // board id
60  uint64_t amcNo : 4; // amc number
61  uint64_t blkNo : 8; // block number
62  uint64_t unused : 4; // unused
63  uint64_t amcSize : 24; // amc size
64  uint64_t errStrip : 8; // errStrip
65  };
66  };
67 
68  class AMC13Event {
69  public:
70  AMC13Event() : cdfh_(0), amc13h_(0), amc13t_(0), cdft_(0) {}
72  amcHeaders_.clear();
73  amcs_.clear();
74  }
75 
77  void setCDFHeader(uint8_t Evt_ty, uint32_t LV1_id, uint16_t BX_id, uint16_t Source_id);
78  uint64_t getCDFHeader() const { return cdfh_; }
79 
81  void setAMC13Header(uint8_t CalTyp, uint8_t nAMC, uint32_t OrN);
82  uint64_t getAMC13Header() const { return amc13h_; }
83 
85  void setAMC13Trailer(uint8_t Blk_NoT, uint8_t LV1_idT, uint16_t BX_idT);
86  uint64_t getAMC13Trailer() const { return amc13t_; }
87 
89  void setCDFTrailer(uint32_t EvtLength);
90  uint64_t getCDFTrailer() const { return cdft_; }
91  uint32_t fragmentLength() const { return CDFTrailer{cdft_}.evtLength; }
92  uint16_t crc() const { return CDFTrailer{cdft_}.crcCDF; }
93  uint8_t evtStatus() const { return CDFTrailer{cdft_}.evtStat; }
94  uint8_t ttsBits() const { return CDFTrailer{cdft_}.tts; }
95 
96  int bxId() const { return (int8_t)CDFHeader{cdfh_}.bxId; }
97  uint32_t lv1Id() const { return CDFHeader{cdfh_}.lv1Id; }
98  uint16_t sourceId() const { return CDFHeader{cdfh_}.sourceId; }
99 
100  int 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  const std::vector<AMCdata>* getAMCpayloads() const { return &amcs_; }
109  void addAMCpayload(const AMCdata& a) { amcs_.push_back(a); }
110  void clearAMCpayloads() { amcs_.clear(); }
111 
112  private:
113  uint64_t cdfh_; // CDFHeader
114  uint64_t amc13h_; // AMC13Header
115  uint64_t amc13t_; // AMC13Trailer
116  uint64_t cdft_; // CDFTrailer
117 
118  // AMC headers
119  std::vector<uint64_t> amcHeaders_;
120  // AMCs payload
121  std::vector<AMCdata> amcs_;
122  };
123 } // namespace gem
124 #endif
gem::CDFTrailer::word
uint64_t word
Definition: AMC13Event.h:40
gem::AMCHeader::word
uint64_t word
Definition: AMC13Event.h:57
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:109
gem::CDFTrailer::res2
uint64_t res2
Definition: AMC13Event.h:47
gem::AMC13Header::cb0
uint64_t cb0
Definition: AMC13Event.h:22
gem::CDFTrailer::res1
uint64_t res1
Definition: AMC13Event.h:42
gem::AMC13Event::cdft_
uint64_t cdft_
Definition: AMC13Event.h:116
gem::AMC13Event::amcHeaders_
std::vector< uint64_t > amcHeaders_
Definition: AMC13Event.h:119
gem::CDFTrailer::crcCDF
uint64_t crcCDF
Definition: AMC13Event.h:50
gem::AMC13Event::addAMCheader
void addAMCheader(uint64_t word)
Definition: AMC13Event.cc:41
gem::AMCHeader::amcNo
uint64_t amcNo
Definition: AMC13Event.h:60
gem::CDFTrailer::evtStat
uint64_t evtStat
Definition: AMC13Event.h:46
gem::AMC13Event::setCDFTrailer
void setCDFTrailer(uint64_t word)
Definition: AMC13Event.h:88
gem::AMC13Event::cdfh_
uint64_t cdfh_
Definition: AMC13Event.h:113
gem::AMC13Trailer::lv1IdT
uint64_t lv1IdT
Definition: AMC13Event.h:34
gem::AMC13Event
Definition: AMC13Event.h:68
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
gem::AMC13Event::getCDFTrailer
uint64_t getCDFTrailer() const
Definition: AMC13Event.h:90
gem::AMC13Event::setCDFHeader
void setCDFHeader(uint64_t word)
Definition: AMC13Event.h:76
gem::AMC13Trailer::blkN
uint64_t blkN
Definition: AMC13Event.h:35
gem::AMC13Event::orbitNumber
int orbitNumber() const
Definition: AMC13Event.h:100
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:121
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:63
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:39
gem::CDFHeader::sourceId
uint64_t sourceId
Definition: AMC13Event.h:12
gem::AMC13Event::bxId
int bxId() const
Definition: AMC13Event.h:96
gem::AMC13Event::AMC13Event
AMC13Event()
Definition: AMC13Event.h:70
AMCdata.h
gem::AMC13Header::word
uint64_t word
Definition: AMC13Event.h:20
gem::AMCdata
Definition: AMCdata.h:66
a
double a
Definition: hdecay.h:119
gem::AMC13Event::clearAMCpayloads
void clearAMCpayloads()
Definition: AMC13Event.h:110
gem::AMCHeader
Definition: AMC13Event.h:56
gem::AMC13Event::~AMC13Event
~AMC13Event()
Definition: AMC13Event.h:71
gem::AMC13Event::ttsBits
uint8_t ttsBits() const
Definition: AMC13Event.h:94
gem::AMC13Event::getAMC13Header
uint64_t getAMC13Header() const
Definition: AMC13Event.h:82
gem::CDFHeader
Definition: AMC13Event.h:8
gem::AMC13Trailer::crc32
uint64_t crc32
Definition: AMC13Event.h:36
gem::AMC13Trailer
Definition: AMC13Event.h:30
gem::AMC13Trailer::word
uint64_t word
Definition: AMC13Event.h:31
gem::AMC13Event::crc
uint16_t crc() const
Definition: AMC13Event.h:92
gem::CDFTrailer::crcModified
uint64_t crcModified
Definition: AMC13Event.h:43
gem::CDFTrailer::wrongFedId
uint64_t wrongFedId
Definition: AMC13Event.h:49
gem::AMCHeader::blkNo
uint64_t blkNo
Definition: AMC13Event.h:61
gem
Definition: AMC13Event.h:6
gem::AMCHeader::boardId
uint64_t boardId
Definition: AMC13Event.h:59
gem::CDFTrailer::cbA
uint64_t cbA
Definition: AMC13Event.h:53
gem::AMC13Event::setAMC13Header
void setAMC13Header(uint64_t word)
Definition: AMC13Event.h:80
gem::AMC13Event::getAMC13Trailer
uint64_t getAMC13Trailer() const
Definition: AMC13Event.h:86
gem::AMC13Event::amc13t_
uint64_t amc13t_
Definition: AMC13Event.h:115
gem::AMC13Event::getCDFHeader
uint64_t getCDFHeader() const
Definition: AMC13Event.h:78
gem::AMCHeader::errStrip
uint64_t errStrip
Definition: AMC13Event.h:64
gem::CDFHeader::fov
uint64_t fov
Definition: AMC13Event.h:11
gem::AMC13Event::getAMCpayloads
const std::vector< AMCdata > * getAMCpayloads() const
Definition: AMC13Event.h:108
gem::CDFTrailer::eventType
uint64_t eventType
Definition: AMC13Event.h:52
gem::CDFTrailer::evtLength
uint64_t evtLength
Definition: AMC13Event.h:51
gem::CDFTrailer::tts
uint64_t tts
Definition: AMC13Event.h:45
gem::AMC13Event::sourceId
uint16_t sourceId() const
Definition: AMC13Event.h:98
gem::AMC13Event::fragmentLength
uint32_t fragmentLength() const
Definition: AMC13Event.h:91
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:62
gem::CDFTrailer::slinkError
uint64_t slinkError
Definition: AMC13Event.h:48
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:114
gem::CDFTrailer::moreTrailers
uint64_t moreTrailers
Definition: AMC13Event.h:44
gem::AMC13Event::setAMC13Trailer
void setAMC13Trailer(uint64_t word)
Definition: AMC13Event.h:84
gem::AMC13Event::nAMC
uint8_t nAMC() const
Definition: AMC13Event.h:101
gem::AMC13Header
Definition: AMC13Event.h:19