CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 25 of file PixelAliasList.h.

Member Function Documentation

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

Definition at line 286 of file PixelAliasList.h.

References i, and pixelVersionAliases_.

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

286 { return pixelVersionAliases_[i].alias() ;}
int i
Definition: DBlmapReader.cc:9
std::vector< PixelVersionAlias > pixelVersionAliases_
std::vector<pathAliasPair> pos::PixelAliasList::getConfigAliases ( std::string  path)
inline

Definition at line 267 of file PixelAliasList.h.

References aliasMmap.

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

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

Definition at line 238 of file PixelAliasList.h.

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

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

238  {
239  for(unsigned int i=0;i<pixelVersionAliases_.size();i++){
241  pixelVersionAliases_[i].path()==path){
242  return pixelVersionAliases_[i].version();
243  }
244  }
245  assert(0);
246  return 0;
247  }
int i
Definition: DBlmapReader.cc:9
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 225 of file PixelAliasList.h.

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

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

225  {
226  std::vector<std::string> tmp;
227  for(unsigned int i=0;i<pixelVersionAliases_.size();i++){
228  //std::cout << "path alias:"<<pixelVersionAliases_[i].path()
229  // << pixelVersionAliases_[i].alias() << std::endl;
230  if (pixelVersionAliases_[i].path()==path){
231  tmp.push_back(pixelVersionAliases_[i].alias());
232  }
233  }
234  return tmp;
235  }
int i
Definition: DBlmapReader.cc:9
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 250 of file PixelAliasList.h.

References versionMmap.

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

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

Definition at line 254 of file PixelAliasList.h.

References query::result, and versionMmap.

255  {
257  for(pathVersionAliasMmap::iterator it = versionMmap.begin() ;it != versionMmap.end() ; it ++)
258  {
259  if((*it).first.find(koc) != std::string::npos)
260  {
261  result[(*it).first] = (*it).second ;
262  }
263  }
264  return result ;
265  }
std::map< std::string, vectorVAPairs > pathVersionAliasMmap
tuple result
Definition: query.py:137
pathVersionAliasMmap versionMmap
void pos::PixelAliasList::insertAlias ( PixelConfigAlias anAlias)
inline

Definition at line 174 of file PixelAliasList.h.

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

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

174  {
175  for(unsigned int i=0;i<pixelConfigAliases_.size();i++){
176  if (pixelConfigAliases_[i].name()==anAlias.name()){
177  std::cout << "[PixelAliasList::insertAlias()]\t\t\tReplacing existing alias:" << anAlias.name()<<std::endl;
178  pixelConfigAliases_[i]=anAlias;
179  return;
180  }
181  }
182  pixelConfigAliases_.push_back(anAlias);
183  }
int i
Definition: DBlmapReader.cc:9
std::string name(unsigned int i)
std::vector< PixelConfigAlias > pixelConfigAliases_
tuple cout
Definition: gather_cfg.py:121
void pos::PixelAliasList::insertVersionAlias ( PixelVersionAlias anAlias)
inline

Definition at line 194 of file PixelAliasList.h.

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

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

194  {
195  for(unsigned int i=0;i<pixelVersionAliases_.size();i++){
196  if (pixelVersionAliases_[i].alias()==anAlias.alias()&&
197  pixelVersionAliases_[i].path()==anAlias.path()){
198  std::cout << "[PixelAliasList::insertVersionAlias()]\t\tReplacing existing version alias:"
199  <<anAlias.path()<< " " << anAlias.alias() << std::endl;
200  pixelVersionAliases_[i]=anAlias;
201  return;
202  }
203  }
204  pixelVersionAliases_.push_back(anAlias);
205  }
int i
Definition: DBlmapReader.cc:9
std::string alias(unsigned int i)
std::vector< PixelVersionAlias > pixelVersionAliases_
tuple cout
Definition: gather_cfg.py:121
unsigned int pos::PixelAliasList::key ( unsigned int  i)
inline

Definition at line 280 of file PixelAliasList.h.

References i, and pixelConfigAliases_.

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

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

Definition at line 278 of file PixelAliasList.h.

References pixelConfigAliases_.

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

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

References pixelVersionAliases_.

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

Definition at line 281 of file PixelAliasList.h.

References i, and pixelConfigAliases_.

