CMS 3D CMS Logo

AMC13Event.cc
Go to the documentation of this file.
1 #include <cstdint>
3 
4 using namespace gem;
5 
6 void AMC13Event::setCDFHeader(uint8_t Evt_ty, uint32_t LV1_id, uint16_t BX_id, uint16_t Source_id) {
7  CDFHeader u{0};
8  u.cb5 = 0x5;
9  u.eventType = Evt_ty;
10  u.lv1Id = LV1_id;
11  u.bxId = BX_id;
12  u.sourceId = Source_id;
13  cdfh_ = u.word;
14 }
15 
16 void AMC13Event::setAMC13Header(uint8_t CalTyp, uint8_t nAMC, uint32_t OrN) {
17  AMC13Header u{0};
18  u.cb0 = 0x0;
19  u.calType = CalTyp;
20  u.nAMC = nAMC;
21  u.orbitN = OrN;
22  amc13h_ = u.word;
23 }
24 
25 void AMC13Event::setAMC13Trailer(uint8_t Blk_NoT, uint8_t LV1_idT, uint16_t BX_idT) {
26  AMC13Trailer u{0};
27  u.blkN = Blk_NoT;
28  u.lv1IdT = LV1_idT;
29  u.bxIdT = BX_idT;
30  amc13t_ = u.word;
31 }
32 
33 void AMC13Event::setCDFTrailer(uint32_t EvtLength) {
34  CDFTrailer u{0};
35  u.cbA = 0xA;
36  u.eventType = CDFHeader{cdfh_}.eventType;
37  u.evtLength = EvtLength;
38  cdft_ = u.word;
39 }
40 
42 
43 void AMC13Event::addAMCheader(uint32_t AMC_size, uint8_t Blk_No, uint8_t AMC_No, uint16_t BoardID) {
44  // AMC Header word
45  // 55 - 32 | 27 - 20 | 19 - 16 | 15 - 0 |
46  // AMC_size | Blk_No | AMC_No | BoardID |
47  uint64_t word = (static_cast<uint64_t>(AMC_size & 0x00ffffff) << 32) | (static_cast<uint64_t>(Blk_No & 0xff) << 20) |
48  (static_cast<uint64_t>(AMC_No & 0x0f) << 16) | (static_cast<uint64_t>(BoardID & 0xffff));
49  amcHeaders_.push_back(word);
50 }
uint64_t amc13h_
Definition: AMC13Event.h:90
void addAMCheader(uint64_t word)
Definition: AMC13Event.cc:41
uint64_t cdft_
Definition: AMC13Event.h:92
void setAMC13Trailer(uint64_t word)
Definition: AMC13Event.h:67
void setCDFTrailer(uint64_t word)
Definition: AMC13Event.h:71
std::vector< uint64_t > amcHeaders_
Definition: AMC13Event.h:95
uint64_t cdfh_
Definition: AMC13Event.h:89
Definition: AMC13Event.h:6
uint64_t word
void setCDFHeader(uint64_t word)
Definition: AMC13Event.h:59
uint64_t cb0
Definition: AMC13Event.h:22
unsigned long long uint64_t
Definition: Time.h:13
void setAMC13Header(uint64_t word)
Definition: AMC13Event.h:63
uint64_t cb5
Definition: AMC13Event.h:16
uint64_t amc13t_
Definition: AMC13Event.h:91
uint64_t cbA
Definition: AMC13Event.h:47
uint8_t nAMC() const
Definition: AMC13Event.h:79