ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsMonitoring
src
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
5
#include "
SeedsToTrackParamsAlg.h
"
6
7
#include "
TrkSurfaces/Surface.h
"
8
#include "
InDetReadoutGeometry/SiDetectorElement.h
"
9
10
namespace
ActsTrk
{
11
12
StatusCode
SeedsToTrackParamsAlg::initialize
() {
13
ATH_MSG_INFO
(
"Initializing "
<< name() <<
" ..."
);
14
15
ATH_CHECK
(
m_ctxProvider
.initialize());
16
ATH_CHECK
(
m_geometryConvTool
.retrieve());
17
ATH_CHECK
(
m_paramEstimationTool
.retrieve());
18
19
ATH_CHECK
(
m_detEleCollKey
.initialize());
20
ATH_CHECK
(
m_inputSeedContainerKey
.initialize());
21
ATH_CHECK
(
m_outputTrackParamsCollectionKey
.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
33
SG::ReadHandle<ActsTrk::SeedContainer>
seedContainerHandle =
SG::makeHandle
(
m_inputSeedContainerKey
, ctx);
34
SG::ReadCondHandle<InDetDD::SiDetectorElementCollection>
detEleHandle =
SG::makeHandle
(
m_detEleCollKey
, ctx);
35
36
ATH_CHECK
(seedContainerHandle.
isValid
());
37
ATH_CHECK
(detEleHandle.
isValid
());
38
39
SG::WriteHandle<ActsTrk::BoundTrackParametersContainer>
boundTrackParamsHandle =
SG::makeHandle
(
m_outputTrackParamsCollectionKey
, ctx);
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
82
bool
SeedsToTrackParamsAlg::shouldReverseSearch
(
const
ActsTrk::Seed
& seed)
const
{
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
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
sp
static Double_t sp
Definition
LArPhysWaveHECTool.cxx:37
SeedsToTrackParamsAlg.h
SiDetectorElement.h
Surface.h
z
#define z
ActsTrk::SeedsToTrackParamsAlg::shouldReverseSearch
bool shouldReverseSearch(const ActsTrk::Seed &seed) const
Definition
SeedsToTrackParamsAlg.cxx:82
ActsTrk::SeedsToTrackParamsAlg::m_ctxProvider
ContextUtility m_ctxProvider
Auxiliary class to access the magnetic field, geometry and calibration context.
Definition
SeedsToTrackParamsAlg.h:46
ActsTrk::SeedsToTrackParamsAlg::m_paramEstimationTool
ToolHandle< ActsTrk::ITrackParamsEstimationTool > m_paramEstimationTool
Definition
SeedsToTrackParamsAlg.h:36
ActsTrk::SeedsToTrackParamsAlg::m_detEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_detEleCollKey
Definition
SeedsToTrackParamsAlg.h:38
ActsTrk::SeedsToTrackParamsAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
SeedsToTrackParamsAlg.cxx:26
ActsTrk::SeedsToTrackParamsAlg::m_inputSeedContainerKey
SG::ReadHandleKey< ActsTrk::SeedContainer > m_inputSeedContainerKey
Definition
SeedsToTrackParamsAlg.h:40
ActsTrk::SeedsToTrackParamsAlg::m_useTopSpRZboundary
Gaudi::Property< std::vector< double > > m_useTopSpRZboundary
Definition
SeedsToTrackParamsAlg.h:44
ActsTrk::SeedsToTrackParamsAlg::initialize
virtual StatusCode initialize() override
Definition
SeedsToTrackParamsAlg.cxx:12
ActsTrk::SeedsToTrackParamsAlg::m_autoReverseSearch
Gaudi::Property< bool > m_autoReverseSearch
Definition
SeedsToTrackParamsAlg.h:43
ActsTrk::SeedsToTrackParamsAlg::m_geometryConvTool
PublicToolHandle< IGeometryRealmConvTool > m_geometryConvTool
Definition
SeedsToTrackParamsAlg.h:35
ActsTrk::SeedsToTrackParamsAlg::m_outputTrackParamsCollectionKey
SG::WriteHandleKey< ActsTrk::BoundTrackParametersContainer > m_outputTrackParamsCollectionKey
Definition
SeedsToTrackParamsAlg.h:41
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
InDetDD::SiDetectorElementCollection
Class to hold the SiDetectorElement objects to be put in the detector store.
Definition
SiDetectorElementCollection.h:27
InDetDD::SiDetectorElementCollection::getDetectorElement
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
Definition
SiDetectorElementCollection.cxx:9
InDetDD::SiDetectorElement
Class to hold geometrical description of a silicon detector element.
Definition
SiDetectorElement.h:109
InDetDD::SolidStateDetectorElementBase::surface
Trk::Surface & surface()
Element Surface.
SG::ReadCondHandle
Definition
ReadCondHandle.h:39
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:204
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition
ReadCondHandle.h:66
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
Trk::Surface
Abstract Base Class for tracking surfaces.
Definition
Surface.h:79
xAOD::SpacePoint_v1::z
float z() const
xAOD::SpacePoint_v1::radius
float radius() const
r
int r
Definition
globals.cxx:22
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition
MdtCalibInput.h:31
ActsTrk::BoundTrackParametersContainer
DataVector< Acts::BoundTrackParameters > BoundTrackParametersContainer
Definition
Tracking/Acts/ActsEvent/ActsEvent/TrackParametersContainer.h:12
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:268
xAOD::SpacePoint
SpacePoint_v1 SpacePoint
Definition
Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/SpacePoint.h:12
ActsTrk::SeedContainer
Definition
SeedContainer.h:67
ActsTrk::SeedContainer::size
std::size_t size() const noexcept
Definition
SeedContainer.h:71
ActsTrk::Seed
Definition
SeedContainer.h:44
Generated on
for ATLAS Offline Software by
1.17.0