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 Member Functions | Private Attributes | Friends
DCULVRBTempsDat Class Reference

#include <DCULVRBTempsDat.h>

Inheritance diagram for DCULVRBTempsDat:
IDataItem IDBObject

Public Member Functions

 DCULVRBTempsDat ()
 
float getT1 () const
 
float getT2 () const
 
float getT3 () const
 
std::string getTable ()
 
void setT1 (float temp)
 
void setT2 (float temp)
 
void setT3 (float temp)
 
 ~DCULVRBTempsDat ()
 
- 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, DCULVRBTempsDat > *fillVec, DCUIOV *iov) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::map< EcalLogicID, DCULVRBTempsDat > *data, DCUIOV *iov) throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const DCULVRBTempsDat *item, DCUIOV *iov) throw (std::runtime_error)
 

Private Attributes

float m_t1
 
float m_t2
 
float m_t3
 

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 () throw (std::runtime_error)
 
void createReadStatement () throw (std::runtime_error)
 
void setPrefetchRowCount (int ncount) throw (std::runtime_error)
 
void terminateReadStatement () throw (std::runtime_error)
 
void terminateWriteStatement () throw (std::runtime_error)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const throw (std::runtime_error)
 
- 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 12 of file DCULVRBTempsDat.h.

Constructor & Destructor Documentation

DCULVRBTempsDat::DCULVRBTempsDat ( )

Definition at line 12 of file DCULVRBTempsDat.cc.

References NULL.

13 {
14  m_env = NULL;
15  m_conn = NULL;
16  m_writeStmt = NULL;
17  m_readStmt = NULL;
18 
19  m_t1 = 0;
20  m_t2 = 0;
21  m_t3 = 0;
22 }
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
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
DCULVRBTempsDat::~DCULVRBTempsDat ( )

Definition at line 26 of file DCULVRBTempsDat.cc.

27 {
28 }

Member Function Documentation

void DCULVRBTempsDat::fetchData ( std::map< EcalLogicID, DCULVRBTempsDat > *  fillVec,
DCUIOV iov 
)
throw (std::runtime_error
)
private

Definition at line 78 of file DCULVRBTempsDat.cc.

References dat, alignCSCRings::e, o2o::iov, AlCaHLTBitMon_ParallelJobs::p, setT1(), setT2(), and setT3().

80 {
81  this->checkConnection();
82  fillMap->clear();
83 
84  iov->setConnection(m_env, m_conn);
85  int iovID = iov->fetchID();
86  if (!iovID) {
87  // throw(std::runtime_error("DCULVRBTempsDat::writeDB: IOV not in DB"));
88  return;
89  }
90 
91  try {
92 
93  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
94  "d.t1, d.t2, d.t3 "
95  "FROM channelview cv JOIN dcu_lvrb_temps_dat d "
96  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
97  "WHERE d.iov_id = :iov_id");
98  m_readStmt->setInt(1, iovID);
99  ResultSet* rset = m_readStmt->executeQuery();
100 
101  std::pair< EcalLogicID, DCULVRBTempsDat > p;
103  while(rset->next()) {
104  p.first = EcalLogicID( rset->getString(1), // name
105  rset->getInt(2), // logic_id
106  rset->getInt(3), // id1
107  rset->getInt(4), // id2
108  rset->getInt(5), // id3
109  rset->getString(6)); // maps_to
110 
111  dat.setT1( rset->getFloat(7) );
112  dat.setT2( rset->getFloat(8) );
113  dat.setT3( rset->getFloat(9) );
114 
115  p.second = dat;
116  fillMap->insert(p);
117  }
118  } catch (SQLException &e) {
119  throw(std::runtime_error("DCULVRBTempsDat::fetchData(): "+e.getMessage()));
120  }
121 }
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:27
int fetchID()
Definition: DCUIOV.cc:79
void setT1(float temp)
void setT3(float temp)
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
static std::vector< std::string > checklist dat
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void setT2(float temp)
void checkConnection() const
Definition: IDBObject.h:41
float DCULVRBTempsDat::getT1 ( ) const
inline

