test
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::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
 
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, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
virtual void writeXMLTrailer (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
- 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 22 of file PixelMaxVsf.cc.

References trackerHits::c, dtNoiseDBValidation_cfg::cerr, n, alignCSCRings::r, rocs_, and AlCaHLTBitMon_QueryRunRegistry::string.

22  :PixelConfigBase("","","")
23 {
24  std::string mthn = "[PixelMaxVsf::PixelMaxVsf()]\t\t\t\t " ;
25  std::map<std::string , int > colM;
26  std::vector<std::string > colNames;
40  colNames.push_back("CONFIG_KEY" );
41  colNames.push_back("KEY_TYPE" );
42  colNames.push_back("KEY_ALIAS" );
43  colNames.push_back("VERSION" );
44  colNames.push_back("KIND_OF_COND");
45  colNames.push_back("ROC_NAME" );
46  colNames.push_back("MAXVSF" );
47 
48  for(unsigned int c = 0 ; c < tableMat[0].size() ; c++)
49  {
50  for(unsigned int n=0; n<colNames.size(); n++)
51  {
52  if(tableMat[0][c] == colNames[n])
53  {
54  colM[colNames[n]] = c;
55  break;
56  }
57  }
58  }//end for
59  for(unsigned int n=0; n<colNames.size(); n++)
60  {
61  if(colM.find(colNames[n]) == colM.end())
62  {
63  std::cerr << __LINE__ << "]\t" << mthn << "Couldn't find in the database the column with name " << colNames[n] << std::endl;
64  assert(0);
65  }
66  }
67 
68  rocs_.clear();
69 
70  for(unsigned int r = 1 ; r < tableMat.size() ; r++) //Goes to every row of the Matrix
71  {
72  PixelROCName roc(tableMat[r][colM["ROC_NAME"]]);
73  unsigned int vsf;
74  vsf = atoi(tableMat[r][colM["MAXVSF"]].c_str());
75  rocs_[roc]=vsf;
76  }
77 }//end constructor
std::map< PixelROCName, unsigned int > rocs_
Definition: PixelMaxVsf.h:56
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 81 of file PixelMaxVsf.cc.

References gather_cfg::cout, recoMuon::in, rocs_, and AlCaHLTBitMon_QueryRunRegistry::string.

81  :
82  PixelConfigBase("","",""){
83 
84  std::string mthn = "[PixelMaxVsf::PixelMaxVsf()]\t\t\t\t " ;
85 
86  if (filename[filename.size()-1]=='t'){
87 
88  std::ifstream in(filename.c_str());
89 
90  if (!in.good()){
91  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
92  throw std::runtime_error("Failed to open file "+filename);
93  }
94  else {
95  std::cout << __LINE__ << "]\t" << mthn << "Opened: " << filename << std::endl;
96  }
97 
98  if (in.eof()){
99  std::cout << __LINE__ << "]\t" << mthn << "eof before reading anything!" << std::endl;
100  throw std::runtime_error("File appears to be empty: "+filename);
101  }
102 
103 
104  rocs_.clear();
105 
106  std::string rocname;
107 
108  in >> rocname;
109  while (!in.eof()){
110  //cout << "Read rocname:"<<rocname<<endl;
111  PixelROCName roc(rocname);
112  unsigned int vsf;
113  in >> vsf;
114  rocs_[roc]=vsf;
115  in >> rocname;
116  }
117  return;
118  }
119  else{
120  assert(0);
121  }
122 
123 }
std::map< PixelROCName, unsigned int > rocs_
Definition: PixelMaxVsf.h:56
This class implements..
Definition: PixelROCName.h:23
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
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 125 of file PixelMaxVsf.cc.

References rocs_.

125  {
126 
127  std::map<PixelROCName,unsigned int>::const_iterator itr = rocs_.find(roc);
128 
129  if (itr==rocs_.end()) {
130  return false;
131  }
132 
133  Vsf=itr->second;
134 
135  return true;
136 
137 }
std::map< PixelROCName, unsigned int > rocs_
Definition: PixelMaxVsf.h:56
void PixelMaxVsf::setVsf ( PixelROCName  roc,
unsigned int  Vsf 
)

Definition at line 140 of file PixelMaxVsf.cc.

References rocs_.

140  {
141 
142  rocs_[roc]=Vsf;
143 
144 }
std::map< PixelROCName, unsigned int > rocs_
Definition: PixelMaxVsf.h:56
void PixelMaxVsf::writeASCII ( std::string  dir = "") const
virtual

Implements pos::PixelConfigBase.

Definition at line 148 of file PixelMaxVsf.cc.

References gather_cfg::cout, cmsRelvalreport::exit, lut2db_cfg::filename, dbtoconf::out, rocs_, and AlCaHLTBitMon_QueryRunRegistry::string.

148  {
149 
150  std::string mthn = "[PixelMaxVsf::writeASCII()]\t\t\t\t " ;
151  if (dir!="") dir+="/";
152  std::string filename=dir+"maxvsf.dat";
153 
154  std::ofstream out(filename.c_str(), std::ios_base::out) ;
155  if(!out) {
156  std::cout << __LINE__ << "]\t" << mthn << "Could not open file " << filename << " for write" << std::endl ;
157  exit(1);
158  }
159 
160 
161  std::map<PixelROCName, unsigned int>::const_iterator irocs = rocs_.begin();
162  for(; irocs != rocs_.end() ; irocs++){
163  out << (irocs->first).rocname() << " " << irocs->second << endl ;
164  }
165 
166  out.close();
167 
168 }
std::map< PixelROCName, unsigned int > rocs_
Definition: PixelMaxVsf.h:56
tuple out
Definition: dbtoconf.py:99
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
dbl *** dir
Definition: mlp_gen.cc:35
void pos::PixelMaxVsf::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlinevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 34 of file PixelMaxVsf.h.

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

Reimplemented from pos::PixelConfigBase.

Definition at line 216 of file PixelMaxVsf.cc.

References rocs_, and AlCaHLTBitMon_QueryRunRegistry::string.

219 {
220  std::string mthn = "[PixelMaxVsf::writeXML()]\t\t\t " ;
221 
222  std::map<PixelROCName, unsigned int>::const_iterator irocs = rocs_.begin();
223  for(; irocs != rocs_.end() ; irocs++){
224  *outstream << " <DATA>" << std::endl ;
225  *outstream << " <ROC_NAME>" << (irocs->first).rocname() << "</ROC_NAME>" << std::endl ;
226  *outstream << " <MAXVSF>" << irocs->second << "</MAXVSF>" << std::endl ;
227  *outstream << " </DATA>" << std::endl ;
228  *outstream << std::endl ;
229  }
230 }
std::map< PixelROCName, unsigned int > rocs_
Definition: PixelMaxVsf.h:56
void PixelMaxVsf::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::PixelConfigBase.

Definition at line 171 of file PixelMaxVsf.cc.

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

177 {
178  std::string mthn = "[PixelMaxVsf::writeXMLHeader()]\t\t\t " ;
179  std::stringstream maskFullPath ;
180 
181  maskFullPath << path << "/Pixel_RocMaxVsf_" << PixelTimeFormatter::getmSecTime() << ".xml";
182  std::cout << __LINE__ << "]\t" << mthn << "Writing to: " << maskFullPath.str() << std::endl ;
183 
184  outstream->open(maskFullPath.str().c_str()) ;
185 
186  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
187  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
188  *outstream << "" << std::endl ;
189  *outstream << " <HEADER>" << std::endl ;
190  *outstream << " <TYPE>" << std::endl ;
191  *outstream << " <EXTENSION_TABLE_NAME>ROC_MAXVSF</EXTENSION_TABLE_NAME>" << std::endl ;
192  *outstream << " <NAME>ROC MaxVsf Setting</NAME>" << std::endl ;
193  *outstream << " </TYPE>" << std::endl ;
194  *outstream << " <RUN>" << std::endl ;
195  *outstream << " <RUN_TYPE>ROC MaxVsf Settings</RUN_TYPE>" << std::endl ;
196  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
197  *outstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
198  *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl ;
199  *outstream << " </RUN>" << std::endl ;
200  *outstream << " </HEADER>" << std::endl ;
201  *outstream << "" << std::endl ;
202  *outstream << " <DATA_SET>" << std::endl ;
203  *outstream << "" << std::endl ;
204  *outstream << " <VERSION>" << version << "</VERSION>" << std::endl ;
205  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl ;
206  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl ;
207  *outstream << "" << std::endl ;
208  *outstream << " <PART>" << std::endl ;
209  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
210  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
211  *outstream << " </PART>" << std::endl ;
212 
213 }
static std::string getmSecTime(void)
tuple path
else: Piece not in the list, fine.
static std::string getTime(void)
std::string getComment() const
std::string getAuthor() const
tuple cout
Definition: gather_cfg.py:121
void PixelMaxVsf::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelConfigBase.

Definition at line 233 of file PixelMaxVsf.cc.

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

236 {
237  std::string mthn = "[PixelMaxVsf::writeXMLTrailer()]\t\t\t " ;
238 
239  *outstream << " </DATA_SET>" << std::endl ;
240  *outstream << "</ROOT>" << std::endl ;
241 
242  outstream->close() ;
243  std::cout << __LINE__ << "]\t" << mthn << "Data written " << std::endl ;
244 
245 }
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

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

Definition at line 56 of file PixelMaxVsf.h.

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