80 {
83 try {
85 } catch (...) {
87 return StatusCode::FAILURE;
88 }
89 }
91
92
93
94
95 m_autoRetrieveTools = false;
96 m_checkToolDeps = false;
97
99 << Acts::VersionMajor << "." << Acts::VersionMinor << "."
100 << Acts::VersionPatch << " [" << Acts::CommitHash.value_or("unknown hash") << "]");
101
102
105 ATH_MSG_INFO(
"Configured to build " << buildSubdet.size()
106 << " subdetectors:");
107 for (const auto &s : buildSubdet) {
109 }
110
112 if (buildSubdet.find("Pixel") != buildSubdet.end()) {
114 }
115 if (buildSubdet.find("SCT") != buildSubdet.end()) {
117 }
118 if (buildSubdet.find("TRT") != buildSubdet.end()) {
121 }
122 if (buildSubdet.find("ITkPixel") != buildSubdet.end()) {
124 }
125 if (buildSubdet.find("ITkStrip") != buildSubdet.end()) {
127 }
128 if (buildSubdet.find("HGTD") != buildSubdet.end()) {
131 }
132
135 }
136
137
140 ATH_MSG_FATAL(
"Consistency check for ITk inner pixel barrel passive layer construction failed. Please check your inputs! ");
141 return StatusCode::FAILURE;
142 }
143
146 ATH_MSG_FATAL(
"Consistency check for ITk outer pixel barrel passive layer construction failed. Please check your inputs! ");
147 return StatusCode::FAILURE;
148 }
149
152 ATH_MSG_FATAL(
"Consistency check for ITk strip barrel passive layer construction failed. Please check your inputs! ");
153 return StatusCode::FAILURE;
154 }
155
157
158
159 ATH_MSG_INFO(
"Using Blueprint API for geometry construction");
162
165
166 using enum Acts::AxisDirection;
167
168 std::vector<ActsTrk::IBlueprintNodeBuilder*> ptrBuilders;
170 std::back_inserter(ptrBuilders),
171 [](ToolHandle<ActsTrk::IBlueprintNodeBuilder>& b) { return b.get(); });
172
174
175 Acts::Experimental::Blueprint::Config
cfg;
176 cfg.envelope[AxisZ] = {20_mm, 20_mm};
177 cfg.envelope[AxisR] = {0_mm, 20_mm};
178
179 auto blueprint = std::make_unique<Acts::Experimental::Blueprint>(cfg);
180
181 auto&
root = blueprint->addCylinderContainer(
"Detector", AxisZ);
182
183 std::shared_ptr<Acts::Experimental::BlueprintNode> currentTop{nullptr};
184
185 for (auto& builder : ptrBuilders) {
187
188 }
189
190 root.addChild(std::move(currentTop));
191
192 Acts::Experimental::BlueprintOptions blueprintOptions;
194 std::unique_ptr<Acts::TrackingGeometry>
trackingGeometry = blueprint->construct(
196
200 }
202
204
206 Acts::ObjVisualization3D vis;
208 {.visible = false}, {.visible = true});
209 vis.write("blueprint_sensitive.obj");
210 vis.clear();
211
213 {.visible = false}, {.visible = false});
214 vis.write("blueprint_volume.obj");
215 vis.clear();
216
218 {.visible = true}, {.visible = false});
219 vis.write("blueprint_portals.obj");
220 }
222 Acts::detail::TrackingGeometryPrintVisitor printer{
m_nominalContext.context()};
224 ATH_MSG_INFO(
"Built tracking geometry \n"<<printer.stream().str());
225 }
228 return StatusCode::FAILURE;
229 }
230
231 return StatusCode::SUCCESS;
232 }
233
235
236 Acts::LayerArrayCreator::Config lacCfg;
237 auto layerArrayCreator = std::make_shared<const Acts::LayerArrayCreator>(
239
240 Acts::TrackingVolumeArrayCreator::Config tvcCfg;
241 auto trackingVolumeArrayCreator =
242 std::make_shared<const Acts::TrackingVolumeArrayCreator>(
244
245 Acts::CylinderVolumeHelper::Config cvhConfig;
246 cvhConfig.layerArrayCreator = layerArrayCreator;
247 cvhConfig.trackingVolumeArrayCreator = trackingVolumeArrayCreator;
248
249 auto cylinderVolumeHelper =
250 std::make_shared<const Acts::CylinderVolumeHelper>(
252
253 Acts::TrackingGeometryBuilder::Config tgbConfig;
254 tgbConfig.trackingVolumeHelper = cylinderVolumeHelper;
255
257 std::shared_ptr<const Acts::IMaterialDecorator> matDeco = nullptr;
258
260 if (matFileFullPath.empty()) {
262 return StatusCode::FAILURE;
263 }
264 ATH_MSG_INFO(
"Configured to use material input: " << matFileFullPath);
265
266 if (matFileFullPath.find(".json") != std::string::npos) {
267
268 Acts::MaterialMapJsonConverter::Config jsonGeoConvConfig;
269
270 matDeco = std::make_shared<const Acts::JsonMaterialDecorator>(
272 }
273 tgbConfig.materialDecorator = matDeco;
274 }
275
276 std::array<double, 2> sctECEnvelopeZ{20_mm, 20_mm};
277
278 try {
279
281 tgbConfig.trackingVolumeBuilders.push_back([&](const auto &gctx,
282 const auto &inner,
283 const auto &) {
284
285 Acts::CylinderVolumeBuilder::Config bpvConfig =
287
288 Acts::CylinderVolumeBuilder beamPipeVolumeBuilder {
290
291 return beamPipeVolumeBuilder.trackingVolume(gctx, inner);
292 });
293 }
294
295
296
297
298 if (buildSubdet.count("Pixel") > 0) {
299 tgbConfig.trackingVolumeBuilders.push_back([&](const auto &gctx,
300 const auto &inner,
301 const auto &) {
304 auto lb = std::make_shared<ActsLayerBuilder>(
306 Acts::CylinderVolumeBuilder::Config cvbConfig;
307 cvbConfig.layerEnvelopeR = {3_mm, 3_mm};
308 cvbConfig.layerEnvelopeZ = 1_mm;
309 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
310 cvbConfig.volumeName = "Pixel";
311 cvbConfig.layerBuilder =
lb;
313
314 Acts::CylinderVolumeBuilder cvb(
316
317 return cvb.trackingVolume(gctx, inner);
318 });
319 }
320
321
322 if (buildSubdet.count("ITkPixel") > 0) {
323 tgbConfig.trackingVolumeBuilders.push_back(
324 [&](const auto &gctx, const auto &inner, const auto &) {
328 cfg.doEndcapLayerMerging =
true;
332 auto lb = std::make_shared<ActsLayerBuilder>(
334
335 Acts::CylinderVolumeBuilder::Config cvbConfig;
336 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
337 cvbConfig.layerEnvelopeZ = 1_mm;
338 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
339 cvbConfig.volumeName = "ITkPixelInner";
340 cvbConfig.layerBuilder =
lb;
342
343 Acts::CylinderVolumeBuilder cvb(
344 cvbConfig,
346
347 return cvb.trackingVolume(gctx, inner);
348 });
349
350 tgbConfig.trackingVolumeBuilders.push_back(
351 [&](const auto &gctx, const auto &inner, const auto &) {
355 cfg.doEndcapLayerMerging =
false;
359 auto lb = std::make_shared<ActsLayerBuilder>(
361
362 Acts::CylinderVolumeBuilder::Config cvbConfig;
363 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
364 cvbConfig.layerEnvelopeZ = 1_mm;
365 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
366 cvbConfig.volumeName = "ITkPixelOuter";
367 cvbConfig.layerBuilder =
lb;
368 cvbConfig.buildToRadiusZero = false;
369 cvbConfig.checkRingLayout = true;
370 cvbConfig.ringTolerance = 10_mm;
371
372 Acts::CylinderVolumeBuilder cvb(
373 cvbConfig,
375
376 return cvb.trackingVolume(gctx, inner);
377 });
378 }
379
380
381 if (buildSubdet.count("ITkStrip") > 0) {
382 tgbConfig.trackingVolumeBuilders.push_back(
383 [&](const auto &gctx, const auto &inner, const auto &) {
390 auto lb = std::make_shared<ActsLayerBuilder>(
392
393 Acts::CylinderVolumeBuilder::Config cvbConfig;
394 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
395 cvbConfig.layerEnvelopeZ = 1_mm;
396 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
397 cvbConfig.volumeName = "ITkStrip";
398 cvbConfig.layerBuilder =
lb;
399 cvbConfig.buildToRadiusZero =
401
402 Acts::CylinderVolumeBuilder cvb(
403 cvbConfig,
405
406 return cvb.trackingVolume(gctx, inner);
407 });
408 }
409
410 bool buildSCT = buildSubdet.count("SCT") > 0;
411 bool buildTRT = buildSubdet.count("TRT") > 0;
412
413 if (buildSCT && buildTRT) {
414
415 tgbConfig.trackingVolumeBuilders.push_back(
416 [&](const auto &gctx, const auto &inner, const auto &) {
419 cfg.endcapEnvelopeZ = sctECEnvelopeZ;
420 auto sct_lb = std::make_shared<ActsLayerBuilder>(
422
424
426 *cylinderVolumeHelper, inner);
427 });
428
429 } else if (buildSCT) {
430 tgbConfig.trackingVolumeBuilders.push_back(
431 [&](const auto &gctx, const auto &inner, const auto &) {
434 lbCfg.endcapEnvelopeZ = sctECEnvelopeZ;
435 auto lb = std::make_shared<ActsLayerBuilder>(
436 lbCfg,
438
439 Acts::CylinderVolumeBuilder::Config cvbConfig;
440 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
441 cvbConfig.layerEnvelopeZ = 2_mm;
442 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
443 cvbConfig.volumeName = "SCT";
444 cvbConfig.layerBuilder =
lb;
445 cvbConfig.buildToRadiusZero = false;
446
447 Acts::CylinderVolumeBuilder cvb(
448 cvbConfig,
450
451 return cvb.trackingVolume(gctx, inner);
452 });
453 } else if (buildTRT) {
454 tgbConfig.trackingVolumeBuilders.push_back(
455 [&](const auto &gctx, const auto &inner, const auto &) {
457 Acts::CylinderVolumeBuilder::Config cvbConfig;
458 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
459 cvbConfig.layerEnvelopeZ = 2_mm;
460 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
461 cvbConfig.volumeName = "TRT";
462 cvbConfig.layerBuilder =
lb;
463 cvbConfig.buildToRadiusZero = false;
464
465 Acts::CylinderVolumeBuilder cvb(
466 cvbConfig,
468
469 return cvb.trackingVolume(gctx, inner);
470 });
471 }
472
473
474 if(buildSubdet.count("HGTD") > 0) {
475 tgbConfig.trackingVolumeBuilders.push_back(
476 [&](const auto &gctx, const auto &inner, const auto &) {
478 Acts::CylinderVolumeBuilder::Config cvbConfig;
479 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
480 cvbConfig.layerEnvelopeZ = 1_mm;
481 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
482 cvbConfig.volumeName = "HGTD";
483 cvbConfig.layerBuilder =
lb;
484 cvbConfig.buildToRadiusZero = false;
485
486 Acts::CylinderVolumeBuilder cvb(
487 cvbConfig,
489
490 return cvb.trackingVolume(gctx, inner);
491 });
492 }
493
494
496 tgbConfig.trackingVolumeBuilders.push_back(
497 [&](const auto &gctx, const auto &inner, const auto &) {
499 });
500 }
501
502 } catch (const std::exception &e) {
503 ATH_MSG_ERROR(
"Encountered error when building Acts tracking geometry");
505 return StatusCode::FAILURE;
506 }
507
508 auto trackingGeometryBuilder =
509 std::make_shared<const Acts::TrackingGeometryBuilder>(
511
516
518 ATH_MSG_ERROR(
"No ACTS tracking geometry was built. Cannot proceeed");
519 return StatusCode::FAILURE;
520 }
521
522
524 ATH_MSG_INFO(
"Running extra consistency check! (this is SLOW)");
526 ATH_MSG_ERROR(
"Consistency check has failed! Geometry is not consistent");
527 return StatusCode::FAILURE;
528 }
529 }
530
533 return StatusCode::FAILURE;
534 }
535
536
537 ATH_MSG_INFO(
"Acts TrackingGeometry construction completed");
538
539 return StatusCode::SUCCESS;
540}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
const TRT_ID * m_TRT_idHelper
const InDetDD::TRT_DetectorManager * p_TRTManager
bool runConsistencyChecks() const
Gaudi::Property< std::vector< std::string > > m_buildSubdetectors
Gaudi::Property< bool > m_keepGoingOnMaterialMergeFailure
Gaudi::Property< std::vector< float > > m_passiveITkInnerPixelBarrelLayerThickness
Gaudi::Property< bool > m_useBlueprint
ActsLayerBuilder::Config makeLayerBuilderConfig(const InDetDD::InDetDetectorManager *manager)
const InDetDD::SiDetectorManager * p_ITkStripManager
std::set< ActsTrk::DetectorType > m_subDetNoAlign
Gaudi::Property< std::vector< unsigned int > > m_subDetNoAlignProp
Define the subdetectors for which the tracking geometry does not expect a valid alignment store.
Gaudi::Property< std::vector< float > > m_passiveITkOuterPixelBarrelLayerThickness
ToolHandleArray< ActsTrk::IRefineTrackingGeoTool > m_refineVisitors
Gaudi::Property< std::vector< float > > m_passiveITkOuterPixelBarrelLayerHalflengthZ
Acts::CylinderVolumeBuilder::Config makeBeamPipeConfig(std::shared_ptr< const Acts::CylinderVolumeHelper > cvh) const
BooleanProperty m_runConsistencyChecks
Gaudi::Property< std::vector< float > > m_passiveITkStripBarrelLayerRadii
Gaudi::Property< bool > m_buildBeamPipe
Gaudi::Property< std::string > m_materialMapCalibFolder
Gaudi::Property< std::vector< float > > m_passiveITkStripBarrelLayerThickness
const BeamPipeDetectorManager * p_beamPipeMgr
std::shared_ptr< const Acts::ILayerBuilder > makeHGTDLayerBuilder(const HGTD_DetectorManager *manager)
std::unique_ptr< const ActsTrk::DetectorElementToActsGeometryIdMap > m_detIdMap
Gaudi::Property< bool > m_printGeo
Print the assembled tracking geometry after building.
Gaudi::Property< std::string > m_materialMapInputFileBase
Gaudi::Property< std::vector< float > > m_passiveITkInnerPixelBarrelLayerRadii
the specifications for building additional passive cylinders in the barrel region: for each cylinder ...
const ActsTrk::GeometryContext & getNominalContext() const override
Returns an empty nominal context without any alignment caches.
std::shared_ptr< const Acts::ILayerBuilder > makeStrawLayerBuilder(const InDetDD::InDetDetectorManager *manager)
ToolHandleArray< ActsTrk::IBlueprintNodeBuilder > m_blueprintNodeBuilders
ToolHandle< IActsTrackingVolumeBuilder > m_caloVolumeBuilder
const InDetDD::SiDetectorManager * p_SCTManager
std::unique_ptr< ActsTrk::DetectorElementToActsGeometryIdMap > createDetectorElementToGeoIdMap() const
Creates and popules the DetectorElement -> Acts::Surface geo identifier map from the geometry service...
Gaudi::Property< bool > m_useMaterialMap
const HGTD_DetectorManager * p_HGTDManager
Gaudi::Property< std::vector< float > > m_passiveITkOuterPixelBarrelLayerRadii
Gaudi::Property< std::vector< float > > m_passiveITkInnerPixelBarrelLayerHalflengthZ
Gaudi::Property< std::vector< float > > m_passiveITkStripBarrelLayerHalflengthZ
Gaudi::Property< bool > m_objDebugOutput
const HGTD_ID * m_HGTD_idHelper
const InDetDD::SiDetectorManager * p_ITkPixelManager
const InDetDD::SiDetectorManager * p_pixelManager
std::shared_ptr< Acts::TrackingVolume > makeSCTTRTAssembly(const Acts::GeometryContext &gctx, const Acts::ILayerBuilder &sct_lb, const Acts::ILayerBuilder &trt_lb, const Acts::CylinderVolumeHelper &cvh, const std::shared_ptr< const Acts::TrackingVolume > &pixel)
static Root::TMsgLogger logger("iLumiCalc")
Acts::Logging::Level actsLevelVector(MSG::Level lvl)