CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pos::PixelAliasList Class Reference

#include "interface/PixelAliasList.h"

Public Member Functions

std::string alias (unsigned int i)
 
std::vector< pathAliasPairgetConfigAliases (std::string path)
 
unsigned int getVersion (std::string path, std::string alias)
 
std::vector< std::string > getVersionAliases (std::string path)
 
pathVersionAliasMmap getVersionData ()
 
pathVersionAliasMmap getVersionData (std::string koc)
 
void insertAlias (PixelConfigAlias &anAlias)
 
void insertVersionAlias (PixelVersionAlias &anAlias)
 
unsigned int key (unsigned int i)
 
unsigned int nAliases ()
 
std::string name (unsigned int i)
 
unsigned int nVersionAliases ()
 
PixelConfigAlias operator[] (unsigned int i)
 
std::string path (unsigned int i)
 
void readfile (std::string filename)
 
void updateConfigAlias (std::string path, unsigned int version, std::string alias, PixelConfigList &config)
 
unsigned int version (unsigned int i)
 
PixelConfigAliasversionAliases (std::string aliasName)
 
void writefile ()
 

Private Attributes

pathAliasMmap aliasMmap
 
std::vector< PixelConfigAliaspixelConfigAliases_
 
std::vector< PixelVersionAliaspixelVersionAliases_
 
pathVersionAliasMmap versionMmap
 

Detailed Description

A longer explanation will be placed here later

Definition at line 30 of file PixelAliasList.h.

Member Function Documentation

◆ alias()

std::string pos::PixelAliasList::alias ( unsigned int  i)
inline

Definition at line 267 of file PixelAliasList.h.

267 { return pixelVersionAliases_[i].alias(); }

References mps_fire::i, and pixelVersionAliases_.

Referenced by getVersion(), getVersionAliases(), insertVersionAlias(), readfile(), and updateConfigAlias().

◆ getConfigAliases()

std::vector<pathAliasPair> pos::PixelAliasList::getConfigAliases ( std::string  path)
inline

Definition at line 248 of file PixelAliasList.h.

248  {
249  std::vector<pathAliasPair> configAliasVector;
250  for (pathAliasMmap::iterator it = aliasMmap.begin(); it != aliasMmap.end(); it++) {
251  if ((*it).first == path) {
252  configAliasVector.push_back((*it).second);
253  }
254  }
255  return configAliasVector;
256  }

References aliasMmap, and path().

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

◆ getVersion()

unsigned int pos::PixelAliasList::getVersion ( std::string  path,
std::string  alias 
)
inline

Definition at line 225 of file PixelAliasList.h.

225  {
226  for (unsigned int i = 0; i < pixelVersionAliases_.size(); i++) {
227  if (pixelVersionAliases_[i].alias() == alias && pixelVersionAliases_[i].path() == path) {
228  return pixelVersionAliases_[i].version();
229  }
230  }
231  assert(0);
232  return 0;
233  }

References alias(), cms::cuda::assert(), mps_fire::i, path(), and pixelVersionAliases_.

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

◆ getVersionAliases()

std::vector<std::string> pos::PixelAliasList::getVersionAliases ( std::string  path)
inline

Definition at line 213 of file PixelAliasList.h.

213  {
214  std::vector<std::string> tmp;
215  for (unsigned int i = 0; i < pixelVersionAliases_.size(); i++) {
216  //std::cout << "path alias:"<<pixelVersionAliases_[i].path()
217  // << pixelVersionAliases_[i].alias() << std::endl;
218  if (pixelVersionAliases_[i].path() == path) {
219  tmp.push_back(pixelVersionAliases_[i].alias());
220  }
221  }
222  return tmp;
223  }

References alias(), mps_fire::i, path(), pixelVersionAliases_, and createJobs::tmp.

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

◆ getVersionData() [1/2]

pathVersionAliasMmap pos::PixelAliasList::getVersionData ( )
inline

Definition at line 236 of file PixelAliasList.h.

236 { return versionMmap; }

References versionMmap.

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

◆ getVersionData() [2/2]

pathVersionAliasMmap pos::PixelAliasList::getVersionData ( std::string  koc)
inline

Definition at line 238 of file PixelAliasList.h.

238  {
240  for (pathVersionAliasMmap::iterator it = versionMmap.begin(); it != versionMmap.end(); it++) {
241  if ((*it).first.find(koc) != std::string::npos) {
242  result[(*it).first] = (*it).second;
243  }
244  }
245  return result;
246  }

