#include <CondTools/Hcal/interface/HcalDbOnline.h>
Public Types | |
typedef std::pair< IOVTime, IOVTime > | IntervalOV |
typedef unsigned long long | IOVTime |
Public Member Functions | |
std::vector< IntervalOV > | getIOVs (const std::string &fTag) |
bool | getObject (HcalCalibrationQIEData *fObject, const std::string &fTag, IOVTime fTime) |
bool | getObject (HcalQIEData *fObject, const std::string &fTag, IOVTime fTime) |
bool | getObject (HcalElectronicsMap *fObject, const std::string &fTag, IOVTime fTime) |
bool | getObject (HcalGainWidths *fObject, const std::string &fTag, IOVTime fTime) |
bool | getObject (HcalPedestalWidths *fObject, const std::string &fTag, IOVTime fTime) |
bool | getObject (HcalGains *fObject, const std::string &fTag, IOVTime fTime) |
bool | getObject (HcalGains *fObject, HcalGainWidths *fWidths, const std::string &fTag, IOVTime fTime) |
bool | getObject (HcalPedestals *fObject, const std::string &fTag, IOVTime fTime) |
bool | getObject (HcalPedestals *fObject, HcalPedestalWidths *fWidths, const std::string &fTag, IOVTime fTime) |
HcalDbOnline (const std::string &fDb, bool fVerbose=false) | |
std::vector< std::string > | metadataAllTags () |
~HcalDbOnline () | |
Private Member Functions | |
template<class T> | |
bool | getObjectGeneric (T *fObject, const std::string &fTag) |
Private Attributes | |
oracle::occi::Connection * | mConnect |
oracle::occi::Environment * | mEnvironment |
oracle::occi::Statement * | mStatement |
bool | mVerbose |
Definition at line 34 of file HcalDbOnline.h.
typedef std::pair<IOVTime, IOVTime> HcalDbOnline::IntervalOV |
Definition at line 37 of file HcalDbOnline.h.
typedef unsigned long long HcalDbOnline::IOVTime |
Definition at line 36 of file HcalDbOnline.h.
HcalDbOnline::HcalDbOnline | ( | const std::string & | fDb, | |
bool | fVerbose = false | |||
) |
Definition at line 26 of file HcalDbOnline.cc.
References TestMuL1L2Filter_cff::cerr, lat::endl(), cmsBenchmark::host, mConnect, mEnvironment, mStatement, and cmsBenchmark::user.
00027 : mConnect (0), 00028 mVerbose (fVerbose) 00029 { 00030 mEnvironment = oracle::occi::Environment::createEnvironment (oracle::occi::Environment::OBJECT); 00031 // decode connect string 00032 unsigned ipass = fDb.find ('/'); 00033 unsigned ihost = fDb.find ('@'); 00034 00035 if (ipass == std::string::npos || ihost == std::string::npos) { 00036 std::cerr << "HcalDbOnline::HcalDbOnline-> Error in connection string format: " << fDb 00037 << " Expect user/password@db" << std::endl; 00038 } 00039 else { 00040 std::string user (fDb, 0, ipass); 00041 std::string pass (fDb, ipass+1, ihost-ipass-1); 00042 std::string host (fDb, ihost+1); 00043 // std::cout << "HcalDbOnline::HcalDbOnline-> Connecting " << user << '/' << pass << '@' << host << std::endl; 00044 try { 00045 mConnect = mEnvironment->createConnection(user, pass, host); 00046 mStatement = mConnect->createStatement (); 00047 } 00048 catch (oracle::occi::SQLException& sqlExcp) { 00049 std::cerr << "HcalDbOnline::HcalDbOnline exception-> " << sqlExcp.getErrorCode () << ": " << sqlExcp.what () << std::endl; 00050 } 00051 } 00052 }
HcalDbOnline::~HcalDbOnline | ( | ) |
Definition at line 54 of file HcalDbOnline.cc.
References mConnect, mEnvironment, and mStatement.
00054 { 00055 delete mStatement; 00056 mEnvironment->terminateConnection (mConnect); 00057 oracle::occi::Environment::terminateEnvironment (mEnvironment); 00058 }
std::vector< HcalDbOnline::IntervalOV > HcalDbOnline::getIOVs | ( | const std::string & | fTag | ) |
Definition at line 592 of file HcalDbOnline.cc.
References TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), max, mStatement, mVerbose, and HLT_VtxMuL3::result.
Referenced by copyObject(), and printRuns().
00592 { 00593 std::vector<IntervalOV> result; 00594 std::string sql_query (""); 00595 sql_query += "SELECT unique INTERVAL_OF_VALIDITY_BEGIN, INTERVAL_OF_VALIDITY_END from V_TAG_IOV_CONDDATASET\n"; 00596 sql_query += "WHERE TAG_NAME='" + fTag + "'\n"; 00597 sql_query += "ORDER by INTERVAL_OF_VALIDITY_BEGIN\n"; 00598 try { 00599 if (mVerbose) std::cout << "executing query: \n" << sql_query << std::endl; 00600 mStatement->setPrefetchRowCount (100); 00601 mStatement->setSQL (sql_query); 00602 oracle::occi::ResultSet* rset = mStatement->executeQuery (); 00603 while (rset->next ()) { 00604 // char buffer [128]; 00605 // oracle::occi::Bytes iovb = rset->getNumber (1).toBytes(); 00606 // unsigned ix = 0; 00607 // std::cout << "total bytes: " << iovb.length() << std::endl; 00608 // for (; ix < iovb.length(); ix++) { 00609 // sprintf (buffer, "byte# %d: %x", ix, iovb.byteAt (ix)); 00610 // std::cout << buffer << std::endl; 00611 // } 00612 IOVTime beginIov = (unsigned long) rset->getNumber (1); 00613 // sprintf (buffer, "%x", beginIov); 00614 // std::cout << "value: " << buffer << std::endl; 00615 IOVTime endIov = rset->getInt (2); 00616 if (!endIov) endIov = std::numeric_limits <IOVTime>::max (); // end of ages 00617 result.push_back (std::make_pair (beginIov, endIov)); 00618 } 00619 } 00620 catch (oracle::occi::SQLException& sqlExcp) { 00621 std::cerr << "HcalDbOnline::getIOVs exception-> " << sqlExcp.getErrorCode () << ": " << sqlExcp.what () << std::endl; 00622 } 00623 return result; 00624 }
bool HcalDbOnline::getObject | ( | HcalCalibrationQIEData * | fObject, | |
const std::string & | fTag, | |||
IOVTime | fTime | |||
) |
Definition at line 279 of file HcalDbOnline.cc.
References HcalCalibrationQIEData::addCoder(), TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), eta, hcalSubdet(), i, id, index, mStatement, mVerbose, phi, HcalCalibrationQIECoder::setMinCharges(), HcalCalibrationQIEData::sort(), values, and z.
00279 { 00280 if (!fObject) return false; 00281 std::string sql_what (""); 00282 sql_what += " ADC_CH.SIDE, ADC_CH.ETA, ADC_CH.PHI, ADC_CH.DEPTH, ADC_CH.SUBDETECTOR,\n" ; 00283 sql_what += " DAT.BIN0, DAT.BIN1, DAT.BIN2, DAT.BIN3, DAT.BIN4, DAT.BIN5, DAT.BIN6, DAT.BIN7,\n"; 00284 sql_what += " DAT.BIN8, DAT.BIN9, DAT.BIN10, DAT.BIN11, DAT.BIN12, DAT.BIN13, DAT.BIN14, DAT.BIN15,\n"; 00285 sql_what += " DAT.BIN16, DAT.BIN17, DAT.BIN18, DAT.BIN19, DAT.BIN20, DAT.BIN21, DAT.BIN22, DAT.BIN23,\n"; 00286 sql_what += " DAT.BIN24, DAT.BIN25, DAT.BIN26, DAT.BIN27, DAT.BIN28, DAT.BIN29, DAT.BIN30, DAT.BIN31 \n"; 00287 00288 // HB/HE/HO 00289 std::string sql_hbheho (""); 00290 sql_hbheho += " FROM \n"; 00291 sql_hbheho += " CMS_HCL_HCAL_CONDITION_OWNER.QIECARD_ADC_CALIBMODE DAT\n"; 00292 sql_hbheho += " inner join CMS_HCL_CORE_CONDITION_OWNER.COND_DATA_SETS DS\n"; 00293 sql_hbheho += " on DAT.CONDITION_DATA_SET_ID=DS.CONDITION_DATA_SET_ID\n"; 00294 sql_hbheho += " inner join \n"; 00295 sql_hbheho += " ( \n"; 00296 sql_hbheho += " select\n"; 00297 sql_hbheho += " LOGMAP.SIDE,\n"; 00298 sql_hbheho += " LOGMAP.ETA,\n"; 00299 sql_hbheho += " LOGMAP.PHI,\n"; 00300 sql_hbheho += " LOGMAP.DEPTH,\n"; 00301 sql_hbheho += " LOGMAP.SUBDETECTOR,\n"; 00302 sql_hbheho += " ADC_CHAIN.ADC_PART_ID\n"; 00303 sql_hbheho += " from\n"; 00304 sql_hbheho += " CMS_HCL_HCAL_CONDITION_OWNER.HCAL_HARDWARE_LOGICAL_MAPS_V2 LOGMAP\n"; 00305 sql_hbheho += " inner join CMS_HCL_CORE_CONDITION_OWNER.COND_DATA_SETS LOGMAP_DS\n"; 00306 sql_hbheho += " on LOGMAP_DS.CONDITION_DATA_SET_ID=LOGMAP.CONDITION_DATA_SET_ID\n"; 00307 sql_hbheho += " inner join\n"; 00308 sql_hbheho += " (\n"; 00309 sql_hbheho += " select ADC.PART_ID as ADC_PART_ID, \n"; 00310 sql_hbheho += " SLOT.NAME_LABEL as RBX_SLOT,\n"; 00311 sql_hbheho += " RM.RM_SLOT as RM_SLOT,\n"; 00312 sql_hbheho += " QIE.QIE_SLOT as QIE_SLOT,\n"; 00313 sql_hbheho += " ADC.ADC_POSITION as ADC\n"; 00314 sql_hbheho += " from CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_READOUTBOX_SLOTS SLOT\n"; 00315 sql_hbheho += " inner join CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_READOUTBOXS RBX\n"; 00316 sql_hbheho += " on RBX.PART_PARENT_ID=SLOT.PART_ID\n"; 00317 sql_hbheho += " inner join CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_READOUTMODULES RM\n"; 00318 sql_hbheho += " on RM.PART_PARENT_ID=RBX.PART_ID\n"; 00319 sql_hbheho += " inner join CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_QIECARDS QIE\n"; 00320 sql_hbheho += " on QIE.PART_PARENT_ID=RM.PART_ID\n"; 00321 sql_hbheho += " inner join CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_ADCS ADC\n"; 00322 sql_hbheho += " on ADC.PART_PARENT_ID=QIE.PART_ID \n"; 00323 sql_hbheho += " ) ADC_CHAIN\n"; 00324 sql_hbheho += " on ADC_CHAIN.RBX_SLOT = LOGMAP.RBX_SLOT and\n"; 00325 sql_hbheho += " ADC_CHAIN.RM_SLOT = LOGMAP.RM_SLOT and\n"; 00326 sql_hbheho += " ADC_CHAIN.QIE_SLOT = LOGMAP.QIE_SLOT and\n"; 00327 sql_hbheho += " ADC_CHAIN.ADC = LOGMAP.ADC\n"; 00328 sql_hbheho += " where LOGMAP_DS.VERSION='15'\n"; 00329 sql_hbheho += " ) ADC_CH\n"; 00330 sql_hbheho += " on DS.PART_ID=ADC_CH.ADC_PART_ID\n"; 00331 sql_hbheho += " where DS.VERSION='3'\n"; 00332 00333 00334 // HF 00335 std::string sql_hf (""); 00336 sql_hf += " FROM \n"; 00337 sql_hf += " CMS_HCL_HCAL_CONDITION_OWNER.QIECARD_ADC_CALIBMODE DAT\n"; 00338 sql_hf += " inner join CMS_HCL_CORE_CONDITION_OWNER.COND_DATA_SETS DS\n"; 00339 sql_hf += " on DAT.CONDITION_DATA_SET_ID=DS.CONDITION_DATA_SET_ID\n"; 00340 sql_hf += " inner join \n"; 00341 sql_hf += " ( \n"; 00342 sql_hf += " select\n"; 00343 sql_hf += " LOGMAP.SIDE,\n"; 00344 sql_hf += " LOGMAP.ETA,\n"; 00345 sql_hf += " LOGMAP.PHI,\n"; 00346 sql_hf += " LOGMAP.DEPTH,\n"; 00347 sql_hf += " LOGMAP.SUBDETECTOR,\n"; 00348 sql_hf += " ADC_CHAIN.ADC_PART_ID\n"; 00349 sql_hf += " from\n"; 00350 sql_hf += " CMS_HCL_HCAL_CONDITION_OWNER.HCAL_HARDWARE_LOGICAL_MAPS_V2 LOGMAP\n"; 00351 sql_hf += " inner join CMS_HCL_CORE_CONDITION_OWNER.COND_DATA_SETS LOGMAP_DS\n"; 00352 sql_hf += " on LOGMAP_DS.CONDITION_DATA_SET_ID=LOGMAP.CONDITION_DATA_SET_ID\n"; 00353 sql_hf += " inner join\n"; 00354 sql_hf += " (\n"; 00355 sql_hf += " select ADC.PART_ID as ADC_PART_ID, \n"; 00356 sql_hf += " SLOT.NAME_LABEL as CRATE_SLOT,\n"; 00357 sql_hf += " QIE.QIE_SLOT as QIE_SLOT,\n"; 00358 sql_hf += " ADC.ADC_POSITION as ADC\n"; 00359 sql_hf += " from CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_WEDGE_SLOTS SLOT\n"; 00360 sql_hf += " inner join CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_HF_FE_CRATE CR\n"; 00361 sql_hf += " on CR.PART_PARENT_ID=SLOT.PART_ID\n"; 00362 sql_hf += " inner join CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_QIECARDS QIE\n"; 00363 sql_hf += " on QIE.PART_PARENT_ID=CR.PART_ID\n"; 00364 sql_hf += " inner join CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_ADCS ADC\n"; 00365 sql_hf += " on ADC.PART_PARENT_ID=QIE.PART_ID \n"; 00366 sql_hf += " ) ADC_CHAIN\n"; 00367 sql_hf += " on ADC_CHAIN.CRATE_SLOT = LOGMAP.RBX_SLOT and\n"; 00368 sql_hf += " ADC_CHAIN.QIE_SLOT = LOGMAP.QIE_SLOT and\n"; 00369 sql_hf += " ADC_CHAIN.ADC = LOGMAP.ADC\n"; 00370 sql_hf += " where LOGMAP_DS.VERSION='15'\n"; 00371 sql_hf += " ) ADC_CH\n"; 00372 sql_hf += " on DS.PART_ID=ADC_CH.ADC_PART_ID\n"; 00373 sql_hf += " where DS.VERSION='3'\n"; 00374 00375 00376 std::string sql_query [2]; 00377 sql_query [0] = " SELECT \n" + sql_what + sql_hbheho; 00378 sql_query [1] = " SELECT \n" + sql_what + sql_hf; 00379 00380 try { 00381 for (int i = 0; i < 2; i++) { 00382 if (mVerbose) std::cout << "executing query: \n" << sql_query [i] << std::endl; 00383 // oracle::occi::Statement* stmt = mConnect->createStatement (); 00384 mStatement->setPrefetchRowCount (100); 00385 mStatement->setSQL (sql_query [i]); 00386 oracle::occi::ResultSet* rset = mStatement->executeQuery (); 00387 while (rset->next ()) { 00388 int index = 1; 00389 int z = rset->getInt (index++); 00390 int eta = rset->getInt (index++); 00391 int phi = rset->getInt (index++); 00392 int depth = rset->getInt (index++); 00393 std::string subdet = rset->getString (index++); 00394 float values [32]; 00395 for (unsigned bin = 0; bin < 32; bin++) values [bin] = rset->getFloat (index++); 00396 00397 HcalSubdetector sub = hcalSubdet (subdet); 00398 HcalDetId id (sub, z * eta, phi, depth); 00399 00400 HcalCalibrationQIECoder coder(id.rawId()); 00401 coder.setMinCharges (values); 00402 00403 fObject->addCoder (coder); 00404 } 00405 delete rset; 00406 } 00407 // delete stmt; 00408 } 00409 catch (oracle::occi::SQLException& sqlExcp) { 00410 std::cerr << "HcalDbOnline::getObject exception-> " << sqlExcp.getErrorCode () << ": " << sqlExcp.what () << std::endl; 00411 } 00412 fObject->sort (); 00413 return true; 00414 }
bool HcalDbOnline::getObject | ( | HcalQIEData * | fObject, | |
const std::string & | fTag, | |||
IOVTime | fTime | |||
) |
Definition at line 122 of file HcalDbOnline.cc.
References HcalQIEData::addCoder(), capId(), TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), eta, hcalSubdet(), i, id, index, mStatement, mVerbose, offset, phi, range, HcalQIECoder::setOffset(), HcalQIECoder::setSlope(), slope, HcalQIEData::sort(), and z.
00122 { 00123 if (!fObject) return false; 00124 std::string sql_what (""); 00125 sql_what += " ADC_CH.SIDE, ADC_CH.ETA, ADC_CH.PHI, ADC_CH.DEPTH, ADC_CH.SUBDETECTOR,\n" ; 00126 sql_what += " DAT.CAP0_RANGE0_OFFSET, DAT.CAP0_RANGE0_SLOPE,\n" ; 00127 sql_what += " DAT.CAP0_RANGE1_OFFSET, DAT.CAP1_RANGE0_SLOPE,\n" ; 00128 sql_what += " DAT.CAP0_RANGE2_OFFSET, DAT.CAP2_RANGE0_SLOPE,\n" ; 00129 sql_what += " DAT.CAP0_RANGE3_OFFSET, DAT.CAP3_RANGE0_SLOPE,\n" ; 00130 sql_what += " DAT.CAP1_RANGE0_OFFSET, DAT.CAP0_RANGE1_SLOPE,\n" ; 00131 sql_what += " DAT.CAP1_RANGE1_OFFSET, DAT.CAP1_RANGE1_SLOPE,\n" ; 00132 sql_what += " DAT.CAP1_RANGE2_OFFSET, DAT.CAP2_RANGE1_SLOPE,\n" ; 00133 sql_what += " DAT.CAP1_RANGE3_OFFSET, DAT.CAP3_RANGE1_SLOPE,\n" ; 00134 sql_what += " DAT.CAP2_RANGE0_OFFSET, DAT.CAP0_RANGE2_SLOPE,\n" ; 00135 sql_what += " DAT.CAP2_RANGE1_OFFSET, DAT.CAP1_RANGE2_SLOPE,\n" ; 00136 sql_what += " DAT.CAP2_RANGE2_OFFSET, DAT.CAP2_RANGE2_SLOPE,\n" ; 00137 sql_what += " DAT.CAP2_RANGE3_OFFSET, DAT.CAP3_RANGE2_SLOPE,\n" ; 00138 sql_what += " DAT.CAP3_RANGE0_OFFSET, DAT.CAP0_RANGE3_SLOPE,\n" ; 00139 sql_what += " DAT.CAP3_RANGE1_OFFSET, DAT.CAP1_RANGE3_SLOPE,\n" ; 00140 sql_what += " DAT.CAP3_RANGE2_OFFSET, DAT.CAP2_RANGE3_SLOPE,\n" ; 00141 sql_what += " DAT.CAP3_RANGE3_OFFSET, DAT.CAP3_RANGE3_SLOPE \n" ; 00142 00143 // HB/HE/HO 00144 std::string sql_hbheho (""); 00145 sql_hbheho += " FROM \n"; 00146 sql_hbheho += " CMS_HCL_HCAL_CONDITION_OWNER.QIECARD_ADC_NORMMODE DAT\n"; 00147 sql_hbheho += " inner join CMS_HCL_CORE_CONDITION_OWNER.COND_DATA_SETS DS\n"; 00148 sql_hbheho += " on DAT.CONDITION_DATA_SET_ID=DS.CONDITION_DATA_SET_ID\n"; 00149 sql_hbheho += " inner join \n"; 00150 sql_hbheho += " ( \n"; 00151 sql_hbheho += " select\n"; 00152 sql_hbheho += " LOGMAP.SIDE,\n"; 00153 sql_hbheho += " LOGMAP.ETA,\n"; 00154 sql_hbheho += " LOGMAP.PHI,\n"; 00155 sql_hbheho += " LOGMAP.DEPTH,\n"; 00156 sql_hbheho += " LOGMAP.SUBDETECTOR,\n"; 00157 sql_hbheho += " ADC_CHAIN.ADC_PART_ID\n"; 00158 sql_hbheho += " from\n"; 00159 sql_hbheho += " CMS_HCL_HCAL_CONDITION_OWNER.HCAL_HARDWARE_LOGICAL_MAPS_V2 LOGMAP\n"; 00160 sql_hbheho += " inner join CMS_HCL_CORE_CONDITION_OWNER.COND_DATA_SETS LOGMAP_DS\n"; 00161 sql_hbheho += " on LOGMAP_DS.CONDITION_DATA_SET_ID=LOGMAP.CONDITION_DATA_SET_ID\n"; 00162 sql_hbheho += " inner join\n"; 00163 sql_hbheho += " (\n"; 00164 sql_hbheho += " select ADC.PART_ID as ADC_PART_ID, \n"; 00165 sql_hbheho += " SLOT.NAME_LABEL as RBX_SLOT,\n"; 00166 sql_hbheho += " RM.RM_SLOT as RM_SLOT,\n"; 00167 sql_hbheho += " QIE.QIE_SLOT as QIE_SLOT,\n"; 00168 sql_hbheho += " ADC.ADC_POSITION as ADC\n"; 00169 sql_hbheho += " from CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_READOUTBOX_SLOTS SLOT\n"; 00170 sql_hbheho += " inner join CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_READOUTBOXS RBX\n"; 00171 sql_hbheho += " on RBX.PART_PARENT_ID=SLOT.PART_ID\n"; 00172 sql_hbheho += " inner join CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_READOUTMODULES RM\n"; 00173 sql_hbheho += " on RM.PART_PARENT_ID=RBX.PART_ID\n"; 00174 sql_hbheho += " inner join CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_QIECARDS QIE\n"; 00175 sql_hbheho += " on QIE.PART_PARENT_ID=RM.PART_ID\n"; 00176 sql_hbheho += " inner join CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_ADCS ADC\n"; 00177 sql_hbheho += " on ADC.PART_PARENT_ID=QIE.PART_ID \n"; 00178 sql_hbheho += " ) ADC_CHAIN\n"; 00179 sql_hbheho += " on ADC_CHAIN.RBX_SLOT = LOGMAP.RBX_SLOT and\n"; 00180 sql_hbheho += " ADC_CHAIN.RM_SLOT = LOGMAP.RM_SLOT and\n"; 00181 sql_hbheho += " ADC_CHAIN.QIE_SLOT = LOGMAP.QIE_SLOT and\n"; 00182 sql_hbheho += " ADC_CHAIN.ADC = LOGMAP.ADC\n"; 00183 sql_hbheho += " where LOGMAP_DS.VERSION='15'\n"; 00184 sql_hbheho += " ) ADC_CH\n"; 00185 sql_hbheho += " on DS.PART_ID=ADC_CH.ADC_PART_ID\n"; 00186 sql_hbheho += " where DS.VERSION='3'\n"; 00187 00188 00189 // HF 00190 std::string sql_hf (""); 00191 sql_hf += " FROM \n"; 00192 sql_hf += " CMS_HCL_HCAL_CONDITION_OWNER.QIECARD_ADC_NORMMODE DAT\n"; 00193 sql_hf += " inner join CMS_HCL_CORE_CONDITION_OWNER.COND_DATA_SETS DS\n"; 00194 sql_hf += " on DAT.CONDITION_DATA_SET_ID=DS.CONDITION_DATA_SET_ID\n"; 00195 sql_hf += " inner join \n"; 00196 sql_hf += " ( \n"; 00197 sql_hf += " select\n"; 00198 sql_hf += " LOGMAP.SIDE,\n"; 00199 sql_hf += " LOGMAP.ETA,\n"; 00200 sql_hf += " LOGMAP.PHI,\n"; 00201 sql_hf += " LOGMAP.DEPTH,\n"; 00202 sql_hf += " LOGMAP.SUBDETECTOR,\n"; 00203 sql_hf += " ADC_CHAIN.ADC_PART_ID\n"; 00204 sql_hf += " from\n"; 00205 sql_hf += " CMS_HCL_HCAL_CONDITION_OWNER.HCAL_HARDWARE_LOGICAL_MAPS_V2 LOGMAP\n"; 00206 sql_hf += " inner join CMS_HCL_CORE_CONDITION_OWNER.COND_DATA_SETS LOGMAP_DS\n"; 00207 sql_hf += " on LOGMAP_DS.CONDITION_DATA_SET_ID=LOGMAP.CONDITION_DATA_SET_ID\n"; 00208 sql_hf += " inner join\n"; 00209 sql_hf += " (\n"; 00210 sql_hf += " select ADC.PART_ID as ADC_PART_ID, \n"; 00211 sql_hf += " SLOT.NAME_LABEL as CRATE_SLOT,\n"; 00212 sql_hf += " QIE.QIE_SLOT as QIE_SLOT,\n"; 00213 sql_hf += " ADC.ADC_POSITION as ADC\n"; 00214 sql_hf += " from CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_WEDGE_SLOTS SLOT\n"; 00215 sql_hf += " inner join CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_HF_FE_CRATE CR\n"; 00216 sql_hf += " on CR.PART_PARENT_ID=SLOT.PART_ID\n"; 00217 sql_hf += " inner join CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_QIECARDS QIE\n"; 00218 sql_hf += " on QIE.PART_PARENT_ID=CR.PART_ID\n"; 00219 sql_hf += " inner join CMS_HCL_CORE_CONSTRUCT_OWNER.V_HCAL_ADCS ADC\n"; 00220 sql_hf += " on ADC.PART_PARENT_ID=QIE.PART_ID \n"; 00221 sql_hf += " ) ADC_CHAIN\n"; 00222 sql_hf += " on ADC_CHAIN.CRATE_SLOT = LOGMAP.RBX_SLOT and\n"; 00223 sql_hf += " ADC_CHAIN.QIE_SLOT = LOGMAP.QIE_SLOT and\n"; 00224 sql_hf += " ADC_CHAIN.ADC = LOGMAP.ADC\n"; 00225 sql_hf += " where LOGMAP_DS.VERSION='15'\n"; 00226 sql_hf += " ) ADC_CH\n"; 00227 sql_hf += " on DS.PART_ID=ADC_CH.ADC_PART_ID\n"; 00228 sql_hf += " where DS.VERSION='3'\n"; 00229 00230 std::string sql_query [2]; 00231 sql_query [0] = " SELECT \n" + sql_what + sql_hbheho; 00232 sql_query [1] = " SELECT \n" + sql_what + sql_hf; 00233 00234 try { 00235 for (int i = 0; i < 2; i++) { 00236 if (mVerbose) std::cout << "executing query: \n" << sql_query[i] << std::endl; 00237 mStatement->setPrefetchRowCount (100); 00238 mStatement->setSQL (sql_query [i]); 00239 oracle::occi::ResultSet* rset = mStatement->executeQuery (); 00240 while (rset->next ()) { 00241 int index = 1; 00242 int z = rset->getInt (index++); 00243 int eta = rset->getInt (index++); 00244 int phi = rset->getInt (index++); 00245 int depth = rset->getInt (index++); 00246 std::string subdet = rset->getString (index++); 00247 float offset [4][4]; 00248 float slope [4][4]; 00249 for (int capId = 0; capId < 4; capId++) { 00250 for (int range = 0; range < 4; range++) { 00251 offset [capId][range] = rset->getFloat (index++); 00252 slope [capId][range] = rset->getFloat (index++); 00253 } 00254 } 00255 00256 HcalSubdetector sub = hcalSubdet (subdet); 00257 HcalDetId id (sub, z * eta, phi, depth); 00258 00259 HcalQIECoder coder(id.rawId()); 00260 for (int capId = 0; capId < 4; capId++) { 00261 for (int range = 0; range < 4; range++) { 00262 coder.setOffset (capId, range, offset [capId][range]); 00263 coder.setSlope (capId, range, slope [capId][range]); 00264 } 00265 } 00266 00267 fObject->addCoder (coder); 00268 } 00269 delete rset; 00270 } 00271 } 00272 catch (oracle::occi::SQLException& sqlExcp) { 00273 std::cerr << "HcalDbOnline::getObject exception-> " << sqlExcp.getErrorCode () << ": " << sqlExcp.what () << std::endl; 00274 } 00275 fObject->sort (); 00276 return true; 00277 }
bool HcalDbOnline::getObject | ( | HcalElectronicsMap * | fObject, | |
const std::string & | fTag, | |||
IOVTime | fTime | |||
) |
Definition at line 60 of file HcalDbOnline.cc.
References TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), eta, hcalSubdet(), id, index, HcalElectronicsMap::mapEId2chId(), mStatement, mVerbose, phi, HcalElectronicsId::setHTR(), HcalElectronicsMap::sort(), ecalRecalibSequence_cff::tag, and z.
00060 { 00061 if (!fObject) return false; 00062 std::string tag = fTag; 00063 if (tag.empty()) { 00064 tag = "9"; 00065 std::cout << "HcalDbOnline::getObject (HcalElectronicsMap*..)-> Using default tag: " << tag << std::endl; 00066 } 00067 std::string sql_query (""); 00068 sql_query += "SELECT\n"; 00069 sql_query += " DAT2.SIDE, DAT2.ETA, DAT2.PHI, DAT2.DEPTH, DAT2.SUBDETECTOR,\n" ; 00070 sql_query += " DAT2.CRATE, DAT2.HTR_SLOT, DAT2.HTR_FPGA, DAT2.DCC, DAT2.DCC_SPIGOT, DAT2.HTR_FIBER, DAT2.FIBER_CHANNEL \n" ; 00071 sql_query += " FROM\n"; 00072 sql_query += " CMS_HCL_HCAL_CONDITION_OWNER.HCAL_HARDWARE_LOGICAL_MAPS DAT2,\n"; 00073 sql_query += " CMS_HCL_CORE_CONDITION_OWNER.COND_DATA_SETS DS2,\n"; 00074 sql_query += " CMS_HCL_CORE_CONDITION_OWNER.KINDS_OF_CONDITIONS KOC2\n"; 00075 sql_query += " WHERE\n"; 00076 sql_query += " DS2.CONDITION_DATA_SET_ID=DAT2.CONDITION_DATA_SET_ID\n"; 00077 sql_query += " AND KOC2.KIND_OF_CONDITION_ID=DS2.KIND_OF_CONDITION_ID \n"; 00078 sql_query += " AND KOC2.IS_RECORD_DELETED='F' AND DS2.IS_RECORD_DELETED='F' \n"; 00079 sql_query += " AND KOC2.EXTENSION_TABLE_NAME='HCAL_HARDWARE_LOGICAL_MAPS' \n"; 00080 sql_query += " AND DS2.VERSION='" + tag + "'\n"; 00081 try { 00082 if (mVerbose) std::cout << "executing query: \n" << sql_query << std::endl; 00083 // oracle::occi::Statement* stmt = mConnect->createStatement (); 00084 mStatement->setPrefetchRowCount (100); 00085 mStatement->setSQL (sql_query); 00086 oracle::occi::ResultSet* rset = mStatement->executeQuery (); 00087 while (rset->next ()) { 00088 int index = 1; 00089 int z = rset->getInt (index++) > 0 ? 1 : -1; 00090 int eta = rset->getInt (index++); 00091 int phi = rset->getInt (index++); 00092 int depth = rset->getInt (index++); 00093 std::string subdet = rset->getString (index++); 00094 int crate = rset->getInt (index++); 00095 int slot = rset->getInt (index++); 00096 int fpga = rset->getInt (index++) > 0 ? 1 : 0; 00097 int dcc = rset->getInt (index++); 00098 int spigot = rset->getInt (index++); 00099 int fiber = rset->getInt (index++); 00100 int fiberChannel = rset->getInt (index++); 00101 00102 HcalElectronicsId eid (fiberChannel, fiber, spigot, dcc); 00103 eid.setHTR (crate, slot, fpga); 00104 00105 HcalSubdetector sub = hcalSubdet (subdet); 00106 HcalDetId id (sub, z * eta, phi, depth); 00107 00108 // fObject->setMapping (id, eid, HcalTrigTowerDetId ()); 00109 DetId detid(id); 00110 fObject->mapEId2chId (eid,detid); 00111 } 00112 delete rset; 00113 // delete stmt; 00114 } 00115 catch (oracle::occi::SQLException& sqlExcp) { 00116 std::cerr << "HcalDbOnline::getObject exception-> " << sqlExcp.getErrorCode () << ": " << sqlExcp.what () << std::endl; 00117 } 00118 fObject->sort (); 00119 return true; 00120 }
bool HcalDbOnline::getObject | ( | HcalGainWidths * | fObject, | |
const std::string & | fTag, | |||
IOVTime | fTime | |||
) |
bool HcalDbOnline::getObject | ( | HcalPedestalWidths * | fObject, | |
const std::string & | fTag, | |||
IOVTime | fTime | |||
) |
Definition at line 492 of file HcalDbOnline.cc.
References getObject().
00492 { 00493 return getObject ((HcalPedestals*)0, fObject, fTag, fTime); 00494 }
Definition at line 564 of file HcalDbOnline.cc.
References getObject().
00564 { 00565 return getObject (fObject, (HcalGainWidths*) 0, fTag, fTime); 00566 }
bool HcalDbOnline::getObject | ( | HcalGains * | fObject, | |
HcalGainWidths * | fWidths, | |||
const std::string & | fTag, | |||
IOVTime | fTime | |||
) |
Definition at line 496 of file HcalDbOnline.cc.
References TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), eta, hcalSubdet(), i, id, index, mStatement, mVerbose, phi, values, and z.
00496 { 00497 if (!fObject && !fWidths) return false; 00498 std::ostringstream sTime; 00499 sTime << fTime; 00500 std::string sql_query (""); 00501 sql_query += "SELECT\n"; 00502 sql_query += " Z, ETA, PHI, DEPTH, DETECTOR_NAME\n"; 00503 sql_query += " , CAPACITOR_0_VALUE, CAPACITOR_1_VALUE, CAPACITOR_2_VALUE, CAPACITOR_3_VALUE\n"; 00504 sql_query += " , CAPACITOR_0_ERROR, CAPACITOR_1_ERROR, CAPACITOR_2_ERROR, CAPACITOR_3_ERROR\n"; 00505 sql_query += " , RUN_NUMBER, INTERVAL_OF_VALIDITY_BEGIN, INTERVAL_OF_VALIDITY_END\n"; 00506 sql_query += "FROM V_HCAL_GAIN_CALIBRATIONS\n"; 00507 sql_query += "WHERE TAG_NAME='" + fTag + "'\n"; 00508 sql_query += "AND INTERVAL_OF_VALIDITY_BEGIN=" + sTime.str() + "\n"; 00509 sql_query += "AND (INTERVAL_OF_VALIDITY_END IS NULL OR INTERVAL_OF_VALIDITY_END>" + sTime.str() + ")\n"; 00510 try { 00511 if (mVerbose) std::cout << "executing query: \n" << sql_query << std::endl; 00512 mStatement->setPrefetchRowCount (100); 00513 mStatement->setSQL (sql_query); 00514 oracle::occi::ResultSet* rset = mStatement->executeQuery (); 00515 std::cout << "query is executed... " << std::endl; 00516 while (rset->next ()) { 00517 int index = 1; 00518 int z = rset->getInt (index++); 00519 int eta = rset->getInt (index++); 00520 int phi = rset->getInt (index++); 00521 int depth = rset->getInt (index++); 00522 std::string subdet = rset->getString (index++); 00523 00524 float values [4]; 00525 float widths [4]; 00526 for (int i = 0; i < 4; i++) values[i] = rset->getFloat (index++); 00527 for (int i = 0; i < 4; i++) widths [i] = rset->getFloat (index++); 00528 // unsigned long run = rset->getNumber (index++); 00529 // unsigned long iovBegin = rset->getNumber (index++); 00530 // unsigned long iovEnd = rset->getNumber (index++); 00531 00532 HcalSubdetector sub = hcalSubdet (subdet); 00533 HcalDetId id (sub, z * eta, phi, depth); 00534 00535 if (fObject) { 00536 if (fObject->exists(id) ) 00537 std::cerr << "HcalDbOnline::getObject-> Ignore data to redefine channel " << id.rawId() << std::endl; 00538 else 00539 { 00540 HcalGain mygain(id,values[0],values[1],values[2],values[3]); 00541 fObject->addValues (mygain); 00542 } 00543 } 00544 if (fWidths) { 00545 if (fWidths->exists(id) ) 00546 std::cerr << "HcalDbOnline::getObject-> Ignore data to redefine channel " << id.rawId() << std::endl; 00547 else 00548 { 00549 HcalGainWidth mywid(id,values[0],values[1],values[2],values[3]); 00550 fWidths->addValues(mywid); 00551 } 00552 } 00553 } 00554 delete rset; 00555 } 00556 catch (oracle::occi::SQLException& sqlExcp) { 00557 std::cerr << "HcalDbOnline::getObject exception-> " << sqlExcp.getErrorCode () << ": " << sqlExcp.what () << std::endl; 00558 } 00559 // if (fObject) fObject->sort (); 00560 // if (fWidths) fWidths->sort (); 00561 return true; 00562 }
bool HcalDbOnline::getObject | ( | HcalPedestals * | fObject, | |
const std::string & | fTag, | |||
IOVTime | fTime | |||
) |
Definition at line 488 of file HcalDbOnline.cc.
References getObject().
00488 { 00489 return getObject (fObject, (HcalPedestalWidths*)0, fTag, fTime); 00490 }
bool HcalDbOnline::getObject | ( | HcalPedestals * | fObject, | |
HcalPedestalWidths * | fWidths, | |||
const std::string & | fTag, | |||
IOVTime | fTime | |||
) |
Definition at line 417 of file HcalDbOnline.cc.
References TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), eta, hcalSubdet(), i, id, index, j, mStatement, mVerbose, phi, HcalPedestalWidth::setSigma(), values, and z.
Referenced by copyObject(), getObject(), and getObject().
00417 { 00418 if (!fObject && !fWidths) return false; 00419 std::ostringstream sTime; 00420 sTime << fTime; 00421 std::string sql_query (""); 00422 sql_query += "SELECT\n"; 00423 sql_query += " Z, ETA, PHI, DEPTH, DETECTOR_NAME\n"; 00424 sql_query += " , CAPACITOR_0_VALUE, CAPACITOR_1_VALUE, CAPACITOR_2_VALUE, CAPACITOR_3_VALUE\n"; 00425 sql_query += " , SIGMA_0_0, SIGMA_0_1, SIGMA_0_2, SIGMA_0_3, SIGMA_1_1, SIGMA_1_2, SIGMA_1_3, SIGMA_2_2, SIGMA_2_3, SIGMA_3_3\n"; 00426 sql_query += " , RUN_NUMBER, INTERVAL_OF_VALIDITY_BEGIN, INTERVAL_OF_VALIDITY_END\n"; 00427 sql_query += "FROM V_HCAL_PEDESTALS_V2\n"; 00428 sql_query += "WHERE TAG_NAME='" + fTag + "'\n"; 00429 sql_query += "AND INTERVAL_OF_VALIDITY_BEGIN=" + sTime.str() + "\n"; 00430 sql_query += "AND (INTERVAL_OF_VALIDITY_END IS NULL OR INTERVAL_OF_VALIDITY_END>" + sTime.str() + ")\n"; 00431 try { 00432 if (mVerbose) std::cout << "executing query: \n" << sql_query << std::endl; 00433 mStatement->setPrefetchRowCount (100); 00434 mStatement->setSQL (sql_query); 00435 oracle::occi::ResultSet* rset = mStatement->executeQuery (); 00436 while (rset->next ()) { 00437 int index = 1; 00438 int z = rset->getInt (index++); 00439 int eta = rset->getInt (index++); 00440 int phi = rset->getInt (index++); 00441 int depth = rset->getInt (index++); 00442 std::string subdet = rset->getString (index++); 00443 00444 float values [4]; 00445 float widths [4][4]; 00446 for (int i = 0; i < 4; i++) values[i] = rset->getFloat (index++); 00447 for (int i = 0; i < 4; i++) 00448 for (int j = i; j < 4; j++) widths [i][j] = rset->getFloat (index++); 00449 00450 // unsigned long run = rset->getNumber (index++); 00451 // unsigned long iovBegin = rset->getNumber (index++); 00452 // unsigned long iovEnd = rset->getNumber (index++); 00453 00454 HcalSubdetector sub = hcalSubdet (subdet); 00455 HcalDetId id (sub, z * eta, phi, depth); 00456 00457 if (fObject) { 00458 if (fObject->exists(id) ) 00459 std::cerr << "HcalDbOnline::getObject-> Ignore data to redefine channel " << id.rawId() << std::endl; 00460 else 00461 { 00462 HcalPedestal myped(id,values[0],values[1],values[2],values[3]); 00463 fObject->addValues(myped); 00464 } 00465 } 00466 if (fWidths) { 00467 if (fWidths->exists(id) ) 00468 std::cerr << "HcalDbOnline::getObject-> Ignore data to redefine channel " << id.rawId() << std::endl; 00469 else 00470 { 00471 HcalPedestalWidth mywidth(id); 00472 for (int i = 0; i < 4; i++) 00473 for (int j = i; j < 4; j++) mywidth.setSigma (i, j, widths [i][j]); 00474 fWidths->addValues(mywidth); 00475 } 00476 } 00477 } 00478 delete rset; 00479 } 00480 catch (oracle::occi::SQLException& sqlExcp) { 00481 std::cerr << "HcalDbOnline::getObject exception-> " << sqlExcp.getErrorCode () << ": " << sqlExcp.what () << std::endl; 00482 } 00483 // if (fObject) fObject->sort (); 00484 // if (fWidths) fWidths->sort (); 00485 return true; 00486 }
bool HcalDbOnline::getObjectGeneric | ( | T * | fObject, | |
const std::string & | fTag | |||
) | [inline, private] |
std::vector< std::string > HcalDbOnline::metadataAllTags | ( | ) |
Definition at line 572 of file HcalDbOnline.cc.
References TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), mStatement, mVerbose, HLT_VtxMuL3::result, and ecalRecalibSequence_cff::tag.
Referenced by printTags().
00572 { 00573 std::vector<std::string> result; 00574 std::string sql_query (""); 00575 sql_query += "SELECT unique TAG_NAME from V_TAG_IOV_CONDDATASET order by TAG_NAME\n"; 00576 try { 00577 if (mVerbose) std::cout << "executing query: \n" << sql_query << std::endl; 00578 mStatement->setPrefetchRowCount (100); 00579 mStatement->setSQL (sql_query); 00580 oracle::occi::ResultSet* rset = mStatement->executeQuery (); 00581 while (rset->next ()) { 00582 std::string tag = rset->getString (1); 00583 result.push_back (tag); 00584 } 00585 } 00586 catch (oracle::occi::SQLException& sqlExcp) { 00587 std::cerr << "HcalDbOnline::metadataAllTags exception-> " << sqlExcp.getErrorCode () << ": " << sqlExcp.what () << std::endl; 00588 } 00589 return result; 00590 }
oracle::occi::Connection* HcalDbOnline::mConnect [private] |
oracle::occi::Environment* HcalDbOnline::mEnvironment [private] |
oracle::occi::Statement* HcalDbOnline::mStatement [private] |
Definition at line 59 of file HcalDbOnline.h.
Referenced by getIOVs(), getObject(), HcalDbOnline(), metadataAllTags(), and ~HcalDbOnline().
bool HcalDbOnline::mVerbose [private] |
Definition at line 61 of file HcalDbOnline.h.
Referenced by getIOVs(), getObject(), and metadataAllTags().