Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DataHandle to work as expected when used with LegacyDataSvc #117

Merged
merged 2 commits into from
Jul 4, 2023
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
13 changes: 10 additions & 3 deletions k4FWCore/include/k4FWCore/DataHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ DataHandle<T>::DataHandle(const std::string& descriptor, Gaudi::DataHandle::Mode

podio_data_service = dynamic_cast<PodioDataSvc*>(m_eds.get());
if (nullptr != podio_data_service) {
m_dataPtr = new T();
if constexpr (std::is_integral_v<T> || std::is_floating_point_v<T>) {
m_dataPtr = new T();
}
} else {
// This is the legacy implementation kept for a transition period
PodioLegacyDataSvc* plds;
Expand Down Expand Up @@ -191,8 +193,13 @@ template <typename T> T* DataHandle<T>::createAndPut() {

// Temporary workaround for k4MarlinWrapper
template <typename T> const std::string DataHandle<T>::getCollMetadataCellID(const unsigned int id) {
std::cerr << "k4FWCore: getCollMetadataCellID is not implemented!" << std::endl;
return "";
if (auto lpds = dynamic_cast<PodioLegacyDataSvc*>(m_eds.get())) {
auto colMD = lpds->getProvider().getCollectionMetaData(id);
return colMD.getValue<std::string>("CellIDEncodingString");
}

throw GaudiException("getCollMetadataCellID is only implemented for the legacy data svc",
"Cannot get collection metadata", StatusCode::FAILURE);
}

// temporary to allow property declaration
Expand Down