This class implements.. More...
#include <interface/PixelROCMaskBits.h>
Public Member Functions | |
unsigned int | mask (unsigned int col, unsigned int row) const |
PixelROCName | name () const |
PixelROCMaskBits () | |
int | read (const PixelROCName &rocid, std::ifstream &in) |
int | read (const PixelROCName &rocid, std::istringstream &in) |
int | read (const PixelROCName &rocid, std::string in) |
int | readBinary (const PixelROCName &rocid, std::ifstream &in) |
void | setMask (unsigned int col, unsigned int row, unsigned int mask) |
void | setROCMaskBits (PixelROCName &rocid, std::string bits) |
void | writeASCII (std::ofstream &out) const |
void | writeBinary (std::ofstream &out) const |
void | writeXML (std::ofstream *out) const |
Private Attributes | |
unsigned char | bits_ [520] |
PixelROCName | rocid_ |
Friends | |
std::ostream & | operator<< (std::ostream &s, const PixelROCMaskBits &maskbits) |
This class implements..
A longer explanation will be placed here later
Definition at line 20 of file PixelROCMaskBits.h.
PixelROCMaskBits::PixelROCMaskBits | ( | ) |
Definition at line 18 of file PixelROCMaskBits.cc.
{ }
unsigned int PixelROCMaskBits::mask | ( | unsigned int | col, |
unsigned int | row | ||
) | const |
Definition at line 173 of file PixelROCMaskBits.cc.
Referenced by pos::PixelCalibConfiguration::enablePixels(), pos::PixelTrimAllPixels::generateConfiguration(), pos::PixelTrimCommon::generateConfiguration(), and writeASCII().
{ unsigned int tmp=bits_[col*10+row/8]; // std::cout << "c = " << col << "\tr = " << row << "\tbits_[" << (col*10+row/8) << "]=" << bits_[col*10+row/8] << std::endl ; // std::cout << "[PixelROCMaskBits::mask()] tmp iniziale " << tmp << std::endl ; tmp=tmp>>(row%8); // std::cout << "[PixelROCMaskBits::mask()] tmp finale " << tmp << std::endl ; // unsigned int res = tmp&0x01 ; // std::cout << "[PixelROCMaskBits::mask()] return value " << res << std::endl ; return tmp&0x01; }
PixelROCName pos::PixelROCMaskBits::name | ( | ) | const [inline] |
int PixelROCMaskBits::read | ( | const PixelROCName & | rocid, |
std::istringstream & | in | ||
) |
Definition at line 101 of file PixelROCMaskBits.cc.
References bits_, INSTR::byte, data, i, j, rocid_, AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.
{ rocid_=rocid; std::string tag; for (int i=0;i<52;i++) { in >> tag; //std::cout << "Now reading col:"<<tag<<std::endl; std::string data; in >> data; //std::cout <<"data.size()" <<data.size()<<std::endl; unsigned char byte=0; for(int j=0;j<80;j++) { if (data[j]=='1') byte+=128; if ((j+1)%8==0) { //std::cout << "Writing byte:"<<(int)byte<<std::endl; bits_[i*10+(j+1)/8-1]=byte; byte=0; } else { byte/=2; } } } return 1; }
int PixelROCMaskBits::read | ( | const PixelROCName & | rocid, |
std::string | in | ||
) |
int PixelROCMaskBits::read | ( | const PixelROCName & | rocid, |
std::ifstream & | in | ||
) |
Definition at line 57 of file PixelROCMaskBits.cc.
References bits_, INSTR::byte, data, i, j, rocid_, AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.
{ rocid_=rocid; std::string tag; for (int i=0;i<52;i++){ in >> tag; //std::cout << "Now reading col:"<<tag<<std::endl; std::string data; in >> data; //std::cout <<"data.size()" <<data.size()<<std::endl; unsigned char byte=0; for(int j=0;j<80;j++){ if (data[j]=='1') byte+=128; if ((j+1)%8==0) { //std::cout << "Writing byte:"<<(int)byte<<std::endl; bits_[i*10+(j+1)/8-1]=byte; byte=0; } else{ byte/=2; } } } return 1; }
int PixelROCMaskBits::readBinary | ( | const PixelROCName & | rocid, |
std::ifstream & | in | ||
) |
Definition at line 132 of file PixelROCMaskBits.cc.
Referenced by pos::PixelMaskAllPixels::PixelMaskAllPixels().
void PixelROCMaskBits::setMask | ( | unsigned int | col, |
unsigned int | row, | ||
unsigned int | mask | ||
) |
void PixelROCMaskBits::setROCMaskBits | ( | PixelROCName & | rocid, |
std::string | bits | ||
) |
Definition at line 23 of file PixelROCMaskBits.cc.
References bits_, gather_cfg::cout, i, rocid_, and AlCaHLTBitMon_QueryRunRegistry::string.
{ std::string mthn = "[PixelROCMaskBits::setROCMaskBits()]\t\t\t " ; try { rocid_=rocid; char cpt[520] ; bits.copy( cpt , 520); for(unsigned int i = 0 ; i < bits.size(); i++) { bits_[i] = (unsigned char)cpt[i]; // std::cout<< "bits_[" << i << "]\t" << bits_[i] <<std::endl; // std::cout<<rocid_<<std::endl; // std::cout.flags(std::ios::hex) } } catch(std::bad_cast) { std::cout << __LINE__ << "]\t" << mthn << "Error casting variable." << std::endl; } }
void PixelROCMaskBits::writeASCII | ( | std::ofstream & | out | ) | const |
Definition at line 156 of file PixelROCMaskBits.cc.
References mask(), rocid_, and pos::PixelROCName::rocname().
void PixelROCMaskBits::writeBinary | ( | std::ofstream & | out | ) | const |
void PixelROCMaskBits::writeXML | ( | std::ofstream * | out | ) | const |
Definition at line 225 of file PixelROCMaskBits.cc.
References base64_encode(), bits_, rocid_, pos::PixelROCName::rocname(), and AlCaHLTBitMon_QueryRunRegistry::string.
{ std::string mthn = "[PixelROCMaskBits::writeXML()]\t\t\t\t" ; std::string encoded = base64_encode(bits_, sizeof(bits_)); *out << " <DATA>" << std::endl ; *out << " <ROC_NAME>" << rocid_.rocname() << "</ROC_NAME>" << std::endl ; *out << " <KILL_MASK>" << encoded << "</KILL_MASK>" << std::endl ; *out << " </DATA>" << std::endl ; *out << " " << std::endl ; }
std::ostream& operator<< | ( | std::ostream & | s, |
const PixelROCMaskBits & | maskbits | ||
) | [friend] |
unsigned char pos::PixelROCMaskBits::bits_[520] [private] |
Definition at line 50 of file PixelROCMaskBits.h.
Referenced by mask(), read(), readBinary(), setMask(), setROCMaskBits(), writeBinary(), and writeXML().
PixelROCName pos::PixelROCMaskBits::rocid_ [private] |
Definition at line 49 of file PixelROCMaskBits.h.
Referenced by name(), read(), readBinary(), setROCMaskBits(), writeASCII(), writeBinary(), and writeXML().