References mps_fire::result, and versionMmap.

◆ insertAlias()

void pos::PixelAliasList::insertAlias ( PixelConfigAlias anAlias)
inline

Definition at line 165 of file PixelAliasList.h.

165  {
166  for (unsigned int i = 0; i < pixelConfigAliases_.size(); i++) {
167  if (pixelConfigAliases_[i].name() == anAlias.name()) {
168  std::cout << "[PixelAliasList::insertAlias()]\t\t\tReplacing existing alias:" << anAlias.name() << std::endl;
169  pixelConfigAliases_[i] = anAlias;
170  return;
171  }
172  }
173  pixelConfigAliases_.push_back(anAlias);
174  }

References gather_cfg::cout, mps_fire::i, pos::PixelConfigAlias::name(), name(), and pixelConfigAliases_.

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

◆ insertVersionAlias()

void pos::PixelAliasList::insertVersionAlias ( PixelVersionAlias anAlias)
inline

Definition at line 185 of file PixelAliasList.h.

185  {
186  for (unsigned int i = 0; i < pixelVersionAliases_.size(); i++) {
187  if (pixelVersionAliases_[i].alias() == anAlias.alias() && pixelVersionAliases_[i].path() == anAlias.path()) {
188  std::cout << "[PixelAliasList::insertVersionAlias()]\t\tReplacing existing version alias:" << anAlias.path()
189  << " " << anAlias.alias() << std::endl;
190  pixelVersionAliases_[i] = anAlias;
191  return;
192  }
193  }
194  pixelVersionAliases_.push_back(anAlias);
195  }

References pos::PixelVersionAlias::alias(), alias(), gather_cfg::cout, mps_fire::i, pos::PixelVersionAlias::path(), and pixelVersionAliases_.

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

◆ key()

unsigned int pos::PixelAliasList::key ( unsigned int  i)
inline

◆ nAliases()

unsigned int pos::PixelAliasList::nAliases ( )
inline

Definition at line 259 of file PixelAliasList.h.

259 { return pixelConfigAliases_.size(); }

References pixelConfigAliases_.

Referenced by pos::PixelConfigFile::getAliases(), and pos::PixelConfigFile::getAliases_map().

◆ name()

std::string pos::PixelAliasList::name ( unsigned int  i)
inline

◆ nVersionAliases()

unsigned int pos::PixelAliasList::nVersionAliases ( )
inline

Definition at line 264 of file PixelAliasList.h.

264 { return pixelVersionAliases_.size(); }

References pixelVersionAliases_.

◆ operator[]()

PixelConfigAlias pos::PixelAliasList::operator[] ( unsigned int  i)
inline

Definition at line 262 of file PixelAliasList.h.

262 { return pixelConfigAliases_[i]; }

References mps_fire::i, and pixelConfigAliases_.

◆ path()

std::string pos::PixelAliasList::path ( unsigned int  i)
inline

Definition at line 265 of file PixelAliasList.h.

265 { return pixelVersionAliases_[i].path(); }

References mps_fire::i, and pixelVersionAliases_.

Referenced by getConfigAliases(), getVersion(), getVersionAliases(), readfile(), and updateConfigAlias().

◆ readfile()

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

Definition at line 61 of file PixelAliasList.h.

