File indexing completed on 2025-01-18 09:27:41
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Units.hpp"
0012 #include "Acts/Detector/Blueprint.hpp"
0013 #include "Acts/Detector/interface/IGeometryIdGenerator.hpp"
0014 #include "Acts/Detector/interface/IInternalStructureBuilder.hpp"
0015 #include "Acts/Detector/interface/IRootVolumeFinderBuilder.hpp"
0016 #include "Acts/Geometry/Extent.hpp"
0017 #include "Acts/Geometry/GeometryContext.hpp"
0018 #include "Acts/Geometry/VolumeBounds.hpp"
0019 #include "Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp"
0020 #include "Acts/Plugins/DD4hep/DD4hepLayerStructure.hpp"
0021 #include "Acts/Utilities/Logger.hpp"
0022
0023 #include <memory>
0024 #include <optional>
0025 #include <tuple>
0026 #include <vector>
0027
0028 #include <DD4hep/DD4hepUnits.h>
0029 #include <DD4hep/DetElement.h>
0030
0031 namespace Acts::Experimental {
0032
0033 class DD4hepBlueprintFactory {
0034 public:
0035
0036 struct Config {
0037 std::shared_ptr<Experimental::DD4hepLayerStructure> layerStructure =
0038 nullptr;
0039
0040
0041 unsigned int maxPortals = 8u;
0042 };
0043
0044
0045 struct Cache {
0046 DD4hepDetectorElement::Store dd4hepStore;
0047 };
0048
0049
0050
0051
0052
0053 DD4hepBlueprintFactory(const Config& cfg,
0054 std::unique_ptr<const Logger> mlogger =
0055 getDefaultLogger("DD4hepBlueprintFactory",
0056 Acts::Logging::INFO));
0057
0058
0059
0060
0061
0062
0063
0064
0065 std::unique_ptr<Blueprint::Node> create(
0066 Cache& cache, const GeometryContext& gctx,
0067 const dd4hep::DetElement& dd4hepElement) const;
0068
0069 private:
0070
0071 static constexpr ActsScalar unitLength =
0072 Acts::UnitConstants::mm / dd4hep::millimeter;
0073
0074
0075 Config m_cfg;
0076
0077
0078 std::unique_ptr<const Logger> m_logger;
0079
0080
0081 const Logger& logger() const { return *m_logger; }
0082
0083
0084
0085
0086
0087
0088
0089
0090 void recursiveParse(Cache& cache, Blueprint::Node& mother,
0091 const GeometryContext& gctx,
0092 const dd4hep::DetElement& dd4hepElement,
0093 unsigned int hiearchyLevel = 0) const;
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103 std::tuple<Transform3, VolumeBounds::BoundsType, std::vector<ActsScalar>,
0104 std::vector<BinningValue>, std::string>
0105 extractExternals([[maybe_unused]] const GeometryContext& gctx,
0106 const dd4hep::DetElement& dd4hepElement,
0107 const std::string& baseName,
0108 const std::optional<Extent>& extOpt = std::nullopt) const;
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125 std::tuple<std::shared_ptr<const IInternalStructureBuilder>,
0126 std::shared_ptr<const IRootVolumeFinderBuilder>,
0127 std::shared_ptr<const IGeometryIdGenerator>,
0128 std::array<std::string, 3u>, std::optional<Extent>>
0129 extractInternals(DD4hepDetectorElement::Store& dd4hepStore,
0130 const GeometryContext& gctx,
0131 const dd4hep::DetElement& dd4hepElement,
0132 const std::string& baseName) const;
0133 };
0134
0135 }