CMS 3D CMS Logo

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() [1/3]

LMFSeqDat::LMFSeqDat ( )

Definition at line 10 of file LMFSeqDat.cc.

References LMFUnique::m_intFields, m_runIOV, LMFUnique::m_stringFields, LMFUnique::setClassName(), 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
Definition: RunIOV.h:13
Definition: Tm.h:13
std::map< std::string, int > m_intFields
Definition: LMFUnique.h:104

◆ LMFSeqDat() [2/3]

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, LMFUnique::setClassName(), 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
conn
Definition: getInfo.py:9
Definition: RunIOV.h:13
Definition: Tm.h:13
std::map< std::string, int > m_intFields
Definition: LMFUnique.h:104

◆ LMFSeqDat() [3/3]

LMFSeqDat::LMFSeqDat ( EcalDBConnection c)

Definition at line 23 of file LMFSeqDat.cc.

References LMFUnique::m_intFields, m_runIOV, LMFUnique::m_stringFields, LMFUnique::setClassName(), 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
Definition: RunIOV.h:13
Definition: Tm.h:13
std::map< std::string, int > m_intFields
Definition: LMFUnique.h:104

◆ ~LMFSeqDat()

LMFSeqDat::~LMFSeqDat ( )
override

Definition at line 49 of file LMFSeqDat.cc.

49 {}

Member Function Documentation

◆ fetchByRunIOV() [1/6]

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

◆ fetchByRunIOV() [2/6]

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

Definition at line 253 of file LMFSeqDat.cc.

References cuy::col, fetchByRunIOV(), RunIOV::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 }
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:245
col
Definition: cuy.py:1009
int getID()
Definition: RunIOV.h:35

◆ fetchByRunIOV() [3/6]

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

◆ fetchByRunIOV() [4/6]

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 MillePedeFileConverter_cfg::e, mps_fire::i, MainPageGenerator::l, AlcaSiPixelAliHarvester0T_cff::method, and alignCSCRings::s.

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;
219  s.setConnection(m_env, m_conn);
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
oracle::occi::ResultSet ResultSet
Definition: LMFUnique.h:23
oracle::occi::Statement Statement
Definition: LMFUnique.h:24

◆ fetchByRunIOV() [5/6]

std::map< int, LMFSeqDat > LMFSeqDat::fetchByRunIOV ( int  par,
std::string  sql,
std::string  method 
)
privatenoexcept

Definition at line 190 of file LMFSeqDat.cc.

References AlcaSiPixelAliHarvester0T_cff::method, and 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

◆ fetchByRunIOV() [6/6]

std::map< int, LMFSeqDat > LMFSeqDat::fetchByRunIOV ( std::string  sql,
std::string  method 
)
privatenoexcept

Definition at line 185 of file LMFSeqDat.cc.

References AlcaSiPixelAliHarvester0T_cff::method.

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

◆ fetchByRunNumber() [1/4]

std::map< int, LMFSeqDat > LMFSeqDat::fetchByRunNumber ( int  runno)

Definition at line 271 of file LMFSeqDat.cc.

References fetchByRunIOV(), and visualization-live-secondInstance_cfg::runno.

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

◆ fetchByRunNumber() [2/4]

LMFSeqDat LMFSeqDat::fetchByRunNumber ( int  runno,
int  seq_num 
)
inline

Definition at line 67 of file LMFSeqDat.h.

References fetchByRunNumber(), and visualization-live-secondInstance_cfg::runno.

Referenced by fetchByRunNumber().

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

◆ fetchByRunNumber() [3/4]

LMFSeqDat LMFSeqDat::fetchByRunNumber ( int  runno,
const Tm taken_at 
)

Definition at line 279 of file LMFSeqDat.cc.

References fetchByRunNumber(), visualization-live-secondInstance_cfg::runno, 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:64

◆ fetchByRunNumber() [4/4]

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, MainPageGenerator::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 }
ret
prodAgent to be discontinued
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:245

◆ fetchIdSql()

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 getVmin() const
Definition: LMFSeqDat.h:51
int getSequenceNumber() const
Definition: LMFSeqDat.h:44
RunIOV m_runIOV
Definition: LMFSeqDat.h:74
int getVmax() const
Definition: LMFSeqDat.h:52
int getID()
Definition: RunIOV.h:35
char m_debug
Definition: LMFUnique.h:100

◆ fetchLast()

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 }
ret
prodAgent to be discontinued
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:245

◆ fetchLastRun()

RunIOV LMFSeqDat::fetchLastRun ( )

Definition at line 243 of file LMFSeqDat.cc.

References fetchLast(), and getRunIOV().

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

◆ fetchParentIDs()

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

◆ getParameters()

void LMFSeqDat::getParameters ( ResultSet rset)
overrideprivatevirtual

Reimplemented from LMFUnique.

