CMS 3D CMS Logo

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

#include <RunH4TablePositionDat.h>

Inheritance diagram for RunH4TablePositionDat:
IDataItem IDBObject

Public Member Functions

int getNumEvents () const
 
int getNumSpills () const
 
std::string getTable () override
 
int getTableX () const
 
int getTableY () const
 
 RunH4TablePositionDat ()
 
void setNumEvents (int num)
 
void setNumSpills (int num)
 
void setTableX (int num)
 
void setTableY (int num)
 
 ~RunH4TablePositionDat () 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, RunH4TablePositionDat > *fillMap, RunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeDB (const EcalLogicID *ecid, const RunH4TablePositionDat *item, RunIOV *iov) noexcept(false)
 

Private Attributes

int m_numEvents
 
int m_numSpills
 
int m_table_x
 
int m_table_y
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static const int 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 11 of file RunH4TablePositionDat.h.

Constructor & Destructor Documentation

◆ RunH4TablePositionDat()

RunH4TablePositionDat::RunH4TablePositionDat ( )

Definition at line 11 of file RunH4TablePositionDat.cc.

11  {
12  m_env = nullptr;
13  m_conn = nullptr;
14  m_writeStmt = nullptr;
15  m_readStmt = nullptr;
16 
17  m_table_x = 0;
18  m_table_y = 0;
19  m_numSpills = 0;
20  m_numEvents = 0;
21 }

◆ ~RunH4TablePositionDat()

RunH4TablePositionDat::~RunH4TablePositionDat ( )
override

Definition at line 23 of file RunH4TablePositionDat.cc.

23 {}

Member Function Documentation

◆ fetchData()

void RunH4TablePositionDat::fetchData ( std::map< EcalLogicID, RunH4TablePositionDat > *  fillMap,
RunIOV iov 
)
privatenoexcept

Definition at line 70 of file RunH4TablePositionDat.cc.

70  {
71  this->checkConnection();
72  fillMap->clear();
73 
74  iov->setConnection(m_env, m_conn);
75  int iovID = iov->fetchID();
76  if (!iovID) {
77  // throw(std::runtime_error("RunH4TablePositionDat::writeDB: IOV not in DB"));
78  return;
79  }
80 
81  try {
82  m_readStmt->setSQL(
83  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
84  "d.table_x, d.table_y, d.number_of_spills, d.number_of_events "
85  "FROM channelview cv JOIN run_h4_table_position_dat d "
86  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
87  "WHERE d.iov_id = :iov_id");
88  m_readStmt->setInt(1, iovID);
89  ResultSet* rset = m_readStmt->executeQuery();
90 
91  std::pair<EcalLogicID, RunH4TablePositionDat> p;
93  while (rset->next()) {
94  p.first = EcalLogicID(rset->getString(1), // name
95  rset->getInt(2), // logic_id
96  rset->getInt(3), // id1
97  rset->getInt(4), // id2
98  rset->getInt(5), // id3
99  rset->getString(6)); // maps_to
100 
101  dat.setTableX(rset->getInt(7));
102  dat.setTableY(rset->getInt(8));
103  dat.setNumSpills(rset->getInt(9));
104  dat.setNumEvents(rset->getInt(10));
105 
106  p.second = dat;
107  fillMap->insert(p);
108  }
109 
110  } catch (SQLException& e) {
111  throw(std::runtime_error("RunH4TablePositionDat::fetchData(): " + e.getMessage()));
112  }
113 }

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setNumEvents(), setNumSpills(), setTableX(), and setTableY().

◆ getNumEvents()

int RunH4TablePositionDat::getNumEvents ( ) const
inline

Definition at line 30 of file RunH4TablePositionDat.h.

30 { return m_numEvents; }

References m_numEvents.

◆ getNumSpills()

int RunH4TablePositionDat::getNumSpills ( ) const
inline

Definition at line 27 of file RunH4TablePositionDat.h.

27 { return m_numSpills; }

References m_numSpills.

◆ getTable()

std::string RunH4TablePositionDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file RunH4TablePositionDat.h.

18 { return "RUN_H4_TABLE_POSITION_DAT"; }

◆ getTableX()

int RunH4TablePositionDat::getTableX ( ) const
inline

Definition at line 21 of file RunH4TablePositionDat.h.

21 { return m_table_x; }

References m_table_x.

◆ getTableY()

int RunH4TablePositionDat::getTableY ( ) const
inline

Definition at line 24 of file RunH4TablePositionDat.h.

24 { return m_table_y; }

References m_table_y.

◆ prepareWrite()

void RunH4TablePositionDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 25 of file RunH4TablePositionDat.cc.

25  {
26  this->checkConnection();
27 
28  try {
29  m_writeStmt = m_conn->createStatement();
30  m_writeStmt->setSQL(
31  "INSERT INTO run_h4_table_position_dat (iov_id, logic_id, "
32  "table_x, table_y, number_of_spills, number_of_events ) "
33  "VALUES (:iov_id, :logic_id, "
34  ":table_x, :table_y, :number_of_spills, :number_of_events)");
35  } catch (SQLException& e) {
36  throw(std::runtime_error("RunH4TablePositionDat::prepareWrite(): " + e.getMessage()));
37  }
38 }

