Skip to content

Commit

Permalink
Use the new edm4hep::CellIDEncoding (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell authored Nov 13, 2023
1 parent 95931b5 commit 41284dc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
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 */

0 comments on commit 41284dc

Please sign in to comment.