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::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
 
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::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 22 of file PixelDetectorConfig.cc.

References EnergyCorrector::c, containsModule(), pos::PixelROCStatus::get(), cuy::ins, python.rootplot.argparse::module, modules_, n, pos::PixelROCStatus::noInit, alignCSCRings::r, rocs_, pos::PixelROCStatus::set(), ntuplemaker::status, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 98 of file PixelDetectorConfig.cc.

References containsModule(), gather_cfg::cout, pos::PixelROCStatus::get(), recoMuon::in, geometryCSVtoXML::line, python.rootplot.argparse::module, edm::moduleName(), modules_, pos::PixelROCStatus::noInit, rocs_, pos::PixelROCStatus::set(), ntuplemaker::status, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Member Function Documentation

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

Definition at line 545 of file PixelDetectorConfig.cc.

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

546 {
547  std::stringstream s ; s << __LINE__ << "]\t[PixelDetectorConfig::addROC()]\t\t\t\t " ;
548  std::string mthn = s.str() ;
549 
550  std::map<PixelROCName, PixelROCStatus>::iterator theROCIt = rocs_.find(theROC) ;
551  if( theROCIt == rocs_.end() ) // if theROC was not there, add it and turn it on
552  {
553  PixelROCStatus theStatus ;
554  theStatus.reset() ;
555  rocs_[theROC] = theStatus ;
556 // cout << __LINE__ << "]\t" << mthn << "Non existing ROC (" << theROC.rocname() << "): adding it" << endl ;
557  } else {
558  theROCIt->second.reset() ; // otherwise just turn it on by resetting it to zero
559 // cout << __LINE__ << "]\t" << mthn << "Already existing ROC (" << theROC.rocname() << "): switching it on" << endl ;
560  }
561 }
std::map< PixelROCName, PixelROCStatus > rocs_
This class implements..
bool PixelDetectorConfig::containsModule ( const PixelModuleName moduleToFind) const

Definition at line 320 of file PixelDetectorConfig.cc.

References modules_.

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

321 {
322  for ( std::vector<PixelModuleName>::const_iterator modules_itr = modules_.begin(); modules_itr != modules_.end(); modules_itr++ )
323  {
324  if ( *modules_itr == moduleToFind ) return true;
325  }
326  return false;
327 }
std::vector< PixelModuleName > modules_
std::set< unsigned int > PixelDetectorConfig::getFEDs ( PixelNameTranslation translation) const

Definition at line 272 of file PixelDetectorConfig.cc.

References pos::PixelHdwAddress::fednumber(), pos::PixelNameTranslation::getChannelsOnModule(), pos::PixelNameTranslation::getHdwAddress(), and modules_.

273 {
274 
275  std::set <unsigned int> feds;
276  assert(modules_.size()!=0);
277  std::vector<PixelModuleName>::const_iterator imodule=modules_.begin();
278 
279  for (;imodule!=modules_.end();++imodule) {
280 
281  std::set<PixelChannel> channelsOnThisModule = translation->getChannelsOnModule(*imodule);
282  for ( std::set<PixelChannel>::const_iterator channelsOnThisModule_itr = channelsOnThisModule.begin(); channelsOnThisModule_itr != channelsOnThisModule.end(); channelsOnThisModule_itr++ )
283  {
284  const PixelHdwAddress& channel_hdwaddress = translation->getHdwAddress(*channelsOnThisModule_itr);
285  unsigned int fednumber=channel_hdwaddress.fednumber();
286  feds.insert(fednumber);
287  }
288 
289  }
290 
291  return feds;
292 }
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
unsigned int fednumber() const
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 296 of file PixelDetectorConfig.cc.

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

