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

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

Definition at line 267 of file PixelAliasList.h.

References mps_fire::i, and pixelVersionAliases_.

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

267 { return pixelVersionAliases_[i].alias(); }
std::vector< PixelVersionAlias > pixelVersionAliases_
std::vector<pathAliasPair> pos::PixelAliasList::getConfigAliases ( std::string  path)
inline

Definition at line 248 of file PixelAliasList.h.

References aliasMmap.

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

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  }
std::string path(unsigned int i)
pathAliasMmap aliasMmap
unsigned int pos::PixelAliasList::getVersion ( std::string  path,
std::string  alias 
)
inline

Definition at line 225 of file PixelAliasList.h.

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

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

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  }
std::string alias(unsigned int i)
std::string path(unsigned int i)
std::vector< PixelVersionAlias > pixelVersionAliases_
std::vector<std::string> pos::PixelAliasList::getVersionAliases ( std::string  path)
inline

Definition at line 213 of file PixelAliasList.h.

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

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

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  }
std::string alias(unsigned int i)
std::string path(unsigned int i)
std::vector< PixelVersionAlias > pixelVersionAliases_
tmp
align.sh
Definition: createJobs.py:716
pathVersionAliasMmap pos::PixelAliasList::getVersionData ( )
inline

Definition at line 236 of file PixelAliasList.h.

References versionMmap.

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

236 { return versionMmap; }
pathVersionAliasMmap versionMmap
pathVersionAliasMmap pos::PixelAliasList::getVersionData ( std::string  koc)
inline

Definition at line 238 of file PixelAliasList.h.

References mps_fire::result, and versionMmap.

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  }
std::map< std::string, vectorVAPairs > pathVersionAliasMmap
pathVersionAliasMmap versionMmap
void pos::PixelAliasList::insertAlias ( PixelConfigAlias anAlias)
inline

Definition at line 165 of file PixelAliasList.h.

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

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

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  }
std::string name(unsigned int i)
std::vector< PixelConfigAlias > pixelConfigAliases_
void pos::PixelAliasList::insertVersionAlias ( PixelVersionAlias anAlias)
inline

Definition at line 185 of file PixelAliasList.h.

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

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

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  }
std::string alias(unsigned int i)
std::vector< PixelVersionAlias > pixelVersionAliases_
unsigned int pos::PixelAliasList::key ( unsigned int  i)
inline

Definition at line 261 of file PixelAliasList.h.

References mps_fire::i, and pixelConfigAliases_.

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

261 { return pixelConfigAliases_[i].key(); }
std::vector< PixelConfigAlias > pixelConfigAliases_
unsigned int pos::PixelAliasList::nAliases ( )
inline

Definition at line 259 of file PixelAliasList.h.

References pixelConfigAliases_.

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

259 { return pixelConfigAliases_.size(); }
std::vector< PixelConfigAlias > pixelConfigAliases_
std::string pos::PixelAliasList::name ( unsigned int  i)
inline
unsigned int pos::PixelAliasList::nVersionAliases ( )
inline

Definition at line 264 of file PixelAliasList.h.

References pixelVersionAliases_.

264 { return pixelVersionAliases_.size(); }
std::vector< PixelVersionAlias > pixelVersionAliases_
PixelConfigAlias pos::PixelAliasList::operator[] ( unsigned int  i)
inline

Definition at line 262 of file PixelAliasList.h.

References mps_fire::i, and pixelConfigAliases_.

262 { return pixelConfigAliases_[i]; }
std::vector< PixelConfigAlias > pixelConfigAliases_
std::string pos::PixelAliasList::path ( unsigned int  i)
inline

Definition at line 265 of file PixelAliasList.h.

References mps_fire::i, and pixelVersionAliases_.

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

265 { return pixelVersionAliases_[i].path(); }
std::vector< PixelVersionAlias > pixelVersionAliases_
void pos::PixelAliasList::readfile ( std::string  filename)
inline

Definition at line 61 of file PixelAliasList.h.

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

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

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  }
std::string alias(unsigned int i)
unsigned int version(unsigned int i)
unsigned int key(unsigned int i)
std::string path(unsigned int i)
std::pair< unsigned int, std::string > versionAliasPair
std::map< std::string, std::string > pathAliasPair
pathVersionAliasMmap versionMmap
std::vector< PixelVersionAlias > pixelVersionAliases_
pathAliasMmap aliasMmap
std::vector< PixelConfigAlias > pixelConfigAliases_
void pos::PixelAliasList::updateConfigAlias ( std::string  path,
unsigned int  version,
std::string  alias,
PixelConfigList config 
)
inline

Definition at line 197 of file PixelAliasList.h.

References pos::PixelConfigList::clone(), mps_fire::i, dqmiolumiharvest::j, key(), and pixelConfigAliases_.

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

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  }
std::string alias(unsigned int i)
unsigned int version(unsigned int i)
Definition: config.py:1
unsigned int key(unsigned int i)
std::string path(unsigned int i)
std::vector< PixelConfigAlias > pixelConfigAliases_
unsigned int pos::PixelAliasList::version ( unsigned int  i)
inline

Definition at line 266 of file PixelAliasList.h.

References mps_fire::i, and pixelVersionAliases_.

Referenced by validation.Sample::datasetpattern(), validation.Sample::filename(), and readfile().

266 { return pixelVersionAliases_[i].version(); }
std::vector< PixelVersionAlias > pixelVersionAliases_
PixelConfigAlias* pos::PixelAliasList::versionAliases ( std::string  aliasName)
inline

Definition at line 176 of file PixelAliasList.h.

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

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

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  }
std::string name(unsigned int i)
std::vector< PixelConfigAlias > pixelConfigAliases_
void pos::PixelAliasList::writefile ( )
inline

Definition at line 32 of file PixelAliasList.h.

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().

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  }
std::vector< PixelVersionAlias > pixelVersionAliases_
std::vector< PixelConfigAlias > pixelConfigAliases_

Member Data Documentation

pathAliasMmap pos::PixelAliasList::aliasMmap
private

Definition at line 273 of file PixelAliasList.h.

Referenced by getConfigAliases(), and readfile().

std::vector<PixelConfigAlias> pos::PixelAliasList::pixelConfigAliases_
private
std::vector<PixelVersionAlias> pos::PixelAliasList::pixelVersionAliases_
private
pathVersionAliasMmap pos::PixelAliasList::versionMmap
private

Definition at line 274 of file PixelAliasList.h.

Referenced by getVersionData(), and readfile().