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::PixelDetectorConfig Class Reference

This is the documentation about PixelDetectorConfig... More...

#include <PixelDetectorConfig.h>

Inheritance diagram for pos::PixelDetectorConfig:
pos::PixelConfigBase

Public Member Functions

void addROC (PixelROCName &, std::string statusLabel)
 
void addROC (PixelROCName &)
 
bool containsModule (const PixelModuleName &moduleToFind) const
 
std::set< unsigned int > getFEDs (PixelNameTranslation *translation) const
 
std::map< unsigned int,
std::set< unsigned int > > 
getFEDsAndChannels (PixelNameTranslation *translation) const
 
PixelModuleName getModule (unsigned int i) const
 
const std::vector
< PixelModuleName > & 
getModuleList () const
 
unsigned int getNModules () const
 
const std::map< PixelROCName,
PixelROCStatus > & 
getROCsList () const
 
 PixelDetectorConfig (std::vector< std::vector< std::string > > &tableMat)
 
 PixelDetectorConfig (std::string filename)
 
void removeROC (PixelROCName &)
 
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::vector< PixelModuleNamemodules_
 
std::map< PixelROCName,
PixelROCStatus
rocs_
 

Detailed Description

This is the documentation about PixelDetectorConfig...

" "

Definition at line 39 of file PixelDetectorConfig.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file PixelDetectorConfig.cc.

References c, containsModule(), pos::PixelROCStatus::get(), cuy::ins, callgraph::module, modules_, dqmiodumpmetadata::n, pos::PixelROCStatus::noInit, alignCSCRings::r, PixelMapPlotter::roc, rocs_, pos::PixelROCStatus::set(), mps_update::status, and AlCaHLTBitMon_QueryRunRegistry::string.

