01/20/05 A.Tumanov More...
#include <CSCDCCEventData.h>
Public Member Functions | |
void | addChamber (CSCEventData &chamber, int dduID, int dduSlot, int dduInput, int dmbID) |
bool | check () const |
for making events. Sets the bxnum and lvl1num inside the chamber event | |
CSCDCCEventData (unsigned short *buf, CSCDCCExaminer *examiner=NULL) | |
CSCDCCEventData (int sourceId, int nDDUs, int bx, int l1a) | |
CSCDCCHeader | dccHeader () const |
CSCDCCTrailer | dccTrailer () const |
const std::vector < CSCDDUEventData > & | dduData () const |
accessor to dduData | |
std::vector< CSCDDUEventData > & | dduData () |
boost::dynamic_bitset | pack () |
packs data into bits | |
int | sizeInWords () const |
~CSCDCCEventData () | |
Static Public Member Functions | |
static void | setDebug (bool value) |
Static Public Attributes | |
static bool | debug = false |
Protected Member Functions | |
void | unpack_data (unsigned short *buf, CSCDCCExaminer *examiner=NULL) |
Protected Attributes | |
CSCDCCHeader | theDCCHeader |
CSCDCCTrailer | theDCCTrailer |
std::vector< CSCDDUEventData > | theDDUData |
int | theSizeInWords |
01/20/05 A.Tumanov
Definition at line 13 of file CSCDCCEventData.h.
CSCDCCEventData::CSCDCCEventData | ( | int | sourceId, |
int | nDDUs, | ||
int | bx, | ||
int | l1a | ||
) |
Definition at line 17 of file CSCDCCEventData.cc.
References theDDUData.
: theDCCHeader(bx, l1a, sourceId) { theDDUData.reserve(nDDUs); }
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 23 of file CSCDCCEventData.cc.
References unpack_data().
{ unpack_data(buf, examiner); }
CSCDCCEventData::~CSCDCCEventData | ( | ) |
Definition at line 28 of file CSCDCCEventData.cc.
{ }
void CSCDCCEventData::addChamber | ( | CSCEventData & | chamber, |
int | dduID, | ||
int | dduSlot, | ||
int | dduInput, | ||
int | dmbID | ||
) |
Definition at line 106 of file CSCDCCEventData.cc.
References dccHeader(), i, CSCDCCHeader::setDAV(), and theDDUData.
{ // first, find this DDU std::vector<CSCDDUEventData>::iterator dduItr; int dduIndex = -1; int nDDUs = theDDUData.size(); for(int i = 0; dduIndex == -1 && i < nDDUs; ++i) { if(theDDUData[i].header().source_id() == dduID) dduIndex = i; } if(dduIndex == -1) { // make a new one CSCDDUHeader newDDUHeader(dccHeader().getCDFBunchCounter(), dccHeader().getCDFEventNumber(), dduID); theDDUData.push_back(CSCDDUEventData(newDDUHeader)); dduIndex = nDDUs; dccHeader().setDAV(dduSlot); } theDDUData[dduIndex].add( chamber, dmbID, dduInput ); }
bool CSCDCCEventData::check | ( | ) | const |
for making events. Sets the bxnum and lvl1num inside the chamber event
Definition at line 94 of file CSCDCCEventData.cc.
References CSCDCCHeader::check(), CSCDCCTrailer::check(), debug, LogTrace, sizeInWords(), theDCCHeader, and theDCCTrailer.
{ // the trailer counts in 64-bit words if (debug) { LogTrace ("CSCDCCEventData|CSCRawToDigi") << "size in Words () = " << std::dec << sizeInWords(); } return theDCCHeader.check() && theDCCTrailer.check(); }
CSCDCCHeader CSCDCCEventData::dccHeader | ( | ) | const [inline] |
Definition at line 28 of file CSCDCCEventData.h.
References theDCCHeader.
Referenced by addChamber().
{return theDCCHeader;}
CSCDCCTrailer CSCDCCEventData::dccTrailer | ( | ) | const [inline] |
Definition at line 29 of file CSCDCCEventData.h.
References theDCCTrailer.
Referenced by pack().
{return theDCCTrailer;}
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(), CSCOfflineMonitor::doBXMonitor(), CSCValidation::doTimeMonitoring(), and CSCChamberDataItr::next().
{return theDDUData;}
std::vector<CSCDDUEventData>& CSCDCCEventData::dduData | ( | ) | [inline] |
boost::dynamic_bitset CSCDCCEventData::pack | ( | ) |
packs data into bits
Definition at line 129 of file CSCDCCEventData.cc.
References python::multivaluedict::append(), CSCDCCHeader::data(), CSCDCCTrailer::data(), dccTrailer(), i, query::result, CSCDCCHeader::sizeInWords(), CSCDCCTrailer::sizeInWords(), theDCCHeader, theDCCTrailer, theDDUData, and bitset_utilities::ushortToBitset().
{ boost::dynamic_bitset<> result( theDCCHeader.sizeInWords()*16); result = bitset_utilities::ushortToBitset(theDCCHeader.sizeInWords()*16, theDCCHeader.data()); //std::cout <<"SANDRIK DCC size of header in words"<< theDCCHeader.sizeInWords()*16 <<std::endl; //std::cout <<"SANDRIK DCC size of header in bits"<< result.size()<<std::endl; //for(size_t i = 0; i < result.size(); ++i) { // std::cout<<result[i]; // if (((i+1)%32)==0) std::cout<<std::endl; //} for(size_t i = 0; i < theDDUData.size(); ++i) { result = bitset_utilities::append(result,theDDUData[i].pack()); //std::cout <<"SANDRIK here is ddu data check "; //theDDUData[i].header().check(); //std::cout <<std::endl; //bitset_utilities::printWords(result); } //std::cout <<"SANDRIK packed dcc size is "<<result.size()<<std::endl; //for(size_t i = 0; i < result.size(); ++i) { // std::cout<<result[i]; // if (((i+1)%32)==0) std::cout<<std::endl; //} boost::dynamic_bitset<> dccTrailer = bitset_utilities::ushortToBitset(theDCCTrailer.sizeInWords()*16, theDCCTrailer.data()); result = bitset_utilities::append(result,dccTrailer); // bitset_utilities::printWords(result); return result; }
static void CSCDCCEventData::setDebug | ( | bool | value | ) | [inline, static] |
Definition at line 22 of file CSCDCCEventData.h.
References debug, and relativeConstraints::value.
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().
{return theSizeInWords;}
void CSCDCCEventData::unpack_data | ( | unsigned short * | buf, |
CSCDCCExaminer * | examiner = NULL |
||
) | [protected] |
loop over DDUEventDatas
Definition at line 33 of file CSCDCCEventData.cc.
References CSCDDUEventData::check(), CSCDCCTrailer::check(), debug, LogTrace, CSCDCCHeader::sizeInWords(), CSCDDUEventData::sizeInWords(), CSCDCCTrailer::sizeInWords(), theDCCHeader, theDCCTrailer, and theDDUData.
Referenced by CSCDCCEventData().
{ /* for (int i=0;i<20;i++) { printf("%04x %04x %04x %04x\n",buf[i+3],buf[i+2],buf[i+1],buf[i]); i+=3; } */ theDDUData.clear(); if (debug) LogTrace ("CSCDCCEventData|CSCRawToDigi") << "CSCDCCEventData::unpack_data() is called"; // decode DCC header (128 bits) if (debug) LogTrace ("CSCDCCEventData|CSCRawToDigi") << "unpacking dcc header..."; memcpy(&theDCCHeader, buf, theDCCHeader.sizeInWords()*2); //theDCCHeader = CSCDCCHeader(buf); // direct unpacking instead of bitfields buf += theDCCHeader.sizeInWords(); //std::cout <<"Sandrik DCC Id = " << theDCCHeader.getCDFSourceId() << std::endl; while ( (buf[7]==0x8000)&&(buf[6]==0x0001)&&(buf[5]==0x8000)) { CSCDDUEventData dduEventData(buf, examiner); // CSCDDUEventData dduEventData(buf); if (debug) LogTrace ("CSCDCCEventData|CSCRawToDigi") << " checking ddu data integrity "; if (dduEventData.check()) { theDDUData.push_back(dduEventData); buf += dduEventData.sizeInWords(); } else { if (debug) LogTrace("CSCDCCEventData|CSCRawToDigi") <<"DDU Data Check failed! "; break; } } if (debug) { LogTrace ("CSCDCCEventData|CSCRawToDigi") << "unpacking dcc trailer "; LogTrace ("CSCDCCEventData|CSCRawToDigi") << std::hex << buf[3] <<" " << buf[2]<<" " << buf[1]<<" " << buf[0]; } //decode dcc trailer (128 bits) if (debug) LogTrace ("CSCDCCEventData|CSCRawToDigi") <<"decoding DCC trailer"; memcpy(&theDCCTrailer, buf, theDCCTrailer.sizeInWords()*2); if (debug) LogTrace("CSCDCCEventData|CSCRawToDigi") << "checking DDU Trailer" << theDCCTrailer.check(); buf += theDCCTrailer.sizeInWords(); //std::cout << " DCC Size: " << std::dec << theSizeInWords << std::endl; //std::cout << "LastBuf: " << std::hex << inputBuf[theSizeInWords-4] << std::endl; }
bool CSCDCCEventData::debug = false [static] |
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] |
Definition at line 55 of file CSCDCCEventData.h.
Referenced by sizeInWords().