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_writeKey1D{owner, "AuxiliaryMeasKey1D", ""},
19 m_writeKey2D{owner, "AuxiliaryMeasKey2D", ""},
20 m_writeKey3D{owner, "AuxiliaryMeasKey3D", ""},
21 m_surfaceKey{owner, "AuxiliarySurfaceKey", ""}{}
22
23
24 template<size_t N> xAOD::AuxiliaryMeasurement*
25 AuxiliaryMeasurementHandler::MeasurementProvider::newMeasurement(const SurfacePtr_t& surface,
26 const ProjectorType projector,
27 const AmgSymMatrix(N)& locCov,
28 const AmgVector(N) locPos) {
29 xAOD::AuxiliaryMeasurement* meas{nullptr};
30 static_assert(N>=1 && N<=3, "Invalid measurement dimension");
31 if constexpr(N == 1) {
32 meas = m_handle1D->push_back(std::make_unique<xAOD::AuxiliaryMeasurement>());
33 assert(projector == ProjectorType::e1DimNoTime ||
34 projector == ProjectorType::e1DimRotNoTime);
35 } else if constexpr(N == 2) {
36 meas = m_handle2D->push_back(std::make_unique<xAOD::AuxiliaryMeasurement>());
37 assert(projector == ProjectorType::e2DimNoTime ||
38 projector == ProjectorType::e1DimWithTime ||
39 projector == ProjectorType::e1DimRotWithTime);
40 } else if constexpr(N == 3) {
41 meas = m_handle3D->push_back(std::make_unique<xAOD::AuxiliaryMeasurement>());
42 assert(projector == ProjectorType::e2DimWithTime);
43 }
44 meas->setMeasurement<N>(0, xAOD::toStorage(locPos), xAOD::toStorage(locCov));
45 meas->setProjector(projector);
46 auto cached_itr = m_cachedSurfs.find(surface);
47 if (cached_itr == m_cachedSurfs.end()) {
48 auto persistSurf = m_surfaceContainer->push_back(std::make_unique<xAOD::TrackSurface>());
49 encodeSurface(persistSurf, surface.get(), m_gctx);
50
51 cached_itr = m_cachedSurfs.insert(std::make_pair(surface, persistSurf)).first;
52 }
53 xAOD::AuxiliaryMeasurement::SurfLink_t link{*m_surfaceContainer, cached_itr->second->index(), m_ctx};
54 meas->setSurface(surface, std::move(link));
55 return meas;
56 }
57}
58
59#endif