ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsEvent
Root
ContextUtility.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
ActsEvent/ContextUtility.h
"
5
6
#include "
AthenaBaseComps/AthCheckMacros.h
"
7
8
#include "
StoreGate/ReadHandle.h
"
9
#include "
StoreGate/ReadCondHandle.h
"
10
11
#include "
ActsCalibBase/CalibrationContext.h
"
12
13
#include "GeoModelKernel/throwExcept.h"
14
15
namespace
ActsTrk
{
16
StatusCode
ContextUtility::initialize
(
const
bool
enable) {
17
ATH_CHECK
(
m_geoCtxKey
.initialize(enable && !
m_geoCtxKey
.empty()));
18
ATH_CHECK
(
m_magCtxKey
.initialize(enable && !
m_magCtxKey
.empty()));
19
return
StatusCode::SUCCESS;
20
}
21
22
MsgStream&
ContextUtility::msg
(
const
MSG::Level lvl)
const
{
23
return
m_msgPrinter
(lvl);
24
}
25
26
bool
ContextUtility::msgLvl
(
const
MSG::Level lvl)
const
{
27
return
m_msgLevel
(lvl);
28
}
29
30
Acts::GeometryContext
ContextUtility::getGeometryContext
(
const
EventContext& ctx)
const
{
31
const
ActsTrk::GeometryContext
* gctx{
nullptr
};
32
if
(!
SG::get
(gctx,
m_geoCtxKey
, ctx).isSuccess()) {
33
THROW_EXCEPTION
(
"Failed to retrieve the geometry context "
<<
m_geoCtxKey
.fullKey());
34
35
}
36
if
(!gctx) {
37
ATH_MSG_WARNING
(__func__<<
"() "
<<__LINE__<<
" - No geometry context passed"
);
38
return
Acts::GeometryContext{gctx};
39
}
40
return
gctx->
context
();
41
}
42
43
Acts::CalibrationContext
ContextUtility::getCalibrationContext
(
const
EventContext& ctx)
const
{
44
return
ActsTrk::getCalibrationContext
(ctx);
45
}
46
47
Acts::MagneticFieldContext
ContextUtility::getMagneticFieldContext
(
const
EventContext& ctx)
const
{
48
const
AtlasFieldCacheCondObj
* mctx{
nullptr
};
49
if
(!
SG::get
(mctx,
m_magCtxKey
, ctx).isSuccess()) {
50
THROW_EXCEPTION
(
"Failed to retrieve the magnetic field context "
<<
m_magCtxKey
.fullKey());
51
52
}
53
if
(!mctx) {
54
ATH_MSG_WARNING
(__func__<<
"() "
<<__LINE__<<
" - No magentic field context passed"
);
55
}
56
return
Acts::MagneticFieldContext{mctx};
57
}
58
}
59
AthCheckMacros.h
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
CalibrationContext.h
ContextUtility.h
ReadCondHandle.h
ReadHandle.h
Handle class for reading from StoreGate.
ActsTrk::ContextUtility::m_magCtxKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_magCtxKey
Data dependency on the magnetic field map.
Definition
ContextUtility.h:51
ActsTrk::ContextUtility::getMagneticFieldContext
Acts::MagneticFieldContext getMagneticFieldContext(const EventContext &ctx) const
Retrieves the current magnetic field context from StoreGate.
Definition
ContextUtility.cxx:47
ActsTrk::ContextUtility::msgLvl
bool msgLvl(const MSG::Level lvl) const
Returns whether the stream satisfies the logging level.
Definition
ContextUtility.cxx:26
ActsTrk::ContextUtility::getGeometryContext
Acts::GeometryContext getGeometryContext(const EventContext &ctx) const
Retrieves the current geometry context from StoreGate.
Definition
ContextUtility.cxx:30
ActsTrk::ContextUtility::getCalibrationContext
Acts::CalibrationContext getCalibrationContext(const EventContext &ctx) const
Retrieves the current calibration context from StoreGate.
Definition
ContextUtility.cxx:43
ActsTrk::ContextUtility::m_msgLevel
std::function< bool(const MSG::Level)> m_msgLevel
Lambda to return the msg level from the parent's msg stream.
Definition
ContextUtility.h:55
ActsTrk::ContextUtility::m_geoCtxKey
GeoContextReadKey_t m_geoCtxKey
Data dependency on the aligned geometry transforms.
Definition
ContextUtility.h:49
ActsTrk::ContextUtility::initialize
StatusCode initialize(const bool enable=true)
Initializes the ReadHandleKeys held by the utility class.
Definition
ContextUtility.cxx:16
ActsTrk::ContextUtility::msg
MsgStream & msg(const MSG::Level lvl) const
Return the reference to the msg logging stream.
Definition
ContextUtility.cxx:22
ActsTrk::ContextUtility::m_msgPrinter
std::function< MsgStream &(const MSG::Level)> m_msgPrinter
Lambda to access the parent's msg stream.
Definition
ContextUtility.h:53
ActsTrk::GeometryContext
Definition
GeometryContext.h:30
ActsTrk::GeometryContext::context
Acts::GeometryContext context() const
Definition
GeometryContext.h:48
AtlasFieldCacheCondObj
Definition
AtlasFieldCacheCondObj.h:19
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition
MdtCalibInput.h:31
ActsTrk::getCalibrationContext
Acts::CalibrationContext getCalibrationContext(const EventContext &ctx)
The Acts::Calibration context is piped through the Acts fitters to (re)calibrate the Acts::SourceLink...
Definition
CalibrationContext.h:15
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition
ReadCondHandle.h:282
THROW_EXCEPTION
#define THROW_EXCEPTION(MESSAGE)
Definition
throwExcept.h:10
Generated on
for ATLAS Offline Software by
1.17.0