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 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,
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  }

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

◆ 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 );
29  ATH_MSG_DEBUG( " " << m_sigmaTheta );
30  ATH_MSG_DEBUG( " " << m_sigmaQOverP );
31  ATH_MSG_DEBUG( " " << m_sigmaT0 );
33  ATH_MSG_DEBUG( " " << m_bFieldMode );
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  }

◆ 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  };

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:17
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
xAOD::SpacePoint_v1
Definition: SpacePoint_v1.h:29
xAOD::SpacePoint_v1::z
float z() const
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:46
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:156
ActsTrk::TrackParamsEstimationTool::Stepper
Acts::SympyStepper Stepper
Definition: TrackParamsEstimationTool.h:77
detail::ul
unsigned long ul
Definition: PrimitiveHelpers.h:47
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
xAOD::SpacePoint_v1::y
float y() const
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
xAOD::SpacePoint_v1::x
float x() const
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