#include <EventFilter/EcalTBRawToDigi/src/DCCXtalBlock.h>
Public Member Functions | |
void | dataCheck () |
DCCTBXtalBlock (DCCTBDataParser *parser, ulong *buffer, ulong numbBytes, ulong wordsToEnd, ulong wordEventOffset, ulong expectedXtalID, ulong expectedStripID) | |
int | stripID () |
std::vector< int > | xtalDataSamples () |
int | xtalID () |
Protected Types | |
enum | xtalBlockFields { BPOSITION_BLOCKID = 30, BLOCKID = 3 } |
Protected Member Functions | |
void | increment (ulong numb) |
Protected Attributes | |
ulong | expectedStripID_ |
ulong | expectedXtalID_ |
Definition at line 10 of file DCCXtalBlock.h.
enum DCCTBXtalBlock::xtalBlockFields [protected] |
DCCTBXtalBlock::DCCTBXtalBlock | ( | DCCTBDataParser * | parser, | |
ulong * | buffer, | |||
ulong | numbBytes, | |||
ulong | wordsToEnd, | |||
ulong | wordEventOffset, | |||
ulong | expectedXtalID, | |||
ulong | expectedStripID | |||
) |
Definition at line 6 of file DCCXtalBlock.cc.
References dataCheck(), DCCTBDataParser::debug(), DCCTBBlockPrototype::errors_, DCCTBDataParser::mapper(), DCCTBBlockPrototype::mapperFields_, DCCTBBlockPrototype::parseData(), DCCTBBlockPrototype::parser_, and DCCTBDataMapper::xtalFields().
00014 : DCCTBBlockPrototype(parser,"XTAL", buffer, numbBytes, wordsToEnd, wordEventOffset), 00015 expectedXtalID_(expectedXtalID), expectedStripID_(expectedStripID){ 00016 00017 00018 //Reset error counters //// 00019 errors_["XTAL::HEADER"] = 0; 00020 errors_["XTAL::BLOCKID"] = 0; 00022 00023 // Get data fields from the mapper and retrieve data ///////////////////////////////////// 00024 mapperFields_ = parser_->mapper()->xtalFields(); 00025 parseData(); 00027 00028 // check internal data //////////// 00029 if(parser_->debug()){ dataCheck();} 00031 00032 }
void DCCTBXtalBlock::dataCheck | ( | ) |
Definition at line 36 of file DCCXtalBlock.cc.
References DCCTBBlockPrototype::blockError_, DCCTBBlockPrototype::checkDataField(), DCCTBBlockPrototype::errors_, DCCTBBlockPrototype::errorString_, expectedStripID_, expectedXtalID_, DCCTBBlockPrototype::name_, and res.
Referenced by DCCTBXtalBlock().
00036 { 00037 00038 std::string checkErrors(""); 00039 00040 std::pair <bool,std::string> res; 00041 00042 00043 if(expectedXtalID_ !=0){ 00044 res = checkDataField("XTAL ID",expectedXtalID_); 00045 if(!res.first){ checkErrors += res.second; (errors_["XTAL::HEADER"])++; } 00046 } 00047 if(expectedStripID_!=0){ 00048 res = checkDataField("STRIP ID",expectedStripID_); 00049 if(!res.first){ checkErrors += res.second; (errors_["XTAL::HEADER"])++; } 00050 } 00051 if(checkErrors!=""){ 00052 errorString_ +="\n ======================================================================\n"; 00053 errorString_ += std::string(" ") + name_ + std::string(" data fields checks errors : ") ; 00054 errorString_ += checkErrors ; 00055 errorString_ += "\n ======================================================================"; 00056 blockError_ = true; 00057 } 00058 00059 }
void DCCTBXtalBlock::increment | ( | ulong | numb | ) | [protected] |
Definition at line 62 of file DCCXtalBlock.cc.
References BLOCKID, BPOSITION_BLOCKID, counter(), DCCTBBlockPrototype::dataP_, DCCTBDataParser::debug(), DCCTBBlockPrototype::errors_, DCCTBBlockPrototype::increment(), DCCTBBlockPrototype::parser_, and DCCTBBlockPrototype::wordCounter_.
00062 { 00063 if(!parser_->debug()){ DCCTBBlockPrototype::increment(numb); } 00064 else { 00065 for(ulong counter=0; counter<numb; counter++, dataP_++,wordCounter_++){ 00066 ulong blockID = (*dataP_)>>BPOSITION_BLOCKID; 00067 if( blockID != BLOCKID ){ 00068 (errors_["XTAL::BLOCKID"])++; 00069 //errorString_ += std::string("\n") + parser_->index(nunb)+(" blockId has value ") + parser_->getDecString(blockID); 00070 //errorString += std::string(", while ")+parser_->getDecString(BLOCKID)+std::string(" is expected"); 00071 } 00072 } 00073 } 00074 }
int DCCTBXtalBlock::stripID | ( | ) |
Definition at line 94 of file DCCXtalBlock.cc.
References DCCTBBlockPrototype::getDataField(), it, DCCTBBlockPrototype::mapperFields_, and HLT_VtxMuL3::result.
00094 { 00095 int result=-1; 00096 00097 for(std::set<DCCTBDataField *,DCCTBDataFieldComparator>::iterator it = mapperFields_->begin(); it!= mapperFields_->end(); it++){ 00098 if ( (*it)->name() == "STRIP ID" ) 00099 result=getDataField( (*it)->name() ) ; 00100 00101 } 00102 00103 return result; 00104 00105 }
std::vector< int > DCCTBXtalBlock::xtalDataSamples | ( | ) |
Definition at line 109 of file DCCXtalBlock.cc.
References data, DCCTBBlockPrototype::getDataField(), DCCTBDataParser::getDecString(), i, DCCTBBlockPrototype::name(), DCCTBDataParser::numbXtalSamples(), and DCCTBBlockPrototype::parser_.
00109 { 00110 std::vector<int> data; 00111 00112 00113 for(unsigned int i=1;i <= parser_->numbXtalSamples();i++){ 00114 std::string name = std::string("ADC#") + parser_->getDecString(i); 00115 00116 data.push_back ( getDataField( name ) ); 00117 00118 } 00119 00120 return data; 00121 }
int DCCTBXtalBlock::xtalID | ( | ) |
Definition at line 76 of file DCCXtalBlock.cc.
References DCCTBBlockPrototype::getDataField(), it, DCCTBBlockPrototype::mapperFields_, and HLT_VtxMuL3::result.
00076 { 00077 00078 int result=-1; 00079 00080 for( std::set<DCCTBDataField *,DCCTBDataFieldComparator>::iterator 00081 it = mapperFields_->begin(); it!= mapperFields_->end(); it++){ 00082 00083 if ( (*it)->name() == "XTAL ID" ) 00084 result=getDataField( (*it)->name() ) ; 00085 00086 } 00087 00088 00089 00090 return result; 00091 00092 }
ulong DCCTBXtalBlock::expectedStripID_ [protected] |
ulong DCCTBXtalBlock::expectedXtalID_ [protected] |