#include <CSCTMBHeader.h>
Public Member Functions | |
void | add (const std::vector< CSCCLCTDigi > &digis) |
these methods need more brains to figure which one goes first | |
void | add (const std::vector< CSCCorrelatedLCTDigi > &digis) |
void | addALCT0 (const CSCALCTDigi &digi) |
void | addALCT1 (const CSCALCTDigi &digi) |
void | addCLCT0 (const CSCCLCTDigi &digi) |
Needed before data packing. | |
void | addCLCT1 (const CSCCLCTDigi &digi) |
void | addCorrelatedLCT0 (const CSCCorrelatedLCTDigi &digi) |
void | addCorrelatedLCT1 (const CSCCorrelatedLCTDigi &digi) |
uint16_t | ALCTMatchTime () const |
uint16_t | ALCTOnly () const |
uint16_t | Bxn0Diff () const |
uint16_t | Bxn1Diff () const |
uint16_t | BXNCount () const |
bool | check () const |
std::vector< CSCCLCTDigi > | CLCTDigis (uint32_t idlayer) |
returns CLCT digis | |
uint16_t | CLCTOnly () const |
std::vector< CSCCorrelatedLCTDigi > | CorrelatedLCTDigis (uint32_t idlayer) const |
returns CorrelatedLCT digis | |
CSCTMBHeader (const CSCTMBStatusDigi &digi) | |
CSCTMBHeader (const unsigned short *buf) | |
CSCTMBHeader (int firmwareVersion, int firmwareRevision) | |
unsigned short * | data () |
int | FirmwareVersion () const |
uint16_t | L1ANumber () const |
uint16_t | NCFEBs () const |
unsigned short int | NHeaderFrames () const |
uint16_t | NTBins () const |
void | setEventInformation (const CSCDMBHeader &dmbHeader) |
fills fields like bxn and l1a | |
uint16_t | sizeInBytes () const |
unsigned short int | sizeInWords () const |
CSCTMBHeader2006 | tmbHeader2006 () const |
CSCTMBHeader2007 | tmbHeader2007 () const |
will throw if the cast fails | |
uint16_t | TMBMatch () const |
Static Public Member Functions | |
static void | selfTest () |
tests that packing and unpacking give same results | |
static void | setDebug (const bool value) |
Private Attributes | |
int | theFirmwareVersion |
boost::shared_ptr < CSCVTMBHeaderFormat > | theHeaderFormat |
Static Private Attributes | |
static bool | debug = false |
Friends | |
std::ostream & | operator<< (std::ostream &os, const CSCTMBHeader &hdr) |
Definition at line 20 of file CSCTMBHeader.h.
CSCTMBHeader::CSCTMBHeader | ( | int | firmwareVersion, |
int | firmwareRevision | ||
) |
Definition at line 15 of file CSCTMBHeader.cc.
References theHeaderFormat.
: theHeaderFormat(), theFirmwareVersion(firmwareVersion) { if(firmwareVersion == 2006) { theHeaderFormat = boost::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2006()); } else if(firmwareVersion == 2007) { if(firmwareRevision >= 0x50c3) { theHeaderFormat = boost::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2007_rev0x50c3()); } else { theHeaderFormat = boost::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2007()); } } else { edm::LogError("CSCTMBHeader|CSCRawToDigi") <<"failed to determine TMB firmware version!!"; } }
CSCTMBHeader::CSCTMBHeader | ( | const CSCTMBStatusDigi & | digi | ) |
CSCTMBHeader::CSCTMBHeader | ( | const unsigned short * | buf | ) |
first determine the format
Definition at line 44 of file CSCTMBHeader.cc.
References theFirmwareVersion, and theHeaderFormat.
: theHeaderFormat() { if (buf[0]==0xDB0C) { theFirmwareVersion=2007; theHeaderFormat = boost::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2007(buf)); if(theHeaderFormat->firmwareRevision() >= 0x50c3) { theHeaderFormat = boost::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2007_rev0x50c3(buf)); } } else if (buf[0]==0x6B0C) { theFirmwareVersion=2006; theHeaderFormat = boost::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2006(buf)); } else { edm::LogError("CSCTMBHeader|CSCRawToDigi") <<"failed to determine TMB firmware version!!"; } }
void CSCTMBHeader::add | ( | const std::vector< CSCCLCTDigi > & | digis | ) |
these methods need more brains to figure which one goes first
Definition at line 99 of file CSCTMBHeader.cc.
References addCLCT0(), and addCLCT1().
Referenced by CSCEventData::add().
void CSCTMBHeader::add | ( | const std::vector< CSCCorrelatedLCTDigi > & | digis | ) |
Definition at line 106 of file CSCTMBHeader.cc.
References addCorrelatedLCT0(), and addCorrelatedLCT1().
{ // sort??? if(digis.size() > 0) addCorrelatedLCT0(digis[0]); if(digis.size() > 1) addCorrelatedLCT1(digis[1]); }
void CSCTMBHeader::addALCT0 | ( | const CSCALCTDigi & | digi | ) | [inline] |
Definition at line 116 of file CSCTMBHeader.h.
References theHeaderFormat.
{theHeaderFormat->addALCT0(digi);}
void CSCTMBHeader::addALCT1 | ( | const CSCALCTDigi & | digi | ) | [inline] |
Definition at line 117 of file CSCTMBHeader.h.
References theHeaderFormat.
{theHeaderFormat->addALCT1(digi);}
void CSCTMBHeader::addCLCT0 | ( | const CSCCLCTDigi & | digi | ) | [inline] |
Needed before data packing.
for data packing
Definition at line 114 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by add(), and selfTest().
{theHeaderFormat->addCLCT0(digi);}
void CSCTMBHeader::addCLCT1 | ( | const CSCCLCTDigi & | digi | ) | [inline] |
Definition at line 115 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by add(), and selfTest().
{theHeaderFormat->addCLCT1(digi);}
void CSCTMBHeader::addCorrelatedLCT0 | ( | const CSCCorrelatedLCTDigi & | digi | ) | [inline] |
Definition at line 118 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by add(), and selfTest().
{ theHeaderFormat->addCorrelatedLCT0(digi); }
void CSCTMBHeader::addCorrelatedLCT1 | ( | const CSCCorrelatedLCTDigi & | digi | ) | [inline] |
Definition at line 121 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by add(), and selfTest().
{ theHeaderFormat->addCorrelatedLCT1(digi); }
uint16_t CSCTMBHeader::ALCTMatchTime | ( | ) | const [inline] |
Definition at line 39 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by CSCOfflineMonitor::doBXMonitor(), CSCValidation::doTimeMonitoring(), and cscdqm::EventProcessor::processCSC().
{ return theHeaderFormat->ALCTMatchTime(); }
uint16_t CSCTMBHeader::ALCTOnly | ( | ) | const [inline] |
Definition at line 45 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by cscdqm::EventProcessor::processCSC().
{ return theHeaderFormat->ALCTOnly(); }
uint16_t CSCTMBHeader::Bxn0Diff | ( | ) | const [inline] |
Definition at line 52 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by cscdqm::EventProcessor::processCSC().
{ return theHeaderFormat->Bxn0Diff(); }
uint16_t CSCTMBHeader::Bxn1Diff | ( | ) | const [inline] |
Definition at line 55 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by cscdqm::EventProcessor::processCSC().
{ return theHeaderFormat->Bxn1Diff(); }
uint16_t CSCTMBHeader::BXNCount | ( | ) | const [inline] |
Definition at line 36 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by CSCOfflineMonitor::doBXMonitor(), CSCValidation::doTimeMonitoring(), and cscdqm::EventProcessor::processCSC().
{ return theHeaderFormat->BXNCount(); }
bool CSCTMBHeader::check | ( | ) | const [inline] |
Definition at line 106 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by CSCTMBData::UnpackTMB().
{ return theHeaderFormat->check(); }
std::vector<CSCCLCTDigi> CSCTMBHeader::CLCTDigis | ( | uint32_t | idlayer | ) | [inline] |
returns CLCT digis
Definition at line 80 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by cscdqm::EventProcessor::processCSC(), selfTest(), and CSCEventData::selfTest().
{ return theHeaderFormat->CLCTDigis(idlayer); }
uint16_t CSCTMBHeader::CLCTOnly | ( | ) | const [inline] |
Definition at line 42 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by cscdqm::EventProcessor::processCSC().
{ return theHeaderFormat->CLCTOnly(); }
std::vector<CSCCorrelatedLCTDigi> CSCTMBHeader::CorrelatedLCTDigis | ( | uint32_t | idlayer | ) | const [inline] |
returns CorrelatedLCT digis
Definition at line 86 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by selfTest(), and CSCEventData::selfTest().
{ return theHeaderFormat->CorrelatedLCTDigis(idlayer); }
unsigned short* CSCTMBHeader::data | ( | ) | [inline] |
Definition at line 99 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by CSCTMBData::pack(), and selfTest().
{ return theHeaderFormat->data(); }
int CSCTMBHeader::FirmwareVersion | ( | ) | const [inline] |
Definition at line 33 of file CSCTMBHeader.h.
References theFirmwareVersion.
{return theFirmwareVersion;}
uint16_t CSCTMBHeader::L1ANumber | ( | ) | const [inline] |
Definition at line 59 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by cscdqm::EventProcessor::processCSC().
{ return theHeaderFormat->L1ANumber(); }
uint16_t CSCTMBHeader::NCFEBs | ( | ) | const [inline] |
Definition at line 74 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by CSCTMBData::UnpackTMB().
{ return theHeaderFormat->NCFEBs(); }
unsigned short int CSCTMBHeader::NHeaderFrames | ( | ) | const [inline] |
Definition at line 95 of file CSCTMBHeader.h.
References theHeaderFormat.
{ return theHeaderFormat->NHeaderFrames(); }
uint16_t CSCTMBHeader::NTBins | ( | ) | const [inline] |
Definition at line 71 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by CSCTMBData::UnpackTMB().
{ return theHeaderFormat->NTBins(); }
void CSCTMBHeader::selfTest | ( | ) | [static] |
tests that packing and unpacking give same results
Definition at line 134 of file CSCTMBHeader.cc.
References addCLCT0(), addCLCT1(), addCorrelatedLCT0(), addCorrelatedLCT1(), CLCTDigis(), CorrelatedLCTDigis(), gather_cfg::cout, cscPackerCompare(), data(), debug, DetId::rawId(), and relativeConstraints::station.
{ static bool debug = false; // tests packing and unpacking for(int station = 1; station <= 4; ++station) { for(int iendcap = 1; iendcap <= 2; ++iendcap) { CSCDetId detId(iendcap, station, 1, 1, 0); // the next-to-last is the BX, which only gets // saved in two bits and must be the same for clct0 and clct1. //CSCCLCTDigi clct0(1, 1, 4, 0, 0, 30, 3, 0, 1); // valid for 2006 // In 2007 firmware, there are no distrips, so the 4th argument (strip // type) should always be set to 1 (halfstrips). CSCCLCTDigi clct0(1, 1, 4, 1, 0, 30, 4, 2, 1); // valid for 2007 CSCCLCTDigi clct1(1, 1, 2, 1, 1, 31, 1, 2, 2); // BX of LCT (8th argument) is 1-bit word (the least-significant bit // of ALCT's bx). CSCCorrelatedLCTDigi lct0(1, 1, 2, 10, 98, 5, 0, 1, 0, 0, 0, 0); CSCCorrelatedLCTDigi lct1(2, 1, 2, 20, 15, 9, 1, 0, 0, 0, 0, 0); CSCTMBHeader tmbHeader(2007, 0x50c3); tmbHeader.addCLCT0(clct0); tmbHeader.addCLCT1(clct1); tmbHeader.addCorrelatedLCT0(lct0); tmbHeader.addCorrelatedLCT1(lct1); std::vector<CSCCLCTDigi> clcts = tmbHeader.CLCTDigis(detId.rawId()); // guess they got reordered assert(cscPackerCompare(clcts[0],clct0)); assert(cscPackerCompare(clcts[1],clct1)); if (debug) { std::cout << "Match for: " << clct0 << "\n"; std::cout << " " << clct1 << "\n \n"; } std::vector<CSCCorrelatedLCTDigi> lcts = tmbHeader.CorrelatedLCTDigis(detId.rawId()); assert(cscPackerCompare(lcts[0], lct0)); assert(cscPackerCompare(lcts[1], lct1)); if (debug) { std::cout << "Match for: " << lct0 << "\n"; std::cout << " " << lct1 << "\n"; } // try packing and re-packing, to make sure they're the same unsigned short int * data = tmbHeader.data(); CSCTMBHeader newHeader(data); clcts = newHeader.CLCTDigis(detId.rawId()); assert(cscPackerCompare(clcts[0],clct0)); assert(cscPackerCompare(clcts[1],clct1)); lcts = newHeader.CorrelatedLCTDigis(detId.rawId()); assert(cscPackerCompare(lcts[0], lct0)); assert(cscPackerCompare(lcts[1], lct1)); } } }
static void CSCTMBHeader::setDebug | ( | const bool | value | ) | [inline, static] |
turns on/off debug flag for this class
Definition at line 104 of file CSCTMBHeader.h.
References debug, and relativeConstraints::value.
Referenced by CSCDCCUnpacker::CSCDCCUnpacker().
void CSCTMBHeader::setEventInformation | ( | const CSCDMBHeader & | dmbHeader | ) | [inline] |
fills fields like bxn and l1a
Definition at line 28 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by CSCEventData::checkTMBClasses(), and CSCEventData::setEventInformation().
{ theHeaderFormat->setEventInformation(dmbHeader); }
uint16_t CSCTMBHeader::sizeInBytes | ( | ) | const [inline] |
Definition at line 63 of file CSCTMBHeader.h.
References theHeaderFormat.
{ return theHeaderFormat->sizeInWords()*2; }
unsigned short int CSCTMBHeader::sizeInWords | ( | ) | const [inline] |
in 16-bit words. Add olne because we include beginning(b0c) and end (e0c) flags
Definition at line 93 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by CSCTMBData::pack(), and CSCTMBData::UnpackTMB().
{return theHeaderFormat->sizeInWords();}
CSCTMBHeader2006 CSCTMBHeader::tmbHeader2006 | ( | ) | const |
Definition at line 124 of file CSCTMBHeader.cc.
References Exception, query::result, and theHeaderFormat.
{ CSCTMBHeader2006 * result = dynamic_cast<CSCTMBHeader2006 *>(theHeaderFormat.get()); if(result == 0) { throw cms::Exception("Could not get 2006 TMB header format"); } return *result; }
CSCTMBHeader2007 CSCTMBHeader::tmbHeader2007 | ( | ) | const |
will throw if the cast fails
Definition at line 114 of file CSCTMBHeader.cc.
References Exception, query::result, and theHeaderFormat.
{ CSCTMBHeader2007 * result = dynamic_cast<CSCTMBHeader2007 *>(theHeaderFormat.get()); if(result == 0) { throw cms::Exception("Could not get 2007 TMB header format"); } return *result; }
uint16_t CSCTMBHeader::TMBMatch | ( | ) | const [inline] |
Definition at line 48 of file CSCTMBHeader.h.
References theHeaderFormat.
Referenced by cscdqm::EventProcessor::processCSC().
{ return theHeaderFormat->TMBMatch(); }
std::ostream& operator<< | ( | std::ostream & | os, |
const CSCTMBHeader & | hdr | ||
) | [friend] |
Definition at line 194 of file CSCTMBHeader.cc.
{ hdr.theHeaderFormat->print(os); return os; }
bool CSCTMBHeader::debug = false [static, private] |
Definition at line 139 of file CSCTMBHeader.h.
Referenced by selfTest(), and setDebug().
int CSCTMBHeader::theFirmwareVersion [private] |
Definition at line 142 of file CSCTMBHeader.h.
Referenced by CSCTMBHeader(), and FirmwareVersion().
boost::shared_ptr<CSCVTMBHeaderFormat> CSCTMBHeader::theHeaderFormat [private] |
Definition at line 141 of file CSCTMBHeader.h.
Referenced by addALCT0(), addALCT1(), addCLCT0(), addCLCT1(), addCorrelatedLCT0(), addCorrelatedLCT1(), ALCTMatchTime(), ALCTOnly(), Bxn0Diff(), Bxn1Diff(), BXNCount(), check(), CLCTDigis(), CLCTOnly(), CorrelatedLCTDigis(), CSCTMBHeader(), data(), L1ANumber(), NCFEBs(), NHeaderFrames(), NTBins(), operator<<(), setEventInformation(), sizeInBytes(), sizeInWords(), tmbHeader2006(), tmbHeader2007(), and TMBMatch().