CMS 3D CMS Logo

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

#include <MonRunDat.h>

Inheritance diagram for MonRunDat:
IDataItem IDBObject

Public Member Functions

MonRunOutcomeDef getMonRunOutcomeDef () const
 
int getNumEvents () const
 
std::string getRootfileName () const
 
std::string getTable () override
 
int getTaskList () const
 
int getTaskOutcome () const
 
 MonRunDat ()
 
void setMonRunOutcomeDef (const MonRunOutcomeDef &outcomeDef)
 
void setNumEvents (int num)
 
void setRootfileName (std::string name)
 
void setTaskList (int list)
 
void setTaskOutcome (int outcome)
 
 ~MonRunDat () override
 
- Public Member Functions inherited from IDataItem
 IDataItem ()
 
- 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 fetchData (std::map< EcalLogicID, MonRunDat > *fillMap, MonRunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeDB (const EcalLogicID *ecid, const MonRunDat *item, MonRunIOV *iov) noexcept(false)
 

Private Attributes

int m_numEvents
 
MonRunOutcomeDef m_outcomeDef
 
std::string m_rootfileName
 
int m_taskList
 
int m_taskOutcome
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS = 1024
 
- Protected Member Functions inherited from IDataItem
void checkPrepare () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void setPrefetchRowCount (int ncount) noexcept(false)
 
void terminateReadStatement () noexcept(false)
 
void terminateWriteStatement () noexcept(false)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const noexcept(false)
 
- Protected Attributes inherited from IDataItem
oracle::occi::Statement * m_readStmt
 
oracle::occi::Statement * m_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 12 of file MonRunDat.h.

Constructor & Destructor Documentation

MonRunDat::MonRunDat ( )

Definition at line 12 of file MonRunDat.cc.

12  {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16  m_readStmt = nullptr;
17 
18  m_numEvents = 0;
20  m_rootfileName = "";
21  m_taskList = 0;
22  m_taskOutcome = 0;
23 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
int m_taskList
Definition: MonRunDat.h:47
int m_numEvents
Definition: MonRunDat.h:44
MonRunOutcomeDef m_outcomeDef
Definition: MonRunDat.h:45
std::string m_rootfileName
Definition: MonRunDat.h:46
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
int m_taskOutcome
Definition: MonRunDat.h:48
MonRunDat::~MonRunDat ( )
override

Definition at line 25 of file MonRunDat.cc.

25 {}

Member Function Documentation

void MonRunDat::fetchData ( std::map< EcalLogicID, MonRunDat > *  fillMap,
MonRunIOV iov 
)
privatenoexcept

Definition at line 78 of file MonRunDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, MonRunOutcomeDef::setByID(), IDBObject::setConnection(), setMonRunOutcomeDef(), setNumEvents(), setRootfileName(), setTaskList(), and setTaskOutcome().

Referenced by getTaskOutcome().

78  {
79  this->checkConnection();
80  fillMap->clear();
81 
82  iov->setConnection(m_env, m_conn);
83  int iovID = iov->fetchID();
84  if (!iovID) {
85  // throw(std::runtime_error("MonRunDat::writeDB: IOV not in DB"));
86  return;
87  }
88 
89  try {
90  m_readStmt->setSQL(
91  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
92  "d.num_events, d.run_outcome_id, d.rootfile_name, d.task_list, d.task_outcome "
93  "FROM channelview cv JOIN mon_run_dat d "
94  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
95  "WHERE d.iov_id = :iov_id");
96  m_readStmt->setInt(1, iovID);
97  ResultSet* rset = m_readStmt->executeQuery();
98 
99  std::pair<EcalLogicID, MonRunDat> p;
100  MonRunDat dat;
101  MonRunOutcomeDef outcomeDef;
102  outcomeDef.setConnection(m_env, m_conn);
103  while (rset->next()) {
104  p.first = EcalLogicID(rset->getString(1), // name
105  rset->getInt(2), // logic_id
106  rset->getInt(3), // id1
107  rset->getInt(4), // id2
108  rset->getInt(5), // id3
109  rset->getString(6)); // maps_to
110 
111  dat.setNumEvents(rset->getInt(7));
112  outcomeDef.setByID(rset->getInt(8));
113  dat.setMonRunOutcomeDef(outcomeDef);
114  dat.setRootfileName(rset->getString(9));
115  dat.setTaskList(rset->getInt(10));
116  dat.setTaskOutcome(rset->getInt(11));
117 
118  p.second = dat;
119  fillMap->insert(p);
120  }
121  } catch (SQLException& e) {
122  throw(std::runtime_error("MonRunDat::fetchData(): " + e.getMessage()));
123  }
124 }
void setTaskList(int list)
Definition: MonRunDat.h:30
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
void setNumEvents(int num)
Definition: MonRunDat.h:21
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void setMonRunOutcomeDef(const MonRunOutcomeDef &outcomeDef)
Definition: MonRunDat.h:24
void setByID(int id) noexcept(false) override
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:72
void setRootfileName(std::string name)
Definition: MonRunDat.h:27
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void setTaskOutcome(int outcome)
Definition: MonRunDat.h:33
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
MonRunOutcomeDef MonRunDat::getMonRunOutcomeDef ( ) const
inline

Definition at line 25 of file MonRunDat.h.

References m_outcomeDef.

25 { return m_outcomeDef; }
MonRunOutcomeDef m_outcomeDef
Definition: MonRunDat.h:45
int MonRunDat::getNumEvents ( ) const
inline

Definition at line 22 of file MonRunDat.h.

References m_numEvents.

22 { return m_numEvents; }
int m_numEvents
Definition: MonRunDat.h:44
std::string MonRunDat::getRootfileName ( ) const
inline

Definition at line 28 of file MonRunDat.h.

References m_rootfileName.

28 { return m_rootfileName; }
std::string m_rootfileName
Definition: MonRunDat.h:46
std::string MonRunDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file MonRunDat.h.

19 { return "MON_RUN_DAT"; }
int MonRunDat::getTaskList ( ) const
inline

Definition at line 31 of file MonRunDat.h.

References m_taskList.

31 { return m_taskList; }
int m_taskList
Definition: MonRunDat.h:47
int MonRunDat::getTaskOutcome ( ) const
inline

Definition at line 34 of file MonRunDat.h.

References fetchData(), B2GTnPMonitor_cfi::item, m_taskOutcome, noexcept, prepareWrite(), and writeDB().

34 { return m_taskOutcome; }
int m_taskOutcome
Definition: MonRunDat.h:48
void MonRunDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 27 of file MonRunDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getTaskOutcome().

27  {
28  this->checkConnection();
29 
30  try {
31  m_writeStmt = m_conn->createStatement();
32  m_writeStmt->setSQL(
33  "INSERT INTO mon_run_dat (iov_id, logic_id, "
34  "num_events, run_outcome_id, rootfile_name, task_list, task_outcome) "
35  "VALUES (:iov_id, :logic_id, "
36  ":num_events, :run_outcome_id, :rootfile_name, :task_list, :task_outcome) ");
37  } catch (SQLException& e) {
38  throw(std::runtime_error("MonRunDat::prepareWrite(): " + e.getMessage()));
39  }
40 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void MonRunDat::setMonRunOutcomeDef ( const MonRunOutcomeDef outcomeDef)
inline

Definition at line 24 of file MonRunDat.h.

References m_outcomeDef.

Referenced by fetchData(), and ecaldqm::SummaryWriter::run().

24 { m_outcomeDef = outcomeDef; }
MonRunOutcomeDef m_outcomeDef
Definition: MonRunDat.h:45
void MonRunDat::setNumEvents ( int  num)
inline

Definition at line 21 of file MonRunDat.h.

References m_numEvents, and EgammaValidation_cff::num.

Referenced by fetchData(), and ecaldqm::SummaryWriter::run().

void MonRunDat::setRootfileName ( std::string  name)
inline

Definition at line 27 of file MonRunDat.h.

References m_rootfileName, and Skims_PA_cff::name.

Referenced by fetchData().

27 { m_rootfileName = name; }
std::string m_rootfileName
Definition: MonRunDat.h:46
void MonRunDat::setTaskList ( int  list)
inline

Definition at line 30 of file MonRunDat.h.

References list(), and m_taskList.

Referenced by fetchData(), and ecaldqm::SummaryWriter::run().

30 { m_taskList = list; }
int m_taskList
Definition: MonRunDat.h:47
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
void MonRunDat::setTaskOutcome ( int  outcome)
inline

Definition at line 33 of file MonRunDat.h.

References m_taskOutcome.

Referenced by fetchData(), and ecaldqm::SummaryWriter::run().

33 { m_taskOutcome = outcome; }
int m_taskOutcome
Definition: MonRunDat.h:48
void MonRunDat::writeDB ( const EcalLogicID ecid,
const MonRunDat item,
MonRunIOV iov 
)
privatenoexcept

Definition at line 42 of file MonRunDat.cc.

References MillePedeFileConverter_cfg::e, MonRunOutcomeDef::fetchID(), B2GTnPMonitor_cfi::item, and IDBObject::setConnection().

Referenced by getTaskOutcome().

42  {
43  this->checkConnection();
44  this->checkPrepare();
45 
46  int iovID = iov->fetchID();
47  if (!iovID) {
48  throw(std::runtime_error("MonRunDat::writeDB: IOV not in DB"));
49  }
50 
51  MonRunOutcomeDef monRunOutcomeDef = item->getMonRunOutcomeDef(); // XXX object copy every row!
52  monRunOutcomeDef.setConnection(m_env, m_conn);
53  int outcomeID = monRunOutcomeDef.fetchID();
54  if (!outcomeID) {
55  throw(std::runtime_error("MonRunDat::writeDB: Outcome Definition not in DB"));
56  }
57 
58  int logicID = ecid->getLogicID();
59  if (!logicID) {
60  throw(std::runtime_error("MonRunDat::writeDB: Bad EcalLogicID"));
61  }
62 
63  try {
64  m_writeStmt->setInt(1, iovID);
65  m_writeStmt->setInt(2, logicID);
66  m_writeStmt->setInt(3, item->getNumEvents());
67  m_writeStmt->setInt(4, outcomeID);
68  m_writeStmt->setString(5, item->getRootfileName());
69  m_writeStmt->setInt(6, item->getTaskList());
70  m_writeStmt->setInt(7, item->getTaskOutcome());
71 
72  m_writeStmt->executeUpdate();
73  } catch (SQLException& e) {
74  throw(std::runtime_error("MonRunDat::writeDB(): " + e.getMessage()));
75  }
76 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
int getTaskList() const
Definition: MonRunDat.h:31
int getNumEvents() const
Definition: MonRunDat.h:22
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
int getTaskOutcome() const
Definition: MonRunDat.h:34
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:72
MonRunOutcomeDef getMonRunOutcomeDef() const
Definition: MonRunDat.h:25
int fetchID() noexcept(false) override
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
int getLogicID() const
Definition: EcalLogicID.cc:28
std::string getRootfileName() const
Definition: MonRunDat.h:28
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonRunDat.h.

Member Data Documentation

int MonRunDat::m_numEvents
private

Definition at line 44 of file MonRunDat.h.

Referenced by getNumEvents(), and setNumEvents().

MonRunOutcomeDef MonRunDat::m_outcomeDef
private

Definition at line 45 of file MonRunDat.h.

Referenced by getMonRunOutcomeDef(), and setMonRunOutcomeDef().

std::string MonRunDat::m_rootfileName
private

Definition at line 46 of file MonRunDat.h.

Referenced by getRootfileName(), and setRootfileName().

int MonRunDat::m_taskList
private

Definition at line 47 of file MonRunDat.h.

Referenced by getTaskList(), and setTaskList().

int MonRunDat::m_taskOutcome
private

Definition at line 48 of file MonRunDat.h.

Referenced by getTaskOutcome(), and setTaskOutcome().