CMS 3D CMS Logo

PixelConfig.h
Go to the documentation of this file.
1 #ifndef PixelConfig_h
2 #define PixelConfig_h
3 
9 #include <fstream>
10 #include <string>
11 #include <vector>
12 #include <utility>
13 
14 namespace pos{
20  class PixelConfig {
21 
22  public:
23 
24  void write(std::ofstream& out){
25  for (unsigned int i=0;i<versions_.size();i++){
26  out << versions_[i].first<<" "<<versions_[i].second<<std::endl;
27  }
28  }
29 
30  void add(std::string dir, unsigned int version){
31  std::pair<std::string,unsigned int> aPair(dir,version);
32  versions_.push_back(aPair);
33  }
34  //returns -1 if it can not find the dir.
35  int find(std::string dir, unsigned int &version){
36 // std::cout << "[pos::PixelConfig::find()] versions_.size() = " << versions_.size() << std::endl ;
37  for(unsigned int i=0;i<versions_.size();i++){
38 // std::cout << "Looking :"<<versions_[i].first
39 // <<" "<<versions_[i].second<<std::endl;
40  if (versions_[i].first==dir) {
41  version=versions_[i].second;
42  return 0;
43  }
44  }
45  return -1;
46  }
47 
48  //returns -1 if it can not find the dir.
49  int update(std::string dir, unsigned int &version, unsigned int newversion){
50  for(unsigned int i=0;i<versions_.size();i++){
51  //std::cout << "Looking :"<<versions_[i].first
52  // <<" "<<versions_[i].second<<std::endl;
53  if (versions_[i].first==dir) {
54  version=versions_[i].second;
55  versions_[i].second=newversion;
56  return 0;
57  }
58  }
59  return -1;
60  }
61 
62  std::vector<std::pair<std::string,unsigned int> > versions(){
63  return versions_;
64  }
65 
66  private:
67 
68  std::vector<std::pair<std::string,unsigned int> > versions_;
69 
70  };
71 }
72 #endif
mps_fire.i
i
Definition: mps_fire.py:355
pos::PixelConfig::write
void write(std::ofstream &out)
Definition: PixelConfig.h:24
pos
Definition: PixelAliasList.h:18
dqmdumpme.first
first
Definition: dqmdumpme.py:55
pos::PixelConfig::add
void add(std::string dir, unsigned int version)
Definition: PixelConfig.h:30
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pos::PixelConfig::versions_
std::vector< std::pair< std::string, unsigned int > > versions_
Definition: PixelConfig.h:68
pos::PixelConfig::find
int find(std::string dir, unsigned int &version)
Definition: PixelConfig.h:35
pos::PixelConfig::update
int update(std::string dir, unsigned int &version, unsigned int newversion)
Definition: PixelConfig.h:49
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
pos::PixelConfig::versions
std::vector< std::pair< std::string, unsigned int > > versions()
Definition: PixelConfig.h:62
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
pos::PixelConfig
This class implements..
Definition: PixelConfig.h:20
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23