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

#include <FEConfigFgrGroupDat.h>

Inheritance diagram for FEConfigFgrGroupDat:
IDataItem IDBObject

Public Member Functions

 FEConfigFgrGroupDat ()
 
int getFgrGroupId () const
 
int getLUTValue () const
 
float getRatioHigh () const
 
float getRatioLow () const
 
std::string getTable ()
 
float getThreshHigh () const
 
float getThreshLow () const
 
void setFgrGroupId (int x)
 
void setLUTValue (int x)
 
void setRatioHigh (float x)
 
void setRatioLow (float x)
 
void setThreshHigh (float x)
 
void setThreshLow (float x)
 
 ~FEConfigFgrGroupDat ()
 
- 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, FEConfigFgrGroupDat > *fillMap, FEConfigFgrInfo *iconf) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigFgrGroupDat > *data, FEConfigFgrInfo *iconf) throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const FEConfigFgrGroupDat *item, FEConfigFgrInfo *iconf) throw (std::runtime_error)
 

Private Attributes

int m_group_id
 
int m_lut
 
float m_ratio_high
 
float m_ratio_low
 
float m_thresh_high
 
float m_thresh_low
 

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

Constructor & Destructor Documentation

FEConfigFgrGroupDat::FEConfigFgrGroupDat ( )

Definition at line 11 of file FEConfigFgrGroupDat.cc.

References NULL.

12 {
13  m_env = NULL;
14  m_conn = NULL;
15  m_writeStmt = NULL;
16  m_readStmt = NULL;
17 
18  m_group_id=0;
19  m_thresh_low = 0;
20  m_thresh_high = 0;
21  m_ratio_low = 0;
22  m_ratio_high = 0;
23  m_lut = 0;
24 
25 }
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
FEConfigFgrGroupDat::~FEConfigFgrGroupDat ( )

Definition at line 29 of file FEConfigFgrGroupDat.cc.

30 {
31 }

Member Function Documentation

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

Definition at line 84 of file FEConfigFgrGroupDat.cc.

References dat, alignCSCRings::e, AlCaHLTBitMon_ParallelJobs::p, setFgrGroupId(), setLUTValue(), setRatioHigh(), setRatioLow(), setThreshHigh(), and setThreshLow().