297 {
298  // FED Number channels
299 
300  std::map <unsigned int, std::set<unsigned int> > fedsChannels;
301  assert(modules_.size()!=0);
302  std::vector<PixelModuleName>::const_iterator imodule=modules_.begin();
303 
304  for (;imodule!=modules_.end();++imodule) {
305 
306  std::set<PixelChannel> channelsOnThisModule = translation->getChannelsOnModule(*imodule);
307  for ( std::set<PixelChannel>::const_iterator channelsOnThisModule_itr = channelsOnThisModule.begin(); channelsOnThisModule_itr != channelsOnThisModule.end(); channelsOnThisModule_itr++ )
308  {
309  const PixelHdwAddress& channel_hdwaddress = translation->getHdwAddress(*channelsOnThisModule_itr);
310  unsigned int fednumber=channel_hdwaddress.fednumber();
311  unsigned int fedchannel=channel_hdwaddress.fedchannel();
312  fedsChannels[fednumber].insert(fedchannel);
313  }
314 
315  }
316 
317  return fedsChannels;
318 }
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
unsigned int fednumber() const
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 266 of file PixelDetectorConfig.cc.

References i, and modules_.

266  {
267 
268  return modules_[i];
269 
270 }
int i
Definition: DBlmapReader.cc:9
std::vector< PixelModuleName > modules_
const std::vector<PixelModuleName>& pos::PixelDetectorConfig::getModuleList ( ) const
inline

Definition at line 50 of file PixelDetectorConfig.h.

References modules_.

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

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

Definition at line 260 of file PixelDetectorConfig.cc.

References modules_.

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

Definition at line 584 of file PixelDetectorConfig.cc.

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

585 {
586  std::string mthn = "[PixelDetectorConfig::removeROC()]\t\t\t\t " ;
587 
588  std::map<PixelROCName, PixelROCStatus>::iterator theROCIt = rocs_.find(theROC) ;
589  if( theROCIt != rocs_.end() ) // if theROC was there remove it, otherwise ignore
590  {
591  theROCIt->second.set("noInit") ;
592 // cout << __LINE__ << "]\t" << mthn << "Already existing ROC (" << theROC.rocname() << "): switching it off" << endl ;
593  } else {
594  PixelROCStatus theStatus ;
595  theStatus.set("noInit") ;
596  rocs_[theROC] = theStatus ;
597 // cout << __LINE__ << "]\t" << mthn << "ROC " << theROC.rocname() << " was not individually declared in the file: declare and switch off" << endl ;
598  }
599 }
std::map< PixelROCName, PixelROCStatus > rocs_
void set(ROCstatus stat)
This class implements..
void PixelDetectorConfig::writeASCII ( std::string  dir = "") const
virtual

Implements pos::PixelConfigBase.

Definition at line 330 of file PixelDetectorConfig.cc.

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

330  {
331 
332  std::stringstream s ; s << __LINE__ << "]\t[PixelDetectorConfig::writeASCII()]\t\t " ;
333  std::string mthn = s.str() ;
334 
335  if (dir!="") dir+="/";
336  std::string filename=dir+"detectconfig.dat";
337 
338  std::ofstream out(filename.c_str(), std::ios_base::out) ;
339  if(!out) {
340  std::cout << __LINE__ << "]\t" << mthn << "Could not open file " << filename << " for write" << std::endl ;
341  exit(1);
342  }
343 
344 
345  if(rocs_.size() == 0)
346  {
347  std::vector<PixelModuleName>::const_iterator imodule=modules_.begin();
348 
349  for (;imodule!=modules_.end();++imodule)
350  {
351  out << *imodule << std::endl;
352  }
353  }
354  else
355  {
356  out << "Rocs:" << endl ;
357  std::map<PixelROCName, PixelROCStatus>::const_iterator irocs = rocs_.begin();
358  for(; irocs != rocs_.end() ; irocs++)
359  {
360  out << (irocs->first).rocname() << " " << (irocs->second).statusName() << endl ;
361  }
362  }
363 
364  out.close();
365 
366 }
std::map< PixelROCName, PixelROCStatus > rocs_
std::vector< PixelModuleName > modules_
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 PixelDetectorConfig::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
virtual

Reimplemented from pos::PixelConfigBase.

Definition at line 472 of file PixelDetectorConfig.cc.

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

