9#include "CoolKernel/ValidityKey.h"
10#include "CoolKernel/IFolder.h"
11#include "CoolKernel/Exception.h"
12#include "CoolKernel/IObject.h"
13#include "CoolKernel/IObjectIterator.h"
14#include "CoolKernel/IDatabaseSvc.h"
15#include "CoralKernel/Context.h"
54 cool::ValidityKey since(
run);
55 cool::ValidityKey until(
run);
56 cool::ValidityKey maskLB(0xffffffff);
64 msg << MSG::FATAL <<
"updateLumiBlocks - failed to open DB... " <<
m_cool_id <<
endmsg;
69 if (
m_cool_ptr->existsFolder(
"/TRIGGER/LUMI/LBLB")) {
71 msg << MSG::INFO <<
"ReadRunData - reading folder: /TRIGGER/LUMI/LBLB" <<
endmsg;
73 cool::IFolderPtr folderLB =
m_cool_ptr->getFolder(
"/TRIGGER/LUMI/LBLB");
74 cool::IObjectIteratorPtr objectsLB = folderLB->browseObjects(since, until, 0);
76 while ( objectsLB -> goToNext() ) {
77 const cool::IObject &obj = objectsLB->currentRef();
78 const cool::IRecord &payload = obj.payload();
79 const uint32_t lumi = (obj.since() & 0xffff);
81 const uint64_t start = payload[
"StartTime"].data<cool::UInt63>();
82 const uint64_t end = payload[
"EndTime"].data<cool::UInt63>();
83 const uint64_t
length = end - start;
87 msg << MSG::DEBUG <<
" run=" <<
run
94 msg << MSG::INFO <<
"ReadRunData - missing COOL folder: /TRIGGER/LUMI/LBLB in " <<
m_cool_id <<
endmsg;
106 msg << MSG::INFO <<
"Unknown lumiblock number " <<
lb <<
endmsg;
124 msg << MSG::DEBUG <<
"ReadLumiBlock::openDb - opening database '" <<
m_cool_id <<
"'" <<
endmsg;
128 }
catch(cool::DatabaseDoesNotExist& e) {
129 msg << MSG::ERROR <<
"ReadLumiBlock::openDb - COOL exception caught: " << e.what() <<
endmsg;
142 msg << MSG::DEBUG <<
"ReadLumiBlock::closeDd - closing database '" <<
m_cool_id <<
endmsg;
145 }
catch(std::exception& e) {
146 msg << MSG::ERROR <<
"ReadLumiBlock::closeDB - COOL exception caught: " << e.what() <<
endmsg;
bool updateLumiBlocks(uint32_t run, MsgStream &msg)
Load information for.
cool::IDatabasePtr m_cool_ptr
std::map< uint32_t, uint64_t > m_lbLength
float getLumiBlockLength(uint32_t lb, MsgStream &msg) const
cool::DatabaseId m_cool_id_run1
bool dbIsOpen()
Check if DB connection is open.
void closeDb(MsgStream &msg)
Close DB connection.
cool::DatabaseId m_cool_id
ReadLumiBlock()
Construct helper class for reading in lumi block length from COOL.
bool openDb(bool readOnly, MsgStream &msg)
Open a DB connection.
std::string m_cool_source
cool::DatabaseId m_cool_id_run2