CMS 3D CMS Logo

CSCDCCHeader.cc
Go to the documentation of this file.
3 #include <iostream>
4 #include <cassert>
5 #include <cstring>
6 
7 CSCDCCHeader::CSCDCCHeader(int bx, int l1a, int sourceId, int version) {
8  word[0] = 0x5100000000000008LL;
9  word[1] = 0xD900000000000000LL;
11  FEDHeader::set(reinterpret_cast<unsigned char *>(data()), 1, l1a, bx, sourceId, version, true);
12 }
13 
15  word[0] = 0x5100000000000008LL;
16  word[1] = 0xD900000000000000LL;
17 }
18 
19 CSCDCCHeader::CSCDCCHeader(const CSCDCCStatusDigi &digi) { memcpy(this, digi.header(), sizeInWords() * 2); }
20 
21 int CSCDCCHeader::getCDFEventNumber() const { return ((word[0] >> 32) & 0x00FFFFFF); }
22 
23 int CSCDCCHeader::getCDFBunchCounter() const { return ((word[0] >> 20) & 0xFFF); }
24 int CSCDCCHeader::getCDFSourceId() const { return ((word[0] >> 8) & 0xFFF); }
25 int CSCDCCHeader::getCDFFOV() const { return ((word[0] >> 4) & 0xF); }
26 int CSCDCCHeader::getCDFEventType() const { return ((word[0] >> 56) & 0xF); }
27 
28 void CSCDCCHeader::setDAV(int slot) {
29  /* Bits 7,6,5,4,2 to indicate available DDU.
30  For slink0, the DDU slots are 5, 12, 4, 13, 3 (same as Fifo_in_use[4:0]);
31  for slink1, the DDU slots are 9, 7, 10, 6, 11
32  */
33  assert(slot >= 3 && slot <= 13);
34  int bit[] = {0, 0, 0, 2, 5, 7, 4, 6, 0, 7, 5, 2, 6, 4};
35  word[0] |= 1 << bit[slot];
36 }
37 
38 std::ostream &operator<<(std::ostream &os, const CSCDCCHeader &hdr) {
39  os << "DCC Header" << std::endl;
40  return os;
41 }
void setDAV(int dduSlot)
Definition: CSCDCCHeader.cc:28
int getCDFSourceId() const
Definition: CSCDCCHeader.cc:24
std::ostream & operator<<(std::ostream &os, const CSCDCCHeader &hdr)
Definition: CSCDCCHeader.cc:38
assert(be >=bs)
uint64_t word
const uint16_t * header() const
data accessors
int getCDFFOV() const
Definition: CSCDCCHeader.cc:25
int getCDFBunchCounter() const
Definition: CSCDCCHeader.cc:23
static unsigned sizeInWords()
Definition: CSCDCCHeader.h:29
static void set(unsigned char *header, uint8_t triggerType, uint32_t lvl1ID, uint16_t bxID, uint16_t sourceID, uint8_t version=0, bool moreHeaders=false)
Set all fields in the header.
Definition: FEDHeader.cc:25
int getCDFEventType() const
Definition: CSCDCCHeader.cc:26
unsigned short * data()
Definition: CSCDCCHeader.h:28
int getCDFEventNumber() const
Definition: CSCDCCHeader.cc:21