281 { return pixelConfigAliases_[i] ;}
int i
Definition: DBlmapReader.cc:9
std::vector< PixelConfigAlias > pixelConfigAliases_
std::string pos::PixelAliasList::path ( unsigned int  i)
inline

Definition at line 284 of file PixelAliasList.h.

References i, and pixelVersionAliases_.

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

284 { return pixelVersionAliases_[i].path() ;}
int i
Definition: DBlmapReader.cc:9
std::vector< PixelVersionAlias > pixelVersionAliases_
void pos::PixelAliasList::readfile ( std::string  filename)
inline

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

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

Definition at line 207 of file PixelAliasList.h.

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

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

208  {
209 
210  //first loop over configuration aliases
211  for(unsigned int i=0;i<pixelConfigAliases_.size();i++){
212  //std::cout << "Looping over aliases:"<<i<<std::endl;
213  for(unsigned int j=0;j<pixelConfigAliases_[i].nVersionAliases();j++){
214  //std::cout << "Looping over versionAliases:"<<j<<std::endl;
215  if(path==pixelConfigAliases_[i].versionAliasesPath(j)&&
216  alias==pixelConfigAliases_[i].versionAliasesAlias(j)){
217  //std::cout << "Making clone!"<<std::endl;
218  unsigned int newkey=config.clone(pixelConfigAliases_[i].key(),path,version);
219  pixelConfigAliases_[i].setKey(newkey);
220  }
221  }
222  }
223  }
int i
Definition: DBlmapReader.cc:9
std::string alias(unsigned int i)
unsigned int version(unsigned int i)
unsigned int key(unsigned int i)
std::string path(unsigned int i)
int j
Definition: DBlmapReader.cc:9
std::vector< PixelConfigAlias > pixelConfigAliases_
unsigned int pos::PixelAliasList::version ( unsigned int  i)
inline

Definition at line 285 of file PixelAliasList.h.

References i, and pixelVersionAliases_.

Referenced by readfile().

285 { return pixelVersionAliases_[i].version();}
int i
Definition: DBlmapReader.cc:9
std::vector< PixelVersionAlias > pixelVersionAliases_
PixelConfigAlias* pos::PixelAliasList::versionAliases ( std::string  aliasName)
inline

Definition at line 185 of file PixelAliasList.h.

References i, name(), and pixelConfigAliases_.

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

185  {
186  for(unsigned int i=0;i<pixelConfigAliases_.size();i++){
187  if (pixelConfigAliases_[i].name()==aliasName){
188  return &(pixelConfigAliases_[i]);
189  }
190  }
191  return 0;
192  }
int i
Definition: DBlmapReader.cc:9
std::string name(unsigned int i)
std::vector< PixelConfigAlias > pixelConfigAliases_
void pos::PixelAliasList::writefile ( )
inline

Definition at line 29 of file PixelAliasList.h.

References pos::PixelVersionAlias::alias(), createBeamHaloJobs::directory, lut2db_cfg::filename, i, j, pos::PixelConfigAlias::key(), n, pos::PixelConfigAlias::name(), pos::PixelConfigAlias::nVersionAliases(), dbtoconf::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().

29  {
30 
31  std::string directory=getenv("PIXELCONFIGURATIONBASE");
32 
33  std::string filename=directory+"/aliases.txt";
34 
35  std::ofstream out(filename.c_str());
36 
37  out << "ConfigurationAliases" <<std::endl;
38  for(unsigned int i=0;i<pixelConfigAliases_.size();i++){
39  PixelConfigAlias& theAlias=pixelConfigAliases_[i];
40  out << theAlias.name() << " "
41  << theAlias.key() << " ";
42 
43  unsigned int n=theAlias.nVersionAliases();
44  for (unsigned int j=0;j<n;j++){
45  out << theAlias.versionAliasesPath(j) << " ";
46  out << theAlias.versionAliasesAlias(j) << " ";
47  }
48 
49  out << ";" << std::endl;
50 
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() << " "
58  << theAlias.version() << " "
59  << theAlias.alias() << " ;"<<std::endl;
60 
61  }
62  }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
tuple out
Definition: dbtoconf.py:99
std::vector< PixelVersionAlias > pixelVersionAliases_
tuple filename
Definition: lut2db_cfg.py:20
std::vector< PixelConfigAlias > pixelConfigAliases_

Member Data Documentation

pathAliasMmap pos::PixelAliasList::aliasMmap
private

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

Referenced by getVersionData(), and readfile().