CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
LMFRunIOV Class Reference

#include <LMFRunIOV.h>

Inheritance diagram for LMFRunIOV:
LMFUnique IUniqueDBObject IDBObject

Public Member Functions

void dump () const override
 
std::list< LMFRunIOVfetchBySequence (const LMFSeqDat &s)
 
std::list< LMFRunIOVfetchBySequence (const LMFSeqDat &s, int lmr)
 
std::list< LMFRunIOVfetchBySequence (const LMFSeqDat &s, int lmr, int type, int color)
 
std::string fetchIdSql (Statement *stmt) override
 
std::list< LMFRunIOVfetchLastBeforeSequence (const LMFSeqDat &s, int lmr, int type, int color)
 
LMFColor getColor () const
 
std::string getColorLongName () const
 
std::string getColorShortName () const
 
Tm getDBInsertionTime () const
 
LMFColor getLMFColor () const
 
LMFRunTag getLMFRunTag () const
 
int getLmr () const
 
void getParameters (ResultSet *rset) override
 
LMFSeqDat getSequence () const
 
Tm getSubRunEnd () const
 
Tm getSubRunStart () const
 
std::string getSubRunType () const
 
LMFTrigType getTriggerType () const
 
bool isValid () override
 
 LMFRunIOV ()
 
 LMFRunIOV (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
 LMFRunIOV (EcalDBConnection *c)
 
 LMFRunIOV (const LMFRunIOV &r)
 
bool operator!= (const LMFRunIOV &m) const
 
virtual LMFRunIOVoperator= (const LMFRunIOV &r)
 
bool operator== (const LMFRunIOV &m) const
 
std::string setByIDSql (Statement *stmt, int id) override
 
LMFRunIOVsetColor (const LMFColor &c)
 
LMFRunIOVsetColor (std::string name)
 
LMFRunIOVsetColor (int color_id)
 
LMFRunIOVsetColorIndex (int color_index)
 
LMFRunIOVsetLMFRunTag (const LMFRunTag &tag)
 
LMFRunIOVsetLMFRunTag (int tag_id)
 
LMFRunIOVsetLmr (int n)
 
LMFRunIOVsetSequence (LMFSeqDat &seq)
 
LMFRunIOVsetSequence (LMFSeqDat *seq)
 
LMFRunIOVsetSubRunEnd (const Tm &end)
 
LMFRunIOVsetSubRunStart (const Tm &start)
 
LMFRunIOVsetSubRunType (const std::string &x)
 
LMFRunIOVsetTriggerType (LMFTrigType &tt)
 
LMFRunIOVsetTriggerType (int trigType_id)
 
LMFRunIOVsetTriggerType (std::string trigShortName)
 
std::string writeDBSql (Statement *stmt) override
 
 ~LMFRunIOV () override
 
- Public Member Functions inherited from LMFUnique
void attach (std::string name, LMFUnique *u)
 
void debug ()
 
virtual void dump (int n) const
 
virtual bool exists ()
 
virtual boost::ptr_list< LMFUniquefetchAll () 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 () const
 
 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

void checkFabric ()
 
std::list< LMFRunIOVfetchBySequence (const std::vector< int > &par, const std::string &sql, const std::string &method) noexcept(false)
 
void initialize ()
 

Private Attributes

LMFDefFabric_fabric
 

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 19 of file LMFRunIOV.h.

Constructor & Destructor Documentation

LMFRunIOV::LMFRunIOV ( )

Definition at line 28 of file LMFRunIOV.cc.

References initialize().

28  : LMFUnique()
29 {
30  initialize();
31 }
LMFUnique()
Definition: LMFUnique.h:23
void initialize()
Definition: LMFRunIOV.cc:10
LMFRunIOV::LMFRunIOV ( oracle::occi::Environment *  env,
oracle::occi::Connection *  conn 
)

Definition at line 33 of file LMFRunIOV.cc.

References initialize().

34  : LMFUnique(env, conn)
35 {
36  initialize();
37 }
LMFUnique()
Definition: LMFUnique.h:23
void initialize()
Definition: LMFRunIOV.cc:10
LMFRunIOV::LMFRunIOV ( EcalDBConnection c)

Definition at line 39 of file LMFRunIOV.cc.

References initialize().

39  : LMFUnique(c)
40 {
41  initialize();
42 }
LMFUnique()
Definition: LMFUnique.h:23
void initialize()
Definition: LMFRunIOV.cc:10
LMFRunIOV::LMFRunIOV ( const LMFRunIOV r)

Definition at line 44 of file LMFRunIOV.cc.

References initialize(), and alignCSCRings::r.

44  {
45  initialize();
46  *this = r;
47 }
void initialize()
Definition: LMFRunIOV.cc:10
LMFRunIOV::~LMFRunIOV ( )
override

Definition at line 49 of file LMFRunIOV.cc.

References _fabric.

50 {
51  if (_fabric != nullptr) {
52  delete _fabric;
53  }
54 }
LMFDefFabric * _fabric
Definition: LMFRunIOV.h:99

Member Function Documentation

void LMFRunIOV::checkFabric ( )
private

Definition at line 87 of file LMFRunIOV.cc.

References _fabric, IDBObject::m_conn, and IDBObject::m_env.

Referenced by operator!=(), operator=(), setColor(), setColorIndex(), and setTriggerType().

87  {
88  if (_fabric == nullptr) {
90  }
91 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
LMFDefFabric * _fabric
Definition: LMFRunIOV.h:99
void LMFRunIOV::dump ( void  ) const
overridevirtual

Reimplemented from LMFUnique.

Definition at line 212 of file LMFRunIOV.cc.

References _fabric, gather_cfg::cout, LMFDefFabric::dump(), LMFUnique::dump(), and LMFUnique::m_debug.

Referenced by getColor().

212  {
213  LMFUnique::dump();
214  std::cout << "# Fabric Address: " << _fabric << std::endl;
215  if (m_debug) {
216  _fabric->dump();
217  }
218 }
virtual void dump() const
Definition: LMFUnique.cc:112
LMFDefFabric * _fabric
Definition: LMFRunIOV.h:99
char m_debug
Definition: LMFUnique.h:99
std::list< LMFRunIOV > LMFRunIOV::fetchBySequence ( const LMFSeqDat s)

Definition at line 377 of file LMFRunIOV.cc.

References LMFUnique::getID().

Referenced by fetchBySequence(), fetchLastBeforeSequence(), EcalCondDBInterface::fetchLMFRunIOV(), getColor(), and operator!=().

377  {
378  int seq_id = s.getID();
379  vector<int> parameters;
380  parameters.push_back(seq_id);
381  return fetchBySequence(parameters, "SELECT LMF_IOV_ID FROM "
382  "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
383  "WHERE SEQ_ID = :1", "fetchBySequence");
384 }
int getID() const
Definition: LMFUnique.h:52
std::list< LMFRunIOV > fetchBySequence(const LMFSeqDat &s)
Definition: LMFRunIOV.cc:377
std::list< LMFRunIOV > LMFRunIOV::fetchBySequence ( const LMFSeqDat s,
int  lmr 
)

Definition at line 386 of file LMFRunIOV.cc.

References fetchBySequence(), and LMFUnique::getID().

386  {
387  int seq_id = s.getID();
388  vector<int> parameters;
389  parameters.push_back(seq_id);
390  parameters.push_back(lmr);
391  return fetchBySequence(parameters, "SELECT LMF_IOV_ID FROM "
392  "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
393  "WHERE SEQ_ID = :1 AND LMR = :2",
394  "fetchBySequence");
395 }
int getID() const
Definition: LMFUnique.h:52
std::list< LMFRunIOV > fetchBySequence(const LMFSeqDat &s)
Definition: LMFRunIOV.cc:377
std::list< LMFRunIOV > LMFRunIOV::fetchBySequence ( const LMFSeqDat s,
int  lmr,
int  type,
int  color 
)

Definition at line 397 of file LMFRunIOV.cc.

References fetchBySequence(), and LMFUnique::getID().

398  {
399  int seq_id = s.getID();
400  vector<int> parameters;
401  parameters.push_back(seq_id);
402  parameters.push_back(lmr);
403  parameters.push_back(color);
404  parameters.push_back(type);
405  return fetchBySequence(parameters, "SELECT LMF_IOV_ID FROM "
406  "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
407  "WHERE SEQ_ID = :1 AND LMR = :2 AND COLOR_ID = :3 "
408  "AND TRIG_TYPE = :4",
409  "fetchBySequence");
410 }
type
Definition: HCALResponse.h:21
int getID() const
Definition: LMFUnique.h:52
std::list< LMFRunIOV > fetchBySequence(const LMFSeqDat &s)
Definition: LMFRunIOV.cc:377
std::list< LMFRunIOV > LMFRunIOV::fetchBySequence ( const std::vector< int > &  par,
const std::string &  sql,
const std::string &  method 
)
privatenoexcept

Definition at line 348 of file LMFRunIOV.cc.

References IDBObject::checkConnection(), MillePedeFileConverter_cfg::e, mps_fire::i, checklumidiff::l, LMFUnique::m_className, IDBObject::m_conn, IDBObject::m_env, AlcaSiPixelAliHarvester0T_cff::method, LMFUnique::setByID(), and IDBObject::setConnection().

352 {
353  std::list<LMFRunIOV> l;
354  this->checkConnection();
355  try {
356  Statement *stmt = m_conn->createStatement();
357  stmt->setSQL(sql);
358  for (unsigned int i = 0; i < par.size(); i++) {
359  stmt->setInt(i + 1, par[i]);
360  }
361  ResultSet *rset = stmt->executeQuery();
362  while (rset->next() != 0) {
363  int lmf_iov_id = rset->getInt(1);
364  LMFRunIOV iov;
365  iov.setConnection(m_env, m_conn);
366  iov.setByID(lmf_iov_id);
367  l.push_back(iov);
368  }
369  m_conn->terminateStatement(stmt);
370  } catch (SQLException &e) {
371  throw(std::runtime_error(m_className + "::" + method + ": " +
372  e.getMessage()));
373  }
374  return l;
375 }
std::string m_className
Definition: LMFUnique.h:98
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::ResultSet ResultSet
Definition: LMFUnique.h:19
void setByID(int id) noexcept(false) override
Definition: LMFUnique.cc:286
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
oracle::occi::Statement Statement
Definition: LMFUnique.h:20
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
std::string LMFRunIOV::fetchIdSql ( Statement stmt)
overridevirtual

Reimplemented from LMFUnique.

Definition at line 220 of file LMFRunIOV.cc.

References LMFUnique::m_intFields, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by operator!=().

221 {
222  std::string sql = "";
223 
224  sql = "SELECT LMF_IOV_ID FROM CMS_ECAL_LASER_COND.LMF_RUN_IOV WHERE "
225  "SEQ_ID = :1 "
226  "AND LMR = :2 ";
227  if (m_intFields["tag_id"] > 0) {
228  sql += "AND TAG_ID = :3";
229  }
230  stmt->setSQL(sql);
231  stmt->setInt(1, m_intFields["seq_id"]);
232  stmt->setInt(2, m_intFields["lmr"]);
233  if (m_intFields["tag_id"] > 0) {
234  stmt->setInt(3, m_intFields["tag_id"]);
235  }
236  return sql;
237 }
std::map< std::string, int > m_intFields
Definition: LMFUnique.h:103
std::list< LMFRunIOV > LMFRunIOV::fetchLastBeforeSequence ( const LMFSeqDat s,
int  lmr,
int  type,
int  color 
)

Definition at line 412 of file LMFRunIOV.cc.

References fetchBySequence(), and LMFUnique::getID().

Referenced by EcalCondDBInterface::fetchLMFRunIOV(), and getColor().

414  {
415  int seq_id = s.getID();
416  vector<int> parameters;
417  parameters.push_back(seq_id);
418  parameters.push_back(lmr);
419  parameters.push_back(color);
420  parameters.push_back(type);
421  return fetchBySequence(parameters, "SELECT LMF_IOV_ID FROM (SELECT "
422  "SEQ_ID, LMF_IOV_ID FROM "
423  "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
424  "WHERE SEQ_ID < :1 AND LMR = :2 AND COLOR_ID = :3 "
425  "AND TRIG_TYPE = :4 ORDER BY SEQ_ID DESC) WHERE "
426  "ROWNUM <= 1",
427  "fetchBySequence");
428 }
type
Definition: HCALResponse.h:21
int getID() const
Definition: LMFUnique.h:52
std::list< LMFRunIOV > fetchBySequence(const LMFSeqDat &s)
Definition: LMFRunIOV.cc:377
LMFColor LMFRunIOV::getColor ( ) const
inline
std::string LMFRunIOV::getColorLongName ( ) const

Definition at line 119 of file LMFRunIOV.cc.

References getLMFColor(), and LMFColor::getLongName().

119  {
120  LMFColor rcol = getLMFColor();
121  return rcol.getLongName();
122 }
LMFColor getLMFColor() const
Definition: LMFRunIOV.cc:107
std::string getLongName() const
Definition: LMFColor.h:45
std::string LMFRunIOV::getColorShortName ( ) const

Definition at line 114 of file LMFRunIOV.cc.

References getLMFColor(), and LMFColor::getShortName().

114  {
115  LMFColor rcol = getLMFColor();
116  return rcol.getShortName();
117 }
LMFColor getLMFColor() const
Definition: LMFRunIOV.cc:107
std::string getShortName() const
Definition: LMFColor.h:44
Tm LMFRunIOV::getDBInsertionTime ( ) const

Definition at line 181 of file LMFRunIOV.cc.

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

Referenced by getColor().

181  {
182  Tm t;
183  t.setToString(getString("db_timestamp"));
184  return t;
185 }
void setToString(const std::string s) noexcept(false)
Definition: Tm.cc:193
std::string getString(std::string fieldname) const
Definition: LMFUnique.cc:194
Definition: Tm.h:13
LMFColor LMFRunIOV::getLMFColor ( ) const

Definition at line 107 of file LMFRunIOV.cc.

References LMFUnique::getInt(), IDBObject::m_conn, IDBObject::m_env, and LMFUnique::setByID().

Referenced by getColor(), getColorLongName(), getColorShortName(), isValid(), and operator==().

108 {
109  LMFColor rcol = LMFColor(m_env, m_conn);
110  rcol.setByID(getInt("color_id"));
111  return rcol;
112 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setByID(int id) noexcept(false) override
Definition: LMFUnique.cc:286
int getInt(std::string fieldname) const
Definition: LMFUnique.cc:203
LMFRunTag LMFRunIOV::getLMFRunTag ( ) const

Definition at line 68 of file LMFRunIOV.cc.

References LMFUnique::getInt(), IDBObject::m_conn, IDBObject::m_env, and LMFUnique::setByID().

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

69 {
71  rtag.setByID(getInt("tag_id"));
72  return rtag;
73 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setByID(int id) noexcept(false) override
Definition: LMFUnique.cc:286
int getInt(std::string fieldname) const
Definition: LMFUnique.cc:203
int LMFRunIOV::getLmr ( ) const

Definition at line 154 of file LMFRunIOV.cc.

References LMFUnique::getInt().

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

154  {
155  return getInt("lmr");
156 }
int getInt(std::string fieldname) const
Definition: LMFUnique.cc:203
void LMFRunIOV::getParameters ( ResultSet rset)
overridevirtualnoexcept

Reimplemented from LMFUnique.

Definition at line 251 of file LMFRunIOV.cc.

References DateHandler::dateToTm(), util.getRunInfo::day(), cuy::dh, IDBObject::m_conn, IDBObject::m_env, LMFUnique::m_foreignKeys, edm::second(), setColor(), IDBObject::setConnection(), LMFUnique::setInt(), setLMFRunTag(), LMFUnique::setString(), setTriggerType(), Tm::str(), AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::tt, and create_public_lumi_plots::year.

Referenced by operator!=().

251  {
253  setLMFRunTag(rset->getInt(1));
254  LMFSeqDat *seq;
255  if (m_foreignKeys.find("sequence") != m_foreignKeys.end()) {
256  seq = (LMFSeqDat*)m_foreignKeys["sequence"];
257  setInt("seq_id", seq->getID());
258  } else {
259  seq = new LMFSeqDat;
260  seq->setConnection(m_env, m_conn);
261  seq->setByID(rset->getInt(2));
262  setInt("seq_id", seq->getID());
263  delete seq;
264  }
265  setInt("lmr", rset->getInt(3));
266  setColor(rset->getInt(4));
267  setTriggerType(rset->getInt(5));
268  Date start = rset->getDate(6);
269  setString("subrun_start", dh.dateToTm(start).str());
270  Date stop = rset->getDate(7);
271  setString("subrun_end", dh.dateToTm(stop).str());
272  setString("subrun_type", rset->getString(8));
273 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
274  setString("db_timestamp", rset->getTimestamp(9).toText("YYYY-MM-DD HH24:MI:SS", 0));
275 #else
276  int year = 0;
277  unsigned int month = 0;
278  unsigned int day = 0;
279  unsigned int hour = 0;
280  unsigned int minute = 0;
281  unsigned int second = 0;
282  unsigned int fs = 0;
283  rset->getTimestamp(9).getDate(year, month, day);
284  rset->getTimestamp(9).getTime(hour, minute, second, fs);
285  const std::tm tt = {
286 // Different max(second) is defined by C99 and Oracle Timestamp.
287  .tm_sec = static_cast<int>(second),
288  .tm_min = static_cast<int>(minute),
289  .tm_hour = static_cast<int>(hour),
290  .tm_mday = static_cast<int>(day),
291  .tm_mon = static_cast<int>(month),
292  .tm_year = year - 1900
293  };
294  char tt_str[30] = { 0 };
295  if (std::strftime(tt_str, sizeof(tt_str), "%F %T", &tt)) {
296  setString("db_timestamp", std::string(tt_str));
297  } else {
298  throw std::runtime_error("LMFRunIOV::getParameters: failed to generate the date string for 'db_timestamp' parameter");
299  }
300 #endif
301 }
Definition: start.py:1
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
LMFRunIOV & setLMFRunTag(const LMFRunTag &tag)
Definition: LMFRunIOV.cc:56
U second(std::pair< T, U > const &p)
LMFRunIOV & setTriggerType(LMFTrigType &tt)
Definition: LMFRunIOV.cc:124
std::map< std::string, LMFUnique * > m_foreignKeys
Definition: LMFUnique.h:105
LMFUnique & setString(std::string key, std::string value)
Definition: LMFUnique.cc:15
def day(string)
Definition: getRunInfo.py:11
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
LMFRunIOV & setColor(const LMFColor &c)
Definition: LMFRunIOV.cc:75
dh
Definition: cuy.py:355
LMFSeqDat LMFRunIOV::getSequence ( ) const

Definition at line 205 of file LMFRunIOV.cc.

References LMFUnique::getInt(), IDBObject::m_conn, IDBObject::m_env, and LMFUnique::setByID().

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

206 {
208  rs.setByID(getInt("seq_id"));
209  return rs;
210 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setByID(int id) noexcept(false) override
Definition: LMFUnique.cc:286
int getInt(std::string fieldname) const
Definition: LMFUnique.cc:203
Tm LMFRunIOV::getSubRunEnd ( ) const

Definition at line 174 of file LMFRunIOV.cc.

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

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

174  {
175  Tm t;
176  t.setToString(getString("subrun_end"));
177  return t;
178 }
void setToString(const std::string s) noexcept(false)
Definition: Tm.cc:193
std::string getString(std::string fieldname) const
Definition: LMFUnique.cc:194
Definition: Tm.h:13
Tm LMFRunIOV::getSubRunStart ( ) const

Definition at line 163 of file LMFRunIOV.cc.

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

Referenced by getColor(), LMFDat::getSubrunStart(), operator==(), and writeDBSql().

163  {
164  Tm t;
165  t.setToString(getString("subrun_start"));
166  return t;
167 }
void setToString(const std::string s) noexcept(false)
Definition: Tm.cc:193
std::string getString(std::string fieldname) const
Definition: LMFUnique.cc:194
Definition: Tm.h:13
std::string LMFRunIOV::getSubRunType ( ) const

Definition at line 192 of file LMFRunIOV.cc.

References LMFUnique::getString().

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

192  {
193  return getString("subrun_type");
194 }
std::string getString(std::string fieldname) const
Definition: LMFUnique.cc:194
LMFTrigType LMFRunIOV::getTriggerType ( ) const

Definition at line 142 of file LMFRunIOV.cc.

References LMFUnique::getInt(), IDBObject::m_conn, IDBObject::m_env, and LMFUnique::setByID().

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

143 {
145  rt.setByID(getInt("trigType_id"));
146  return rt;
147 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setByID(int id) noexcept(false) override
Definition: LMFUnique.cc:286
int getInt(std::string fieldname) const
Definition: LMFUnique.cc:203
void LMFRunIOV::initialize ( void  )
private

Definition at line 10 of file LMFRunIOV.cc.

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

Referenced by LMFRunIOV(), and operator!=().

10  {
11  Tm tm;
12  tm.setToCurrentGMTime();
13 
14  m_intFields["lmr"] = 0;
15  m_intFields["tag_id"] = 0;
16  m_intFields["seq_id"] = 0;
17  m_intFields["color_id"] = 0;
18  m_intFields["trigType_id"] = 0;
19  m_stringFields["subrun_start"] = tm.str();
20  m_stringFields["subrun_end"] = tm.str();
21  m_stringFields["db_timestamp"] = tm.str();
22  m_stringFields["subrun_type"] = "none";
23  m_className = "LMFRunIOV";
24 
25  _fabric = nullptr;
26 }
std::string m_className
Definition: LMFUnique.h:98
void setToCurrentGMTime()
Definition: Tm.cc:177
std::map< std::string, std::string > m_stringFields
Definition: LMFUnique.h:101
LMFDefFabric * _fabric
Definition: LMFRunIOV.h:99
std::string str() const
Definition: Tm.cc:89
Definition: Tm.h:13
std::map< std::string, int > m_intFields
Definition: LMFUnique.h:103
bool LMFRunIOV::isValid ( void  )
overridevirtual

Reimplemented from LMFUnique.

Definition at line 303 of file LMFRunIOV.cc.

References getLMFColor(), getLMFRunTag(), getLmr(), getSequence(), and getTriggerType().

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

303  {
304  bool ret = true;
305  if (!getLMFRunTag().isValid()) {
306  ret = false;
307  }
308  if (!getSequence().isValid()) {
309  ret = false;
310  }
311  if (!getTriggerType().isValid()) {
312  ret = false;
313  }
314  if ((getLmr() < 0) || (getLmr() > 92)) {
315  ret = false;
316  }
317  if (!getLMFColor().isValid()) {
318  ret = false;
319  }
320  // subrun start and end are by definition valid
321  return ret;
322 }
LMFColor getLMFColor() const
Definition: LMFRunIOV.cc:107
LMFSeqDat getSequence() const
Definition: LMFRunIOV.cc:205
int getLmr() const
Definition: LMFRunIOV.cc:154
LMFTrigType getTriggerType() const
Definition: LMFRunIOV.cc:142
bool isValid() override
Definition: LMFRunIOV.cc:303
LMFRunTag getLMFRunTag() const
Definition: LMFRunIOV.cc:68
bool LMFRunIOV::operator!= ( const LMFRunIOV m) const
inline
LMFRunIOV & LMFRunIOV::operator= ( const LMFRunIOV r)
virtual

Definition at line 430 of file LMFRunIOV.cc.

References _fabric, checkFabric(), gather_cfg::cout, LMFDefFabric::debug(), and LMFUnique::m_debug.

Referenced by getColor().

430  {
431  if (this != &r) {
432  LMFUnique::operator=(r);
433  if (r._fabric != nullptr) {
434  checkFabric();// _fabric = new LMFDefFabric;
435  if (m_debug) {
436  _fabric->debug();
437  std::cout << "COPYING INTO " << _fabric << std::endl;
438  }
439  *_fabric = *(r._fabric);
440  }
441  }
442  return *this;
443 }
void checkFabric()
Definition: LMFRunIOV.cc:87
LMFDefFabric * _fabric
Definition: LMFRunIOV.h:99
char m_debug
Definition: LMFUnique.h:99
bool LMFRunIOV::operator== ( const LMFRunIOV m) const
inline

Definition at line 72 of file LMFRunIOV.h.

References getLMFColor(), getLMFRunTag(), getLmr(), getSequence(), getSubRunEnd(), getSubRunStart(), getSubRunType(), and getTriggerType().

73  {
74  return ( getLMFRunTag() == m.getLMFRunTag() &&
75  getSequence() == m.getSequence() &&
76  getLmr() == m.getLmr() &&
77  getLMFColor() == m.getLMFColor() &&
78  getTriggerType() == m.getTriggerType() &&
79  getSubRunType() == m.getSubRunType() &&
80  getSubRunStart() == m.getSubRunStart() &&
81  getSubRunEnd() == m.getSubRunEnd() );
82  }
std::string getSubRunType() const
Definition: LMFRunIOV.cc:192
Tm getSubRunStart() const
Definition: LMFRunIOV.cc:163
LMFColor getLMFColor() const
Definition: LMFRunIOV.cc:107
LMFSeqDat getSequence() const
Definition: LMFRunIOV.cc:205
int getLmr() const
Definition: LMFRunIOV.cc:154
LMFTrigType getTriggerType() const
Definition: LMFRunIOV.cc:142
Tm getSubRunEnd() const
Definition: LMFRunIOV.cc:174
LMFRunTag getLMFRunTag() const
Definition: LMFRunIOV.cc:68
std::string LMFRunIOV::setByIDSql ( Statement stmt,
int  id 
)
overridevirtual

Reimplemented from LMFUnique.

Definition at line 239 of file LMFRunIOV.cc.

References cuy::dh, IDBObject::m_conn, IDBObject::m_env, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by operator!=().

240 {
242  std::string sql = "SELECT TAG_ID, SEQ_ID, LMR, COLOR_ID, TRIG_TYPE, "
243  "SUBRUN_START, SUBRUN_END, SUBRUN_TYPE, DB_TIMESTAMP FROM "
244  "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
245  "WHERE LMF_IOV_ID = :1";
246  stmt->setSQL(sql);
247  stmt->setInt(1, id);
248  return sql;
249 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
dh
Definition: cuy.py:355
LMFRunIOV & LMFRunIOV::setColor ( const LMFColor c)

Definition at line 75 of file LMFRunIOV.cc.

References LMFUnique::getID(), and LMFUnique::setInt().

Referenced by getParameters().

76 {
77  setInt("color_id", color.getID());
78  return *this;
79 }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
LMFRunIOV & LMFRunIOV::setColor ( std::string  name)

Definition at line 100 of file LMFRunIOV.cc.

References _fabric, checkFabric(), LMFDefFabric::getColorID(), and LMFUnique::setInt().

101 {
102  checkFabric();
103  setInt("color_id", _fabric->getColorID(name));
104  return *this;
105 }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
int getColorID(std::string name) const
Definition: LMFDefFabric.cc:95
void checkFabric()
Definition: LMFRunIOV.cc:87
LMFDefFabric * _fabric
Definition: LMFRunIOV.h:99
LMFRunIOV & LMFRunIOV::setColor ( int  color_id)

Definition at line 81 of file LMFRunIOV.cc.

References LMFUnique::setInt().

82 {
83  setInt("color_id", color_id);
84  return *this;
85 }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
LMFRunIOV & LMFRunIOV::setColorIndex ( int  color_index)

Definition at line 93 of file LMFRunIOV.cc.

References _fabric, checkFabric(), LMFDefFabric::getColorID(), and LMFUnique::setInt().

94 {
95  checkFabric();
96  setInt("color_id", _fabric->getColorID(color_index));
97  return *this;
98 }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
int getColorID(std::string name) const
Definition: LMFDefFabric.cc:95
void checkFabric()
Definition: LMFRunIOV.cc:87
LMFDefFabric * _fabric
Definition: LMFRunIOV.h:99
LMFRunIOV & LMFRunIOV::setLMFRunTag ( const LMFRunTag tag)

Definition at line 56 of file LMFRunIOV.cc.

References LMFUnique::getID(), and LMFUnique::setInt().

Referenced by getParameters().

57 {
58  setInt("tag_id", tag.getID());
59  return *this;
60 }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
int getID() const
Definition: LMFUnique.h:52
LMFRunIOV & LMFRunIOV::setLMFRunTag ( int  tag_id)

Definition at line 62 of file LMFRunIOV.cc.

References LMFUnique::setInt().

63 {
64  setInt("tag_id", tag_id);
65  return *this;
66 }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
LMFRunIOV & LMFRunIOV::setLmr ( int  n)

Definition at line 149 of file LMFRunIOV.cc.

References LMFUnique::setInt().

149  {
150  setInt("lmr", n);
151  return *this;
152 }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
LMFRunIOV & LMFRunIOV::setSequence ( LMFSeqDat seq)

Definition at line 196 of file LMFRunIOV.cc.

References LMFUnique::attach(), LMFUnique::getID(), and LMFUnique::setInt().

197 {
198  LMFSeqDat *seqdat = new LMFSeqDat();
199  *seqdat = seq;
200  attach("sequence", seqdat);
201  setInt("seq_id", seqdat->getID());
202  return *this;
203 }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
int getID() const
Definition: LMFUnique.h:52
void attach(std::string name, LMFUnique *u)
Definition: LMFUnique.cc:50
LMFRunIOV& LMFRunIOV::setSequence ( LMFSeqDat seq)
LMFRunIOV & LMFRunIOV::setSubRunEnd ( const Tm end)

Definition at line 169 of file LMFRunIOV.cc.

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

169  {
170  setString("subrun_end", stop.str());
171  return *this;
172 }
LMFUnique & setString(std::string key, std::string value)
Definition: LMFUnique.cc:15
LMFRunIOV & LMFRunIOV::setSubRunStart ( const Tm start)

Definition at line 158 of file LMFRunIOV.cc.

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

158  {
159  setString("subrun_start", start.str());
160  return *this;
161 }
LMFUnique & setString(std::string key, std::string value)
Definition: LMFUnique.cc:15
std::string str() const
Definition: Tm.cc:89
LMFRunIOV & LMFRunIOV::setSubRunType ( const std::string &  x)

Definition at line 187 of file LMFRunIOV.cc.

References LMFUnique::setString().

187  {
188  setString("subrun_type", s);
189  return *this;
190 }
LMFUnique & setString(std::string key, std::string value)
Definition: LMFUnique.cc:15
LMFRunIOV & LMFRunIOV::setTriggerType ( LMFTrigType tt)

Definition at line 124 of file LMFRunIOV.cc.

References LMFUnique::getID(), and LMFUnique::setInt().

Referenced by getParameters().

125 {
126  setInt("trigType_id", trigType.getID());
127  return *this;
128 }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
LMFRunIOV & LMFRunIOV::setTriggerType ( int  trigType_id)

Definition at line 137 of file LMFRunIOV.cc.

References LMFUnique::setInt().

137  {
138  setInt("trigType_id", id);
139  return *this;
140 }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
LMFRunIOV & LMFRunIOV::setTriggerType ( std::string  trigShortName)

Definition at line 130 of file LMFRunIOV.cc.

References _fabric, checkFabric(), LMFDefFabric::getTrigTypeID(), and LMFUnique::setInt().

131 {
132  checkFabric();
133  setInt("trigType_id", _fabric->getTrigTypeID(sname));
134  return *this;
135 }
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
void checkFabric()
Definition: LMFRunIOV.cc:87
int getTrigTypeID(std::string sname) const
LMFDefFabric * _fabric
Definition: LMFRunIOV.h:99
std::string LMFRunIOV::writeDBSql ( Statement stmt)
overridevirtual

Reimplemented from LMFUnique.

Definition at line 324 of file LMFRunIOV.cc.

References symbols::dm, LMFUnique::getInt(), getSubRunEnd(), getSubRunStart(), getSubRunType(), IDBObject::m_conn, IDBObject::m_env, LMFUnique::sequencePostfix(), AlCaHLTBitMon_QueryRunRegistry::string, DateHandler::tmToDate(), and groupFilesInBlocks::tt.

Referenced by operator!=().

325 {
326  // check that everything has been setup
327  int tag_id = getInt("tag_id");
328  int seq_id = getInt("seq_id");
329  int color_id = getInt("color_id");
330  int tt = getInt("trigType_id");
332  std::string sql = "INSERT INTO LMF_RUN_IOV (LMF_IOV_ID, TAG_ID, SEQ_ID, "
333  "LMR, COLOR_ID, TRIG_TYPE, SUBRUN_START, SUBRUN_END, SUBRUN_TYPE) VALUES "
334  "(lmf_run_iov_" + sp + "_sq.NextVal, :1, :2, :3, :4, :5, :6, :7, :8)";
335  stmt->setSQL(sql);
337  stmt->setInt(1, tag_id);
338  stmt->setInt(2, seq_id);
339  stmt->setInt(3, getInt("lmr"));
340  stmt->setInt(4, color_id);
341  stmt->setInt(5, tt);
342  stmt->setDate(6, dm.tmToDate(getSubRunStart()));
343  stmt->setDate(7, dm.tmToDate(getSubRunEnd()));
344  stmt->setString(8, getSubRunType());
345  return sql;
346 }
std::string getSubRunType() const
Definition: LMFRunIOV.cc:192
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
Tm getSubRunStart() const
Definition: LMFRunIOV.cc:163
std::string sequencePostfix(const Tm &t)
Definition: LMFUnique.cc:10
int getInt(std::string fieldname) const
Definition: LMFUnique.cc:203
Tm getSubRunEnd() const
Definition: LMFRunIOV.cc:174

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 21 of file LMFRunIOV.h.

Member Data Documentation

LMFDefFabric* LMFRunIOV::_fabric
private