ATLAS Offline Software
DetectorVolumeSvc.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 // ATHENA
9 #include "GaudiKernel/EventContext.h"
12 
13 // ACTS
14 #include "Acts/Detector/Detector.hpp"
15 #include "Acts/Detector/DetectorVolume.hpp"
16 #include "Acts/Detector/CylindricalContainerBuilder.hpp"
17 #include "Acts/Detector/DetectorBuilder.hpp"
18 
19 using namespace ActsTrk;
21  ISvcLocator *svc)
22  : base_class(name, svc) {}
23 
25  ATH_CHECK(m_builderTools.retrieve());
26  if (m_builderTools.empty()) {
27  ATH_MSG_FATAL("No subdetectors were defined ");
28  return StatusCode::FAILURE;
29  }
30  return StatusCode::SUCCESS;
31 }
32 
33 std::shared_ptr<const Acts::Experimental::Detector> DetectorVolumeSvc::detector() const {
34  if (!m_detector.isValid()) {
35  ATH_MSG_INFO("Build the Acts tracking detector");
37  }
38  return *m_detector.ptr();
39 }
40 
41 unsigned int DetectorVolumeSvc::populateAlignmentStore(AlignmentStore& /*store*/) const {
42  return 0;
43 }
44 
46  return m_nomContext;
47 }
48 
49 std::shared_ptr<const Acts::Experimental::Detector> DetectorVolumeSvc::buildDetector() const {
50  ActsGeometryContext gctx{};
51  std::vector<std::shared_ptr<const Acts::Experimental::IDetectorComponentBuilder> > builders;
52  for (const auto &builder : m_builderTools) {
54  }
55 
56  //Define config for cylindrical container builder
57  Acts::Experimental::CylindricalContainerBuilder::Config cylindricalCfg;
58  cylindricalCfg.builders = builders;
59  cylindricalCfg.binning = std::vector<Acts::BinningValue>{Acts::BinningValue::binZ, Acts::BinningValue::binR};
60  auto cylindricalBuilder = std::make_shared<Acts::Experimental::CylindricalContainerBuilder>(cylindricalCfg);
61 
62  //Define config for detector builder
63  Acts::Experimental::DetectorBuilder::Config detectorCfg;
64  detectorCfg.builder = cylindricalBuilder;
65  return Acts::Experimental::DetectorBuilder(detectorCfg).construct(gctx.context());
66 }
ActsTrk::DetectorVolumeSvc::detector
DetectorPtr detector() const override
Definition: DetectorVolumeSvc.cxx:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
CxxUtils::CachedValue::ptr
const T * ptr() const
Return a pointer to the cached value.
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Trk::binZ
@ binZ
Definition: BinningType.h:49
CxxUtils::CachedValue::isValid
bool isValid() const
Test to see if the value is valid.
ActsTrk::DetectorVolumeSvc::populateAlignmentStore
unsigned int populateAlignmentStore(AlignmentStore &store) const override
Definition: DetectorVolumeSvc.cxx:41
ActsTrk::DetectorVolumeSvc::m_nomContext
ActsGeometryContext m_nomContext
Definition: DetectorVolumeSvc.h:43
ActsTrk::DetectorVolumeSvc::m_builderTools
ToolHandleArray< IDetectorVolumeBuilderTool > m_builderTools
Definition: DetectorVolumeSvc.h:40
ActsTrk::DetectorVolumeSvc::buildDetector
std::shared_ptr< const Acts::Experimental::Detector > buildDetector() const
Definition: DetectorVolumeSvc.cxx:49
GeoPrimitives.h
DetectorVolumeSvc.h
ActsTrk::DetectorVolumeSvc::initialize
StatusCode initialize() override
Definition: DetectorVolumeSvc.cxx:24
createSimpleDistributions.builder
builder
Definition: createSimpleDistributions.py:52
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ActsTrk::DetectorVolumeSvc::m_detector
CxxUtils::CachedValue< DetectorPtr > m_detector
Definition: DetectorVolumeSvc.h:42
NoDeletePtr.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ActsTrk::DetectorVolumeSvc::DetectorVolumeSvc
DetectorVolumeSvc(const std::string &name, ISvcLocator *pSvcLocator)
Definition: DetectorVolumeSvc.cxx:20
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:27
PathResolver.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
CxxUtils::CachedValue::set
void set(const T &val) const
Set the value, assuming it is currently invalid.
Trk::binR
@ binR
Definition: BinningType.h:50
ActsTrk::DetectorVolumeSvc::getNominalContext
const ActsGeometryContext & getNominalContext() const override
Definition: DetectorVolumeSvc.cxx:45
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
ActsTrk::NoDeletePtr
Definition: NoDeletePtr.h:17