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

#include <FEConfigTimingDat.h>

Inheritance diagram for FEConfigTimingDat:
IDataItem IDBObject

Public Member Functions

 FEConfigTimingDat ()
 
std::string getTable ()
 
int getTimingPar1 () const
 
int getTimingPar2 () const
 
void setTimingPar1 (int x)
 
void setTimingPar2 (int x)
 
 ~FEConfigTimingDat ()
 
- 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, FEConfigTimingDat > *fillMap, FEConfigTimingInfo *iconf) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigTimingDat > *data, FEConfigTimingInfo *iconf) throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const FEConfigTimingDat *item, FEConfigTimingInfo *iconf) throw (std::runtime_error)
 

Private Attributes

int m_par1
 
int m_par2
 

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 11 of file FEConfigTimingDat.h.

Constructor & Destructor Documentation

FEConfigTimingDat::FEConfigTimingDat ( )

Definition at line 11 of file FEConfigTimingDat.cc.

References NULL.

12 {
13  m_env = NULL;
14  m_conn = NULL;
15  m_writeStmt = NULL;
16  m_readStmt = NULL;
17 
18  m_par1 = 0;
19  m_par2 = 0;
20 
21 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:24
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
#define NULL
Definition: scimark2.h:8
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:25
FEConfigTimingDat::~FEConfigTimingDat ( )

Definition at line 25 of file FEConfigTimingDat.cc.

26 {
27 }

Member Function Documentation

void FEConfigTimingDat::fetchData ( std::map< EcalLogicID, FEConfigTimingDat > *  fillMap,
FEConfigTimingInfo iconf 
)
throw (std::runtime_error
)
private

Definition at line 72 of file FEConfigTimingDat.cc.

References alignCSCRings::e, edm::pset::fillMap(), AlCaHLTBitMon_ParallelJobs::p, setTimingPar1(), and setTimingPar2().

74 {
75  this->checkConnection();
76  fillMap->clear();
77 
78  iconf->setConnection(m_env, m_conn);
79  int iconfID = iconf->fetchID();
80  if (!iconfID) {
81  return;
82  }
83 
84  try {
85 
86  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
87  "d.time_par1, d.time_par2 "
88  "FROM channelview cv JOIN " +getTable() + " d ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
89  "WHERE tim_conf_id = :tim_conf_id");
90  m_readStmt->setInt(1, iconfID);
91  ResultSet* rset = m_readStmt->executeQuery();
92 
93  std::pair< EcalLogicID, FEConfigTimingDat > p;
95  while(rset->next()) {
96  p.first = EcalLogicID( rset->getString(1), // name
97  rset->getInt(2), // logic_id
98  rset->getInt(3), // id1
99  rset->getInt(4), // id2
100  rset->getInt(5), // id3
101  rset->getString(6)); // maps_to
102 
103  dat.setTimingPar1( rset->getInt(7) );
104  dat.setTimingPar2( rset->getInt(8) );
105 
106  p.second = dat;
107  fillMap->insert(p);
108  }
109  } catch (SQLException &e) {
110  throw(std::runtime_error("FEConfigTimingDat::fetchData: "+e.getMessage()));
111  }
112 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setTimingPar2(int x)
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
void setTimingPar1(int x)
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:25
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:21
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void fillMap(Registry *reg, regmap_type &fillme)
Definition: Registry.cc:24
void checkConnection() const
Definition: IDBObject.h:41
std::string getTable()
std::string FEConfigTimingDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigTimingDat.h.

18 { return "FE_CONFIG_Time_DAT"; }
int FEConfigTimingDat::getTimingPar1 ( ) const
inline

Definition at line 21 of file FEConfigTimingDat.h.

References m_par1.

Referenced by writeArrayDB().

21 { return m_par1; }
int FEConfigTimingDat::getTimingPar2 ( ) const
inline

Definition at line 23 of file FEConfigTimingDat.h.

References m_par2.

Referenced by writeArrayDB().

23 { return m_par2; }
void FEConfigTimingDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 31 of file FEConfigTimingDat.cc.

References alignCSCRings::e.

33 {
34  this->checkConnection();
35 
36  try {
37  m_writeStmt = m_conn->createStatement();
38  m_writeStmt->setSQL("INSERT INTO "+getTable()+" (tim_conf_id, logic_id, "
39  "time_par1, time_par2 ) VALUES (:tim_conf_id, :logic_id, :time_par1, :time_par2 )" );
40  } catch (SQLException &e) {
41  throw(std::runtime_error("FEConfigTimingDat::prepareWrite(): "+e.getMessage()));
42  }
43 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:24
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
void checkConnection() const
Definition: IDBObject.h:41
std::string getTable()
void FEConfigTimingDat::setTimingPar1 ( int  x)
inline

Definition at line 20 of file FEConfigTimingDat.h.

References m_par1, and vdt::x.

Referenced by EcalTPGParamBuilder::analyze(), and fetchData().

20 { m_par1 = x; }
x
Definition: VDTMath.h:216
void FEConfigTimingDat::setTimingPar2 ( int  x)
inline

Definition at line 22 of file FEConfigTimingDat.h.

References m_par2, and vdt::x.

Referenced by EcalTPGParamBuilder::analyze(), and fetchData().

22 { m_par2 = x; }
x
Definition: VDTMath.h:216
void FEConfigTimingDat::writeArrayDB ( const std::map< EcalLogicID, FEConfigTimingDat > *  data,
FEConfigTimingInfo iconf 
)
throw (std::runtime_error
)
private

Definition at line 114 of file FEConfigTimingDat.cc.

References prof2calltree::count, data, alignCSCRings::e, EcalLogicID::getLogicID(), getTimingPar1(), getTimingPar2(), AlCaHLTBitMon_ParallelJobs::p, vdt::x, and detailsBasic3DVector::y.

116 {
117  this->checkConnection();
118  this->checkPrepare();
119 
120  int iconfID = iconf->fetchID();
121  if (!iconfID) { throw(std::runtime_error("FEConfigTimingDat::writeArrayDB: tim_conf_id not in DB")); }
122 
123 
124  int nrows=data->size();
125  int* ids= new int[nrows];
126  int* iconfid_vec= new int[nrows];
127  int* xx= new int[nrows];
128  int* yy= new int[nrows];
129 
130  ub2* ids_len= new ub2[nrows];
131  ub2* iconf_len= new ub2[nrows];
132  ub2* x_len= new ub2[nrows];
133  ub2* y_len= new ub2[nrows];
134 
135  const EcalLogicID* channel;
136  const FEConfigTimingDat* dataitem;
137  int count=0;
138  typedef map< EcalLogicID, FEConfigTimingDat >::const_iterator CI;
139  for (CI p = data->begin(); p != data->end(); ++p) {
140  channel = &(p->first);
141  int logicID = channel->getLogicID();
142  if (!logicID) { throw(std::runtime_error("FEConfigTimingDat::writeArrayDB: Bad EcalLogicID")); }
143  ids[count]=logicID;
144  iconfid_vec[count]=iconfID;
145 
146  dataitem = &(p->second);
147  // dataIface.writeDB( channel, dataitem, iconf);
148  int x=dataitem->getTimingPar1();
149  int y=dataitem->getTimingPar2();
150 
151  xx[count]=x;
152  yy[count]=y;
153 
154  ids_len[count]=sizeof(ids[count]);
155  iconf_len[count]=sizeof(iconfid_vec[count]);
156 
157  x_len[count]=sizeof(xx[count]);
158  y_len[count]=sizeof(yy[count]);
159 
160  count++;
161  }
162 
163 
164  try {
165  m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len);
166  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
167  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len );
168  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len );
169 
170  m_writeStmt->executeArrayUpdate(nrows);
171 
172  delete [] ids;
173  delete [] iconfid_vec;
174  delete [] xx;
175  delete [] yy;
176 
177  delete [] ids_len;
178  delete [] iconf_len;
179  delete [] x_len;
180  delete [] y_len;
181 
182  } catch (SQLException &e) {
183  throw(std::runtime_error("FEConfigTimingDat::writeArrayDB(): "+e.getMessage()));
184  }
185 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:24
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
int getLogicID() const
Definition: EcalLogicID.cc:42
int getTimingPar2() const
int getTimingPar1() const
void checkPrepare()
Definition: IDataItem.h:27
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
x
Definition: VDTMath.h:216
void checkConnection() const
Definition: IDBObject.h:41
void FEConfigTimingDat::writeDB ( const EcalLogicID ecid,
const FEConfigTimingDat item,
FEConfigTimingInfo iconf 
)
throw (std::runtime_error
)
private

