#include <OnlineDB/EcalCondDB/interface/FEConfigLUTGroupDat.h>
Public Member Functions | |
FEConfigLUTGroupDat () | |
int | getLUTGroupId () const |
int | getLUTValue (int i) const |
std::string | getTable () |
void | setLUTGroupId (int x) |
void | setLUTValue (int i, int x) |
~FEConfigLUTGroupDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, FEConfigLUTGroupDat > *fillMap, FEConfigLUTInfo *iconf) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeArrayDB (const std::map< EcalLogicID, FEConfigLUTGroupDat > *data, FEConfigLUTInfo *iconf) throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const FEConfigLUTGroupDat *item, FEConfigLUTInfo *iconf) throw (std::runtime_error) |
Private Attributes | |
int | m_group_id |
int | m_lut [1024] |
Friends | |
class | EcalCondDBInterface |
Definition at line 11 of file FEConfigLUTGroupDat.h.
FEConfigLUTGroupDat::FEConfigLUTGroupDat | ( | ) |
Definition at line 11 of file FEConfigLUTGroupDat.cc.
References i, IDBObject::m_conn, IDBObject::m_env, m_group_id, m_lut, IDataItem::m_readStmt, 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 for(int i=0; i<1024; i++){ 00020 m_lut[i] = 0; 00021 } 00022 00023 }
FEConfigLUTGroupDat::~FEConfigLUTGroupDat | ( | ) |
void FEConfigLUTGroupDat::fetchData | ( | std::map< EcalLogicID, FEConfigLUTGroupDat > * | fillMap, | |
FEConfigLUTInfo * | iconf | |||
) | throw (std::runtime_error) [private] |
int FEConfigLUTGroupDat::getLUTGroupId | ( | ) | const [inline] |
Definition at line 21 of file FEConfigLUTGroupDat.h.
References m_group_id.
Referenced by writeArrayDB().
00021 { return m_group_id; }
Definition at line 24 of file FEConfigLUTGroupDat.h.
References m_lut.
Referenced by writeArrayDB().
std::string FEConfigLUTGroupDat::getTable | ( | ) | [inline, virtual] |
void FEConfigLUTGroupDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 33 of file FEConfigLUTGroupDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, and IDataItem::m_writeStmt.
00035 { 00036 this->checkConnection(); 00037 00038 try { 00039 m_writeStmt = m_conn->createStatement(); 00040 m_writeStmt->setSQL("INSERT INTO fe_lut_per_group_dat (lut_conf_id, group_id, " 00041 " lut_id, lut_value ) " 00042 "VALUES (:lut_conf_id, :group_id, " 00043 ":lut_id, :lut_value )" ); 00044 } catch (SQLException &e) { 00045 throw(runtime_error("FEConfigLUTGroupDat::prepareWrite(): "+e.getMessage())); 00046 } 00047 }
Definition at line 20 of file FEConfigLUTGroupDat.h.
References m_group_id.
Referenced by EcalTPGParamBuilder::analyze().
00020 { m_group_id = x; }
Definition at line 23 of file FEConfigLUTGroupDat.h.
References m_lut.
Referenced by EcalTPGParamBuilder::analyze().
void FEConfigLUTGroupDat::writeArrayDB | ( | const std::map< EcalLogicID, FEConfigLUTGroupDat > * | data, | |
FEConfigLUTInfo * | iconf | |||
) | throw (std::runtime_error) [private] |
Definition at line 178 of file FEConfigLUTGroupDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), count, GenMuonPlsPt100GeV_cfg::cout, data, lat::endl(), getLUTGroupId(), getLUTValue(), i, IDataItem::m_writeStmt, x, y, and z.
00180 { 00181 this->checkConnection(); 00182 this->checkPrepare(); 00183 00184 int iconfID = iconf->fetchID(); 00185 if (!iconfID) { throw(runtime_error("FEConfigLUTGroupDat::writeArrayDB: ICONF not in DB")); } 00186 00187 00188 int nrows=data->size()*1024; 00189 00190 int* iconfid_vec= new int[nrows]; 00191 int* xx= new int[nrows]; 00192 int* yy= new int[nrows]; 00193 int* zz= new int[nrows]; 00194 00195 00196 00197 ub2* iconf_len= new ub2[nrows]; 00198 ub2* x_len= new ub2[nrows]; 00199 ub2* y_len= new ub2[nrows]; 00200 ub2* z_len= new ub2[nrows]; 00201 00202 00203 const FEConfigLUTGroupDat* dataitem; 00204 int count=0; 00205 typedef map< EcalLogicID, FEConfigLUTGroupDat >::const_iterator CI; 00206 for (CI p = data->begin(); p != data->end(); ++p) { 00207 00208 00209 dataitem = &(p->second); 00210 int x=dataitem->getLUTGroupId(); 00211 00212 00213 for (int i=0; i<1024; i++){ 00214 iconfid_vec[count]=iconfID; 00215 int y=i; 00216 int z=dataitem->getLUTValue(i); 00217 00218 xx[count]=x; 00219 yy[count]=y; 00220 zz[count]=z; 00221 00222 00223 iconf_len[count]=sizeof(iconfid_vec[count]); 00224 00225 x_len[count]=sizeof(xx[count]); 00226 y_len[count]=sizeof(yy[count]); 00227 z_len[count]=sizeof(zz[count]); 00228 00229 count++; 00230 00231 } 00232 } 00233 00234 00235 try { 00236 00237 // for (int i=0; i<nrows; i++){ 00238 00239 int i=0; 00240 cout << "about to insert "<< iconfid_vec[i]<<" " <<xx[i]<< " "<< yy[i]<< " "<< zz[i]<< endl; 00241 i=nrows-1; 00242 cout << "about to insert "<< iconfid_vec[i]<<" " <<xx[i]<< " "<< yy[i]<< " "<< zz[i]<< endl; 00243 // } 00244 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len); 00245 m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len ); 00246 m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len ); 00247 m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT , sizeof(zz[0]), z_len ); 00248 00249 m_writeStmt->executeArrayUpdate(nrows); 00250 00251 00252 delete [] iconfid_vec; 00253 delete [] xx; 00254 delete [] yy; 00255 delete [] zz; 00256 00257 00258 00259 delete [] iconf_len; 00260 delete [] x_len; 00261 delete [] y_len; 00262 delete [] z_len; 00263 00264 00265 } catch (SQLException &e) { 00266 throw(runtime_error("FEConfigLUTGroupDat::writeArrayDB(): "+e.getMessage())); 00267 } 00268 }
void FEConfigLUTGroupDat::writeDB | ( | const EcalLogicID * | ecid, | |
const FEConfigLUTGroupDat * | item, | |||
FEConfigLUTInfo * | iconf | |||
) | throw (std::runtime_error) [private] |
Definition at line 49 of file FEConfigLUTGroupDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), count, GenMuonPlsPt100GeV_cfg::cout, e, lat::endl(), m_lut, IDataItem::m_writeStmt, x, y, and z.
00051 { 00052 this->checkConnection(); 00053 this->checkPrepare(); 00054 00055 int iconfID = iconf->fetchID(); 00056 00057 cout<< "iconf="<< iconfID << endl; 00058 00059 if (!iconfID) { throw(runtime_error("FEConfigLUTGroupDat::writeArrayDB: ICONF not in DB")); } 00060 00061 00062 int nrows=1024; 00063 int* iconfid_vec= new int[nrows]; 00064 int* xx= new int[nrows]; 00065 int* yy= new int[nrows]; 00066 int* zz= new int[nrows]; 00067 00068 00069 ub2* iconf_len= new ub2[nrows]; 00070 ub2* x_len= new ub2[nrows]; 00071 ub2* y_len= new ub2[nrows]; 00072 ub2* z_len= new ub2[nrows]; 00073 00074 00075 00076 for(int count=0; count<nrows; count++){ 00077 00078 iconfid_vec[count]=iconfID; 00079 int x=item->getLUTGroupId(); 00080 int y=count; 00081 int z=m_lut[count]; 00082 00083 xx[count]=x; 00084 yy[count]=y; 00085 zz[count]=z; 00086 00087 iconf_len[count]=sizeof(iconfid_vec[count]); 00088 00089 x_len[count]=sizeof(xx[count]); 00090 y_len[count]=sizeof(yy[count]); 00091 z_len[count]=sizeof(zz[count]); 00092 00093 } 00094 00095 00096 try { 00097 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len); 00098 m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len ); 00099 m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len ); 00100 m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT , sizeof(zz[0]), z_len ); 00101 00102 m_writeStmt->executeArrayUpdate(nrows); 00103 00104 00105 delete [] iconfid_vec; 00106 delete [] xx; 00107 delete [] yy; 00108 delete [] zz; 00109 00110 00111 00112 delete [] iconf_len; 00113 delete [] x_len; 00114 delete [] y_len; 00115 delete [] z_len; 00116 00117 00118 } catch (SQLException &e) { 00119 throw(runtime_error("FEConfigLUTGroupDat::writeArrayDB(): "+e.getMessage())); 00120 } 00121 }
friend class EcalCondDBInterface [friend] |
int FEConfigLUTGroupDat::m_group_id [private] |
Definition at line 44 of file FEConfigLUTGroupDat.h.
Referenced by FEConfigLUTGroupDat(), getLUTGroupId(), and setLUTGroupId().
int FEConfigLUTGroupDat::m_lut[1024] [private] |
Definition at line 45 of file FEConfigLUTGroupDat.h.
Referenced by FEConfigLUTGroupDat(), getLUTValue(), setLUTValue(), and writeDB().