Understanding CCDB processing and finaliseCCDB

Dear @eulisse and @shahoian ,

we were discussing at some point to have a callback that is triggered once CCDB objects were updated by the framework. Do I understand correctly that the function to be implemented is finaliseCCDB and that one would not need to implement anything in the run function?
If so, the only example I can find so far seems to be https://github.com/AliceO2Group/AliceO2/blob/75a734be2b60db6c23e6d18d971edd0c89d560f7/Detectors/Filtering/src/FilteringSpec.cxx.

How would one then deal with this function. Assume I have

InputSpec{"calibLaserTracks", "TPC", "CalibLaserTracks", 0, Lifetime::Condition, ccdbParamSpec("TPC/Calib/LaserTracks")},

Can I then simply do

void XXX::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
  if (matcher == ConcreteDataMatcher("TPC", "CalibLaserTracks", 0)) {
   const auto calib = static_cast<LtrCalibData*>(obj);
    LOGP(info, "TPC drift velocity correction was updated. New value: {:.2}", calib->getDriftVCorrection());
    // do something with 'calib'

Hi @wiechula

Contrary to what I told you during the calib.review meeting, the finaliseCCDB callback for each object is triggered by the ctx.inputs().get<...>(spec) call for corresponding object. This was mentioned in the fixed version of the presentation: CCDB_intro - Google Präsentationen
As the slide says, at the moment there is a problem with triggering the callback when only DataRef is extracted, i.e. ctx.inputs().get<...>(spec) and unfortunately, the access to std containers works only via such call, e.g.

const auto align = o2::framework::DataRefUtils::as<CCDBSerialized<vector<o2::detectors::AlignParam>> (ctx.inputs().get("itsalg")); 

so, in this case the finaliseCCDB will not be called. @eulisse is aware of the problem.


Hi @shahoian ,

thanks a lot for the clarification and the pointer to the updated presentation!


Hi @wiechula

Note that with https://github.com/AliceO2Group/AliceO2/pull/8252 also the vectors can be directly fetched as e.g.

inputs.emplace_back("itsAlg", "ITS", "ALIGN", 0, Lifetime::Condition, ccdbParamSpec("ITS/Align"));
const auto* av = pc.inputs().get<std::vector<o2::detectors::AlignParam>*>("itsAlg").get();

and the finaliseCCDB works also for them.


Thanks @eulisse , @shahoian for this fix!

Hello @eulisse @shahoian,

Is it also possible to load an object of kind std::unordered_map<std::string, o2::tpc::CalDet<float>> and triggering the finaliseCCDB function?

I am trying

inputs.emplace_back("tpcthreshold", gDataOriginTPC, "PADTHRESHOLD", 0, Lifetime::Condition, ccdbParamSpec("TPC/Config/FEEPad"));
pc.inputs().get<std::unordered_map<std::string, o2::tpc::CalDet<float>>* >("tpcthreshold");

but I am getting an error during the building of o2:
/Users/matthias/alice/sw/SOURCES/O2/idc_debug/0/Framework/Core/include/Framework/SerializationMethods.h:56:3: error: static_assert failed due to requirement 'std::is_pointer<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, o2::tpc::CalDet<float>, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<const std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, o2::tpc::CalDet<float>>>> *>::value == false' "wrapped type can not be a pointer" static_assert(std::is_pointer<T>::value == false, "wrapped type can not be a pointer");

Loading the object via const auto thresholdMapMap = o2::framework::DataRefUtils::as<CCDBSerialized<std::unordered_map<std::string, o2::tpc::CalDet<float>>>>(pc.inputs().get("tpcthreshold")); seems to work.


Do you have a root dictionary for such an object? You might have to wrap it in RootSerialised<>.