CMS 3D CMS Logo

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

This is the documentation about PixelMaxVsf... More...

#include <PixelMaxVsf.h>

Inheritance diagram for pos::PixelMaxVsf:
pos::PixelConfigBase

Public Member Functions

bool getVsf (PixelROCName roc, unsigned int &Vsf) const
 
 PixelMaxVsf (std::vector< std::vector< std::string > > &tableMat)
 
 PixelMaxVsf (std::string filename)
 
void setVsf (PixelROCName roc, unsigned int Vsf)
 
void writeASCII (std::string dir="") 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::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::map< PixelROCName,
unsigned int > 
rocs_
 

Detailed Description

This is the documentation about PixelMaxVsf...

" "

This class specifies the maximum Vsf setting that should be used for each ROC.

Definition at line 26 of file PixelMaxVsf.h.

Constructor & Destructor Documentation

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

EXTENSION_TABLE_NAME: ROC_MAXVSF (VIEW: CONF_KEY_ROC_MAXVSF_V)

CONFIG_KEY NOT NULL VARCHAR2(80) KEY_TYPE NOT NULL VARCHAR2(80) KEY_ALIAS NOT NULL VARCHAR2(80) VERSION VARCHAR2(40) KIND_OF_COND NOT NULL VARCHAR2(40) ROC_NAME VARCHAR2(200) MAXVSF NOT NULL NUMBER(38)

Definition at line 21 of file PixelMaxVsf.cc.

References cms::cuda::assert(), c, EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, dqmiodumpmetadata::n, alignCSCRings::r, PixelMapPlotter::roc, rocs_, and AlCaHLTBitMon_QueryRunRegistry::string.

21  : PixelConfigBase("", "", "") {
22  std::string mthn = "[PixelMaxVsf::PixelMaxVsf()]\t\t\t\t ";
23  std::map<std::string, int> colM;
24  std::vector<std::string> colNames;
38  colNames.push_back("CONFIG_KEY");
39  colNames.push_back("KEY_TYPE");
40  colNames.push_back("KEY_ALIAS");
41  colNames.push_back("VERSION");
42  colNames.push_back("KIND_OF_COND");
43  colNames.push_back("ROC_NAME");
44  colNames.push_back("MAXVSF");
45 
46  for (unsigned int c = 0; c < tableMat[0].size(); c++) {
47  for (unsigned int n = 0; n < colNames.size(); n++) {
48  if (tableMat[0][c] == colNames[n]) {
49  colM[colNames[n]] = c;
50  break;
51  }
52  }
53  } //end for
54  for (unsigned int n = 0; n < colNames.size(); n++) {
55  if (colM.find(colNames[n]) == colM.end()) {
56  std::cerr << __LINE__ << "]\t" << mthn << "Couldn't find in the database the column with name " << colNames[n]
57  << std::endl;
58  assert(0);
59  }
60  }
61 
62  rocs_.clear();
63 
64  for (unsigned int r = 1; r < tableMat.size(); r++) //Goes to every row of the Matrix
65  {
66  PixelROCName roc(tableMat[r][colM["ROC_NAME"]]);
67  unsigned int vsf;
68  vsf = atoi(tableMat[r][colM["MAXVSF"]].c_str());
69  rocs_[roc] = vsf;
70  }
71 } //end constructor
const edm::EventSetup & c
assert(be >=bs)
std::map< PixelROCName, unsigned int > rocs_
Definition: PixelMaxVsf.h:49
This class implements..
Definition: PixelROCName.h:23
PixelConfigBase(std::string description, std::string creator, std::string date)
PixelMaxVsf::PixelMaxVsf ( std::string  filename)

Definition at line 75 of file PixelMaxVsf.cc.

References cms::cuda::assert(), gather_cfg::cout, recoMuon::in, PixelMapPlotter::roc, rocs_, and AlCaHLTBitMon_QueryRunRegistry::string.

75  : PixelConfigBase("", "", "") {
76  std::string mthn = "[PixelMaxVsf::PixelMaxVsf()]\t\t\t\t ";
77 
78  if (filename[filename.size() - 1] == 't') {
79  std::ifstream in(filename.c_str());
80 
81  if (!in.good()) {
82  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
83  throw std::runtime_error("Failed to open file " + filename);
84  } else {
85  std::cout << __LINE__ << "]\t" << mthn << "Opened: " << filename << std::endl;
86  }
87 
88  if (in.eof()) {
89  std::cout << __LINE__ << "]\t" << mthn << "eof before reading anything!" << std::endl;
90  throw std::runtime_error("File appears to be empty: " + filename);
91  }
92 
93  rocs_.clear();
94 
95  std::string rocname;
96 
97  in >> rocname;
98  while (!in.eof()) {
99  //cout << "Read rocname:"<<rocname<<endl;
100  PixelROCName roc(rocname);
101  unsigned int vsf;
102  in >> vsf;
103  rocs_[roc] = vsf;
104  in >> rocname;
105  }
106  return;
107  } else {
108  assert(0);
109  }
110 }
assert(be >=bs)
std::map< PixelROCName, unsigned int > rocs_
Definition: PixelMaxVsf.h:49
This class implements..
Definition: PixelROCName.h:23
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:144
PixelConfigBase(std::string description, std::string creator, std::string date)

Member Function Documentation

bool PixelMaxVsf::getVsf ( PixelROCName  roc,
unsigned int &  Vsf 
) const

Definition at line 112 of file PixelMaxVsf.cc.

References rocs_.

