ATLAS Offline Software
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
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. More...
 

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 More...
 
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 14 of file TrackParamsEstimationTool.cxx.

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

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

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

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

51  {
52  const auto& sp_collection = seed.sp();
53  if ( sp_collection.size() < 3 ) return std::nullopt;
54  const auto& bottom_sp = (useTopSp && m_bFieldMode != 2) ? sp_collection.back() : sp_collection.front();
55 
56  // Magnetic Field
57  ATLASMagneticFieldWrapper magneticField;
58  Acts::MagneticFieldProvider::Cache magFieldCache = magneticField.makeCache( magFieldContext );
59  Acts::Vector3 bField = *magneticField.getField( Acts::Vector3(bottom_sp->x(), bottom_sp->y(), bottom_sp->z()),
60  magFieldCache );
61  if (m_bFieldMode == 1) {
62  bField[0] = 0.0;
63  bField[1] = 0.0;
64  }
65 
66  // Get the surface
67  const Acts::Surface& surface = retrieveSurface(seed, useTopSp);
68 
70  seed,
71  useTopSp,
72  geoContext,
73  magFieldContext,
74  surface,
75  bField);
76  }

◆ initialize()

StatusCode ActsTrk::TrackParamsEstimationTool::initialize ( )
overridevirtual

Definition at line 20 of file TrackParamsEstimationTool.cxx.

21  {
22  ATH_MSG_INFO( "Initializing " << name() << "..." );
23 
24  ATH_MSG_DEBUG( "Properties Summary:" );
25  ATH_MSG_DEBUG( " " << m_sigmaLoc0 );
26  ATH_MSG_DEBUG( " " << m_sigmaLoc1 );
27  ATH_MSG_DEBUG( " " << m_sigmaPhi );
28  ATH_MSG_DEBUG( " " << m_sigmaTheta );
29  ATH_MSG_DEBUG( " " << m_sigmaQOverP );
30  ATH_MSG_DEBUG( " " << m_sigmaT0 );
32  ATH_MSG_DEBUG( " " << m_bFieldMode );
33  ATH_MSG_DEBUG( " " << m_firstSp );
34 
35  m_logger = makeActsAthenaLogger(this, "Acts");
36 
37  m_extrapolator = Extrapolator(Stepper(std::make_shared<ATLASMagneticFieldWrapper>()), Navigator(), logger().cloneWithSuffix("Prop"));
38 
40 
41  return StatusCode::SUCCESS;
42  }

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

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

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.

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

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

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

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

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

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

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

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

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

◆ m_spacePointIndicesFun

SpacePointIndicesFun_t ActsTrk::TrackParamsEstimationTool::m_spacePointIndicesFun {}
private

Definition at line 92 of file TrackParamsEstimationTool.h.

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


