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 ()
 
float getTemperature () const
 
 RunPTMTempDat ()
 
void setTemperature (float t)
 
 ~RunPTMTempDat ()
 
- 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)
 
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 ( )

Definition at line 11 of file RunPTMTempDat.cc.

References NULL.

12 {
13  m_env = NULL;
14  m_conn = NULL;
15  m_writeStmt = NULL;
16  m_readStmt = NULL;
17 
18  m_temperature = 0;
19 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
#define NULL
Definition: scimark2.h:8
float m_temperature
Definition: RunPTMTempDat.h:33
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
RunPTMTempDat::~RunPTMTempDat ( )

Definition at line 23 of file RunPTMTempDat.cc.

24 {
25 }

Member Function Documentation

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

Definition at line 72 of file RunPTMTempDat.cc.

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

Referenced by getTemperature().

74 {
75  this->checkConnection();
76  fillMap->clear();
77 
78  iov->setConnection(m_env, m_conn);
79  int iovID = iov->fetchID();
80  if (!iovID) {
81  // throw(std::runtime_error("RunPTMTempDat::writeDB: IOV not in DB"));
82  return;
83  }
84 
85  try {
86 
87  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
88  "d.temperature "
89  "FROM channelview cv JOIN RUN_TEMPERATURE_PTM_DAT d "
90  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
91  "WHERE d.iov_id = :iov_id");
92  m_readStmt->setInt(1, iovID);
93  ResultSet* rset = m_readStmt->executeQuery();
94 
95  std::pair< EcalLogicID, RunPTMTempDat > p;
96  RunPTMTempDat dat;
97  while(rset->next()) {
98  p.first = EcalLogicID( rset->getString(1), // name
99  rset->getInt(2), // logic_id
100  rset->getInt(3), // id1
101  rset->getInt(4), // id2
102  rset->getInt(5), // id3
103  rset->getString(6)); // maps_to
104 
105  dat.setTemperature( rset->getFloat(7) );
106 
107  p.second = dat;
108  fillMap->insert(p);
109  }
110 
111  } catch (SQLException &e) {
112  throw(std::runtime_error("RunPTMTempDat::fetchData(): "+e.getMessage()));
113  }
114 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
int fetchID() noexcept(false)
Definition: RunIOV.cc:103
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
void setTemperature(float t)
Definition: RunPTMTempDat.h:19
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
std::string RunPTMTempDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 18 of file RunPTMTempDat.h.

18 { return "RUN_PTM_TEMP_DAT"; }
float RunPTMTempDat::getTemperature ( ) const
inline

Definition at line 20 of file RunPTMTempDat.h.

References fetchData(), m_temperature, noexcept, prepareWrite(), and writeDB().

20 { return m_temperature; }
float m_temperature
Definition: RunPTMTempDat.h:33
void RunPTMTempDat::prepareWrite ( )
privatevirtualnoexcept

Implements IDataItem.

Definition at line 29 of file RunPTMTempDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getTemperature().

31 {
32  this->checkConnection();
33 
34  try {
35  m_writeStmt = m_conn->createStatement();
36  m_writeStmt->setSQL("INSERT INTO run_temperature_ptm_dat (iov_id, logic_id, "
37  "temperature) "
38  "VALUES (:iov_id, :logic_id, "
39  ":temperature)");
40  } catch (SQLException &e) {
41  throw(std::runtime_error("RunPTMTempDat::prepareWrite(): "+e.getMessage()));
42  }
43 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
void RunPTMTempDat::setTemperature ( float  t)
inline

Definition at line 19 of file RunPTMTempDat.h.

References m_temperature, and lumiQTWidget::t.

Referenced by fetchData().

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

Definition at line 47 of file RunPTMTempDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getTemperature().

49 {
50  this->checkConnection();
51  this->checkPrepare();
52 
53  int iovID = iov->fetchID();
54  if (!iovID) { throw(std::runtime_error("RunPTMTempDat::writeDB: IOV not in DB")); }
55 
56  int logicID = ecid->getLogicID();
57  if (!logicID) { throw(std::runtime_error("RunPTMTempDat::writeDB: Bad EcalLogicID")); }
58 
59  try {
60  m_writeStmt->setInt(1, iovID);
61  m_writeStmt->setInt(2, logicID);
62  m_writeStmt->setFloat(3, item->getTemperature());
63 
64  m_writeStmt->executeUpdate();
65  } catch (SQLException &e) {
66  throw(std::runtime_error("RunPTMTempDat::writeDB(): "+e.getMessage()));
67  }
68 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
int getLogicID() const
Definition: EcalLogicID.cc:41
int fetchID() noexcept(false)
Definition: RunIOV.cc:103
float getTemperature() const
Definition: RunPTMTempDat.h:20

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file RunPTMTempDat.h.

Member Data Documentation

float RunPTMTempDat::m_temperature
private

Definition at line 33 of file RunPTMTempDat.h.

Referenced by getTemperature(), and setTemperature().