Definition at line 22 of file DCULVRBTempsDat.h.

References m_t1.

Referenced by writeArrayDB().

22 { return m_t1; }
float DCULVRBTempsDat::getT2 ( ) const
inline

Definition at line 25 of file DCULVRBTempsDat.h.

References m_t2.

Referenced by writeArrayDB().

25 { return m_t2; }
float DCULVRBTempsDat::getT3 ( ) const
inline

Definition at line 28 of file DCULVRBTempsDat.h.

References m_t3.

Referenced by writeArrayDB().

28 { return m_t3; }
std::string DCULVRBTempsDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 19 of file DCULVRBTempsDat.h.

19 { return "DCU_LVRB_TEMPS_DAT"; }
void DCULVRBTempsDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 32 of file DCULVRBTempsDat.cc.

References alignCSCRings::e.

34 {
35  this->checkConnection();
36 
37  try {
38  m_writeStmt = m_conn->createStatement();
39  m_writeStmt->setSQL("INSERT INTO dcu_lvrb_temps_dat (iov_id, logic_id, "
40  "t1, t2, t3) "
41  "VALUES (:iov_id, :logic_id, "
42  ":3, :4, :5)");
43  } catch (SQLException &e) {
44  throw(std::runtime_error("DCULVRBTempsDat::prepareWrite(): "+e.getMessage()));
45  }
46 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void checkConnection() const
Definition: IDBObject.h:41
void DCULVRBTempsDat::setT1 ( float  temp)
inline

Definition at line 21 of file DCULVRBTempsDat.h.

References m_t1, and groupFilesInBlocks::temp.

Referenced by fetchData().

void DCULVRBTempsDat::setT2 ( float  temp)
inline

Definition at line 24 of file DCULVRBTempsDat.h.

References m_t2, and groupFilesInBlocks::temp.

Referenced by fetchData().

void DCULVRBTempsDat::setT3 ( float  temp)
inline

Definition at line 27 of file DCULVRBTempsDat.h.

References m_t3, and groupFilesInBlocks::temp.

Referenced by fetchData().

void DCULVRBTempsDat::writeArrayDB ( const std::map< EcalLogicID, DCULVRBTempsDat > *  data,
DCUIOV iov 
)
throw (std::runtime_error
)
private

Definition at line 123 of file DCULVRBTempsDat.cc.

References prof2calltree::count, data, alignCSCRings::e, EcalLogicID::getLogicID(), getT1(), getT2(), getT3(), o2o::iov, AlCaHLTBitMon_ParallelJobs::p, x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

125 {
126  this->checkConnection();
127  this->checkPrepare();
128 
129  int iovID = iov->fetchID();
130  if (!iovID) { throw(std::runtime_error("DCULVRBTempsDat::writeArrayDB: IOV not in DB")); }
131 
132 
133  int nrows=data->size();
134  int* ids= new int[nrows];
135  int* iovid_vec= new int[nrows];
136  float* xx= new float[nrows];
137  float* yy= new float[nrows];
138  float* zz= new float[nrows];
139 
140  ub2* ids_len= new ub2[nrows];
141  ub2* iov_len= new ub2[nrows];
142  ub2* x_len= new ub2[nrows];
143  ub2* y_len= new ub2[nrows];
144  ub2* z_len= new ub2[nrows];
145 
146 
147  const EcalLogicID* channel;
148  const DCULVRBTempsDat* dataitem;
149  int count=0;
150  typedef map< EcalLogicID, DCULVRBTempsDat >::const_iterator CI;
151  for (CI p = data->begin(); p != data->end(); ++p) {
152  channel = &(p->first);
153  int logicID = channel->getLogicID();
154  if (!logicID) { throw(std::runtime_error("DCULVRBTempsDat::writeArrayDB: Bad EcalLogicID")); }
155  ids[count]=logicID;
156  iovid_vec[count]=iovID;
157 
158  dataitem = &(p->second);
159  // dataIface.writeDB( channel, dataitem, iov);
160  float x=dataitem->getT1();
161  float y=dataitem->getT2();
162  float z=dataitem->getT3();
163 
164 
165 
166  xx[count]=x;
167  yy[count]=y;
168  zz[count]=z;
169 
170 
171  ids_len[count]=sizeof(ids[count]);
172  iov_len[count]=sizeof(iovid_vec[count]);
173 
174  x_len[count]=sizeof(xx[count]);
175  y_len[count]=sizeof(yy[count]);
176  z_len[count]=sizeof(zz[count]);
177 
178 
179  count++;
180  }
181 
182 
183  try {
184  m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]),iov_len);
185  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
186  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT , sizeof(xx[0]), x_len );
187  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len );
188  m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len );
189 
190 
191  m_writeStmt->executeArrayUpdate(nrows);
192 
193  delete [] ids;
194  delete [] iovid_vec;
195  delete [] xx;
196  delete [] yy;
197  delete [] zz;
198 
199  delete [] ids_len;
200  delete [] iov_len;
201  delete [] x_len;
202  delete [] y_len;
203  delete [] z_len;
204 
205 
206  } catch (SQLException &e) {
207  throw(std::runtime_error("DCULVRBTempsDat::writeArrayDB(): "+e.getMessage()));
208  }
209 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
float getT2() const
float getT1() const
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
float float float z
int fetchID()
Definition: DCUIOV.cc:79
int getLogicID() const
Definition: EcalLogicID.cc:41
void checkPrepare()
Definition: IDataItem.h:31
float getT3() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
Definition: DDAxes.h:10
void checkConnection() const
Definition: IDBObject.h:41
void DCULVRBTempsDat::writeDB ( const EcalLogicID ecid,
const DCULVRBTempsDat item,
DCUIOV iov 
)
throw (std::runtime_error
)
private

