78 {
81 try {
83 } catch (...) {
85 return StatusCode::FAILURE;
86 }
87 }
89
90
91
92
93 m_autoRetrieveTools = false;
94 m_checkToolDeps = false;
95
97 << Acts::VersionMajor << "." << Acts::VersionMinor << "."
98 << Acts::VersionPatch << " [" << Acts::CommitHash.value_or("unknown hash") << "]");
99
100
103 ATH_MSG_INFO(
"Configured to build " << buildSubdet.size()
104 << " subdetectors:");
105 for (const auto &s : buildSubdet) {
107 }
108
110 if (buildSubdet.find("Pixel") != buildSubdet.end()) {
112 }
113 if (buildSubdet.find("SCT") != buildSubdet.end()) {
115 }
116 if (buildSubdet.find("TRT") != buildSubdet.end()) {
119 }
120 if (buildSubdet.find("ITkPixel") != buildSubdet.end()) {
122 }
123 if (buildSubdet.find("ITkStrip") != buildSubdet.end()) {
125 }
126 if (buildSubdet.find("HGTD") != buildSubdet.end()) {
129 }
130
133 }
134
135
138 ATH_MSG_FATAL(
"Consistency check for ITk inner pixel barrel passive layer construction failed. Please check your inputs! ");
139 return StatusCode::FAILURE;
140 }
141
144 ATH_MSG_FATAL(
"Consistency check for ITk outer pixel barrel passive layer construction failed. Please check your inputs! ");
145 return StatusCode::FAILURE;
146 }
147
150 ATH_MSG_FATAL(
"Consistency check for ITk strip barrel passive layer construction failed. Please check your inputs! ");
151 return StatusCode::FAILURE;
152 }
153
155
156
157 ATH_MSG_INFO(
"Using Blueprint API for geometry construction");
160
162
163 using enum Acts::AxisDirection;
164
165 std::vector<ActsTrk::IBlueprintNodeBuilder*> ptrBuilders;
167 std::back_inserter(ptrBuilders),
168 [](ToolHandle<ActsTrk::IBlueprintNodeBuilder>& b) { return b.get(); });
169
171
172 Acts::Experimental::Blueprint::Config
cfg;
173 cfg.envelope[AxisZ] = {20_mm, 20_mm};
174 cfg.envelope[AxisR] = {0_mm, 20_mm};
175
176 auto blueprint = std::make_unique<Acts::Experimental::Blueprint>(cfg);
177
178 auto&
root = blueprint->addCylinderContainer(
"Detector", AxisZ);
179
180 std::shared_ptr<Acts::Experimental::BlueprintNode> currentTop{nullptr};
181
182 for (auto& builder : ptrBuilders) {
184
185 }
186
187 root.addChild(std::move(currentTop));
188
191
193 Acts::ObjVisualization3D vis;
195 {.visible = false}, {.visible = true});
196 vis.write("blueprint_sensitive.obj");
197 vis.clear();
198
200 {.visible = false}, {.visible = false});
201 vis.write("blueprint_volume.obj");
202 vis.clear();
203
205 {.visible = true}, {.visible = false});
206 vis.write("blueprint_portals.obj");
207
208
209 }
211 Acts::detail::TrackingGeometryPrintVisitor printer{
m_nominalContext.context()};
213 ATH_MSG_INFO(
"Built tracking geometry \n"<<printer.stream().str());
214 }
215
216 return StatusCode::SUCCESS;
217 }
218
220
221 Acts::LayerArrayCreator::Config lacCfg;
222 auto layerArrayCreator = std::make_shared<const Acts::LayerArrayCreator>(
224
225 Acts::TrackingVolumeArrayCreator::Config tvcCfg;
226 auto trackingVolumeArrayCreator =
227 std::make_shared<const Acts::TrackingVolumeArrayCreator>(
229
230 Acts::CylinderVolumeHelper::Config cvhConfig;
231 cvhConfig.layerArrayCreator = layerArrayCreator;
232 cvhConfig.trackingVolumeArrayCreator = trackingVolumeArrayCreator;
233
234 auto cylinderVolumeHelper =
235 std::make_shared<const Acts::CylinderVolumeHelper>(
237
238 Acts::TrackingGeometryBuilder::Config tgbConfig;
239 tgbConfig.trackingVolumeHelper = cylinderVolumeHelper;
240
242 std::shared_ptr<const Acts::IMaterialDecorator> matDeco = nullptr;
243
245 if (matFileFullPath.empty()) {
247 return StatusCode::FAILURE;
248 }
249 ATH_MSG_INFO(
"Configured to use material input: " << matFileFullPath);
250
251 if (matFileFullPath.find(".json") != std::string::npos) {
252
253 Acts::MaterialMapJsonConverter::Config jsonGeoConvConfig;
254
255 matDeco = std::make_shared<const Acts::JsonMaterialDecorator>(
257 }
258 tgbConfig.materialDecorator = matDeco;
259 }
260
261 std::array<double, 2> sctECEnvelopeZ{20_mm, 20_mm};
262
263 try {
264
266 tgbConfig.trackingVolumeBuilders.push_back([&](const auto &gctx,
267 const auto &inner,
268 const auto &) {
269
270 Acts::CylinderVolumeBuilder::Config bpvConfig =
272
273 Acts::CylinderVolumeBuilder beamPipeVolumeBuilder {
275
276 return beamPipeVolumeBuilder.trackingVolume(gctx, inner);
277 });
278 }
279
280
281
282
283 if (buildSubdet.count("Pixel") > 0) {
284 tgbConfig.trackingVolumeBuilders.push_back([&](const auto &gctx,
285 const auto &inner,
286 const auto &) {
289 auto lb = std::make_shared<ActsLayerBuilder>(
291 Acts::CylinderVolumeBuilder::Config cvbConfig;
292 cvbConfig.layerEnvelopeR = {3_mm, 3_mm};
293 cvbConfig.layerEnvelopeZ = 1_mm;
294 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
295 cvbConfig.volumeName = "Pixel";
296 cvbConfig.layerBuilder =
lb;
298
299 Acts::CylinderVolumeBuilder cvb(
301
302 return cvb.trackingVolume(gctx, inner);
303 });
304 }
305
306
307 if (buildSubdet.count("ITkPixel") > 0) {
308 tgbConfig.trackingVolumeBuilders.push_back(
309 [&](const auto &gctx, const auto &inner, const auto &) {
313 cfg.doEndcapLayerMerging =
true;
317 auto lb = std::make_shared<ActsLayerBuilder>(
319
320 Acts::CylinderVolumeBuilder::Config cvbConfig;
321 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
322 cvbConfig.layerEnvelopeZ = 1_mm;
323 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
324 cvbConfig.volumeName = "ITkPixelInner";
325 cvbConfig.layerBuilder =
lb;
327
328 Acts::CylinderVolumeBuilder cvb(
329 cvbConfig,
331
332 return cvb.trackingVolume(gctx, inner);
333 });
334
335 tgbConfig.trackingVolumeBuilders.push_back(
336 [&](const auto &gctx, const auto &inner, const auto &) {
340 cfg.doEndcapLayerMerging =
false;
344 auto lb = std::make_shared<ActsLayerBuilder>(
346
347 Acts::CylinderVolumeBuilder::Config cvbConfig;
348 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
349 cvbConfig.layerEnvelopeZ = 1_mm;
350 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
351 cvbConfig.volumeName = "ITkPixelOuter";
352 cvbConfig.layerBuilder =
lb;
353 cvbConfig.buildToRadiusZero = false;
354 cvbConfig.checkRingLayout = true;
355 cvbConfig.ringTolerance = 10_mm;
356
357 Acts::CylinderVolumeBuilder cvb(
358 cvbConfig,
360
361 return cvb.trackingVolume(gctx, inner);
362 });
363 }
364
365
366 if (buildSubdet.count("ITkStrip") > 0) {
367 tgbConfig.trackingVolumeBuilders.push_back(
368 [&](const auto &gctx, const auto &inner, const auto &) {
375 auto lb = std::make_shared<ActsLayerBuilder>(
377
378 Acts::CylinderVolumeBuilder::Config cvbConfig;
379 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
380 cvbConfig.layerEnvelopeZ = 1_mm;
381 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
382 cvbConfig.volumeName = "ITkStrip";
383 cvbConfig.layerBuilder =
lb;
384 cvbConfig.buildToRadiusZero =
386
387 Acts::CylinderVolumeBuilder cvb(
388 cvbConfig,
390
391 return cvb.trackingVolume(gctx, inner);
392 });
393 }
394
395 bool buildSCT = buildSubdet.count("SCT") > 0;
396 bool buildTRT = buildSubdet.count("TRT") > 0;
397
398 if (buildSCT && buildTRT) {
399
400 tgbConfig.trackingVolumeBuilders.push_back(
401 [&](const auto &gctx, const auto &inner, const auto &) {
404 cfg.endcapEnvelopeZ = sctECEnvelopeZ;
405 auto sct_lb = std::make_shared<ActsLayerBuilder>(
407
409
411 *cylinderVolumeHelper, inner);
412 });
413
414 } else if (buildSCT) {
415 tgbConfig.trackingVolumeBuilders.push_back(
416 [&](const auto &gctx, const auto &inner, const auto &) {
419 lbCfg.endcapEnvelopeZ = sctECEnvelopeZ;
420 auto lb = std::make_shared<ActsLayerBuilder>(
421 lbCfg,
423
424 Acts::CylinderVolumeBuilder::Config cvbConfig;
425 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
426 cvbConfig.layerEnvelopeZ = 2_mm;
427 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
428 cvbConfig.volumeName = "SCT";
429 cvbConfig.layerBuilder =
lb;
430 cvbConfig.buildToRadiusZero = false;
431
432 Acts::CylinderVolumeBuilder cvb(
433 cvbConfig,
435
436 return cvb.trackingVolume(gctx, inner);
437 });
438 } else if (buildTRT) {
439 tgbConfig.trackingVolumeBuilders.push_back(
440 [&](const auto &gctx, const auto &inner, const auto &) {
442 Acts::CylinderVolumeBuilder::Config cvbConfig;
443 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
444 cvbConfig.layerEnvelopeZ = 2_mm;
445 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
446 cvbConfig.volumeName = "TRT";
447 cvbConfig.layerBuilder =
lb;
448 cvbConfig.buildToRadiusZero = false;
449
450 Acts::CylinderVolumeBuilder cvb(
451 cvbConfig,
453
454 return cvb.trackingVolume(gctx, inner);
455 });
456 }
457
458
459 if(buildSubdet.count("HGTD") > 0) {
460 tgbConfig.trackingVolumeBuilders.push_back(
461 [&](const auto &gctx, const auto &inner, const auto &) {
463 Acts::CylinderVolumeBuilder::Config cvbConfig;
464 cvbConfig.layerEnvelopeR = {5_mm, 5_mm};
465 cvbConfig.layerEnvelopeZ = 1_mm;
466 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
467 cvbConfig.volumeName = "HGTD";
468 cvbConfig.layerBuilder =
lb;
469 cvbConfig.buildToRadiusZero = false;
470
471 Acts::CylinderVolumeBuilder cvb(
472 cvbConfig,
474
475 return cvb.trackingVolume(gctx, inner);
476 });
477 }
478
479
481 tgbConfig.trackingVolumeBuilders.push_back(
482 [&](const auto &gctx, const auto &inner, const auto &) {
484 });
485 }
486
487 } catch (const std::exception &e) {
488 ATH_MSG_ERROR(
"Encountered error when building Acts tracking geometry");
490 return StatusCode::FAILURE;
491 }
492
493 auto trackingGeometryBuilder =
494 std::make_shared<const Acts::TrackingGeometryBuilder>(
496
501
503 ATH_MSG_ERROR(
"No ACTS tracking geometry was built. Cannot proceeed");
504 return StatusCode::FAILURE;
505 }
506
507
509 ATH_MSG_INFO(
"Running extra consistency check! (this is SLOW)");
511 ATH_MSG_ERROR(
"Consistency check has failed! Geometry is not consistent");
512 return StatusCode::FAILURE;
513 }
514 }
515
516 ATH_MSG_INFO(
"Acts TrackingGeometry construction completed");
517
518 return StatusCode::SUCCESS;
519}
#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)
ToolHandleArray< ActsTrk::IBlueprintNodeBuilder > m_blueprintNodeBuilders
Acts::CylinderVolumeBuilder::Config makeBeamPipeConfig(std::shared_ptr< const Acts::CylinderVolumeHelper > cvh) const
Gaudi::Property< std::vector< float > > m_passiveITkInnerPixelBarrelLayerHalflengthZ
Gaudi::Property< std::vector< float > > m_passiveITkStripBarrelLayerThickness
const InDetDD::TRT_DetectorManager * p_TRTManager
const TRT_ID * m_TRT_idHelper
Gaudi::Property< std::vector< unsigned int > > m_subDetNoAlignProp
Define the subdetectors for which the tracking geometry does not expect a valid alignment store.
const HGTD_ID * m_HGTD_idHelper
std::shared_ptr< const Acts::ILayerBuilder > makeHGTDLayerBuilder(const HGTD_DetectorManager *manager)
Gaudi::Property< bool > m_useMaterialMap
std::shared_ptr< const Acts::TrackingGeometry > m_trackingGeometry
Gaudi::Property< std::string > m_materialMapCalibFolder
const HGTD_DetectorManager * p_HGTDManager
Gaudi::Property< std::vector< float > > m_passiveITkOuterPixelBarrelLayerThickness
const InDetDD::SiDetectorManager * p_pixelManager
Gaudi::Property< bool > m_objDebugOutput
Gaudi::Property< std::vector< float > > m_passiveITkOuterPixelBarrelLayerRadii
std::shared_ptr< const Acts::ILayerBuilder > makeStrawLayerBuilder(const InDetDD::InDetDetectorManager *manager)
const ActsTrk::GeometryContext & getNominalContext() const override
Gaudi::Property< std::string > m_materialMapInputFileBase
const InDetDD::SiDetectorManager * p_ITkStripManager
Gaudi::Property< std::vector< float > > m_passiveITkStripBarrelLayerRadii
std::set< ActsTrk::DetectorType > m_subDetNoAlign
const BeamPipeDetectorManager * p_beamPipeMgr
Gaudi::Property< bool > m_printGeo
Print the assembled tracking geometry after building.
Gaudi::Property< bool > m_buildBeamPipe
Gaudi::Property< std::vector< std::string > > m_buildSubdetectors
ToolHandle< IActsTrackingVolumeBuilder > m_caloVolumeBuilder
BooleanProperty m_runConsistencyChecks
bool runConsistencyChecks() const
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)
Gaudi::Property< std::vector< float > > m_passiveITkOuterPixelBarrelLayerHalflengthZ
Gaudi::Property< std::vector< float > > m_passiveITkInnerPixelBarrelLayerRadii
the specifications for building additional passive cylinders in the barrel region: for each cylinder ...
Gaudi::Property< std::vector< float > > m_passiveITkInnerPixelBarrelLayerThickness
Gaudi::Property< std::vector< float > > m_passiveITkStripBarrelLayerHalflengthZ
const InDetDD::SiDetectorManager * p_SCTManager
const InDetDD::SiDetectorManager * p_ITkPixelManager
ActsLayerBuilder::Config makeLayerBuilderConfig(const InDetDD::InDetDetectorManager *manager)
Gaudi::Property< bool > m_useBlueprint
Acts::GeometryContext context() const
static Root::TMsgLogger logger("iLumiCalc")
Acts::Logging::Level actsLevelVector(MSG::Level lvl)
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.