22  : PixelConfigBase("", "", "") {
23  std::string mthn = "]\t[PixelDetectorConfig::PixelDetectorConfig()]\t\t ";
24  std::vector<std::string> ins = tableMat[0];
25  std::map<std::string, int> colM;
26  std::vector<std::string> colNames;
27  /*
28  EXTENSION_TABLE_NAME: PIXEL_DETECTOR_CONFIG (VIEW: CONF_KEY_DET_CONFIG_V)
29 
30  CONFIG_KEY NOT NULL VARCHAR2(80)
31  KEY_TYPE NOT NULL VARCHAR2(80)
32  KEY_ALIAS NOT NULL VARCHAR2(80)
33  VERSION VARCHAR2(40)
34  KIND_OF_COND NOT NULL VARCHAR2(40)
35  ROC_NAME NOT NULL VARCHAR2(200)
36  ROC_STATUS NOT NULL VARCHAR2(200)
37  */
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("ROC_STATUS");
45 
46  for (unsigned int c = 0; c < ins.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 
55  /*
56  for(unsigned int n=0; n<colNames.size(); n++){
57  if(colM.find(colNames[n]) == colM.end()){
58  std::cerr << __LINE__ << mthn << "Couldn't find in the database the column with name " << colNames[n] << std::endl;
59  assert(0);
60  }
61  }
62  */
63 
64  modules_.clear();
65  rocs_.clear();
66  std::string module = "";
67  for (unsigned int r = 1; r < tableMat.size(); r++) { //Goes to every row of the Matrix
68  PixelROCName roc(tableMat[r][colM["ROC_NAME"]]); // see DACSettings!!!!
69  PixelROCStatus rocstatus;
70  std::string status = tableMat[r][colM["ROC_STATUS"]];
71  // The following is due to the fact that enabled ROCs are
72  // labelled as ON in the DataBase, but have NO label in
73  // configuration files!!!
74  if (status.find("on") != string::npos) {
75  status = "";
76  }
77  if (!status.empty()) {
78  rocstatus.set(status);
79  }
80  rocs_[roc] = rocstatus;
81  if (!rocstatus.get(PixelROCStatus::noInit)) {
82  PixelModuleName module(tableMat[r][colM["ROC_NAME"]]);
83  if (!containsModule(module)) {
84  modules_.push_back(module);
85  }
86  }
87  } //end for r
88 
89  // std::cout << __LINE__ << mthn << "Number of Modules in Detector Configuration Class: " << getNModules() << std::endl;
90 
91 } //end constructor
const edm::EventSetup & c
list status
Definition: mps_update.py:107
bool get(ROCstatus stat) const
std::map< PixelROCName, PixelROCStatus > rocs_
tuple ins
Definition: cuy.py:313
std::vector< PixelModuleName > modules_
void set(ROCstatus stat)
This class implements..
This class implements..
Definition: PixelROCName.h:23
This class implements..
bool containsModule(const PixelModuleName &moduleToFind) const
PixelConfigBase(std::string description, std::string creator, std::string date)
tuple module
Definition: callgraph.py:69
PixelDetectorConfig::PixelDetectorConfig ( std::string  filename)

Definition at line 95 of file PixelDetectorConfig.cc.

References cms::cuda::assert(), containsModule(), gather_cfg::cout, pos::PixelROCStatus::get(), recoMuon::in, geometryCSVtoXML::line, callgraph::module, convertParamsToOnlineFormat::moduleName, modules_, pos::PixelROCStatus::noInit, PixelMapPlotter::roc, rocs_, pos::PixelROCStatus::set(), mps_update::status, and AlCaHLTBitMon_QueryRunRegistry::string.

95  : PixelConfigBase("", "", "") {
96  std::string mthn = "[PixelDetectorConfig::PixelDetectorConfig()]\t\t ";
97 
98  if (filename[filename.size() - 1] == 't') {
99  std::ifstream in(filename.c_str());
100 
101  if (!in.good()) {
102  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
103  throw std::runtime_error("Failed to open file " + filename);
104  } else {
105  std::cout << __LINE__ << "]\t" << mthn << "Opened: " << filename << std::endl;
106  }
107 
108  if (in.eof()) {
109  std::cout << __LINE__ << "]\t" << mthn << "EOF before reading anything!" << std::endl;
110  throw std::runtime_error("File seems to be empty " + filename);
111  }
112 
113  modules_.clear();
114  rocs_.clear();
115 
117 
118  in >> module;
119 
120  if (module == "Rocs:") {
121  std::cout << __LINE__ << "]\t" << mthn << "New format of detconfig" << std::endl;
122  //new format with list of ROCs.
123  std::string rocname;
124  in >> rocname;
125  while (!in.eof()) {
126  //cout << __LINE__ << "]\t" << mthn << "Read rocname:"<<rocname<<endl;
127  PixelROCName roc(rocname);
129  getline(in, line);
130  //cout << __LINE__ << "]\t" << mthn << "Read line:'"<<line<<"'"<<endl;
131  istringstream instring(line);
132  PixelROCStatus rocstatus;
134  while (!instring.eof()) {
135  instring >> status;
136  // cout << __LINE__ << "]\t" << mthn << "Read status:"<<status<<endl;
137  if (!status.empty()) {
138  rocstatus.set(status);
139  }
140  }
141  rocs_[roc] = rocstatus;
142  if (!rocstatus.get(PixelROCStatus::noInit)) {
143  PixelModuleName module(rocname);
144  if (!containsModule(module)) {
145  modules_.push_back(module);
146  }
147  }
148  in >> rocname;
149  }
150  return;
151  }
152 
153  //std::cout << __LINE__ << "]\t" << mthn << "Read module:"<<module<<std::endl;
154 
155  if (in.eof())
156  std::cout << mthn << "EOF after reading first module name" << std::endl;
157 
158  std::cout << __LINE__ << "]\t" << mthn << "Old format of detconfig" << std::endl;
159  while (!in.eof()) {
160  //std::cout << __LINE__ << "]\t" << mthn << "Read module:"<<module<<std::endl;
161 
162  PixelModuleName moduleName(module);
163 
164  modules_.push_back(moduleName);
165 
166  in >> module;
167 
168  assert(modules_.size() < 10000);
169  }
170 
171  in.close();
172 
173  } else {
174  assert(0);
175 
176  /*
177  std::ifstream in(filename.c_str(),std::ios::binary);
178 
179  if (!in.good()){
180  std::cout << __LINE__ << "]\t" << mthn << "Could not open:"<<filename<<std::endl;
181  assert(0);
182  }
183  else {
184  std::cout << __LINE__ << "]\t" << mthn << "Opened:"<<filename<<std::endl;
185  }
186 
187  char nchar;
188 
189  in.read(&nchar,1);
190 
191  std::string s1;
192 
193  //wrote these lines of code without ref. needs to be fixed
194  for(int i=0;i< nchar; i++){
195  char c;
196  in >>c;
197  s1.push_back(c);
198  }
199 
200  //std::cout << __LINE__ << "]\t" << mthn << "READ ROC name:"<<s1<<std::endl;
201 
202  dacsettings_.clear();
203 
204 
205  while (!in.eof()){
206 
207  //std::cout << __LINE__ << "]\t" << mthn << "read s1:"<<s1<<std::endl;
208 
209  PixelROCName rocid(s1);
210 
211  //std::cout << __LINE__ << "]\t" << mthn << "read rocid:"<<rocid<<std::endl;
212 
213  PixelROCDetectorConfig tmp;
214 
215  tmp.readBinary(in, rocid);
216 
217  dacsettings_.push_back(tmp);
218 
219 
220  in.read(&nchar,1);
221 
222  s1.clear();
223 
224  if (in.eof()) continue;
225 
226  //wrote these lines of code without ref. needs to be fixed
227  for(int i=0;i< nchar; i++){
228  char c;
229  in >>c;
230  s1.push_back(c);
231  }
232 
233 
234  }
235 
236  in.close();
237 
238  */
239  }
240 
241  //std::cout << __LINE__ << "]\t" << mthn << "Read dac settings for "<<dacsettings_.size()<<" ROCs"<<std::endl;
242 }
list status
Definition: mps_update.py:107
bool get(ROCstatus stat) const
assert(be >=bs)
std::map< PixelROCName, PixelROCStatus > rocs_
std::vector< PixelModuleName > modules_
void set(ROCstatus stat)
This class implements..
This class implements..
Definition: PixelROCName.h:23
This class implements..
bool containsModule(const PixelModuleName &moduleToFind) const
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:144
PixelConfigBase(std::string description, std::string creator, std::string date)
tuple module
Definition: callgraph.py:69

Member Function Documentation

void pos::PixelDetectorConfig::addROC ( PixelROCName ,
std::string  statusLabel 
)
void PixelDetectorConfig::addROC ( PixelROCName theROC)

Definition at line 502 of file PixelDetectorConfig.cc.

References pos::PixelROCStatus::reset(), rocs_, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

503 {
504  std::stringstream s;
505  s << __LINE__ << "]\t[PixelDetectorConfig::addROC()]\t\t\t\t ";
506  std::string mthn = s.str();
507 
508  std::map<PixelROCName, PixelROCStatus>::iterator theROCIt = rocs_.find(theROC);
509  if (theROCIt == rocs_.end()) // if theROC was not there, add it and turn it on
510  {
511  PixelROCStatus theStatus;
512  theStatus.reset();
513  rocs_[theROC] = theStatus;
514  // cout << __LINE__ << "]\t" << mthn << "Non existing ROC (" << theROC.rocname() << "): adding it" << endl ;
515  } else {
516  theROCIt->second.reset(); // otherwise just turn it on by resetting it to zero
517  // cout << __LINE__ << "]\t" << mthn << "Already existing ROC (" << theROC.rocname() << "): switching it on" << endl ;
518  }
519 }
std::map< PixelROCName, PixelROCStatus > rocs_
This class implements..
bool PixelDetectorConfig::containsModule ( const PixelModuleName moduleToFind) const

Definition at line 291 of file PixelDetectorConfig.cc.

References modules_.

Referenced by pos::PixelCalibConfiguration::buildROCAndModuleLists(), pos::PixelCalibConfiguration::fedCardsAndChannels(), pos::PixelNameTranslation::getChannels(), and PixelDetectorConfig().

291  {
292  for (std::vector<PixelModuleName>::const_iterator modules_itr = modules_.begin(); modules_itr != modules_.end();
293  ++modules_itr) {
294  if (*modules_itr == moduleToFind)
295  return true;
296  }
297  return false;
298 }
std::vector< PixelModuleName > modules_
std::set< unsigned int > PixelDetectorConfig::getFEDs ( PixelNameTranslation translation) const

Definition at line 248 of file PixelDetectorConfig.cc.

References cms::cuda::assert(), pos::PixelHdwAddress::fednumber(), unpackBuffers-CaloStage1::feds, pos::PixelNameTranslation::getChannelsOnModule(), pos::PixelNameTranslation::getHdwAddress(), and modules_.

248  {
249  std::set<unsigned int> feds;
250  assert(!modules_.empty());
251  std::vector<PixelModuleName>::const_iterator imodule = modules_.begin();
252 
253  for (; imodule != modules_.end(); ++imodule) {
254  std::set<PixelChannel> channelsOnThisModule = translation->getChannelsOnModule(*imodule);
255  for (std::set<PixelChannel>::const_iterator channelsOnThisModule_itr = channelsOnThisModule.begin();
256  channelsOnThisModule_itr != channelsOnThisModule.end();
257  ++channelsOnThisModule_itr) {
258  const PixelHdwAddress &channel_hdwaddress = translation->getHdwAddress(*channelsOnThisModule_itr);
259  unsigned int fednumber = channel_hdwaddress.fednumber();
260  feds.insert(fednumber);
261  }
262  }
263 
264  return feds;
265 }
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
unsigned int fednumber() const
assert(be >=bs)
Store mfec, mfecchannel etc.
std::vector< PixelModuleName > modules_
std::set< PixelChannel > getChannelsOnModule(const PixelModuleName &aModule) const
std::map< unsigned int, std::set< unsigned int > > PixelDetectorConfig::getFEDsAndChannels ( PixelNameTranslation translation) const

Definition at line 268 of file PixelDetectorConfig.cc.

References cms::cuda::assert(), pos::PixelHdwAddress::fedchannel(), pos::PixelHdwAddress::fednumber(), pos::PixelNameTranslation::getChannelsOnModule(), pos::PixelNameTranslation::getHdwAddress(), and modules_.

269  {
270  // FED Number channels
271 
272  std::map<unsigned int, std::set<unsigned int> > fedsChannels;
273  assert(!modules_.empty());
274  std::vector<PixelModuleName>::const_iterator imodule = modules_.begin();
275 
276  for (; imodule != modules_.end(); ++imodule) {
277  std::set<PixelChannel> channelsOnThisModule = translation->getChannelsOnModule(*imodule);
278  for (std::set<PixelChannel>::const_iterator channelsOnThisModule_itr = channelsOnThisModule.begin();
279  channelsOnThisModule_itr != channelsOnThisModule.end();
280  ++channelsOnThisModule_itr) {
281  const PixelHdwAddress &channel_hdwaddress = translation->getHdwAddress(*channelsOnThisModule_itr);
282  unsigned int fednumber = channel_hdwaddress.fednumber();
283  unsigned int fedchannel = channel_hdwaddress.fedchannel();
284  fedsChannels[fednumber].insert(fedchannel);
285  }
286  }
287 
288  return fedsChannels;
289 }
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
unsigned int fednumber() const
assert(be >=bs)
unsigned int fedchannel() const
Store mfec, mfecchannel etc.
std::vector< PixelModuleName > modules_
std::set< PixelChannel > getChannelsOnModule(const PixelModuleName &aModule) const
PixelModuleName PixelDetectorConfig::getModule ( unsigned int  i) const

Definition at line 246 of file PixelDetectorConfig.cc.

References mps_fire::i, and modules_.

246 { return modules_[i]; }
std::vector< PixelModuleName > modules_
const std::vector<PixelModuleName>& pos::PixelDetectorConfig::getModuleList ( ) const
inline

Definition at line 48 of file PixelDetectorConfig.h.

References modules_.

Referenced by pos::PixelCalibConfiguration::buildROCAndModuleLists(), and pos::PixelPortcardMap::portcards().

48 { return modules_; }
std::vector< PixelModuleName > modules_
unsigned int PixelDetectorConfig::getNModules ( ) const

Definition at line 244 of file PixelDetectorConfig.cc.

References modules_.

244 { return modules_.size(); }
std::vector< PixelModuleName > modules_
const std::map<PixelROCName, PixelROCStatus>& pos::PixelDetectorConfig::getROCsList ( ) const
inline
void PixelDetectorConfig::removeROC ( PixelROCName theROC)

Definition at line 543 of file PixelDetectorConfig.cc.

References rocs_, pos::PixelROCStatus::set(), and AlCaHLTBitMon_QueryRunRegistry::string.

544 {
545  std::string mthn = "[PixelDetectorConfig::removeROC()]\t\t\t\t ";
546 
547  std::map<PixelROCName, PixelROCStatus>::iterator theROCIt = rocs_.find(theROC);
548  if (theROCIt != rocs_.end()) // if theROC was there remove it, otherwise ignore
549  {
550  theROCIt->second.set("noInit");
551  // cout << __LINE__ << "]\t" << mthn << "Already existing ROC (" << theROC.rocname() << "): switching it off" << endl ;
552  } else {
553  PixelROCStatus theStatus;
554  theStatus.set("noInit");
555  rocs_[theROC] = theStatus;
556  // cout << __LINE__ << "]\t" << mthn << "ROC " << theROC.rocname() << " was not individually declared in the file: declare and switch off" << endl ;
557  }
558 }
std::map< PixelROCName, PixelROCStatus > rocs_
void set(ROCstatus stat)
This class implements..
void PixelDetectorConfig::writeASCII ( std::string  dir = "") const
overridevirtual

Implements pos::PixelConfigBase.

Definition at line 301 of file PixelDetectorConfig.cc.

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

301  {
302  std::stringstream s;
303  s << __LINE__ << "]\t[PixelDetectorConfig::writeASCII()]\t\t ";
304  std::string mthn = s.str();
305 
306  if (!dir.empty())
307  dir += "/";
308  std::string filename = dir + "detectconfig.dat";
309 
310  std::ofstream out(filename.c_str(), std::ios_base::out);
311  if (!out) {
312  std::cout << __LINE__ << "]\t" << mthn << "Could not open file " << filename << " for write" << std::endl;
313  exit(1);
314  }
315 
316  if (rocs_.empty()) {
317  std::vector<PixelModuleName>::const_iterator imodule = modules_.begin();
318 
319  for (; imodule != modules_.end(); ++imodule) {
320  out << *imodule << std::endl;
321  }
322  } else {
323  out << "Rocs:" << endl;
324  std::map<PixelROCName, PixelROCStatus>::const_iterator irocs = rocs_.begin();
325  for (; irocs != rocs_.end(); ++irocs) {
326  out << (irocs->first).rocname() << " " << (irocs->second).statusName() << endl;
327  }
328  }
329 
330  out.close();
331 }
std::map< PixelROCName, PixelROCStatus > rocs_
std::vector< PixelModuleName > modules_
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:144
void PixelDetectorConfig::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 432 of file PixelDetectorConfig.cc.

References cms::cuda::assert(), gather_cfg::cout, contentValuesFiles::fullPath, pos::PixelTimeFormatter::getTime(), modules_, submitPVResolutionJobs::out, rocs_, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

432  {
433  std::stringstream s;
434  s << __LINE__ << "]\t[PixelDetectorConfig::writeXML()]\t\t\t ";
435  std::string mthn = s.str();
436 
437  std::stringstream fullPath;
438 
439  fullPath << path << "/Pixel_DetectorConfig.xml";
440  cout << __LINE__ << "]\t" << mthn << "Writing to: " << fullPath.str() << std::endl;
441 
442  std::ofstream out(fullPath.str().c_str());
443 
444  out << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl;
445  out << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl;
446  out << " <HEADER>" << std::endl;
447  out << " <TYPE>" << std::endl;
448  out << " <EXTENSION_TABLE_NAME>PIXEL_DETECTOR_CONFIG</EXTENSION_TABLE_NAME>" << std::endl;
449  out << " <NAME>Pixel Detector Configuration</NAME>" << std::endl;
450  out << " </TYPE>" << std::endl;
451  out << " <RUN>" << std::endl;
452  out << " <RUN_TYPE>Pixel Detector Configuration test</RUN_TYPE>" << std::endl;
453  out << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl;
454  out << " <RUN_BEGIN_TIMESTAMP>" << pos::PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl;
455  out << " <COMMENT_DESCRIPTION>Test of DetectorConfig xml</COMMENT_DESCRIPTION>" << std::endl;
456  out << " <LOCATION>CERN TAC</LOCATION>" << std::endl;
457  out << " <CREATED_BY_USER>Dario Menasce</CREATED_BY_USER>" << std::endl;
458  out << " </RUN>" << std::endl;
459  out << " </HEADER>" << std::endl;
460  out << "" << std::endl;
461  out << "" << std::endl;
462 
463  if (rocs_.empty()) {
464  std::vector<PixelModuleName>::const_iterator imodule = modules_.begin();
465 
466  // This needs to be fixed: given a module name, actually loop over ROCs to write the XML data
467  for (; imodule != modules_.end(); ++imodule) {
468  out << " <DATA>" << std::endl;
469  //----> out << " <ROC_NAME>" << (irocs->first).rocname() << "</ROC_NAME>" << std::endl ;
470  out << " <ROC_STATUS>on</ROC_STATUS>" << std::endl;
471  out << " </DATA>" << std::endl;
472  out << " " << std::endl;
473  }
474  } else {
475  std::map<PixelROCName, PixelROCStatus>::const_iterator irocs = rocs_.begin();
476  for (; irocs != rocs_.end(); ++irocs) {
477  std::string sts = (irocs->second).statusName();
478  if (sts.empty()) {
479  sts = "on";
480  }
481  out << " <DATA_SET>" << std::endl;
482  out << " <VERSION>" << version << "</VERSION>" << std::endl;
483  out << " <PART>" << std::endl;
484  out << " <NAME_LABEL>" << (irocs->first).rocname() << "</NAME_LABEL>" << std::endl;
485  out << " <KIND_OF_PART>ROC</KIND_OF_PART>" << std::endl;
486  out << " </PART>" << std::endl;
487  out << " <DATA>" << std::endl;
488  out << " <ROC_NAME>" << (irocs->first).rocname() << "</ROC_NAME>" << std::endl;
489  out << " <ROC_STATUS>" << sts << "</ROC_STATUS>" << std::endl;
490  out << " </DATA>" << std::endl;
491  out << " </DATA_SET>" << std::endl;
492  out << " " << std::endl;
493  }
494  }
495  out << " </DATA_SET>" << std::endl;
496  out << "</ROOT> " << std::endl;
497  out.close();
498  assert(0);
499 }
assert(be >=bs)
static std::string getTime(void)
std::map< PixelROCName, PixelROCStatus > rocs_
std::vector< PixelModuleName > modules_
tuple cout
Definition: gather_cfg.py:144
void PixelDetectorConfig::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 384 of file PixelDetectorConfig.cc.

References modules_, rocs_, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

386  {
387  std::stringstream s;
388  s << __LINE__ << "]\t[PixelDetectorConfig::writeXML()]\t\t\t ";
389  std::string mthn = s.str();
390  if (rocs_.empty()) {
391  std::vector<PixelModuleName>::const_iterator imodule = modules_.begin();
392 
393  // This needs to be fixed: given a module name, actually loop over ROCs to write the XML data
394  for (; imodule != modules_.end(); ++imodule) {
395  *outstream << " <DATA>" << std::endl;
396  //----> out << " <ROC_NAME>" << (irocs->first).rocname() << "</ROC_NAME>" << std::endl ;
397  *outstream << " <ROC_STATUS>on</ROC_STATUS>" << std::endl;
398  *outstream << " </DATA>" << std::endl;
399  *outstream << " " << std::endl;
400  }
401  } else {
402  std::map<PixelROCName, PixelROCStatus>::const_iterator irocs = rocs_.begin();
403  for (; irocs != rocs_.end(); ++irocs) {
404  std::string sts = (irocs->second).statusName();
405  if (sts.empty()) {
406  sts = "on";
407  }
408  *outstream << " " << std::endl;
409  *outstream << " <DATA>" << std::endl;
410  *outstream << " <ROC_NAME>" << (irocs->first).rocname() << "</ROC_NAME>" << std::endl;
411  *outstream << " <ROC_STATUS>" << sts << "</ROC_STATUS>" << std::endl;
412  *outstream << " </DATA>" << std::endl;
413  }
414  }
415 }
std::map< PixelROCName, PixelROCStatus > rocs_
std::vector< PixelModuleName > modules_
void PixelDetectorConfig::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 334 of file PixelDetectorConfig.cc.

References cms::cuda::assert(), gather_cfg::cout, contentValuesFiles::fullPath, pos::PixelConfigBase::getAuthor(), pos::PixelConfigBase::getComment(), pos::PixelTimeFormatter::getmSecTime(), pos::PixelTimeFormatter::getTime(), and AlCaHLTBitMon_QueryRunRegistry::string.

339  {
340  std::string mthn = "]\t[PixelDetectorConfig::writeXMLHeader()]\t\t\t ";
341  std::stringstream fullPath;
342  fullPath << path << "/Pixel_DetectorConfig_" << PixelTimeFormatter::getmSecTime() << ".xml";
343  cout << __LINE__ << mthn << "Writing to: " << fullPath.str() << endl;
344 
345  outstream->open(fullPath.str().c_str());
346 
347  if (!outstream->good()) {
348  cout << __LINE__ << mthn << "FATAL: could not open file " << fullPath.str() << endl;
349  assert(0);
350  }
351 
352  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl;
353  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl;
354  *outstream << "" << std::endl;
355  *outstream << " <!-- " << mthn << "-->" << std::endl;
356  *outstream << "" << std::endl;
357  *outstream << " <HEADER>" << std::endl;
358  *outstream << " <TYPE>" << std::endl;
359  *outstream << " <EXTENSION_TABLE_NAME>PIXEL_DETECTOR_CONFIG</EXTENSION_TABLE_NAME>" << std::endl;
360  *outstream << " <NAME>Pixel Detector Configuration</NAME>" << std::endl;
361  *outstream << " </TYPE>" << std::endl;
362  *outstream << " <RUN>" << std::endl;
363  *outstream << " <RUN_TYPE>Pixel Detector Configuration test</RUN_TYPE>" << std::endl;
364  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl;
365  *outstream << " <RUN_BEGIN_TIMESTAMP>" << pos::PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>"
366  << std::endl;
367  *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl;
368  *outstream << " </RUN>" << std::endl;
369  *outstream << " </HEADER>" << std::endl;
370  *outstream << "" << std::endl;
371  *outstream << " <DATA_SET>" << std::endl;
372  *outstream << " " << std::endl;
373  *outstream << " <VERSION>" << version << "</VERSION>" << std::endl;
374  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl;
375  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl;
376  *outstream << " " << std::endl;
377  *outstream << " <PART>" << std::endl;
378  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl;
379  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl;
380  *outstream << " </PART>" << std::endl;
381 }
assert(be >=bs)
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 PixelDetectorConfig::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 418 of file PixelDetectorConfig.cc.

References alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

420  {
421  std::stringstream s;
422  s << __LINE__ << "]\t[PixelDetectorConfig::writeXMLTrailer()]\t\t\t ";
423  std::string mthn = s.str();
424 
425  *outstream << " " << std::endl;
426  *outstream << " </DATA_SET>" << std::endl;
427  *outstream << "</ROOT> " << std::endl;
428 
429  outstream->close();
430 }

Member Data Documentation

std::vector<PixelModuleName> pos::PixelDetectorConfig::modules_
private
std::map<PixelROCName, PixelROCStatus> pos::PixelDetectorConfig::rocs_
private