ATLAS Offline Software
TrackParamsEstimationTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include "Acts/Seeding/EstimateTrackParamsFromSeed.hpp"
8 #include "Acts/EventData/TransformationHelpers.hpp"
9 
10 namespace ActsTrk {
12  const std::string& name,
13  const IInterface* parent)
14  : base_class(type, name, parent)
15  {}
16 
18  {
19  ATH_MSG_INFO( "Initializing " << name() << "..." );
20 
21  ATH_MSG_DEBUG( "Properties Summary:" );
22  ATH_MSG_DEBUG( " " << m_bFieldMin );
23  ATH_MSG_DEBUG( " " << m_sigmaLoc0 );
24  ATH_MSG_DEBUG( " " << m_sigmaLoc1 );
25  ATH_MSG_DEBUG( " " << m_sigmaPhi );
26  ATH_MSG_DEBUG( " " << m_sigmaTheta );
27  ATH_MSG_DEBUG( " " << m_sigmaQOverP );
28  ATH_MSG_DEBUG( " " << m_sigmaT0 );
30  ATH_MSG_DEBUG( " " << m_useTopSp );
31 
32  // Make the logger And Propagate to ACTS routines
33  m_logger = makeActsAthenaLogger(this, "Acts");
34  return StatusCode::SUCCESS;
35  }
36 
37  std::optional<Acts::BoundTrackParameters>
39  const ActsTrk::Seed& seed,
40  const Acts::GeometryContext& geoContext,
41  const Acts::MagneticFieldContext& magFieldContext,
42  std::function<const Acts::Surface&(const ActsTrk::Seed&)> retrieveSurface) const
43  {
44  const auto& sp_collection = seed.sp();
45  if ( sp_collection.size() < 3 ) return std::nullopt;
46  const auto& bottom_sp = m_useTopSp ? sp_collection.back() : sp_collection.front();
47 
48  // Magnetic Field
49  ATLASMagneticFieldWrapper magneticField;
50  Acts::MagneticFieldProvider::Cache magFieldCache = magneticField.makeCache( magFieldContext );
51  Acts::Vector3 bField = *magneticField.getField( Acts::Vector3(bottom_sp->x(), bottom_sp->y(), bottom_sp->z()),
52  magFieldCache );
53 
54  // Get the surface
55  const Acts::Surface& surface = retrieveSurface(seed);
56 
57  return estimateTrackParameters(ctx,
58  seed,
59  geoContext,
60  surface,
61  bField,
62  m_bFieldMin);
63  }
64 
65  std::optional<Acts::BoundTrackParameters>
67  const ActsTrk::Seed& seed,
68  const Acts::GeometryContext& geoContext,
69  const Acts::Surface& surface,
70  const Acts::Vector3& bField,
71  double bFieldMin) const
72  {
73  // Get SPs
74  const auto& sp_collection = seed.sp();
75  if ( sp_collection.size() < 3 ) return std::nullopt;
76 
77  // Compute Bound parameters at surface
78  std::optional<Acts::BoundVector> params_opt = m_useTopSp ?
79  Acts::estimateTrackParamsFromSeed(geoContext,
80  sp_collection.rbegin(),
81  sp_collection.rend(),
82  surface,
83  bField,
84  bFieldMin,
85  logger()) :
86  Acts::estimateTrackParamsFromSeed(geoContext,
87  sp_collection.begin(),
88  sp_collection.end(),
89  surface,
90  bField,
91  bFieldMin,
92  logger());
93 
94  if ( not params_opt.has_value() ) {
95  return std::nullopt;
96  }
97 
98  auto& params = params_opt.value();
99 
100  if (m_useTopSp) {
101  // reverse direction so momentum vector pointing outwards
102  params = Acts::reflectBoundParameters(params);
103  }
104 
105  Acts::EstimateTrackParamCovarianceConfig covarianceEstimationConfig = {
107  .initialSigmaPtRel = m_initialSigmaPtRel,
108  .initialVarInflation = Eigen::Map<const Acts::BoundVector>(m_initialVarInflation.value().data()),
109  .noTimeVarInflation = 1.0,
110  };
111  Acts::BoundMatrix covariance = Acts::estimateTrackParamCovariance(covarianceEstimationConfig, params, false);
112 
113  // Create BoundTrackParameters
114  return Acts::BoundTrackParameters(surface.getSharedPtr(),
115  params,
116  covariance,
118  }
119 
120 }
121 // 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:38
ATLASMagneticFieldWrapper
Definition: ATLASMagneticFieldWrapper.h:15
ActsTrk::TrackParamsEstimationTool::m_initialSigmaPtRel
Gaudi::Property< double > m_initialSigmaPtRel
Definition: TrackParamsEstimationTool.h:62
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:64
ActsTrk::TrackParamsEstimationTool::m_sigmaTheta
Gaudi::Property< double > m_sigmaTheta
Definition: TrackParamsEstimationTool.h:56
ATLASMagneticFieldWrapper.h
xAOD::pion
@ pion
Definition: TrackingPrimitives.h:196
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
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: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
ActsTrk::Seed
Acts::Seed< xAOD::SpacePoint, 3ul > Seed
Definition: Seed.h:12
ActsTrk::TrackParamsEstimationTool::m_useTopSp
Gaudi::Property< bool > m_useTopSp
Definition: TrackParamsEstimationTool.h:66
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsTrk::TrackParamsEstimationTool::TrackParamsEstimationTool
TrackParamsEstimationTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrackParamsEstimationTool.cxx:11
ActsTrk::TrackParamsEstimationTool::m_logger
std::unique_ptr< const Acts::Logger > m_logger
logging instance
Definition: TrackParamsEstimationTool.h:72
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:49
ActsTrk::TrackParamsEstimationTool::logger
const Acts::Logger & logger() const
Private access to the logger.
Definition: TrackParamsEstimationTool.h:70
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
ActsTrk::TrackParamsEstimationTool::initialize
virtual StatusCode initialize() override
Definition: TrackParamsEstimationTool.cxx:17
ActsTrk::TrackParamsEstimationTool::m_sigmaQOverP
Gaudi::Property< double > m_sigmaQOverP
Definition: TrackParamsEstimationTool.h:58