CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes | Friends
DCSPTMTempList Class Reference

#include <DCSPTMTempList.h>

Inheritance diagram for DCSPTMTempList:
IDBObject

Public Member Functions

 DCSPTMTempList ()
 
void fetchValuesForECID (const EcalLogicID &ecid) noexcept(false)
 
void fetchValuesForECIDAndTime (const EcalLogicID &ecid, const Tm &start, const Tm &end) noexcept(false)
 
std::vector< DCSPTMTempgetList ()
 
 ~DCSPTMTempList () override
 
- 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 Attributes

std::vector< DCSPTMTempm_vec_temp
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS = 1024
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const noexcept(false)
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 15 of file DCSPTMTempList.h.

Constructor & Destructor Documentation

DCSPTMTempList::DCSPTMTempList ( )

Definition at line 14 of file DCSPTMTempList.cc.

14 { m_conn = nullptr; }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
DCSPTMTempList::~DCSPTMTempList ( )
override

Definition at line 16 of file DCSPTMTempList.cc.

16 {}

Member Function Documentation

void DCSPTMTempList::fetchValuesForECID ( const EcalLogicID ecid)
noexcept

Definition at line 20 of file DCSPTMTempList.cc.

References gather_cfg::cout, DateHandler::dateToTm(), cuy::dh, alignCSCRings::e, mps_fire::i, alignCSCRings::r, DCSPTMTemp::setEcalLogicID(), DCSPTMTemp::setEnd(), DCSPTMTemp::setStart(), DCSPTMTemp::setTemperature(), and x.

Referenced by EcalCondDBInterface::fetchDCSPTMTempList().

20  {
21  this->checkConnection();
22  int nruns = 0;
23 
24  int ecid_id = ecid.getLogicID();
25 
26  try {
27  Statement* stmt0 = m_conn->createStatement();
28  stmt0->setSQL(
29  "SELECT count(since) FROM PVSS_TEMPERATURE_DAT "
30  "WHERE logic_id = :logic_id ");
31  stmt0->setInt(1, ecid_id);
32 
33  ResultSet* rset0 = stmt0->executeQuery();
34  if (rset0->next()) {
35  nruns = rset0->getInt(1);
36  }
37  m_conn->terminateStatement(stmt0);
38 
39  cout << "DCSPTMTempList::fetchValuesForECID>> Number of records in DB=" << nruns << endl;
40  m_vec_temp.reserve(nruns);
41 
42  Statement* stmt = m_conn->createStatement();
43  stmt->setSQL(
44  "SELECT "
45  "since, till, temperature FROM PVSS_TEMPERATURE_DAT "
46  "WHERE logic_id = :logic_id order by since ");
47  stmt->setInt(1, ecid_id);
48 
50  Tm runStart;
51  Tm runEnd;
52 
53  ResultSet* rset = stmt->executeQuery();
54  int i = 0;
55  while (i < nruns) {
56  rset->next();
57 
58  Date startDate = rset->getDate(1);
59  Date endDate = rset->getDate(2);
60  float x = rset->getFloat(3);
61  runStart = dh.dateToTm(startDate);
62  runEnd = dh.dateToTm(endDate);
63 
64  DCSPTMTemp r;
65  r.setTemperature(x);
66  r.setStart(runStart);
67  r.setEnd(runEnd);
68  r.setEcalLogicID(ecid);
69  m_vec_temp.push_back(r);
70 
71  i++;
72  }
73 
74  cout << "DCSPTMTempList::fetchValuesForECID>> loop done " << endl;
75 
76  m_conn->terminateStatement(stmt);
77  } catch (SQLException& e) {
78  throw(std::runtime_error("DCSPTMTempList: " + e.getMessage()));
79  }
80 }
void setEnd(const Tm &end)
Definition: DCSPTMTemp.cc:32
void setEcalLogicID(const EcalLogicID &ecid)
Definition: DCSPTMTemp.cc:47
void setTemperature(float temp)
Definition: DCSPTMTemp.cc:43
std::vector< DCSPTMTemp > m_vec_temp
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
int getLogicID() const
Definition: EcalLogicID.cc:28
tuple cout
Definition: gather_cfg.py:144
Definition: Tm.h:13
tuple dh
Definition: cuy.py:354
void setStart(const Tm &start)
Definition: DCSPTMTemp.cc:23
void DCSPTMTempList::fetchValuesForECIDAndTime ( const EcalLogicID ecid,
const Tm start,
const Tm end 
)
noexcept