473 {
474  std::stringstream s ; s << __LINE__ << "]\t[PixelDetectorConfig::writeXML()]\t\t\t " ;
475  std::string mthn = s.str() ;
476 
477  std::stringstream fullPath ;
478 
479  fullPath << path << "/Pixel_DetectorConfig.xml" ;
480  cout << __LINE__ << "]\t" << mthn << "Writing to: " << fullPath.str() << std::endl ;
481 
482  std::ofstream out(fullPath.str().c_str()) ;
483 
484  out << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
485  out << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
486  out << " <HEADER>" << std::endl ;
487  out << " <TYPE>" << std::endl ;
488  out << " <EXTENSION_TABLE_NAME>PIXEL_DETECTOR_CONFIG</EXTENSION_TABLE_NAME>" << std::endl ;
489  out << " <NAME>Pixel Detector Configuration</NAME>" << std::endl ;
490  out << " </TYPE>" << std::endl ;
491  out << " <RUN>" << std::endl ;
492  out << " <RUN_TYPE>Pixel Detector Configuration test</RUN_TYPE>" << std::endl ;
493  out << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
494  out << " <RUN_BEGIN_TIMESTAMP>" << pos::PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
495  out << " <COMMENT_DESCRIPTION>Test of DetectorConfig xml</COMMENT_DESCRIPTION>" << std::endl ;
496  out << " <LOCATION>CERN TAC</LOCATION>" << std::endl ;
497  out << " <CREATED_BY_USER>Dario Menasce</CREATED_BY_USER>" << std::endl ;
498  out << " </RUN>" << std::endl ;
499  out << " </HEADER>" << std::endl ;
500  out << "" << std::endl ;
501  out << "" << std::endl ;
502 
503  if(rocs_.size() == 0)
504  {
505  std::vector<PixelModuleName>::const_iterator imodule=modules_.begin();
506 
507  // This needs to be fixed: given a module name, actually loop over ROCs to write the XML data
508  for (;imodule!=modules_.end();++imodule)
509  {
510  out << " <DATA>" << std::endl ;
511 //----> out << " <ROC_NAME>" << (irocs->first).rocname() << "</ROC_NAME>" << std::endl ;
512  out << " <ROC_STATUS>on</ROC_STATUS>" << std::endl ;
513  out << " </DATA>" << std::endl ;
514  out << " " << std::endl ;
515  }
516  }
517  else
518  {
519  std::map<PixelROCName, PixelROCStatus>::const_iterator irocs = rocs_.begin();
520  for(; irocs != rocs_.end() ; irocs++)
521  {
522  std::string sts = (irocs->second).statusName() ;
523  if( sts == "" ) {sts = "on" ;}
524  out << " <DATA_SET>" << std::endl ;
525  out << " <VERSION>" << version << "</VERSION>" << std::endl ;
526  out << " <PART>" << std::endl ;
527  out << " <NAME_LABEL>" << (irocs->first).rocname() << "</NAME_LABEL>" << std::endl ;
528  out << " <KIND_OF_PART>ROC</KIND_OF_PART>" << std::endl ;
529  out << " </PART>" << std::endl ;
530  out << " <DATA>" << std::endl ;
531  out << " <ROC_NAME>" << (irocs->first).rocname() << "</ROC_NAME>" << std::endl ;
532  out << " <ROC_STATUS>" << sts << "</ROC_STATUS>" << std::endl ;
533  out << " </DATA>" << std::endl ;
534  out << " </DATA_SET>" << std::endl ;
535  out << " " << std::endl ;
536  }
537  }
538  out << " </DATA_SET>" << std::endl ;
539  out << "</ROOT> " << std::endl ;
540  out.close() ;
541  assert(0) ;
542 }
tuple path
else: Piece not in the list, fine.
static std::string getTime(void)
std::map< PixelROCName, PixelROCStatus > rocs_
std::vector< PixelModuleName > modules_
tuple out
Definition: dbtoconf.py:99
tuple cout
Definition: gather_cfg.py:121
void PixelDetectorConfig::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelConfigBase.

Definition at line 421 of file PixelDetectorConfig.cc.

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