References MillePedeFileConverter_cfg::e.

◆ setNumEvents()

void RunH4TablePositionDat::setNumEvents ( int  num)
inline

Definition at line 29 of file RunH4TablePositionDat.h.

29 { m_numEvents = num; }

References m_numEvents, and EgammaValidation_cff::num.

Referenced by fetchData().

◆ setNumSpills()

void RunH4TablePositionDat::setNumSpills ( int  num)
inline

Definition at line 26 of file RunH4TablePositionDat.h.

26 { m_numSpills = num; }

References m_numSpills, and EgammaValidation_cff::num.

Referenced by fetchData().

◆ setTableX()

void RunH4TablePositionDat::setTableX ( int  num)
inline

Definition at line 20 of file RunH4TablePositionDat.h.

20 { m_table_x = num; }

References m_table_x, and EgammaValidation_cff::num.

Referenced by fetchData().

◆ setTableY()

void RunH4TablePositionDat::setTableY ( int  num)
inline

Definition at line 23 of file RunH4TablePositionDat.h.

23 { m_table_y = num; }

References m_table_y, and EgammaValidation_cff::num.

Referenced by fetchData().

◆ writeDB()

void RunH4TablePositionDat::writeDB ( const EcalLogicID ecid,
const RunH4TablePositionDat item,
RunIOV iov 
)
privatenoexcept

Definition at line 40 of file RunH4TablePositionDat.cc.

42  {
43  this->checkConnection();
44  this->checkPrepare();
45 
46  int iovID = iov->fetchID();
47  if (!iovID) {
48  throw(std::runtime_error("RunH4TablePositionDat::writeDB: IOV not in DB"));
49  }
50 
51  int logicID = ecid->getLogicID();
52  if (!logicID) {
53  throw(std::runtime_error("RunH4TablePositionDat::writeDB: Bad EcalLogicID"));
54  }
55 
56  try {
57  m_writeStmt->setInt(1, iovID);
58  m_writeStmt->setInt(2, logicID);
59  m_writeStmt->setInt(3, item->getTableX());
60  m_writeStmt->setInt(4, item->getTableY());
61  m_writeStmt->setInt(5, item->getNumSpills());
62  m_writeStmt->setInt(6, item->getNumEvents());
63 
64  m_writeStmt->executeUpdate();
65  } catch (SQLException& e) {
66  throw(std::runtime_error("RunH4TablePositionDat::writeDB(): " + e.getMessage()));
67  }
68 }

References MillePedeFileConverter_cfg::e, and B2GTnPMonitor_cfi::item.

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file RunH4TablePositionDat.h.

Member Data Documentation

◆ m_numEvents

int RunH4TablePositionDat::m_numEvents
private

Definition at line 43 of file RunH4TablePositionDat.h.

Referenced by getNumEvents(), and setNumEvents().

◆ m_numSpills

int RunH4TablePositionDat::m_numSpills
private

Definition at line 42 of file RunH4TablePositionDat.h.

Referenced by getNumSpills(), and setNumSpills().

◆ m_table_x

int RunH4TablePositionDat::m_table_x
private

Definition at line 40 of file RunH4TablePositionDat.h.

Referenced by getTableX(), and setTableX().

◆ m_table_y

int RunH4TablePositionDat::m_table_y
private

Definition at line 41 of file RunH4TablePositionDat.h.

Referenced by getTableY(), and setTableY().

RunH4TablePositionDat
Definition: RunH4TablePositionDat.h:11
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
RunH4TablePositionDat::setTableY
void setTableY(int num)
Definition: RunH4TablePositionDat.h:23
RunH4TablePositionDat::m_numEvents
int m_numEvents
Definition: RunH4TablePositionDat.h:43
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
IDataItem::m_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
RunH4TablePositionDat::m_table_x
int m_table_x
Definition: RunH4TablePositionDat.h:40
RunH4TablePositionDat::setTableX
void setTableX(int num)
Definition: RunH4TablePositionDat.h:20
IDataItem::m_writeStmt
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
EcalLogicID
Definition: EcalLogicID.h:7
RunH4TablePositionDat::m_table_y
int m_table_y
Definition: RunH4TablePositionDat.h:41
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
RunH4TablePositionDat::m_numSpills
int m_numSpills
Definition: RunH4TablePositionDat.h:42
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
RunIOV::fetchID
int fetchID() noexcept(false) override
Definition: RunIOV.cc:60
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
RunH4TablePositionDat::setNumEvents
void setNumEvents(int num)
Definition: RunH4TablePositionDat.h:29
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
RunH4TablePositionDat::setNumSpills
void setNumSpills(int num)
Definition: RunH4TablePositionDat.h:26
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37