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 
21 
23  ATH_MSG_DEBUG("initialize " << name());
24  ATH_CHECK(m_alignStoreKeys.initialize());
25  ATH_CHECK(m_wchk.initialize());
26  return StatusCode::SUCCESS;
27 }
28 
29 StatusCode GeometryContextAlg::execute(const EventContext& ctx) const {
30  ATH_MSG_DEBUG("execute " << name());
31 
32  SG::WriteHandle wch{m_wchk, ctx};
33 
34  // create an Acts aware geo alignment store from the one given
35  // (this makes a copy for now, which is not ideal)
36  auto gctx = std::make_unique<GeometryContext>();
37 
39  SG::ReadHandle<DetectorAlignStore> alignStore{key, ctx};
40  if (!alignStore.isValid()) {
41  ATH_MSG_FATAL("Failed to retrieve alignment from " << key.fullKey());
42  return StatusCode::FAILURE;
43  }
44  gctx->setStore(std::make_unique<DetectorAlignStore>(*alignStore));
45  }
46 
47  // get a nominal alignment store from the tracking geometry service
48  // and plug it into a geometry context
49  ATH_CHECK(wch.record(std::move(gctx)));
50  ATH_MSG_DEBUG("Recorded new " << wch.key());
51 
52  return StatusCode::SUCCESS;
53 }
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
GeometryContext.h
WriteHandle.h
Handle class for recording to StoreGate.
ActsTrk::GeometryContextAlg::m_wchk
SG::WriteHandleKey< GeometryContext > m_wchk
Definition: GeometryContextAlg.h:30
ActsTrk::GeometryContextAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition: GeometryContextAlg.cxx:29
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
IOVInfiniteRange.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
ActsTrk::GeometryContextAlg::m_alignStoreKeys
SG::ReadHandleKeyArray< DetectorAlignStore > m_alignStoreKeys
Definition: GeometryContextAlg.h:28
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MdtCalibInput.h:31
ActsTrk::GeometryContextAlg::initialize
StatusCode initialize() override
Definition: GeometryContextAlg.cxx:22
ReadHandle.h
Handle class for reading from StoreGate.
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37