Definition at line 82 of file DCSPTMTempList.cc.

References gather_cfg::cout, DateHandler::dateToTm(), cuy::dh, alignCSCRings::e, dataset::end, mps_fire::i, alignCSCRings::r, DCSPTMTemp::setEcalLogicID(), DCSPTMTemp::setEnd(), DCSPTMTemp::setStart(), DCSPTMTemp::setTemperature(), command_line::start, DateHandler::tmToDate(), and x.

Referenced by EcalCondDBInterface::fetchDCSPTMTempList().

84  {
85  this->checkConnection();
86  int nruns = 0;
87 
88  int ecid_id = ecid.getLogicID();
89 
91  Tm runStart;
92  Tm runEnd;
93 
94  try {
95  Statement* stmt0 = m_conn->createStatement();
96  stmt0->setSQL(
97  "SELECT count(since) FROM PVSS_TEMPERATURE_DAT "
98  "WHERE logic_id = :logic_id "
99  "AND since >= :start_time "
100  "AND since <= :till_time ");
101  stmt0->setInt(1, ecid_id);
102  stmt0->setDate(2, dh.tmToDate(start));
103  stmt0->setDate(3, dh.tmToDate(end));
104 
105  ResultSet* rset0 = stmt0->executeQuery();
106  if (rset0->next()) {
107  nruns = rset0->getInt(1);
108  }
109  m_conn->terminateStatement(stmt0);
110 
111  cout << "DCSPTMTempList::fetchValuesForECIDAndTime>> Number of records in DB=" << nruns << endl;
112  m_vec_temp.reserve(nruns);
113 
114  Statement* stmt = m_conn->createStatement();
115  stmt->setSQL(
116  "SELECT "
117  "since, till, temperature FROM PVSS_TEMPERATURE_DAT "
118  "WHERE logic_id = :logic_id "
119  "AND since >= :start_time "
120  "AND since <= :till_time "
121  " order by since ");
122  stmt->setInt(1, ecid_id);
123  stmt->setDate(2, dh.tmToDate(start));
124  stmt->setDate(3, dh.tmToDate(end));
125 
126  ResultSet* rset = stmt->executeQuery();
127  int i = 0;
128  while (i < nruns) {
129  rset->next();
130 
131  Date startDate = rset->getDate(1);
132  Date endDate = rset->getDate(2);
133  float x = rset->getFloat(3);
134  runStart = dh.dateToTm(startDate);
135  runEnd = dh.dateToTm(endDate);
136 
137  DCSPTMTemp r;
138  r.setTemperature(x);
139  r.setStart(runStart);
140  r.setEnd(runEnd);
141  r.setEcalLogicID(ecid);
142  m_vec_temp.push_back(r);
143 
144  i++;
145  }
146 
147  m_conn->terminateStatement(stmt);
148  } catch (SQLException& e) {
149  throw(std::runtime_error("DCSPTMTempList: " + e.getMessage()));
150  }
151 }
void setEnd(const Tm &end)
Definition: DCSPTMTemp.cc:32
void setEcalLogicID(const EcalLogicID &ecid)
Definition: DCSPTMTemp.cc:47
void setTemperature(float temp)
Definition: DCSPTMTemp.cc:43
std::vector< DCSPTMTemp > m_vec_temp
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
int getLogicID() const
Definition: EcalLogicID.cc:28
tuple cout
Definition: gather_cfg.py:144
Definition: Tm.h:13
tuple dh
Definition: cuy.py:354
void setStart(const Tm &start)
Definition: DCSPTMTemp.cc:23
std::vector< DCSPTMTemp > DCSPTMTempList::getList ( )

Definition at line 18 of file DCSPTMTempList.cc.

18 { return m_vec_temp; }
std::vector< DCSPTMTemp > m_vec_temp

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 17 of file DCSPTMTempList.h.

Member Data Documentation

std::vector<DCSPTMTemp> DCSPTMTempList::m_vec_temp
private

Definition at line 32 of file DCSPTMTempList.h.