CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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, const 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 override
 
 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 (const Tm &start)
 
LMFSeqDatsetSequenceStop (const Tm &end)
 
LMFSeqDatsetVersions (int vmin, int vmax)
 
 ~LMFSeqDat () override
 
- 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 std::list
< std::unique_ptr< LMFUnique > > 
fetchAll () const noexcept(false)
 
int fetchID () noexcept(false) override
 
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 (const Tm &t)
 
void setByID (int id) noexcept(false) override
 
LMFUniquesetInt (std::string key, int value)
 
LMFUniquesetString (std::string key, std::string value)
 
void startProfiling ()
 
void stopProfiling ()
 
 ~LMFUnique () override
 
- 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 (const std::vector< std::string > &par, std::string sql, std::string method) noexcept(false)
 
std::map< int, LMFSeqDatfetchByRunIOV (int par, std::string sql, std::string method) noexcept(false)
 
std::map< int, LMFSeqDatfetchByRunIOV (std::string sql, std::string method) noexcept(false)
 
std::string fetchIdSql (Statement *stmt) override
 
void fetchParentIDs () noexcept(false) override
 
void getParameters (ResultSet *rset) override
 
std::string setByIDSql (Statement *stmt, int id) override
 
void setVmax (int v)
 
void setVmin (int v)
 
std::string writeDBSql (Statement *stmt) override
 

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 () noexcept(false)
 
virtual int writeForeignKeys () noexcept(false)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const noexcept(false)
 
- 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 submitPVValidationJobs::t.

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

Definition at line 36 of file LMFSeqDat.cc.

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

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

Definition at line 23 of file LMFSeqDat.cc.

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

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

Definition at line 49 of file LMFSeqDat.cc.

49 {}

Member Function Documentation

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

Definition at line 245 of file LMFSeqDat.cc.

References RunIOV::getID().

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

245  {
246  int runIOVID = iov.getID();
247  return fetchByRunIOV(runIOVID,
248  "SELECT SEQ_ID FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT "
249  "WHERE RUN_IOV_ID = :1",
250  "fetchByRunIOV");
251 }
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:245
int getID()
Definition: RunIOV.h:35
std::map< int, LMFSeqDat > LMFSeqDat::fetchByRunIOV ( RunIOV iov,
const LMFColor col 
)

Definition at line 253 of file LMFSeqDat.cc.

References fetchByRunIOV(), RunIOV::getID(), LMFUnique::getID(), contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

253  {
254  int runIOVID = iov.getID();
255  int colorId = col.getID();
256  std::vector<std::string> pars;
257  std::stringstream ss;
258  ss << "I" << runIOVID;
259  pars.push_back(ss.str());
260  ss.str(std::string());
261  ss << "I" << colorId;
262  pars.push_back(ss.str());
263  return fetchByRunIOV(pars,
264  "SELECT S.SEQ_ID FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT "
265  "S JOIN CMS_ECAL_LASER_COND.LMF_RUN_IOV R"
266  " ON S.SEQ_ID = R.SEQ_ID WHERE RUN_IOV_ID = :1 AND "
267  " COLOR_ID = :2",
268  "fetchByRunIOVAndColor");
269 }
int getID() const
Definition: LMFUnique.h:58
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:245
int getID()
Definition: RunIOV.h:35
LMFSeqDat LMFSeqDat::fetchByRunIOV ( RunIOV iov,
int  seq_num 
)
inline

Definition at line 65 of file LMFSeqDat.h.

References fetchByRunIOV().

Referenced by fetchByRunIOV().

65 { return fetchByRunIOV(iov)[seq_num]; }
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:245
std::map< int, LMFSeqDat > LMFSeqDat::fetchByRunIOV ( const std::vector< std::string > &  par,
std::string  sql,
std::string  method 
)
privatenoexcept

Definition at line 198 of file LMFSeqDat.cc.

References alignCSCRings::e, getSequenceNumber(), mps_fire::i, cmsLHEtoEOSManager::l, alignCSCRings::s, LMFUnique::setByID(), and IDBObject::setConnection().

