ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::TrackParamsEstimationTool Class Reference

#include <TrackParamsEstimationTool.h>

Inheritance diagram for ActsTrk::TrackParamsEstimationTool:
Collaboration diagram for ActsTrk::TrackParamsEstimationTool:

Public Member Functions

 TrackParamsEstimationTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~TrackParamsEstimationTool ()=default
virtual StatusCode initialize () override
virtual std::optional< Acts::BoundTrackParameters > estimateTrackParameters (const ActsTrk::Seed &seed, bool useTopSp, const Acts::GeometryContext &geoContext, const Acts::MagneticFieldContext &magFieldContext, std::function< const Acts::Surface &(const ActsTrk::Seed &seed, bool useTopSp)> retrieveSurface) const override
virtual std::optional< Acts::BoundTrackParameters > estimateTrackParameters (const ActsTrk::Seed &seed, bool useTopSp, const Acts::GeometryContext &geoContext, const Acts::MagneticFieldContext &magFieldContext, const Acts::Surface &surface, const Acts::Vector3 &bField) const override
SpacePointIndicesFun_t spacePointIndicesFun () const override

Private Types

using Stepper = Acts::SympyStepper
using Navigator = Acts::VoidNavigator
using Extrapolator = Acts::Propagator<Stepper>

Private Member Functions

const Acts::Logger & logger () const
 Private access to the logger.

Private Attributes

Gaudi::Property< double > m_sigmaLoc0
Gaudi::Property< double > m_sigmaLoc1
Gaudi::Property< double > m_sigmaPhi
Gaudi::Property< double > m_sigmaTheta
Gaudi::Property< double > m_sigmaQOverP
Gaudi::Property< double > m_sigmaT0
Gaudi::Property< double > m_initialSigmaPtRel
Gaudi::Property< std::vector< double > > m_initialVarInflation
Gaudi::Property< int > m_useLongSeeds
Gaudi::Property< int > m_bFieldMode
Gaudi::Property< std::size_t > m_firstSp
std::optional< Extrapolatorm_extrapolator
std::unique_ptr< const Acts::Logger > m_logger
 logging instance
SpacePointIndicesFun_t m_spacePointIndicesFun {}

Detailed Description

Definition at line 19 of file TrackParamsEstimationTool.h.

Member Typedef Documentation

◆ Extrapolator

using ActsTrk::TrackParamsEstimationTool::Extrapolator = Acts::Propagator<Stepper>
private

Definition at line 79 of file TrackParamsEstimationTool.h.

◆ Navigator

using ActsTrk::TrackParamsEstimationTool::Navigator = Acts::VoidNavigator
private

Definition at line 78 of file TrackParamsEstimationTool.h.

◆ Stepper

using ActsTrk::TrackParamsEstimationTool::Stepper = Acts::SympyStepper
private

Definition at line 77 of file TrackParamsEstimationTool.h.

Constructor & Destructor Documentation

◆ TrackParamsEstimationTool()

ActsTrk::TrackParamsEstimationTool::TrackParamsEstimationTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 15 of file TrackParamsEstimationTool.cxx.

18 : base_class(type, name, parent)
19 {}

◆ ~TrackParamsEstimationTool()

virtual ActsTrk::TrackParamsEstimationTool::~TrackParamsEstimationTool ( )
virtualdefault

Member Function Documentation

◆ estimateTrackParameters() [1/2]

std::optional< Acts::BoundTrackParameters > ActsTrk::TrackParamsEstimationTool::estimateTrackParameters ( const ActsTrk::Seed & seed,
bool useTopSp,
const Acts::GeometryContext & geoContext,
const Acts::MagneticFieldContext & magFieldContext,
const Acts::Surface & surface,
const Acts::Vector3 & bField ) const
overridevirtual

Definition at line 80 of file TrackParamsEstimationTool.cxx.

