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

This class implements.. More...

#include "interface/PixelConfigList.h"

Public Member Functions

unsigned int add (PixelConfig &aConfig)
 
unsigned int clone (unsigned int oldkey, std::string path, unsigned int version)
 
unsigned int numberOfConfigs ()
 
PixelConfigoperator[] (unsigned int i)
 
void readfile (std::string filename)
 
void reload (std::string filename)
 
unsigned int size ()
 
void writefile ()
 

Private Attributes

std::vector< PixelConfigconfigs
 

Detailed Description

This class implements..

A longer explanation will be placed here later

Definition at line 17 of file PixelConfigList.h.

Member Function Documentation

unsigned int pos::PixelConfigList::add ( PixelConfig aConfig)
inline

Definition at line 118 of file PixelConfigList.h.

References configs.

Referenced by pos::PixelConfigFile::makeKey(), and counter.Counter::register().

118  {
119 
120  configs.push_back(aConfig);
121 
122  return configs.size()-1;
123 
124  }
std::vector< PixelConfig > configs
unsigned int pos::PixelConfigList::clone ( unsigned int  oldkey,
std::string  path,
unsigned int  version 
)
inline

Definition at line 100 of file PixelConfigList.h.

References assert(), configs, gather_cfg::cout, and pos::PixelConfig::update().

Referenced by pos::PixelAliasList::updateConfigAlias().

100  {
101  PixelConfig aConfig=configs[oldkey];
102 
103  unsigned int oldversion;
104 
105  if (-1==aConfig.update(path,oldversion,version)){
106  std::cout << "Old version not found for path="<<path<<" in config "<<oldkey<<std::endl;
107  assert(0);
108  }
109 
110  configs.push_back(aConfig);
111 
112  return configs.size()-1;
113 
114  }
assert(m_qm.get())
std::vector< PixelConfig > configs
tuple path
else: Piece not in the list, fine.
tuple cout
Definition: gather_cfg.py:121
unsigned int pos::PixelConfigList::numberOfConfigs ( )
inline

Definition at line 136 of file PixelConfigList.h.

References configs.

136 { return configs.size(); }
std::vector< PixelConfig > configs
PixelConfig& pos::PixelConfigList::operator[] ( unsigned int  i)
inline

Definition at line 128 of file PixelConfigList.h.

References configs, and i.

128 {return configs[i];}
int i
Definition: DBlmapReader.cc:9
std::vector< PixelConfig > configs
void pos::PixelConfigList::readfile ( std::string  filename)
inline

Definition at line 44 of file PixelConfigList.h.

References pos::PixelConfig::add(), assert(), configs, gather_cfg::cout, recoMuon::in, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, tmp, and relval_steps::version.

Referenced by pos::PixelConfigFile::getConfig(), and reload().

44  {
45 
46  std::ifstream in(filename.c_str());
47 
49 
50  in >> tag;
51  while(tag.substr(0,1) == "#") {
52  in.ignore(4096, '\n'); //skips to endl;
53  in >> tag;
54  }
55 
56  unsigned int version=0;
57 
58  while(!in.eof()){
59  if (tag!="key"){
60  std::cout << "PixelConfigDB: tag="<<tag<<std::endl;
61  assert(0);
62  }
63  unsigned int tmp_version;
64  in >> tmp_version;
65  if (version!=tmp_version){
66  std::cout << "PixelConfigDB: read version: "<<tmp_version<<" while expected "
67  << version << std::endl;
68  assert(0);
69  }
70 
71  in >> tag;
72  while(tag.substr(0,1) == "#") {
73  in.ignore(4096, '\n'); //skips to endl;
74  in >> tag;
75  }
76 
77  PixelConfig aConfig;
78  while (tag!="key"&&in.good()){
79  unsigned int tmp;
80  in >>tmp;
81  //std::cout << "adding: "<<tag<<" "<<tmp<<std::endl;
82  aConfig.add(tag,tmp);
83  in >> tag;
84  while(tag.substr(0,1) == "#") {
85  in.ignore(4096, '\n'); //skips to endl;
86  in >> tag;
87  }
88  }
89 
90  configs.push_back(aConfig);
91  version++;
92 
93  };
94 
95  in.close();
96 
97  }
assert(m_qm.get())
std::vector< PixelConfig > configs
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
void pos::PixelConfigList::reload ( std::string  filename)
inline

Definition at line 130 of file PixelConfigList.h.

References configs, and readfile().

Referenced by pos::PixelConfigFile::getConfig().

131  {
132  configs.clear() ;
133  readfile(filename) ;
134  }
std::vector< PixelConfig > configs
void readfile(std::string filename)
tuple filename
Definition: lut2db_cfg.py:20
unsigned int pos::PixelConfigList::size ( void  )
inline

Definition at line 126 of file PixelConfigList.h.

References configs.

126 { return configs.size(); }
std::vector< PixelConfig > configs
void pos::PixelConfigList::writefile ( )
inline

Definition at line 21 of file PixelConfigList.h.

References assert(), configs, createBeamHaloJobs::directory, lut2db_cfg::filename, i, dbtoconf::out, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by pos::PixelConfigFile::addVersionAlias(), and pos::PixelConfigFile::makeKey().

21  {
22 
23  std::string directory=getenv("PIXELCONFIGURATIONBASE");
24 /* directory+="/PixelConfigDataExamples/"; */
25  directory+="/";
26 
27  std::string filename=directory+"/configurations.txt";
28 
29  std::ofstream out(filename.c_str());
30  assert(out.good());
31 
32  for (unsigned int i=0;i<configs.size();i++){
33  //std::cout << "key "<<i<<std::endl;
34  out << "key "<<i<<std::endl;
35  configs[i].write(out);
36  out <<std::endl;
37  //std::cout <<std::endl;
38  }
39 
40 
41  }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
std::vector< PixelConfig > configs
tuple out
Definition: dbtoconf.py:99
tuple filename
Definition: lut2db_cfg.py:20

Member Data Documentation

std::vector<PixelConfig> pos::PixelConfigList::configs
private