test
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
ODVfeToRejectDat Class Reference

#include <ODVfeToRejectDat.h>

Inheritance diagram for ODVfeToRejectDat:
IODConfig IDBObject

Public Member Functions

int getFedId () const
 
int getGain () const
 
int getId () const
 
int getStatus () const
 
std::string getTable ()
 
int getTTId () const
 
int getVfeId () const
 
 ODVfeToRejectDat ()
 
void setFedId (int dac)
 
void setGain (int dac)
 
void setId (int dac)
 
void setStatus (int dac)
 
void setTTId (int dac)
 
void setVfeId (int dac)
 
 ~ODVfeToRejectDat ()
 
- 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< ODVfeToRejectDat > *fillMap, ODVfeToRejectInfo *iov) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::vector< ODVfeToRejectDat > &data, ODVfeToRejectInfo *iov) throw (std::runtime_error)
 
void writeDB (const ODVfeToRejectDat *item, ODVfeToRejectInfo *iov) throw (std::runtime_error)
 

Private Attributes

int m_fed
 
int m_gain
 
int m_ID
 
int m_sta
 
int m_tt
 
int m_vfe
 

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 ODVfeToRejectDat.h.

Constructor & Destructor Documentation

ODVfeToRejectDat::ODVfeToRejectDat ( )

Definition at line 10 of file ODVfeToRejectDat.cc.

References NULL.