86 {
87  this->checkConnection();
88  fillMap->clear();
89 
90  iconf->setConnection(m_env, m_conn);
91  int iconfID = iconf->fetchID();
92  if (!iconfID) {
93  throw(std::runtime_error("FEConfigFgrGroupDat::fetchData: ICONF not in DB"));
94  return;
95  }
96 
97  try {
98 
99  m_readStmt->setSQL("SELECT d.group_id, d.threshold_low, d.threshold_high, d.ratio_low, d.ratio_high, d.lut_value "
100  "FROM fe_fgr_per_group_dat d "
101  "WHERE fgr_conf_id = :fgr_conf_id order by d.group_id ");
102  m_readStmt->setInt(1, iconfID);
103  ResultSet* rset = m_readStmt->executeQuery();
104 
105  std::pair< EcalLogicID, FEConfigFgrGroupDat > p;
107  int ig=-1;
108  while(rset->next()) {
109  ig++; // we create a dummy logic_id
110  p.first = EcalLogicID( "Group_id", // name
111  ig ); // logic_id
112 
113  dat.setFgrGroupId( rset->getInt(1) );
114  dat.setThreshLow( rset->getFloat(2) );
115  dat.setThreshHigh( rset->getFloat(3) );
116  dat.setRatioLow( rset->getFloat(4) );
117  dat.setRatioHigh( rset->getFloat(5) );
118  dat.setLUTValue( rset->getInt(6) );
119 
120  p.second = dat;
121  fillMap->insert(p);
122  }
123  } catch (SQLException &e) {
124  throw(std::runtime_error("FEConfigFgrGroupDat::fetchData: "+e.getMessage()));
125  }
126 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setThreshLow(float x)
void setRatioHigh(float x)
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void setThreshHigh(float x)
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 checkConnection() const
Definition: IDBObject.h:41
int FEConfigFgrGroupDat::getFgrGroupId ( ) const
inline
int FEConfigFgrGroupDat::getLUTValue ( ) const
inline

Definition at line 32 of file FEConfigFgrGroupDat.h.

References m_lut.

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

32 { return m_lut; }
float FEConfigFgrGroupDat::getRatioHigh ( ) const
inline
float FEConfigFgrGroupDat::getRatioLow ( ) const
inline
std::string FEConfigFgrGroupDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigFgrGroupDat.h.

18 { return "FE_CONFIG_FGR_PER_GROUP_DAT"; }
float FEConfigFgrGroupDat::getThreshHigh ( ) const
inline
float FEConfigFgrGroupDat::getThreshLow ( ) const
inline
void FEConfigFgrGroupDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 35 of file FEConfigFgrGroupDat.cc.

References alignCSCRings::e.

37 {
38  this->checkConnection();
39 
40  try {
41  m_writeStmt = m_conn->createStatement();
42  m_writeStmt->setSQL("INSERT INTO fe_fgr_per_group_dat (fgr_conf_id, group_id, "
43  " threshold_low, threshold_high, ratio_low, ratio_high, lut_value ) "
44  "VALUES (:fgr_conf_id, :group_id, "
45  ":3, :4, :5, :6, :7 )" );
46  } catch (SQLException &e) {
47  throw(std::runtime_error("FEConfigFgrGroupDat::prepareWrite(): "+e.getMessage()));
48  }
49 }
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 FEConfigFgrGroupDat::setFgrGroupId ( int  x)
inline

Definition at line 20 of file FEConfigFgrGroupDat.h.

References m_group_id, and x.

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

20 { m_group_id = x; }
Definition: DDAxes.h:10
void FEConfigFgrGroupDat::setLUTValue ( int  x)
inline

Definition at line 31 of file FEConfigFgrGroupDat.h.

References m_lut, and x.

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

31 { m_lut = x; }
Definition: DDAxes.h:10
void FEConfigFgrGroupDat::setRatioHigh ( float  x)
inline

Definition at line 29 of file FEConfigFgrGroupDat.h.

References m_ratio_high, and x.

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

29 { m_ratio_high = x; }
Definition: DDAxes.h:10
void FEConfigFgrGroupDat::setRatioLow ( float  x)
inline

Definition at line 27 of file FEConfigFgrGroupDat.h.

References m_ratio_low, and x.

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

27 { m_ratio_low = x; }
Definition: DDAxes.h:10
void FEConfigFgrGroupDat::setThreshHigh ( float  x)
inline

Definition at line 25 of file FEConfigFgrGroupDat.h.

References m_thresh_high, and x.

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

25 { m_thresh_high = x; }
Definition: DDAxes.h:10
void FEConfigFgrGroupDat::setThreshLow ( float  x)
inline

Definition at line 23 of file FEConfigFgrGroupDat.h.

References m_thresh_low, and x.

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

23 { m_thresh_low = x; }
Definition: DDAxes.h:10
void FEConfigFgrGroupDat::writeArrayDB ( const std::map< EcalLogicID, FEConfigFgrGroupDat > *  data,
FEConfigFgrInfo iconf 
)
throw (std::runtime_error
)
private

Definition at line 128 of file FEConfigFgrGroupDat.cc.

References prof2calltree::count, data, alignCSCRings::e, getFgrGroupId(), getLUTValue(), getRatioHigh(), getRatioLow(), getThreshHigh(), getThreshLow(), AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, findQualityFiles::rr, alignCSCRings::s, contentValuesCheck::ss, edmStreamStallGrapher::t, groupFilesInBlocks::tt, x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

130 {
131  this->checkConnection();
132  this->checkPrepare();
133 
134  int iconfID = iconf->fetchID();
135  if (!iconfID) { throw(std::runtime_error("FEConfigFgrGroupDat::writeArrayDB: ICONF not in DB")); }
136 
137 
138  int nrows=data->size();
139  int* ids= new int[nrows];
140  int* iconfid_vec= new int[nrows];
141  int* xx= new int[nrows];
142  float* yy= new float[nrows];
143  float* zz= new float[nrows];
144  float* rr= new float[nrows];
145  float* ss= new float[nrows];
146  int* tt= new int[nrows];
147 
148 
149  ub2* ids_len= new ub2[nrows];
150  ub2* iconf_len= new ub2[nrows];
151  ub2* x_len= new ub2[nrows];
152  ub2* y_len= new ub2[nrows];
153  ub2* z_len= new ub2[nrows];
154  ub2* r_len= new ub2[nrows];
155  ub2* s_len= new ub2[nrows];
156  ub2* t_len= new ub2[nrows];
157 
158 
159  // const EcalLogicID* channel;
160  const FEConfigFgrGroupDat* dataitem;
161  int count=0;
162  typedef map< EcalLogicID, FEConfigFgrGroupDat >::const_iterator CI;
163  for (CI p = data->begin(); p != data->end(); ++p) {
164  //channel = &(p->first);
165  // int logicID = channel->getLogicID();
166  // if (!logicID) { throw(std::runtime_error("FEConfigFgrGroupDat::writeArrayDB: Bad EcalLogicID")); }
167  // ids[count]=logicID;
168  iconfid_vec[count]=iconfID;
169 
170  dataitem = &(p->second);
171  // dataIface.writeDB( channel, dataitem, iconf);
172  int x=dataitem->getFgrGroupId();
173  float y=dataitem->getThreshLow();
174  float z=dataitem->getThreshHigh();
175  float r=dataitem->getRatioLow();
176  float s=dataitem->getRatioHigh();
177  int t=dataitem->getLUTValue();
178 
179  xx[count]=x;
180  yy[count]=y;
181  zz[count]=z;
182  rr[count]=r;
183  ss[count]=s;
184  tt[count]=t;
185 
186  // ids_len[count]=sizeof(ids[count]);
187  iconf_len[count]=sizeof(iconfid_vec[count]);
188 
189  x_len[count]=sizeof(xx[count]);
190  y_len[count]=sizeof(yy[count]);
191  z_len[count]=sizeof(zz[count]);
192  r_len[count]=sizeof(rr[count]);
193  s_len[count]=sizeof(ss[count]);
194  t_len[count]=sizeof(tt[count]);
195 
196  count++;
197  }
198 
199 
200  try {
201  m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len);
202  m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len );
203  m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len );
204  m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len );
205  m_writeStmt->setDataBuffer(5, (dvoid*)rr, OCCIFLOAT , sizeof(rr[0]), r_len );
206  m_writeStmt->setDataBuffer(6, (dvoid*)ss, OCCIFLOAT , sizeof(ss[0]), s_len );
207  m_writeStmt->setDataBuffer(7, (dvoid*)tt, OCCIINT , sizeof(tt[0]), t_len );
208 
209  m_writeStmt->executeArrayUpdate(nrows);
210 
211  delete [] ids;
212  delete [] iconfid_vec;
213  delete [] xx;
214  delete [] yy;
215  delete [] zz;
216  delete [] rr;
217  delete [] ss;
218  delete [] tt;
219 
220  delete [] ids_len;
221  delete [] iconf_len;
222  delete [] x_len;
223  delete [] y_len;
224  delete [] z_len;
225  delete [] r_len;
226  delete [] s_len;
227  delete [] t_len;
228 
229  } catch (SQLException &e) {
230  throw(std::runtime_error("FEConfigFgrGroupDat::writeArrayDB(): "+e.getMessage()));
231  }
232 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
float float float z
float getRatioLow() const
float getThreshLow() const
float getRatioHigh() const
void checkPrepare()
Definition: IDataItem.h:31
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
float getThreshHigh() const
Definition: DDAxes.h:10
void checkConnection() const
Definition: IDBObject.h:41
void FEConfigFgrGroupDat::writeDB ( const EcalLogicID ecid,
const FEConfigFgrGroupDat item,
FEConfigFgrInfo iconf 
)
throw (std::runtime_error
)
private

