ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::ContextUtility Class Reference

Utility class to handle the three contexts neeeded in an ACTS reconstruction job 1) GeometryContext -> handles the aligned transforms of the Surfaces & volumes 2) MagneticFieldContext -> Contains the magnetic field 3) CalibrationContext -> Pipes the StoreGate access through the Acts caller chain The utility class declares the data dependencies on the needed conditions by calling the declareProperty on its client. More...

#include <ContextUtility.h>

Collaboration diagram for ActsTrk::ContextUtility:

Public Member Functions

template<class PropOwner>
 ContextUtility (PropOwner *owner)
 Constructor taking the pointer to the class holding the object used to declare the data dependency from the WriteHandleKeys to the AvalancheScheduler.
StatusCode initialize (const bool enable=true)
 Initializes the ReadHandleKeys held by the utility class.
Acts::GeometryContext getGeometryContext (const EventContext &ctx) const
 Retrieves the current geometry context from StoreGate.
Acts::CalibrationContext getCalibrationContext (const EventContext &ctx) const
 Retrieves the current calibration context from StoreGate.
Acts::MagneticFieldContext getMagneticFieldContext (const EventContext &ctx) const
 Retrieves the current magnetic field context from StoreGate.

Private Member Functions

MsgStream & msg (const MSG::Level lvl) const
 Return the reference to the msg logging stream.
bool msgLvl (const MSG::Level lvl) const
 Returns whether the stream satisfies the logging level.

Private Attributes

GeoContextReadKey_t m_geoCtxKey
 Data dependency on the aligned geometry transforms.
SG::ReadCondHandleKey< AtlasFieldCacheCondObjm_magCtxKey
 Data dependency on the magnetic field map.
std::function< MsgStream &(const MSG::Level)> m_msgPrinter
 Lambda to access the parent's msg stream.
std::function< bool(const MSG::Level)> m_msgLevel
 Lambda to return the msg level from the parent's msg stream.

Detailed Description

Utility class to handle the three contexts neeeded in an ACTS reconstruction job 1) GeometryContext -> handles the aligned transforms of the Surfaces & volumes 2) MagneticFieldContext -> Contains the magnetic field 3) CalibrationContext -> Pipes the StoreGate access through the Acts caller chain The utility class declares the data dependencies on the needed conditions by calling the declareProperty on its client.

Likewise any StoreGateKey the Utility needs to be initialized in in the initialize method.

Definition at line 27 of file ContextUtility.h.

Constructor & Destructor Documentation

◆ ContextUtility()

template<class PropOwner>
ActsTrk::ContextUtility::ContextUtility ( PropOwner * owner)
explicit

Constructor taking the pointer to the class holding the object used to declare the data dependency from the WriteHandleKeys to the AvalancheScheduler.

The object should be defined in the header like ActsTrk::ContextUtility m_ctxProvider{this};

Member Function Documentation

◆ getCalibrationContext()

Acts::CalibrationContext ActsTrk::ContextUtility::getCalibrationContext ( const EventContext & ctx) const

Retrieves the current calibration context from StoreGate.

Parameters
ctxThe event context to access the conditions store

Definition at line 43 of file ContextUtility.cxx.

43 {
45 }
Acts::CalibrationContext getCalibrationContext(const EventContext &ctx)
The Acts::Calibration context is piped through the Acts fitters to (re)calibrate the Acts::SourceLink...

◆ getGeometryContext()

Acts::GeometryContext ActsTrk::ContextUtility::getGeometryContext ( const EventContext & ctx) const

Retrieves the current geometry context from StoreGate.

Parameters
ctxThe event context to access the conditions store

Definition at line 30 of file ContextUtility.cxx.

30 {
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 }
#define ATH_MSG_WARNING(x)
GeoContextReadKey_t m_geoCtxKey
Data dependency on the aligned geometry transforms.
Acts::GeometryContext context() const
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10

◆ getMagneticFieldContext()

Acts::MagneticFieldContext ActsTrk::ContextUtility::getMagneticFieldContext ( const EventContext & ctx) const

Retrieves the current magnetic field context from StoreGate.

Parameters
ctxThe event context to access the conditions store

Definition at line 47 of file ContextUtility.cxx.

47 {
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 }
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_magCtxKey
Data dependency on the magnetic field map.

◆ initialize()

StatusCode ActsTrk::ContextUtility::initialize ( const bool enable = true)

Initializes the ReadHandleKeys held by the utility class.

Parameters
enableFlag to toggle whether the key shall be used or not

Definition at line 16 of file ContextUtility.cxx.

16 {
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 }
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ msg()

MsgStream & ActsTrk::ContextUtility::msg ( const MSG::Level lvl) const
private

Return the reference to the msg logging stream.

Parameters
lvlLogging level to be applied

Definition at line 22 of file ContextUtility.cxx.

22 {
23 return m_msgPrinter(lvl);
24 }
std::function< MsgStream &(const MSG::Level)> m_msgPrinter
Lambda to access the parent's msg stream.

◆ msgLvl()

bool ActsTrk::ContextUtility::msgLvl ( const MSG::Level lvl) const
private

Returns whether the stream satisfies the logging level.

Definition at line 26 of file ContextUtility.cxx.

26 {
27 return m_msgLevel(lvl);
28 }
std::function< bool(const MSG::Level)> m_msgLevel
Lambda to return the msg level from the parent's msg stream.

Member Data Documentation

◆ m_geoCtxKey

GeoContextReadKey_t ActsTrk::ContextUtility::m_geoCtxKey
private

Data dependency on the aligned geometry transforms.

Definition at line 49 of file ContextUtility.h.

◆ m_magCtxKey

SG::ReadCondHandleKey<AtlasFieldCacheCondObj> ActsTrk::ContextUtility::m_magCtxKey
private

Data dependency on the magnetic field map.

Definition at line 51 of file ContextUtility.h.

◆ m_msgLevel

std::function<bool(const MSG::Level)> ActsTrk::ContextUtility::m_msgLevel
private

Lambda to return the msg level from the parent's msg stream.

Definition at line 55 of file ContextUtility.h.

◆ m_msgPrinter

std::function<MsgStream&(const MSG::Level)> ActsTrk::ContextUtility::m_msgPrinter
private

Lambda to access the parent's msg stream.

Definition at line 53 of file ContextUtility.h.


The documentation for this class was generated from the following files: