![]() |
![]() |
#include <interface/PixelMaskAllPixels.h>
Public Member Functions | |
void | addROCMaskBits (PixelROCMaskBits) |
PixelROCMaskBits * | getMaskBits (PixelROCName name) |
const PixelROCMaskBits & | getMaskBits (int ROCId) const |
PixelMaskAllPixels () | |
PixelMaskAllPixels (std::vector< std::vector< std::string > > &tableMat) | |
PixelMaskAllPixels (std::string filename) | |
PixelMaskCommon (std::string filename) | |
void | writeASCII (std::string filename) const |
void | writeASCII (std::string dir) const |
void | writeBinary (std::string filename) const |
void | writeBinary (std::string filename) const |
virtual void | writeXML (std::ofstream *out) const |
void | writeXML (pos::PixelConfigKey key, int version, std::string path) const |
virtual void | writeXML (std::ofstream *out) const |
void | writeXML (pos::PixelConfigKey key, int version, std::string path) const |
virtual void | writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const |
virtual void | writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const |
virtual void | writeXMLTrailer (std::ofstream *out) const |
virtual void | writeXMLTrailer (std::ofstream *out) const |
Private Attributes | |
std::vector< bool > | maskbits_ |
std::vector< PixelROCMaskBits > | maskbits_ |
std::vector< PixeROCName > | rocname_ |
This class implements..
" "
A longer explanation will be placed here later
Definition at line 23 of file PixelMaskAllPixels.h.
PixelMaskAllPixels::PixelMaskAllPixels | ( | std::string | filename | ) |
Definition at line 90 of file PixelMaskAllPixels.cc.
References c, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), i, in, maskbits_, pos::PixelROCMaskBits::read(), pos::PixelROCMaskBits::readBinary(), s1, ecalRecalibSequence_cff::tag, and tmp.
00090 : 00091 PixelMaskBase("","",""){ 00092 00093 if (filename[filename.size()-1]=='t'){ 00094 00095 00096 std::ifstream in(filename.c_str()); 00097 00098 if (!in.good()){ 00099 std::cout << "Could not open:"<<filename<<std::endl; 00100 assert(0); 00101 } 00102 00103 std::string tag; 00104 in >> tag; 00105 00106 maskbits_.clear(); 00107 00108 while (!in.eof()) { 00109 00110 PixelROCName rocid(in); 00111 00112 PixelROCMaskBits tmp; 00113 00114 tmp.read(rocid,in); 00115 00116 maskbits_.push_back(tmp); 00117 00118 in >> tag; 00119 00120 } 00121 00122 in.close(); 00123 00124 } 00125 else{ 00126 00127 std::ifstream in(filename.c_str(),std::ios::binary); 00128 00129 char nchar; 00130 00131 in.read(&nchar,1); 00132 00133 //in >> nchar; 00134 00135 std::string s1; 00136 00137 //wrote these lines of code without ref. needs to be fixed 00138 for(int i=0;i< nchar; i++){ 00139 char c; 00140 in >>c; 00141 s1.push_back(c); 00142 } 00143 00144 //std::cout << "READ ROC name:"<<s1<<std::endl; 00145 00146 maskbits_.clear(); 00147 00148 00149 while (!in.eof()){ 00150 00151 //std::cout << "PixelMaskAllPixels::PixelMaskAllPixels read s1:"<<s1<<std::endl; 00152 00153 PixelROCName rocid(s1); 00154 00155 //std::cout << "PixelMaskAllPixels::PixelMaskAllPixels read rocid:"<<rocid<<std::endl; 00156 00157 PixelROCMaskBits tmp; 00158 00159 tmp.readBinary(rocid, in); 00160 00161 maskbits_.push_back(tmp); 00162 00163 00164 in.read(&nchar,1); 00165 00166 s1.clear(); 00167 00168 if (in.eof()) continue; 00169 00170 //std::cout << "Will read:"<<(int)nchar<<" characters."<<std::endl; 00171 00172 //wrote these lines of code without ref. needs to be fixed 00173 for(int i=0;i< nchar; i++){ 00174 char c; 00175 in >>c; 00176 //std::cout <<" "<<c; 00177 s1.push_back(c); 00178 } 00179 //std::cout << std::endl; 00180 00181 00182 } 00183 00184 in.close(); 00185 00186 00187 00188 } 00189 00190 00191 //std::cout << "Read maskbits for "<<maskbits_.size()<<" ROCs"<<std::endl; 00192 00193 }
PixelMaskAllPixels::PixelMaskAllPixels | ( | std::vector< std::vector< std::string > > & | tableMat | ) |
Definition at line 23 of file PixelMaskAllPixels.cc.
References c, TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), maskbits_, n, r, pos::PixelROCMaskBits::read(), and tmp.
00023 : PixelMaskBase("","","") 00024 { 00025 00026 std::cout<<"Table Size in const:"<<tableMat.size()<<std::endl; 00027 00028 std::vector< std::string > ins = tableMat[0]; 00029 std::map<std::string , int > colM; 00030 std::vector<std::string > colNames; 00031 00032 colNames.push_back("CONFIG_KEY_ID" ); 00033 colNames.push_back("CONFG_KEY" ); 00034 colNames.push_back("VERSION" ); 00035 colNames.push_back("KIND_OF_COND" ); 00036 colNames.push_back("ROC_NAME" ); 00037 colNames.push_back("HUB_ADDRS" ); 00038 colNames.push_back("PORT_NUMBER" ); 00039 colNames.push_back("ROC_I2C_ADDR" ); 00040 colNames.push_back("GEOM_ROC_NUM" ); 00041 colNames.push_back("DATA_FILE" ); 00042 colNames.push_back("MASK_CLOB" ); 00043 00044 00045 00046 for(unsigned int c = 0 ; c < ins.size() ; c++) 00047 { 00048 for(unsigned int n=0; n<colNames.size(); n++) 00049 { 00050 if(tableMat[0][c] == colNames[n]) 00051 { 00052 colM[colNames[n]] = c; 00053 break; 00054 } 00055 } 00056 }//end for 00057 for(unsigned int n=0; n<colNames.size(); n++) 00058 { 00059 if(colM.find(colNames[n]) == colM.end()) 00060 { 00061 std::cerr << "[PixelMaskAllPixels::PixelMaskAllPixels()]\tCouldn't find in the database the column with name " << colNames[n] << std::endl; 00062 assert(0); 00063 } 00064 } 00065 00066 for(unsigned int r = 1 ; r < tableMat.size() ; r++){ //Goes to every row of the Matrix 00067 std::string currentRocName = tableMat[r][colM["ROC_NAME"]] ; 00068 PixelROCName rocid(currentRocName); 00069 PixelROCMaskBits tmp; 00070 std::istringstream istring ; 00071 istring.str(tableMat[r][colM["MASK_CLOB"]]) ; 00072 tmp.read(rocid,istring); 00073 maskbits_.push_back(tmp); 00074 }//end for r 00075 //std::cout<<maskbits_.size()<<std::endl; 00076 }
PixelMaskAllPixels::PixelMaskAllPixels | ( | ) |
void PixelMaskAllPixels::addROCMaskBits | ( | PixelROCMaskBits | bits | ) |
Definition at line 81 of file PixelMaskAllPixels.cc.
References maskbits_.
00082 { 00083 maskbits_.push_back(bits); 00084 }
PixelROCMaskBits * PixelMaskAllPixels::getMaskBits | ( | PixelROCName | name | ) | [virtual] |
const PixelROCMaskBits & PixelMaskAllPixels::getMaskBits | ( | int | ROCId | ) | const [virtual] |
Implements pos::PixelMaskBase.
Definition at line 195 of file PixelMaskAllPixels.cc.
References maskbits_.
00195 { 00196 00197 return maskbits_[ROCId]; 00198 00199 }
pos::PixelMaskAllPixels::PixelMaskCommon | ( | std::string | filename | ) |
void pos::PixelMaskAllPixels::writeASCII | ( | std::string | filename | ) | const [virtual] |
Implements pos::PixelMaskBase.
void PixelMaskAllPixels::writeASCII | ( | std::string | dir | ) | const [virtual] |
Implements pos::PixelMaskBase.
Definition at line 224 of file PixelMaskAllPixels.cc.
References EgammaValidation_cff::filename, i, maskbits_, module(), pos::PixelModuleName::modulename(), name, and out.
00224 { 00225 00226 if (dir!="") dir+="/"; 00227 PixelModuleName module(maskbits_[0].name().rocname()); 00228 std::string filename=dir+"ROC_Masks_module_"+module.modulename()+".dat"; 00229 00230 std::ofstream out(filename.c_str()); 00231 00232 for(unsigned int i=0;i<maskbits_.size();i++){ 00233 maskbits_[i].writeASCII(out); 00234 } 00235 00236 00237 }
void pos::PixelMaskAllPixels::writeBinary | ( | std::string | filename | ) | const [virtual] |
Implements pos::PixelMaskBase.
void PixelMaskAllPixels::writeBinary | ( | std::string | filename | ) | const [virtual] |
Implements pos::PixelMaskBase.
Definition at line 211 of file PixelMaskAllPixels.cc.
References i, maskbits_, and out.
00211 { 00212 00213 00214 std::ofstream out(filename.c_str(),std::ios::binary); 00215 00216 for(unsigned int i=0;i<maskbits_.size();i++){ 00217 maskbits_[i].writeBinary(out); 00218 } 00219 00220 00221 }
virtual void pos::PixelMaskAllPixels::writeXML | ( | std::ofstream * | out | ) | const [inline, virtual] |
void pos::PixelMaskAllPixels::writeXML | ( | pos::PixelConfigKey | key, | |
int | version, | |||
std::string | path | |||
) | const [inline, virtual] |
virtual void pos::PixelMaskAllPixels::writeXML | ( | std::ofstream * | out | ) | const [inline, virtual] |
void pos::PixelMaskAllPixels::writeXML | ( | pos::PixelConfigKey | key, | |
int | version, | |||
std::string | path | |||
) | const [inline, virtual] |
virtual void pos::PixelMaskAllPixels::writeXMLHeader | ( | pos::PixelConfigKey | key, | |
int | version, | |||
std::string | path, | |||
std::ofstream * | out | |||
) | const [inline, virtual] |
virtual void pos::PixelMaskAllPixels::writeXMLHeader | ( | pos::PixelConfigKey | key, | |
int | version, | |||
std::string | path, | |||
std::ofstream * | out | |||
) | const [inline, virtual] |
virtual void pos::PixelMaskAllPixels::writeXMLTrailer | ( | std::ofstream * | out | ) | const [inline, virtual] |
virtual void pos::PixelMaskAllPixels::writeXMLTrailer | ( | std::ofstream * | out | ) | const [inline, virtual] |
std::vector<bool> pos::PixelMaskAllPixels::maskbits_ [private] |
Definition at line 39 of file PixelMaskCommon.h.
std::vector<PixelROCMaskBits> pos::PixelMaskAllPixels::maskbits_ [private] |
Definition at line 48 of file PixelMaskAllPixels.h.
Referenced by addROCMaskBits(), getMaskBits(), PixelMaskAllPixels(), writeASCII(), and writeBinary().
std::vector<PixeROCName> pos::PixelMaskAllPixels::rocname_ [private] |
Definition at line 38 of file PixelMaskCommon.h.