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

◆ add()

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

Definition at line 111 of file PixelConfigList.h.

111  {
112  configs.push_back(aConfig);
113 
114  return configs.size() - 1;
115  }

References configs.

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

◆ clone()

unsigned int pos::PixelConfigList::clone ( unsigned int  oldkey,
std::string  path,
unsigned int  version 
)
inline

Definition at line 95 of file PixelConfigList.h.

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  }

References cms::cuda::assert(), configs, gather_cfg::cout, castor_dqm_sourceclient_file_cfg::path, pos::PixelConfig::update(), and BeamSplash_cfg::version.

◆ numberOfConfigs()

unsigned int pos::PixelConfigList::numberOfConfigs ( )
inline

Definition at line 126 of file PixelConfigList.h.

126 { return configs.size(); }

References configs.

◆ operator[]()

PixelConfig& pos::PixelConfigList::operator[] ( unsigned int  i)
inline

Definition at line 119 of file PixelConfigList.h.

119 { return configs[i]; }

References configs, and mps_fire::i.

◆ readfile()

void pos::PixelConfigList::readfile ( std::string  filename)
inline

Definition at line 43 of file PixelConfigList.h.

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  }

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

Referenced by reload().

◆ reload()

void pos::PixelConfigList::reload ( std::string  filename)
inline

Definition at line 121 of file PixelConfigList.h.

121  {
122  configs.clear();
124  }

References configs, corrVsCorr::filename, and readfile().

◆ size()

unsigned int pos::PixelConfigList::size ( void  )
inline

Definition at line 117 of file PixelConfigList.h.

117 { return configs.size(); }

References configs.

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

◆ writefile()

void pos::PixelConfigList::writefile ( )
inline

Definition at line 24 of file PixelConfigList.h.

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  }

References cms::cuda::assert(), configs, createBeamHaloJobs::directory, corrVsCorr::filename, mps_fire::i, MillePedeFileConverter_cfg::out, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ configs

std::vector<PixelConfig> pos::PixelConfigList::configs
private
mps_fire.i
i
Definition: mps_fire.py:355
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cms::cuda::assert
assert(be >=bs)
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
pos::PixelConfigList::readfile
void readfile(std::string filename)
Definition: PixelConfigList.h:43
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
recoMuon::in
Definition: RecoMuonEnumerators.h:6
createBeamHaloJobs.directory
string directory
Definition: createBeamHaloJobs.py:211
pos::PixelConfigList::configs
std::vector< PixelConfig > configs
Definition: PixelConfigList.h:129
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45