CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/EventFilter/CSCRawToDigi/src/CSCDCCHeader.cc

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