From d69324a98e4d79b01a844e77782a18e3901861bf Mon Sep 17 00:00:00 2001 From: Paul Gessinger Date: Fri, 29 Nov 2024 14:16:40 +0100 Subject: [PATCH] put compat include in separate header --- .../EDM4hep/src/EDM4hepMeasurementReader.cpp | 13 +---------- .../EDM4hep/src/EDM4hepMeasurementWriter.cpp | 14 +++--------- .../EDM4hep/TrackerHitCompatibility.hpp | 22 +++++++++++++++++++ 3 files changed, 26 insertions(+), 23 deletions(-) create mode 100644 Plugins/EDM4hep/include/Acts/Plugins/EDM4hep/TrackerHitCompatibility.hpp diff --git a/Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp b/Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp index afd5ddd0294..5299da121ca 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp @@ -9,6 +9,7 @@ #include "ActsExamples/Io/EDM4hep/EDM4hepMeasurementReader.hpp" #include "Acts/Definitions/Units.hpp" +#include "Acts/Plugins/EDM4hep/TrackerHitCompatibility.hpp" #include "Acts/Plugins/Podio/PodioUtil.hpp" #include "ActsExamples/EventData/Cluster.hpp" #include "ActsExamples/EventData/Measurement.hpp" @@ -18,18 +19,6 @@ #include #include -#if __has_include() -#include "edm4hep/TrackerHit3D.h" -#include "edm4hep/TrackerHit3DCollection.h" -#else -#include "edm4hep/TrackerHit.h" -#include "edm4hep/TrackerHitCollection.h" -namespace edm4hep { -using TrackerHit3DCollection = edm4hep::TrackerHitCollection; -using TrackerHit3D = edm4hep::TrackerHit; -} // namespace edm4hep -#endif - #include #include diff --git a/Examples/Io/EDM4hep/src/EDM4hepMeasurementWriter.cpp b/Examples/Io/EDM4hep/src/EDM4hepMeasurementWriter.cpp index 43637a83c53..23e291cc2dd 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepMeasurementWriter.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepMeasurementWriter.cpp @@ -9,6 +9,7 @@ #include "ActsExamples/Io/EDM4hep/EDM4hepMeasurementWriter.hpp" #include "Acts/Definitions/Units.hpp" +#include "Acts/Plugins/EDM4hep/TrackerHitCompatibility.hpp" #include "ActsExamples/EventData/Cluster.hpp" #include "ActsExamples/EventData/Measurement.hpp" #include "ActsExamples/Framework/WhiteBoard.hpp" @@ -16,18 +17,9 @@ #include -#include - -// Compatibility with EDM4hep < 0.99 and >= 0.99 -#if __has_include() -#include -#else -#include -namespace edm4hep { -using TrackerHit3DCollection = edm4hep::TrackerHitCollection; -} -#endif +#include #include +#include namespace ActsExamples { diff --git a/Plugins/EDM4hep/include/Acts/Plugins/EDM4hep/TrackerHitCompatibility.hpp b/Plugins/EDM4hep/include/Acts/Plugins/EDM4hep/TrackerHitCompatibility.hpp new file mode 100644 index 00000000000..11115e7cbe5 --- /dev/null +++ b/Plugins/EDM4hep/include/Acts/Plugins/EDM4hep/TrackerHitCompatibility.hpp @@ -0,0 +1,22 @@ +// This file is part of the ACTS project. +// +// Copyright (C) 2016 CERN for the benefit of the ACTS project +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +#pragma once + +// Compatibility with EDM4hep < 0.99 and >= 0.99 +#if __has_include() +#include "edm4hep/TrackerHit3D.h" +#include "edm4hep/TrackerHit3DCollection.h" +#else +#include "edm4hep/TrackerHit.h" +#include "edm4hep/TrackerHitCollection.h" +namespace edm4hep { +using TrackerHit3DCollection = edm4hep::TrackerHitCollection; +using TrackerHit3D = edm4hep::TrackerHit; +} // namespace edm4hep +#endif