87 {
88 // Get SPs
89 const auto& sp_collection = seed.sp();
90 const std::size_t nSp = sp_collection.size();
91 if (nSp < 3) return std::nullopt;
92
93 // Function to extract the values from sp_collection
94 auto sp_collection_extract = std::views::transform([&sp_collection, useTopSp](std::size_t i) {
95 return sp_collection.at(useTopSp ? sp_collection.size() - i - 1 : i);
96 });
97
98 // Compute free parameters
99 Acts::FreeVector freeParams = Acts::estimateTrackParamsFromSeed(m_spacePointIndicesFun(nSp) | sp_collection_extract, bField);
100
101 if (m_useLongSeeds == 1 && nSp > 3ul) {
102 auto spacePointIndicesFun2 = [](std::size_t nSp) -> std::array<std::size_t, 3> {
103 return {0, nSp / 2ul, nSp - 1};
104 };
105 Acts::FreeVector freeParams2 = Acts::estimateTrackParamsFromSeed(spacePointIndicesFun2(nSp) | sp_collection_extract, bField);
106 ATH_MSG_DEBUG("update seed p = " << 1.0 / freeParams[Acts::eFreeQOverP] << " to " << 1.0 / freeParams2[Acts::eFreeQOverP]);
107 freeParams[Acts::eFreeQOverP] = freeParams2[Acts::eFreeQOverP];
108 }
109
110 if (useTopSp) {
111 // reverse direction so momentum vector pointing outwards
112 freeParams = Acts::reflectFreeParameters(freeParams);
113 }
114
115 // Convert free params to curvilinear params for extrapolation
116 Acts::BoundTrackParameters curvilinearParams = Acts::BoundTrackParameters::createCurvilinear(
117 freeParams.segment<4>(Acts::eFreePos0),
118 freeParams.segment<3>(Acts::eFreeDir0),
119 freeParams[Acts::eFreeQOverP],
120 std::nullopt,
121 Acts::ParticleHypothesis::pion());
122
123 // Extrapolate to surface
124 Acts::PropagatorPlainOptions propOptions(geoContext, magFieldContext);
125 propOptions.direction = Acts::Direction::fromScalarZeroAsPositive(
126 surface.intersect(
127 geoContext,
128 freeParams.segment<3>(Acts::eFreePos0),
129 freeParams.segment<3>(Acts::eFreeDir0)
130 ).closest().pathLength());
131 auto boundParamsResult = m_extrapolator->propagateToSurface(curvilinearParams, surface, propOptions);
132 if (!boundParamsResult.ok()) {
133 ATH_MSG_DEBUG("Extrapolation failed");
134 return std::nullopt;
135 }
136
137 // Get extrapolated parameters
138 Acts::BoundTrackParameters boundParams = *boundParamsResult;
139
140 // Estimate covariance
141 Acts::EstimateTrackParamCovarianceConfig covarianceEstimationConfig = {
143 .initialSigmaPtRel = m_initialSigmaPtRel,
144 .initialVarInflation = Eigen::Map<const Acts::BoundVector>(m_initialVarInflation.value().data()),
145 .noTimeVarInflation = 1.0,
146 };
147 boundParams.covariance() = Acts::estimateTrackParamCovariance(
148 covarianceEstimationConfig,
149 boundParams.parameters(),
150 false);
151
152 return boundParams;
153 }
#define ATH_MSG_DEBUG(x)
Gaudi::Property< std::vector< double > > m_initialVarInflation
std::optional< Extrapolator > m_extrapolator

◆ estimateTrackParameters() [2/2]

std::optional< Acts::BoundTrackParameters > ActsTrk::TrackParamsEstimationTool::estimateTrackParameters ( const ActsTrk::Seed & seed,
bool useTopSp,
const Acts::GeometryContext & geoContext,
const Acts::MagneticFieldContext & magFieldContext,
std::function< const Acts::Surface &(const ActsTrk::Seed &seed, bool useTopSp)> retrieveSurface ) const
overridevirtual

Definition at line 46 of file TrackParamsEstimationTool.cxx.

52 {
53 const auto& sp_collection = seed.sp();
54 if ( sp_collection.size() < 3 ) return std::nullopt;
55 const xAOD::SpacePoint* bottom_sp = (useTopSp && m_bFieldMode != 2) ? sp_collection.back() : sp_collection.front();
56
57 // Magnetic Field
58 ATLASMagneticFieldWrapper magneticField;
59 Acts::MagneticFieldProvider::Cache magFieldCache = magneticField.makeCache( magFieldContext );
60 Acts::Vector3 bField = *magneticField.getField( Acts::Vector3(bottom_sp->x(), bottom_sp->y(), bottom_sp->z()),
61 magFieldCache );
62 if (m_bFieldMode == 1) {
63 bField[0] = 0.0;
64 bField[1] = 0.0;
65 }
66
67 // Get the surface
68 const Acts::Surface& surface = retrieveSurface(seed, useTopSp);
69
71 seed,
72 useTopSp,
73 geoContext,
74 magFieldContext,
75 surface,
76 bField);
77 }
Acts::Result< Acts::Vector3 > getField(const Acts::Vector3 &position, Acts::MagneticFieldProvider::Cache &gcache) const override
MagneticFieldProvider::Cache makeCache(const Acts::MagneticFieldContext &mctx) const override
virtual std::optional< Acts::BoundTrackParameters > estimateTrackParameters(const ActsTrk::Seed &seed, bool useTopSp, const Acts::GeometryContext &geoContext, const Acts::MagneticFieldContext &magFieldContext, std::function< const Acts::Surface &(const ActsTrk::Seed &seed, bool useTopSp)> retrieveSurface) const override
float z() const
float y() const
float x() const