200  {
201  std::map<int, LMFSeqDat> l;
202  this->checkConnection();
203  try {
204  Statement *stmt = m_conn->createStatement();
205  stmt->setSQL(sql);
206  for (unsigned int i = 0; i < pars.size(); i++) {
207  if (pars[i][0] == 'I') {
208  stmt->setInt(i + 1, atoi(pars[i].c_str() + 1));
209  } else if (pars[i][0] == 'S') {
210  stmt->setString(i + 1, pars[i].c_str() + 1);
211  } else {
212  throw(std::runtime_error(m_className + "::" + method + ": " + "Invalid type"));
213  }
214  }
215  ResultSet *rset = stmt->executeQuery();
216  while (rset->next() != 0) {
217  int seq_id = rset->getInt(1);
218  LMFSeqDat s;
220  s.setByID(seq_id);
221  l[s.getSequenceNumber()] = s;
222  }
223  m_conn->terminateStatement(stmt);
224  } catch (SQLException &e) {
225  throw(std::runtime_error(m_className + "::" + method + ": " + e.getMessage()));
226  }
227  return l;
228 }
std::string m_className
Definition: LMFUnique.h:99
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
int getSequenceNumber() const
Definition: LMFSeqDat.h:44
oracle::occi::ResultSet ResultSet
Definition: LMFUnique.h:23
void setByID(int id) noexcept(false) override
Definition: LMFUnique.cc:267
oracle::occi::Statement Statement
Definition: LMFUnique.h:24
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
std::map< int, LMFSeqDat > LMFSeqDat::fetchByRunIOV ( int  par,
std::string  sql,
std::string  method 
)
privatenoexcept

Definition at line 190 of file LMFSeqDat.cc.

References contentValuesCheck::ss.

190  {
191  std::vector<std::string> pars;
192  std::stringstream ss;
193  ss << "I" << par;
194  pars.push_back(ss.str());
195  return fetchByRunIOV(pars, sql, method);
196 }
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:245
std::map< int, LMFSeqDat > LMFSeqDat::fetchByRunIOV ( std::string  sql,
std::string  method 
)
privatenoexcept

Definition at line 185 of file LMFSeqDat.cc.

185  {
186  std::vector<std::string> pars;
187  return fetchByRunIOV(pars, sql, method);
188 }
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:245
std::map< int, LMFSeqDat > LMFSeqDat::fetchByRunNumber ( int  runno)

Definition at line 271 of file LMFSeqDat.cc.

References fetchByRunIOV().

Referenced by fetchByRunNumber().

271  {
272  return fetchByRunIOV(runno,
273  "SELECT SEQ_ID FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT D "
274  "JOIN CMS_ECAL_COND.RUN_IOV R ON "
275  "D.RUN_IOV_ID = R.IOV_ID WHERE RUN_NUM = :1",
276  "fetchByRunNumber");
277 }
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:245
LMFSeqDat LMFSeqDat::fetchByRunNumber ( int  runno,
int  seq_num 
)
inline

Definition at line 67 of file LMFSeqDat.h.

References fetchByRunNumber().

Referenced by fetchByRunNumber().

67 { return fetchByRunNumber(runno)[seq_num]; }
std::map< int, LMFSeqDat > fetchByRunNumber(int runno)
Definition: LMFSeqDat.cc:271
LMFSeqDat LMFSeqDat::fetchByRunNumber ( int  runno,
const Tm taken_at 
)

Definition at line 279 of file LMFSeqDat.cc.

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

279 { return fetchByRunNumber(runno, taken_at.str()); }
std::map< int, LMFSeqDat > fetchByRunNumber(int runno)
Definition: LMFSeqDat.cc:271
std::string str() const
Definition: Tm.cc:66
LMFSeqDat LMFSeqDat::fetchByRunNumber ( int  runno,
std::string  taken_at 
)

Definition at line 281 of file LMFSeqDat.cc.

References gather_cfg::cout, fetchByRunIOV(), mps_fire::i, cmsLHEtoEOSManager::l, submitPVResolutionJobs::q, runTheMatrix::ret, visualization-live-secondInstance_cfg::runno, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and x.

281  {
282  std::map<int, LMFSeqDat> l;
283  std::vector<std::string> pars;
284  std::stringstream ss;
285  ss << "I" << runno;
286  pars.push_back(ss.str());
287  ss.str(std::string());
288  ss << "S" << taken_at;
289  pars.push_back(ss.str());
290  std::string q =
291  "SELECT SEQ_ID FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT D "
292  "JOIN CMS_ECAL_COND.RUN_IOV R ON "
293  "D.RUN_IOV_ID = R.IOV_ID WHERE RUN_NUM = :1 AND "
294  "SEQ_START >= TO_DATE(:2, 'YYYY-MM-DD HH24:MI:SS') "
295  "AND SEQ_STOP <= TO_DATE(:2, 'YYYY-MM-DD HH24:MI:SS')";
296  l = fetchByRunIOV(pars, q, "fetchByRunNumberAt");
297  LMFSeqDat ret;
298  if (l.size() == 1) {
299  std::map<int, LMFSeqDat>::const_iterator x = l.begin();
300  ret = x->second;
301  } else if (l.size() > 1) {
302  std::cout << "WARNING: Your query returned more than one result. " << std::endl;
303  std::cout << " This was not expected. Please check the DB!!!" << std::endl;
304  std::cout << "Your query: " << std::endl << q << std::endl;
305  std::cout << "Your parameters: " << std::endl;
306  for (unsigned int i = 0; i < pars.size(); i++) {
307  std::cout << i << ": " << pars[i] << std::endl;
308  }
309  }
310  return ret;
311 }
tuple ret
prodAgent to be discontinued
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:245
tuple cout
Definition: gather_cfg.py:144
std::string LMFSeqDat::fetchIdSql ( Statement stmt)
overrideprivatevirtual

