#include <OnlineDB/EcalCondDB/interface/FEConfigWeightGroupDat.h>
Public Member Functions | |
FEConfigWeightGroupDat () | |
std::string | getTable () |
float | getWeight0 () const |
float | getWeight1 () const |
float | getWeight2 () const |
float | getWeight3 () const |
float | getWeight4 () const |
int | getWeightGroupId () const |
void | setWeight0 (float x) |
void | setWeight1 (float x) |
void | setWeight2 (float x) |
void | setWeight3 (float x) |
void | setWeight4 (float x) |
void | setWeightGroupId (int x) |
~FEConfigWeightGroupDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, FEConfigWeightGroupDat > *fillMap, FEConfigWeightInfo *iconf) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeArrayDB (const std::map< EcalLogicID, FEConfigWeightGroupDat > *data, FEConfigWeightInfo *iconf) throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const FEConfigWeightGroupDat *item, FEConfigWeightInfo *iconf) throw (std::runtime_error) |
Private Attributes | |
int | m_group_id |
float | m_w0 |
float | m_w1 |
float | m_w2 |
float | m_w3 |
float | m_w4 |
Friends | |
class | EcalCondDBInterface |
Definition at line 11 of file FEConfigWeightGroupDat.h.
FEConfigWeightGroupDat::FEConfigWeightGroupDat | ( | ) |
Definition at line 11 of file FEConfigWeightGroupDat.cc.
References IDBObject::m_conn, IDBObject::m_env, m_group_id, IDataItem::m_readStmt, m_w0, m_w1, m_w2, m_w3, m_w4, IDataItem::m_writeStmt, and NULL.
00012 { 00013 m_env = NULL; 00014 m_conn = NULL; 00015 m_writeStmt = NULL; 00016 m_readStmt = NULL; 00017 00018 m_group_id=0; 00019 m_w0 = 0; 00020 m_w1 = 0; 00021 m_w2 = 0; 00022 m_w3 = 0; 00023 m_w4 = 0; 00024 00025 }
FEConfigWeightGroupDat::~FEConfigWeightGroupDat | ( | ) |
void FEConfigWeightGroupDat::fetchData | ( | std::map< EcalLogicID, FEConfigWeightGroupDat > * | fillMap, | |
FEConfigWeightInfo * | iconf | |||
) | throw (std::runtime_error) [private] |
std::string FEConfigWeightGroupDat::getTable | ( | ) | [inline, virtual] |
float FEConfigWeightGroupDat::getWeight0 | ( | ) | const [inline] |
Definition at line 24 of file FEConfigWeightGroupDat.h.
References m_w0.
Referenced by writeArrayDB().
00024 { return m_w0; }
float FEConfigWeightGroupDat::getWeight1 | ( | ) | const [inline] |
Definition at line 26 of file FEConfigWeightGroupDat.h.
References m_w1.
Referenced by writeArrayDB().
00026 { return m_w1; }
float FEConfigWeightGroupDat::getWeight2 | ( | ) | const [inline] |
Definition at line 28 of file FEConfigWeightGroupDat.h.
References m_w2.
Referenced by writeArrayDB().
00028 { return m_w2; }
float FEConfigWeightGroupDat::getWeight3 | ( | ) | const [inline] |
Definition at line 30 of file FEConfigWeightGroupDat.h.
References m_w3.
Referenced by writeArrayDB().
00030 { return m_w3; }
float FEConfigWeightGroupDat::getWeight4 | ( | ) | const [inline] |
Definition at line 32 of file FEConfigWeightGroupDat.h.
References m_w4.
Referenced by writeArrayDB().
00032 { return m_w4; }
int FEConfigWeightGroupDat::getWeightGroupId | ( | ) | const [inline] |
Definition at line 21 of file FEConfigWeightGroupDat.h.
References m_group_id.
Referenced by writeArrayDB().
00021 { return m_group_id; }
void FEConfigWeightGroupDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 35 of file FEConfigWeightGroupDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, and IDataItem::m_writeStmt.
00037 { 00038 this->checkConnection(); 00039 00040 try { 00041 m_writeStmt = m_conn->createStatement(); 00042 m_writeStmt->setSQL("INSERT INTO fe_weight_per_group_dat (wei_conf_id, group_id, " 00043 " w0, w1, w2, w3, w4 ) " 00044 "VALUES (:wei_conf_id, :group_id, " 00045 ":w0, :w1, :w2, :w3, :w4 )" ); 00046 } catch (SQLException &e) { 00047 throw(runtime_error("FEConfigWeightGroupDat::prepareWrite(): "+e.getMessage())); 00048 } 00049 }
void FEConfigWeightGroupDat::setWeight0 | ( | float | x | ) | [inline] |
Definition at line 23 of file FEConfigWeightGroupDat.h.
References m_w0.
Referenced by EcalTPGParamBuilder::analyze().
void FEConfigWeightGroupDat::setWeight1 | ( | float | x | ) | [inline] |
Definition at line 25 of file FEConfigWeightGroupDat.h.
References m_w1.
Referenced by EcalTPGParamBuilder::analyze().
void FEConfigWeightGroupDat::setWeight2 | ( | float | x | ) | [inline] |
Definition at line 27 of file FEConfigWeightGroupDat.h.
References m_w2.
Referenced by EcalTPGParamBuilder::analyze().
void FEConfigWeightGroupDat::setWeight3 | ( | float | x | ) | [inline] |
Definition at line 29 of file FEConfigWeightGroupDat.h.
References m_w3.
Referenced by EcalTPGParamBuilder::analyze().
void FEConfigWeightGroupDat::setWeight4 | ( | float | x | ) | [inline] |
Definition at line 31 of file FEConfigWeightGroupDat.h.
References m_w4.
Referenced by EcalTPGParamBuilder::analyze().
Definition at line 20 of file FEConfigWeightGroupDat.h.
References m_group_id.
Referenced by EcalTPGParamBuilder::analyze().
00020 { m_group_id = x; }
void FEConfigWeightGroupDat::writeArrayDB | ( | const std::map< EcalLogicID, FEConfigWeightGroupDat > * | data, | |
FEConfigWeightInfo * | iconf | |||
) | throw (std::runtime_error) [private] |
Definition at line 128 of file FEConfigWeightGroupDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), count, data, getWeight0(), getWeight1(), getWeight2(), getWeight3(), getWeight4(), getWeightGroupId(), IDataItem::m_writeStmt, r, s, ss, t, tt, x, y, and z.
00130 { 00131 this->checkConnection(); 00132 this->checkPrepare(); 00133 00134 int iconfID = iconf->fetchID(); 00135 if (!iconfID) { throw(runtime_error("FEConfigWeightGroupDat::writeArrayDB: ICONF not in DB")); } 00136 00137 00138 int nrows=data->size(); 00139 int* ids= new int[nrows]; 00140 int* iconfid_vec= new int[nrows]; 00141 int* xx= new int[nrows]; 00142 float* yy= new float[nrows]; 00143 float* zz= new float[nrows]; 00144 float* rr= new float[nrows]; 00145 float* ss= new float[nrows]; 00146 float* tt= new float[nrows]; 00147 00148 00149 ub2* ids_len= new ub2[nrows]; 00150 ub2* iconf_len= new ub2[nrows]; 00151 ub2* x_len= new ub2[nrows]; 00152 ub2* y_len= new ub2[nrows]; 00153 ub2* z_len= new ub2[nrows]; 00154 ub2* r_len= new ub2[nrows]; 00155 ub2* s_len= new ub2[nrows]; 00156 ub2* t_len= new ub2[nrows]; 00157 00158 00159 const EcalLogicID* channel; 00160 const FEConfigWeightGroupDat* dataitem; 00161 int count=0; 00162 typedef map< EcalLogicID, FEConfigWeightGroupDat >::const_iterator CI; 00163 for (CI p = data->begin(); p != data->end(); ++p) { 00164 channel = &(p->first); 00165 // int logicID = channel->getLogicID(); 00166 // if (!logicID) { throw(runtime_error("FEConfigWeightGroupDat::writeArrayDB: Bad EcalLogicID")); } 00167 // ids[count]=logicID; 00168 iconfid_vec[count]=iconfID; 00169 00170 dataitem = &(p->second); 00171 // dataIface.writeDB( channel, dataitem, iconf); 00172 int x=dataitem->getWeightGroupId(); 00173 float y=dataitem->getWeight0(); 00174 float z=dataitem->getWeight1(); 00175 float r=dataitem->getWeight2(); 00176 float s=dataitem->getWeight3(); 00177 float t=dataitem->getWeight4(); 00178 00179 xx[count]=x; 00180 yy[count]=y; 00181 zz[count]=z; 00182 rr[count]=r; 00183 ss[count]=s; 00184 tt[count]=t; 00185 00186 // ids_len[count]=sizeof(ids[count]); 00187 iconf_len[count]=sizeof(iconfid_vec[count]); 00188 00189 x_len[count]=sizeof(xx[count]); 00190 y_len[count]=sizeof(yy[count]); 00191 z_len[count]=sizeof(zz[count]); 00192 r_len[count]=sizeof(rr[count]); 00193 s_len[count]=sizeof(ss[count]); 00194 t_len[count]=sizeof(tt[count]); 00195 00196 count++; 00197 } 00198 00199 00200 try { 00201 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len); 00202 m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len ); 00203 m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len ); 00204 m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len ); 00205 m_writeStmt->setDataBuffer(5, (dvoid*)rr, OCCIFLOAT , sizeof(rr[0]), r_len ); 00206 m_writeStmt->setDataBuffer(6, (dvoid*)ss, OCCIFLOAT , sizeof(ss[0]), s_len ); 00207 m_writeStmt->setDataBuffer(7, (dvoid*)tt, OCCIFLOAT , sizeof(tt[0]), t_len ); 00208 00209 m_writeStmt->executeArrayUpdate(nrows); 00210 00211 delete [] ids; 00212 delete [] iconfid_vec; 00213 delete [] xx; 00214 delete [] yy; 00215 delete [] zz; 00216 delete [] rr; 00217 delete [] ss; 00218 delete [] tt; 00219 00220 delete [] ids_len; 00221 delete [] iconf_len; 00222 delete [] x_len; 00223 delete [] y_len; 00224 delete [] z_len; 00225 delete [] r_len; 00226 delete [] s_len; 00227 delete [] t_len; 00228 00229 } catch (SQLException &e) { 00230 throw(runtime_error("FEConfigWeightGroupDat::writeArrayDB(): "+e.getMessage())); 00231 } 00232 }
void FEConfigWeightGroupDat::writeDB | ( | const EcalLogicID * | ecid, | |
const FEConfigWeightGroupDat * | item, | |||
FEConfigWeightInfo * | iconf | |||
) | throw (std::runtime_error) [private] |
Definition at line 53 of file FEConfigWeightGroupDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), e, and IDataItem::m_writeStmt.
00055 { 00056 this->checkConnection(); 00057 this->checkPrepare(); 00058 00059 int iconfID = iconf->fetchID(); 00060 if (!iconfID) { throw(runtime_error("FEConfigWeightGroupDat::writeDB: ICONF not in DB")); } 00061 /* no need for the logic id in this table 00062 int logicID = ecid->getLogicID(); 00063 if (!logicID) { throw(runtime_error("FEConfigWeightGroupDat::writeDB: Bad EcalLogicID")); } 00064 */ 00065 00066 try { 00067 m_writeStmt->setInt(1, iconfID); 00068 00069 m_writeStmt->setInt(2, item->getWeightGroupId()); 00070 m_writeStmt->setFloat(3, item->getWeight0()); 00071 m_writeStmt->setFloat(4, item->getWeight1()); 00072 m_writeStmt->setFloat(5, item->getWeight2()); 00073 m_writeStmt->setFloat(6, item->getWeight3()); 00074 m_writeStmt->setFloat(7, item->getWeight4()); 00075 00076 m_writeStmt->executeUpdate(); 00077 } catch (SQLException &e) { 00078 throw(runtime_error("FEConfigWeightGroupDat::writeDB(): "+e.getMessage())); 00079 } 00080 }
friend class EcalCondDBInterface [friend] |
int FEConfigWeightGroupDat::m_group_id [private] |
Definition at line 50 of file FEConfigWeightGroupDat.h.
Referenced by FEConfigWeightGroupDat(), getWeightGroupId(), and setWeightGroupId().
float FEConfigWeightGroupDat::m_w0 [private] |
Definition at line 51 of file FEConfigWeightGroupDat.h.
Referenced by FEConfigWeightGroupDat(), getWeight0(), and setWeight0().
float FEConfigWeightGroupDat::m_w1 [private] |
Definition at line 52 of file FEConfigWeightGroupDat.h.
Referenced by FEConfigWeightGroupDat(), getWeight1(), and setWeight1().
float FEConfigWeightGroupDat::m_w2 [private] |
Definition at line 53 of file FEConfigWeightGroupDat.h.
Referenced by FEConfigWeightGroupDat(), getWeight2(), and setWeight2().
float FEConfigWeightGroupDat::m_w3 [private] |
Definition at line 54 of file FEConfigWeightGroupDat.h.
Referenced by FEConfigWeightGroupDat(), getWeight3(), and setWeight3().
float FEConfigWeightGroupDat::m_w4 [private] |
Definition at line 55 of file FEConfigWeightGroupDat.h.
Referenced by FEConfigWeightGroupDat(), getWeight4(), and setWeight4().