CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LMFColoredTable.cc
Go to the documentation of this file.
2 
4  m_className = "LMFColoredTable";
5  m_system = 0;
6  m_color = 0;
7  COLOR[0] = "BLUE";
8  COLOR[1] = "GREEN";
9  COLOR[2] = "ORANGE";
10  COLOR[3] = "IR";
11  SYSTEM[0] = "LASER";
12  SYSTEM[1] = "LED";
13 }
14 
16  m_className = "LMFColoredTable";
17  m_system = 0;
18  m_color = 0;
19  COLOR[0] = "BLUE";
20  COLOR[1] = "GREEN";
21  COLOR[2] = "ORANGE";
22  COLOR[3] = "IR";
23  SYSTEM[0] = "LASER";
24  SYSTEM[1] = "LED";
25 }
26 
27 LMFColoredTable::LMFColoredTable(oracle::occi::Environment* env,
28  oracle::occi::Connection* conn) :
29  LMFDat(env, conn) {
30  m_className = "LMFColoredTable";
31  m_system = 0;
32  m_color = 0;
33  COLOR[0] = "BLUE";
34  COLOR[1] = "GREEN";
35  COLOR[2] = "ORANGE";
36  COLOR[3] = "IR";
37  SYSTEM[0] = "LASER";
38  SYSTEM[1] = "LED";
39 }
40 
42  std::string ret = "";
43  std::map<int, std::string>::const_iterator i = COLOR.find(m_color);
44  if (i != COLOR.end()) {
45  ret = i->second;
46  }
47  return ret;
48 }
49 
51  std::string ret = "";
52  std::map<int, std::string>::const_iterator i = SYSTEM.find(m_system);
53  if (i != SYSTEM.end()) {
54  ret = i->second;
55  }
56  return ret;
57 }
58 
60  std::transform(color.begin(), color.end(), color.begin(), toupper);
61  std::map<int, std::string>::const_iterator i = COLOR.begin();
62  std::map<int, std::string>::const_iterator e = COLOR.end();
63  bool loop = true;
64  while ((loop) && (i != e)) {
65  if (i->second == color) {
66  loop = false;
67  setColor(i->first);
68  }
69  i++;
70  }
71  return *this;
72 }
73 
75  std::transform(system.begin(), system.end(), system.begin(), toupper);
76  std::map<int, std::string>::const_iterator i = SYSTEM.begin();
77  std::map<int, std::string>::const_iterator e = SYSTEM.end();
78  bool loop = true;
79  while ((loop) && (i != e)) {
80  if (i->second == system) {
81  loop = false;
82  setSystem(i->first);
83  }
84  i++;
85  }
86  return *this;
87 }
88 
90  throw(std::runtime_error) {
91  // check if the VMIN version has been properly set, otherwise
92  // change it to the default value
93  std::map<int, std::vector<float> >::iterator i = m_data.begin();
94  std::map<int, std::vector<float> >::iterator e = m_data.end();
95  std::list<int> versions; // the list of different versions
96  while (i != e) {
97  int s = i->second.size();
98  if (i->second[s - 2] == 0) { // VMIN cannot be NULL
99  i->second[s - 2] = 1;
100  }
101  versions.push_back(i->second[s - 1]);
102  versions.push_back(i->second[s - 2]);
103  versions.unique();
104  i++;
105  }
106  // checkVesrions(versions); // not yet used, in fact...
107  int ret = 0;
108  try {
109  ret = LMFDat::writeDB();
110  }
111  catch (std::runtime_error &e) {
112  m_conn->rollback();
113  throw(e);
114  }
115  return ret;
116 }
std::string m_className
Definition: LMFUnique.h:99
int i
Definition: DBlmapReader.cc:9
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::map< int, std::vector< float > > m_data
Definition: LMFDat.h:153
int loop
CMSSW
std::map< int, std::string > COLOR
int writeDB()
Definition: LMFDat.cc:398
std::string getColor() const
Definition: LMFDat.h:19
LMFColoredTable & setColor(int color)
virtual LMFColoredTable & setSystem(int system)
std::map< int, std::string > SYSTEM
tuple conn
Definition: results_mgr.py:53
virtual std::string getSystem() const