130 {
133 try {
135 } catch (...) {
137 return StatusCode::FAILURE;
138 }
139 }
141
142
143
144
145 m_autoRetrieveTools = false;
146 m_checkToolDeps = false;
147
149 << Acts::VersionMajor << "." << Acts::VersionMinor << "."
150 << Acts::VersionPatch << " [" << Acts::CommitHash.value_or("unknown hash") << "]");
151
152
155 ATH_MSG_INFO(
"Configured to build " << buildSubdet.size()
156 << " subdetectors:");
157 for (const auto &s : buildSubdet) {
159 }
160
161 for (const Gaudi::Property<std::vector<unsigned int>>* window :
165 if (!toNeighborWindow(window->value()).has_value()) {
167 << " must hold two bin counts of at most "
168 << static_cast<unsigned int>(std::numeric_limits<std::uint8_t>::max()));
169 return StatusCode::FAILURE;
170 }
171 }
174 << " exceeds " << static_cast<unsigned int>(std::numeric_limits<std::uint8_t>::max()));
175 return StatusCode::FAILURE;
176 }
177
179 if (buildSubdet.contains("Pixel") ) {
181 }
182 if (buildSubdet.contains("SCT") ) {
184 }
185 if (buildSubdet.contains("TRT") ) {
188 }
189 if (buildSubdet.contains("ITkPixel") ) {
191 }
192 if (buildSubdet.contains("ITkStrip") ) {
194 }
195 if (buildSubdet.contains("HGTD") ) {
198 }
199
202 }
203
204
207 ATH_MSG_FATAL(
"Consistency check for ITk inner pixel barrel passive layer construction failed. Please check your inputs! ");
208 return StatusCode::FAILURE;
209 }
210
213 ATH_MSG_FATAL(
"Consistency check for ITk outer pixel barrel passive layer construction failed. Please check your inputs! ");
214 return StatusCode::FAILURE;
215 }
216
219 ATH_MSG_FATAL(
"Consistency check for ITk strip barrel passive layer construction failed. Please check your inputs! ");
220 return StatusCode::FAILURE;
221 }
222
224
225
226 ATH_MSG_INFO(
"Using Blueprint API for geometry construction");
229
232
233 using enum Acts::AxisDirection;
234
235 std::vector<ActsTrk::IBlueprintNodeBuilder*> ptrBuilders;
237 std::back_inserter(ptrBuilders),
238 [](ToolHandle<ActsTrk::IBlueprintNodeBuilder>& b) { return b.get(); });
239
241
242 Acts::Blueprint::Config
cfg;
243 cfg.envelope[AxisZ] = {20_mm, 20_mm};
244 cfg.envelope[AxisR] = {0_mm, 20_mm};
245
246 auto blueprint = std::make_unique<Acts::Blueprint>(cfg);
247
248 auto&
root = blueprint->addCylinderContainer(
"Detector", AxisZ);
249
250 std::shared_ptr<Acts::BlueprintNode> currentTop{nullptr};
251
252 for (auto& builder : ptrBuilders) {
254
255 }
256
257 root.addChild(std::move(currentTop));
258
259 Acts::BlueprintOptions blueprintOptions;
261 std::unique_ptr<Acts::TrackingGeometry>
trackingGeometry = blueprint->construct(
263
267 }
269
271
273 Acts::ObjVisualization3D vis;
275 viewConfigFunc({.visible = true}, {.visible = false}, {.visible = false}));
276 vis.write("blueprint_envelopes.obj");
277 vis.clear();
278
280 viewConfigFunc({.visible = false}, {.visible = true}, {.visible = false}));
281 vis.write("blueprint_portals.obj");
282
284 viewConfigFunc({.visible = false}, {.visible = false}, {.visible = true}));
285 vis.write("blueprint_sensitive.obj");
286 vis.clear();
287
288 }
290 Acts::detail::TrackingGeometryPrintVisitor printer{
m_nominalContext.context()};
292 ATH_MSG_INFO(
"Built tracking geometry \n"<<printer.stream().str());
293 }
296 return StatusCode::FAILURE;
297 }
298
301 }
302
303 return StatusCode::SUCCESS;
304 }
305
307
308 Acts::LayerArrayCreator::Config lacCfg;
309 auto layerArrayCreator = std::make_shared<const Acts::LayerArrayCreator>(
311
312 Acts::TrackingVolumeArrayCreator::Config tvcCfg;
313 auto trackingVolumeArrayCreator =
314 std::make_shared<const Acts::TrackingVolumeArrayCreator>(
316
317 Acts::CylinderVolumeHelper::Config cvhConfig;
318 cvhConfig.layerArrayCreator = layerArrayCreator;
319 cvhConfig.trackingVolumeArrayCreator = trackingVolumeArrayCreator;
320
321 auto cylinderVolumeHelper =
322 std::make_shared<const Acts::CylinderVolumeHelper>(
324
325 Acts::TrackingGeometryBuilder::Config tgbConfig;
326 tgbConfig.trackingVolumeHelper = cylinderVolumeHelper;
327
329 std::shared_ptr<const Acts::IMaterialDecorator> matDeco = nullptr;
330
332 if (matFileFullPath.empty()) {
334 return StatusCode::FAILURE;
335 }
336 ATH_MSG_INFO(
"Configured to use material input: " << matFileFullPath);
337
338 if (matFileFullPath.find(".json") != std::string::npos) {
339
340 Acts::MaterialMapJsonConverter::Config jsonGeoConvConfig;
341
342 matDeco = std::make_shared<const Acts::JsonMaterialDecorator>(
344 }
345 tgbConfig.materialDecorator = std::move(matDeco);
346 }
347
348 std::array<double, 2> sctECEnvelopeZ{20_mm, 20_mm};
349
350 try {
351
353 tgbConfig.trackingVolumeBuilders.push_back([&](const auto &gctx,
354 const auto &inner,
355 const auto &) {
356
357 Acts::CylinderVolumeBuilder::Config bpvConfig =
359
360 Acts::CylinderVolumeBuilder beamPipeVolumeBuilder {
362
363 return beamPipeVolumeBuilder.trackingVolume(gctx, inner);
364 });
365 }
366
367
368
369
370 if (buildSubdet.contains("Pixel")) {
371 tgbConfig.trackingVolumeBuilders.push_back([&](const auto &gctx,
372 const auto &inner,
373 const auto &) {
376 auto lb = std::make_shared<ActsLayerBuilder>(
378 Acts::CylinderVolumeBuilder::Config cvbConfig;
379 cvbConfig.layerEnvelopeR = {3_mm, 3_mm};
380 cvbConfig.layerEnvelopeZ = 1_mm;
381 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
382 cvbConfig.volumeName = "Pixel";
383 cvbConfig.layerBuilder =
lb;
385
386 Acts::CylinderVolumeBuilder cvb(
388
389 return cvb.trackingVolume(gctx, inner);
390 });
391 }
392
393
394 if (buildSubdet.contains("ITkPixel") ) {
395 tgbConfig.trackingVolumeBuilders.push_back(
396 [&](const auto &gctx, const auto &inner, const auto &) {
402 cfg.doEndcapLayerMerging =
true;
406 auto lb = std::make_shared<ActsLayerBuilder>(
408
409 Acts::CylinderVolumeBuilder::Config cvbConfig;
410 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
411 cvbConfig.layerEnvelopeZ = 1_mm;
412 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
413 cvbConfig.volumeName = "ITkPixelInner";
414 cvbConfig.layerBuilder =
lb;
416
417 Acts::CylinderVolumeBuilder cvb(
418 cvbConfig,
420
421 return cvb.trackingVolume(gctx, inner);
422 });
423
424 tgbConfig.trackingVolumeBuilders.push_back(
425 [&](const auto &gctx, const auto &inner, const auto &) {
431 cfg.doEndcapLayerMerging =
false;
435 auto lb = std::make_shared<ActsLayerBuilder>(
437
438 Acts::CylinderVolumeBuilder::Config cvbConfig;
439 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
440 cvbConfig.layerEnvelopeZ = 1_mm;
441 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
442 cvbConfig.volumeName = "ITkPixelOuter";
443 cvbConfig.layerBuilder =
lb;
444 cvbConfig.buildToRadiusZero = false;
445 cvbConfig.checkRingLayout = true;
446 cvbConfig.ringTolerance = 10_mm;
447
448 Acts::CylinderVolumeBuilder cvb(
449 cvbConfig,
451
452 return cvb.trackingVolume(gctx, inner);
453 });
454 }
455
456
457 if (buildSubdet.contains("ITkStrip")) {
458 tgbConfig.trackingVolumeBuilders.push_back(
459 [&](const auto &gctx, const auto &inner, const auto &) {
468 auto lb = std::make_shared<ActsLayerBuilder>(
470
471 Acts::CylinderVolumeBuilder::Config cvbConfig;
472 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
473 cvbConfig.layerEnvelopeZ = 1_mm;
474 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
475 cvbConfig.volumeName = "ITkStrip";
476 cvbConfig.layerBuilder =
lb;
477 cvbConfig.buildToRadiusZero =
479
480 Acts::CylinderVolumeBuilder cvb(
481 cvbConfig,
483
484 return cvb.trackingVolume(gctx, inner);
485 });
486 }
487
488 bool buildSCT = buildSubdet.contains("SCT") ;
489 bool buildTRT = buildSubdet.contains("TRT");
490
491 if (buildSCT && buildTRT) {
492
493 tgbConfig.trackingVolumeBuilders.push_back(
494 [&](const auto &gctx, const auto &inner, const auto &) {
497 cfg.endcapEnvelopeZ = sctECEnvelopeZ;
498 auto sct_lb = std::make_shared<ActsLayerBuilder>(
500
502
504 *cylinderVolumeHelper, inner);
505 });
506
507 } else if (buildSCT) {
508 tgbConfig.trackingVolumeBuilders.push_back(
509 [&](const auto &gctx, const auto &inner, const auto &) {
512 lbCfg.endcapEnvelopeZ = sctECEnvelopeZ;
513 auto lb = std::make_shared<ActsLayerBuilder>(
514 lbCfg,
516
517 Acts::CylinderVolumeBuilder::Config cvbConfig;
518 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
519 cvbConfig.layerEnvelopeZ = 2_mm;
520 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
521 cvbConfig.volumeName = "SCT";
522 cvbConfig.layerBuilder =
lb;
523 cvbConfig.buildToRadiusZero = false;
524
525 Acts::CylinderVolumeBuilder cvb(
526 cvbConfig,
528
529 return cvb.trackingVolume(gctx, inner);
530 });
531 } else if (buildTRT) {
532 tgbConfig.trackingVolumeBuilders.push_back(
533 [&](const auto &gctx, const auto &inner, const auto &) {
535 Acts::CylinderVolumeBuilder::Config cvbConfig;
536 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
537 cvbConfig.layerEnvelopeZ = 2_mm;
538 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
539 cvbConfig.volumeName = "TRT";
540 cvbConfig.layerBuilder = std::move(
lb);
541 cvbConfig.buildToRadiusZero = false;
542
543 Acts::CylinderVolumeBuilder cvb(
544 cvbConfig,
546
547 return cvb.trackingVolume(gctx, inner);
548 });
549 }
550
551
552 if(buildSubdet.contains("HGTD") ) {
553 tgbConfig.trackingVolumeBuilders.push_back(
554 [&](const auto &gctx, const auto &inner, const auto &) {
556 Acts::CylinderVolumeBuilder::Config cvbConfig;
557 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
558 cvbConfig.layerEnvelopeZ = 1_mm;
559 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
560 cvbConfig.volumeName = "HGTD";
561 cvbConfig.layerBuilder = std::move(
lb);
562 cvbConfig.buildToRadiusZero = false;
563
564 Acts::CylinderVolumeBuilder cvb(
565 cvbConfig,
567
568 return cvb.trackingVolume(gctx, inner);
569 });
570 }
571
572
574 tgbConfig.trackingVolumeBuilders.push_back(
575 [&](const auto &gctx, const auto &inner, const auto &) {
577 });
578 }
579
580 } catch (const std::exception &e) {
581 ATH_MSG_ERROR(
"Encountered error when building Acts tracking geometry");
583 return StatusCode::FAILURE;
584 }
585
586 auto trackingGeometryBuilder =
587 std::make_shared<const Acts::TrackingGeometryBuilder>(
589
594
596 ATH_MSG_ERROR(
"No ACTS tracking geometry was built. Cannot proceeed");
597 return StatusCode::FAILURE;
598 }
599
600
602 ATH_MSG_INFO(
"Running extra consistency check! (this is SLOW)");
604 ATH_MSG_ERROR(
"Consistency check has failed! Geometry is not consistent");
605 return StatusCode::FAILURE;
606 }
607 }
608
611 return StatusCode::FAILURE;
612 }
613
616 }
617
618 ATH_MSG_INFO(
"Acts TrackingGeometry construction completed");
619
620 return StatusCode::SUCCESS;
621}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_FATAL(x,...)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
StatusCode buildDetrayGeometry()
Converts the built Acts::TrackingGeometry into a Detray geometry and stores it in m_detrayGeometry.
const TRT_ID * m_TRT_idHelper
Gaudi::Property< std::vector< unsigned int > > m_itkStripBarrelNeighborWindow
const InDetDD::TRT_DetectorManager * p_TRTManager
bool runConsistencyChecks() const
Gaudi::Property< std::vector< std::string > > m_buildSubdetectors
Gaudi::Property< std::vector< unsigned int > > m_itkPixelInnerBarrelNeighborWindow
Most bins the surface array lookup serves on each side of the crossing, as {phi, z}...
Gaudi::Property< bool > m_keepGoingOnMaterialMergeFailure
Gaudi::Property< std::vector< unsigned int > > m_itkPixelOuterBarrelNeighborWindow
Gaudi::Property< std::vector< unsigned int > > m_itkStripEndcapNeighborWindow
Gaudi::Property< std::vector< float > > m_passiveITkInnerPixelBarrelLayerThickness
Gaudi::Property< bool > m_useBlueprint
ActsLayerBuilder::Config makeLayerBuilderConfig(const InDetDD::InDetDetectorManager *manager)
Gaudi::Property< bool > m_buildDetrayGeometry
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< unsigned int > > m_itkPixelOuterEndcapNeighborWindow
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< unsigned int > m_surfaceArrayOverfill
Extra cells per direction and axis that each surface fills around its footprint.
Gaudi::Property< std::vector< float > > m_passiveITkInnerPixelBarrelLayerRadii
the specifications for building additional passive cylinders in the barrel region: for each cylinder ...
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
Gaudi::Property< std::vector< unsigned int > > m_itkPixelInnerEndcapNeighborWindow
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)