34 #include "TGeoManager.h"
36 namespace ActsExamples {
49 template <
typename variable_maps_t>
52 std::vector<std::shared_ptr<const Acts::TGeoDetectorElement>>&
54 std::shared_ptr<const Acts::IMaterialDecorator> mdecorator) {
64 auto surfaceArrayCreator = std::make_shared<const Acts::SurfaceArrayCreator>(
69 auto protoLayerHelper = std::make_shared<const Acts::ProtoLayerHelper>(
74 auto layerCreator = std::make_shared<const Acts::LayerCreator>(
78 auto layerArrayCreator = std::make_shared<const Acts::LayerArrayCreator>(
82 auto tVolumeArrayCreator =
83 std::make_shared<const Acts::TrackingVolumeArrayCreator>(
89 cvhConfig.trackingVolumeArrayCreator = tVolumeArrayCreator;
90 auto cylinderVolumeHelper =
91 std::make_shared<const Acts::CylinderVolumeHelper>(
97 std::list<std::shared_ptr<const Acts::ITrackingVolumeBuilder>> volumeBuilders;
99 std::string rootFileName = vm[
"geo-tgeo-filename"].template as<std::string>();
103 auto beamPipeParameters =
104 vm[
"geo-tgeo-bp-parameters"].template as<read_range>();
105 if (beamPipeParameters.size() > 2) {
111 std::vector<double>(1, beamPipeParameters[1]);
113 std::vector<double>(1, beamPipeParameters[2]);
114 auto beamPipeBuilder = std::make_shared<const Acts::PassiveLayerBuilder>(
120 bpvConfig.volumeName =
"BeamPipe";
121 bpvConfig.layerBuilder = beamPipeBuilder;
124 bpvConfig.buildToRadiusZero =
true;
125 auto beamPipeVolumeBuilder =
126 std::make_shared<const Acts::CylinderVolumeBuilder>(
132 volumeBuilders.push_back(beamPipeVolumeBuilder);
140 TGeoManager::Import(rootFileName.c_str());
142 auto layerBuilderConfigs =
143 ActsExamples::Options::readTGeoLayerBuilderConfigs<variable_maps_t>(vm);
146 std::vector<std::shared_ptr<const Acts::TGeoLayerBuilder>> tgLayerBuilders;
148 for (
auto& lbc : layerBuilderConfigs) {
149 std::shared_ptr<const Acts::LayerCreator> layerCreatorLB =
nullptr;
151 if (lbc.autoSurfaceBinning) {
156 auto surfaceArrayCreatorLB =
157 std::make_shared<const Acts::SurfaceArrayCreator>(
159 lbc.configurationName +
"SurfaceArrayCreator",
164 layerCreatorLB = std::make_shared<const Acts::LayerCreator>(
172 auto protoLayerHelperLB = std::make_shared<const Acts::ProtoLayerHelper>(
179 (layerCreatorLB !=
nullptr) ? layerCreatorLB : layerCreator;
180 lbc.protoLayerHelper =
181 (protoLayerHelperLB !=
nullptr) ? protoLayerHelperLB : protoLayerHelper;
183 auto layerBuilder = std::make_shared<const Acts::TGeoLayerBuilder>(
187 tgLayerBuilders.push_back(layerBuilder);
192 volumeConfig.
volumeName = lbc.configurationName;
196 auto ringLayoutConfiguration =
197 [&](
const std::vector<Acts::TGeoLayerBuilder::LayerConfig>& lConfigs)
199 for (
const auto& lcfg : lConfigs) {
200 for (
const auto& scfg : lcfg.splitConfigs) {
201 if (scfg.first ==
Acts::binR and scfg.second > 0.) {
209 ringLayoutConfiguration(lbc.layerConfigurations[0]);
210 ringLayoutConfiguration(lbc.layerConfigurations[2]);
213 auto volumeBuilder = std::make_shared<const Acts::CylinderVolumeBuilder>(
218 volumeBuilders.push_back(volumeBuilder);
227 for (
auto& vb : volumeBuilders) {
229 [=](
const auto& gcontext,
const auto& inner,
const auto&) {
230 return vb->trackingVolume(gcontext, inner);
235 auto cylinderGeometryBuilder =
236 std::make_shared<const Acts::TrackingGeometryBuilder>(
242 for (
auto& lBuilder : tgLayerBuilders) {
243 auto detElements = lBuilder->detectorElements();
244 detElementStore.insert(detElementStore.begin(), detElements.begin(),