CMS 3D CMS Logo

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

Member Function Documentation

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

Definition at line 123 of file PixelConfigList.h.

References configs.

Referenced by pos::PixelConfigFile::makeKey(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

123  {
124 
125  configs.push_back(aConfig);
126 
127  return configs.size()-1;
128 
129  }
std::vector< PixelConfig > configs
unsigned int pos::PixelConfigList::clone ( unsigned int  oldkey,
std::string  path,
unsigned int  version 
)
inline

Definition at line 105 of file PixelConfigList.h.

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

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

105  {
106  PixelConfig aConfig=configs[oldkey];
107 
108  unsigned int oldversion;
109 
110  if (-1==aConfig.update(path,oldversion,version)){
111  std::cout << "Old version not found for path="<<path<<" in config "<<oldkey<<std::endl;
112  assert(0);
113  }
114 
115  configs.push_back(aConfig);
116 
117  return configs.size()-1;
118 
119  }
std::vector< PixelConfig > configs
unsigned int pos::PixelConfigList::numberOfConfigs ( )
inline

Definition at line 141 of file PixelConfigList.h.

References configs.

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

Definition at line 133 of file PixelConfigList.h.

References configs, and mps_fire::i.

133 {return configs[i];}
std::vector< PixelConfig > configs
void pos::PixelConfigList::readfile ( std::string  filename)
inline

Definition at line 49 of file PixelConfigList.h.

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

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

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

Definition at line 135 of file PixelConfigList.h.

References configs, and readfile().

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

136  {
137  configs.clear() ;
138  readfile(filename) ;
139  }
std::vector< PixelConfig > configs
void readfile(std::string filename)
unsigned int pos::PixelConfigList::size ( void  )
inline

Definition at line 131 of file PixelConfigList.h.

References configs.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

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

Definition at line 26 of file PixelConfigList.h.

References configs, createBeamHaloJobs::directory, corrVsCorr::filename, mps_fire::i, MillePedeFileConverter_cfg::out, and AlCaHLTBitMon_QueryRunRegistry::string.

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

26  {
27 
28  std::string directory=getenv("PIXELCONFIGURATIONBASE");
29 /* directory+="/PixelConfigDataExamples/"; */
30  directory+="/";
31 
32  std::string filename=directory+"/configurations.txt";
33 
34  std::ofstream out(filename.c_str());
35  assert(out.good());
36 
37  for (unsigned int i=0;i<configs.size();i++){
38  //std::cout << "key "<<i<<std::endl;
39  out << "key "<<i<<std::endl;
40  configs[i].write(out);
41  out <<std::endl;
42  //std::cout <<std::endl;
43  }
44 
45 
46  }
std::vector< PixelConfig > configs

Member Data Documentation

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