61  {
62  std::ifstream in(filename.c_str());
63  if (!in.good()) {
64  std::cout << "[PixelAliasList::readfile()]\t\tCould not open file:" << filename << std::endl;
65  }
66  assert(in.good());
67 
68  // Added by Dario, May 28th, 2008 =====================================================================
69  pixelConfigAliases_.clear();
70  pixelVersionAliases_.clear();
71  aliasMmap.clear();
72  versionMmap.clear();
73  // End of Dario's addition ============================================================================
74 
76 
77  in >> tag;
78  while (tag.substr(0, 1) == "#") {
79  in.ignore(4096, '\n'); //skips to endl;
80  in >> tag;
81  }
82 
83  assert(tag == "ConfigurationAliases");
84 
85  in >> tag;
86 
87  while (tag != "VersionAliases") {
89 
90  unsigned int key;
91  in >> key;
92 
93  //std::cout << "[PixelAliasList::readfile()] Alias, key:"<<alias<<" "<<key<<std::endl;
94 
95  PixelConfigAlias anAlias(alias, key);
96 
97  in >> tag;
98  std::string theAlias = alias;
99 
100  // Added by Dario, May 20th, 2008 =====================================================================
101  pathAliasPair tmpPAPair;
102  if (tag == ";") {
103  tmpPAPair[""] = " ";
104  aliasMmap[theAlias] = tmpPAPair;
105  }
106  // End of Dario's addition ============================================================================
107  while (tag != ";") {
110 
111  path = tag;
112  in >> alias;
113  //std::cout << "[PixelAliasList::readfile()] path, alias:"<<path<<" "<<alias<<std::endl;
114 
115  anAlias.addVersionAlias(path, alias);
116  // Added by Dario, May 20th, 2008 =====================================================================
117  tmpPAPair[path] = alias;
118  aliasMmap[theAlias] = tmpPAPair;
119  // End of Dario's addition ============================================================================
120  in >> tag;
121  }
122 
123  pixelConfigAliases_.push_back(anAlias);
124 
125  in >> tag;
126  }
127 
128  assert(tag == "VersionAliases");
129 
132  unsigned int version;
133 
134  in >> path;
135  in >> version;
136  in >> alias;
137  in >> tag;
138 
139  //std::cout << "path version alias tag:"<<path<<" "<<version
140  // <<" "<<alias<<" "<<tag<<std::endl;
141 
142  // Added by Dario, May 23rd, 2008 =====================================================================
143  versionAliasPair tmpVAPair;
144  // End of Dario's addition ============================================================================
145  while (!in.eof()) {
146  assert(tag == ";");
147  PixelVersionAlias aVersionAlias(path, version, alias);
148  pixelVersionAliases_.push_back(aVersionAlias);
149 
150  // Added by Dario, May 23rd, 2008 =====================================================================
151  tmpVAPair.first = version;
152  tmpVAPair.second = alias;
153  versionMmap[path].push_back(tmpVAPair);
154  // End of Dario's addition ============================================================================
155 
156  in >> path;
157  in >> version;
158  in >> alias;
159  in >> tag;
160  }
161 
162  in.close();
163  }

References pos::PixelConfigAlias::addVersionAlias(), alias(), aliasMmap, cms::cuda::assert(), gather_cfg::cout, corrVsCorr::filename, recoMuon::in, key(), path(), pixelConfigAliases_, pixelVersionAliases_, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, version(), and versionMmap.

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

◆ updateConfigAlias()

void pos::PixelAliasList::updateConfigAlias ( std::string  path,
unsigned int  version,
std::string  alias,
PixelConfigList config 
)
inline

Definition at line 197 of file PixelAliasList.h.

197  {
198  //first loop over configuration aliases
199  for (unsigned int i = 0; i < pixelConfigAliases_.size(); i++) {
200  //std::cout << "Looping over aliases:"<<i<<std::endl;
201  for (unsigned int j = 0; j < pixelConfigAliases_[i].nVersionAliases(); j++) {
202  //std::cout << "Looping over versionAliases:"<<j<<std::endl;
203  if (path == pixelConfigAliases_[i].versionAliasesPath(j) &&
204  alias == pixelConfigAliases_[i].versionAliasesAlias(j)) {
205  //std::cout << "Making clone!"<<std::endl;
206  unsigned int newkey = config.clone(pixelConfigAliases_[i].key(), path, version);
207  pixelConfigAliases_[i].setKey(newkey);
208  }
209  }
210  }
211  }

References alias(), mps_fire::i, dqmiolumiharvest::j, key(), path(), pixelConfigAliases_, and version().

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

◆ version()

unsigned int pos::PixelAliasList::version ( unsigned int  i)
inline

◆ versionAliases()

PixelConfigAlias* pos::PixelAliasList::versionAliases ( std::string  aliasName)
inline

Definition at line 176 of file PixelAliasList.h.

176  {
177  for (unsigned int i = 0; i < pixelConfigAliases_.size(); i++) {
178  if (pixelConfigAliases_[i].name() == aliasName) {
179  return &(pixelConfigAliases_[i]);
180  }
181  }
182  return 0;
183  }

References mps_fire::i, name(), and pixelConfigAliases_.

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

◆ writefile()

void pos::PixelAliasList::writefile ( )
inline

Definition at line 32 of file PixelAliasList.h.

