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

#include <FEConfigLUTParamDat.h>

Inheritance diagram for FEConfigLUTParamDat:
IDataItem IDBObject

Public Member Functions

 FEConfigLUTParamDat ()
 
float getETSat () const
 
std::string getTable ()
 
float getTTThreshhigh () const
 
float getTTThreshlow () const
 
void setETSat (float x)
 
void setTTThreshhigh (float x)
 
void setTTThreshlow (float x)
 
 ~FEConfigLUTParamDat ()
 
- 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, FEConfigLUTParamDat > *fillMap, FEConfigLUTInfo *iconf) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigLUTParamDat > *data, FEConfigLUTInfo *iconf) throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const FEConfigLUTParamDat *item, FEConfigLUTInfo *iconf) throw (std::runtime_error)
 

Private Attributes

float m_etsat
 
float m_tthreshhigh
 
float m_tthreshlow
 

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

Constructor & Destructor Documentation

FEConfigLUTParamDat::FEConfigLUTParamDat ( )

Definition at line 11 of file FEConfigLUTParamDat.cc.

References NULL.

12 {
13  m_env = NULL;
14  m_conn = NULL;
15  m_writeStmt = NULL;
16  m_readStmt = NULL;
17 
18  m_etsat = 0;
19  m_tthreshlow = 0;
20  m_tthreshhigh = 0;
21 
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
FEConfigLUTParamDat::~FEConfigLUTParamDat ( )

Definition at line 26 of file FEConfigLUTParamDat.cc.

27 {
28 }

Member Function Documentation

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

Definition at line 77 of file FEConfigLUTParamDat.cc.

References alignCSCRings::e, AlCaHLTBitMon_ParallelJobs::p, setETSat(), setTTThreshhigh(), and setTTThreshlow().

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

Definition at line 27 of file FEConfigLUTParamDat.h.

References m_etsat.

Referenced by popcon::EcalTPGPhysicsConstHandler::getNewObjects(), and writeArrayDB().

27 { return m_etsat; }
std::string FEConfigLUTParamDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigLUTParamDat.h.

18 { return "FE_CONFIG_LUTPARAM_DAT"; }
float FEConfigLUTParamDat::getTTThreshhigh ( ) const
inline

Definition at line 29 of file FEConfigLUTParamDat.h.

References m_tthreshhigh.

Referenced by popcon::EcalTPGPhysicsConstHandler::getNewObjects(), and writeArrayDB().

29 { return m_tthreshhigh; }
float FEConfigLUTParamDat::getTTThreshlow ( ) const
inline

Definition at line 28 of file FEConfigLUTParamDat.h.

References m_tthreshlow.

Referenced by popcon::EcalTPGPhysicsConstHandler::getNewObjects(), and writeArrayDB().

28 { return m_tthreshlow; }
void FEConfigLUTParamDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 32 of file FEConfigLUTParamDat.cc.

References alignCSCRings::e.

34 {
35  this->checkConnection();
36 
37  try {
38  m_writeStmt = m_conn->createStatement();
39  m_writeStmt->setSQL("INSERT INTO "+getTable()+" (lut_conf_id, logic_id, "
40  " etsat, ttthreshlow, ttthreshhigh ) "
41  "VALUES (:lut_conf_id, :logic_id, "
42  ":etsat, :ttthreshlow, :ttthreshhigh )" );
43  } catch (SQLException &e) {
44  throw(std::runtime_error("FEConfigLUTParamDat::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 FEConfigLUTParamDat::setETSat ( float  x)
inline

Definition at line 21 of file FEConfigLUTParamDat.h.

References m_etsat, and x.

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

void FEConfigLUTParamDat::setTTThreshhigh ( float  x)
inline

Definition at line 23 of file FEConfigLUTParamDat.h.

References m_tthreshhigh, and x.

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

void FEConfigLUTParamDat::setTTThreshlow ( float  x)
inline

Definition at line 22 of file FEConfigLUTParamDat.h.

References m_tthreshlow, and x.

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

void FEConfigLUTParamDat::writeArrayDB ( const std::map< EcalLogicID, FEConfigLUTParamDat > *  data,
FEConfigLUTInfo iconf 
)
throw (std::runtime_error
)
private

Definition at line 124 of file FEConfigLUTParamDat.cc.

References prof2calltree::count, data, alignCSCRings::e, getETSat(), EcalLogicID::getLogicID(), getTTThreshhigh(), getTTThreshlow(), AlCaHLTBitMon_ParallelJobs::p, x, y, and z.

126 {
127  this->checkConnection();
128  this->checkPrepare();
129 
130  int iconfID = iconf->fetchID();
131  if (!iconfID) { throw(std::runtime_error("FEConfigLUTParamDat::writeArrayDB: ICONF not in DB")); }
132 
133 
134  int nrows=data->size();
135  int* ids= new int[nrows];
136  int* iov_vec= new int[nrows];
137  float* xx= new float[nrows];
138  float* yy= new float[nrows];
139  float* zz= new float[nrows];
140 
141 
142  ub2* ids_len= new ub2[nrows];
143  ub2* iov_len= new ub2[nrows];
144  ub2* x_len= new ub2[nrows];
145  ub2* y_len= new ub2[nrows];
146  ub2* z_len= new ub2[nrows];
147 
148 
149  const EcalLogicID* channel;
150  const FEConfigLUTParamDat* dataitem;
151  int count=0;
152  typedef map< EcalLogicID, FEConfigLUTParamDat >::const_iterator CI;
153  for (CI p = data->begin(); p != data->end(); ++p) {
154  channel = &(p->first);
155  int logicID = channel->getLogicID();
156  if (!logicID) { throw(std::runtime_error("FEConfigLUTParamDat::writeArrayDB: Bad EcalLogicID")); }
157  ids[count]=logicID;
158  iov_vec[count]=iconfID;
159 
160  dataitem = &(p->second);
161  // dataIface.writeDB( channel, dataitem, conf);
162  float x=dataitem->getETSat();
163  float y=dataitem->getTTThreshlow();
164  float z=dataitem->getTTThreshhigh();
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(iov_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  count++;
179  }
180 
181 
182  try {
183  m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT, sizeof(iov_vec[0]),iov_len);
184  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
185  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT , sizeof(xx[0]), x_len );
186  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len );
187  m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len );
188 
189  m_writeStmt->executeArrayUpdate(nrows);
190 
191  delete [] ids;
192  delete [] iov_vec;
193  delete [] xx;
194  delete [] yy;
195  delete [] zz;
196 
197  delete [] ids_len;
198  delete [] iov_len;
199  delete [] x_len;
200  delete [] y_len;
201  delete [] z_len;
202 
203  } catch (SQLException &e) {
204  throw(std::runtime_error("FEConfigLUTParamDat::writeArrayDB(): "+e.getMessage()));
205  }
206 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
float getTTThreshhigh() const
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
float getTTThreshlow() const
int getLogicID() const
Definition: EcalLogicID.cc:41
void checkPrepare()
Definition: IDataItem.h:31
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void checkConnection() const
Definition: IDBObject.h:41
void FEConfigLUTParamDat::writeDB ( const EcalLogicID ecid,
const FEConfigLUTParamDat item,
FEConfigLUTInfo iconf 
)
throw (std::runtime_error
)
private

Definition at line 50 of file FEConfigLUTParamDat.cc.

References alignCSCRings::e.

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

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigLUTParamDat.h.

Member Data Documentation

float FEConfigLUTParamDat::m_etsat
private

Definition at line 47 of file FEConfigLUTParamDat.h.

Referenced by getETSat(), and setETSat().

float FEConfigLUTParamDat::m_tthreshhigh
private

Definition at line 49 of file FEConfigLUTParamDat.h.

Referenced by getTTThreshhigh(), and setTTThreshhigh().

float FEConfigLUTParamDat::m_tthreshlow
private

Definition at line 48 of file FEConfigLUTParamDat.h.

Referenced by getTTThreshlow(), and setTTThreshlow().