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 Member Functions | Private Attributes | Friends
LMFSeqDat Class Reference

#include <LMFSeqDat.h>

Inheritance diagram for LMFSeqDat:
LMFUnique IUniqueDBObject IDBObject

Public Member Functions

std::map< int, LMFSeqDatfetchByRunIOV (RunIOV &iov)
 
std::map< int, LMFSeqDatfetchByRunIOV (RunIOV &iov, const LMFColor &col)
 
LMFSeqDat fetchByRunIOV (RunIOV &iov, int seq_num)
 
std::map< int, LMFSeqDatfetchByRunNumber (int runno)
 
LMFSeqDat fetchByRunNumber (int runno, int seq_num)
 
LMFSeqDat fetchByRunNumber (int runno, Tm taken_at)
 
LMFSeqDat fetchByRunNumber (int runno, std::string taken_at)
 
LMFSeqDat fetchLast ()
 
RunIOV fetchLastRun ()
 
RunIOV getRunIOV () const
 
int getSequenceNumber () const
 
Tm getSequenceStart () const
 
Tm getSequenceStop () const
 
int getVmax () const
 
int getVmin () const
 
bool isValid () const
 
 LMFSeqDat ()
 
 LMFSeqDat (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
 LMFSeqDat (EcalDBConnection *c)
 
bool operator!= (const LMFSeqDat &m) const
 
bool operator== (const LMFSeqDat &m) const
 
LMFSeqDatsetRunIOV (const RunIOV &iov)
 
LMFSeqDatsetSequenceNumber (int n)
 
LMFSeqDatsetSequenceStart (Tm start)
 
LMFSeqDatsetSequenceStop (Tm end)
 
LMFSeqDatsetVersions (int vmin, int vmax)
 
 ~LMFSeqDat ()
 
- Public Member Functions inherited from LMFUnique
void attach (std::string name, LMFUnique *u)
 
void debug ()
 
virtual void dump () const
 
virtual void dump (int n) const
 
virtual bool exists ()
 
virtual boost::ptr_list
< LMFUnique
fetchAll () const throw (std::runtime_error)
 
int fetchID () throw (std::runtime_error)
 
std::string getClassName ()
 
std::string getClassName () const
 
int getID () const
 
int getInt (std::string fieldname) const
 
std::string getString (std::string fieldname) const
 
virtual bool isValid ()
 
 LMFUnique ()
 
 LMFUnique (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
 LMFUnique (EcalDBConnection *c)
 
void nodebug ()
 
virtual bool operator< (const LMFUnique &r)
 
virtual bool operator<= (const LMFUnique &r)
 
std::string sequencePostfix (Tm t)
 
void setByID (int id) throw (std::runtime_error)
 
LMFUniquesetInt (std::string key, int value)
 
LMFUniquesetString (std::string key, std::string value)
 
void startProfiling ()
 
void stopProfiling ()
 
virtual ~LMFUnique ()
 
- Public Member Functions inherited from IDBObject
oracle::occi::Connection * getConn () const
 
oracle::occi::Environment * getEnv () const
 
void setConnection (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
virtual ~IDBObject ()
 

Private Member Functions

std::map< int, LMFSeqDatfetchByRunIOV (std::vector< std::string > par, std::string sql, std::string method) throw (std::runtime_error)
 
std::map< int, LMFSeqDatfetchByRunIOV (int par, std::string sql, std::string method) throw (std::runtime_error)
 
std::map< int, LMFSeqDatfetchByRunIOV (std::string sql, std::string method) throw (std::runtime_error)
 
std::string fetchIdSql (Statement *stmt)
 
void fetchParentIDs () throw (std::runtime_error)
 
void getParameters (ResultSet *rset)
 
std::string setByIDSql (Statement *stmt, int id)
 
void setVmax (int v)
 
void setVmin (int v)
 
std::string writeDBSql (Statement *stmt)
 

Private Attributes

RunIOV m_runIOV
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Public Types inherited from LMFUnique
typedef oracle::occi::ResultSet ResultSet
 
typedef oracle::occi::Statement Statement
 
- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS =1024
 
- Protected Member Functions inherited from LMFUnique
virtual void setClassName (std::string s)
 
virtual int writeDB () throw (std::runtime_error)
 
virtual int writeForeignKeys () throw (std::runtime_error)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const throw (std::runtime_error)
 
- Protected Attributes inherited from LMFUnique
bool _profiling
 
std::string m_className
 
char m_debug
 
std::map< std::string,
LMFUnique * > 
m_foreignKeys
 
std::map< std::string, int > m_intFields
 
std::map< std::string,
std::string > 
m_stringFields
 
- Protected Attributes inherited from IUniqueDBObject
int m_ID
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 14 of file LMFSeqDat.h.

Constructor & Destructor Documentation

LMFSeqDat::LMFSeqDat ( )

Definition at line 10 of file LMFSeqDat.cc.

References LMFUnique::m_intFields, m_runIOV, LMFUnique::m_stringFields, Tm::plusInfinity(), LMFUnique::setClassName(), Tm::str(), and lumiQTWidget::t.

10  : LMFUnique()
11 {
12  setClassName("LMFSeqDat");
13 
14  m_runIOV = RunIOV();
15  m_intFields["seq_num"] = 0;
16  Tm t;
17  t = t.plusInfinity();
18  m_stringFields["seq_start"] = t.str();
19  m_stringFields["seq_stop"] = t.str();
20  m_intFields["vmin"] = 1;
21  m_intFields["vmax"] = 0;
22 }
virtual void setClassName(std::string s)
Definition: LMFUnique.h:97
LMFUnique()
Definition: LMFUnique.h:23
std::map< std::string, std::string > m_stringFields
Definition: LMFUnique.h:102
RunIOV m_runIOV
Definition: LMFSeqDat.h:79
std::string str() const
Definition: Tm.cc:89
Definition: RunIOV.h:13
Definition: Tm.h:14
static Tm plusInfinity()
Definition: Tm.h:47
std::map< std::string, int > m_intFields
Definition: LMFUnique.h:104
LMFSeqDat::LMFSeqDat ( oracle::occi::Environment *  env,
oracle::occi::Connection *  conn 
)

Definition at line 37 of file LMFSeqDat.cc.

References LMFUnique::m_intFields, m_runIOV, LMFUnique::m_stringFields, Tm::plusInfinity(), LMFUnique::setClassName(), Tm::str(), and lumiQTWidget::t.

38  : LMFUnique(env, conn) {
39  setClassName("LMFSeqDat");
40 
41  m_runIOV = RunIOV();
42  m_intFields["seq_num"] = 0;
43  Tm t;
44  t = t.plusInfinity();
45  m_stringFields["seq_start"] = t.str();
46  m_stringFields["seq_stop"] = t.str();
47  m_intFields["vmin"] = 1;
48  m_intFields["vmax"] = 0;
49 }
virtual void setClassName(std::string s)
Definition: LMFUnique.h:97
LMFUnique()
Definition: LMFUnique.h:23
std::map< std::string, std::string > m_stringFields
Definition: LMFUnique.h:102
RunIOV m_runIOV
Definition: LMFSeqDat.h:79
std::string str() const
Definition: Tm.cc:89
Definition: RunIOV.h:13
Definition: Tm.h:14
tuple conn
Definition: results_mgr.py:53
static Tm plusInfinity()
Definition: Tm.h:47
std::map< std::string, int > m_intFields
Definition: LMFUnique.h:104
LMFSeqDat::LMFSeqDat ( EcalDBConnection c)

Definition at line 24 of file LMFSeqDat.cc.

References LMFUnique::m_intFields, m_runIOV, LMFUnique::m_stringFields, Tm::plusInfinity(), LMFUnique::setClassName(), Tm::str(), and lumiQTWidget::t.

24  : LMFUnique(c) {
25  setClassName("LMFSeqDat");
26 
27  m_runIOV = RunIOV();
28  m_intFields["seq_num"] = 0;
29  Tm t;
30  t = t.plusInfinity();
31  m_stringFields["seq_start"] = t.str();
32  m_stringFields["seq_stop"] = t.str();
33  m_intFields["vmin"] = 1;
34  m_intFields["vmax"] = 0;
35 }
virtual void setClassName(std::string s)
Definition: LMFUnique.h:97
LMFUnique()
Definition: LMFUnique.h:23
std::map< std::string, std::string > m_stringFields
Definition: LMFUnique.h:102
RunIOV m_runIOV
Definition: LMFSeqDat.h:79
std::string str() const
Definition: Tm.cc:89
Definition: RunIOV.h:13
Definition: Tm.h:14
static Tm plusInfinity()
Definition: Tm.h:47
std::map< std::string, int > m_intFields
Definition: LMFUnique.h:104
LMFSeqDat::~LMFSeqDat ( )

Definition at line 51 of file LMFSeqDat.cc.

52 {
53 }

Member Function Documentation

std::map< int, LMFSeqDat > LMFSeqDat::fetchByRunIOV ( RunIOV iov)

Definition at line 268 of file LMFSeqDat.cc.

References RunIOV::getID().

Referenced by fetchByRunIOV(), fetchByRunNumber(), and fetchLast().

268  {
269  int runIOVID = iov.getID();
270  return fetchByRunIOV(runIOVID,
271  "SELECT SEQ_ID FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT "
272  "WHERE RUN_IOV_ID = :1",
273  "fetchByRunIOV");
274 }
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:268
int getID()
Definition: RunIOV.h:36
std::map< int, LMFSeqDat > LMFSeqDat::fetchByRunIOV ( RunIOV iov,
const LMFColor col 
)

Definition at line 276 of file LMFSeqDat.cc.

References fetchByRunIOV(), RunIOV::getID(), and LMFUnique::getID().

277  {
278  int runIOVID = iov.getID();
279  int colorId = col.getID();
280  std::vector<std::string> pars;
281  std::stringstream ss;
282  ss << "I" << runIOVID;
283  pars.push_back(ss.str());
284  ss.str(std::string());
285  ss << "I" << colorId;
286  pars.push_back(ss.str());
287  return fetchByRunIOV(pars,
288  "SELECT S.SEQ_ID FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT "
289  "S JOIN CMS_ECAL_LASER_COND.LMF_RUN_IOV R"
290  " ON S.SEQ_ID = R.SEQ_ID WHERE RUN_IOV_ID = :1 AND "
291  " COLOR_ID = :2",
292  "fetchByRunIOVAndColor");
293 }
int getID() const
Definition: LMFUnique.h:52
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:268
int getID()
Definition: RunIOV.h:36
LMFSeqDat LMFSeqDat::fetchByRunIOV ( RunIOV iov,
int  seq_num 
)
inline

Definition at line 66 of file LMFSeqDat.h.

References fetchByRunIOV().

66  {
67  return fetchByRunIOV(iov)[seq_num];
68  }
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:268
std::map< int, LMFSeqDat > LMFSeqDat::fetchByRunIOV ( std::vector< std::string >  par,
std::string  sql,
std::string  method 
)
throw (std::runtime_error
)
private

Definition at line 215 of file LMFSeqDat.cc.

References alignCSCRings::e, getSequenceNumber(), i, prof2calltree::l, PFRecoTauDiscriminationAgainstElectronMVA2_cfi::method, alignCSCRings::s, LMFUnique::setByID(), and IDBObject::setConnection().

219 {
220  std::map<int, LMFSeqDat> l;
221  this->checkConnection();
222  try {
223  Statement *stmt = m_conn->createStatement();
224  stmt->setSQL(sql);
225  for (unsigned int i = 0; i < pars.size(); i++) {
226  if (pars[i][0] == 'I') {
227  stmt->setInt(i + 1, atoi(pars[i].c_str() + 1));
228  } else if (pars[i][0] == 'S') {
229  stmt->setString(i + 1, pars[i].c_str() + 1);
230  } else {
231  throw(std::runtime_error(m_className + "::" + method + ": " +
232  "Invalid type"));
233  }
234  }
235  ResultSet *rset = stmt->executeQuery();
236  while (rset->next() != 0) {
237  int seq_id = rset->getInt(1);
238  LMFSeqDat s;
240  s.setByID(seq_id);
241  l[s.getSequenceNumber()] = s;
242  }
243  m_conn->terminateStatement(stmt);
244  } catch (SQLException &e) {
245  throw(std::runtime_error(m_className + "::" + method + ": " +
246  e.getMessage()));
247  }
248  return l;
249 }
std::string m_className
Definition: LMFUnique.h:99
int i
Definition: DBlmapReader.cc:9
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
int getSequenceNumber() const
Definition: LMFSeqDat.h:41
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
void setByID(int id)
Definition: LMFUnique.cc:286
oracle::occi::Statement Statement
Definition: LMFUnique.h:20
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:21
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void checkConnection() const
Definition: IDBObject.h:41
std::map< int, LMFSeqDat > LMFSeqDat::fetchByRunIOV ( int  par,
std::string  sql,
std::string  method 
)
throw (std::runtime_error
)
private

Definition at line 203 of file LMFSeqDat.cc.

References PFRecoTauDiscriminationAgainstElectronMVA2_cfi::method.

207 {
208  std::vector<std::string> pars;
209  std::stringstream ss;
210  ss << "I" << par;
211  pars.push_back(ss.str());
212  return fetchByRunIOV(pars, sql, method);
213 }
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:268
std::map< int, LMFSeqDat > LMFSeqDat::fetchByRunIOV ( std::string  sql,
std::string  method 
)
throw (std::runtime_error
)
private

Definition at line 195 of file LMFSeqDat.cc.

References PFRecoTauDiscriminationAgainstElectronMVA2_cfi::method.

198 {
199  std::vector<std::string> pars;
200  return fetchByRunIOV(pars, sql, method);
201 }
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:268
std::map< int, LMFSeqDat > LMFSeqDat::fetchByRunNumber ( int  runno)

Definition at line 295 of file LMFSeqDat.cc.

References fetchByRunIOV().

Referenced by fetchByRunNumber().

295  {
296  return fetchByRunIOV(runno,
297  "SELECT SEQ_ID FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT D "
298  "JOIN CMS_ECAL_COND.RUN_IOV R ON "
299  "D.RUN_IOV_ID = R.IOV_ID WHERE RUN_NUM = :1",
300  "fetchByRunNumber");
301 }
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:268
LMFSeqDat LMFSeqDat::fetchByRunNumber ( int  runno,
int  seq_num 
)
inline

Definition at line 70 of file LMFSeqDat.h.

References fetchByRunNumber().

70  {
71  return fetchByRunNumber(runno)[seq_num];
72  }
std::map< int, LMFSeqDat > fetchByRunNumber(int runno)
Definition: LMFSeqDat.cc:295
LMFSeqDat LMFSeqDat::fetchByRunNumber ( int  runno,
Tm  taken_at 
)

Definition at line 303 of file LMFSeqDat.cc.

References fetchByRunNumber(), and Tm::str().

303  {
304  return fetchByRunNumber(runno, taken_at.str());
305 }
std::map< int, LMFSeqDat > fetchByRunNumber(int runno)
Definition: LMFSeqDat.cc:295
std::string str() const
Definition: Tm.cc:89
LMFSeqDat LMFSeqDat::fetchByRunNumber ( int  runno,
std::string  taken_at 
)

Definition at line 307 of file LMFSeqDat.cc.

References gather_cfg::cout, fetchByRunIOV(), i, prof2calltree::l, lumiQueryAPI::q, run_regression::ret, lumiregperbunch::runno, and vdt::x.

307  {
308  std::map<int, LMFSeqDat> l;
309  std::vector<std::string> pars;
310  std::stringstream ss;
311  ss << "I" << runno;
312  pars.push_back(ss.str());
313  ss.str(std::string());
314  ss << "S" << taken_at;
315  pars.push_back(ss.str());
316  std::string q = "SELECT SEQ_ID FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT D "
317  "JOIN CMS_ECAL_COND.RUN_IOV R ON "
318  "D.RUN_IOV_ID = R.IOV_ID WHERE RUN_NUM = :1 AND "
319  "SEQ_START >= TO_DATE(:2, 'YYYY-MM-DD HH24:MI:SS') "
320  "AND SEQ_STOP <= TO_DATE(:2, 'YYYY-MM-DD HH24:MI:SS')";
321  l = fetchByRunIOV(pars, q, "fetchByRunNumberAt");
322  LMFSeqDat ret;
323  if (l.size() == 1) {
324  std::map<int, LMFSeqDat>::const_iterator x = l.begin();
325  ret = x->second;
326  } else if (l.size() > 1) {
327  std::cout << "WARNING: Your query returned more than one result. "
328  << std::endl;
329  std::cout << " This was not expected. Please check the DB!!!"
330  << std::endl;
331  std::cout << "Your query: " << std::endl << q << std::endl;
332  std::cout << "Your parameters: " << std::endl;
333  for (unsigned int i = 0; i < pars.size(); i++) {
334  std::cout << i << ": " << pars[i] << std::endl;
335  }
336  }
337  return ret;
338 }
int i
Definition: DBlmapReader.cc:9
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:268
tuple cout
Definition: gather_cfg.py:121
x
Definition: VDTMath.h:216
std::string LMFSeqDat::fetchIdSql ( Statement stmt)
privatevirtual

Reimplemented from LMFUnique.

Definition at line 75 of file LMFSeqDat.cc.

References gather_cfg::cout, RunIOV::getID(), getSequenceNumber(), getVmax(), getVmin(), LMFUnique::m_className, LMFUnique::m_debug, and m_runIOV.

76 {
77  int runIOVID = m_runIOV.getID();
78  if (!runIOVID) {
79  if (m_debug) {
80  std::cout << m_className << ": RunIOV not set" << endl;
81  }
82  return "";
83  }
84 
85  if (m_debug) {
86  std::cout << "Run IOV ID: " << runIOVID << std::endl;
87  std::cout << "SEQ # : " << getSequenceNumber() << std::endl;
88  std::cout << "Versions : " << getVmin() << " - " << getVmax() << endl;
89  }
90  std::string sql = "SELECT SEQ_ID FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT "
91  "WHERE "
92  "RUN_IOV_ID = :1 AND "
93  "SEQ_NUM = :2 AND "
94  "VMIN = :3 ";
95  if (getVmax() > 0) {
96  sql += "AND VMAX = :4";
97  } else {
98  sql += "ORDER BY VMAX DESC";
99  }
100  stmt->setSQL(sql);
101  stmt->setInt(1, runIOVID);
102  stmt->setInt(2, getSequenceNumber());
103  stmt->setInt(3, getVmin());
104  if (getVmax() > 0) {
105  stmt->setInt(4, getVmax());
106  }
107  return sql;
108 }
std::string m_className
Definition: LMFUnique.h:99
int getVmax() const
Definition: LMFSeqDat.h:49
int getSequenceNumber() const
Definition: LMFSeqDat.h:41
RunIOV m_runIOV
Definition: LMFSeqDat.h:79
int getID()
Definition: RunIOV.h:36
tuple cout
Definition: gather_cfg.py:121
char m_debug
Definition: LMFUnique.h:100
int getVmin() const
Definition: LMFSeqDat.h:48
LMFSeqDat LMFSeqDat::fetchLast ( )

Definition at line 251 of file LMFSeqDat.cc.

References fetchByRunIOV(), m, and run_regression::ret.

Referenced by fetchLastRun().

251  {
252  LMFSeqDat ret;
253  std::map<int, LMFSeqDat> m =
254  fetchByRunIOV("SELECT SEQ_ID FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT "
255  "WHERE SEQ_ID = "
256  "(SELECT MAX(SEQ_ID) FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT)",
257  "fetchLast");
258  if (m.size() > 0) {
259  ret = m.begin()->second;
260  }
261  return ret;
262 }
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:268
RunIOV LMFSeqDat::fetchLastRun ( )

Definition at line 264 of file LMFSeqDat.cc.

References fetchLast(), and getRunIOV().

Referenced by EcalCondDBInterface::fetchLMFLastRun().

264  {
265  return fetchLast().getRunIOV();
266 }
LMFSeqDat fetchLast()
Definition: LMFSeqDat.cc:251
RunIOV getRunIOV() const
Definition: LMFSeqDat.cc:61
void LMFSeqDat::fetchParentIDs ( )
throw (std::runtime_error
)
privatevirtual

Reimplemented from LMFUnique.

Definition at line 181 of file LMFSeqDat.cc.

References RunIOV::getID(), IDBObject::m_conn, IDBObject::m_env, m_runIOV, RunIOV::setByID(), and IDBObject::setConnection().

183 {
184  // get the RunIOV
186  int runIOVID = m_runIOV.getID();
187  m_runIOV.setByID(runIOVID);
188 
189  if (m_runIOV.getID() == 0) {
190  throw(std::runtime_error("LMFSeqDat: Given RunIOV does not exist in DB"));
191  }
192 
193 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setByID(int id)
Definition: RunIOV.cc:152
RunIOV m_runIOV
Definition: LMFSeqDat.h:79
int getID()
Definition: RunIOV.h:36
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void LMFSeqDat::getParameters ( ResultSet rset)
privatevirtual

Reimplemented from LMFUnique.

Definition at line 118 of file LMFSeqDat.cc.

References DateHandler::dateToTm(), IDBObject::m_conn, IDBObject::m_env, m_runIOV, RunIOV::setByID(), IDBObject::setConnection(), LMFUnique::setInt(), LMFUnique::setString(), and Tm::str().

118  {
119  DateHandler dh(m_env, m_conn);
120  int runIOVID = rset->getInt(1);
121  setInt("seq_num", rset->getInt(2));
122  Date startDate = rset->getDate(3);
123  Date endDate = rset->getDate(4);
124  setInt("vmin", rset->getInt(5));
125  setInt("vmax", rset->getInt(6));
126 
127  setString("seq_start", dh.dateToTm( startDate ).str());
128  setString("seq_stop", dh.dateToTm( endDate ).str());
129 
131  m_runIOV.setByID(runIOVID);
132 }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setByID(int id)
Definition: RunIOV.cc:152
RunIOV m_runIOV
Definition: LMFSeqDat.h:79
LMFUnique & setString(std::string key, std::string value)
Definition: LMFUnique.cc:15
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
RunIOV LMFSeqDat::getRunIOV ( ) const

Definition at line 61 of file LMFSeqDat.cc.

References m_runIOV.

Referenced by fetchLastRun(), and operator==().

62 {
63  return m_runIOV;
64 }
RunIOV m_runIOV
Definition: LMFSeqDat.h:79
int LMFSeqDat::getSequenceNumber ( ) const
inline

Definition at line 41 of file LMFSeqDat.h.

References LMFUnique::getInt().

Referenced by fetchByRunIOV(), fetchIdSql(), operator==(), and writeDBSql().

41 { return getInt("seq_num"); }
int getInt(std::string fieldname) const
Definition: LMFUnique.cc:203
Tm LMFSeqDat::getSequenceStart ( ) const
inline

Definition at line 42 of file LMFSeqDat.h.

References LMFUnique::getString(), Tm::setToString(), and lumiQTWidget::t.

Referenced by isValid(), operator==(), and writeDBSql().

42  {
43  Tm t;
44  t.setToString(getString("seq_start"));
45  return t;
46  }
void setToString(const std::string s)
Definition: Tm.cc:193
std::string getString(std::string fieldname) const
Definition: LMFUnique.cc:194
Definition: Tm.h:14
Tm LMFSeqDat::getSequenceStop ( ) const

Definition at line 55 of file LMFSeqDat.cc.

References LMFUnique::getString(), Tm::setToString(), and lumiQTWidget::t.

Referenced by isValid(), operator==(), and writeDBSql().

55  {
56  Tm t;
57  t.setToString(getString("seq_stop"));
58  return t;
59 }
void setToString(const std::string s)
Definition: Tm.cc:193
std::string getString(std::string fieldname) const
Definition: LMFUnique.cc:194
Definition: Tm.h:14
int LMFSeqDat::getVmax ( ) const
inline

Definition at line 49 of file LMFSeqDat.h.

References LMFUnique::getInt().

Referenced by fetchIdSql(), operator==(), and writeDBSql().

49 { return getInt("vmax"); }
int getInt(std::string fieldname) const
Definition: LMFUnique.cc:203
int LMFSeqDat::getVmin ( ) const
inline

Definition at line 48 of file LMFSeqDat.h.

References LMFUnique::getInt().

Referenced by fetchIdSql(), operator==(), and writeDBSql().

48 { return getInt("vmin"); }
int getInt(std::string fieldname) const
Definition: LMFUnique.cc:203
bool LMFSeqDat::isValid ( void  ) const
virtual

Reimplemented from LMFUnique.

Definition at line 134 of file LMFSeqDat.cc.

References getSequenceStart(), getSequenceStop(), and run_regression::ret.

Referenced by writeDBSql().

134  {
135  bool ret = true;
136  if (getSequenceStart().isNull()) {
137  ret = false;
138  }
139  if ((getSequenceStop().str().length() > 0) &&
140  (getSequenceStop().microsTime() < getSequenceStart().microsTime())) {
141  ret = false;
142  }
143  if (getSequenceStop() == Tm().plusInfinity()) {
144  ret = false;
145  }
146  return ret;
147 }
Tm getSequenceStop() const
Definition: LMFSeqDat.cc:55
Tm getSequenceStart() const
Definition: LMFSeqDat.h:42
Definition: Tm.h:14
bool LMFSeqDat::operator!= ( const LMFSeqDat m) const
inline

Definition at line 63 of file LMFSeqDat.h.

References m.

63 { return !(*this == m); }
bool LMFSeqDat::operator== ( const LMFSeqDat m) const
inline

Definition at line 53 of file LMFSeqDat.h.

References getRunIOV(), getSequenceNumber(), getSequenceStart(), getSequenceStop(), getVmax(), and getVmin().

54  {
55  return ( getSequenceNumber() == m.getSequenceNumber() &&
56  getRunIOV() == m.getRunIOV() &&
59  getVmin() == m.getVmin() &&
60  getVmax() == m.getVmax());
61  }
Tm getSequenceStop() const
Definition: LMFSeqDat.cc:55
int getVmax() const
Definition: LMFSeqDat.h:49
int getSequenceNumber() const
Definition: LMFSeqDat.h:41
Tm getSequenceStart() const
Definition: LMFSeqDat.h:42
RunIOV getRunIOV() const
Definition: LMFSeqDat.cc:61
int getVmin() const
Definition: LMFSeqDat.h:48
std::string LMFSeqDat::setByIDSql ( Statement stmt,
int  id 
)
privatevirtual

Reimplemented from LMFUnique.

Definition at line 110 of file LMFSeqDat.cc.

110  {
111  std::string sql = "SELECT RUN_IOV_ID, SEQ_NUM, SEQ_START, SEQ_STOP, "
112  "VMIN, VMAX FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT WHERE SEQ_ID = :1";
113  stmt->setSQL(sql);
114  stmt->setInt(1, id);
115  return sql;
116 }
LMFSeqDat & LMFSeqDat::setRunIOV ( const RunIOV iov)

Definition at line 66 of file LMFSeqDat.cc.

References o2o::iov, IUniqueDBObject::m_ID, and m_runIOV.

67 {
68  if (iov != m_runIOV) {
69  m_ID = 0;
70  m_runIOV = iov;
71  }
72  return *this;
73 }
RunIOV m_runIOV
Definition: LMFSeqDat.h:79
tuple iov
Definition: o2o.py:307
LMFSeqDat& LMFSeqDat::setSequenceNumber ( int  n)
inline

Definition at line 26 of file LMFSeqDat.h.

References LMFUnique::setInt().

26 { setInt("seq_num", n); return *this; }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
LMFSeqDat& LMFSeqDat::setSequenceStart ( Tm  start)
inline

Definition at line 27 of file LMFSeqDat.h.

References LMFUnique::setString(), and Tm::str().

27  {
28  setString("seq_start", start.str());
29  return *this;
30  }
LMFUnique & setString(std::string key, std::string value)
Definition: LMFUnique.cc:15
std::string str() const
Definition: Tm.cc:89
LMFSeqDat& LMFSeqDat::setSequenceStop ( Tm  end)
inline

Definition at line 31 of file LMFSeqDat.h.

References LMFUnique::setString(), and Tm::str().

Referenced by writeDBSql().

31  {
32  setString("seq_stop", end.str());
33  return *this;
34  }
LMFUnique & setString(std::string key, std::string value)
Definition: LMFUnique.cc:15
std::string str() const
Definition: Tm.cc:89
LMFSeqDat& LMFSeqDat::setVersions ( int  vmin,
int  vmax 
)
inline

Definition at line 35 of file LMFSeqDat.h.

References setVmax(), and setVmin().

35  {
36  setVmin(vmin) ; setVmax(vmax);
37  return *this;
38  }
void setVmax(int v)
Definition: LMFSeqDat.h:84
void setVmin(int v)
Definition: LMFSeqDat.h:81
void LMFSeqDat::setVmax ( int  v)
inlineprivate

Definition at line 84 of file LMFSeqDat.h.

References LMFUnique::setInt().

Referenced by setVersions().

84  {
85  setInt("vmax", v);
86  }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
mathSSE::Vec4< T > v
void LMFSeqDat::setVmin ( int  v)
inlineprivate

Definition at line 81 of file LMFSeqDat.h.

References LMFUnique::setInt().

Referenced by setVersions().

81  {
82  setInt("vmin", v);
83  }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
mathSSE::Vec4< T > v
std::string LMFSeqDat::writeDBSql ( Statement stmt)
privatevirtual

Reimplemented from LMFUnique.

Definition at line 149 of file LMFSeqDat.cc.

References gather_cfg::cout, LMFUnique::dump(), RunIOV::getID(), DateHandler::getPlusInfTm(), getSequenceNumber(), getSequenceStart(), getSequenceStop(), getVmax(), getVmin(), isValid(), IDBObject::m_conn, IDBObject::m_env, m_runIOV, LMFUnique::sequencePostfix(), setSequenceStop(), and DateHandler::tmToDate().

150 {
151  // Validate the data, use infinity-till convention
152  DateHandler dh(m_env, m_conn);
153 
154  if (!isValid()) {
155  dump();
156  throw(std::runtime_error("LMFSeqDat::writeDB: not valid"));
157  }
158 
159  if (getSequenceStop().str().length() == 0) {
160  setSequenceStop(dh.getPlusInfTm());
161  }
162  int runIOVID = m_runIOV.getID();
163  if (runIOVID == 0) {
164  throw(std::runtime_error("LMFSeqDat::writeDB: RunIOV not set"));
165  }
166  std::string sp = sequencePostfix(getSequenceStart());
167  std::string sql = "INSERT INTO LMF_SEQ_DAT (SEQ_ID, RUN_IOV_ID, SEQ_NUM, "
168  "SEQ_START, SEQ_STOP, VMIN, VMAX) "
169  "VALUES (SEQ_ID_" + sp + "_SQ.NextVal, :1, :2, :3, :4, :5, :6)";
170  cout << sql << endl;
171  stmt->setSQL(sql);
172  stmt->setInt(1, runIOVID);
173  stmt->setInt(2, getSequenceNumber());
174  stmt->setDate(3, dh.tmToDate(getSequenceStart()));
175  stmt->setDate(4, dh.tmToDate(getSequenceStop()));
176  stmt->setInt(5, getVmin());
177  stmt->setInt(6, getVmax());
178  return sql;
179 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
Tm getSequenceStop() const
Definition: LMFSeqDat.cc:55
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
int getVmax() const
Definition: LMFSeqDat.h:49
int getSequenceNumber() const
Definition: LMFSeqDat.h:41
virtual void dump() const
Definition: LMFUnique.cc:112
std::string sequencePostfix(Tm t)
Definition: LMFUnique.cc:10
LMFSeqDat & setSequenceStop(Tm end)
Definition: LMFSeqDat.h:31
RunIOV m_runIOV
Definition: LMFSeqDat.h:79
Tm getSequenceStart() const
Definition: LMFSeqDat.h:42
int getID()
Definition: RunIOV.h:36
tuple cout
Definition: gather_cfg.py:121
bool isValid() const
Definition: LMFSeqDat.cc:134
int getVmin() const
Definition: LMFSeqDat.h:48

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 16 of file LMFSeqDat.h.

Member Data Documentation

RunIOV LMFSeqDat::m_runIOV
private