◆ initialize()

StatusCode ActsTrk::TrackParamsEstimationTool::initialize ( )
overridevirtual

Definition at line 21 of file TrackParamsEstimationTool.cxx.

22 {
23 ATH_MSG_INFO( "Initializing " << name() << "..." );
24
25 ATH_MSG_DEBUG( "Properties Summary:" );
26 ATH_MSG_DEBUG( " " << m_sigmaLoc0 );
27 ATH_MSG_DEBUG( " " << m_sigmaLoc1 );
28 ATH_MSG_DEBUG( " " << m_sigmaPhi );
31 ATH_MSG_DEBUG( " " << m_sigmaT0 );
34 ATH_MSG_DEBUG( " " << m_firstSp );
35
36 m_logger = makeActsAthenaLogger(this, "Acts");
37
38 m_extrapolator = Extrapolator(Stepper(std::make_shared<ATLASMagneticFieldWrapper>()), Navigator(), logger().cloneWithSuffix("Prop"));
39
41
42 return StatusCode::SUCCESS;
43 }
#define ATH_MSG_INFO(x)
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
const Acts::Logger & logger() const
Private access to the logger.
std::unique_ptr< const Acts::Logger > m_logger
logging instance
SpacePointIndicesFun_t spacePointIndicesFun() const override
Gaudi::Property< std::size_t > m_firstSp

◆ logger()

const Acts::Logger & ActsTrk::TrackParamsEstimationTool::logger ( ) const
inlineprivate

Private access to the logger.

Definition at line 84 of file TrackParamsEstimationTool.h.

85 {
86 return *m_logger;
87 }

◆ spacePointIndicesFun()

ITrackParamsEstimationTool::SpacePointIndicesFun_t ActsTrk::TrackParamsEstimationTool::spacePointIndicesFun ( ) const
override

Definition at line 156 of file TrackParamsEstimationTool.cxx.

156 {
157 if (m_useLongSeeds == 2) {
158 return [](std::size_t nSp) -> std::array<std::size_t, 3> {
159 if (nSp > 3ul)
160 return {0, nSp / 2ul, nSp - 1};
161 else
162 return {0, 1, 2};
163 };
164 } else if (m_firstSp > 0ul) {
165 std::size_t firstSp = m_firstSp;
166 return [firstSp](std::size_t nSp) -> std::array<std::size_t, 3> {
167 if (nSp > 3ul) {
168 std::size_t first = std::min(firstSp, nSp - 3ul);
169 return {first, first + 1, first + 2};
170 } else
171 return {0, 1, 2};
172 };
173 } else {
174 return [](std::size_t) -> std::array<std::size_t, 3> {
175 return {0, 1, 2};
176 };
177 }
178 };
bool first
Definition DeMoScan.py:534

Member Data Documentation

◆ m_bFieldMode

Gaudi::Property<int> ActsTrk::TrackParamsEstimationTool::m_bFieldMode
private
Initial value:
{this, "bFieldMode", 0,
"B-field mode: 0=B-field at first SP in search order; 1=z-component of B-field; 2=B-field at innermost SP, regardless of search direction"}

Definition at line 72 of file TrackParamsEstimationTool.h.

72 {this, "bFieldMode", 0,
73 "B-field mode: 0=B-field at first SP in search order; 1=z-component of B-field; 2=B-field at innermost SP, regardless of search direction"};

◆ m_extrapolator

std::optional<Extrapolator> ActsTrk::TrackParamsEstimationTool::m_extrapolator
private

Definition at line 81 of file TrackParamsEstimationTool.h.

◆ m_firstSp

Gaudi::Property<std::size_t> ActsTrk::TrackParamsEstimationTool::m_firstSp
private
Initial value:
{this, "firstSp", 0ul,
"Index of first SP to use"}

Definition at line 74 of file TrackParamsEstimationTool.h.

74 {this, "firstSp", 0ul,
75 "Index of first SP to use"};
unsigned long ul

◆ m_initialSigmaPtRel

Gaudi::Property< double > ActsTrk::TrackParamsEstimationTool::m_initialSigmaPtRel
private
Initial value:
{this, "initialSigmaPtRel", 0.1,
"Initial relative pT resolution"}

