Warning, file /acts/Examples/Detectors/Common/include/ActsExamples/DetectorCommons/AlignmentContext.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/GeometryIdentifier.hpp"
0013 #include "Acts/Surfaces/Surface.hpp"
0014
0015 #include <unordered_map>
0016
0017 namespace ActsExamples {
0018
0019
0020
0021
0022
0023
0024
0025 class IAlignmentStore {
0026 public:
0027
0028 virtual ~IAlignmentStore() = default;
0029
0030
0031
0032
0033 virtual std::shared_ptr<IAlignmentStore> clone() const = 0;
0034
0035
0036
0037
0038
0039 virtual const Acts::Transform3* contextualTransform(
0040 const Acts::Surface& surface) const = 0;
0041
0042
0043
0044
0045 virtual void visitStore(
0046 const std::function<void(Acts::Transform3*)>& visitor) = 0;
0047 };
0048
0049
0050
0051 struct AlignmentContext {
0052
0053 const IAlignmentStore* store{nullptr};
0054 };
0055
0056
0057
0058
0059
0060
0061 class GeoIdAlignmentStore : public IAlignmentStore {
0062 public:
0063
0064
0065 explicit GeoIdAlignmentStore(
0066 std::unordered_map<Acts::GeometryIdentifier, Acts::Transform3>
0067 transformMap)
0068 : m_transformMap(std::move(transformMap)) {}
0069
0070
0071 std::shared_ptr<IAlignmentStore> clone() const override {
0072 return std::make_shared<GeoIdAlignmentStore>(m_transformMap);
0073 }
0074
0075
0076 const Acts::Transform3* contextualTransform(
0077 const Acts::Surface& surface) const override {
0078 auto it = m_transformMap.find(surface.geometryId());
0079 if (it != m_transformMap.end()) {
0080 return &(it->second);
0081 }
0082 return nullptr;
0083 }
0084
0085
0086 void visitStore(
0087 const std::function<void(Acts::Transform3*)>& visitor) override {
0088 for (auto& [id, trf] : m_transformMap) {
0089 visitor(&trf);
0090 }
0091 }
0092
0093 private:
0094
0095 std::unordered_map<Acts::GeometryIdentifier, Acts::Transform3> m_transformMap;
0096 };
0097
0098 }