ATLAS Offline Software
TrackParamsEstimationTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include "Acts/Seeding/EstimateTrackParamsFromSeed.hpp"
8 
9 namespace ActsTrk {
11  const std::string& name,
12  const IInterface* parent)
13  : base_class(type, name, parent)
14  {}
15 
17  {
18  ATH_MSG_INFO( "Initializing " << name() << "..." );
19 
20  ATH_MSG_DEBUG( "Properties Summary:" );
21  ATH_MSG_DEBUG( " " << m_bFieldMin );
22  ATH_MSG_DEBUG( " " << m_sigmaLoc0 );
23  ATH_MSG_DEBUG( " " << m_sigmaLoc1 );
24  ATH_MSG_DEBUG( " " << m_sigmaPhi );
25  ATH_MSG_DEBUG( " " << m_sigmaTheta );
26  ATH_MSG_DEBUG( " " << m_sigmaQOverP );
27  ATH_MSG_DEBUG( " " << m_sigmaT0 );
29 
30  m_covariance(Acts::eBoundLoc0, Acts::eBoundLoc0) =
31  m_initialVarInflation[Acts::eBoundLoc0] * m_sigmaLoc0 * m_sigmaLoc0;
32  m_covariance(Acts::eBoundLoc1, Acts::eBoundLoc1) =
33  m_initialVarInflation[Acts::eBoundLoc1] * m_sigmaLoc1 * m_sigmaLoc1;
34  m_covariance(Acts::eBoundPhi, Acts::eBoundPhi) =
35  m_initialVarInflation[Acts::eBoundPhi] * m_sigmaPhi * m_sigmaPhi;
36  m_covariance(Acts::eBoundTheta, Acts::eBoundTheta) =
37  m_initialVarInflation[Acts::eBoundTheta] * m_sigmaTheta * m_sigmaTheta;
38  m_covariance(Acts::eBoundQOverP, Acts::eBoundQOverP) =
39  m_initialVarInflation[Acts::eBoundQOverP] * m_sigmaQOverP * m_sigmaQOverP;
40  m_covariance(Acts::eBoundTime, Acts::eBoundTime) =
41  m_initialVarInflation[Acts::eBoundTime] * m_sigmaT0 * m_sigmaT0;
42 
43  return StatusCode::SUCCESS;
44  }
45 
46  std::optional<Acts::BoundTrackParameters>
48  const ActsTrk::Seed& seed,
49  const Acts::GeometryContext& geoContext,
50  const Acts::MagneticFieldContext& magFieldContext,
51  std::function<const Acts::Surface&(const ActsTrk::Seed&)> retrieveSurface) const
52  {
53  const auto& sp_collection = seed.sp();
54  if ( sp_collection.size() < 3 ) return std::nullopt;
55  const auto& bottom_sp = 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 
63  // Get the surface
64  const Acts::Surface& surface = retrieveSurface(seed);
65 
66  return estimateTrackParameters(ctx,
67  seed,
68  geoContext,
69  surface,
71  bField,
72  m_bFieldMin);
73  }
74 
75  std::optional<Acts::BoundTrackParameters>
77  const ActsTrk::Seed& seed,
78  const Acts::GeometryContext& geoContext,
79  const Acts::Surface& surface,
80  const Acts::BoundSquareMatrix& covariance,
81  const Acts::Vector3& bField,
82  double bFieldMin) const
83  {
84  // Get SPs
85  const auto& sp_collection = seed.sp();
86  if ( sp_collection.size() < 3 ) return std::nullopt;
87 
88  // Compute Bound parameters at surface
89  std::optional<Acts::BoundVector> params_opt =
90  Acts::estimateTrackParamsFromSeed(geoContext,
91  sp_collection.begin(),
92  sp_collection.end(),
93  surface,
94  bField,
95  bFieldMin);
96 
97  if ( not params_opt.has_value() )
98  return std::nullopt;
99 
100  const auto& params = params_opt.value();
101 
102  // Create BoundTrackParameters
103  return Acts::BoundTrackParameters(surface.getSharedPtr(),
104  params,
105  covariance,
107  }
108 
109 }
110 // namespace ActsTrk
ActsTrk::TrackParamsEstimationTool::m_sigmaLoc0
Gaudi::Property< double > m_sigmaLoc0
Definition: TrackParamsEstimationTool.h:50
ActsTrk::TrackParamsEstimationTool::estimateTrackParameters
virtual std::optional< Acts::BoundTrackParameters > estimateTrackParameters(const EventContext &ctx, const ActsTrk::Seed &seed, const Acts::GeometryContext &geoContext, const Acts::MagneticFieldContext &magFieldContext, std::function< const Acts::Surface &(const ActsTrk::Seed &)> retrieveSurface) const override
Definition: TrackParamsEstimationTool.cxx:47
ATLASMagneticFieldWrapper
Definition: ATLASMagneticFieldWrapper.h:15
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:62
ActsTrk::TrackParamsEstimationTool::m_sigmaTheta
Gaudi::Property< double > m_sigmaTheta
Definition: TrackParamsEstimationTool.h:56
ActsTrk::Seed
Acts::Seed< xAOD::SpacePoint > Seed
Definition: Seed.h:13
ATLASMagneticFieldWrapper.h
xAOD::pion
@ pion
Definition: TrackingPrimitives.h:196
ActsTrk::TrackParamsEstimationTool::m_covariance
Acts::BoundSquareMatrix m_covariance
The track parameters covariance (assumed to be the same for all estimated track parameters for the mo...
Definition: TrackParamsEstimationTool.h:67
ATLASMagneticFieldWrapper::makeCache
MagneticFieldProvider::Cache makeCache(const Acts::MagneticFieldContext &mctx) const override
Definition: ATLASMagneticFieldWrapper.h:34
ActsTrk::TrackParamsEstimationTool::m_sigmaLoc1
Gaudi::Property< double > m_sigmaLoc1
Definition: TrackParamsEstimationTool.h:52
ActsTrk::TrackParamsEstimationTool::m_sigmaPhi
Gaudi::Property< double > m_sigmaPhi
Definition: TrackParamsEstimationTool.h:54
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ActsTrk::TrackParamsEstimationTool::m_bFieldMin
Gaudi::Property< double > m_bFieldMin
Definition: TrackParamsEstimationTool.h:48
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ActsTrk::TrackParamsEstimationTool::TrackParamsEstimationTool
TrackParamsEstimationTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrackParamsEstimationTool.cxx:10
TrackParamsEstimationTool.h
ATLASMagneticFieldWrapper::getField
Acts::Result< Acts::Vector3 > getField(const Acts::Vector3 &position, Acts::MagneticFieldProvider::Cache &gcache) const override
Definition: ATLASMagneticFieldWrapper.h:39
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ActsTrk::TrackParamsEstimationTool::m_sigmaT0
Gaudi::Property< double > m_sigmaT0
Definition: TrackParamsEstimationTool.h:60
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:34
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
ActsTrk::TrackParamsEstimationTool::initialize
virtual StatusCode initialize() override
Definition: TrackParamsEstimationTool.cxx:16
ActsTrk::TrackParamsEstimationTool::m_sigmaQOverP
Gaudi::Property< double > m_sigmaQOverP
Definition: TrackParamsEstimationTool.h:58