8 #ifndef ECALCONDDBINTERFACE_HH
9 #define ECALCONDDBINTERFACE_HH
139 std::
string mapsTo = "") noexcept(false);
149 std::
string mapsTo = "",
150 int orderedBy =
EcalLogicID::NULLID) noexcept(false);
248 int n_runs) noexcept(false);
264 if (iov->getID() == 0) {
265 std::cout <<
"IOV was not set we retrieve it from DB" << std::endl;
268 if (iov->getID() == 0) {
269 std::cout <<
"IOV was not written we write it" << std::endl;
274 dataIface.setConnection(
env,
conn);
275 dataIface.prepareWrite();
277 const EcalLogicID* channel;
278 const DATT* dataitem;
279 typedef typename std::map<EcalLogicID, DATT>::const_iterator CI;
280 for (CI
p = data->begin();
p != data->end(); ++
p) {
281 channel = &(
p->first);
282 dataitem = &(
p->second);
283 dataIface.writeDB(channel, dataitem, iov);
286 dataIface.terminateWriteStatement();
287 }
catch (std::runtime_error&
e) {
292 throw(std::runtime_error(
"EcalCondDBInterface::insertDataSet: Unknown exception caught"));
297 template <
class DATT,
class IOVT>
301 if (iov->getID() == 0) {
302 std::cout <<
"IOV was not set we retrieve it from DB" << std::endl;
305 if (iov->getID() == 0) {
306 std::cout <<
"IOV was not written we write it" << std::endl;
310 std::cout <<
"id=" << iov->getID() << std::endl;
313 dataIface.setConnection(
env,
conn);
314 dataIface.prepareWrite();
316 dataIface.writeArrayDB(
data, iov);
319 dataIface.terminateWriteStatement();
321 }
catch (std::runtime_error&
e) {
326 throw(std::runtime_error(
"EcalCondDBInterface::insertDataSet: Unknown exception caught"));
330 template <
class DATT,
class IOVT>
332 const std::vector<IOVT>& run_iov,
333 const std::vector<DATT>&
data) noexcept(
false) {
334 int nruns = run_iov.size();
336 if (run_iov.size() != ecid.size() && ecid.size() !=
data.size()) {
337 throw(std::runtime_error(
"EcalCondDBInterface::insertDataSetVector: vector sizes are different.."));
342 dataIface.setConnection(
env,
conn);
343 dataIface.prepareWrite();
345 for (
int i = 0;
i < nruns;
i++) {
346 run_iov[
i].setConnection(
env,
conn);
347 run_iov[
i].writeDB();
349 dataIface.writeDB(&ecid[
i], &
data[i], &run_iov[i]);
353 }
catch (std::runtime_error&
e) {
358 throw(std::runtime_error(
"EcalCondDBInterface::insertDataSet: Unknown exception caught"));
364 template <
class ICONF>
367 iconf->setConnection(
env,
conn);
368 iconf->prepareWrite();
371 std::cout <<
"iconf inserted with ID=" << iconf->getId() << std::endl;
373 iconf->terminateWriteStatement();
374 }
catch (std::runtime_error&
e) {
379 throw(std::runtime_error(
"EcalCondDBInterface::insertDataSet: Unknown exception caught"));
386 template <
class ICONF>
389 iconf->setConnection(
env,
conn);
390 iconf->createReadStatement();
391 iconf->fetchData(iconf);
392 iconf->terminateReadStatement();
398 template <
class ICONF>
401 iconf->setConnection(
env,
conn);
402 iconf->createReadStatement();
403 iconf->fetchLastData(iconf);
404 iconf->terminateReadStatement();
410 template <
class DATT,
class ICONF>
413 iconf->setConnection(
env,
conn);
415 if (iconf->getId() == 0) {
416 std::cout <<
"EcalCondDBInterface>> config_id was not set we retrieve it from DB" << std::endl;
419 if (iconf->getId() == 0) {
420 std::cout <<
"EcalCondDBInterface>> configuration info was not written we write it" << std::endl;
425 dataIface.setConnection(
env,
conn);
426 dataIface.prepareWrite();
428 const DATT* dataitem;
430 for (
int p = 0;
p !=
data->size(); ++
p) {
432 dataIface.writeDB(dataitem, iconf);
435 dataIface.terminateWriteStatement();
436 }
catch (std::runtime_error&
e) {
441 throw(std::runtime_error(
"EcalCondDBInterface::insertConfigDataSet: Unknown exception caught"));
447 template <
class DATT,
class ICONF>
450 iconf->setConnection(
env,
conn);
452 if (iconf->getId() == 0) {
453 std::cout <<
"EcalCondDBInterface>> config_id was not set we retrieve it from DB" << std::endl;
456 if (iconf->getId() == 0) {
457 std::cout <<
"EcalCondDBInterface>> configuration info was not written we write it" << std::endl;
462 dataIface.setConnection(
env,
conn);
463 dataIface.prepareWrite();
465 dataIface.writeArrayDB(
data, iconf);
468 dataIface.terminateWriteStatement();
470 }
catch (std::runtime_error&
e) {
475 throw(std::runtime_error(
"EcalCondDBInterface::insertConfigDataArraySet: Unknown exception caught"));
481 template <
class DATT,
class ICONF>
484 datiface.setConnection(
env,
conn);
485 datiface.createReadStatement();
486 datiface.setPrefetchRowCount(1024);
487 datiface.fetchData(fillMap, iconf);
488 datiface.terminateReadStatement();
494 template <
class DATT,
class IOVT>
495 void fetchDataSet(std::map<EcalLogicID, DATT>* fillMap, IOVT* iov) noexcept(
false) {
499 datiface.setConnection(
env,
conn);
500 datiface.createReadStatement();
501 datiface.setPrefetchRowCount(1024);
502 datiface.fetchData(fillMap, iov);
503 datiface.terminateReadStatement();
509 template <
class DATT>
510 void fetchDCSDataSet(std::list<std::pair<
Tm, std::map<EcalLogicID, DATT> > >* fillMap,
const Tm&
t) noexcept(
false) {
514 datiface.setConnection(
env,
conn);
515 datiface.createReadStatement();
516 datiface.setPrefetchRowCount(1024);
517 datiface.fetchHistoricalData(fillMap,
t);
518 datiface.terminateReadStatement();
525 template <
class DATT,
class IOVT>
530 datiface.setConnection(
env,
conn);
531 datiface.createReadStatement();
532 datiface.setPrefetchRowCount(1024);
533 datiface.fetchData(fillMap, iov, mapping_name);
534 datiface.terminateReadStatement();
544 template <
class DATT,
class IOVT>
551 fillIOV->setConnection(
env,
conn);
552 fillIOV->setByRecentData(datiface.getTable(),
tag,
run);
553 datiface.setConnection(
env,
conn);
554 datiface.createReadStatement();
555 datiface.setPrefetchRowCount(1024);
556 datiface.fetchData(fillMap, fillIOV);
557 datiface.terminateReadStatement();
567 template <
class DATT,
class IOVT>
574 fillIOV->setConnection(
env,
conn);
575 fillIOV->setByRecentData(datiface.getTable(), location,
run);
576 datiface.setConnection(
env,
conn);
577 datiface.createReadStatement();
578 datiface.setPrefetchRowCount(1024);
579 datiface.fetchData(fillMap, fillIOV);
580 datiface.terminateReadStatement();
void insertLmfSeq(LMFSeqDat *iov) noexcept(false)
std::map< int, int > _detId2LogicId
std::map< int, int > _logicId2DetId
RunList fetchGlobalRunListByLocation(const RunTag &tag, int min_run, int max_run, const LocationDef &locDef) noexcept(false)
MonRunIOV fetchMonRunIOV(RunTag *runtag, MonRunTag *montag, run_t run, subrun_t monrun) noexcept(false)
void insertMonRunIOV(MonRunIOV *iov) noexcept(false)
void fetchLastConfigSet(ICONF *iconf) noexcept(false)
EcalLogicID getEcalLogicID(std::string name, int id1=EcalLogicID::NULLID, int id2=EcalLogicID::NULLID, int id3=EcalLogicID::NULLID, std::string mapsTo="") noexcept(false)
int getLogicIdFromDetId(int det_id)
void updateRunConfig(ODRunConfigInfo *od) noexcept(false)
oracle::occi::Environment * env
void insertDCUIOV(DCUIOV *iov) noexcept(false)
std::list< ODDelaysDat > fetchFEDelaysForRun(RunIOV *iov) noexcept(false)
DCUIOV fetchDCUIOV(DCUTag *tag, const Tm &evenTm) noexcept(false)
RunList fetchNonEmptyRunList(const RunTag &tag, int min_run, int max_run) noexcept(false)
MonRunList fetchMonRunList(const RunTag &tag, const MonRunTag &monruntag) noexcept(false)
void fetchConfigSet(ICONF *iconf) noexcept(false)
void insertLmfDat(LMFDat *dat) noexcept(false)
RunList fetchRunListLastNRuns(const RunTag &tag, int max_run, int n_runs) noexcept(false)
EcalCondDBInterface(std::string host, std::string sid, std::string user, std::string pass, int port=1521)
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
std::vector< EcalLogicID > getEcalLogicIDMappedTo(int logic_id, std::string maps_to)
~EcalCondDBInterface() noexcept(false) override
RunList fetchNonEmptyGlobalRunList(const RunTag &tag, int min_run, int max_run) noexcept(false)
std::vector< EcalLogicID > getEcalLogicIDForLMPN(int lmr_logic_id)
std::vector< EcalLogicID > getEcalLogicIDSet(std::string name, int fromId1=EcalLogicID::NULLID, int toId1=EcalLogicID::NULLID, int fromId2=EcalLogicID::NULLID, int toId2=EcalLogicID::NULLID, int fromId3=EcalLogicID::NULLID, int toId3=EcalLogicID::NULLID, std::string mapsTo="") noexcept(false)
DateHandler * getDateHandler()
void updateRunIOV(RunIOV *iov) noexcept(false)
oracle::occi::Connection * conn
RunIOV fetchRunIOV(RunTag *tag, run_t run) noexcept(false)
void updateRunIOVStartTime(RunIOV *iov) noexcept(false)
void fetchDCSDataSet(std::list< std::pair< Tm, std::map< EcalLogicID, DATT > > > *fillMap, const Tm &t) noexcept(false)
void insertDataSetVector(const std::vector< EcalLogicID > &ecid, const std::vector< IOVT > &run_iov, const std::vector< DATT > &data) noexcept(false)
MonRunList fetchMonRunListLastNRuns(const RunTag &tag, const MonRunTag &monruntag, int max_run, int n_runs) noexcept(false)
EcalCondDBInterface(std::string sid, std::string user, std::string pass)
DCSPTMTempList fetchDCSPTMTempList(const EcalLogicID &ecid) noexcept(false)
void insertConfigDataArraySet(const std::vector< DATT > &data, ICONF *iconf) noexcept(false)
std::vector< EcalLogicID > getEcalLogicIDSetOrdered(std::string name, int fromId1, int toId1, int fromId2=EcalLogicID::NULLID, int toId2=EcalLogicID::NULLID, int fromId3=EcalLogicID::NULLID, int toId3=EcalLogicID::NULLID, std::string mapsTo="", int orderedBy=EcalLogicID::NULLID) noexcept(false)
std::map< int, int > getEcalLogicID2LmrMap()
RunIOV fetchLMFLastRun() const
void insertConfigSet(ICONF *iconf) noexcept(false)
void fetchValidDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *fillIOV, std::string location, run_t run=(unsigned int)-1) noexcept(false)
EcalCondDBInterface()=delete
void insertRunIOV(RunIOV *iov) noexcept(false)
void insertLmfRunIOV(LMFRunIOV *iov) noexcept(false)
void insertDataArraySet(const std::map< EcalLogicID, DATT > *data, IOVT *iov) noexcept(false)
CaliIOV fetchCaliIOV(CaliTag *tag, const Tm &evenTm) noexcept(false)
void insertConfigDataSet(const std::vector< DATT > data, ICONF *iconf) noexcept(false)
LMFRunIOV fetchLMFRunIOV(RunTag *runtag, LMFRunTag *lmftag, run_t run, subrun_t lmfrun) noexcept(false)
RunList fetchRunListByLocation(const RunTag &tag, int min_run, int max_run, const LocationDef &locDef) noexcept(false)
void updateRunIOVEndTime(RunIOV *iov) noexcept(false)
RunList fetchRunList(const RunTag &tag) noexcept(false)
static std::vector< std::string > checklist dat
void insertLmfLmrSubIOV(LMFLmrSubIOV *iov) noexcept(false)
int getDetIdFromLogicId(int logic_id)
char data[epos_bytes_allocation]
void insertDataSet(const std::map< EcalLogicID, DATT > *data, IOVT *iov) noexcept(false)
std::map< int, int > getLogicId2DetIdMap()
void insertLmfIOV(LMFIOV *iov) noexcept(false)
void fetchDataSetWithMap(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov, std::string mapping_name) noexcept(false)
void fillLogicId2DetIdMaps()
void fetchConfigDataSet(std::vector< DATT > *fillMap, ICONF *iconf) noexcept(false)
std::vector< EcalLogicID > getEcalLogicIDForLMR(int lmr_logic_id)
std::map< int, int > getDetId2LogicIdMap()
void fetchValidDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *fillIOV, RunTag *tag, run_t run=(unsigned int)-1) noexcept(false)