CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pos::PixelMaskAllPixels Class Reference

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

#include <PixelMaskAllPixels.h>

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

Public Member Functions

void addROCMaskBits (const PixelROCMaskBits &)
 
const PixelROCMaskBitsgetMaskBits (int ROCId) const override
 
PixelROCMaskBitsgetMaskBits (PixelROCName name) override
 
 PixelMaskAllPixels (std::string filename)
 
 PixelMaskAllPixels (std::vector< std::vector< std::string > > &tableMat)
 
 PixelMaskAllPixels ()
 
void writeASCII (std::string dir) const override
 
void writeBinary (std::string filename) const override
 
void writeXML (pos::PixelConfigKey key, int version, std::string path) const override
 
void writeXML (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void writeXMLTrailer (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
- Public Member Functions inherited from pos::PixelMaskBase
 PixelMaskBase (std::string description, std::string creator, std::string date)
 
void setOverride (PixelMaskOverrideBase *)
 
void writeXML (pos::PixelConfigKey key, int version, std::string path) const override
 
void writeXML (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void writeXMLTrailer (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
 ~PixelMaskBase () override
 
- 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 void writeXML (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 ~PixelConfigBase ()
 

Private Attributes

std::vector< PixelROCMaskBitsmaskbits_
 

Detailed Description

This is the documentation about PixelMaskAllPixels...

" "

Definition at line 23 of file PixelMaskAllPixels.h.

Constructor & Destructor Documentation

◆ PixelMaskAllPixels() [1/3]

PixelMaskAllPixels::PixelMaskAllPixels ( std::string  filename)

Definition at line 87 of file PixelMaskAllPixels.cc.

References HltBtagPostValidation_cff::c, gather_cfg::cout, corrVsCorr::filename, mps_fire::i, recoMuon::in, maskbits_, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, and createJobs::tmp.

87  : PixelMaskBase("", "", "") {
88  std::string mthn = "[PixelMaskAllPixels::PixelMaskAllPixels()]\t\t ";
89 
90  if (filename[filename.size() - 1] == 't') {
91  std::ifstream in(filename.c_str());
92 
93  if (!in.good()) {
94  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
95  throw std::runtime_error("Failed to open file " + filename);
96  }
97 
99  in >> tag;
100 
101  maskbits_.clear();
102 
103  while (!in.eof()) {
104  PixelROCName rocid(in);
105 
107 
108  tmp.read(rocid, in);
109 
110  maskbits_.push_back(tmp);
111 
112  in >> tag;
113  }
114 
115  in.close();
116 
117  } else {
118  std::ifstream in(filename.c_str(), std::ios::binary);
119 
120  char nchar;
121 
122  in.read(&nchar, 1);
123 
124  //in >> nchar;
125 
126  std::string s1;
127 
128  //wrote these lines of code without ref. needs to be fixed
129  for (int i = 0; i < nchar; i++) {
130  char c;
131  in >> c;
132  s1.push_back(c);
133  }
134 
135  //std::cout << __LINE__ << "]\t" << mthn << "READ ROC name: " << s1 << std::endl;
136 
137  maskbits_.clear();
138 
139  while (!in.eof()) {
140  //std::cout << __LINE__ << "]\t" << mthn << "read s1: " << s1 << std::endl;
141 
142  PixelROCName rocid(s1);
143 
144  //std::cout << __LINE__ << "]\t" << mthn << "read rocid: " << rocid << std::endl;
145 
147 
148  tmp.readBinary(rocid, in);
149 
150  maskbits_.push_back(tmp);
151 
152  in.read(&nchar, 1);
153 
154  s1.clear();
155 
156  if (in.eof())
157  continue;
158 
159  //std::cout << __LINE__ << "]\t" << mthn << "Will read: " << (int)nchar << " characters." <<std::endl;
160 
161  //wrote these lines of code without ref. needs to be fixed
162  for (int i = 0; i < nchar; i++) {
163  char c;
164  in >> c;
165  //std::cout << " " <<c;
166  s1.push_back(c);
167  }
168  //std::cout << std::endl;
169  }
170 
171  in.close();
172  }
173 
174  //std::cout << __LINE__ << "]\t" << mthn << "Read maskbits for " << maskbits_.size() << " ROCs" << std::endl;
175 }
PixelMaskBase(std::string description, std::string creator, std::string date)
std::vector< PixelROCMaskBits > maskbits_
This class implements..
This class implements..
Definition: PixelROCName.h:23
tmp
align.sh
Definition: createJobs.py:716

◆ PixelMaskAllPixels() [2/3]

PixelMaskAllPixels::PixelMaskAllPixels ( std::vector< std::vector< std::string > > &  tableMat)

Definition at line 27 of file PixelMaskAllPixels.cc.

References cms::cuda::assert(), base64_decode, HltBtagPostValidation_cff::c, DMR_cfg::cerr, cuy::ins, maskbits_, dqmiodumpmetadata::n, AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

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

◆ PixelMaskAllPixels() [3/3]

PixelMaskAllPixels::PixelMaskAllPixels ( )

Definition at line 81 of file PixelMaskAllPixels.cc.

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

Member Function Documentation

◆ addROCMaskBits()

void PixelMaskAllPixels::addROCMaskBits ( const PixelROCMaskBits bits)

◆ getMaskBits() [1/2]

const PixelROCMaskBits & PixelMaskAllPixels::getMaskBits ( int  ROCId) const
overridevirtual

Implements pos::PixelMaskBase.

Definition at line 178 of file PixelMaskAllPixels.cc.

References maskbits_.

178 { return maskbits_[ROCId]; }
std::vector< PixelROCMaskBits > maskbits_

◆ getMaskBits() [2/2]

PixelROCMaskBits * PixelMaskAllPixels::getMaskBits ( PixelROCName  name)
overridevirtual

Implements pos::PixelMaskBase.

Definition at line 181 of file PixelMaskAllPixels.cc.

References mps_fire::i, maskbits_, and Skims_PA_cff::name.

181  {
182  for (unsigned int i = 0; i < maskbits_.size(); i++) {
183  if (maskbits_[i].name() == name)
184  return &(maskbits_[i]);
185  }
186 
187  return nullptr;
188 }
std::vector< PixelROCMaskBits > maskbits_

◆ writeASCII()

void PixelMaskAllPixels::writeASCII ( std::string  dir) const
overridevirtual

Implements pos::PixelMaskBase.

Definition at line 200 of file PixelMaskAllPixels.cc.

References DeadROC_duringRun::dir, corrVsCorr::filename, mps_fire::i, maskbits_, callgraph::module, Skims_PA_cff::name, MillePedeFileConverter_cfg::out, and AlCaHLTBitMon_QueryRunRegistry::string.

200  {
201  if (!dir.empty())
202  dir += "/";
203  PixelModuleName module(maskbits_[0].name().rocname());
204  std::string filename = dir + "ROC_Masks_module_" + module.modulename() + ".dat";
205 
206  std::ofstream out(filename.c_str());
207 
208  for (unsigned int i = 0; i < maskbits_.size(); i++) {
209  maskbits_[i].writeASCII(out);
210  }
211 }
std::vector< PixelROCMaskBits > maskbits_
This class implements..

◆ writeBinary()

void PixelMaskAllPixels::writeBinary ( std::string  filename) const
overridevirtual

Implements pos::PixelMaskBase.

Definition at line 191 of file PixelMaskAllPixels.cc.

References corrVsCorr::filename, mps_fire::i, maskbits_, and MillePedeFileConverter_cfg::out.

191  {
192  std::ofstream out(filename.c_str(), std::ios::binary);
193 
194  for (unsigned int i = 0; i < maskbits_.size(); i++) {
195  maskbits_[i].writeBinary(out);
196  }
197 }
std::vector< PixelROCMaskBits > maskbits_

◆ writeXML() [1/2]

void pos::PixelMaskAllPixels::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlineoverridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 34 of file PixelMaskAllPixels.h.

34 { ; }

◆ writeXML() [2/2]

void PixelMaskAllPixels::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 257 of file PixelMaskAllPixels.cc.

References mps_fire::i, maskbits_, and AlCaHLTBitMon_QueryRunRegistry::string.

259  {
260  std::string mthn = "[PixelMaskAllPixels::writeXML()]\t\t\t ";
261 
262  for (unsigned int i = 0; i < maskbits_.size(); i++) {
263  maskbits_[i].writeXML(outstream);
264  }
265 }
std::vector< PixelROCMaskBits > maskbits_

◆ writeXMLHeader()

void PixelMaskAllPixels::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 214 of file PixelMaskAllPixels.cc.

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

219  {
220  std::string mthn = "[PixelMaskAllPixels::writeXMLHeader()]\t\t\t ";
221  std::stringstream maskFullPath;
222 
223  maskFullPath << path << "/Pixel_RocMasks_" << PixelTimeFormatter::getmSecTime() << ".xml";
224  std::cout << __LINE__ << "]\t" << mthn << "Writing to: " << maskFullPath.str() << std::endl;
225 
226  outstream->open(maskFullPath.str().c_str());
227 
228  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl;
229  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl;
230  *outstream << "" << std::endl;
231  *outstream << " <HEADER>" << std::endl;
232  *outstream << " <TYPE>" << std::endl;
233  *outstream << " <EXTENSION_TABLE_NAME>ROC_MASKS</EXTENSION_TABLE_NAME>" << std::endl;
234  *outstream << " <NAME>ROC Mask Bits</NAME>" << std::endl;
235  *outstream << " </TYPE>" << std::endl;
236  *outstream << " <RUN>" << std::endl;
237  *outstream << " <RUN_TYPE>ROC Mask Bits</RUN_TYPE>" << std::endl;
238  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl;
239  *outstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl;
240  *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl;
241  *outstream << " </RUN>" << std::endl;
242  *outstream << " </HEADER>" << std::endl;
243  *outstream << "" << std::endl;
244  *outstream << " <DATA_SET>" << std::endl;
245  *outstream << "" << std::endl;
246  *outstream << " <VERSION>" << version << "</VERSION>" << std::endl;
247  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl;
248  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl;
249  *outstream << "" << std::endl;
250  *outstream << " <PART>" << std::endl;
251  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl;
252  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl;
253  *outstream << " </PART>" << std::endl;
254  *outstream << " " << std::endl;
255 }
std::string getComment() const
static std::string getmSecTime(void)
static std::string getTime(void)
std::string getAuthor() const

◆ writeXMLTrailer()

void PixelMaskAllPixels::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 267 of file PixelMaskAllPixels.cc.

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

269  {
270  std::string mthn = "[PixelMaskAllPixels::writeXMLTrailer()]\t\t\t ";
271 
272  *outstream << " " << std::endl;
273  *outstream << " </DATA_SET>" << std::endl;
274  *outstream << "</ROOT>" << std::endl;
275 
276  outstream->close();
277  std::cout << __LINE__ << "]\t" << mthn << "Data written " << std::endl;
278 }

Member Data Documentation

◆ maskbits_

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