![]() |
![]() |
#include <EventFilter/CSCRawToDigi/interface/CSCDCCEventData.h>
Public Member Functions | |
void | addChamber (CSCEventData &chamber, int dduID, int dduSlot, int dmbID) |
bool | check () const |
for making events. Sets the bxnum and lvl1num inside the chamber event | |
CSCDCCEventData (unsigned short *buf, CSCDCCExaminer *examiner=NULL) | |
buf may need to stay pinned in memory as long as this data is used. | |
CSCDCCEventData (int sourceId, int nDDUs, int bx, int l1a) | |
CSCDCCHeader | dccHeader () const |
CSCDCCTrailer | dccTrailer () const |
std::vector< CSCDDUEventData > & | dduData () |
const std::vector < CSCDDUEventData > & | dduData () const |
accessor to dduData | |
boost::dynamic_bitset | pack () |
packs data into bits | |
int | sizeInWords () const |
prints out the error associated with this status from the header or trailer | |
~CSCDCCEventData () | |
Static Public Member Functions | |
static void | setDebug (bool value) |
Static Public Attributes | |
static bool | debug = false |
CSCDCCEventData.cc 01/20/05 A.Tumanov. | |
Protected Member Functions | |
void | unpack_data (unsigned short *buf, CSCDCCExaminer *examiner=NULL) |
Protected Attributes | |
CSCDCCHeader | theDCCHeader |
CSCDCCTrailer | theDCCTrailer |
std::vector< CSCDDUEventData > | theDDUData |
int | theSizeInWords |
Definition at line 13 of file CSCDCCEventData.h.
Definition at line 13 of file CSCDCCEventData.cc.
References theDDUData.
00014 : theDCCHeader(bx, l1a, sourceId) 00015 { 00016 theDDUData.reserve(nDDUs); 00017 }
CSCDCCEventData::CSCDCCEventData | ( | unsigned short * | buf, | |
CSCDCCExaminer * | examiner = NULL | |||
) | [explicit] |
buf may need to stay pinned in memory as long as this data is used.
Not sure
Definition at line 19 of file CSCDCCEventData.cc.
References unpack_data().
00020 { 00021 unpack_data(buf, examiner); 00022 }
CSCDCCEventData::~CSCDCCEventData | ( | ) |
void CSCDCCEventData::addChamber | ( | CSCEventData & | chamber, | |
int | dduID, | |||
int | dduSlot, | |||
int | dmbID | |||
) |
Definition at line 96 of file CSCDCCEventData.cc.
References dccHeader(), header, i, CSCDCCHeader::setDAV(), and theDDUData.
00097 { 00098 // first, find this DDU 00099 std::vector<CSCDDUEventData>::iterator dduItr; 00100 int dduIndex = -1; 00101 int nDDUs = theDDUData.size(); 00102 for(int i = 0; dduIndex == -1 && i < nDDUs; ++i) 00103 { 00104 if(theDDUData[i].header().source_id() == dduID) dduIndex = i; 00105 } 00106 if(dduIndex == -1) 00107 { 00108 // make a new one 00109 CSCDDUHeader newDDUHeader(dccHeader().getCDFBunchCounter(), 00110 dccHeader().getCDFEventNumber(), dduID); 00111 theDDUData.push_back(CSCDDUEventData(newDDUHeader)); 00112 dduIndex = nDDUs; 00113 dccHeader().setDAV(dduSlot); 00114 } 00115 theDDUData[dduIndex].add(chamber, dmbID); 00116 }
bool CSCDCCEventData::check | ( | ) | const |
for making events. Sets the bxnum and lvl1num inside the chamber event
Definition at line 84 of file CSCDCCEventData.cc.
References CSCDCCHeader::check(), CSCDCCTrailer::check(), debug, LogTrace, sizeInWords(), theDCCHeader, and theDCCTrailer.
00085 { 00086 // the trailer counts in 64-bit words 00087 if (debug) 00088 { 00089 LogTrace ("CSCDCCEventData|CSCRawToDigi") << "size in Words () = " << std::dec << sizeInWords(); 00090 } 00091 00092 return theDCCHeader.check() && theDCCTrailer.check(); 00093 }
CSCDCCHeader CSCDCCEventData::dccHeader | ( | ) | const [inline] |
Definition at line 28 of file CSCDCCEventData.h.
References theDCCHeader.
Referenced by addChamber().
00028 {return theDCCHeader;}
CSCDCCTrailer CSCDCCEventData::dccTrailer | ( | ) | const [inline] |
Definition at line 29 of file CSCDCCEventData.h.
References theDCCTrailer.
Referenced by pack().
00029 {return theDCCTrailer;}
std::vector<CSCDDUEventData>& CSCDCCEventData::dduData | ( | ) | [inline] |
const std::vector<CSCDDUEventData>& CSCDCCEventData::dduData | ( | ) | const [inline] |
accessor to dduData
Definition at line 25 of file CSCDCCEventData.h.
References theDDUData.
Referenced by CSCChamberDataItr::CSCChamberDataItr(), CSCMonitorModule::monitorDCC(), and CSCChamberDataItr::next().
00025 {return theDDUData;}
boost::dynamic_bitset CSCDCCEventData::pack | ( | ) |
packs data into bits
Definition at line 119 of file CSCDCCEventData.cc.
References bitset_utilities::append(), CSCDCCHeader::data(), CSCDCCTrailer::data(), dccTrailer(), i, HLT_VtxMuL3::result, CSCDCCHeader::sizeInWords(), CSCDCCTrailer::sizeInWords(), theDCCHeader, theDCCTrailer, theDDUData, and bitset_utilities::ushortToBitset().
00120 { 00121 boost::dynamic_bitset<> result( theDCCHeader.sizeInWords()*16); 00122 result = bitset_utilities::ushortToBitset(theDCCHeader.sizeInWords()*16, theDCCHeader.data()); 00123 //std::cout <<"SANDRIK DCC size of header in words"<< theDCCHeader.sizeInWords()*16 <<std::endl; 00124 //std::cout <<"SANDRIK DCC size of header in bits"<< result.size()<<std::endl; 00125 //for(size_t i = 0; i < result.size(); ++i) { 00126 // std::cout<<result[i]; 00127 // if (((i+1)%32)==0) std::cout<<std::endl; 00128 //} 00129 00130 for(size_t i = 0; i < theDDUData.size(); ++i) 00131 { 00132 result = bitset_utilities::append(result,theDDUData[i].pack()); 00133 //std::cout <<"SANDRIK here is ddu data check "; 00134 //theDDUData[i].header().check(); 00135 //std::cout <<std::endl; 00136 //bitset_utilities::printWords(result); 00137 } 00138 00139 //std::cout <<"SANDRIK packed dcc size is "<<result.size()<<std::endl; 00140 //for(size_t i = 0; i < result.size(); ++i) { 00141 // std::cout<<result[i]; 00142 // if (((i+1)%32)==0) std::cout<<std::endl; 00143 //} 00144 00145 boost::dynamic_bitset<> dccTrailer = bitset_utilities::ushortToBitset(theDCCTrailer.sizeInWords()*16, 00146 theDCCTrailer.data()); 00147 result = bitset_utilities::append(result,dccTrailer); 00148 // bitset_utilities::printWords(result); 00149 return result; 00150 }
Definition at line 22 of file CSCDCCEventData.h.
References debug.
Referenced by CSCDCCUnpacker::CSCDCCUnpacker().
int CSCDCCEventData::sizeInWords | ( | ) | const [inline] |
prints out the error associated with this status from the header or trailer
Definition at line 39 of file CSCDCCEventData.h.
References theSizeInWords.
Referenced by check().
00039 {return theSizeInWords;}
void CSCDCCEventData::unpack_data | ( | unsigned short * | buf, | |
CSCDCCExaminer * | examiner = NULL | |||
) | [protected] |
loop over DDUEventDatas
Definition at line 29 of file CSCDCCEventData.cc.
References CSCDDUEventData::check(), CSCDCCTrailer::check(), debug, LogTrace, CSCDCCHeader::sizeInWords(), CSCDDUEventData::sizeInWords(), CSCDCCTrailer::sizeInWords(), theDCCHeader, theDCCTrailer, and theDDUData.
Referenced by CSCDCCEventData().
00030 { 00031 //for (int i=0;i<200;i++) { 00032 // printf("%04x %04x %04x %04x\n",buf[i+3],buf[i+2],buf[i+1],buf[i]); 00033 // i+=3; 00034 //} 00035 theDDUData.clear(); 00036 if (debug) 00037 LogTrace ("CSCDCCEventData|CSCRawToDigi") << "CSCDCCEventData::unpack_data() is called"; 00038 00039 // decode DCC header (128 bits) 00040 if (debug) 00041 LogTrace ("CSCDCCEventData|CSCRawToDigi") << "unpacking dcc header..."; 00042 memcpy(&theDCCHeader, buf, theDCCHeader.sizeInWords()*2); 00043 //theDCCHeader = CSCDCCHeader(buf); // direct unpacking instead of bitfields 00044 buf += theDCCHeader.sizeInWords(); 00045 00046 //std::cout <<"Sandrik DCC Id = " << theDCCHeader.getCDFSourceId() << std::endl; 00047 00049 while ( (buf[7]==0x8000)&&(buf[6]==0x0001)&&(buf[5]==0x8000)) 00050 { 00051 CSCDDUEventData dduEventData(buf, examiner); 00052 // CSCDDUEventData dduEventData(buf); 00053 00054 if (debug) LogTrace ("CSCDCCEventData|CSCRawToDigi") << " checking ddu data integrity "; 00055 if (dduEventData.check()) 00056 { 00057 theDDUData.push_back(dduEventData); 00058 buf += dduEventData.sizeInWords(); 00059 } 00060 else 00061 { 00062 if (debug) LogTrace("CSCDCCEventData|CSCRawToDigi") <<"DDU Data Check failed! "; 00063 break; 00064 } 00065 00066 } 00067 00068 if (debug) 00069 { 00070 LogTrace ("CSCDCCEventData|CSCRawToDigi") << "unpacking dcc trailer "; 00071 LogTrace ("CSCDCCEventData|CSCRawToDigi") << std::hex << buf[3] <<" " 00072 << buf[2]<<" " << buf[1]<<" " << buf[0]; 00073 } 00074 00075 //decode dcc trailer (128 bits) 00076 if (debug) LogTrace ("CSCDCCEventData|CSCRawToDigi") <<"decoding DCC trailer"; 00077 memcpy(&theDCCTrailer, buf, theDCCTrailer.sizeInWords()*2); 00078 if (debug) LogTrace("CSCDCCEventData|CSCRawToDigi") << "checking DDU Trailer" << theDCCTrailer.check(); 00079 buf += theDCCTrailer.sizeInWords(); 00080 00081 }
bool CSCDCCEventData::debug = false [static] |
CSCDCCEventData.cc 01/20/05 A.Tumanov.
Definition at line 46 of file CSCDCCEventData.h.
Referenced by check(), setDebug(), and unpack_data().
CSCDCCHeader CSCDCCEventData::theDCCHeader [protected] |
Definition at line 51 of file CSCDCCEventData.h.
Referenced by check(), dccHeader(), pack(), and unpack_data().
CSCDCCTrailer CSCDCCEventData::theDCCTrailer [protected] |
Definition at line 54 of file CSCDCCEventData.h.
Referenced by check(), dccTrailer(), pack(), and unpack_data().
std::vector<CSCDDUEventData> CSCDCCEventData::theDDUData [protected] |
Definition at line 53 of file CSCDCCEventData.h.
Referenced by addChamber(), CSCDCCEventData(), dduData(), pack(), and unpack_data().
int CSCDCCEventData::theSizeInWords [protected] |