Definition at line 46 of file FEConfigTimingDat.cc.

References alignCSCRings::e.

48 {
49  this->checkConnection();
50  this->checkPrepare();
51 
52  int iconfID = iconf->fetchID();
53  if (!iconfID) { throw(std::runtime_error("FEConfigTimingDat::writeDB: ICONF not in DB")); }
54 
55  int logicID = ecid->getLogicID();
56  if (!logicID) { throw(std::runtime_error("FEConfigTimingDat::writeDB: Bad EcalLogicID")); }
57 
58  try {
59  m_writeStmt->setInt(1, iconfID);
60  m_writeStmt->setInt(2, logicID);
61  m_writeStmt->setInt(3, item->getTimingPar1());
62  m_writeStmt->setInt(4, item->getTimingPar2());
63 
64  m_writeStmt->executeUpdate();
65  } catch (SQLException &e) {
66  throw(std::runtime_error("FEConfigTimingDat::writeDB(): "+e.getMessage()));
67  }
68 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:24
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
int getLogicID() const
Definition: EcalLogicID.cc:42
int getTimingPar2() const
int getTimingPar1() const
void checkPrepare()
Definition: IDataItem.h:27
void checkConnection() const
Definition: IDBObject.h:41

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigTimingDat.h.

Member Data Documentation

int FEConfigTimingDat::m_par1
private

Definition at line 39 of file FEConfigTimingDat.h.

Referenced by getTimingPar1(), and setTimingPar1().

int FEConfigTimingDat::m_par2
private

Definition at line 40 of file FEConfigTimingDat.h.

Referenced by getTimingPar2(), and setTimingPar2().