112  {
113  std::map<PixelROCName, unsigned int>::const_iterator itr = rocs_.find(roc);
114 
115  if (itr == rocs_.end()) {
116  return false;
117  }
118 
119  Vsf = itr->second;
120 
121  return true;
122 }
std::map< PixelROCName, unsigned int > rocs_
Definition: PixelMaxVsf.h:49
void PixelMaxVsf::setVsf ( PixelROCName  roc,
unsigned int  Vsf 
)

Definition at line 124 of file PixelMaxVsf.cc.

References PixelMapPlotter::roc, and rocs_.

124 { rocs_[roc] = Vsf; }
std::map< PixelROCName, unsigned int > rocs_
Definition: PixelMaxVsf.h:49
void PixelMaxVsf::writeASCII ( std::string  dir = "") const
overridevirtual

Implements pos::PixelConfigBase.

Definition at line 126 of file PixelMaxVsf.cc.

References gather_cfg::cout, beamvalidation::exit(), lut2db_cfg::filename, submitPVResolutionJobs::out, rocs_, and AlCaHLTBitMon_QueryRunRegistry::string.

126  {
127  std::string mthn = "[PixelMaxVsf::writeASCII()]\t\t\t\t ";
128  if (!dir.empty())
129  dir += "/";
130  std::string filename = dir + "maxvsf.dat";
131 
132  std::ofstream out(filename.c_str(), std::ios_base::out);
133  if (!out) {
134  std::cout << __LINE__ << "]\t" << mthn << "Could not open file " << filename << " for write" << std::endl;
135  exit(1);
136  }
137 
138  std::map<PixelROCName, unsigned int>::const_iterator irocs = rocs_.begin();
139  for (; irocs != rocs_.end(); ++irocs) {
140  out << (irocs->first).rocname() << " " << irocs->second << endl;
141  }
142 
143  out.close();
144 }
std::map< PixelROCName, unsigned int > rocs_
Definition: PixelMaxVsf.h:49
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:144
void pos::PixelMaxVsf::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlineoverridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 32 of file PixelMaxVsf.h.

32 { ; }
void PixelMaxVsf::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 190 of file PixelMaxVsf.cc.

References rocs_, and AlCaHLTBitMon_QueryRunRegistry::string.

190  {
191  std::string mthn = "[PixelMaxVsf::writeXML()]\t\t\t ";
192 
193  std::map<PixelROCName, unsigned int>::const_iterator irocs = rocs_.begin();
194  for (; irocs != rocs_.end(); ++irocs) {
195  *outstream << " <DATA>" << std::endl;
196  *outstream << " <ROC_NAME>" << (irocs->first).rocname() << "</ROC_NAME>" << std::endl;
197  *outstream << " <MAXVSF>" << irocs->second << "</MAXVSF>" << std::endl;
198  *outstream << " </DATA>" << std::endl;
199  *outstream << std::endl;
200  }
201 }
std::map< PixelROCName, unsigned int > rocs_
Definition: PixelMaxVsf.h:49
void PixelMaxVsf::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 147 of file PixelMaxVsf.cc.

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

152  {
153  std::string mthn = "[PixelMaxVsf::writeXMLHeader()]\t\t\t ";
154  std::stringstream maskFullPath;
155 
156  maskFullPath << path << "/Pixel_RocMaxVsf_" << PixelTimeFormatter::getmSecTime() << ".xml";
157  std::cout << __LINE__ << "]\t" << mthn << "Writing to: " << maskFullPath.str() << std::endl;
158 
159  outstream->open(maskFullPath.str().c_str());
160 
161  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl;
162  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl;
163  *outstream << "" << std::endl;
164  *outstream << " <HEADER>" << std::endl;
165  *outstream << " <TYPE>" << std::endl;
166  *outstream << " <EXTENSION_TABLE_NAME>ROC_MAXVSF</EXTENSION_TABLE_NAME>" << std::endl;
167  *outstream << " <NAME>ROC MaxVsf Setting</NAME>" << std::endl;
168  *outstream << " </TYPE>" << std::endl;
169  *outstream << " <RUN>" << std::endl;
170  *outstream << " <RUN_TYPE>ROC MaxVsf Settings</RUN_TYPE>" << std::endl;
171  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl;
172  *outstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl;
173  *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl;
174  *outstream << " </RUN>" << std::endl;
175  *outstream << " </HEADER>" << std::endl;
176  *outstream << "" << std::endl;
177  *outstream << " <DATA_SET>" << std::endl;
178  *outstream << "" << std::endl;
179  *outstream << " <VERSION>" << version << "</VERSION>" << std::endl;
180  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl;
181  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl;
182  *outstream << "" << std::endl;
183  *outstream << " <PART>" << std::endl;
184  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl;
185  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl;
186  *outstream << " </PART>" << std::endl;
187 }
static std::string getmSecTime(void)
static std::string getTime(void)
std::string getComment() const
std::string getAuthor() const
tuple cout
Definition: gather_cfg.py:144
void PixelMaxVsf::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 204 of file PixelMaxVsf.cc.

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

206  {
207  std::string mthn = "[PixelMaxVsf::writeXMLTrailer()]\t\t\t ";
208 
209  *outstream << " </DATA_SET>" << std::endl;
210  *outstream << "</ROOT>" << std::endl;
211 
212  outstream->close();
213  std::cout << __LINE__ << "]\t" << mthn << "Data written " << std::endl;
214 }
tuple cout
Definition: gather_cfg.py:144

Member Data Documentation

std::map<PixelROCName, unsigned int> pos::PixelMaxVsf::rocs_
private

Definition at line 49 of file PixelMaxVsf.h.

Referenced by getVsf(), PixelMaxVsf(), setVsf(), writeASCII(), and writeXML().