Reimplemented from LMFUnique.

Definition at line 67 of file LMFSeqDat.cc.

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

67  {
68  int runIOVID = m_runIOV.getID();
69  if (!runIOVID) {
70  if (m_debug) {
71  std::cout << m_className << ": RunIOV not set" << endl;
72  }
73  return "";
74  }
75 
76  if (m_debug) {
77  std::cout << "Run IOV ID: " << runIOVID << std::endl;
78  std::cout << "SEQ # : " << getSequenceNumber() << std::endl;
79  std::cout << "Versions : " << getVmin() << " - " << getVmax() << endl;
80  }
81  std::string sql =
82  "SELECT SEQ_ID FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT "
83  "WHERE "
84  "RUN_IOV_ID = :1 AND "
85  "SEQ_NUM = :2 AND "
86  "VMIN = :3 ";
87  if (getVmax() > 0) {
88  sql += "AND VMAX = :4";
89  } else {
90  sql += "ORDER BY VMAX DESC";
91  }
92  stmt->setSQL(sql);
93  stmt->setInt(1, runIOVID);
94  stmt->setInt(2, getSequenceNumber());
95  stmt->setInt(3, getVmin());
96  if (getVmax() > 0) {
97  stmt->setInt(4, getVmax());
98  }
99  return sql;
100 }
std::string m_className
Definition: LMFUnique.h:99
int getVmax() const
Definition: LMFSeqDat.h:52
int getSequenceNumber() const
Definition: LMFSeqDat.h:44
RunIOV m_runIOV
Definition: LMFSeqDat.h:74
int getID()
Definition: RunIOV.h:35
tuple cout
Definition: gather_cfg.py:144
char m_debug
Definition: LMFUnique.h:100
int getVmin() const
Definition: LMFSeqDat.h:51
LMFSeqDat LMFSeqDat::fetchLast ( )

Definition at line 230 of file LMFSeqDat.cc.

References fetchByRunIOV(), visualization-live-secondInstance_cfg::m, and runTheMatrix::ret.

Referenced by fetchLastRun().

230  {
231  LMFSeqDat ret;
232  std::map<int, LMFSeqDat> m = fetchByRunIOV(
233  "SELECT SEQ_ID FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT "
234  "WHERE SEQ_ID = "
235  "(SELECT MAX(SEQ_ID) FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT)",
236  "fetchLast");
237  if (!m.empty()) {
238  ret = m.begin()->second;
239  }
240  return ret;
241 }
tuple ret
prodAgent to be discontinued
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:245
RunIOV LMFSeqDat::fetchLastRun ( )

Definition at line 243 of file LMFSeqDat.cc.

References fetchLast(), and getRunIOV().

Referenced by EcalCondDBInterface::fetchLMFLastRun().

243 { return fetchLast().getRunIOV(); }
LMFSeqDat fetchLast()
Definition: LMFSeqDat.cc:230
RunIOV getRunIOV() const
Definition: LMFSeqDat.cc:57
void LMFSeqDat::fetchParentIDs ( )
overrideprivatevirtualnoexcept

Reimplemented from LMFUnique.

Definition at line 174 of file LMFSeqDat.cc.

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

174  {
175  // get the RunIOV
177  int runIOVID = m_runIOV.getID();
178  m_runIOV.setByID(runIOVID);
179 
180  if (m_runIOV.getID() == 0) {
181  throw(std::runtime_error("LMFSeqDat: Given RunIOV does not exist in DB"));
182  }
183 }
void setByID(int id) noexcept(false) override
Definition: RunIOV.cc:106
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
RunIOV m_runIOV
Definition: LMFSeqDat.h:74
int getID()
Definition: RunIOV.h:35
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void LMFSeqDat::getParameters ( ResultSet rset)
overrideprivatevirtual

