From 27b5c0d37a3d7159e6ad8eff71d783a4f5359048 Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Fri, 23 Feb 2024 09:13:28 +0100 Subject: [PATCH] Use TrackerHit3D once it becomes available (#62) --- SimG4Components/src/SimG4SaveTrajectory.cpp | 3 --- SimG4Components/src/SimG4SaveTrajectory.h | 10 +++++++--- 2 files changed, 7 insertions(+), 6 deletions(-) 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}; };