Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:14:41

0001 #include "EventFilter/CSCRawToDigi/interface/CSCDCCHeader.h"
0002 #include "DataFormats/FEDRawData/interface/FEDHeader.h"
0003 #include <iostream>
0004 #include <cassert>
0005 #include <cstring>
0006 
0007 CSCDCCHeader::CSCDCCHeader(int bx, int l1a, int sourceId, int version) {
0008   word[0] = 0x5100000000000008LL;
0009   word[1] = 0xD900000000000000LL;
0010   /// =VB= Should pass true as last parameter for FEDHeader::set() method to construct correct data
0011   FEDHeader::set(reinterpret_cast<unsigned char *>(data()), 1, l1a, bx, sourceId, version, true);
0012 }
0013 
0014 CSCDCCHeader::CSCDCCHeader() {
0015   word[0] = 0x5100000000000008LL;
0016   word[1] = 0xD900000000000000LL;
0017 }
0018 
0019 CSCDCCHeader::CSCDCCHeader(const CSCDCCStatusDigi &digi) { memcpy(this, digi.header(), sizeInWords() * 2); }
0020 
0021 int CSCDCCHeader::getCDFEventNumber() const { return ((word[0] >> 32) & 0x00FFFFFF); }
0022 
0023 int CSCDCCHeader::getCDFBunchCounter() const { return ((word[0] >> 20) & 0xFFF); }
0024 int CSCDCCHeader::getCDFSourceId() const { return ((word[0] >> 8) & 0xFFF); }
0025 int CSCDCCHeader::getCDFFOV() const { return ((word[0] >> 4) & 0xF); }
0026 int CSCDCCHeader::getCDFEventType() const { return ((word[0] >> 56) & 0xF); }
0027 
0028 void CSCDCCHeader::setDAV(int slot) {
0029   /* Bits 7,6,5,4,2 to indicate available DDU. 
0030      For slink0, the DDU slots are 5, 12, 4, 13, 3 (same as Fifo_in_use[4:0]); 
0031      for slink1, the DDU slots are 9, 7, 10, 6, 11
0032   */
0033   assert(slot >= 3 && slot <= 13);
0034   int bit[] = {0, 0, 0, 2, 5, 7, 4, 6, 0, 7, 5, 2, 6, 4};
0035   word[0] |= 1 << bit[slot];
0036 }
0037 
0038 std::ostream &operator<<(std::ostream &os, const CSCDCCHeader &hdr) {
0039   os << "DCC Header" << std::endl;
0040   return os;
0041 }