ATLAS Offline Software
Loading...
Searching...
No Matches
SeedsToTrackParamsAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
9
10namespace ActsTrk {
11
13 ISvcLocator* pSvcLocator)
14 : AthReentrantAlgorithm(name, pSvcLocator)
15 {}
16
18 ATH_MSG_INFO("Initializing " << name() << " ...");
19
24
25 ATH_CHECK(m_detEleCollKey.initialize());
28
29 return AthReentrantAlgorithm::initialize();
30 }
31
32 StatusCode SeedsToTrackParamsAlg::execute(const EventContext& ctx) const {
33 ATH_MSG_DEBUG("Executing " << name() << " ... ");
34
35 Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
36 Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
37
40
41 ATH_CHECK(seedContainerHandle.isValid());
42 ATH_CHECK(detEleHandle.isValid());
43
45 ATH_MSG_DEBUG(" \\__ Track Params Estimated `" << m_outputTrackParamsCollectionKey.key() << "` created ...");
46 ATH_CHECK(boundTrackParamsHandle.record(std::make_unique<ActsTrk::BoundTrackParametersContainer>()));
47 ActsTrk::BoundTrackParametersContainer *trackParams = boundTrackParamsHandle.ptr();
48
49 const ActsTrk::SeedContainer &seeds = *seedContainerHandle;
50 const InDetDD::SiDetectorElementCollection &detElements = *detEleHandle.cptr();
51
52 for (std::size_t iseed = 0; iseed < seeds.size(); ++iseed) {
53 ActsTrk::Seed seed = seeds[iseed];
54
55 const bool useTopSp = m_autoReverseSearch && shouldReverseSearch(seed);
56
57 auto retrieveSurfaceFunction =
58 [this, &detElements] (const ActsTrk::Seed& seed, bool useTopSp) -> const Acts::Surface& {
59 const xAOD::SpacePoint* sp = useTopSp ? seed.sp().back() : seed.sp().front();
60 const InDetDD::SiDetectorElement* element = detElements.getDetectorElement(
61 useTopSp ? sp->elementIdList().back() : sp->elementIdList().front());
62 const Trk::Surface& atlas_surface = element->surface();
63 return this->m_ATLASConverterTool->trkSurfaceToActsSurface(atlas_surface);
64 };
65
66 std::optional<Acts::BoundTrackParameters> optTrackParams =
67 m_paramEstimationTool->estimateTrackParameters(
68 seed,
69 useTopSp,
70 tgContext,
71 mfContext,
72 retrieveSurfaceFunction);
73
74 if (!optTrackParams.has_value()) {
75 ATH_MSG_DEBUG("Failed to estimate track parameters for seed " << iseed);
76 trackParams->push_back(std::unique_ptr<Acts::BoundTrackParameters>());
77 continue;
78 }
79
80 trackParams->push_back(std::make_unique<Acts::BoundTrackParameters>(std::move(*optTrackParams)));
81 }
82
83 return StatusCode::SUCCESS;
84 }
85
87 const auto& bottom_sp = seed.sp().front();
88
89 const double r = bottom_sp->radius();
90 const double z = std::abs(bottom_sp->z());
91
92 const double rBoundary = m_useTopSpRZboundary.value()[0];
93 const double zBoundary = m_useTopSpRZboundary.value()[1];
94
95 return r > rBoundary || z > zBoundary;
96 }
97
98
99}
#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
ToolHandle< ActsTrk::IActsToTrkConverterTool > m_ATLASConverterTool
SeedsToTrackParamsAlg(const std::string &name, ISvcLocator *pSvcLocator)
PublicToolHandle< ActsTrk::ITrackingGeometryTool > m_trackingGeometryTool
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
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool
SG::WriteHandleKey< ActsTrk::BoundTrackParametersContainer > m_outputTrackParamsCollectionKey
An algorithm that can be simultaneously executed in multiple threads.
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.
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())