Skip to content

Commit

Permalink
[QC-1130] Issue with the newest ROOT when loading streamer infos (#2184)
Browse files Browse the repository at this point in the history
I removed this logic as we don't need it anymore.
  • Loading branch information
Barthelemy committed Mar 19, 2024
1 parent 61087d0 commit 909283c
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 64 deletions.
1 change: 0 additions & 1 deletion Framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ install(FILES example-default.json
readout.json
readout-no-sampling.json
postprocessing.json
streamerinfos.root
DESTINATION etc)

install(PROGRAMS script/o2-qc-functional-test.sh
Expand Down
8 changes: 0 additions & 8 deletions Framework/include/QualityControl/CcdbDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ class CcdbDatabase : public DatabaseInterface
void prepareTaskDataContainer(std::string taskName) override;
std::vector<std::string> getPublishedObjectNames(std::string taskName) override;
void truncate(std::string taskName, std::string objectName) override;
void storeStreamerInfosToFile(std::string filename);
static long getCurrentTimestamp();
static long getFutureTimestamp(int secondsInFuture);
/**
Expand Down Expand Up @@ -129,13 +128,6 @@ class CcdbDatabase : public DatabaseInterface
void setMaxObjectSize(size_t maxObjectSize) override;

private:
/**
* \brief Load StreamerInfos from a ROOT file.
* When we were not saving TFiles in the CCDB, we streamed ROOT objects without their StreamerInfos.
* As a result we can't read them back. The only way is to load them from a file. This is what we do
* here.
*/
static void loadDeprecatedStreamerInfos();
void init();

/**
Expand Down
52 changes: 0 additions & 52 deletions Framework/src/CcdbDatabase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <TList.h>
#include <TROOT.h>
#include <TKey.h>
#include <TStreamerInfo.h>
// std
#include <chrono>
#include <sstream>
Expand Down Expand Up @@ -64,42 +63,6 @@ CcdbDatabase::CcdbDatabase() : ccdbApi(new o2::ccdb::CcdbApi())

CcdbDatabase::~CcdbDatabase() { disconnect(); }

void CcdbDatabase::loadDeprecatedStreamerInfos()
{
if (getenv("QUALITYCONTROL_ROOT") == nullptr) {
ILOG(Debug, Devel) << "QUALITYCONTROL_ROOT is not set thus the the streamerinfo ROOT file can't be found. "
<< "Consequently, old data might not be readable." << ENDM;
return;
}
string path = string(getenv("QUALITYCONTROL_ROOT")) + "/etc/";
vector<string> filenames = { "streamerinfos.root" };
for (const auto& filename : filenames) {
string localPath = path + filename;
ILOG(Debug, Devel) << "Loading streamerinfos from : " << localPath << ENDM;
TFile file(localPath.data(), "READ");
if (file.IsZombie()) {
string s = string("Cannot find ") + localPath;
ILOG(Warning, Support) << s << ENDM;
continue;
}
TIter next(file.GetListOfKeys());
TKey* key;
std::unordered_set<std::string> alreadySeen;
while ((key = (TKey*)next())) {
TClass* cl = gROOT->GetClass(key->GetClassName());
if (!cl->InheritsFrom("TStreamerInfo"))
continue;
auto* si = (TStreamerInfo*)key->ReadObj();
string stringRepresentation = si->GetName() + si->GetClassVersion();
if (alreadySeen.count(stringRepresentation) == 0) {
alreadySeen.emplace(stringRepresentation);
ILOG(Debug, Trace) << "importing streamer info version " << si->GetClassVersion() << " for '" << si->GetName() << "'" << ENDM;
si->BuildCheck();
}
}
}
}

void CcdbDatabase::connect(const string& host, const string& /*database*/, const string& /*username*/, const string& /*password*/)
{
mUrl = host;
Expand All @@ -119,7 +82,6 @@ void CcdbDatabase::init()
{
ccdbApi->init(mUrl);
ccdbApi->setCurlRetriesParameters(5);
loadDeprecatedStreamerInfos();
}

void CcdbDatabase::handleStorageError(const string& path, int result)
Expand Down Expand Up @@ -691,20 +653,6 @@ void CcdbDatabase::truncate(std::string taskName, std::string objectName)
ccdbApi->truncate(taskName + "/" + objectName);
}

void CcdbDatabase::storeStreamerInfosToFile(std::string filename)
{
TH1F* h1 = new TH1F("asdf", "asdf", 100, 0, 99);
shared_ptr<MonitorObject> mo1 = make_shared<MonitorObject>(h1, "fake", "class", "DET");
TMessage message(kMESS_OBJECT);
message.Reset();
message.EnableSchemaEvolution(true);
message.WriteObjectAny(mo1.get(), mo1->IsA());
TList* infos = message.GetStreamerInfos();
TFile f(filename.data(), "recreate");
infos->Write();
f.Close();
}

void CcdbDatabase::setMaxObjectSize(size_t maxObjectSize)
{
CcdbDatabase::mMaxObjectSize = maxObjectSize;
Expand Down
Binary file removed Framework/streamerinfos.root
Binary file not shown.
3 changes: 0 additions & 3 deletions Framework/test/testDbFactory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ BOOST_AUTO_TEST_CASE(db_ccdb_listing)
BOOST_CHECK(std::find(objectNames.begin(), objectNames.end(), "/object1") != objectNames.end());
BOOST_CHECK(std::find(objectNames.begin(), objectNames.end(), "/object2") != objectNames.end());
BOOST_CHECK(std::find(objectNames.begin(), objectNames.end(), "/path/to/object3") != objectNames.end());

// store list of streamer infos
// ccdb->storeStreamerInfosToFile("streamerinfos.root");
}

} // namespace o2::quality_control::repository

0 comments on commit 909283c

Please sign in to comment.