ATLAS Offline Software
Loading...
Searching...
No Matches
SeedsToTrackParamsAlg.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
9
10namespace ActsTrk {
11
13 ATH_MSG_INFO("Initializing " << name() << " ...");
14
15 ATH_CHECK(m_ctxProvider.initialize());
16 ATH_CHECK(m_geometryConvTool.retrieve());
18
19 ATH_CHECK(m_detEleCollKey.initialize());
22
23 return StatusCode::SUCCESS;
24 }
25
26 StatusCode SeedsToTrackParamsAlg::execute(const EventContext& ctx) const {
27 ATH_MSG_DEBUG("Executing " << name() << " ... ");
28
29 const Acts::GeometryContext tgContext = m_ctxProvider.getGeometryContext(ctx);
30 const Acts::MagneticFieldContext mfContext = m_ctxProvider.getMagneticFieldContext(ctx);
31 const Acts::CalibrationContext calContext = m_ctxProvider.getCalibrationContext(ctx);
32
35
36 ATH_CHECK(seedContainerHandle.isValid());
37 ATH_CHECK(detEleHandle.isValid());
38
40 ATH_MSG_DEBUG(" \\__ Track Params Estimated `" << m_outputTrackParamsCollectionKey.key() << "` created ...");
41 ATH_CHECK(boundTrackParamsHandle.record(std::make_unique<ActsTrk::BoundTrackParametersContainer>()));
42 ActsTrk::BoundTrackParametersContainer *trackParams = boundTrackParamsHandle.ptr();
43
44 const ActsTrk::SeedContainer &seeds = *seedContainerHandle;
45 const InDetDD::SiDetectorElementCollection &detElements = *detEleHandle.cptr();
46
47 for (std::size_t iseed = 0; iseed < seeds.size(); ++iseed) {
48 ActsTrk::Seed seed = seeds[iseed];
49
50 const bool useTopSp = m_autoReverseSearch && shouldReverseSearch(seed);
51
52 auto retrieveSurfaceFunction =
53 [this, &detElements] (const ActsTrk::Seed& seed, bool useTopSp) -> const Acts::Surface& {
54 const xAOD::SpacePoint* sp = useTopSp ? seed.sp().back() : seed.sp().front();
55 const InDetDD::SiDetectorElement* element = detElements.getDetectorElement(
56 useTopSp ? sp->elementIdList().back() : sp->elementIdList().front());
57 const Trk::Surface& atlas_surface = element->surface();
58 return *m_geometryConvTool->convertSurfaceToActs(atlas_surface);
59 };
60
61 const auto& [optTrackParams, estimationStatus] =
62 m_paramEstimationTool->estimateTrackParameters(
63 seed,
64 useTopSp,
65 tgContext,
66 mfContext,
67 calContext,
68 retrieveSurfaceFunction);
69
70 if (!optTrackParams.has_value()) {
71 ATH_MSG_DEBUG("Failed to estimate track parameters for seed " << iseed);
72 trackParams->push_back(std::unique_ptr<Acts::BoundTrackParameters>());
73 continue;
74 }
75
76 trackParams->push_back(std::make_unique<Acts::BoundTrackParameters>(std::move(*optTrackParams)));
77 }
78
79 return StatusCode::SUCCESS;
80 }
81
83 const xAOD::SpacePoint* bottom_sp = seed.sp().front();
84
85 const double r = bottom_sp->radius();
86 const double z = std::abs(bottom_sp->z());
87
88 const double rBoundary = m_useTopSpRZboundary.value()[0];
89 const double zBoundary = m_useTopSpRZboundary.value()[1];
90
91 return r > rBoundary || z > zBoundary;
92 }
93
94}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_INFO(x,...)
static Double_t sp
#define z
bool shouldReverseSearch(const ActsTrk::Seed &seed) const
ContextUtility m_ctxProvider
Auxiliary class to access the magnetic field, geometry and calibration context.
ToolHandle< ActsTrk::ITrackParamsEstimationTool > m_paramEstimationTool
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_detEleCollKey
virtual StatusCode execute(const EventContext &ctx) const override
SG::ReadHandleKey< ActsTrk::SeedContainer > m_inputSeedContainerKey
Gaudi::Property< std::vector< double > > m_useTopSpRZboundary
virtual StatusCode initialize() override
Gaudi::Property< bool > m_autoReverseSearch
PublicToolHandle< IGeometryRealmConvTool > m_geometryConvTool
SG::WriteHandleKey< ActsTrk::BoundTrackParametersContainer > m_outputTrackParamsCollectionKey
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Class to hold the SiDetectorElement objects to be put in the detector store.
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
Class to hold geometrical description of a silicon detector element.
Trk::Surface & surface()
Element Surface.
const_pointer_type cptr()
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
Abstract Base Class for tracking surfaces.
Definition Surface.h:79
float z() const
float radius() const
int r
Definition globals.cxx:22
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
DataVector< Acts::BoundTrackParameters > BoundTrackParametersContainer
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
std::size_t size() const noexcept