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
32
SG::ReadHandle<ActsTrk::SeedContainer>
seedContainerHandle =
SG::makeHandle
(
m_inputSeedContainerKey
, ctx);
33
SG::ReadCondHandle<InDetDD::SiDetectorElementCollection>
detEleHandle =
SG::makeHandle
(
m_detEleCollKey
, ctx);
34
35
ATH_CHECK
(seedContainerHandle.
isValid
());
36
ATH_CHECK
(detEleHandle.
isValid
());
37
38
SG::WriteHandle<ActsTrk::BoundTrackParametersContainer>
boundTrackParamsHandle =
SG::makeHandle
(
m_outputTrackParamsCollectionKey
, ctx);
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
80
bool
SeedsToTrackParamsAlg::shouldReverseSearch
(
const
ActsTrk::Seed
& seed)
const
{
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
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
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:80
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:40
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition
ReadCondHandle.h:67
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:269
xAOD::SpacePoint
SpacePoint_v1 SpacePoint
Definition
Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/SpacePoint.h:12
ActsTrk::SeedContainer
Definition
SeedContainer.h:66
ActsTrk::SeedContainer::size
std::size_t size() const noexcept
Definition
SeedContainer.h:70
ActsTrk::Seed
Definition
SeedContainer.h:43
Generated on
for ATLAS Offline Software by
1.17.0