11 {
12  m_env = NULL;
13  m_conn = NULL;
14  m_writeStmt = NULL;
15  m_readStmt = NULL;
16 
17 
18  m_fed = 0;
19  m_tt = 0;
20  m_vfe = 0;
21  m_gain = 0;
22  m_sta = 0;
23 
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
ODVfeToRejectDat::~ODVfeToRejectDat ( )

Definition at line 28 of file ODVfeToRejectDat.cc.

29 {
30 }

Member Function Documentation

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

Definition at line 71 of file ODVfeToRejectDat.cc.

References gather_cfg::cout, alignCSCRings::e, o2o::iov, AlCaHLTBitMon_ParallelJobs::p, setFedId(), setGain(), setStatus(), setTTId(), and setVfeId().

73 {
74  this->checkConnection();
75 
76  iov->setConnection(m_env, m_conn);
77  int iovID = iov->fetchID();
78  if (!iovID) {
79  std::cout <<"ID not in the DB"<< endl;
80  return;
81  }
82 
83  try {
84  m_readStmt->setSQL("SELECT * FROM " + getTable() + " WHERE rec_id = :rec_id order by fed_id, tt_id, vfe_id ");
85  m_readStmt->setInt(1, iovID);
86  ResultSet* rset = m_readStmt->executeQuery();
87 
88  // std::vector< ODVfeToRejectDat > p;
89  ODVfeToRejectDat dat;
90  while(rset->next()) {
91  // dat.setId( rset->getInt(1) );
92  dat.setFedId( rset->getInt(2) );
93  dat.setTTId( rset->getInt(3) );
94  dat.setVfeId( rset->getInt(4) );
95  dat.setGain( rset->getInt(5) );
96  dat.setStatus( rset->getInt(6) );
97 
98  p->push_back( dat);
99 
100  }
101 
102 
103  } catch (SQLException &e) {
104  throw(std::runtime_error("ODVfeToRejectDat::fetchData(): "+e.getMessage()));
105  }
106 }
void setVfeId(int dac)
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setStatus(int dac)
void setTTId(int dac)
void setGain(int dac)
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void setFedId(int dac)
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
std::string getTable()
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 ODVfeToRejectDat::getFedId ( ) const
inline

Definition at line 24 of file ODVfeToRejectDat.h.

References m_fed.

Referenced by writeArrayDB().

24 { return m_fed; }
int ODVfeToRejectDat::getGain ( ) const
inline

Definition at line 33 of file ODVfeToRejectDat.h.

References m_gain.

Referenced by writeArrayDB().

33 { return m_gain; }
int ODVfeToRejectDat::getId ( ) const
inline

Definition at line 21 of file ODVfeToRejectDat.h.

References m_ID.

21 { return m_ID; }
int ODVfeToRejectDat::getStatus ( void  ) const
inline

Definition at line 36 of file ODVfeToRejectDat.h.

References m_sta.

Referenced by writeArrayDB().

36 { return m_sta; }
std::string ODVfeToRejectDat::getTable ( )
inlinevirtual

Implements IODConfig.

Definition at line 18 of file ODVfeToRejectDat.h.

18 { return "VFES_TO_REJECT_DAT"; }
int ODVfeToRejectDat::getTTId ( ) const
inline

Definition at line 27 of file ODVfeToRejectDat.h.

References m_tt.

Referenced by writeArrayDB().

27 { return m_tt; }
int ODVfeToRejectDat::getVfeId ( ) const
inline

Definition at line 30 of file ODVfeToRejectDat.h.

References m_vfe.

Referenced by writeArrayDB().

30 { return m_vfe; }
void ODVfeToRejectDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IODConfig.

Definition at line 34 of file ODVfeToRejectDat.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, vfe_id, GAIN, STATUS ) "
42  "VALUES (:1, :2, :3, :4, :5 , :6 )");
43  } catch (SQLException &e) {
44  throw(std::runtime_error("ODVfeToRejectDat::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
std::string getTable()
void checkConnection() const
Definition: IDBObject.h:41
void ODVfeToRejectDat::setFedId ( int  dac)
inline

Definition at line 23 of file ODVfeToRejectDat.h.

References m_fed.

Referenced by fetchData().

23 { m_fed = dac; }
void ODVfeToRejectDat::setGain ( int  dac)
inline

Definition at line 32 of file ODVfeToRejectDat.h.

References m_gain.

Referenced by fetchData().

32 { m_gain = dac; }
void ODVfeToRejectDat::setId ( int  dac)
inline

Definition at line 20 of file ODVfeToRejectDat.h.

References m_ID.

20 { m_ID = dac; }
void ODVfeToRejectDat::setStatus ( int  dac)
inline

Definition at line 35 of file ODVfeToRejectDat.h.

References m_sta.

Referenced by fetchData().

35 { m_sta = dac; }
void ODVfeToRejectDat::setTTId ( int  dac)
inline

Definition at line 26 of file ODVfeToRejectDat.h.

References m_tt.

Referenced by fetchData().

26 { m_tt = dac; }
void ODVfeToRejectDat::setVfeId ( int  dac)
inline

Definition at line 29 of file ODVfeToRejectDat.h.

References m_vfe.

Referenced by fetchData().

29 { m_vfe = dac; }
void ODVfeToRejectDat::writeArrayDB ( const std::vector< ODVfeToRejectDat > &  data,
ODVfeToRejectInfo iov 
)
throw (std::runtime_error
)
private

Definition at line 110 of file ODVfeToRejectDat.cc.

References prof2calltree::count, data, alignCSCRings::e, getFedId(), getGain(), getStatus(), getTTId(), getVfeId(), and o2o::iov.

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

Definition at line 50 of file ODVfeToRejectDat.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->getVfeId() );
60  m_writeStmt->setInt(5, item->getGain() );
61  m_writeStmt->setInt(6, item->getStatus() );
62 
63  m_writeStmt->executeUpdate();
64  } catch (SQLException &e) {
65  throw(std::runtime_error("ODVfeToRejectDat::writeDB(): "+e.getMessage()));
66  }
67 }
int getFedId() const
Statement * m_writeStmt
Definition: IODConfig.h:36
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
int getStatus() const
int getGain() const
int getVfeId() const
int getId() const
int getTTId() const
void checkConnection() const
Definition: IDBObject.h:41

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file ODVfeToRejectDat.h.

Member Data Documentation

int ODVfeToRejectDat::m_fed
private

Definition at line 55 of file ODVfeToRejectDat.h.

Referenced by getFedId(), and setFedId().

int ODVfeToRejectDat::m_gain
private

Definition at line 58 of file ODVfeToRejectDat.h.

Referenced by getGain(), and setGain().

int ODVfeToRejectDat::m_ID
private

Definition at line 60 of file ODVfeToRejectDat.h.

Referenced by getId(), and setId().

int ODVfeToRejectDat::m_sta
private

Definition at line 59 of file ODVfeToRejectDat.h.

Referenced by getStatus(), and setStatus().

int ODVfeToRejectDat::m_tt
private

Definition at line 56 of file ODVfeToRejectDat.h.

Referenced by getTTId(), and setTTId().

int ODVfeToRejectDat::m_vfe
private

Definition at line 57 of file ODVfeToRejectDat.h.

Referenced by getVfeId(), and setVfeId().