Reimplemented from LMFUnique.

Definition at line 111 of file LMFSeqDat.cc.

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

111  {
113  int runIOVID = rset->getInt(1);
114  setInt("seq_num", rset->getInt(2));
115  Date startDate = rset->getDate(3);
116  Date endDate = rset->getDate(4);
117  setInt("vmin", rset->getInt(5));
118  setInt("vmax", rset->getInt(6));
119 
120  setString("seq_start", dh.dateToTm(startDate).str());
121  setString("seq_stop", dh.dateToTm(endDate).str());
122 
124  m_runIOV.setByID(runIOVID);
125 }
void setByID(int id) noexcept(false) override
Definition: RunIOV.cc:106
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:31
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
RunIOV m_runIOV
Definition: LMFSeqDat.h:74
LMFUnique & setString(std::string key, std::string value)
Definition: LMFUnique.cc:14
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
tuple dh
Definition: cuy.py:354
RunIOV LMFSeqDat::getRunIOV ( ) const

Definition at line 57 of file LMFSeqDat.cc.

References m_runIOV.

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

57 { return m_runIOV; }
RunIOV m_runIOV
Definition: LMFSeqDat.h:74
int LMFSeqDat::getSequenceNumber ( ) const
inline

Definition at line 44 of file LMFSeqDat.h.

References LMFUnique::getInt().

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

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

Definition at line 45 of file LMFSeqDat.h.

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

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

45  {
46  Tm t;
47  t.setToString(getString("seq_start"));
48  return t;
49  }
void setToString(const std::string s) noexcept(false)
Definition: Tm.cc:150
std::string getString(std::string fieldname) const
Definition: LMFUnique.cc:178
Definition: Tm.h:13
Tm LMFSeqDat::getSequenceStop ( ) const

Definition at line 51 of file LMFSeqDat.cc.

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

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

51  {
52  Tm t;
53  t.setToString(getString("seq_stop"));
54  return t;
55 }
void setToString(const std::string s) noexcept(false)
Definition: Tm.cc:150
std::string getString(std::string fieldname) const
Definition: LMFUnique.cc:178
Definition: Tm.h:13
int LMFSeqDat::getVmax ( ) const
inline

Definition at line 52 of file LMFSeqDat.h.

References LMFUnique::getInt().

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

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

Definition at line 51 of file LMFSeqDat.h.

References LMFUnique::getInt().

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

51 { return getInt("vmin"); }
int getInt(std::string fieldname) const
Definition: LMFUnique.cc:187
bool LMFSeqDat::isValid ( void  ) const
overridevirtual

Reimplemented from LMFUnique.

Definition at line 127 of file LMFSeqDat.cc.

References getSequenceStart(), getSequenceStop(), runTheMatrix::ret, and str.

Referenced by ntupleDataFormat._Object::_checkIsValid(), core.AutoHandle.AutoHandle::ReallyLoad(), and writeDBSql().

127  {
128  bool ret = true;
129  if (getSequenceStart().isNull()) {
130  ret = false;
131  }
132  if ((getSequenceStop().str().length() > 0) && (getSequenceStop().microsTime() < getSequenceStart().microsTime())) {
133  ret = false;
134  }
135  if (getSequenceStop() == Tm().plusInfinity()) {
136  ret = false;
137  }
138  return ret;
139 }
tuple ret
prodAgent to be discontinued
Tm getSequenceStop() const
Definition: LMFSeqDat.cc:51
Tm getSequenceStart() const
Definition: LMFSeqDat.h:45
#define str(s)
Definition: Tm.h:13
bool LMFSeqDat::operator!= ( const LMFSeqDat m) const
inline

Definition at line 62 of file LMFSeqDat.h.

References visualization-live-secondInstance_cfg::m.

bool LMFSeqDat::operator== ( const LMFSeqDat m) const
inline

Definition at line 56 of file LMFSeqDat.h.

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

56  {
57  return (getSequenceNumber() == m.getSequenceNumber() && getRunIOV() == m.getRunIOV() &&
59  getVmin() == m.getVmin() && getVmax() == m.getVmax());
60  }
Tm getSequenceStop() const
Definition: LMFSeqDat.cc:51
int getVmax() const
Definition: LMFSeqDat.h:52
int getSequenceNumber() const
Definition: LMFSeqDat.h:44
Tm getSequenceStart() const
Definition: LMFSeqDat.h:45
RunIOV getRunIOV() const
Definition: LMFSeqDat.cc:57
int getVmin() const
Definition: LMFSeqDat.h:51
std::string LMFSeqDat::setByIDSql ( Statement stmt,
int  id 
)
overrideprivatevirtual

