CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 (EcalLogicID ecid) throw (std::runtime_error)
 
void fetchValuesForECIDAndTime (EcalLogicID ecid, Tm start, Tm end) throw (std::runtime_error)
 
std::vector< DCSPTMTempgetList ()
 
 ~DCSPTMTempList ()
 
- 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 throw (std::runtime_error)
 
- 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 15 of file DCSPTMTempList.cc.

References NULL.

16 {
17  m_conn = NULL;
18 }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
#define NULL
Definition: scimark2.h:8
DCSPTMTempList::~DCSPTMTempList ( )

Definition at line 20 of file DCSPTMTempList.cc.

21 {
22 }

Member Function Documentation

void DCSPTMTempList::fetchValuesForECID ( EcalLogicID  ecid)
throw (std::runtime_error
)

Definition at line 31 of file DCSPTMTempList.cc.

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

Referenced by EcalCondDBInterface::fetchDCSPTMTempList().

33 {
34 
35  this->checkConnection();
36  int nruns=0;
37 
38  int ecid_id=ecid.getLogicID();
39 
40  try {
41  Statement* stmt0 = m_conn->createStatement();
42  stmt0->setSQL("SELECT count(since) FROM PVSS_TEMPERATURE_DAT "
43  "WHERE logic_id = :logic_id " );
44  stmt0->setInt(1, ecid_id);
45 
46  ResultSet* rset0 = stmt0->executeQuery();
47  if (rset0->next()) {
48  nruns = rset0->getInt(1);
49  }
50  m_conn->terminateStatement(stmt0);
51 
52  cout <<"DCSPTMTempList::fetchValuesForECID>> Number of records in DB="<< nruns << endl;
53  m_vec_temp.reserve(nruns);
54 
55  Statement* stmt = m_conn->createStatement();
56  stmt->setSQL("SELECT "
57  "since, till, temperature FROM PVSS_TEMPERATURE_DAT "
58  "WHERE logic_id = :logic_id order by since " );
59  stmt->setInt(1, ecid_id);
60 
62  Tm runStart;
63  Tm runEnd;
64 
65  ResultSet* rset = stmt->executeQuery();
66  int i=0;
67  while (i<nruns) {
68  rset->next();
69 
70  Date startDate = rset->getDate(1);
71  Date endDate = rset->getDate(2);
72  float x = rset->getFloat(3);
73  runStart = dh.dateToTm( startDate );
74  runEnd = dh.dateToTm( endDate );
75 
76  DCSPTMTemp r ;
77  r.setTemperature(x);
78  r.setStart(runStart);
79  r.setEnd(runEnd);
80  r.setEcalLogicID(ecid);
81  m_vec_temp.push_back(r);
82 
83  i++;
84  }
85 
86  cout <<"DCSPTMTempList::fetchValuesForECID>> loop done " << endl;
87 
88  m_conn->terminateStatement(stmt);
89  } catch (SQLException &e) {
90  throw(std::runtime_error("DCSPTMTempList: "+e.getMessage()));
91  }
92 
93 
94 }
int i
Definition: DBlmapReader.cc:9
void setTemperature(float temp)
Definition: DCSPTMTemp.cc:70
std::vector< DCSPTMTemp > m_vec_temp
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
void setStart(Tm start)
Definition: DCSPTMTemp.cc:33
void setEcalLogicID(EcalLogicID ecid)
Definition: DCSPTMTemp.cc:80
int getLogicID() const
Definition: EcalLogicID.cc:42
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:21
tuple cout
Definition: gather_cfg.py:121
x
Definition: VDTMath.h:216
Definition: Tm.h:14
void setEnd(Tm end)
Definition: DCSPTMTemp.cc:50
void checkConnection() const
Definition: IDBObject.h:41
void DCSPTMTempList::fetchValuesForECIDAndTime ( EcalLogicID  ecid,
Tm  start,
Tm  end 
)
throw (std::runtime_error
)

