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

Member Function Documentation

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

Definition at line 287 of file PixelAliasList.h.

References i, and pixelVersionAliases_.

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

287 { 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 268 of file PixelAliasList.h.

References aliasMmap.

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

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

Definition at line 239 of file PixelAliasList.h.

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

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

239  {
240  for(unsigned int i=0;i<pixelVersionAliases_.size();i++){
242  pixelVersionAliases_[i].path()==path){
243  return pixelVersionAliases_[i].version();
244  }
245  }
246  assert(0);
247  return 0;
248  }
int i
Definition: DBlmapReader.cc:9
std::string alias(unsigned int i)
assert(m_qm.get())
std::string path(unsigned int i)
std::vector< PixelVersionAlias > pixelVersionAliases_
std::vector<std::string> pos::PixelAliasList::getVersionAliases ( std::string  path)
inline

Definition at line 226 of file PixelAliasList.h.

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

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

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

References versionMmap.

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

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

Definition at line 255 of file PixelAliasList.h.

References mps_fire::result, and versionMmap.

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

Definition at line 175 of file PixelAliasList.h.

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

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

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

Definition at line 195 of file PixelAliasList.h.

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

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

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

Definition at line 281 of file PixelAliasList.h.

References i, and pixelConfigAliases_.

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

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

Definition at line 279 of file PixelAliasList.h.

References pixelConfigAliases_.

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

279 { 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 284 of file PixelAliasList.h.

References pixelVersionAliases_.

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

Definition at line 282 of file PixelAliasList.h.

References i, and pixelConfigAliases_.

282 { 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 285 of file PixelAliasList.h.

References i, and pixelVersionAliases_.

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

285 { 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 65 of file PixelAliasList.h.

References pos::PixelConfigAlias::addVersionAlias(), alias(), aliasMmap, assert(), 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().

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

Definition at line 208 of file PixelAliasList.h.

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

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

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

References i, and pixelVersionAliases_.

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

286 { 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 186 of file PixelAliasList.h.

References i, name(), and pixelConfigAliases_.

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

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

Definition at line 30 of file PixelAliasList.h.

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

30  {
31 
32  std::string directory=getenv("PIXELCONFIGURATIONBASE");
33 
34  std::string filename=directory+"/aliases.txt";
35 
36  std::ofstream out(filename.c_str());
37 
38  out << "ConfigurationAliases" <<std::endl;
39  for(unsigned int i=0;i<pixelConfigAliases_.size();i++){
40  PixelConfigAlias& theAlias=pixelConfigAliases_[i];
41  out << theAlias.name() << " "
42  << 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 
54  out << "VersionAliases" <<std::endl;
55  for(unsigned int i=0;i<pixelVersionAliases_.size();i++){
56  PixelVersionAlias& theAlias=pixelVersionAliases_[i];
57 
58  out << theAlias.path() << " "
59  << theAlias.version() << " "
60  << theAlias.alias() << " ;"<<std::endl;
61 
62  }
63  }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
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 294 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 295 of file PixelAliasList.h.

Referenced by getVersionData(), and readfile().