CMS 3D CMS Logo

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

#include <RunPTMTempDat.h>

Inheritance diagram for RunPTMTempDat:
IDataItem IDBObject

Public Member Functions

std::string getTable () override
 
float getTemperature () const
 
 RunPTMTempDat ()
 
void setTemperature (float t)
 
 ~RunPTMTempDat () 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, RunPTMTempDat > *fillMap, RunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeDB (const EcalLogicID *ecid, const RunPTMTempDat *item, RunIOV *iov) noexcept(false)
 

Private Attributes

float m_temperature
 

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 11 of file RunPTMTempDat.h.

Constructor & Destructor Documentation

◆ RunPTMTempDat()

RunPTMTempDat::RunPTMTempDat ( )

Definition at line 11 of file RunPTMTempDat.cc.

11  {
12  m_env = nullptr;
13  m_conn = nullptr;
14  m_writeStmt = nullptr;
15  m_readStmt = nullptr;
16 
17  m_temperature = 0;
18 }
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
float m_temperature
Definition: RunPTMTempDat.h:30
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24

◆ ~RunPTMTempDat()

RunPTMTempDat::~RunPTMTempDat ( )
override

Definition at line 20 of file RunPTMTempDat.cc.

20 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 62 of file RunPTMTempDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, and setTemperature().

62  {
63  this->checkConnection();
64  fillMap->clear();
65 
66  iov->setConnection(m_env, m_conn);
67  int iovID = iov->fetchID();
68  if (!iovID) {
69  // throw(std::runtime_error("RunPTMTempDat::writeDB: IOV not in DB"));
70  return;
71  }
72 
73  try {
74  m_readStmt->setSQL(
75  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
76  "d.temperature "
77  "FROM channelview cv JOIN RUN_TEMPERATURE_PTM_DAT d "
78  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
79  "WHERE d.iov_id = :iov_id");
80  m_readStmt->setInt(1, iovID);
81  ResultSet* rset = m_readStmt->executeQuery();
82 
83  std::pair<EcalLogicID, RunPTMTempDat> p;
84  RunPTMTempDat dat;
85  while (rset->next()) {
86  p.first = EcalLogicID(rset->getString(1), // name
87  rset->getInt(2), // logic_id
88  rset->getInt(3), // id1
89  rset->getInt(4), // id2
90  rset->getInt(5), // id3
91  rset->getString(6)); // maps_to
92 
93  dat.setTemperature(rset->getFloat(7));
94 
95  p.second = dat;
96  fillMap->insert(p);
97  }
98 
99  } catch (SQLException& e) {
100  throw(std::runtime_error("RunPTMTempDat::fetchData(): " + e.getMessage()));
101  }
102 }
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::Statement * m_readStmt
Definition: IDataItem.h:24
void setTemperature(float t)
Definition: RunPTMTempDat.h:19
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
int fetchID() noexcept(false) override
Definition: RunIOV.cc:60

◆ getTable()

std::string RunPTMTempDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file RunPTMTempDat.h.

18 { return "RUN_PTM_TEMP_DAT"; }

◆ getTemperature()

float RunPTMTempDat::getTemperature ( ) const
inline

Definition at line 20 of file RunPTMTempDat.h.

References m_temperature.

20 { return m_temperature; }
float m_temperature
Definition: RunPTMTempDat.h:30

◆ prepareWrite()

void RunPTMTempDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 22 of file RunPTMTempDat.cc.

References MillePedeFileConverter_cfg::e.

22  {
23  this->checkConnection();
24 
25  try {
26  m_writeStmt = m_conn->createStatement();
27  m_writeStmt->setSQL(
28  "INSERT INTO run_temperature_ptm_dat (iov_id, logic_id, "
29  "temperature) "
30  "VALUES (:iov_id, :logic_id, "
31  ":temperature)");
32  } catch (SQLException& e) {
33  throw(std::runtime_error("RunPTMTempDat::prepareWrite(): " + e.getMessage()));
34  }
35 }
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

◆ setTemperature()

void RunPTMTempDat::setTemperature ( float  t)
inline

Definition at line 19 of file RunPTMTempDat.h.

References m_temperature, and submitPVValidationJobs::t.

Referenced by fetchData().

◆ writeDB()

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

Definition at line 37 of file RunPTMTempDat.cc.

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

37  {
38  this->checkConnection();
39  this->checkPrepare();
40 
41  int iovID = iov->fetchID();
42  if (!iovID) {
43  throw(std::runtime_error("RunPTMTempDat::writeDB: IOV not in DB"));
44  }
45 
46  int logicID = ecid->getLogicID();
47  if (!logicID) {
48  throw(std::runtime_error("RunPTMTempDat::writeDB: Bad EcalLogicID"));
49  }
50 
51  try {
52  m_writeStmt->setInt(1, iovID);
53  m_writeStmt->setInt(2, logicID);
54  m_writeStmt->setFloat(3, item->getTemperature());
55 
56  m_writeStmt->executeUpdate();
57  } catch (SQLException& e) {
58  throw(std::runtime_error("RunPTMTempDat::writeDB(): " + e.getMessage()));
59  }
60 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
int getLogicID() const
Definition: EcalLogicID.cc:28
int fetchID() noexcept(false) override
Definition: RunIOV.cc:60

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file RunPTMTempDat.h.

Member Data Documentation

◆ m_temperature

float RunPTMTempDat::m_temperature
private

Definition at line 30 of file RunPTMTempDat.h.

Referenced by getTemperature(), and setTemperature().