ATLAS Offline Software
GeometryContextAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "GeometryContextAlg.h"
6 
7 // PACKAGE
9 
10 // ATHENA
12 #include "StoreGate/ReadHandle.h"
13 #include "StoreGate/WriteHandle.h"
14 
16 
17 
18 using namespace ActsTrk;
19 GeometryContextAlg::GeometryContextAlg(const std::string& name, ISvcLocator* pSvcLocator) :
20  AthReentrantAlgorithm(name, pSvcLocator) {}
21 
23 
25  ATH_MSG_DEBUG("initialize " << name());
26  ATH_CHECK(m_alignStoreKeys.initialize());
28  return StatusCode::SUCCESS;
29 }
30 
31 StatusCode GeometryContextAlg::execute(const EventContext& ctx) const {
32  ATH_MSG_DEBUG("execute " << name());
33 
35 
36  // create an Acts aware geo alignment store from the one given
37  // (this makes a copy for now, which is not ideal)
38  std::unique_ptr<ActsGeometryContext> gctx = std::make_unique<ActsGeometryContext>();
39 
41  SG::ReadHandle<DetectorAlignStore> alignStore{key, ctx};
42  if (!alignStore.isValid()) {
43  ATH_MSG_FATAL("Failed to retrieve alignment from " << key.fullKey());
44  return StatusCode::FAILURE;
45  }
46  gctx->setStore(std::make_unique<DetectorAlignStore>(*alignStore));
47  }
48 
49  // get a nominal alignment store from the tracking geometry service
50  // and plug it into a geometry context
51  ATH_CHECK(wch.record(std::move(gctx)));
52  ATH_MSG_DEBUG("Recorded new " << wch.key());
53 
54  return StatusCode::SUCCESS;
55 }
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ActsGeometryContext.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
WriteHandle.h
Handle class for recording to StoreGate.
ActsTrk::GeometryContextAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition: GeometryContextAlg.cxx:31
ActsTrk::GeometryContextAlg::m_wchk
SG::WriteHandleKey< ActsGeometryContext > m_wchk
Definition: GeometryContextAlg.h:30
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
GeometryContextAlg.h
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ActsTrk::GeometryContextAlg::~GeometryContextAlg
virtual ~GeometryContextAlg()
WriteCondHandle.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
ActsTrk::GeometryContextAlg::m_alignStoreKeys
SG::ReadHandleKeyArray< ActsTrk::DetectorAlignStore > m_alignStoreKeys
Definition: GeometryContextAlg.h:28
IOVInfiniteRange.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ActsTrk::GeometryContextAlg::GeometryContextAlg
GeometryContextAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: GeometryContextAlg.cxx:19
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
ActsTrk::GeometryContextAlg::initialize
StatusCode initialize() override
Definition: GeometryContextAlg.cxx:24
ReadHandle.h
Handle class for reading from StoreGate.
ActsGeometryContext::setStore
void setStore(AlignmentStorePtr store)
Adds the store to the Geometry context.
Definition: ActsGeometryContext.h:41
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37