CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
pos::PixelMaskAllPixels Class Reference

This is the documentation about PixelMaskAllPixels... More...

#include "interface/PixelMaskAllPixels.h"

Inheritance diagram for pos::PixelMaskAllPixels:
pos::PixelMaskBase pos::PixelMaskBase pos::PixelConfigBase pos::PixelConfigBase

Public Member Functions

void addROCMaskBits (const PixelROCMaskBits &)
 
const PixelROCMaskBitsgetMaskBits (int ROCId) const
 
PixelROCMaskBitsgetMaskBits (PixelROCName name)
 
 PixelMaskAllPixels (std::string filename)
 
 PixelMaskAllPixels (std::vector< std::vector< std::string > > &tableMat)
 
 PixelMaskAllPixels ()
 
 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
 
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 writeXML (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) 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, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
virtual void writeXMLTrailer (std::ofstream *out) const
 
virtual void writeXMLTrailer (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
- Public Member Functions inherited from pos::PixelMaskBase
 PixelMaskBase (std::string description, std::string creator, std::string date)
 
void setOverride (PixelMaskOverrideBase *)
 
virtual ~PixelMaskBase ()
 
- Public Member Functions inherited from pos::PixelConfigBase
std::string creator ()
 
std::string date ()
 
std::string description ()
 
std::string getAuthor () const
 
std::string getComment () const
 
 PixelConfigBase (std::string description, std::string creator, std::string date)
 
void setAuthor (std::string author)
 
void setComment (std::string comment)
 
virtual ~PixelConfigBase ()
 

Private Attributes

std::vector< bool > maskbits_
 
std::vector< PixelROCMaskBitsmaskbits_
 
std::vector< PixeROCName > rocname_
 

Detailed Description

This is the documentation about PixelMaskAllPixels...

This class implements..

" "

A longer explanation will be placed here later

Definition at line 23 of file PixelMaskAllPixels.h.

Constructor & Destructor Documentation

PixelMaskAllPixels::PixelMaskAllPixels ( std::string  filename)

Definition at line 95 of file PixelMaskAllPixels.cc.

References EnergyCorrector::c, gather_cfg::cout, i, recoMuon::in, maskbits_, pos::PixelROCMaskBits::read(), pos::PixelROCMaskBits::readBinary(), AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, and tmp.

95  :
96  PixelMaskBase("","",""){
97 
98  std::string mthn = "[PixelMaskAllPixels::PixelMaskAllPixels()]\t\t " ;
99 
100  if (filename[filename.size()-1]=='t'){
101 
102 
103  std::ifstream in(filename.c_str());
104 
105  if (!in.good()){
106  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
107  throw std::runtime_error("Failed to open file "+filename);
108  }
109 
111  in >> tag;
112 
113  maskbits_.clear();
114 
115  while (!in.eof()) {
116 
117  PixelROCName rocid(in);
118 
120 
121  tmp.read(rocid,in);
122 
123  maskbits_.push_back(tmp);
124 
125  in >> tag;
126 
127  }
128 
129  in.close();
130 
131  }
132  else{
133 
134  std::ifstream in(filename.c_str(),std::ios::binary);
135 
136  char nchar;
137 
138  in.read(&nchar,1);
139 
140  //in >> nchar;
141 
142  std::string s1;
143 
144  //wrote these lines of code without ref. needs to be fixed
145  for(int i=0;i< nchar; i++){
146  char c;
147  in >>c;
148  s1.push_back(c);
149  }
150 
151  //std::cout << __LINE__ << "]\t" << mthn << "READ ROC name: " << s1 << std::endl;
152 
153  maskbits_.clear();
154 
155 
156  while (!in.eof()){
157 
158  //std::cout << __LINE__ << "]\t" << mthn << "read s1: " << s1 << std::endl;
159 
160  PixelROCName rocid(s1);
161 
162  //std::cout << __LINE__ << "]\t" << mthn << "read rocid: " << rocid << std::endl;
163 
165 
166  tmp.readBinary(rocid, in);
167 
168  maskbits_.push_back(tmp);
169 
170 
171  in.read(&nchar,1);
172 
173  s1.clear();
174 
175  if (in.eof()) continue;
176 
177  //std::cout << __LINE__ << "]\t" << mthn << "Will read: " << (int)nchar << " characters." <<std::endl;
178 
179  //wrote these lines of code without ref. needs to be fixed
180  for(int i=0;i< nchar; i++){
181  char c;
182  in >>c;
183  //std::cout << " " <<c;
184  s1.push_back(c);
185  }
186  //std::cout << std::endl;
187 
188 
189  }
190 
191  in.close();
192 
193 
194 
195  }
196 
197 
198  //std::cout << __LINE__ << "]\t" << mthn << "Read maskbits for " << maskbits_.size() << " ROCs" << std::endl;
199 
200  }
int i
Definition: DBlmapReader.cc:9
int read(const PixelROCName &rocid, std::string in)
PixelMaskBase(std::string description, std::string creator, std::string date)
std::vector< PixelROCMaskBits > maskbits_
This class implements..
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
This class implements..
Definition: PixelROCName.h:23
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
int readBinary(const PixelROCName &rocid, std::ifstream &in)
PixelMaskAllPixels::PixelMaskAllPixels ( std::vector< std::vector< std::string > > &  tableMat)

Definition at line 27 of file PixelMaskAllPixels.cc.

References assert(), base64_decode, EnergyCorrector::c, ecal_dqm_sourceclient-live_cfg::cerr, cuy::ins, maskbits_, gen::n, alignCSCRings::r, pos::PixelROCMaskBits::read(), AlCaHLTBitMon_QueryRunRegistry::string, and tmp.

27  : PixelMaskBase("","","")
28 {
29  std::string mthn = "[PixelMaskAllPixels::PixelMaskAllPixels()]\t\t " ;
30  //std::cout << __LINE__ << "]\t" << mthn << "Table Size in const: " << tableMat.size() << std::endl;
31 
32  std::vector< std::string > ins = tableMat[0];
33  std::map<std::string , int > colM;
34  std::vector<std::string > colNames;
35 
36 /*
37  EXTENSION_TABLE_NAME: ROC_MASKS (VIEW: CONF_KEY_ROC_MASKS_V)
38 
39  CONFIG_KEY NOT NULL VARCHAR2(80)
40  KEY_TYPE NOT NULL VARCHAR2(80)
41  KEY_ALIAS NOT NULL VARCHAR2(80)
42  VERSION VARCHAR2(40)
43  KIND_OF_COND NOT NULL VARCHAR2(40)
44  ROC_NAME NOT NULL VARCHAR2(200)
45  KILL_MASK NOT NULL VARCHAR2(4000) colNames.push_back("CONFIG_KEY_ID" );
46 */
47  colNames.push_back("CONFIG_KEY" );
48  colNames.push_back("KEY_TYPE" );
49  colNames.push_back("KEY_ALIAS" );
50  colNames.push_back("VERSION" );
51  colNames.push_back("KIND_OF_COND");
52  colNames.push_back("ROC_NAME" );
53  colNames.push_back("KILL_MASK" );
54 
55  for(unsigned int c = 0 ; c < ins.size() ; c++)
56  {
57  for(unsigned int n=0; n<colNames.size(); n++)
58  {
59  if(tableMat[0][c] == colNames[n])
60  {
61  colM[colNames[n]] = c;
62  break;
63  }
64  }
65  }//end for
66  for(unsigned int n=0; n<colNames.size(); n++)
67  {
68  if(colM.find(colNames[n]) == colM.end())
69  {
70  std::cerr << mthn << "Couldn't find in the database the column with name " << colNames[n] << std::endl;
71  assert(0);
72  }
73  }
74  maskbits_.clear() ;
75  for(unsigned int r = 1 ; r < tableMat.size() ; r++){ //Goes to every row of the Matrix
76  std::string currentRocName = tableMat[r][colM["ROC_NAME"]] ;
77  PixelROCName rocid(currentRocName);
79  tmp.read(rocid,base64_decode(tableMat[r][colM["KILL_MASK"]])) ; // decode back from specially base64-encoded data for XML
80  maskbits_.push_back(tmp);
81  } //end for r
82 }
int read(const PixelROCName &rocid, std::string in)
#define base64_decode(in, inlen, out, outlen)
Definition: base64.h:57
assert(m_qm.get())
tuple ins
Definition: cuy.py:312
PixelMaskBase(std::string description, std::string creator, std::string date)
std::vector< PixelROCMaskBits > maskbits_
This class implements..
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
This class implements..
Definition: PixelROCName.h:23
PixelMaskAllPixels::PixelMaskAllPixels ( )

Definition at line 86 of file PixelMaskAllPixels.cc.

86 :PixelMaskBase("","",""){;}
PixelMaskBase(std::string description, std::string creator, std::string date)

Member Function Documentation

void PixelMaskAllPixels::addROCMaskBits ( const PixelROCMaskBits bits)

Definition at line 89 of file PixelMaskAllPixels.cc.

References maskbits_.

90 {
91  maskbits_.push_back(bits);
92 }
std::vector< PixelROCMaskBits > maskbits_
const PixelROCMaskBits & PixelMaskAllPixels::getMaskBits ( int  ROCId) const
virtual

Implements pos::PixelMaskBase.

Definition at line 203 of file PixelMaskAllPixels.cc.

References maskbits_.

203  {
204 
205  return maskbits_[ROCId];
206 
207 }
std::vector< PixelROCMaskBits > maskbits_
PixelROCMaskBits * PixelMaskAllPixels::getMaskBits ( PixelROCName  name)
virtual

Implements pos::PixelMaskBase.

Definition at line 210 of file PixelMaskAllPixels.cc.

References i, maskbits_, and mergeVDriftHistosByStation::name.

210  {
211 
212  for(unsigned int i=0;i<maskbits_.size();i++){
213  if (maskbits_[i].name()==name) return &(maskbits_[i]);
214  }
215 
216  return 0;
217 
218 }
int i
Definition: DBlmapReader.cc:9
std::vector< PixelROCMaskBits > maskbits_
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 234 of file PixelMaskAllPixels.cc.

References lut2db_cfg::filename, i, maskbits_, python.rootplot.argparse::module, pos::PixelModuleName::modulename(), mergeVDriftHistosByStation::name, dbtoconf::out, and AlCaHLTBitMon_QueryRunRegistry::string.

234  {
235 
236  if (dir!="") dir+="/";
237  PixelModuleName module(maskbits_[0].name().rocname());
238  std::string filename=dir+"ROC_Masks_module_"+module.modulename()+".dat";
239 
240  std::ofstream out(filename.c_str());
241 
242  for(unsigned int i=0;i<maskbits_.size();i++){
243  maskbits_[i].writeASCII(out);
244  }
245 
246 
247 }
int i
Definition: DBlmapReader.cc:9
tuple out
Definition: dbtoconf.py:99
std::vector< PixelROCMaskBits > maskbits_
This class implements..
tuple filename
Definition: lut2db_cfg.py:20
dbl *** dir
Definition: mlp_gen.cc:35
Definition: vlib.h:208
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 221 of file PixelMaskAllPixels.cc.

References i, maskbits_, and dbtoconf::out.

221  {
222 
223 
224  std::ofstream out(filename.c_str(),std::ios::binary);
225 
226  for(unsigned int i=0;i<maskbits_.size();i++){
227  maskbits_[i].writeBinary(out);
228  }
229 
230 
231 }
int i
Definition: DBlmapReader.cc:9
tuple out
Definition: dbtoconf.py:99
std::vector< PixelROCMaskBits > maskbits_
tuple filename
Definition: lut2db_cfg.py:20
void pos::PixelMaskAllPixels::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlinevirtual

Reimplemented from pos::PixelMaskBase.

Definition at line 31 of file PixelMaskCommon.h.

31 {;}
virtual void pos::PixelMaskAllPixels::writeXML ( std::ofstream *  out) const
inlinevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 33 of file PixelMaskCommon.h.

33 {;}
void pos::PixelMaskAllPixels::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlinevirtual

Reimplemented from pos::PixelMaskBase.

Definition at line 37 of file PixelMaskAllPixels.h.

37 {;}
void PixelMaskAllPixels::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelMaskBase.

Definition at line 295 of file PixelMaskAllPixels.cc.

References i, maskbits_, and AlCaHLTBitMon_QueryRunRegistry::string.

298 {
299  std::string mthn = "[PixelMaskAllPixels::writeXML()]\t\t\t " ;
300 
301  for(unsigned int i=0;i<maskbits_.size();i++){
302  maskbits_[i].writeXML(outstream);
303  }
304 }
int i
Definition: DBlmapReader.cc:9
std::vector< PixelROCMaskBits > maskbits_
virtual void pos::PixelMaskAllPixels::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out 
) const
inlinevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 32 of file PixelMaskCommon.h.