Definition at line 50 of file DCULVRBTempsDat.cc.

References alignCSCRings::e, and o2o::iov.

52 {
53  this->checkConnection();
54  this->checkPrepare();
55 
56  int iovID = iov->fetchID();
57  if (!iovID) { throw(std::runtime_error("DCULVRBTempsDat::writeDB: IOV not in DB")); }
58 
59  int logicID = ecid->getLogicID();
60  if (!logicID) { throw(std::runtime_error("DCULVRBTempsDat::writeDB: Bad EcalLogicID")); }
61 
62  try {
63  m_writeStmt->setInt(1, iovID);
64  m_writeStmt->setInt(2, logicID);
65 
66  m_writeStmt->setFloat(3, item->getT1() );
67  m_writeStmt->setFloat(4, item->getT2() );
68  m_writeStmt->setFloat(5, item->getT3() );
69 
70  m_writeStmt->executeUpdate();
71  } catch (SQLException &e) {
72  throw(std::runtime_error("DCULVRBTempsDat::writeDB(): "+e.getMessage()));
73  }
74 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
float getT2() const
float getT1() const
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
int fetchID()
Definition: DCUIOV.cc:79
int getLogicID() const
Definition: EcalLogicID.cc:41
void checkPrepare()
Definition: IDataItem.h:31
float getT3() const
void checkConnection() const
Definition: IDBObject.h:41

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file DCULVRBTempsDat.h.

Member Data Documentation

float DCULVRBTempsDat::m_t1
private

Definition at line 45 of file DCULVRBTempsDat.h.

Referenced by getT1(), and setT1().

float DCULVRBTempsDat::m_t2
private

Definition at line 46 of file DCULVRBTempsDat.h.

Referenced by getT2(), and setT2().

float DCULVRBTempsDat::m_t3
private

Definition at line 47 of file DCULVRBTempsDat.h.

Referenced by getT3(), and setT3().