#include <OnlineDB/EcalCondDB/interface/FEConfigLinDat.h>
Public Member Functions | |
FEConfigLinDat () | |
int | getMultX1 () const |
int | getMultX12 () const |
int | getMultX6 () const |
int | getShift1 () const |
int | getShift12 () const |
int | getShift6 () const |
std::string | getTable () |
void | setMultX1 (int x) |
void | setMultX12 (int x) |
void | setMultX6 (int x) |
void | setShift1 (int x) |
void | setShift12 (int x) |
void | setShift6 (int x) |
~FEConfigLinDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, FEConfigLinDat > *fillMap, FEConfigLinInfo *iconf) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeArrayDB (const std::map< EcalLogicID, FEConfigLinDat > *data, FEConfigLinInfo *iconf) throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const FEConfigLinDat *item, FEConfigLinInfo *iconf) throw (std::runtime_error) |
Private Attributes | |
int | m_multx1 |
int | m_multx12 |
int | m_multx6 |
int | m_shift1 |
int | m_shift12 |
int | m_shift6 |
Friends | |
class | EcalCondDBInterface |
Definition at line 11 of file FEConfigLinDat.h.
FEConfigLinDat::FEConfigLinDat | ( | ) |
Definition at line 11 of file FEConfigLinDat.cc.
References IDBObject::m_conn, IDBObject::m_env, m_multx1, m_multx12, m_multx6, IDataItem::m_readStmt, m_shift1, m_shift12, m_shift6, 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_multx12 = 0; 00019 m_multx6 = 0; 00020 m_multx1 = 0; 00021 m_shift12 = 0; 00022 m_shift6 = 0; 00023 m_shift1 = 0; 00024 00025 00026 }
FEConfigLinDat::~FEConfigLinDat | ( | ) |
void FEConfigLinDat::fetchData | ( | std::map< EcalLogicID, FEConfigLinDat > * | fillMap, | |
FEConfigLinInfo * | iconf | |||
) | throw (std::runtime_error) [private] |
int FEConfigLinDat::getMultX1 | ( | ) | const [inline] |
Definition at line 30 of file FEConfigLinDat.h.
References m_multx1.
Referenced by writeArrayDB().
00030 { return m_multx1; }
int FEConfigLinDat::getMultX12 | ( | ) | const [inline] |
Definition at line 28 of file FEConfigLinDat.h.
References m_multx12.
Referenced by writeArrayDB().
00028 { return m_multx12; }
int FEConfigLinDat::getMultX6 | ( | ) | const [inline] |
Definition at line 29 of file FEConfigLinDat.h.
References m_multx6.
Referenced by writeArrayDB().
00029 { return m_multx6; }
int FEConfigLinDat::getShift1 | ( | ) | const [inline] |
Definition at line 33 of file FEConfigLinDat.h.
References m_shift1.
Referenced by writeArrayDB().
00033 { return m_shift1; }
int FEConfigLinDat::getShift12 | ( | ) | const [inline] |
Definition at line 31 of file FEConfigLinDat.h.
References m_shift12.
Referenced by writeArrayDB().
00031 { return m_shift12; }
int FEConfigLinDat::getShift6 | ( | ) | const [inline] |
Definition at line 32 of file FEConfigLinDat.h.
References m_shift6.
Referenced by writeArrayDB().
00032 { return m_shift6; }
std::string FEConfigLinDat::getTable | ( | ) | [inline, virtual] |
void FEConfigLinDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 36 of file FEConfigLinDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, and IDataItem::m_writeStmt.
00038 { 00039 this->checkConnection(); 00040 00041 try { 00042 m_writeStmt = m_conn->createStatement(); 00043 m_writeStmt->setSQL("INSERT INTO fe_config_lin_dat (lin_conf_id, logic_id, " 00044 " multx12, multx6, multx1, shift12, shift6, shift1 ) " 00045 "VALUES (:lin_conf_id, :logic_id, " 00046 ":multx12, :multx6, :multx1, :shift12, :shift6, :shift1 )" ); 00047 } catch (SQLException &e) { 00048 throw(runtime_error("FEConfigLinDat::prepareWrite(): "+e.getMessage())); 00049 } 00050 }
Definition at line 22 of file FEConfigLinDat.h.
References m_multx1.
Referenced by EcalTPGParamBuilder::analyze().
Definition at line 20 of file FEConfigLinDat.h.
References m_multx12.
Referenced by EcalTPGParamBuilder::analyze().
Definition at line 21 of file FEConfigLinDat.h.
References m_multx6.
Referenced by EcalTPGParamBuilder::analyze().
Definition at line 25 of file FEConfigLinDat.h.
References m_shift1.
Referenced by EcalTPGParamBuilder::analyze().
Definition at line 23 of file FEConfigLinDat.h.
References m_shift12.
Referenced by EcalTPGParamBuilder::analyze().
Definition at line 24 of file FEConfigLinDat.h.
References m_shift6.
Referenced by EcalTPGParamBuilder::analyze().
void FEConfigLinDat::writeArrayDB | ( | const std::map< EcalLogicID, FEConfigLinDat > * | data, | |
FEConfigLinInfo * | iconf | |||
) | throw (std::runtime_error) [private] |
Definition at line 132 of file FEConfigLinDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), count, data, EcalLogicID::getLogicID(), getMultX1(), getMultX12(), getMultX6(), getShift1(), getShift12(), getShift6(), IDataItem::m_writeStmt, r, s, ss, w, ww, x, y, and z.
00134 { 00135 this->checkConnection(); 00136 this->checkPrepare(); 00137 00138 int iconfID = iconf->fetchID(); 00139 if (!iconfID) { throw(runtime_error("FEConfigLinDat::writeArrayDB: ICONF not in DB")); } 00140 00141 00142 int nrows=data->size(); 00143 int* ids= new int[nrows]; 00144 int* iconfid_vec= new int[nrows]; 00145 int* xx= new int[nrows]; 00146 int* yy= new int[nrows]; 00147 int* zz= new int[nrows]; 00148 int* ww= new int[nrows]; 00149 int* rr= new int[nrows]; 00150 int* ss= new int[nrows]; 00151 00152 ub2* ids_len= new ub2[nrows]; 00153 ub2* iconf_len= new ub2[nrows]; 00154 ub2* x_len= new ub2[nrows]; 00155 ub2* y_len= new ub2[nrows]; 00156 ub2* z_len= new ub2[nrows]; 00157 ub2* w_len= new ub2[nrows]; 00158 ub2* r_len= new ub2[nrows]; 00159 ub2* s_len= new ub2[nrows]; 00160 00161 00162 const EcalLogicID* channel; 00163 const FEConfigLinDat* dataitem; 00164 int count=0; 00165 typedef map< EcalLogicID, FEConfigLinDat >::const_iterator CI; 00166 for (CI p = data->begin(); p != data->end(); ++p) { 00167 channel = &(p->first); 00168 int logicID = channel->getLogicID(); 00169 if (!logicID) { throw(runtime_error("FEConfigLinDat::writeArrayDB: Bad EcalLogicID")); } 00170 ids[count]=logicID; 00171 iconfid_vec[count]=iconfID; 00172 00173 dataitem = &(p->second); 00174 // dataIface.writeDB( channel, dataitem, iconf); 00175 int x=dataitem->getMultX12(); 00176 int y=dataitem->getMultX6(); 00177 int z=dataitem->getMultX1(); 00178 int w=dataitem->getShift12(); 00179 int r=dataitem->getShift6(); 00180 int s=dataitem->getShift1(); 00181 00182 xx[count]=x; 00183 yy[count]=y; 00184 zz[count]=z; 00185 ww[count]=w; 00186 rr[count]=r; 00187 ss[count]=s; 00188 00189 ids_len[count]=sizeof(ids[count]); 00190 iconf_len[count]=sizeof(iconfid_vec[count]); 00191 00192 x_len[count]=sizeof(xx[count]); 00193 y_len[count]=sizeof(yy[count]); 00194 z_len[count]=sizeof(zz[count]); 00195 w_len[count]=sizeof(ww[count]); 00196 r_len[count]=sizeof(rr[count]); 00197 s_len[count]=sizeof(ss[count]); 00198 00199 count++; 00200 } 00201 00202 00203 try { 00204 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len); 00205 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len ); 00206 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len ); 00207 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len ); 00208 m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIINT , sizeof(zz[0]), z_len ); 00209 m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIINT , sizeof(ww[0]), w_len ); 00210 m_writeStmt->setDataBuffer(7, (dvoid*)rr, OCCIINT , sizeof(rr[0]), r_len ); 00211 m_writeStmt->setDataBuffer(8, (dvoid*)ss, OCCIINT , sizeof(ss[0]), s_len ); 00212 00213 m_writeStmt->executeArrayUpdate(nrows); 00214 00215 delete [] ids; 00216 delete [] iconfid_vec; 00217 delete [] xx; 00218 delete [] yy; 00219 delete [] zz; 00220 delete [] ww; 00221 delete [] rr; 00222 delete [] ss; 00223 00224 delete [] ids_len; 00225 delete [] iconf_len; 00226 delete [] x_len; 00227 delete [] y_len; 00228 delete [] z_len; 00229 delete [] w_len; 00230 delete [] r_len; 00231 delete [] s_len; 00232 00233 } catch (SQLException &e) { 00234 throw(runtime_error("FEConfigLinDat::writeArrayDB(): "+e.getMessage())); 00235 } 00236 }
void FEConfigLinDat::writeDB | ( | const EcalLogicID * | ecid, | |
const FEConfigLinDat * | item, | |||
FEConfigLinInfo * | iconf | |||
) | throw (std::runtime_error) [private] |
Definition at line 54 of file FEConfigLinDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), e, and IDataItem::m_writeStmt.
00056 { 00057 this->checkConnection(); 00058 this->checkPrepare(); 00059 00060 int iconfID = iconf->fetchID(); 00061 if (!iconfID) { throw(runtime_error("FEConfigLinDat::writeDB: ICONF not in DB")); } 00062 00063 int logicID = ecid->getLogicID(); 00064 if (!logicID) { throw(runtime_error("FEConfigLinDat::writeDB: Bad EcalLogicID")); } 00065 00066 try { 00067 m_writeStmt->setInt(1, iconfID); 00068 m_writeStmt->setInt(2, logicID); 00069 m_writeStmt->setInt(3, item->getMultX12()); 00070 m_writeStmt->setInt(4, item->getMultX6()); 00071 m_writeStmt->setInt(5, item->getMultX1()); 00072 m_writeStmt->setInt(6, item->getShift12()); 00073 m_writeStmt->setInt(7, item->getShift6()); 00074 m_writeStmt->setInt(8, item->getShift1()); 00075 00076 m_writeStmt->executeUpdate(); 00077 } catch (SQLException &e) { 00078 throw(runtime_error("FEConfigLinDat::writeDB(): "+e.getMessage())); 00079 } 00080 }
friend class EcalCondDBInterface [friend] |
int FEConfigLinDat::m_multx1 [private] |
Definition at line 53 of file FEConfigLinDat.h.
Referenced by FEConfigLinDat(), getMultX1(), and setMultX1().
int FEConfigLinDat::m_multx12 [private] |
Definition at line 51 of file FEConfigLinDat.h.
Referenced by FEConfigLinDat(), getMultX12(), and setMultX12().
int FEConfigLinDat::m_multx6 [private] |
Definition at line 52 of file FEConfigLinDat.h.
Referenced by FEConfigLinDat(), getMultX6(), and setMultX6().
int FEConfigLinDat::m_shift1 [private] |
Definition at line 56 of file FEConfigLinDat.h.
Referenced by FEConfigLinDat(), getShift1(), and setShift1().
int FEConfigLinDat::m_shift12 [private] |
Definition at line 54 of file FEConfigLinDat.h.
Referenced by FEConfigLinDat(), getShift12(), and setShift12().
int FEConfigLinDat::m_shift6 [private] |
Definition at line 55 of file FEConfigLinDat.h.
Referenced by FEConfigLinDat(), getShift6(), and setShift6().