diff --git a/SimG4Components/src/SimG4SaveTrajectory.cpp b/SimG4Components/src/SimG4SaveTrajectory.cpp index 12cc083..e56e7c0 100644 --- a/SimG4Components/src/SimG4SaveTrajectory.cpp +++ b/SimG4Components/src/SimG4SaveTrajectory.cpp @@ -12,9 +12,6 @@ #include "G4VTrajectory.hh" -// datamodel -#include "edm4hep/TrackerHitCollection.h" - DECLARE_COMPONENT(SimG4SaveTrajectory) SimG4SaveTrajectory::SimG4SaveTrajectory(const std::string& aType, const std::string& aName, diff --git a/SimG4Components/src/SimG4SaveTrajectory.h b/SimG4Components/src/SimG4SaveTrajectory.h index cf4b135..9f0abad 100644 --- a/SimG4Components/src/SimG4SaveTrajectory.h +++ b/SimG4Components/src/SimG4SaveTrajectory.h @@ -9,10 +9,14 @@ #include "SimG4Interface/ISimG4SaveOutputTool.h" class IGeoSvc; -// datamodel +#if __has_include("edm4hep/TrackerHit3DCollection.h") +#include "edm4hep/TrackerHit3DCollection.h" +#else +#include "edm4hep/TrackerHitCollection.h" namespace edm4hep { -class TrackerHitCollection; + using TrackerHit3DCollection = edm4hep::TrackerHitCollection; } +#endif /** @class SimG4SaveTrajectory SimG4Components/src/SimG4SaveTrajectory.h SimG4SaveTrajectory.h * @@ -43,7 +47,7 @@ class SimG4SaveTrajectory : public GaudiTool, virtual public ISimG4SaveOutputToo /// Pointer to the geometry service ServiceHandle m_geoSvc; /// Handle for trajectory hits including position information - DataHandle m_trackHits{"Hits/Trajectory", + DataHandle m_trackHits{"Hits/Trajectory", Gaudi::DataHandle::Writer, this}; };