424 {
425  std::stringstream s ; s << __LINE__ << "]\t[PixelDetectorConfig::writeXML()]\t\t\t " ;
426  std::string mthn = s.str() ;
427  if(rocs_.size() == 0)
428  {
429  std::vector<PixelModuleName>::const_iterator imodule=modules_.begin();
430 
431  // This needs to be fixed: given a module name, actually loop over ROCs to write the XML data
432  for (;imodule!=modules_.end();++imodule)
433  {
434  *outstream << " <DATA>" << std::endl ;
435 //----> out << " <ROC_NAME>" << (irocs->first).rocname() << "</ROC_NAME>" << std::endl ;
436  *outstream << " <ROC_STATUS>on</ROC_STATUS>" << std::endl ;
437  *outstream << " </DATA>" << std::endl ;
438  *outstream << " " << std::endl ;
439  }
440  }
441  else
442  {
443  std::map<PixelROCName, PixelROCStatus>::const_iterator irocs = rocs_.begin();
444  for(; irocs != rocs_.end() ; irocs++)
445  {
446  std::string sts = (irocs->second).statusName() ;
447  if( sts == "" ) {sts = "on" ;}
448  *outstream << " " << std::endl ;
449  *outstream << " <DATA>" << std::endl ;
450  *outstream << " <ROC_NAME>" << (irocs->first).rocname() << "</ROC_NAME>" << std::endl ;
451  *outstream << " <ROC_STATUS>" << sts << "</ROC_STATUS>" << std::endl ;
452  *outstream << " </DATA>" << std::endl ;
453  }
454  }
455 }
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 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelConfigBase.

Definition at line 369 of file PixelDetectorConfig.cc.

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

375 {
376  std::string mthn = "]\t[PixelDetectorConfig::writeXMLHeader()]\t\t\t " ;
377  std::stringstream fullPath ;
378  fullPath << path << "/Pixel_DetectorConfig_" << PixelTimeFormatter::getmSecTime() << ".xml" ;
379  cout << __LINE__ << mthn << "Writing to: " << fullPath.str() << endl ;
380 
381  outstream->open(fullPath.str().c_str()) ;
382 
383  if( !outstream->good() )
384  {
385  cout << __LINE__ << mthn << "FATAL: could not open file " << fullPath.str() << endl ;
386  assert(0) ;
387  }
388 
389  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
390  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
391  *outstream << "" << std::endl ;
392  *outstream << " <!-- " << mthn << "-->" << std::endl ;
393  *outstream << "" << std::endl ;
394  *outstream << " <HEADER>" << std::endl ;
395  *outstream << " <TYPE>" << std::endl ;
396  *outstream << " <EXTENSION_TABLE_NAME>PIXEL_DETECTOR_CONFIG</EXTENSION_TABLE_NAME>" << std::endl ;
397  *outstream << " <NAME>Pixel Detector Configuration</NAME>" << std::endl ;
398  *outstream << " </TYPE>" << std::endl ;
399  *outstream << " <RUN>" << std::endl ;
400  *outstream << " <RUN_TYPE>Pixel Detector Configuration test</RUN_TYPE>" << std::endl ;
401  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
402  *outstream << " <RUN_BEGIN_TIMESTAMP>" << pos::PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
403  *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl ;
404  *outstream << " </RUN>" << std::endl ;
405  *outstream << " </HEADER>" << std::endl ;
406  *outstream << "" << std::endl ;
407  *outstream << " <DATA_SET>" << std::endl ;
408  *outstream << " " << std::endl ;
409  *outstream << " <VERSION>" << version << "</VERSION>" << std::endl ;
410  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl ;
411  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl ;
412  *outstream << " " << std::endl ;
413  *outstream << " <PART>" << std::endl ;
414  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
415  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
416  *outstream << " </PART>" << std::endl ;
417 
418 }
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 PixelDetectorConfig::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelConfigBase.

Definition at line 458 of file PixelDetectorConfig.cc.

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

461 {
462  std::stringstream s ; s << __LINE__ << "]\t[PixelDetectorConfig::writeXMLTrailer()]\t\t\t " ;
463  std::string mthn = s.str() ;
464 
465  *outstream << " " << std::endl ;
466  *outstream << " </DATA_SET>" << std::endl ;
467  *outstream << "</ROOT> " << std::endl ;
468 
469  outstream->close() ;
470 }

Member Data Documentation

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