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 15 of file PixelConfigList.h.

Member Function Documentation

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

Definition at line 116 of file PixelConfigList.h.

References configs.

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

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

Definition at line 98 of file PixelConfigList.h.

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

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

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

Definition at line 134 of file PixelConfigList.h.

References configs.

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

Definition at line 126 of file PixelConfigList.h.

References configs, and i.

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

Definition at line 42 of file PixelConfigList.h.

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

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

42  {
43 
44  std::ifstream in(filename.c_str());
45 
47 
48  in >> tag;
49  while(tag.substr(0,1) == "#") {
50  in.ignore(4096, '\n'); //skips to endl;
51  in >> tag;
52  }
53 
54  unsigned int version=0;
55 
56  while(!in.eof()){
57  if (tag!="key"){
58  std::cout << "PixelConfigDB: tag="<<tag<<std::endl;
59  assert(0);
60  }
61  unsigned int tmp_version;
62  in >> tmp_version;
63  if (version!=tmp_version){
64  std::cout << "PixelConfigDB: read version: "<<tmp_version<<" while expected "
65  << version << std::endl;
66  assert(0);
67  }
68 
69  in >> tag;
70  while(tag.substr(0,1) == "#") {
71  in.ignore(4096, '\n'); //skips to endl;
72  in >> tag;
73  }
74 
75  PixelConfig aConfig;
76  while (tag!="key"&&in.good()){
77  unsigned int tmp;
78  in >>tmp;
79  //std::cout << "adding: "<<tag<<" "<<tmp<<std::endl;
80  aConfig.add(tag,tmp);
81  in >> tag;
82  while(tag.substr(0,1) == "#") {
83  in.ignore(4096, '\n'); //skips to endl;
84  in >> tag;
85  }
86  }
87 
88  configs.push_back(aConfig);
89  version++;
90 
91  };
92 
93  in.close();
94 
95  }
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 128 of file PixelConfigList.h.

References configs, and readfile().

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

129  {
130  configs.clear() ;
131  readfile(filename) ;
132  }
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 124 of file PixelConfigList.h.

References configs.

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

Definition at line 19 of file PixelConfigList.h.

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

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

19  {
20 
21  std::string directory=getenv("PIXELCONFIGURATIONBASE");
22 /* directory+="/PixelConfigDataExamples/"; */
23  directory+="/";
24 
25  std::string filename=directory+"/configurations.txt";
26 
27  std::ofstream out(filename.c_str());
28  assert(out.good());
29 
30  for (unsigned int i=0;i<configs.size();i++){
31  //std::cout << "key "<<i<<std::endl;
32  out << "key "<<i<<std::endl;
33  configs[i].write(out);
34  out <<std::endl;
35  //std::cout <<std::endl;
36  }
37 
38 
39  }
int i
Definition: DBlmapReader.cc:9
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