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

◆ ~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.

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 }

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

◆ 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.

20 { return m_temperature; }

References m_temperature.

◆ prepareWrite()

void RunPTMTempDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 22 of file RunPTMTempDat.cc.

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 }

References MillePedeFileConverter_cfg::e.

◆ setTemperature()

void RunPTMTempDat::setTemperature ( float  t)
inline

Definition at line 19 of file RunPTMTempDat.h.

19 { m_temperature = t; }

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.

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 }

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

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().

AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
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
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
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
RunPTMTempDat::setTemperature
void setTemperature(float t)
Definition: RunPTMTempDat.h:19
RunPTMTempDat
Definition: RunPTMTempDat.h:11
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
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
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
RunPTMTempDat::m_temperature
float m_temperature
Definition: RunPTMTempDat.h:30
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37