32 {;}
void PixelMaskAllPixels::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelMaskBase.

Definition at line 250 of file PixelMaskAllPixels.cc.

References gather_cfg::cout, pos::PixelConfigBase::getAuthor(), pos::PixelConfigBase::getComment(), pos::PixelTimeFormatter::getmSecTime(), pos::PixelTimeFormatter::getTime(), and AlCaHLTBitMon_QueryRunRegistry::string.

256 {
257  std::string mthn = "[PixelMaskAllPixels::writeXMLHeader()]\t\t\t " ;
258  std::stringstream maskFullPath ;
259 
260  maskFullPath << path << "/Pixel_RocMasks_" << PixelTimeFormatter::getmSecTime() << ".xml";
261  std::cout << __LINE__ << "]\t" << mthn << "Writing to: " << maskFullPath.str() << std::endl ;
262 
263  outstream->open(maskFullPath.str().c_str()) ;
264 
265  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
266  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
267  *outstream << "" << std::endl ;
268  *outstream << " <HEADER>" << std::endl ;
269  *outstream << " <TYPE>" << std::endl ;
270  *outstream << " <EXTENSION_TABLE_NAME>ROC_MASKS</EXTENSION_TABLE_NAME>" << std::endl ;
271  *outstream << " <NAME>ROC Mask Bits</NAME>" << std::endl ;
272  *outstream << " </TYPE>" << std::endl ;
273  *outstream << " <RUN>" << std::endl ;
274  *outstream << " <RUN_TYPE>ROC Mask Bits</RUN_TYPE>" << std::endl ;
275  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
276  *outstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
277  *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl ;
278  *outstream << " </RUN>" << std::endl ;
279  *outstream << " </HEADER>" << std::endl ;
280  *outstream << "" << std::endl ;
281  *outstream << " <DATA_SET>" << std::endl ;
282  *outstream << "" << std::endl ;
283  *outstream << " <VERSION>" << version << "</VERSION>" << std::endl ;
284  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl ;
285  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl ;
286  *outstream << "" << std::endl ;
287  *outstream << " <PART>" << std::endl ;
288  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
289  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
290  *outstream << " </PART>" << std::endl ;
291  *outstream << " " << std::endl ;
292 
293 }
static std::string getmSecTime(void)
static std::string getTime(void)
std::string getComment() const
std::string getAuthor() const
tuple cout
Definition: gather_cfg.py:121
virtual void pos::PixelMaskAllPixels::writeXMLTrailer ( std::ofstream *  out) const
inlinevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 34 of file PixelMaskCommon.h.

34 {;}
void PixelMaskAllPixels::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelMaskBase.

Definition at line 306 of file PixelMaskAllPixels.cc.

References gather_cfg::cout, and AlCaHLTBitMon_QueryRunRegistry::string.

309 {
310  std::string mthn = "[PixelMaskAllPixels::writeXMLTrailer()]\t\t\t " ;
311 
312  *outstream << " " << std::endl ;
313  *outstream << " </DATA_SET>" << std::endl ;
314  *outstream << "</ROOT>" << std::endl ;
315 
316  outstream->close() ;
317  std::cout << __LINE__ << "]\t" << mthn << "Data written " << std::endl ;
318 
319 }
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

std::vector<bool> pos::PixelMaskAllPixels::maskbits_
private

Definition at line 39 of file PixelMaskCommon.h.

std::vector<PixelROCMaskBits> pos::PixelMaskAllPixels::maskbits_
private
std::vector<PixeROCName> pos::PixelMaskAllPixels::rocname_
private

Definition at line 38 of file PixelMaskCommon.h.