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
ODGolBiasCurrentDat Class Reference

#include <ODGolBiasCurrentDat.h>

Inheritance diagram for ODGolBiasCurrentDat:
IODConfig IDBObject

Public Member Functions

int getCurrent () const
 
int getFedId () const
 
int getGolId () const
 
int getId () const
 
int getPLLCurrent () const
 
int getStatus () const
 
std::string getTable ()
 
int getTTId () const
 
 ODGolBiasCurrentDat ()
 
void setCurrent (int dac)
 
void setFedId (int dac)
 
void setGolId (int dac)
 
void setId (int dac)
 
void setPLLCurrent (int x)
 
void setStatus (int dac)
 
void setTTId (int dac)
 
 ~ODGolBiasCurrentDat ()
 
- Public Member Functions inherited from IODConfig
std::string getConfigTag ()
 
void setConfigTag (std::string x)
 
- 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::vector< ODGolBiasCurrentDat > *fillMap, ODGolBiasCurrentInfo *iov) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::vector< ODGolBiasCurrentDat > &data, ODGolBiasCurrentInfo *iov) throw (std::runtime_error)
 
void writeDB (const ODGolBiasCurrentDat *item, ODGolBiasCurrentInfo *iov) throw (std::runtime_error)
 

Private Attributes

int m_cur
 
int m_fed
 
int m_gol
 
int m_ID
 
int m_pll_cur
 
int m_sta
 
int m_tt
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Public Types inherited from IODConfig
typedef oracle::occi::Clob Clob
 
typedef oracle::occi::SQLException SQLException
 
typedef oracle::occi::Statement Statement
 
typedef oracle::occi::Stream Stream
 
- Public Attributes inherited from IODConfig
std::string m_config_tag
 
- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS =1024
 
- Protected Member Functions inherited from IODConfig
void checkPrepare () throw (std::runtime_error)
 
void createReadStatement () throw (std::runtime_error)
 
void populateClob (Clob &clob, std::string fname, unsigned int bufsize) throw (std::runtime_error)
 
unsigned char * readClob (Clob &clob, int size) 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 IODConfig
Statementm_readStmt
 
Statementm_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 11 of file ODGolBiasCurrentDat.h.

Constructor & Destructor Documentation

ODGolBiasCurrentDat::ODGolBiasCurrentDat ( )

Definition at line 10 of file ODGolBiasCurrentDat.cc.

References NULL.