32  {
33  std::string directory = std::getenv("PIXELCONFIGURATIONBASE");
34 
35  std::string filename = directory + "/aliases.txt";
36 
37  std::ofstream out(filename.c_str());
38 
39  out << "ConfigurationAliases" << std::endl;
40  for (unsigned int i = 0; i < pixelConfigAliases_.size(); i++) {
41  PixelConfigAlias& theAlias = pixelConfigAliases_[i];
42  out << theAlias.name() << " " << theAlias.key() << " ";
43 
44  unsigned int n = theAlias.nVersionAliases();
45  for (unsigned int j = 0; j < n; j++) {
46  out << theAlias.versionAliasesPath(j) << " ";
47  out << theAlias.versionAliasesAlias(j) << " ";
48  }
49 
50  out << ";" << std::endl;
51  }
52 
53  out << "VersionAliases" << std::endl;
54  for (unsigned int i = 0; i < pixelVersionAliases_.size(); i++) {
55  PixelVersionAlias& theAlias = pixelVersionAliases_[i];
56 
57  out << theAlias.path() << " " << theAlias.version() << " " << theAlias.alias() << " ;" << std::endl;
58  }
59  }

References pos::PixelVersionAlias::alias(), createBeamHaloJobs::directory, corrVsCorr::filename, mps_fire::i, dqmiolumiharvest::j, pos::PixelConfigAlias::key(), dqmiodumpmetadata::n, pos::PixelConfigAlias::name(), pos::PixelConfigAlias::nVersionAliases(), MillePedeFileConverter_cfg::out, pos::PixelVersionAlias::path(), pixelConfigAliases_, pixelVersionAliases_, AlCaHLTBitMon_QueryRunRegistry::string, pos::PixelVersionAlias::version(), pos::PixelConfigAlias::versionAliasesAlias(), and pos::PixelConfigAlias::versionAliasesPath().

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

Member Data Documentation

◆ aliasMmap

pathAliasMmap pos::PixelAliasList::aliasMmap
private

Definition at line 273 of file PixelAliasList.h.

Referenced by getConfigAliases(), and readfile().

◆ pixelConfigAliases_

std::vector<PixelConfigAlias> pos::PixelAliasList::pixelConfigAliases_
private

◆ pixelVersionAliases_

std::vector<PixelVersionAlias> pos::PixelAliasList::pixelVersionAliases_
private

◆ versionMmap

pathVersionAliasMmap pos::PixelAliasList::versionMmap
private

Definition at line 274 of file PixelAliasList.h.

Referenced by getVersionData(), and readfile().

mps_fire.i
i
Definition: mps_fire.py:355
pos::PixelAliasList::version
unsigned int version(unsigned int i)
Definition: PixelAliasList.h:266
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
pos::versionAliasPair
std::pair< unsigned int, std::string > versionAliasPair
Definition: PixelAliasList.h:24
pos::PixelAliasList::path
std::string path(unsigned int i)
Definition: PixelAliasList.h:265
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos::PixelAliasList::aliasMmap
pathAliasMmap aliasMmap
Definition: PixelAliasList.h:273
pos::PixelAliasList::pixelConfigAliases_
std::vector< PixelConfigAlias > pixelConfigAliases_
Definition: PixelAliasList.h:270
cms::cuda::assert
assert(be >=bs)
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
config
Definition: config.py:1
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
pos::PixelAliasList::pixelVersionAliases_
std::vector< PixelVersionAlias > pixelVersionAliases_
Definition: PixelAliasList.h:271
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
recoMuon::in
Definition: RecoMuonEnumerators.h:6
pos::PixelAliasList::alias
std::string alias(unsigned int i)
Definition: PixelAliasList.h:267
pos::pathVersionAliasMmap
std::map< std::string, vectorVAPairs > pathVersionAliasMmap
Definition: PixelAliasList.h:26
pos::PixelAliasList::versionMmap
pathVersionAliasMmap versionMmap
Definition: PixelAliasList.h:274
pos::pathAliasPair
std::map< std::string, std::string > pathAliasPair
Definition: PixelAliasList.h:27
pos::PixelAliasList::name
std::string name(unsigned int i)
Definition: PixelAliasList.h:260
createBeamHaloJobs.directory
string directory
Definition: createBeamHaloJobs.py:211
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
mps_fire.result
result
Definition: mps_fire.py:303
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
pos::PixelAliasList::key
unsigned int key(unsigned int i)
Definition: PixelAliasList.h:261