00001 #include "EventFilter/CSCRawToDigi/interface/CSCDCCHeader.h"
00002 #include "DataFormats/FEDRawData/interface/FEDHeader.h"
00003 #include <iostream>
00004 #include <cassert>
00005
00006 CSCDCCHeader::CSCDCCHeader(int bx, int l1a, int sourceId)
00007 {
00008 word[0] = 0x510000000000005FLL;
00009 word[1] = 0xD900000000000003LL;
00010 FEDHeader::set(reinterpret_cast<unsigned char *>(data()), 1, l1a, bx, sourceId);
00011 }
00012
00013
00014 CSCDCCHeader::CSCDCCHeader()
00015 {
00016 word[0] = 0x510000000000005FLL;
00017 word[1] = 0xD900000000000003LL;
00018 }
00019
00020 CSCDCCHeader::CSCDCCHeader(const CSCDCCStatusDigi & digi)
00021 {
00022 memcpy(this, digi.header(), sizeInWords()*2);
00023 }
00024
00025
00026
00027 int CSCDCCHeader::getCDFEventNumber() const
00028 {
00029 return ((word[0]>>32)&0x00FFFFFF);
00030 }
00031
00032 int CSCDCCHeader::getCDFBunchCounter() const
00033 {
00034 return ((word[0]>>20)&0xFFF);
00035 }
00036 int CSCDCCHeader::getCDFSourceId() const
00037 {
00038 return ((word[0]>>8)&0xFFF);
00039 }
00040 int CSCDCCHeader::getCDFFOV() const
00041 {
00042 return ((word[0]>>4)&0xF);
00043 }
00044 int CSCDCCHeader::getCDFEventType() const
00045 {
00046 return ((word[0]>>56)&0xF);
00047 }
00048
00049
00050 void CSCDCCHeader::setDAV(int slot)
00051 {
00052
00053
00054
00055
00056 assert(slot>=3 && slot <= 13);
00057 int bit[] = {0, 0, 0, 2, 5, 7, 4, 6, 0, 7, 5, 2, 6, 4};
00058 word[0] |= 1 << bit[slot];
00059 }
00060
00061 std::ostream & operator<<(std::ostream & os, const CSCDCCHeader & hdr)
00062 {
00063 os << "DCC Header" << std::endl;
00064 return os;
00065 }
00066