11 {
12  m_env = NULL;
13  m_conn = NULL;
14  m_writeStmt = NULL;
15  m_readStmt = NULL;
16 
17 
18  m_gol = 0;
19  m_fed = 0;
20  m_tt = 0;
21  m_cur = 0;
22  m_pll_cur=0;
23  m_sta=0;
24 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
Statement * m_writeStmt
Definition: IODConfig.h:36
#define NULL
Definition: scimark2.h:8
Statement * m_readStmt
Definition: IODConfig.h:37
ODGolBiasCurrentDat::~ODGolBiasCurrentDat ( )

Definition at line 28 of file ODGolBiasCurrentDat.cc.

29 {
30 }

Member Function Documentation

void ODGolBiasCurrentDat::fetchData ( std::vector< ODGolBiasCurrentDat > *  fillMap,
ODGolBiasCurrentInfo iov 
)
throw (std::runtime_error
)
private

Definition at line 73 of file ODGolBiasCurrentDat.cc.

References gather_cfg::cout, alignCSCRings::e, o2o::iov, AlCaHLTBitMon_ParallelJobs::p, setCurrent(), setFedId(), setGolId(), setPLLCurrent(), setStatus(), and setTTId().

75 {
76  this->checkConnection();
77 
78  iov->setConnection(m_env, m_conn);
79  int iovID = iov->fetchID();
80  if (!iovID) {
81  std::cout <<"ID not in the DB"<< endl;
82  return;
83  }
84 
85  try {
86  m_readStmt->setSQL("SELECT * FROM " + getTable() + " WHERE rec_id = :rec_id order by fed_id, tt_id, gol_id ");
87  m_readStmt->setInt(1, iovID);
88  ResultSet* rset = m_readStmt->executeQuery();
89 
90  // std::vector< ODGolBiasCurrentDat > p;
92  while(rset->next()) {
93  // dat.setId( rset->getInt(1) );
94  dat.setFedId( rset->getInt(2) );
95  dat.setTTId( rset->getInt(3) );
96  dat.setGolId( rset->getInt(4) );
97  dat.setCurrent( rset->getInt(5) );
98  dat.setPLLCurrent( rset->getInt(6) );
99  dat.setStatus( rset->getInt(7) );
100 
101  p->push_back( dat);
102 
103  }
104 
105 
106  } catch (SQLException &e) {
107  throw(std::runtime_error("ODGolBiasCurrentDat::fetchData(): "+e.getMessage()));
108  }
109 }
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
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
Statement * m_readStmt
Definition: IODConfig.h:37
tuple cout
Definition: gather_cfg.py:121
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void checkConnection() const
Definition: IDBObject.h:41
int ODGolBiasCurrentDat::getCurrent ( ) const
inline

Definition at line 33 of file ODGolBiasCurrentDat.h.

References m_cur.

Referenced by writeArrayDB().

33 { return m_cur; }
int ODGolBiasCurrentDat::getFedId ( ) const
inline

Definition at line 27 of file ODGolBiasCurrentDat.h.

References m_fed.

Referenced by writeArrayDB().

27 { return m_fed; }
int ODGolBiasCurrentDat::getGolId ( ) const
inline

Definition at line 24 of file ODGolBiasCurrentDat.h.

References m_gol.

Referenced by writeArrayDB().

24 { return m_gol; }
int ODGolBiasCurrentDat::getId ( ) const
inline

Definition at line 21 of file ODGolBiasCurrentDat.h.

References m_ID.

21 { return m_ID; }
int ODGolBiasCurrentDat::getPLLCurrent ( ) const
inline

Definition at line 36 of file ODGolBiasCurrentDat.h.

References m_pll_cur.

Referenced by writeArrayDB().

36 { return m_pll_cur; }
int ODGolBiasCurrentDat::getStatus ( void  ) const
inline

Definition at line 39 of file ODGolBiasCurrentDat.h.

References m_sta.

Referenced by writeArrayDB().

39 { return m_sta; }
std::string ODGolBiasCurrentDat::getTable ( )
inlinevirtual

Implements IODConfig.

Definition at line 18 of file ODGolBiasCurrentDat.h.

18 { return "GOL_BIAS_CURRENT_DAT"; }
int ODGolBiasCurrentDat::getTTId ( ) const
inline

Definition at line 30 of file ODGolBiasCurrentDat.h.

References m_tt.

Referenced by writeArrayDB().

30 { return m_tt; }
void ODGolBiasCurrentDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IODConfig.

Definition at line 34 of file ODGolBiasCurrentDat.cc.

References alignCSCRings::e.

36 {
37  this->checkConnection();
38 
39  try {
40  m_writeStmt = m_conn->createStatement();
41  m_writeStmt->setSQL("INSERT INTO "+getTable()+" (rec_id, fed_id, tt_id, gol_id, gol_current, pll_current, status ) "
42  "VALUES (:1, :2, :3, :4, :5 , :6, :7)");
43  } catch (SQLException &e) {
44  throw(std::runtime_error("ODGolBiasCurrentDat::prepareWrite(): "+e.getMessage()));
45  }
46 }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
Statement * m_writeStmt
Definition: IODConfig.h:36
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void checkConnection() const
Definition: IDBObject.h:41
void ODGolBiasCurrentDat::setCurrent ( int  dac)
inline

Definition at line 32 of file ODGolBiasCurrentDat.h.

References m_cur.

Referenced by fetchData().

32 { m_cur = dac; }
void ODGolBiasCurrentDat::setFedId ( int  dac)
inline

Definition at line 26 of file ODGolBiasCurrentDat.h.

References m_fed.

Referenced by fetchData().

26 { m_fed = dac; }
void ODGolBiasCurrentDat::setGolId ( int  dac)
inline

Definition at line 23 of file ODGolBiasCurrentDat.h.

References m_gol.

Referenced by fetchData().

23 { m_gol = dac; }
void ODGolBiasCurrentDat::setId ( int  dac)
inline

Definition at line 20 of file ODGolBiasCurrentDat.h.

References m_ID.

20 { m_ID = dac; }
void ODGolBiasCurrentDat::setPLLCurrent ( int  x)
inline

Definition at line 35 of file ODGolBiasCurrentDat.h.

References m_pll_cur, and x.

Referenced by fetchData().

void ODGolBiasCurrentDat::setStatus ( int  dac)
inline

Definition at line 38 of file ODGolBiasCurrentDat.h.

References m_sta.

Referenced by fetchData().

38 { m_sta = dac; }
void ODGolBiasCurrentDat::setTTId ( int  dac)
inline

Definition at line 29 of file ODGolBiasCurrentDat.h.

References m_tt.

Referenced by fetchData().

29 { m_tt = dac; }
void ODGolBiasCurrentDat::writeArrayDB ( const std::vector< ODGolBiasCurrentDat > &  data,
ODGolBiasCurrentInfo iov 
)
throw (std::runtime_error
)
private

Definition at line 113 of file ODGolBiasCurrentDat.cc.

References prof2calltree::count, AlCaHLTBitMon_QueryRunRegistry::data, alignCSCRings::e, getCurrent(), getFedId(), getGolId(), getPLLCurrent(), getStatus(), getTTId(), o2o::iov, and GetRecoTauVFromDQM_MC_cff::kk.

115 {
116  this->checkConnection();
117 
118  int iovID = iov->fetchID();
119  if (!iovID) { throw(std::runtime_error("ODDelays::writeArrayDB: ODFEDelaysInfo not in DB")); }
120 
121 
122  int nrows=data.size();
123  int* ids= new int[nrows];
124  int* xx= new int[nrows];
125  int* yy= new int[nrows];
126  int* zz= new int[nrows];
127  int* ww= new int[nrows];
128  int* kk= new int[nrows];
129  int* st= new int[nrows];
130 
131 
132 
133  ub2* ids_len= new ub2[nrows];
134  ub2* x_len= new ub2[nrows];
135  ub2* y_len= new ub2[nrows];
136  ub2* z_len= new ub2[nrows];
137  ub2* w_len= new ub2[nrows];
138  ub2* k_len= new ub2[nrows];
139  ub2* st_len= new ub2[nrows];
140 
141  ODGolBiasCurrentDat dataitem;
142 
143 
144  for (int count = 0; count != (int)data.size(); count++) {
145  dataitem=data[count];
146  ids[count]=iovID;
147  xx[count]=dataitem.getFedId();
148  yy[count]=dataitem.getTTId();
149  zz[count]=dataitem.getGolId();
150  ww[count]=dataitem.getCurrent();
151  kk[count]=dataitem.getPLLCurrent();
152  st[count]=dataitem.getStatus();
153 
154 
155  ids_len[count]=sizeof(ids[count]);
156  x_len[count]=sizeof(xx[count]);
157  y_len[count]=sizeof(yy[count]);
158  z_len[count]=sizeof(zz[count]);
159  w_len[count]=sizeof(ww[count]);
160  k_len[count]=sizeof(kk[count]);
161  st_len[count]=sizeof(st[count]);
162 
163 
164  }
165 
166 
167  try {
168  m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT, sizeof(ids[0]),ids_len);
169  m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len );
170  m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len );
171  m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT , sizeof(zz[0]), z_len );
172  m_writeStmt->setDataBuffer(5, (dvoid*)ww, OCCIINT , sizeof(ww[0]), w_len );
173  m_writeStmt->setDataBuffer(6, (dvoid*)kk, OCCIINT , sizeof(kk[0]), k_len );
174  m_writeStmt->setDataBuffer(7, (dvoid*)st, OCCIINT , sizeof(st[0]), st_len );
175 
176 
177  m_writeStmt->executeArrayUpdate(nrows);
178 
179  delete [] ids;
180  delete [] xx;
181  delete [] yy;
182  delete [] zz;
183  delete [] ww;
184  delete [] kk;
185  delete [] st;
186 
187  delete [] ids_len;
188  delete [] x_len;
189  delete [] y_len;
190  delete [] z_len;
191  delete [] w_len;
192  delete [] k_len;
193  delete [] st_len;
194 
195 
196  } catch (SQLException &e) {
197  throw(std::runtime_error("ODGolBiasCurrentDat::writeArrayDB(): "+e.getMessage()));
198  }
199 }
Statement * m_writeStmt
Definition: IODConfig.h:36
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void checkConnection() const
Definition: IDBObject.h:41
void ODGolBiasCurrentDat::writeDB ( const ODGolBiasCurrentDat item,
ODGolBiasCurrentInfo iov 
)
throw (std::runtime_error
)
private

