CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
9  word[0] = 0x5100000000000008LL;
10  word[1] = 0xD900000000000000LL;
12  FEDHeader::set(reinterpret_cast<unsigned char *>(data()), 1, l1a, bx, sourceId, version, true);
13 }
14 
15 
17 {
18  word[0] = 0x5100000000000008LL;
19  word[1] = 0xD900000000000000LL;
20 }
21 
23 {
24  memcpy(this, digi.header(), sizeInWords()*2);
25 }
26 
27 
28 
30 {
31  return ((word[0]>>32)&0x00FFFFFF);
32 }
33 
35 {
36  return ((word[0]>>20)&0xFFF);
37 }
39 {
40  return ((word[0]>>8)&0xFFF);
41 }
43 {
44  return ((word[0]>>4)&0xF);
45 }
47 {
48  return ((word[0]>>56)&0xF);
49 }
50 
51 
52 void CSCDCCHeader::setDAV(int slot)
53 {
54  /* Bits 7,6,5,4,2 to indicate available DDU.
55  For slink0, the DDU slots are 5, 12, 4, 13, 3 (same as Fifo_in_use[4:0]);
56  for slink1, the DDU slots are 9, 7, 10, 6, 11
57  */
58  assert(slot>=3 && slot <= 13);
59  int bit[] = {0, 0, 0, 2, 5, 7, 4, 6, 0, 7, 5, 2, 6, 4};
60  word[0] |= 1 << bit[slot];
61 }
62 
63 std::ostream & operator<<(std::ostream & os, const CSCDCCHeader & hdr)
64 {
65  os << "DCC Header" << std::endl;
66  return os;
67 }
68 
const uint16_t * header() const
data accessors
void setDAV(int dduSlot)
Definition: CSCDCCHeader.cc:52
std::ostream & operator<<(std::ostream &os, const CSCDCCHeader &hdr)
Definition: CSCDCCHeader.cc:63
int getCDFFOV() const
Definition: CSCDCCHeader.cc:42
int getCDFBunchCounter() const
Definition: CSCDCCHeader.cc:34
int getCDFEventNumber() const
Definition: CSCDCCHeader.cc:29
static void set(unsigned char *header, int evt_ty, int lvl1_ID, int bx_ID, int source_ID, int version=0, bool H=false)
Set all fields in the header.
Definition: FEDHeader.cc:40
int getCDFEventType() const
Definition: CSCDCCHeader.cc:46
int getCDFSourceId() const
Definition: CSCDCCHeader.cc:38
unsigned long long word[2]
Definition: CSCDCCHeader.h:32
static unsigned sizeInWords()
Definition: CSCDCCHeader.h:26
unsigned short * data()
Definition: CSCDCCHeader.h:25