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
34
35 ATH_CHECK(seedContainerHandle.isValid());
36 ATH_CHECK(detEleHandle.isValid());
37
39 ATH_MSG_DEBUG(" \\__ Track Params Estimated `" << m_outputTrackParamsCollectionKey.key() << "` created ...");
40 ATH_CHECK(boundTrackParamsHandle.record(std::make_unique<ActsTrk::BoundTrackParametersContainer>()));
41 ActsTrk::BoundTrackParametersContainer *trackParams = boundTrackParamsHandle.ptr();
42
43 const ActsTrk::SeedContainer &seeds = *seedContainerHandle;
44 const InDetDD::SiDetectorElementCollection &detElements = *detEleHandle.cptr();
45
46 for (std::size_t iseed = 0; iseed < seeds.size(); ++iseed) {
47 ActsTrk::Seed seed = seeds[iseed];
48
49 const bool useTopSp = m_autoReverseSearch && shouldReverseSearch(seed);
50
51 auto retrieveSurfaceFunction =
52 [this, &detElements] (const ActsTrk::Seed& seed, bool useTopSp) -> const Acts::Surface& {
53 const xAOD::SpacePoint* sp = useTopSp ? seed.sp().back() : seed.sp().front();
54 const InDetDD::SiDetectorElement* element = detElements.getDetectorElement(
55 useTopSp ? sp->elementIdList().back() : sp->elementIdList().front());
56 const Trk::Surface& atlas_surface = element->surface();
57 return *m_geometryConvTool->convertSurfaceToActs(atlas_surface);
58 };
59
60 std::optional<Acts::BoundTrackParameters> optTrackParams =
61 m_paramEstimationTool->estimateTrackParameters(
62 seed,
63 useTopSp,
64 tgContext,
65 mfContext,
66 retrieveSurfaceFunction);
67
68 if (!optTrackParams.has_value()) {
69 ATH_MSG_DEBUG("Failed to estimate track parameters for seed " << iseed);
70 trackParams->push_back(std::unique_ptr<Acts::BoundTrackParameters>());
71 continue;
72 }
73
74 trackParams->push_back(std::make_unique<Acts::BoundTrackParameters>(std::move(*optTrackParams)));
75 }
76
77 return StatusCode::SUCCESS;
78 }
79
81 const xAOD::SpacePoint* bottom_sp = seed.sp().front();
82
83 const double r = bottom_sp->radius();
84 const double z = std::abs(bottom_sp->z());
85
86 const double rBoundary = m_useTopSpRZboundary.value()[0];
87 const double zBoundary = m_useTopSpRZboundary.value()[1];
88
89 return r > rBoundary || z > zBoundary;
90 }
91
92
93}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(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