ATLAS Offline Software
Loading...
Searching...
No Matches
AuxiliaryMeasurementHandler.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
11
13
14#include <format>
15#include <functional>
16
17namespace ActsTrk{
18 MsgStream& AuxiliaryMeasurementHandler::msg(const MSG::Level lvl) const {
19 return m_msgPrinter(lvl);
20 }
21
22 bool AuxiliaryMeasurementHandler::msgLvl(const MSG::Level lvl) const {
23 return m_msgLevel(lvl);
24 }
25 StatusCode AuxiliaryMeasurementHandler::initialize(const std::string& preFix,
26 bool used) {
27 if (preFix.empty()) {
28 ATH_MSG_ERROR("The prefix key of the auxiliary measurements must no be empty");
29 return StatusCode::FAILURE;
30 }
31 m_surfaceKey = std::format("{:}AuxiliarySurfaceContainer", preFix);
32 if (!m_surfaceKey.initialize(used).isSuccess()) {
33 ATH_MSG_ERROR("Failed to initialize "<<m_surfaceKey.fullKey());
34 return StatusCode::FAILURE;
35 }
36 unsigned counter{1};
37
38 for (auto& initMe : {&m_writeKey1D, &m_writeKey2D, &m_writeKey3D}){
39 (*initMe) = std::format("{:}AuxiliaryMeasContainer{:}D", preFix, counter++);
40 if (!initMe->initialize(used).isSuccess()) {
41 ATH_MSG_ERROR("Failed to initialize "<<(*initMe).fullKey());
42 return StatusCode::FAILURE;
43 }
44 }
45 return StatusCode::SUCCESS;
46 }
47 template<typename AuxCont_t, typename Cont_t>
49 ATH_CHECK(handle.record(std::make_unique<Cont_t>(), std::make_unique<AuxCont_t>()));
50 return StatusCode::SUCCESS;
51 }
52
53
55 const Acts::GeometryContext& gctx,
56 const AuxiliaryMeasurementHandler* parent):
57 m_ctx{ctx},
58 m_gctx{gctx},
59 m_parent{parent}{}
69 const Acts::GeometryContext& gctx) const {
70 if (m_surfaceKey.empty()) {
72 }
73 MeasurementProvider newHandle{ctx, gctx, this};
74 if (!newHandle.setupContainers().isSuccess()) {
76 }
77 return HandleReturn_t{std::move(newHandle)};
78 }
79}
80#undef RECORD_CONTAINER
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
Helper struct to create a new pseudo measurement.
StatusCode recordContainer(SG::WriteHandle< Cont_t > &handle)
StatusCode setupContainers()
Setup method to record the Auxiliary measurement containers into StoreGate.
MeasurementProvider(MeasurementProvider &&other)=default
Default move constructor.
Key_t m_writeKey2D
Key to write the 2D measurements.
MsgStream & msg(const MSG::Level lvl) const
Return the reference to the msg logging stream.
Key_t m_writeKey1D
Key to write the 1D measurements.
HandleReturn_t makeHandle(const EventContext &ctx, const Acts::GeometryContext &gctx) const
Creates a new MeasurementProvider and triggers the write of the container backend to StoreGate.
Acts::Result< MeasurementProvider, HandleStatus > HandleReturn_t
StatusCode initialize(const std::string &preFix, bool used=true)
Initialize the write handle keys.
bool msgLvl(const MSG::Level lvl) const
Returns whether the stream satisfies the logging level.
std::function< bool(const MSG::Level)> m_msgLevel
Lambda to return the msg level from the parent's msg stream.
Key_t m_writeKey3D
Key to write the 2D + time measurements.
std::function< MsgStream &(const MSG::Level)> m_msgPrinter
Lambda to access the parent's msg stream.
SG::WriteHandleKey< xAOD::TrackSurfaceContainer > m_surfaceKey
Key to write the surfaces associated to the measurements.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
holding In fact this class is here in order to allow STL container for all features This class is sho...
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...