Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 31 additions & 23 deletions CCDB/src/UploadTool.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -147,33 +147,41 @@ int main(int argc, char* argv[])
meta[p.first] = p.second;
}

TFile f(filename.c_str());
auto key = f.GetKey(keyname.c_str());
if (key) {
// get type of key
auto classname = key->GetClassName();
auto tcl = TClass::GetClass(classname);
auto object = f.Get<void>(keyname.c_str());
if (tcl->InheritsFrom("TTree")) {
auto tree = static_cast<TTree*>(object);
tree->LoadBaskets(0x1L << 32); // make tree memory based
tree->SetDirectory(nullptr);
}
// convert classname to typeinfo
// typeinfo
auto ti = tcl->GetTypeInfo();

std::cout << " Uploading an object of type " << key->GetClassName()
<< " to path " << path << " with timestamp validity from " << starttimestamp
<< " to " << endtimestamp << "\n";

api.storeAsTFile_impl(object, *ti, path, meta, starttimestamp, endtimestamp);
if (filename == "headersOnly") {
api.storeAsBinaryFile(nullptr, 0, "ignored", "", path, meta, starttimestamp, endtimestamp);
if (!api.isSnapshotMode() && meta.find("adjustableEOV") != meta.end() && meta.find("default") == meta.end()) {
o2::ccdb::CcdbObjectInfo oi(path, classname, filename, meta, starttimestamp, endtimestamp);
o2::ccdb::CcdbObjectInfo oi(path, "", "", meta, starttimestamp, endtimestamp);
o2::ccdb::adjustOverriddenEOV(api, oi);
}
} else {
std::cerr << "Key " << keyname << " does not exist\n";
TFile f(filename.c_str());
auto key = f.GetKey(keyname.c_str());
if (key) {
// get type of key
auto classname = key->GetClassName();
auto tcl = TClass::GetClass(classname);
auto object = f.Get<void>(keyname.c_str());
if (tcl->InheritsFrom("TTree")) {
auto tree = static_cast<TTree*>(object);
tree->LoadBaskets(0x1L << 32); // make tree memory based
tree->SetDirectory(nullptr);
}
// convert classname to typeinfo
// typeinfo
auto ti = tcl->GetTypeInfo();

std::cout << " Uploading an object of type " << key->GetClassName()
<< " to path " << path << " with timestamp validity from " << starttimestamp
<< " to " << endtimestamp << "\n";

api.storeAsTFile_impl(object, *ti, path, meta, starttimestamp, endtimestamp);
if (!api.isSnapshotMode() && meta.find("adjustableEOV") != meta.end() && meta.find("default") == meta.end()) {
o2::ccdb::CcdbObjectInfo oi(path, classname, filename, meta, starttimestamp, endtimestamp);
o2::ccdb::adjustOverriddenEOV(api, oi);
}
} else {
std::cerr << "Key " << keyname << " does not exist\n";
}
}

return 0;
Expand Down