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 ()
 
 PixelMaskAllPixels (std::string filename)
 
 PixelMaskAllPixels (std::vector< std::vector< std::string > > &tableMat)
 
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.

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 }

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

◆ PixelMaskAllPixels() [2/3]

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

Definition at line 27 of file PixelMaskAllPixels.cc.

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 }

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

◆ PixelMaskAllPixels() [3/3]

PixelMaskAllPixels::PixelMaskAllPixels ( )

Definition at line 81 of file PixelMaskAllPixels.cc.

81 : PixelMaskBase("", "", "") { ; }

Member Function Documentation

◆ addROCMaskBits()

void PixelMaskAllPixels::addROCMaskBits ( const PixelROCMaskBits bits)

Definition at line 84 of file PixelMaskAllPixels.cc.

84 { maskbits_.push_back(bits); }

References maskbits_.

◆ getMaskBits() [1/2]

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

Implements pos::PixelMaskBase.

Definition at line 178 of file PixelMaskAllPixels.cc.

178 { return maskbits_[ROCId]; }

References maskbits_.

◆ getMaskBits() [2/2]

PixelROCMaskBits * PixelMaskAllPixels::getMaskBits ( PixelROCName  name)
overridevirtual

Implements pos::PixelMaskBase.

Definition at line 181 of file PixelMaskAllPixels.cc.

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 }

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

◆ writeASCII()

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

Implements pos::PixelMaskBase.

Definition at line 200 of file PixelMaskAllPixels.cc.

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 }

References DeadROC_duringRun::dir, corrVsCorr::filename, mps_fire::i, maskbits_, pos::PixelModuleName::modulename(), Skims_PA_cff::name, MillePedeFileConverter_cfg::out, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ writeBinary()

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

Implements pos::PixelMaskBase.

Definition at line 191 of file PixelMaskAllPixels.cc.

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 }

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

◆ 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.

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 }

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

◆ 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.

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 }

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.

◆ 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.

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 }

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

Member Data Documentation

◆ maskbits_

std::vector<PixelROCMaskBits> pos::PixelMaskAllPixels::maskbits_
private
mps_fire.i
i
Definition: mps_fire.py:428
pos::PixelROCMaskBits
This class implements..
Definition: PixelROCMaskBits.h:24
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos::PixelModuleName
This class implements..
Definition: PixelModuleName.h:26
cms::cuda::assert
assert(be >=bs)
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
pos::PixelMaskBase::PixelMaskBase
PixelMaskBase(std::string description, std::string creator, std::string date)
Definition: PixelMaskBase.cc:17
pos::PixelTimeFormatter::getTime
static std::string getTime(void)
Definition: PixelTimeFormatter.h:60
pos::PixelConfigBase::getAuthor
std::string getAuthor() const
Definition: PixelConfigBase.h:70
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
pos::PixelMaskAllPixels::maskbits_
std::vector< PixelROCMaskBits > maskbits_
Definition: PixelMaskAllPixels.h:51
pos::PixelTimeFormatter::getmSecTime
static std::string getmSecTime(void)
Definition: PixelTimeFormatter.h:93
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pos::PixelConfigBase::getComment
std::string getComment() const
Definition: PixelConfigBase.h:71
cuy.ins
ins
Definition: cuy.py:314
recoMuon::in
Definition: RecoMuonEnumerators.h:6
pos::PixelROCName
This class implements..
Definition: PixelROCName.h:23
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
alignCSCRings.r
r
Definition: alignCSCRings.py:93
base64_decode
#define base64_decode(in, inlen, out, outlen)
Definition: base64.h:52
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23