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 291 of file PixelAliasList.h.

References mps_fire::i, and pixelVersionAliases_.

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

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

Definition at line 272 of file PixelAliasList.h.

References aliasMmap.

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

272  {
273  std::vector<pathAliasPair> configAliasVector ;
274  for(pathAliasMmap::iterator it=aliasMmap.begin(); it!=aliasMmap.end(); it++){
275  if( (*it).first == path ){
276  configAliasVector.push_back((*it).second) ;
277  }
278  }
279  return configAliasVector ;
280  }
std::string path(unsigned int i)
pathAliasMmap aliasMmap
unsigned int pos::PixelAliasList::getVersion ( std::string  path,
std::string  alias 
)
inline

Definition at line 243 of file PixelAliasList.h.

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

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

243  {
244  for(unsigned int i=0;i<pixelVersionAliases_.size();i++){
246  pixelVersionAliases_[i].path()==path){
247  return pixelVersionAliases_[i].version();
248  }
249  }
250  assert(0);
251  return 0;
252  }
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 230 of file PixelAliasList.h.

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

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

230  {
231  std::vector<std::string> tmp;
232  for(unsigned int i=0;i<pixelVersionAliases_.size();i++){
233  //std::cout << "path alias:"<<pixelVersionAliases_[i].path()
234  // << pixelVersionAliases_[i].alias() << std::endl;
235  if (pixelVersionAliases_[i].path()==path){
236  tmp.push_back(pixelVersionAliases_[i].alias());
237  }
238  }
239  return tmp;
240  }
std::string alias(unsigned int i)
std::string path(unsigned int i)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
std::vector< PixelVersionAlias > pixelVersionAliases_
pathVersionAliasMmap pos::PixelAliasList::getVersionData ( )
inline

Definition at line 255 of file PixelAliasList.h.

References versionMmap.

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

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

Definition at line 259 of file PixelAliasList.h.

References mps_fire::result, and versionMmap.

260  {
262  for(pathVersionAliasMmap::iterator it = versionMmap.begin() ;it != versionMmap.end() ; it ++)
263  {
264  if((*it).first.find(koc) != std::string::npos)
265  {
266  result[(*it).first] = (*it).second ;
267  }
268  }
269  return result ;
270  }
std::map< std::string, vectorVAPairs > pathVersionAliasMmap
pathVersionAliasMmap versionMmap
void pos::PixelAliasList::insertAlias ( PixelConfigAlias anAlias)
inline

Definition at line 179 of file PixelAliasList.h.

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

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

179  {
180  for(unsigned int i=0;i<pixelConfigAliases_.size();i++){
181  if (pixelConfigAliases_[i].name()==anAlias.name()){
182  std::cout << "[PixelAliasList::insertAlias()]\t\t\tReplacing existing alias:" << anAlias.name()<<std::endl;
183  pixelConfigAliases_[i]=anAlias;
184  return;
185  }
186  }
187  pixelConfigAliases_.push_back(anAlias);
188  }
std::string name(unsigned int i)
std::vector< PixelConfigAlias > pixelConfigAliases_
void pos::PixelAliasList::insertVersionAlias ( PixelVersionAlias anAlias)
inline

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

199  {
200  for(unsigned int i=0;i<pixelVersionAliases_.size();i++){
201  if (pixelVersionAliases_[i].alias()==anAlias.alias()&&
202  pixelVersionAliases_[i].path()==anAlias.path()){
203  std::cout << "[PixelAliasList::insertVersionAlias()]\t\tReplacing existing version alias:"
204  <<anAlias.path()<< " " << anAlias.alias() << std::endl;
205  pixelVersionAliases_[i]=anAlias;
206  return;
207  }
208  }
209  pixelVersionAliases_.push_back(anAlias);
210  }
std::string alias(unsigned int i)
std::vector< PixelVersionAlias > pixelVersionAliases_
unsigned int pos::PixelAliasList::key ( unsigned int  i)
inline

Definition at line 285 of file PixelAliasList.h.

References mps_fire::i, and pixelConfigAliases_.

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

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

Definition at line 283 of file PixelAliasList.h.

References pixelConfigAliases_.

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