Definition at line 66 of file TrackParamsEstimationTool.h.

66 {this, "initialSigmaPtRel", 0.1,
67 "Initial relative pT resolution"};

◆ m_initialVarInflation

Gaudi::Property< std::vector<double> > ActsTrk::TrackParamsEstimationTool::m_initialVarInflation
private
Initial value:
{this, "initialVarInflation", {1., 1., 1., 1., 1., 1.},
"Inflate tracks"}

Definition at line 68 of file TrackParamsEstimationTool.h.

68 {this, "initialVarInflation", {1., 1., 1., 1., 1., 1.},
69 "Inflate tracks"};

◆ m_logger

std::unique_ptr<const Acts::Logger> ActsTrk::TrackParamsEstimationTool::m_logger
private

logging instance

Definition at line 90 of file TrackParamsEstimationTool.h.

◆ m_sigmaLoc0

Gaudi::Property< double > ActsTrk::TrackParamsEstimationTool::m_sigmaLoc0
private
Initial value:
{this, "sigmaLoc0", 1 * Acts::UnitConstants::mm,
"Constant term of the loc0 resolution"}

Definition at line 54 of file TrackParamsEstimationTool.h.

54 {this, "sigmaLoc0", 1 * Acts::UnitConstants::mm,
55 "Constant term of the loc0 resolution"};

◆ m_sigmaLoc1

Gaudi::Property< double > ActsTrk::TrackParamsEstimationTool::m_sigmaLoc1
private
Initial value:
{this, "sigmaLoc1", 1 * Acts::UnitConstants::mm,
"Constant term of the loc1 resolution"}

Definition at line 56 of file TrackParamsEstimationTool.h.

56 {this, "sigmaLoc1", 1 * Acts::UnitConstants::mm,
57 "Constant term of the loc1 resolution"};

◆ m_sigmaPhi

Gaudi::Property< double > ActsTrk::TrackParamsEstimationTool::m_sigmaPhi
private
Initial value:
{this, "sigmaPhi", 0.1 * Acts::UnitConstants::degree,
"Phi angular resolution"}

Definition at line 58 of file TrackParamsEstimationTool.h.

58 {this, "sigmaPhi", 0.1 * Acts::UnitConstants::degree,
59 "Phi angular resolution"};

◆ m_sigmaQOverP

Gaudi::Property< double > ActsTrk::TrackParamsEstimationTool::m_sigmaQOverP
private
Initial value:
{this, "sigmaQOverP", 0.1 * Acts::UnitConstants::e / Acts::UnitConstants::GeV,
"q/p resolution"}

Definition at line 62 of file TrackParamsEstimationTool.h.

62 {this, "sigmaQOverP", 0.1 * Acts::UnitConstants::e / Acts::UnitConstants::GeV,
63 "q/p resolution"};

◆ m_sigmaT0

Gaudi::Property< double > ActsTrk::TrackParamsEstimationTool::m_sigmaT0
private
Initial value:
{this, "sigmaT0", 1 * Acts::UnitConstants::ns,
"Time resolution"}

Definition at line 64 of file TrackParamsEstimationTool.h.

64 {this, "sigmaT0", 1 * Acts::UnitConstants::ns,
65 "Time resolution"};

◆ m_sigmaTheta

Gaudi::Property< double > ActsTrk::TrackParamsEstimationTool::m_sigmaTheta
private
Initial value:
{this, "sigmaTheta", 0.1 * Acts::UnitConstants::degree,
"Theta angular resolution"}

Definition at line 60 of file TrackParamsEstimationTool.h.

60 {this, "sigmaTheta", 0.1 * Acts::UnitConstants::degree,
61 "Theta angular resolution"};

◆ m_spacePointIndicesFun

SpacePointIndicesFun_t ActsTrk::TrackParamsEstimationTool::m_spacePointIndicesFun {}
private

Definition at line 92 of file TrackParamsEstimationTool.h.

92{};

◆ m_useLongSeeds

Gaudi::Property< int > ActsTrk::TrackParamsEstimationTool::m_useLongSeeds
private
Initial value:
{this, "useLongSeeds", 2,
"0=use 1st 3 SPs, 1=use first,middle,last SPs to improve pT measurement, 2=use for all parameters"}

Definition at line 70 of file TrackParamsEstimationTool.h.

70 {this, "useLongSeeds", 2,
71 "0=use 1st 3 SPs, 1=use first,middle,last SPs to improve pT measurement, 2=use for all parameters"};

The documentation for this class was generated from the following files: