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
Gaudi::Property< bool > m_allowPropagatorFailure
Gaudi::Property< std::size_t > m_stripCalibrationIterations
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 83 of file TrackParamsEstimationTool.h.

◆ Navigator

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

Definition at line 82 of file TrackParamsEstimationTool.h.

◆ Stepper

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

Definition at line 81 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 86 of file TrackParamsEstimationTool.cxx.

89 : base_class(type, name, parent)
90 {}

◆ ~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 152 of file TrackParamsEstimationTool.cxx.

159 {
160 // Get SPs
161 const auto& sp_collection = seed.sp();
162 const std::size_t nSp = sp_collection.size();
163 if (nSp < 3) return std::nullopt;
164
165 // Function to extract the values from sp_collection
166 const auto sp_collection_extract = std::views::transform([&sp_collection, useTopSp](std::size_t i) {
167 return sp_collection.at(useTopSp ? sp_collection.size() - i - 1 : i);
168 });
169
170 // Compute free parameters
171 Acts::FreeVector freeParams = estimateTrackParamsFromSeed(m_spacePointIndicesFun(nSp) | sp_collection_extract, bField, m_stripCalibrationIterations);
172
173 if (m_useLongSeeds == 1 && nSp > 3ul) {
174 const auto spacePointIndicesFun2 = [](std::size_t nSp) -> std::array<std::size_t, 3> {
175 return {0, nSp / 2ul, nSp - 1};
176 };
177 const Acts::FreeVector freeParams2 = estimateTrackParamsFromSeed(spacePointIndicesFun2(nSp) | sp_collection_extract, bField, m_stripCalibrationIterations);
178 ATH_MSG_DEBUG("update seed p = " << 1.0 / freeParams[Acts::eFreeQOverP] << " to " << 1.0 / freeParams2[Acts::eFreeQOverP]);
179 freeParams[Acts::eFreeQOverP] = freeParams2[Acts::eFreeQOverP];
180 }
181
182 if (useTopSp) {
183 // reverse direction so momentum vector pointing outwards
184 freeParams = Acts::reflectFreeParameters(freeParams);
185 }
186
187 // Convert free params to curvilinear params for extrapolation
188 Acts::BoundTrackParameters curvilinearParams = Acts::BoundTrackParameters::createCurvilinear(
189 freeParams.segment<4>(Acts::eFreePos0),
190 freeParams.segment<3>(Acts::eFreeDir0),
191 freeParams[Acts::eFreeQOverP],
192 std::nullopt,
193 Acts::ParticleHypothesis::pion());
194
195 // Extrapolate to surface
196 Acts::PropagatorPlainOptions propOptions(geoContext, magFieldContext);
197 propOptions.direction = Acts::Direction::fromScalarZeroAsPositive(
198 surface.intersect(
199 geoContext,
200 freeParams.segment<3>(Acts::eFreePos0),
201 freeParams.segment<3>(Acts::eFreeDir0)
202 ).closest().pathLength());
203
204 std::optional<Acts::BoundTrackParameters> boundParams;
205 auto boundParamsResult =
206 m_extrapolator->propagateToSurface(curvilinearParams, surface, propOptions);
207
208 if (!boundParamsResult.ok()) {
209 ATH_MSG_DEBUG("Extrapolation failed");
211 // Fallback: use curvilinear parameters instead of failing
212 ATH_MSG_DEBUG("Using curvilinear parameters due to propagation failure");
213 boundParams = curvilinearParams;
214 } else {
215 return std::nullopt;
216 }
217 } else {
218 boundParams = *boundParamsResult;
219 }
220
221
222 // Estimate covariance
223 Acts::EstimateTrackParamCovarianceConfig covarianceEstimationConfig = {
225 .initialSigmaPtRel = m_initialSigmaPtRel,
226 .initialVarInflation = Eigen::Map<const Acts::BoundVector>(m_initialVarInflation.value().data()),
227 .noTimeVarInflation = 1.0,
228 };
229 boundParams->covariance() = Acts::estimateTrackParamCovariance(
230 covarianceEstimationConfig,
231 boundParams->parameters(),
232 false);
233
234 return boundParams;
235 }
#define ATH_MSG_DEBUG(x)
Gaudi::Property< std::vector< double > > m_initialVarInflation
std::optional< Extrapolator > m_extrapolator
Gaudi::Property< std::size_t > m_stripCalibrationIterations

◆ 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 118 of file TrackParamsEstimationTool.cxx.

124 {
125 const auto& sp_collection = seed.sp();
126 if ( sp_collection.size() < 3 ) return std::nullopt;
127 const xAOD::SpacePoint* bottom_sp = (useTopSp && m_bFieldMode != 2) ? sp_collection.back() : sp_collection.front();
128
129 // Magnetic Field
130 ATLASMagneticFieldWrapper magneticField;
131 Acts::MagneticFieldProvider::Cache magFieldCache = magneticField.makeCache( magFieldContext );
132 Acts::Vector3 bField = *magneticField.getField( Acts::Vector3(bottom_sp->x(), bottom_sp->y(), bottom_sp->z()),
133 magFieldCache );
134 if (m_bFieldMode == 1) {
135 bField[0] = 0.0;
136 bField[1] = 0.0;
137 }
138
139 // Get the surface
140 const Acts::Surface& surface = retrieveSurface(seed, useTopSp);
141
143 seed,
144 useTopSp,
145 geoContext,
146 magFieldContext,
147 surface,
148 bField);
149 }
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 92 of file TrackParamsEstimationTool.cxx.

93 {
94 ATH_MSG_INFO( "Initializing " << name() << "..." );
95
96 ATH_MSG_DEBUG( "Properties Summary:" );
97 ATH_MSG_DEBUG( " " << m_sigmaLoc0 );
98 ATH_MSG_DEBUG( " " << m_sigmaLoc1 );
99 ATH_MSG_DEBUG( " " << m_sigmaPhi );
100 ATH_MSG_DEBUG( " " << m_sigmaTheta );
102 ATH_MSG_DEBUG( " " << m_sigmaT0 );
104 ATH_MSG_DEBUG( " " << m_bFieldMode );
105 ATH_MSG_DEBUG( " " << m_firstSp );
107
108 m_logger = makeActsAthenaLogger(this, "Acts");
109
110 m_extrapolator = Extrapolator(Stepper(std::make_shared<ATLASMagneticFieldWrapper>()), Navigator(), logger().cloneWithSuffix("Prop"));
111
113
114 return StatusCode::SUCCESS;
115 }
#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 88 of file TrackParamsEstimationTool.h.

89 {
90 return *m_logger;
91 }

◆ spacePointIndicesFun()

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

Definition at line 238 of file TrackParamsEstimationTool.cxx.

238 {
239 if (m_useLongSeeds == 2) {
240 return [](std::size_t nSp) -> std::array<std::size_t, 3> {
241 if (nSp > 3ul)
242 return {0, nSp / 2ul, nSp - 1};
243 else
244 return {0, 1, 2};
245 };
246 } else if (m_firstSp > 0ul) {
247 std::size_t firstSp = m_firstSp;
248 return [firstSp](std::size_t nSp) -> std::array<std::size_t, 3> {
249 if (nSp > 3ul) {
250 std::size_t first = std::min(firstSp, nSp - 3ul);
251 return {first, first + 1, first + 2};
252 } else
253 return {0, 1, 2};
254 };
255 } else {
256 return [](std::size_t) -> std::array<std::size_t, 3> {
257 return {0, 1, 2};
258 };
259 }
260 };
bool first
Definition DeMoScan.py:534

Member Data Documentation

◆ m_allowPropagatorFailure

Gaudi::Property<bool> ActsTrk::TrackParamsEstimationTool::m_allowPropagatorFailure
private
Initial value:
{this, "allowPropagatorFailure", false,
"Use curvilinear parameters when propagation fails instead of returning null"}

Definition at line 76 of file TrackParamsEstimationTool.h.

76 {this, "allowPropagatorFailure", false,
77 "Use curvilinear parameters when propagation fails instead of returning null"};

◆ 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 85 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 94 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 96 of file TrackParamsEstimationTool.h.

96{};

◆ m_stripCalibrationIterations

Gaudi::Property<std::size_t> ActsTrk::TrackParamsEstimationTool::m_stripCalibrationIterations
private
Initial value:
{this, "stripCalibrationIterations", 1ul,
"Number of strip calibration iterations"}

Definition at line 78 of file TrackParamsEstimationTool.h.

78 {this, "stripCalibrationIterations", 1ul,
79 "Number of strip calibration iterations"};

◆ 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: