30 coolDbInstance(
const std::string& dbStr,
bool readOnly) {
32 std::cout <<
"Opening database '" << dbStr <<
"'...";
33 cool::IDatabaseSvc&
dbSvc = this->databaseService();
34 std::cout <<
"done." << std::endl;
35 return dbSvc.openDatabase(dbStr.c_str(), readOnly);
37 catch (cool::DatabaseDoesNotExist&) {
38 std::cout <<
"Error! Database does not exist!" << std::endl;
45 coolFolderInstance(
const std::string& folderStr) {
47 cool::IFolderPtr
folder = m_coolDb->getFolder(folderStr.c_str());
48 std::cout <<
"Browsing objects of '" << folderStr <<
"'" << std::endl;
52 catch (cool::FolderNotFound&) {
53 std::cout <<
"Error! Folder '" << folderStr <<
"' does not exist!" << std::endl;
60 setSince(cool::Int64
run, cool::Int64
lumi) {
66 setUntil(cool::Int64
run, cool::Int64
lumi) {
72 setIOV(cool::Int64 runS, cool::Int64 lumiS, cool::Int64 runU, cool::Int64 lumiU) {
73 this->setSince(runS, lumiS);
74 this->setUntil(runU, lumiU);
80 setIOV(cool::Int64
run) {
81 this->setSince(
run, 0);
82 this->setUntil(
run, cool::UInt32Max);
89 cool::Int64 runS = m_since >> 32;
90 cool::Int64 lumiS = m_since - (runS << 32);
91 cool::Int64 runU = m_until >> 32;
92 cool::Int64 lumiU = m_until - (runU << 32);
93 std::cout <<
"Using IOVrange [(" << runS <<
"," << lumiS <<
"),(" << runU <<
"," << lumiU <<
")[ " <<
"[" <<
94 m_since <<
"," << m_until <<
"[" << std::endl;
105 Initialize(
const std::string& dbStr,
const std::string& folderStr,
int runS,
int lumiS,
int runU,
int lumiU) {
106 m_coolDb = this->coolDbInstance(dbStr,
false);
107 m_coolFolder = this->coolFolderInstance(folderStr);
108 this->setIOV(runS, lumiS, runU, lumiU);
112 StatusFlagCOOLBase (
const std::string& dbStr,
const std::string& folderStr,
int runS,
int lumiS,
int runU,
114 Initialize(dbStr, folderStr, runS, lumiS, runU, lumiU);
118 StatusFlagCOOLBase(
int runS,
int lumiS,
int runU,
int lumiU) {
119 Initialize(
"COOLOFL_GLOBAL/OFLP200",
"/GLOBAL/DETSTATUS/SHIFTOFL",
120 runS, lumiS, runU, lumiU);
124 StatusFlagCOOLBase() {
125 Initialize(
"COOLOFL_GLOBAL/OFLP200",
"/GLOBAL/DETSTATUS/SHIFTOFL",
130 ~StatusFlagCOOLBase () {
132 m_coolDb->closeDatabase();
133 std::cout <<
"Cleared!" << std::endl;
138 dump(cool::ChannelSelection
selection, std::string tag_name) {
140 cool::IObjectIteratorPtr
objects = m_coolFolder->browseObjects(m_since, m_until - 1,
selection, tag_name);
142 const cool::IObject& element =
objects->currentRef();
143 std::cout << element << std::endl;
146 catch (cool::Exception&
e) {
147 std::cout <<
"Unknown exception caught!" <<
e.what() << std::endl;
153 dumpField(cool::ChannelId
channelId, std::string
field, std::string tag_name) {
157 cool::IObjectIteratorPtr
objects = m_coolFolder->browseObjects(m_since, m_until - 1,
selection, tag_name);
159 const cool::IObject& element =
objects->currentRef();
163 catch (cool::Exception&
e) {
164 std::cout <<
"Unknown exception caught!" <<
e.what() << std::endl;
171 dumpCode(
const std::string& channelName,
const std::string& tag_name) {
172 std::string
result = this->dumpField(this->getCoolFolder()->
channelId(channelName.c_str()),
"Code", tag_name);
182 dumpall(
const std::string& tag_name) {
189 const std::string& tag_name) {
190 cool::ConstRecordAdapter record(m_coolFolder->payloadSpecification(),
payload);
191 if (tag_name ==
"HEAD") {
192 m_coolFolder->storeObject(m_since, m_until, cool::Record(m_coolFolder->payloadSpecification(),
payload),
195 m_coolFolder->storeObject(m_since, m_until, cool::Record(
203 return this->m_coolFolder;
209 return this->m_coolDb;