Definition at line 50 of file ODGolBiasCurrentDat.cc.

References alignCSCRings::e.

52 {
53  this->checkConnection();
54 
55  try {
56  m_writeStmt->setInt(1, item->getId());
57  m_writeStmt->setInt(2, item->getFedId() );
58  m_writeStmt->setInt(3, item->getTTId() );
59  m_writeStmt->setInt(4, item->getGolId() );
60  m_writeStmt->setInt(5, item->getCurrent() );
61  m_writeStmt->setInt(6, item->getPLLCurrent() );
62  m_writeStmt->setInt(7, item->getStatus() );
63 
64 
65  m_writeStmt->executeUpdate();
66  } catch (SQLException &e) {
67  throw(std::runtime_error("ODGolBiasCurrentDat::writeDB(): "+e.getMessage()));
68  }
69 }
Statement * m_writeStmt
Definition: IODConfig.h:36
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void checkConnection() const
Definition: IDBObject.h:41

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file ODGolBiasCurrentDat.h.

Member Data Documentation

int ODGolBiasCurrentDat::m_cur
private

Definition at line 60 of file ODGolBiasCurrentDat.h.

Referenced by getCurrent(), and setCurrent().

int ODGolBiasCurrentDat::m_fed
private

Definition at line 58 of file ODGolBiasCurrentDat.h.

Referenced by getFedId(), and setFedId().

int ODGolBiasCurrentDat::m_gol
private

Definition at line 57 of file ODGolBiasCurrentDat.h.

Referenced by getGolId(), and setGolId().

int ODGolBiasCurrentDat::m_ID
private

Definition at line 63 of file ODGolBiasCurrentDat.h.

Referenced by getId(), and setId().

int ODGolBiasCurrentDat::m_pll_cur
private

Definition at line 61 of file ODGolBiasCurrentDat.h.

Referenced by getPLLCurrent(), and setPLLCurrent().

int ODGolBiasCurrentDat::m_sta
private

Definition at line 62 of file ODGolBiasCurrentDat.h.

Referenced by getStatus(), and setStatus().

int ODGolBiasCurrentDat::m_tt
private

Definition at line 59 of file ODGolBiasCurrentDat.h.

Referenced by getTTId(), and setTTId().