Definition at line 53 of file FEConfigFgrGroupDat.cc.

References alignCSCRings::e.

55 {
56  this->checkConnection();
57  this->checkPrepare();
58 
59  int iconfID = iconf->fetchID();
60  if (!iconfID) { throw(std::runtime_error("FEConfigFgrGroupDat::writeDB: ICONF not in DB")); }
61  /* no need for the logic id in this table
62  int logicID = ecid->getLogicID();
63  if (!logicID) { throw(std::runtime_error("FEConfigFgrGroupDat::writeDB: Bad EcalLogicID")); }
64  */
65 
66  try {
67  m_writeStmt->setInt(1, iconfID);
68 
69  m_writeStmt->setInt(2, item->getFgrGroupId());
70  m_writeStmt->setFloat(3, item->getThreshLow());
71  m_writeStmt->setFloat(4, item->getThreshHigh());
72  m_writeStmt->setFloat(5, item->getRatioLow());
73  m_writeStmt->setFloat(6, item->getRatioHigh());
74  m_writeStmt->setInt(7, item->getLUTValue());
75 
76  m_writeStmt->executeUpdate();
77  } catch (SQLException &e) {
78  throw(std::runtime_error("FEConfigFgrGroupDat::writeDB(): "+e.getMessage()));
79  }
80 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
float getRatioLow() const
float getThreshLow() const
float getRatioHigh() const
void checkPrepare()
Definition: IDataItem.h:31
float getThreshHigh() const
void checkConnection() const
Definition: IDBObject.h:41

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigFgrGroupDat.h.

Member Data Documentation

int FEConfigFgrGroupDat::m_group_id
private

Definition at line 50 of file FEConfigFgrGroupDat.h.

Referenced by getFgrGroupId(), and setFgrGroupId().

int FEConfigFgrGroupDat::m_lut
private

Definition at line 55 of file FEConfigFgrGroupDat.h.

Referenced by getLUTValue(), and setLUTValue().

float FEConfigFgrGroupDat::m_ratio_high
private

Definition at line 54 of file FEConfigFgrGroupDat.h.

Referenced by getRatioHigh(), and setRatioHigh().

float FEConfigFgrGroupDat::m_ratio_low
private

Definition at line 53 of file FEConfigFgrGroupDat.h.

Referenced by getRatioLow(), and setRatioLow().

float FEConfigFgrGroupDat::m_thresh_high
private

Definition at line 52 of file FEConfigFgrGroupDat.h.

Referenced by getThreshHigh(), and setThreshHigh().

float FEConfigFgrGroupDat::m_thresh_low
private

Definition at line 51 of file FEConfigFgrGroupDat.h.

Referenced by getThreshLow(), and setThreshLow().