The documentation for this class was generated from the following files:
ActsTrk::TrackParamsEstimationTool::m_sigmaLoc0
Gaudi::Property< double > m_sigmaLoc0
Definition: TrackParamsEstimationTool.h:54
ActsTrk::TrackParamsEstimationTool::m_extrapolator
std::optional< Extrapolator > m_extrapolator
Definition: TrackParamsEstimationTool.h:81
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:18
ActsTrk::TrackParamsEstimationTool::m_firstSp
Gaudi::Property< std::size_t > m_firstSp
Definition: TrackParamsEstimationTool.h:74
ATLASMagneticFieldWrapper
Definition: ATLASMagneticFieldWrapper.h:15
python.SystemOfUnits.mm
float mm
Definition: SystemOfUnits.py:98
ActsTrk::TrackParamsEstimationTool::m_initialSigmaPtRel
Gaudi::Property< double > m_initialSigmaPtRel
Definition: TrackParamsEstimationTool.h:66
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ActsTrk::TrackParamsEstimationTool::m_initialVarInflation
Gaudi::Property< std::vector< double > > m_initialVarInflation
Definition: TrackParamsEstimationTool.h:68
ActsTrk::TrackParamsEstimationTool::Extrapolator
Acts::Propagator< Stepper > Extrapolator
Definition: TrackParamsEstimationTool.h:79
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
ActsTrk::TrackParamsEstimationTool::m_sigmaTheta
Gaudi::Property< double > m_sigmaTheta
Definition: TrackParamsEstimationTool.h:60
ActsTrk::TrackParamsEstimationTool::m_useLongSeeds
Gaudi::Property< int > m_useLongSeeds
Definition: TrackParamsEstimationTool.h:70
xAOD::pion
@ pion
Definition: TrackingPrimitives.h:197
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
ATLASMagneticFieldWrapper::makeCache
MagneticFieldProvider::Cache makeCache(const Acts::MagneticFieldContext &mctx) const override
Definition: ATLASMagneticFieldWrapper.h:34
ActsTrk::TrackParamsEstimationTool::estimateTrackParameters
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
Definition: TrackParamsEstimationTool.cxx:45
ActsTrk::TrackParamsEstimationTool::m_sigmaLoc1
Gaudi::Property< double > m_sigmaLoc1
Definition: TrackParamsEstimationTool.h:56
ActsTrk::TrackParamsEstimationTool::Navigator
Acts::VoidNavigator Navigator
Definition: TrackParamsEstimationTool.h:78
makeActsAthenaLogger
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
Definition: Tracking/Acts/ActsInterop/src/Logger.cxx:64
ActsTrk::TrackParamsEstimationTool::m_sigmaPhi
Gaudi::Property< double > m_sigmaPhi
Definition: TrackParamsEstimationTool.h:58
Generate_dsid_ranseed.seed
seed
Definition: Generate_dsid_ranseed.py:10
ActsTrk::TrackParamsEstimationTool::m_bFieldMode
Gaudi::Property< int > m_bFieldMode
Definition: TrackParamsEstimationTool.h:72
lumiFormat.i
int i
Definition: lumiFormat.py:85
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ActsTrk::TrackParamsEstimationTool::spacePointIndicesFun
SpacePointIndicesFun_t spacePointIndicesFun() const override
Definition: TrackParamsEstimationTool.cxx:155
ActsTrk::TrackParamsEstimationTool::Stepper
Acts::SympyStepper Stepper
Definition: TrackParamsEstimationTool.h:77
detail::ul
unsigned long ul
Definition: PrimitiveHelpers.h:46
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ActsTrk::TrackParamsEstimationTool::m_logger
std::unique_ptr< const Acts::Logger > m_logger
logging instance
Definition: TrackParamsEstimationTool.h:90
ActsTrk::TrackParamsEstimationTool::m_spacePointIndicesFun
SpacePointIndicesFun_t m_spacePointIndicesFun
Definition: TrackParamsEstimationTool.h:92
ATLASMagneticFieldWrapper::getField
Acts::Result< Acts::Vector3 > getField(const Acts::Vector3 &position, Acts::MagneticFieldProvider::Cache &gcache) const override
Definition: ATLASMagneticFieldWrapper.h:39
DeMoScan.first
bool first
Definition: DeMoScan.py:534
ActsTrk::TrackParamsEstimationTool::m_sigmaT0
Gaudi::Property< double > m_sigmaT0
Definition: TrackParamsEstimationTool.h:64
ActsTrk::TrackParamsEstimationTool::logger
const Acts::Logger & logger() const
Private access to the logger.
Definition: TrackParamsEstimationTool.h:84
ActsTrk::TrackParamsEstimationTool::m_sigmaQOverP
Gaudi::Property< double > m_sigmaQOverP
Definition: TrackParamsEstimationTool.h:62
python.SystemOfUnits.degree
tuple degree
Definition: SystemOfUnits.py:121
python.SystemOfUnits.ns
float ns
Definition: SystemOfUnits.py:146