283 { 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 288 of file PixelAliasList.h.

References pixelVersionAliases_.

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

Definition at line 286 of file PixelAliasList.h.

References mps_fire::i, and pixelConfigAliases_.

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

Definition at line 289 of file PixelAliasList.h.

References mps_fire::i, and pixelVersionAliases_.

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

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

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

69  {
70 
71  std::ifstream in(filename.c_str());
72  if (!in.good()) {
73  std::cout << "[PixelAliasList::readfile()]\t\tCould not open file:"<<filename<<std::endl;
74  }
75  assert(in.good());
76 
77  // Added by Dario, May 28th, 2008 =====================================================================
78  pixelConfigAliases_.clear() ;
79  pixelVersionAliases_.clear() ;
80  aliasMmap.clear() ;
81  versionMmap.clear() ;
82  // End of Dario's addition ============================================================================
83 
85 
86  in >> tag;
87  while(tag.substr(0,1) == "#") {
88  in.ignore(4096, '\n'); //skips to endl;
89  in >> tag;
90  }
91 
92  assert(tag=="ConfigurationAliases");
93 
94  in >> tag;
95 
96  while(tag!="VersionAliases"){
97 
99 
100  unsigned int key;
101  in >> key;
102 
103  //std::cout << "[PixelAliasList::readfile()] Alias, key:"<<alias<<" "<<key<<std::endl;
104 
105  PixelConfigAlias anAlias(alias,key);
106 
107  in >> tag;
108  std::string theAlias = alias ;
109 
110  // Added by Dario, May 20th, 2008 =====================================================================
111  pathAliasPair tmpPAPair ;
112  if( tag == ";" )
113  {
114  tmpPAPair[""] = " " ;
115  aliasMmap[theAlias] = tmpPAPair ;
116  }
117  // End of Dario's addition ============================================================================
118  while(tag != ";") {
121 
122  path=tag;
123  in >> alias;
124  //std::cout << "[PixelAliasList::readfile()] path, alias:"<<path<<" "<<alias<<std::endl;
125 
126  anAlias.addVersionAlias(path,alias);
127  // Added by Dario, May 20th, 2008 =====================================================================
128  tmpPAPair[path] = alias ;
129  aliasMmap[theAlias] = tmpPAPair ;
130  // End of Dario's addition ============================================================================
131  in >> tag;
132 
133  }
134 
135  pixelConfigAliases_.push_back(anAlias);
136 
137  in >> tag;
138 
139  }
140 
141  assert(tag=="VersionAliases");
142 
145  unsigned int version;
146 
147  in >> path;
148  in >> version;
149  in >> alias;
150  in >> tag;
151 
152  //std::cout << "path version alias tag:"<<path<<" "<<version
153  // <<" "<<alias<<" "<<tag<<std::endl;
154 
155  // Added by Dario, May 23rd, 2008 =====================================================================
156  versionAliasPair tmpVAPair ;
157  // End of Dario's addition ============================================================================
158  while(!in.eof()){
159  assert(tag==";");
160  PixelVersionAlias aVersionAlias(path,version,alias);
161  pixelVersionAliases_.push_back(aVersionAlias);
162 
163  // Added by Dario, May 23rd, 2008 =====================================================================
164  tmpVAPair.first = version ;
165  tmpVAPair.second = alias ;
166  versionMmap[path].push_back(tmpVAPair) ;
167  // End of Dario's addition ============================================================================
168 
169  in >> path;
170  in >> version;
171  in >> alias;
172  in >> tag;
173 
174  }
175 
176  in.close();
177  }
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::map< std::string, std::string > pathAliasPair
pathVersionAliasMmap versionMmap
std::pair< unsigned int, std::string > versionAliasPair
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 212 of file PixelAliasList.h.

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

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

213  {
214 
215  //first loop over configuration aliases
216  for(unsigned int i=0;i<pixelConfigAliases_.size();i++){
217  //std::cout << "Looping over aliases:"<<i<<std::endl;
218  for(unsigned int j=0;j<pixelConfigAliases_[i].nVersionAliases();j++){
219  //std::cout << "Looping over versionAliases:"<<j<<std::endl;
220  if(path==pixelConfigAliases_[i].versionAliasesPath(j)&&
221  alias==pixelConfigAliases_[i].versionAliasesAlias(j)){
222  //std::cout << "Making clone!"<<std::endl;
223  unsigned int newkey=config.clone(pixelConfigAliases_[i].key(),path,version);
224  pixelConfigAliases_[i].setKey(newkey);
225  }
226  }
227  }
228  }
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 290 of file PixelAliasList.h.

References mps_fire::i, and pixelVersionAliases_.

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

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

Definition at line 190 of file PixelAliasList.h.

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

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

190  {
191  for(unsigned int i=0;i<pixelConfigAliases_.size();i++){
192  if (pixelConfigAliases_[i].name()==aliasName){
193  return &(pixelConfigAliases_[i]);
194  }
195  }
196  return 0;
197  }
std::string name(unsigned int i)
std::vector< PixelConfigAlias > pixelConfigAliases_
void pos::PixelAliasList::writefile ( )
inline

Definition at line 34 of file PixelAliasList.h.

References pos::PixelVersionAlias::alias(), createBeamHaloJobs::directory, corrVsCorr::filename, mps_fire::i, pos::PixelConfigAlias::key(), gen::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().

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

Member Data Documentation

pathAliasMmap pos::PixelAliasList::aliasMmap
private

Definition at line 298 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 299 of file PixelAliasList.h.

Referenced by getVersionData(), and readfile().