#include <EventFilter/CSCRawToDigi/interface/CSCALCTHeader.h>
Public Types | |
enum | FIFO_MODE { NO_DUMP, FULL_DUMP, LOCAL_DUMP } |
some accessors here are only applicable to 2006 header some to both 2006 and 2007 More... | |
Public Member Functions | |
unsigned short int | ActiveFEBs () const |
void | add (const std::vector< CSCALCTDigi > &digis) |
std::vector< CSCALCTDigi > | ALCTDigis () const |
unsigned short int | alctFirmwareVersion () const |
CSCALCTHeader2006 | alctHeader2006 () const |
CSCALCTHeader2007 | alctHeader2007 () const |
unsigned short int | BoardID () const |
unsigned short int | BXNCount () const |
bool | check () const |
CSCALCTHeader (const CSCALCTStatusDigi &digi) | |
CSCALCTHeader (const unsigned short *buf) | |
for packing | |
CSCALCTHeader (int chamberType) | |
unsigned short int | CSCID () const |
unsigned short int * | data () |
unsigned short int | ExtTrig () const |
unsigned short int | FIFOMode () const |
unsigned short int | L1Acc () const |
unsigned short int | L1AMatch () const |
unsigned short int | LCTChipRead () const |
unsigned short int | nLCTChipRead () const |
for packing | |
unsigned short int | NTBins () const |
boost::dynamic_bitset | pack () |
unsigned short int | Promote1 () const |
unsigned short int | Promote2 () const |
void | setDAVForChannel (int wireGroup) |
void | setEventInformation (const CSCDMBHeader &) |
int | sizeInWords () |
in 16-bit words | |
Static Public Member Functions | |
static void | selfTest () |
tests that we unpack what we packed | |
static void | setDebug (bool value) |
to access data by via status digis | |
Private Attributes | |
std::vector< CSCALCT > | alcts |
CSCALCTs2006 | alcts2006 |
unsigned short int | bxn0 |
unsigned short int | bxn1 |
std::vector< CSCCollisionMask > | collisionMasks |
CSCConfigurationRegister | configRegister |
CSCALCTHeader2006 | header2006 |
CSCALCTHeader2007 | header2007 |
std::vector< CSCHotChannelMask > | hotChannelMasks |
unsigned short int | sizeInWords2007_ |
size of the 2007 header in words | |
unsigned short int | theOriginalBuffer [116] |
CSCVirtexID | virtexID |
Static Private Attributes | |
static bool | debug = false |
static unsigned short int | firmwareVersion = 2006 |
Definition at line 173 of file CSCALCTHeader.h.
some accessors here are only applicable to 2006 header some to both 2006 and 2007
Definition at line 192 of file CSCALCTHeader.h.
00192 {NO_DUMP, FULL_DUMP, LOCAL_DUMP};
CSCALCTHeader::CSCALCTHeader | ( | int | chamberType | ) | [explicit] |
Definition at line 11 of file CSCALCTHeader.cc.
References header2006, CSCALCTHeader2006::sizeInWords(), and theOriginalBuffer.
Referenced by CSCALCTHeader().
00012 : header2006(chamberType) 00013 { //constructor for digi->raw packing based on header2006 00014 memcpy(theOriginalBuffer, &header2006, header2006.sizeInWords()*2); 00015 00016 }
CSCALCTHeader::CSCALCTHeader | ( | const unsigned short * | buf | ) | [explicit] |
for packing
collision and hot channel masks are variable sized the sizes vary depending on type of the ALCT board number of words for various alct board types: 1 2 3 5 6
first determine the correct format
Now fill data
the header part
the alct0 and alct1
the fixed sized header part
now come the variable parts
2007 has LCTbins * 2 alct words
also store raw data buffer too; it is later returned by data() method
Definition at line 18 of file CSCALCTHeader.cc.
References alcts, alcts2006, CSCALCTHeader2007::boardType, collisionMasks, CSCALCTHeader2007::configPresent, configRegister, firmwareVersion, header2006, header2007, hotChannelMasks, i, CSCALCTHeader2007::lctBins, LogTrace, CSCVirtexID::sizeInWords(), CSCALCTHeader2006::sizeInWords(), CSCALCTHeader2007::sizeInWords(), sizeInWords(), CSCALCTs2006::sizeInWords(), CSCConfigurationRegister::sizeInWords(), sizeInWords2007_, theOriginalBuffer, and virtexID.
00018 { 00023 static unsigned short int collisionMaskWordcount[7] = { 8, 8,12,16,16,24,28}; 00024 static unsigned short int hotChannelMaskWordcount[7] = {18,18,24,36,36,48,60}; 00025 00026 00028 if (buf[0]==0xDB0A) { 00029 firmwareVersion=2007; 00030 } 00031 else if ( (buf[0]&0xF800)==0x6000 ) { 00032 firmwareVersion=2006; 00033 } 00034 else { 00035 edm::LogError("CSCALCTHeader|CSCRawToDigi") << "failed to determine ALCT firmware version!!"; 00036 } 00037 00038 LogTrace("CSCALCTHeader|CSCRawToDigi") << "firmware version - " << firmwareVersion; 00039 00041 switch (firmwareVersion) { 00042 case 2006: 00043 memcpy(&header2006, buf, header2006.sizeInWords()*2); 00044 buf +=header2006.sizeInWords(); 00045 memcpy(&alcts2006, buf, alcts2006.sizeInWords()*2); 00046 buf +=alcts2006.sizeInWords(); 00047 break; 00048 00049 case 2007: 00050 memcpy(&header2007, buf, header2007.sizeInWords()*2); 00051 buf +=header2007.sizeInWords(); 00052 sizeInWords2007_ = header2007.sizeInWords(); 00054 if (header2007.configPresent==1) { 00055 memcpy(&virtexID, buf, virtexID.sizeInWords()*2); 00056 buf +=virtexID.sizeInWords(); 00057 sizeInWords2007_ = virtexID.sizeInWords(); 00058 memcpy(&configRegister, buf, configRegister.sizeInWords()*2); 00059 buf +=configRegister.sizeInWords(); 00060 sizeInWords2007_ += configRegister.sizeInWords(); 00061 00062 collisionMasks.resize(collisionMaskWordcount[header2007.boardType]); 00063 for (unsigned int i=0; i<collisionMaskWordcount[header2007.boardType]; ++i){ 00064 memcpy(&collisionMasks[i], buf, collisionMasks[i].sizeInWords()*2); 00065 buf += collisionMasks[i].sizeInWords(); 00066 sizeInWords2007_ += collisionMasks[i].sizeInWords(); 00067 } 00068 00069 hotChannelMasks.resize(hotChannelMaskWordcount[header2007.boardType]); 00070 for (unsigned int i=0; i<hotChannelMaskWordcount[header2007.boardType]; ++i) { 00071 memcpy(&hotChannelMasks[i], buf, hotChannelMasks[i].sizeInWords()*2); 00072 buf += hotChannelMasks[i].sizeInWords(); 00073 sizeInWords2007_ += hotChannelMasks[i].sizeInWords(); 00074 } 00075 } 00076 00077 alcts.resize(header2007.lctBins*2); 00078 for (unsigned int i=0; i<header2007.lctBins*2; ++i) { 00079 memcpy(&alcts[i], buf, alcts[i].sizeInWords()*2); 00080 buf += alcts[i].sizeInWords(); 00081 sizeInWords2007_ += alcts[i].sizeInWords(); 00082 } 00083 break; 00084 00085 default: 00086 edm::LogError("CSCALCTHeader|CSCRawToDigi") 00087 <<"couldn't construct: ALCT firmware version is bad/not defined!"; 00088 break; 00089 } 00090 00092 if ((firmwareVersion==2006)||(firmwareVersion==2007)) 00093 memcpy(theOriginalBuffer, buf-sizeInWords(), sizeInWords()*2); 00094 00095 }
CSCALCTHeader::CSCALCTHeader | ( | const CSCALCTStatusDigi & | digi | ) |
Definition at line 98 of file CSCALCTHeader.cc.
References CSCALCTHeader(), and CSCALCTStatusDigi::header().
00098 { 00099 CSCALCTHeader(digi.header()); 00100 }
unsigned short int CSCALCTHeader::ActiveFEBs | ( | ) | const [inline] |
Definition at line 237 of file CSCALCTHeader.h.
References CSCALCTHeader2006::activeFEBs, and header2006.
00237 {return header2006.activeFEBs;}
void CSCALCTHeader::add | ( | const std::vector< CSCALCTDigi > & | digis | ) |
Definition at line 152 of file CSCALCTHeader.cc.
References CSCALCTs2006::add(), alcts2006, Exception, and firmwareVersion.
Referenced by CSCEventData::add().
00153 { 00154 if(firmwareVersion != 2006) { 00155 throw cms::Exception("CSCDigi2Raw") 00156 << "The ALCTDigis do not live in the ALCT header past the 2006 firmware version"; 00157 } 00158 alcts2006.add(digis); 00159 }
std::vector< CSCALCTDigi > CSCALCTHeader::ALCTDigis | ( | ) | const |
loop over all alct words
Definition at line 121 of file CSCALCTHeader.cc.
References CSCALCTs2006::ALCTDigis(), alcts, alcts2006, BXNCount(), firmwareVersion, i, HLT_VtxMuL3::result, and TrackValidation_HighPurity_cff::valid.
Referenced by CSCEventData::CSCEventData(), and cscdqm::EventProcessor::processCSC().
00122 { 00123 std::vector<CSCALCTDigi> result; 00124 result.reserve(alcts.size()); 00125 00126 switch (firmwareVersion) { 00127 case 2006: 00128 { 00129 result = alcts2006.ALCTDigis(); 00130 break; 00131 } 00132 case 2007: 00133 { 00134 for (unsigned int i=0; i<alcts.size(); ++i) { 00135 CSCALCTDigi digi(alcts[i].valid, alcts[i].quality, alcts[i].accel, alcts[i].pattern, 00136 alcts[i].keyWire, (int)i/2, i%2+1); 00137 result.push_back(digi); 00138 } 00139 break; 00140 } 00141 default: 00142 edm::LogError("CSCALCTHeader|CSCRawToDigi") 00143 <<"Empty Digis: ALCT firmware version is bad/not defined!"; 00144 break; 00145 } 00146 for(unsigned i = 0; i < result.size(); ++i) {result[i].setFullBX(BXNCount());} 00147 return result; 00148 00149 }
unsigned short int CSCALCTHeader::alctFirmwareVersion | ( | ) | const [inline] |
Definition at line 241 of file CSCALCTHeader.h.
References firmwareVersion.
00241 {return firmwareVersion;}
CSCALCTHeader2006 CSCALCTHeader::alctHeader2006 | ( | ) | const [inline] |
CSCALCTHeader2007 CSCALCTHeader::alctHeader2007 | ( | ) | const [inline] |
Definition at line 247 of file CSCALCTHeader.h.
References header2007.
Referenced by CSCAnodeData2007::init().
00247 {return header2007;}
unsigned short int CSCALCTHeader::BoardID | ( | ) | const [inline] |
Definition at line 207 of file CSCALCTHeader.h.
References CSCALCTHeader2006::boardID, and header2006.
00207 {return header2006.boardID;}
unsigned short int CSCALCTHeader::BXNCount | ( | ) | const [inline] |
Definition at line 210 of file CSCALCTHeader.h.
References CSCALCTHeader2006::bxnCount, CSCALCTHeader2007::bxnCount, firmwareVersion, header2006, and header2007.
Referenced by ALCTDigis(), and cscdqm::EventProcessor::processCSC().
00210 { 00211 switch (firmwareVersion) 00212 { 00213 case 2006: 00214 return header2006.bxnCount; 00215 case 2007: 00216 return header2007.bxnCount; 00217 default: 00218 edm::LogError("CSCALCTHeader|CSCRawToDigi") 00219 <<"trying to access BXNcount: ALCT firmware version is bad/not defined!"; 00220 return 0; 00221 } 00222 }
bool CSCALCTHeader::check | ( | ) | const [inline] |
Definition at line 267 of file CSCALCTHeader.h.
References firmwareVersion, CSCALCTHeader2007::flag1, CSCALCTHeader2006::flag_0, header2006, and header2007.
Referenced by CSCAnodeData2006::CSCAnodeData2006(), and CSCEventData::CSCEventData().
00267 { 00268 switch (firmwareVersion) 00269 { 00270 case 2006: 00271 return header2006.flag_0 == 0xC; 00272 case 2007: 00273 return header2007.flag1 == 0xDB0A; 00274 default: 00275 edm::LogError("CSCALCTHeader|CSCRawToDigi") 00276 <<"check(): ALCT firmware version is bad/not defined!"; 00277 return 0; 00278 } 00279 }
unsigned short int CSCALCTHeader::CSCID | ( | ) | const [inline] |
Definition at line 209 of file CSCALCTHeader.h.
References CSCALCTHeader2006::cscID, and header2006.
Referenced by operator<<().
00209 {return header2006.cscID;}
unsigned short int* CSCALCTHeader::data | ( | ) | [inline] |
Definition at line 250 of file CSCALCTHeader.h.
References theOriginalBuffer.
00250 {return theOriginalBuffer;}
unsigned short int CSCALCTHeader::ExtTrig | ( | ) | const [inline] |
Definition at line 208 of file CSCALCTHeader.h.
References CSCALCTHeader2006::extTrig, and header2006.
00208 {return header2006.extTrig;}
unsigned short int CSCALCTHeader::FIFOMode | ( | ) | const [inline] |
Definition at line 193 of file CSCALCTHeader.h.
References CSCALCTHeader2006::fifoMode, and header2006.
00193 {return header2006.fifoMode;}
unsigned short int CSCALCTHeader::L1Acc | ( | ) | const [inline] |
Definition at line 223 of file CSCALCTHeader.h.
References firmwareVersion, header2006, header2007, CSCALCTHeader2006::l1Acc, and CSCALCTHeader2007::l1aCounter.
Referenced by CSCMonitorModule::monitorCSC(), operator<<(), and cscdqm::EventProcessor::processCSC().
00223 { 00224 switch (firmwareVersion) 00225 { 00226 case 2006: 00227 return header2006.l1Acc; 00228 case 2007: 00229 return header2007.l1aCounter; 00230 default: 00231 edm::LogError("CSCALCTHeader|CSCRawToDigi") 00232 <<"trying to access L1Acc: ALCT firmware version is bad/not defined!"; 00233 return 0; 00234 } 00235 }
unsigned short int CSCALCTHeader::L1AMatch | ( | ) | const [inline] |
Definition at line 236 of file CSCALCTHeader.h.
References header2006, and CSCALCTHeader2006::l1aMatch.
00236 {return header2006.l1aMatch;}
unsigned short int CSCALCTHeader::LCTChipRead | ( | ) | const [inline] |
Definition at line 240 of file CSCALCTHeader.h.
References header2006, and CSCALCTHeader2006::lctChipRead.
00240 {return header2006.lctChipRead;}
unsigned short CSCALCTHeader::nLCTChipRead | ( | ) | const |
for packing
header2006 method
Definition at line 107 of file CSCALCTHeader.cc.
References firmwareVersion, header2006, and CSCALCTHeader2006::nLCTChipRead().
00107 { 00108 if(firmwareVersion == 2006) { 00109 return header2006.nLCTChipRead(); 00110 } 00111 else { 00112 // nLCTChip obsolete in ALCT2007 format (email Andrey K. & Victor B., 20.10.2008) 00113 // and we don't think anyone makes uses of this call. 00114 // edm::LogError("CSCALCTHeader|CSCRawToDigi") 00115 // <<"How is nLCTChipRead() supposed to work for ALCTHeader2007?"; 00116 } 00117 return 0; 00118 }
unsigned short int CSCALCTHeader::NTBins | ( | ) | const [inline] |
Definition at line 194 of file CSCALCTHeader.h.
References firmwareVersion, header2006, header2007, CSCALCTHeader2006::nTBins, and CSCALCTHeader2007::rawBins.
Referenced by operator<<().
00194 { 00195 switch (firmwareVersion) 00196 { 00197 case 2006: 00198 return header2006.nTBins; 00199 case 2007: 00200 return header2007.rawBins; 00201 default: 00202 edm::LogError("CSCALCTHeader|CSCRawToDigi") 00203 <<"trying to access NTBINs: ALCT firmware version is bad/not defined!"; 00204 return 0; 00205 } 00206 }
boost::dynamic_bitset CSCALCTHeader::pack | ( | ) |
Definition at line 162 of file CSCALCTHeader.cc.
References alcts, alcts2006, bitset_utilities::append(), firmwareVersion, header, header2006, HLT_VtxMuL3::result, CSCALCTHeader2006::sizeInWords(), CSCALCTs2006::sizeInWords(), and bitset_utilities::ushortToBitset().
Referenced by CSCEventData::pack().
00163 { 00164 boost::dynamic_bitset<> result; 00165 if(firmwareVersion == 2006) 00166 { 00167 boost::dynamic_bitset<> header 00168 = bitset_utilities::ushortToBitset(header2006.sizeInWords()*16, 00169 (unsigned short *) &header2006); 00170 boost::dynamic_bitset<> alcts 00171 = bitset_utilities::ushortToBitset(alcts2006.sizeInWords()*16, 00172 (unsigned short *) &alcts2006); 00173 result = bitset_utilities::append(header, alcts); 00174 00175 } 00176 return result; 00177 }
unsigned short int CSCALCTHeader::Promote1 | ( | ) | const [inline] |
Definition at line 238 of file CSCALCTHeader.h.
References header2006, and CSCALCTHeader2006::promote1.
00238 {return header2006.promote1;}
unsigned short int CSCALCTHeader::Promote2 | ( | ) | const [inline] |
Definition at line 239 of file CSCALCTHeader.h.
References header2006, and CSCALCTHeader2006::promote2.
00239 {return header2006.promote2;}
void CSCALCTHeader::selfTest | ( | ) | [static] |
tests that we unpack what we packed
Definition at line 181 of file CSCALCTHeader.cc.
References alcts, cscClassPackerCompare(), detId, and CSCDetId::iChamberType().
00182 { 00183 // tests packing and unpacking 00184 for(int station = 1; station <= 4; ++station) 00185 { 00186 CSCDetId detId(1, station, 1, 1, 0); 00187 CSCALCTDigi alct0(true, 1, 1, 1, 10, 6, 1); 00188 CSCALCTDigi alct1(true, 1, 1, 0, 11, 6, 2); 00189 00190 std::vector<CSCALCTDigi> oldAlcts; 00191 oldAlcts.push_back(alct0); 00192 oldAlcts.push_back(alct1); 00193 CSCALCTHeader alctHeader(detId.iChamberType()); 00194 00195 alctHeader.add(oldAlcts); 00196 00197 std::vector<CSCALCTDigi> alcts = alctHeader.ALCTDigis(); 00198 assert(alcts[0] == alct0); 00199 assert(alcts[1] == alct1); 00200 00201 cscClassPackerCompare(alctHeader); 00202 00203 } 00204 }
Definition at line 242 of file CSCALCTHeader.h.
References firmwareVersion, header2006, and CSCALCTHeader2006::setDAV().
Referenced by CSCEventData::add().
00242 { 00243 if(firmwareVersion == 2006) { 00244 header2006.setDAV((wireGroup-1)/16); 00245 } 00246 }
to access data by via status digis
turns on the debug flag for this class
Definition at line 182 of file CSCALCTHeader.h.
References debug.
Referenced by CSCDCCUnpacker::CSCDCCUnpacker().
void CSCALCTHeader::setEventInformation | ( | const CSCDMBHeader & | dmb | ) |
Definition at line 102 of file CSCALCTHeader.cc.
References header2006, and CSCALCTHeader2006::setEventInformation().
Referenced by CSCEventData::checkALCTClasses(), and CSCEventData::setEventInformation().
00102 { 00103 header2006.setEventInformation(dmb); 00104 }
int CSCALCTHeader::sizeInWords | ( | ) | [inline] |
in 16-bit words
Definition at line 253 of file CSCALCTHeader.h.
References firmwareVersion, and sizeInWords2007_.
Referenced by CSCEventData::checkALCTClasses(), CSCALCTHeader(), and CSCEventData::CSCEventData().
00253 { 00254 switch (firmwareVersion) 00255 { 00256 case 2006: 00257 return 8; 00258 case 2007: 00259 return sizeInWords2007_; 00260 default: 00261 edm::LogError("CSCALCTHeader|CSCRawToDigi") 00262 <<"SizeInWords(): ALCT firmware version is bad/not defined!"; 00263 return 0; 00264 } 00265 }
std::vector<CSCALCT> CSCALCTHeader::alcts [private] |
Definition at line 292 of file CSCALCTHeader.h.
Referenced by ALCTDigis(), CSCALCTHeader(), pack(), and selfTest().
CSCALCTs2006 CSCALCTHeader::alcts2006 [private] |
Definition at line 293 of file CSCALCTHeader.h.
Referenced by add(), ALCTDigis(), CSCALCTHeader(), and pack().
unsigned short int CSCALCTHeader::bxn0 [private] |
Definition at line 307 of file CSCALCTHeader.h.
unsigned short int CSCALCTHeader::bxn1 [private] |
Definition at line 307 of file CSCALCTHeader.h.
std::vector<CSCCollisionMask> CSCALCTHeader::collisionMasks [private] |
bool CSCALCTHeader::debug = false [static, private] |
short unsigned int CSCALCTHeader::firmwareVersion = 2006 [static, private] |
Definition at line 304 of file CSCALCTHeader.h.
Referenced by add(), ALCTDigis(), alctFirmwareVersion(), BXNCount(), check(), CSCALCTHeader(), L1Acc(), nLCTChipRead(), NTBins(), pack(), setDAVForChannel(), and sizeInWords().
CSCALCTHeader2006 CSCALCTHeader::header2006 [private] |
Definition at line 291 of file CSCALCTHeader.h.
Referenced by ActiveFEBs(), alctHeader2006(), BoardID(), BXNCount(), check(), CSCALCTHeader(), CSCID(), ExtTrig(), FIFOMode(), L1Acc(), L1AMatch(), LCTChipRead(), nLCTChipRead(), NTBins(), pack(), Promote1(), Promote2(), setDAVForChannel(), and setEventInformation().
CSCALCTHeader2007 CSCALCTHeader::header2007 [private] |
Definition at line 290 of file CSCALCTHeader.h.
Referenced by alctHeader2007(), BXNCount(), check(), CSCALCTHeader(), L1Acc(), and NTBins().
std::vector<CSCHotChannelMask> CSCALCTHeader::hotChannelMasks [private] |
unsigned short int CSCALCTHeader::sizeInWords2007_ [private] |
size of the 2007 header in words
Definition at line 307 of file CSCALCTHeader.h.
Referenced by CSCALCTHeader(), and sizeInWords().
unsigned short int CSCALCTHeader::theOriginalBuffer[116] [private] |
CSCVirtexID CSCALCTHeader::virtexID [private] |