ATLAS Offline Software
SolenoidParametrizationCondAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <limits>
7 namespace Trk
8 {
9 
10 SolenoidParametrizationCondAlg::SolenoidParametrizationCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
11  : ::AthReentrantAlgorithm(name, pSvcLocator)
12  , m_condSvc{"CondSvc", name}
13 {
14 }
15 
17  ATH_CHECK( m_condSvc.retrieve());
19  ATH_CHECK( m_writeKey.initialize() );
20  return StatusCode::SUCCESS;
21 }
22 
23 
24 StatusCode SolenoidParametrizationCondAlg::execute(const EventContext &ctx) const {
26  if (write_handle.isValid()) {
27  return StatusCode::SUCCESS;
28  }
29 
31  if (!readHandle.isValid()) {
32  ATH_MSG_FATAL("Failed to get magnetic field conditions data " << m_fieldCacheCondObjInputKey.key() );
33  return StatusCode::FAILURE;
34  }
35 
36  write_handle.addDependency(readHandle);
37  ATH_CHECK( write_handle.record(std::make_unique<SolenoidParametrization>(*(readHandle.cptr())) ));
38  return StatusCode::SUCCESS;
39 }
40 
41 
43  return StatusCode::SUCCESS;
44 }
45 
46 }
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
Trk::SolenoidParametrizationCondAlg::SolenoidParametrizationCondAlg
SolenoidParametrizationCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: SolenoidParametrizationCondAlg.cxx:10
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
Trk::SolenoidParametrizationCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition: SolenoidParametrizationCondAlg.cxx:24
Trk::SolenoidParametrizationCondAlg::finalize
virtual StatusCode finalize() override final
Definition: SolenoidParametrizationCondAlg.cxx:42
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition: WriteCondHandle.h:157
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SolenoidParametrizationCondAlg.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
Trk::SolenoidParametrizationCondAlg::m_writeKey
SG::WriteCondHandleKey< SolenoidParametrization > m_writeKey
Definition: SolenoidParametrizationCondAlg.h:36
Trk::SolenoidParametrizationCondAlg::initialize
virtual StatusCode initialize() override final
Definition: SolenoidParametrizationCondAlg.cxx:16
Trk::SolenoidParametrizationCondAlg::m_condSvc
ServiceHandle< ICondSvc > m_condSvc
Definition: SolenoidParametrizationCondAlg.h:39
SG::WriteCondHandle::isValid
bool isValid() const
Definition: WriteCondHandle.h:248
SG::WriteCondHandle
Definition: WriteCondHandle.h:26
Trk::SolenoidParametrizationCondAlg::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: SolenoidParametrizationCondAlg.h:33
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition: WriteCondHandle.h:275