CMS 3D CMS Logo

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) noexcept(false)
 
void prepareWrite () noexcept(false)
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigFgrGroupDat > *data, FEConfigFgrInfo *iconf) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const FEConfigFgrGroupDat *item, FEConfigFgrInfo *iconf) noexcept(false)
 

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 () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void setPrefetchRowCount (int ncount) noexcept(false)
 
void terminateReadStatement () noexcept(false)
 
void terminateWriteStatement () noexcept(false)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const noexcept(false)
 
- 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 
)
privatenoexcept

Definition at line 84 of file FEConfigFgrGroupDat.cc.

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

Referenced by getLUTValue().

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 }
int fetchID() noexcept(false)
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)
void setThreshHigh(float x)
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
int FEConfigFgrGroupDat::getFgrGroupId ( ) const
inline
int FEConfigFgrGroupDat::getLUTValue ( ) const
inline
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 ( )
privatevirtualnoexcept

Implements IDataItem.

Definition at line 35 of file FEConfigFgrGroupDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getLUTValue().

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
void checkConnection() const noexcept(false)
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().

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().

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().

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().

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().

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().

void FEConfigFgrGroupDat::writeArrayDB ( const std::map< EcalLogicID, FEConfigFgrGroupDat > *  data,
FEConfigFgrInfo iconf 
)
privatenoexcept

Definition at line 128 of file FEConfigFgrGroupDat.cc.

References KineDebug3::count(), data, MillePedeFileConverter_cfg::e, getFgrGroupId(), getLUTValue(), getRatioHigh(), getRatioLow(), getThreshHigh(), getThreshLow(), electrons_cff::ids, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, findQualityFiles::rr, alignCSCRings::s, lumiQTWidget::t, groupFilesInBlocks::tt, x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, and geometryCSVtoXML::zz.

Referenced by getLUTValue().

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 }
int fetchID() noexcept(false)
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
float getRatioLow() const
float getThreshLow() const
float getRatioHigh() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
float getThreshHigh() const
void FEConfigFgrGroupDat::writeDB ( const EcalLogicID ecid,
const FEConfigFgrGroupDat item,
FEConfigFgrInfo iconf 
)
privatenoexcept

Definition at line 53 of file FEConfigFgrGroupDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getLUTValue().

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 }
int fetchID() noexcept(false)
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
float getRatioLow() const
float getThreshLow() const
float getRatioHigh() const
float getThreshHigh() const

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 46 of file FEConfigFgrGroupDat.h.

Referenced by getFgrGroupId(), and setFgrGroupId().

int FEConfigFgrGroupDat::m_lut
private

Definition at line 51 of file FEConfigFgrGroupDat.h.

Referenced by getLUTValue(), and setLUTValue().

float FEConfigFgrGroupDat::m_ratio_high
private

Definition at line 50 of file FEConfigFgrGroupDat.h.

Referenced by getRatioHigh(), and setRatioHigh().

float FEConfigFgrGroupDat::m_ratio_low
private

Definition at line 49 of file FEConfigFgrGroupDat.h.

Referenced by getRatioLow(), and setRatioLow().

float FEConfigFgrGroupDat::m_thresh_high
private

Definition at line 48 of file FEConfigFgrGroupDat.h.

Referenced by getThreshHigh(), and setThreshHigh().

float FEConfigFgrGroupDat::m_thresh_low
private

Definition at line 47 of file FEConfigFgrGroupDat.h.

Referenced by getThreshLow(), and setThreshLow().