Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:49:54

0001 #include <cstdint>
0002 #include "DataFormats/GEMDigi/interface/GEMAMC13.h"
0003 
0004 void GEMAMC13::setCDFHeader(uint8_t Evt_ty, uint32_t LV1_id, uint16_t BX_id, uint16_t Source_id) {
0005   CDFHeader u{0};
0006   u.cb5 = 0x5;
0007   u.eventType = Evt_ty;
0008   u.lv1Id = LV1_id;
0009   u.bxId = BX_id;
0010   u.sourceId = Source_id;
0011   cdfh_ = u.word;
0012 }
0013 
0014 void GEMAMC13::setAMC13Header(uint8_t CalTyp, uint8_t nAMC, uint32_t OrN) {
0015   AMC13Header u{0};
0016   u.cb0 = 0x0;
0017   u.calType = CalTyp;
0018   u.nAMC = nAMC;
0019   u.orbitN = OrN;
0020   amc13h_ = u.word;
0021 }
0022 
0023 void GEMAMC13::setAMC13Trailer(uint8_t Blk_NoT, uint8_t LV1_idT, uint16_t BX_idT) {
0024   AMC13Trailer u{0};
0025   u.blkN = Blk_NoT;
0026   u.lv1IdT = LV1_idT;
0027   u.bxIdT = BX_idT;
0028   amc13t_ = u.word;
0029 }
0030 
0031 void GEMAMC13::setCDFTrailer(uint32_t EvtLength) {
0032   CDFTrailer u{0};
0033   u.cbA = 0xA;
0034   u.eventType = CDFHeader{cdfh_}.eventType;
0035   u.evtLength = EvtLength;
0036   cdft_ = u.word;
0037 }
0038 
0039 void GEMAMC13::addAMCheader(uint64_t word) { amcHeaders_.push_back(word); }
0040 
0041 void GEMAMC13::addAMCheader(uint32_t AMC_size, uint8_t Blk_No, uint8_t AMC_No, uint16_t BoardID) {
0042   // AMC Header word
0043   // 55 - 32  | 27 - 20 | 19 - 16 | 15 - 0  |
0044   // AMC_size | Blk_No  | AMC_No  | BoardID |
0045   uint64_t word = (static_cast<uint64_t>(AMC_size & 0x00ffffff) << 32) | (static_cast<uint64_t>(Blk_No & 0xff) << 20) |
0046                   (static_cast<uint64_t>(AMC_No & 0x0f) << 16) | (static_cast<uint64_t>(BoardID & 0xffff));
0047   amcHeaders_.push_back(word);
0048 }