File indexing completed on 2025-11-25 09:21:13
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/EventData/SourceLink.hpp"
0012 #include "Acts/Geometry/GeometryIdentifier.hpp"
0013 #include "Acts/Geometry/TrackingGeometry.hpp"
0014 #include "Acts/Utilities/HashedString.hpp"
0015 #include "ActsPlugins/EDM4hep/PodioDynamicColumns.hpp"
0016
0017 #include <limits>
0018 #include <memory>
0019
0020 #include <podio/podioVersion.h>
0021
0022 #if podio_VERSION_MAJOR >= 1 || \
0023 (podio_VERSION_MAJOR == 0 && podio_VERSION_MINOR == 99)
0024 #include <podio/ROOTReader.h>
0025 #include <podio/ROOTWriter.h>
0026 #else
0027 #include <podio/ROOTFrameReader.h>
0028 #include <podio/ROOTFrameWriter.h>
0029 #endif
0030
0031 namespace ActsPodioEdm {
0032 class Surface;
0033 }
0034
0035 namespace podio {
0036 class Frame;
0037 }
0038
0039 namespace ActsPlugins {
0040 namespace PodioUtil {
0041
0042
0043
0044
0045 #if podio_VERSION_MAJOR >= 1 || \
0046 (podio_VERSION_MAJOR == 0 && podio_VERSION_MINOR == 99)
0047 using ROOTWriter = podio::ROOTWriter;
0048 using ROOTReader = podio::ROOTReader;
0049 #else
0050 using ROOTWriter = podio::ROOTFrameWriter;
0051 using ROOTReader = podio::ROOTFrameReader;
0052 #endif
0053
0054
0055 template <typename T>
0056 decltype(auto) getDataMutable(T&& object) {
0057 if constexpr (podio::version::build_version.major >= 1) {
0058 return std::forward<T>(object).getData();
0059 } else {
0060 return std::forward<T>(object).data();
0061 }
0062 }
0063
0064 template <typename T>
0065 decltype(auto) getReferenceSurfaceMutable(T&& object) {
0066 if constexpr (podio::version::build_version.major >= 1) {
0067 return std::forward<T>(object).getReferenceSurface();
0068 } else {
0069 return std::forward<T>(object).referenceSurface();
0070 }
0071 }
0072
0073 using Identifier = std::uint64_t;
0074 constexpr Identifier kNoIdentifier = std::numeric_limits<Identifier>::max();
0075 constexpr int kNoSurface = -1;
0076
0077
0078 class ConversionHelper {
0079 public:
0080 virtual std::optional<Identifier> surfaceToIdentifier(
0081 const Acts::Surface& surface) const = 0;
0082 virtual const Acts::Surface* identifierToSurface(
0083 Identifier identifier) const = 0;
0084
0085 virtual Identifier sourceLinkToIdentifier(const Acts::SourceLink& sl) = 0;
0086 virtual Acts::SourceLink identifierToSourceLink(
0087 Identifier identifier) const = 0;
0088 };
0089
0090 std::shared_ptr<const Acts::Surface> convertSurfaceFromPodio(
0091 const ConversionHelper& helper, const ActsPodioEdm::Surface& surface);
0092
0093 ActsPodioEdm::Surface convertSurfaceToPodio(const ConversionHelper& helper,
0094 const Acts::Surface& surface);
0095 }
0096
0097 namespace podio_detail {
0098
0099
0100 void recoverDynamicColumns(
0101 const podio::Frame& frame, const std::string& stem,
0102 std::unordered_map<Acts::HashedString,
0103 std::unique_ptr<podio_detail::ConstDynamicColumnBase>>&
0104 dynamic);
0105 }
0106 }