Reimplemented from LMFUnique.

Definition at line 102 of file LMFSeqDat.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

102  {
103  std::string sql =
104  "SELECT RUN_IOV_ID, SEQ_NUM, SEQ_START, SEQ_STOP, "
105  "VMIN, VMAX FROM CMS_ECAL_LASER_COND.LMF_SEQ_DAT WHERE SEQ_ID = :1";
106  stmt->setSQL(sql);
107  stmt->setInt(1, id);
108  return sql;
109 }
LMFSeqDat & LMFSeqDat::setRunIOV ( const RunIOV iov)

Definition at line 59 of file LMFSeqDat.cc.

References IUniqueDBObject::m_ID, and m_runIOV.

59  {
60  if (iov != m_runIOV) {
61  m_ID = 0;
62  m_runIOV = iov;
63  }
64  return *this;
65 }
RunIOV m_runIOV
Definition: LMFSeqDat.h:74
LMFSeqDat& LMFSeqDat::setSequenceNumber ( int  n)
inline

Definition at line 25 of file LMFSeqDat.h.

References LMFUnique::setInt().

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

Definition at line 29 of file LMFSeqDat.h.

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

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

Definition at line 33 of file LMFSeqDat.h.

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

Referenced by writeDBSql().

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

Definition at line 37 of file LMFSeqDat.h.

References setVmax(), and setVmin().

37  {
38  setVmin(vmin);
39  setVmax(vmax);
40  return *this;
41  }
void setVmax(int v)
Definition: LMFSeqDat.h:77
void setVmin(int v)
Definition: LMFSeqDat.h:76
void LMFSeqDat::setVmax ( int  v)
inlineprivate

Definition at line 77 of file LMFSeqDat.h.

References LMFUnique::setInt().

Referenced by setVersions().

77 { setInt("vmax", v); }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:31
void LMFSeqDat::setVmin ( int  v)
inlineprivate

Definition at line 76 of file LMFSeqDat.h.

References LMFUnique::setInt().

Referenced by setVersions().

76 { setInt("vmin", v); }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:31
std::string LMFSeqDat::writeDBSql ( Statement stmt)
overrideprivatevirtual

Reimplemented from LMFUnique.

Definition at line 141 of file LMFSeqDat.cc.

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

141  {
142  // Validate the data, use infinity-till convention
144 
145  if (!isValid()) {
146  dump();
147  throw(std::runtime_error("LMFSeqDat::writeDB: not valid"));
148  }
149 
150  if (getSequenceStop().str().length() == 0) {
151  setSequenceStop(dh.getPlusInfTm());
152  }
153  int runIOVID = m_runIOV.getID();
154  if (runIOVID == 0) {
155  throw(std::runtime_error("LMFSeqDat::writeDB: RunIOV not set"));
156  }
158  std::string sql =
159  "INSERT INTO LMF_SEQ_DAT (SEQ_ID, RUN_IOV_ID, SEQ_NUM, "
160  "SEQ_START, SEQ_STOP, VMIN, VMAX) "
161  "VALUES (SEQ_ID_" +
162  sp + "_SQ.NextVal, :1, :2, :3, :4, :5, :6)";
163  cout << sql << endl;
164  stmt->setSQL(sql);
165  stmt->setInt(1, runIOVID);
166  stmt->setInt(2, getSequenceNumber());
167  stmt->setDate(3, dh.tmToDate(getSequenceStart()));
168  stmt->setDate(4, dh.tmToDate(getSequenceStop()));
169  stmt->setInt(5, getVmin());
170  stmt->setInt(6, getVmax());
171  return sql;
172 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
Tm getSequenceStop() const
Definition: LMFSeqDat.cc:51
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
LMFSeqDat & setSequenceStop(const Tm &end)
Definition: LMFSeqDat.h:33
int getVmax() const
Definition: LMFSeqDat.h:52
int getSequenceNumber() const
Definition: LMFSeqDat.h:44
std::string sequencePostfix(const Tm &t)
Definition: LMFUnique.cc:9
virtual void dump() const
Definition: LMFUnique.cc:104
bool isValid() const override
Definition: LMFSeqDat.cc:127
RunIOV m_runIOV
Definition: LMFSeqDat.h:74
Tm getSequenceStart() const
Definition: LMFSeqDat.h:45
int getID()
Definition: RunIOV.h:35
tuple cout
Definition: gather_cfg.py:144
#define str(s)
int getVmin() const
Definition: LMFSeqDat.h:51
tuple dh
Definition: cuy.py:354

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