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

Use the new edm4hep::CellIDEncoding #157

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion k4FWCore/include/k4FWCore/DataHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "Gaudi/Algorithm.h"
#include "GaudiKernel/DataObjectHandle.h"

#include "edm4hep/Constants.h"

#include "TTree.h"

#include <type_traits>
Expand Down Expand Up @@ -213,7 +215,7 @@ template <typename T> T* DataHandle<T>::createAndPut() {
template <typename T> const std::string DataHandle<T>::getCollMetadataCellID(const unsigned int id) {
if (auto lpds = dynamic_cast<PodioLegacyDataSvc*>(m_eds.get())) {
auto colMD = lpds->getProvider().getCollectionMetaData(id);
return colMD.getValue<std::string>("CellIDEncodingString");
return colMD.getValue<std::string>(edm4hep::CellIDEncoding);
}

throw GaudiException("getCollMetadataCellID is only implemented for the legacy data svc",
Expand Down
2 changes: 1 addition & 1 deletion test/k4FWCoreTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
# Package: k4FWCoreTest
################################################################################

find_package(EDM4HEP)
find_package(EDM4HEP 0.10.01 REQUIRED)

set(k4fwcoretest_plugin_sources
src/components/TestDataHandleUniquePtr.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "k4FWCore/DataHandle.h"
#include "k4FWCore/MetaDataHandle.h"

#include "edm4hep/Constants.h"

// datamodel
#include "edm4hep/SimTrackerHitCollection.h"

Expand Down Expand Up @@ -53,7 +55,7 @@ class k4FWCoreTest_cellID_reader : public GaudiAlgorithm {
/// Handle for the SimTrackerHits to be read
DataHandle<edm4hep::SimTrackerHitCollection> m_simTrackerHitReaderHandle{"SimTrackerHits", Gaudi::DataHandle::Reader,
this};
MetaDataHandle<std::string> m_cellIDHandle{m_simTrackerHitReaderHandle, "CellIDEncodingString",
MetaDataHandle<std::string> m_cellIDHandle{m_simTrackerHitReaderHandle, edm4hep::CellIDEncoding,
Gaudi::DataHandle::Reader};
};
#endif /* K4FWCORE_K4FWCORETEST_CELLID */
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "k4FWCore/DataHandle.h"
#include "k4FWCore/MetaDataHandle.h"

#include "edm4hep/Constants.h"

// datamodel
#include "edm4hep/SimTrackerHitCollection.h"

Expand Down Expand Up @@ -55,7 +57,7 @@ class k4FWCoreTest_cellID_writer : public GaudiAlgorithm {
/// Handle for the SimTrackerHits to be written
DataHandle<edm4hep::SimTrackerHitCollection> m_simTrackerHitWriterHandle{"SimTrackerHits", Gaudi::DataHandle::Writer,
this};
MetaDataHandle<std::string> m_cellIDHandle{m_simTrackerHitWriterHandle, "CellIDEncodingString",
MetaDataHandle<std::string> m_cellIDHandle{m_simTrackerHitWriterHandle, edm4hep::CellIDEncoding,
Gaudi::DataHandle::Writer};
};
#endif /* K4FWCORE_K4FWCORETEST_CELLID_WRITER */
Loading