Definition at line 96 of file DCSPTMTempList.cc.

References gather_cfg::cout, DateHandler::dateToTm(), alignCSCRings::e, end, i, alignCSCRings::r, DCSPTMTemp::setEcalLogicID(), DCSPTMTemp::setEnd(), DCSPTMTemp::setStart(), DCSPTMTemp::setTemperature(), errorMatrix2Lands_multiChannel::start, DateHandler::tmToDate(), and vdt::x.

Referenced by EcalCondDBInterface::fetchDCSPTMTempList().

98 {
99 
100  this->checkConnection();
101  int nruns=0;
102 
103  int ecid_id=ecid.getLogicID();
104 
105  DateHandler dh(m_env, m_conn);
106  Tm runStart;
107  Tm runEnd;
108 
109 
110  try {
111  Statement* stmt0 = m_conn->createStatement();
112  stmt0->setSQL("SELECT count(since) FROM PVSS_TEMPERATURE_DAT "
113  "WHERE logic_id = :logic_id "
114  "AND since >= :start_time "
115  "AND since <= :till_time "
116  );
117  stmt0->setInt(1, ecid_id);
118  stmt0->setDate(2, dh.tmToDate(start));
119  stmt0->setDate(3, dh.tmToDate(end));
120 
121  ResultSet* rset0 = stmt0->executeQuery();
122  if (rset0->next()) {
123  nruns = rset0->getInt(1);
124  }
125  m_conn->terminateStatement(stmt0);
126 
127  cout <<"DCSPTMTempList::fetchValuesForECIDAndTime>> Number of records in DB="<< nruns << endl;
128  m_vec_temp.reserve(nruns);
129 
130  Statement* stmt = m_conn->createStatement();
131  stmt->setSQL("SELECT "
132  "since, till, temperature FROM PVSS_TEMPERATURE_DAT "
133  "WHERE logic_id = :logic_id "
134  "AND since >= :start_time "
135  "AND since <= :till_time "
136  " order by since " );
137  stmt->setInt(1, ecid_id);
138  stmt->setDate(2, dh.tmToDate(start));
139  stmt->setDate(3, dh.tmToDate(end));
140 
141 
142  ResultSet* rset = stmt->executeQuery();
143  int i=0;
144  while (i<nruns) {
145  rset->next();
146 
147  Date startDate = rset->getDate(1);
148  Date endDate = rset->getDate(2);
149  float x = rset->getFloat(3);
150  runStart = dh.dateToTm( startDate );
151  runEnd = dh.dateToTm( endDate );
152 
153  DCSPTMTemp r ;
154  r.setTemperature(x);
155  r.setStart(runStart);
156  r.setEnd(runEnd);
157  r.setEcalLogicID(ecid);
158  m_vec_temp.push_back(r);
159 
160  i++;
161  }
162 
163 
164  m_conn->terminateStatement(stmt);
165  } catch (SQLException &e) {
166  throw(std::runtime_error("DCSPTMTempList: "+e.getMessage()));
167  }
168 
169 
170 }
int i
Definition: DBlmapReader.cc:9
void setTemperature(float temp)
Definition: DCSPTMTemp.cc:70
std::vector< DCSPTMTemp > m_vec_temp
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
void setStart(Tm start)
Definition: DCSPTMTemp.cc:33
void setEcalLogicID(EcalLogicID ecid)
Definition: DCSPTMTemp.cc:80
int getLogicID() const
Definition: EcalLogicID.cc:42
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:21
tuple cout
Definition: gather_cfg.py:121
x
Definition: VDTMath.h:216
Definition: Tm.h:14
void setEnd(Tm end)
Definition: DCSPTMTemp.cc:50
void checkConnection() const
Definition: IDBObject.h:41
std::vector< DCSPTMTemp > DCSPTMTempList::getList ( )

Definition at line 25 of file DCSPTMTempList.cc.

26 {
27  return m_vec_temp;
28 }
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 33 of file DCSPTMTempList.h.