File indexing completed on 2025-12-16 09:41:48
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Geometry/GeometryContext.hpp"
0012 #include "Acts/Utilities/Logger.hpp"
0013 #include "ActsPlugins/Root/ITGeoDetectorElementSplitter.hpp"
0014
0015 #include <map>
0016 #include <memory>
0017 #include <regex>
0018 #include <string>
0019 #include <tuple>
0020 #include <utility>
0021 #include <vector>
0022
0023 class TGeoNode;
0024
0025 namespace Acts {
0026 class TGeoDetectorElement;
0027 }
0028
0029 namespace ActsExamples {
0030
0031
0032
0033
0034 class TGeoITkModuleSplitter : public ActsPlugins::ITGeoDetectorElementSplitter {
0035 public:
0036 using SplitRange = std::pair<double, double>;
0037
0038
0039 struct Config {
0040
0041 std::map<std::string, unsigned int> barrelMap = {};
0042 std::map<std::string, std::vector<SplitRange>> discMap = {};
0043 std::map<std::string, std::string> splitPatterns;
0044 };
0045
0046
0047
0048
0049
0050 explicit TGeoITkModuleSplitter(
0051 const Config& cfg,
0052 std::unique_ptr<const Acts::Logger> logger =
0053 Acts::getDefaultLogger("TGeoITkModuleSplitter", Acts::Logging::INFO));
0054
0055 ~TGeoITkModuleSplitter() override = default;
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066 std::vector<std::shared_ptr<const ActsPlugins::TGeoDetectorElement>> split(
0067 const Acts::GeometryContext& gctx,
0068 std::shared_ptr<const ActsPlugins::TGeoDetectorElement> detElement)
0069 const override;
0070
0071 private:
0072
0073
0074
0075
0076
0077 void initSplitCategories();
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089 std::vector<std::shared_ptr<const ActsPlugins::TGeoDetectorElement>>
0090 splitBarrelModule(
0091 const Acts::GeometryContext& gctx,
0092 const std::shared_ptr<const ActsPlugins::TGeoDetectorElement>& detElement,
0093 unsigned int nSegments) const;
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105 std::vector<std::shared_ptr<const ActsPlugins::TGeoDetectorElement>>
0106 splitDiscModule(
0107 const Acts::GeometryContext& gctx,
0108 const std::shared_ptr<const ActsPlugins::TGeoDetectorElement>& detElement,
0109 const std::vector<SplitRange>& splitRanges) const;
0110
0111
0112 Config m_cfg;
0113
0114
0115 std::vector<std::tuple<std::regex, std::string, bool>> m_splitCategories;
0116
0117
0118 const Acts::Logger& logger() const { return *m_logger; }
0119
0120
0121 std::unique_ptr<const Acts::Logger> m_logger;
0122 };
0123
0124 }