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

References configs.

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

111  {
112  configs.push_back(aConfig);
113 
114  return configs.size() - 1;
115  }
std::vector< PixelConfig > configs
unsigned int pos::PixelConfigList::clone ( unsigned int  oldkey,
std::string  path,
unsigned int  version 
)
inline

Definition at line 95 of file PixelConfigList.h.

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

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

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

Definition at line 126 of file PixelConfigList.h.

References configs.

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

Definition at line 119 of file PixelConfigList.h.

References configs, and mps_fire::i.

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

Definition at line 43 of file PixelConfigList.h.

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

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

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 " << version << std::endl;
65  assert(0);
66  }
67 
68  in >> tag;
69  while (tag.substr(0, 1) == "#") {
70  in.ignore(4096, '\n'); //skips to endl;
71  in >> tag;
72  }
73 
74  PixelConfig aConfig;
75  while (tag != "key" && in.good()) {
76  unsigned int tmp;
77  in >> tmp;
78  //std::cout << "adding: "<<tag<<" "<<tmp<<std::endl;
79  aConfig.add(tag, tmp);
80  in >> tag;
81  while (tag.substr(0, 1) == "#") {
82  in.ignore(4096, '\n'); //skips to endl;
83  in >> tag;
84  }
85  }
86 
87  configs.push_back(aConfig);
88  version++;
89  };
90 
91  in.close();
92  }
std::vector< PixelConfig > configs
tmp
align.sh
Definition: createJobs.py:716
void pos::PixelConfigList::reload ( std::string  filename)
inline

Definition at line 121 of file PixelConfigList.h.

References configs, and readfile().

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

121  {
122  configs.clear();
124  }
std::vector< PixelConfig > configs
void readfile(std::string filename)
unsigned int pos::PixelConfigList::size ( void  )
inline

Definition at line 117 of file PixelConfigList.h.

References configs.

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

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

Definition at line 24 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().

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

Member Data Documentation

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