ATLAS Offline Software
Loading...
Searching...
No Matches
AuxiliaryMeasurementHandler.icc
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ActsEvent_AuxiliaryMeasurementHandler_ICC
6#define ActsEvent_AuxiliaryMeasurementHandler_ICC
7
8#include "ActsGeoUtils/SurfaceEncoding.h"
9namespace ActsTrk{
10 template <class PropOwner>
11 AuxiliaryMeasurementHandler::AuxiliaryMeasurementHandler(PropOwner* owner):
12 m_msgPrinter{[owner](const MSG::Level msg) -> MsgStream& {
13 return owner->msg(msg);
14 }},
15 m_msgLevel{[owner](const MSG::Level msg) {
16 return owner->msgLvl(msg);
17 }},
18 m_viewKey{owner, "AuxiliaryMeasViewKey", ""},
19 m_writeKey1D{owner, "AuxiliaryMeasKey1D", ""},
20 m_writeKey2D{owner, "AuxiliaryMeasKey2D", ""},
21 m_writeKey3D{owner, "AuxiliaryMeasKey3D", ""},
22 m_surfaceKey{owner, "AuxiliarySurfaceKey", ""}{}
23
24
25 template<size_t N> xAOD::AuxiliaryMeasurement*
26 AuxiliaryMeasurementHandler::MeasurementProvider::newMeasurement(const SurfacePtr_t& surface,
27 const ProjectorType projector,
28 const AmgSymMatrix(N)& locCov,
29 const AmgVector(N) locPos) {
30 xAOD::AuxiliaryMeasurement* meas{nullptr};
31 static_assert(N>=1 && N<=3, "Invalid measurement dimension");
32 if constexpr(N == 1) {
33 meas = m_handle1D->push_back(std::make_unique<xAOD::AuxiliaryMeasurement>());
34 assert(projector == ProjectorType::e1DimNoTime ||
35 projector == ProjectorType::e1DimRotNoTime);
36 } else if constexpr(N == 2) {
37 meas = m_handle2D->push_back(std::make_unique<xAOD::AuxiliaryMeasurement>());
38 assert(projector == ProjectorType::e2DimNoTime ||
39 projector == ProjectorType::e1DimWithTime ||
40 projector == ProjectorType::e1DimRotWithTime);
41 } else if constexpr(N == 3) {
42 meas = m_handle3D->push_back(std::make_unique<xAOD::AuxiliaryMeasurement>());
43 assert(projector == ProjectorType::e2DimWithTime);
44 }
45 meas->setMeasurement<N>(0, xAOD::toStorage(locPos), xAOD::toStorage(locCov));
46 meas->setProjector(projector);
47 auto cached_itr = m_cachedSurfs.find(surface);
48 if (cached_itr == m_cachedSurfs.end()) {
49 auto persistSurf = m_surfaceContainer->push_back(std::make_unique<xAOD::TrackSurface>());
50 encodeSurface(persistSurf, surface.get(), m_gctx);
51
52 cached_itr = m_cachedSurfs.insert(std::make_pair(surface, persistSurf)).first;
53 }
54 xAOD::AuxiliaryMeasurement::SurfLink_t link{*m_surfaceContainer, cached_itr->second->index(), m_ctx};
55 meas->setSurface(surface, std::move(link));
56 m_viewHandle->push_back(meas);
57 return meas;
58 }
59}
60
61#endif