Definition at line 111 of file LMFSeqDat.cc.

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

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
dh
Definition: cuy.py:354

◆ getRunIOV()

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

◆ getSequenceNumber()

int LMFSeqDat::getSequenceNumber ( ) const
inline

Definition at line 44 of file LMFSeqDat.h.

References LMFUnique::getInt().

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

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

◆ getSequenceStart()

Tm LMFSeqDat::getSequenceStart ( ) const
inline

Definition at line 45 of file LMFSeqDat.h.

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

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

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

◆ getSequenceStop()

Tm LMFSeqDat::getSequenceStop ( ) const

Definition at line 51 of file LMFSeqDat.cc.

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

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

51  {
52  Tm t;
53  t.setToString(getString("seq_stop"));
54  return t;
55 }
std::string getString(std::string fieldname) const
Definition: LMFUnique.cc:178
Definition: Tm.h:13

◆ getVmax()

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

◆ getVmin()

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

◆ isValid()

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 }
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

◆ operator!=()

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

◆ operator==()

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

Definition at line 56 of file LMFSeqDat.h.

References getRunIOV(), getSequenceNumber(), getSequenceStart(), getSequenceStop(), getVmax(), getVmin(), and visualization-live-secondInstance_cfg::m.

56  {
57  return (getSequenceNumber() == m.getSequenceNumber() && getRunIOV() == m.getRunIOV() &&
58  getSequenceStart() == m.getSequenceStart() && getSequenceStop() == m.getSequenceStop() &&
59  getVmin() == m.getVmin() && getVmax() == m.getVmax());
60  }
int getVmin() const
Definition: LMFSeqDat.h:51
int getSequenceNumber() const
Definition: LMFSeqDat.h:44
Tm getSequenceStop() const
Definition: LMFSeqDat.cc:51
RunIOV getRunIOV() const
Definition: LMFSeqDat.cc:57
Tm getSequenceStart() const
Definition: LMFSeqDat.h:45
int getVmax() const
Definition: LMFSeqDat.h:52

◆ setByIDSql()

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 }

◆ setRunIOV()

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

◆ setSequenceNumber()

LMFSeqDat& LMFSeqDat::setSequenceNumber ( int  n)
inline

Definition at line 25 of file LMFSeqDat.h.

References dqmiodumpmetadata::n, and LMFUnique::setInt().

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

◆ setSequenceStart()

LMFSeqDat& LMFSeqDat::setSequenceStart ( const Tm start)
inline

Definition at line 29 of file LMFSeqDat.h.

References LMFUnique::setString().

29  {
30  setString("seq_start", start.str());
31  return *this;
32  }
Definition: start.py:1
LMFUnique & setString(std::string key, std::string value)
Definition: LMFUnique.cc:14

◆ setSequenceStop()

LMFSeqDat& LMFSeqDat::setSequenceStop ( const Tm end)
inline

Definition at line 33 of file LMFSeqDat.h.

References mps_fire::end, and LMFUnique::setString().

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

◆ setVersions()

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

◆ setVmax()

void LMFSeqDat::setVmax ( int  v)
inlineprivate

Definition at line 77 of file LMFSeqDat.h.

References LMFUnique::setInt(), and findQualityFiles::v.

Referenced by setVersions().

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

◆ setVmin()

void LMFSeqDat::setVmin ( int  v)
inlineprivate

Definition at line 76 of file LMFSeqDat.h.

References LMFUnique::setInt(), and findQualityFiles::v.

Referenced by setVersions().

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

◆ writeDBSql()

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(), getSequenceNumber(), getSequenceStart(), getSequenceStop(), getVmax(), getVmin(), isValid(), IDBObject::m_conn, IDBObject::m_env, m_runIOV, LMFUnique::sequencePostfix(), setSequenceStop(), str, and AlCaHLTBitMon_QueryRunRegistry::string.

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 }
int getVmin() const
Definition: LMFSeqDat.h:51
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
LMFSeqDat & setSequenceStop(const Tm &end)
Definition: LMFSeqDat.h:33
int getSequenceNumber() const
Definition: LMFSeqDat.h:44
std::string sequencePostfix(const Tm &t)
Definition: LMFUnique.cc:9
bool isValid() const override
Definition: LMFSeqDat.cc:127
RunIOV m_runIOV
Definition: LMFSeqDat.h:74
virtual void dump() const
Definition: LMFUnique.cc:104
Tm getSequenceStop() const
Definition: LMFSeqDat.cc:51
Tm getSequenceStart() const
Definition: LMFSeqDat.h:45
int getVmax() const
Definition: LMFSeqDat.h:52
int getID()
Definition: RunIOV.h:35
dh
Definition: cuy.py:354
#define str(s)

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 16 of file LMFSeqDat.h.

Member Data Documentation

◆ m_runIOV

RunIOV LMFSeqDat::m_runIOV
private