ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::RungeKuttaPropagator Class Referencefinal

Trk::RungeKuttaPropagator is an algorithm for track parameters propagation through magnetic field. More...

#include <RungeKuttaPropagator.h>

Inheritance diagram for Trk::RungeKuttaPropagator:
Collaboration diagram for Trk::RungeKuttaPropagator:

Classes

struct  Cache

Public Member Functions

 RungeKuttaPropagator (const std::string &, const std::string &, const IInterface *)
virtual StatusCode initialize () override final
virtual ~RungeKuttaPropagator ()=default
virtual std::unique_ptr< NeutralParameterspropagate (const NeutralParameters &, const Surface &, PropDirection, const BoundaryCheck &, bool) const override final
 Main propagation method for NeutralParameters.
virtual std::unique_ptr< TrackParameterspropagate (const EventContext &ctx, const TrackParameters &, const Surface &, const PropDirection, const BoundaryCheck &, const MagneticFieldProperties &, ParticleHypothesis, bool, const TrackingVolume *) const override final
 Main propagation method without transport jacobian production.
virtual Trk::MultiComponentState multiStatePropagate (const EventContext &ctx, const MultiComponentState &multiComponentState, const Surface &surface, const MagneticFieldProperties &fieldProperties, const PropDirection direction=Trk::anyDirection, const BoundaryCheck &boundaryCheck=true, const ParticleHypothesis particleHypothesis=nonInteracting) const override final
 Main propagation method for Multi Component state.
virtual std::unique_ptr< TrackParameterspropagate (const EventContext &ctx, const TrackParameters &, const Surface &, const PropDirection, const BoundaryCheck &, const MagneticFieldProperties &, std::optional< TransportJacobian > &, double &, ParticleHypothesis, bool, const TrackingVolume *) const override final
 Main propagation method with transport jacobian production.
virtual std::unique_ptr< TrackParameterspropagate (const EventContext &ctx, const TrackParameters &, std::vector< DestSurf > &, PropDirection, const MagneticFieldProperties &, ParticleHypothesis, std::vector< unsigned int > &, double &, bool, bool, const TrackingVolume *) const override final
 The propagation method finds the closest surface.
virtual std::unique_ptr< TrackParameterspropagateParameters (const EventContext &ctx, const TrackParameters &, const Surface &, const PropDirection, const BoundaryCheck &, const MagneticFieldProperties &, ParticleHypothesis, bool, const TrackingVolume *) const override final
 Main propagation method for parameters only.
virtual std::unique_ptr< TrackParameterspropagateParameters (const EventContext &ctx, const TrackParameters &, const Surface &, const PropDirection, const BoundaryCheck &, const MagneticFieldProperties &, std::optional< TransportJacobian > &, ParticleHypothesis, bool, const TrackingVolume *) const override final
 Main propagation method for parameters only with transport jacobian production.
virtual std::optional< Trk::TrackSurfaceIntersectionintersect (const EventContext &ctx, const TrackParameters &, const Surface &, const MagneticFieldProperties &, ParticleHypothesis, const TrackingVolume *tvol=nullptr) const override final
 Global position together with direction of the trajectory on the surface.
virtual void globalPositions (const EventContext &ctx, std::deque< Amg::Vector3D > &, const TrackParameters &, const MagneticFieldProperties &, const CylinderBounds &, double, ParticleHypothesis, const TrackingVolume *tvol=nullptr) const override final
 GlobalPositions list interface:
virtual bool propagate (const EventContext &ctx, PatternTrackParameters &, const Surface &, PatternTrackParameters &, PropDirection, const MagneticFieldProperties &, ParticleHypothesis particle=pion) const override final
 Main propagation method.
virtual bool propagate (const EventContext &ctx, PatternTrackParameters &, const Surface &, PatternTrackParameters &, PropDirection, const MagneticFieldProperties &, double &, ParticleHypothesis particle=pion) const override final
 Main propagation method with step to surface calculation.
virtual bool propagateParameters (const EventContext &ctx, PatternTrackParameters &, const Surface &, PatternTrackParameters &, PropDirection, const MagneticFieldProperties &, ParticleHypothesis particle=pion) const override final
 Main propagation method for parameters only.
virtual bool propagateParameters (const EventContext &ctx, PatternTrackParameters &, const Surface &, PatternTrackParameters &, PropDirection, const MagneticFieldProperties &, double &, ParticleHypothesis particle=pion) const override final
 Main propagation method for parameters only with step to surface calculation.
virtual void globalPositions (const EventContext &ctx, const PatternTrackParameters &, std::vector< const Surface * > &, std::vector< std::pair< Amg::Vector3D, double > > &, const MagneticFieldProperties &, ParticleHypothesis particle=pion) const override final
virtual std::unique_ptr< Trk::TrackParameterspropagateT (const EventContext &, const TrackParameters &, std::vector< DestSurf > &, PropDirection, const MagneticFieldProperties &, ParticleHypothesis, std::vector< unsigned int > &, PathLimit &, TimeLimit &, bool, const Trk::TrackingVolume *, std::vector< Trk::HitInfo > *&) const override final
 unimplemented propagateT
virtual std::unique_ptr< Trk::TrackParameterspropagateM (const EventContext &, const TrackParameters &, std::vector< DestSurf > &, PropDirection, const MagneticFieldProperties &, ParticleHypothesis, std::vector< unsigned int > &, std::vector< const Trk::TrackStateOnSurface * > *, std::vector< std::pair< std::unique_ptr< Trk::TrackParameters >, int > > *, double &, bool, bool, const Trk::TrackingVolume *, Trk::ExtrapolationCache *) const override final
 unimplemented propagateM
virtual std::optional< Trk::TrackSurfaceIntersectionintersectSurface (const EventContext &, const Surface &, const TrackSurfaceIntersection &, const double, const MagneticFieldProperties &, ParticleHypothesis) const override final
 unimplemented intersectSurface
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool and IAlgTool interface methods.
static const InterfaceID & interfaceID ()
 framework method providing the abstract interface

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Cache getInitializedCache (const EventContext &ctx) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadCondHandleKey< AtlasFieldCacheCondObjm_fieldCondObjInputKey
DoubleProperty m_dlt {this, "AccuracyParameter", 0.0002}
DoubleProperty m_helixStep {this, "MaxHelixStep", 1.}
DoubleProperty m_straightStep {this, "MaxStraightLineStep", 0.01}
BooleanProperty m_usegradient
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Trk::RungeKuttaPropagator is an algorithm for track parameters propagation through magnetic field.

The implementation performs the propagation in global coordinates and uses Jacobian matrices (see RungeKuttaUtils) for the transformations between the global frame and local surface-attached coordinate systems.

One can choose to perform the transport of the parameters only and omit the transport of the associated covariances (propagateParameters).

The algorithm can produce the Jacobian that transports the covariance matrix from one set of track parameters at the initial surface to another set of track parameters at the destination surface. This is useful for Chi2 fitting.

It does NOT include material effects (unlike the STEP propagator). As a result the ParticleHypothesis argument is not really used. It is assumed that in the client code , the propagation, transport of the track parameters and their associated covariances, is decoupled from the actual corrections due to interaction with the detector material.

The algorithm contains three steps :

1.The first step of the algorithm is track parameters transformation from local presentation for given start surface to global Runge Kutta coordinates.

2.The second step is propagation through the magnetic field with or without jacobian.

3.Third step is transformation from global Runge Kutta presentation to local presentation of given output surface.

AtaPlane AtaStraightLine AtaDisc AtaCylinder Perigee | | | | | | | | | |

V V V V V

| Local->Global transformation V Global position (Runge Kutta presentation) | | Propagation to next surface with or without jacobian using Nystroem algorithm (See Handbook Net. Bur. of Standards, procedure 25.5.20) |

V Global->Local transformation

| | | | | | | | | | V V V V V PlaneSurface StraightLineSurface DiscSurface CylinderSurface PerigeeSurface

For propagation using Runge Kutta method we use global coordinates, direction, inverse momentum and Jacobian of transformation. All these parameters we save in an array P[42]

              /dL0    /dL1    /dPhi   /dThe   /dCM

X ->P[0] dX/ P[ 7] P[14] P[21] P[28] P[35] Y ->P[1] dY/ P[ 8] P[15] P[22] P[29] P[36] Z ->P[2] dZ/ P[ 9] P[16] P[23] P[30] P[37] Ax ->P[3] dAx/ P[10] P[17] P[24] P[31] P[38] Ay ->P[4] dAy/ P[11] P[18] P[25] P[32] P[39] Az ->P[5] dAz/ P[12] P[19] P[26] P[33] P[40] CM ->P[6] dCM/ P[13] P[20] P[27] P[34] P[41]

where in case of local re-presentation

L0 - first local coordinate (surface dependent) L1 - second local coordinate (surface dependent) Phi - Azimuthal angle The - Polar angle CM - charge/momentum

in case of global re-presentation

X - global x-coordinate = surface dependent Y - global y-coordinate = surface dependent Z - global z-coordinate = sutface dependent Ax - direction cosine to x-axis = Sin(The)*Cos(Phi) Ay - direction cosine to y-axis = Sin(The)*Sin(Phi) Az - direction cosine to z-axis = Cos(The) CM - charge/momentum = local CM

Author
Igor..nosp@m.Gavr.nosp@m.ilenk.nosp@m.o@ce.nosp@m.rn.ch
Authors
RD Schaffer C Anastopoulos AthenaMT modifications

Definition at line 130 of file RungeKuttaPropagator.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ RungeKuttaPropagator()

Trk::RungeKuttaPropagator::RungeKuttaPropagator ( const std::string & p,
const std::string & n,
const IInterface * t )

Definition at line 1380 of file RungeKuttaPropagator.cxx.

1383 : AthAlgTool(p, n, t)
1384{
1385 declareInterface<Trk::IPropagator>(this);
1386 declareInterface<Trk::IPatternParametersPropagator>(this);
1387}
AthAlgTool()
Default constructor:

◆ ~RungeKuttaPropagator()

virtual Trk::RungeKuttaPropagator::~RungeKuttaPropagator ( )
virtualdefault

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getInitializedCache()

Cache Trk::RungeKuttaPropagator::getInitializedCache ( const EventContext & ctx) const
private

Definition at line 1914 of file RungeKuttaPropagator.cxx.

1915{
1916 SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey,
1917 ctx};
1918 const AtlasFieldCacheCondObj* fieldCondObj{*readHandle};
1919 Cache cache{};
1920 fieldCondObj->getInitializedCache(cache.m_fieldCache);
1921 cache.m_dlt = m_dlt;
1922 cache.m_helixStep = m_helixStep;
1923 cache.m_straightStep = m_straightStep;
1924 cache.m_usegradient = m_usegradient;
1925 return cache;
1926}
void getInitializedCache(MagField::AtlasFieldCache &cache) const
get B field cache for evaluation as a function of 2-d or 3-d position.
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCondObjInputKey
const IIntersectionCache * cache() const
Retrieve the associated cache block, if it exists.

◆ globalPositions() [1/2]

void Trk::RungeKuttaPropagator::globalPositions ( const EventContext & ctx,
const PatternTrackParameters & Tp,
std::vector< const Surface * > & SU,
std::vector< std::pair< Amg::Vector3D, double > > & GP,
const MagneticFieldProperties & M,
ParticleHypothesis particle = pion ) const
finaloverridevirtual

Implements Trk::IPatternParametersPropagator.

Definition at line 1902 of file RungeKuttaPropagator.cxx.

1908{
1910 globalPositionsImpl(cache, Tp, SU, GP, M);
1911}
static Double_t Tp(Double_t *t, Double_t *par)
Cache getInitializedCache(const EventContext &ctx) const

◆ globalPositions() [2/2]

void Trk::RungeKuttaPropagator::globalPositions ( const EventContext & ctx,
std::deque< Amg::Vector3D > & GP,
const TrackParameters & Tp,
const MagneticFieldProperties & M,
const CylinderBounds & CB,
double mS,
ParticleHypothesis ,
const TrackingVolume * tvol = nullptr ) const
finaloverridevirtual

GlobalPositions list interface:

Implements Trk::IPropagator.

Definition at line 1771 of file RungeKuttaPropagator.cxx.

1779{
1780 double P[45];
1782 return;
1784
1785 cache.m_direction = std::abs(mS);
1786 if (mS > 0.)
1787 globalOneSidePositions(cache, GP, P, M, CB, mS);
1788 else
1789 globalTwoSidePositions(cache, GP, P, M, CB, -mS);
1790}
static Double_t P(Double_t *tt, Double_t *par)
bool transformLocalToGlobal(bool, const Trk::TrackParameters &, double *ATH_RESTRICT)

◆ initialize()

StatusCode Trk::RungeKuttaPropagator::initialize ( )
finaloverridevirtual

Definition at line 1390 of file RungeKuttaPropagator.cxx.

1391{
1392 // Read handle for AtlasFieldCacheCondObj
1393 ATH_CHECK(m_fieldCondObjInputKey.initialize());
1394 ATH_MSG_DEBUG("initialize() init key: " << m_fieldCondObjInputKey.key());
1395 return StatusCode::SUCCESS;
1396}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID() [1/2]

const InterfaceID & Trk::IPatternParametersPropagator::interfaceID ( )
inlinestaticinherited

framework method providing the abstract interface

Definition at line 107 of file IPatternParametersPropagator.h.

108{
110}
static const InterfaceID IID_IPatternParametersPropagator("IPatternParametersPropagator", 1, 0)
Interface ID for IPropagators.

◆ interfaceID() [2/2]

const InterfaceID & Trk::IPropagator::interfaceID ( )
inlinestaticinherited

AlgTool and IAlgTool interface methods.

Definition at line 60 of file IPropagator.h.

60{ return IID_IPropagator; }
static const InterfaceID IID_IPropagator("IPropagator", 1, 0)
Interface ID for IPropagators.

◆ intersect()

std::optional< Trk::TrackSurfaceIntersection > Trk::RungeKuttaPropagator::intersect ( const EventContext & ctx,
const TrackParameters & Tp,
const Surface & Su,
const MagneticFieldProperties & M,
ParticleHypothesis ,
const TrackingVolume * tvol = nullptr ) const
finaloverridevirtual

Global position together with direction of the trajectory on the surface.

Implements Trk::IPropagator.

Definition at line 1796 of file RungeKuttaPropagator.cxx.

1802{
1803 bool const nJ = false;
1804 const Trk::Surface* su = &Su;
1806 cache.m_direction = 0.;
1807 cache.m_needgradient = false;
1808
1809 M.magneticFieldMode() == Trk::FastField ? cache.m_solenoid = true : cache.m_solenoid = false;
1810 M.magneticFieldMode() != Trk::NoField ? cache.m_mcondition = true : cache.m_mcondition = false;
1811
1812 double P[64];
1814 return std::nullopt;
1815 }
1816 double Step = 0.;
1817 if (!propagateWithJacobianSwitch(cache, (*su), nJ, P, Step)) {
1818 return std::nullopt;
1819 }
1820
1821 const Amg::Vector3D Glo(P[0], P[1], P[2]);
1822 const Amg::Vector3D Dir(P[3], P[4], P[5]);
1823 return std::make_optional<Trk::TrackSurfaceIntersection>(Glo, Dir, Step);
1824}
Eigen::Matrix< double, 3, 1 > Vector3D
@ FastField
call the fast field access method of the FieldSvc
@ NoField
Field is set to 0., 0., 0.,.

◆ intersectSurface()

virtual std::optional< Trk::TrackSurfaceIntersection > Trk::RungeKuttaPropagator::intersectSurface ( const EventContext & ,
const Surface & ,
const TrackSurfaceIntersection & ,
const double ,
const MagneticFieldProperties & ,
ParticleHypothesis  ) const
inlinefinaloverridevirtual

unimplemented intersectSurface

Implements Trk::IPropagator.

Definition at line 346 of file RungeKuttaPropagator.h.

353 {
354 ATH_MSG_ERROR("Call to non-implemented intersectSurface");
355 return std::nullopt;
356 }
#define ATH_MSG_ERROR(x)

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ multiStatePropagate()

Trk::MultiComponentState Trk::RungeKuttaPropagator::multiStatePropagate ( const EventContext & ctx,
const MultiComponentState & multiComponentState,
const Surface & surface,
const MagneticFieldProperties & fieldProperties,
const PropDirection direction = Trk::anyDirection,
const BoundaryCheck & boundaryCheck = true,
const ParticleHypothesis particleHypothesis = nonInteracting ) const
finaloverridevirtual

Main propagation method for Multi Component state.

Implements Trk::IPropagator.

Definition at line 1441 of file RungeKuttaPropagator.cxx.

1449{
1451
1452 Trk::MultiComponentState propagatedState{};
1453 propagatedState.reserve(multiComponentState.size());
1454 double sumw(0); // sum of the weights of the propagated parameters
1455 double J[25];
1456 Trk::MultiComponentState::const_iterator component =
1457 multiComponentState.begin();
1458 for (; component != multiComponentState.end(); ++component) {
1459 const Trk::TrackParameters* currentParameters = component->params.get();
1460 if (!currentParameters) {
1461 continue;
1462 }
1463 auto propagatedParameters =
1464 propagateRungeKutta(cache, true, *currentParameters, surface, direction,
1465 boundaryCheck, fieldProperties, J, false);
1466
1467 if (!propagatedParameters) {
1468 continue;
1469 }
1470 sumw += component->weight;
1471 // Propagation does not affect the weightings of the states
1472 propagatedState.push_back({std::move(propagatedParameters),
1473 component->weight});
1474 }
1475 // Protect low weight propagation
1476 constexpr double minPropWeight = (1./12.);
1477 if (sumw < minPropWeight) {
1478 propagatedState.clear();
1479 }
1480 return propagatedState;
1481}
std::vector< ComponentParameters > MultiComponentState
const Amg::Vector3D & direction() const
Method to retrieve the direction at the Intersection.
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ propagate() [1/6]

std::unique_ptr< Trk::TrackParameters > Trk::RungeKuttaPropagator::propagate ( const EventContext & ctx,
const TrackParameters & Tp,
const Surface & Su,
const PropDirection D,
const BoundaryCheck & B,
const MagneticFieldProperties & M,
ParticleHypothesis ,
bool returnCurv,
const TrackingVolume *  ) const
finaloverridevirtual

Main propagation method without transport jacobian production.

Implements Trk::IPropagator.

Definition at line 1422 of file RungeKuttaPropagator.cxx.

1431{
1432 double J[25];
1434 return propagateRungeKutta(cache, true, Tp, Su, D, B, M, J, returnCurv);
1435}

◆ propagate() [2/6]

std::unique_ptr< Trk::TrackParameters > Trk::RungeKuttaPropagator::propagate ( const EventContext & ctx,
const TrackParameters & Tp,
const Surface & Su,
const PropDirection D,
const BoundaryCheck & B,
const MagneticFieldProperties & M,
std::optional< TransportJacobian > & Jac,
double & pathLength,
ParticleHypothesis ,
bool returnCurv,
const TrackingVolume *  ) const
finaloverridevirtual

Main propagation method with transport jacobian production.

Implements Trk::IPropagator.

Definition at line 1488 of file RungeKuttaPropagator.cxx.

1499{
1500 double J[25];
1502 pathLength < 0. ? cache.m_maxPath = 10000. : cache.m_maxPath = pathLength;
1503 auto Tpn = propagateRungeKutta(cache, true, Tp, Su, D, B, M, J, returnCurv);
1504 pathLength = cache.m_step;
1505
1506 if (Tpn) {
1507 J[24] = J[20];
1508 J[23] = 0.;
1509 J[22] = 0.;
1510 J[21] = 0.;
1511 J[20] = 0.;
1512 Jac = std::make_optional<Trk::TransportJacobian>(J);
1513 } else
1514 Jac.reset();
1515 return Tpn;
1516}

◆ propagate() [3/6]

std::unique_ptr< Trk::TrackParameters > Trk::RungeKuttaPropagator::propagate ( const EventContext & ctx,
const TrackParameters & Tp,
std::vector< DestSurf > & DS,
PropDirection D,
const MagneticFieldProperties & M,
ParticleHypothesis ,
std::vector< unsigned int > & Sol,
double & Path,
bool usePathLim,
bool ,
const TrackingVolume *  ) const
finaloverridevirtual

The propagation method finds the closest surface.

If the extrapolation surpassed the last boundary it can super duper rarely happen that the propagator is trapped. The propagator then goes the same step back and forth. The flip number limit is kind of a hack to release the propagator from the limbo. The conditions are that the last_st & the current step have to be of the same size but different sign. If this happens a few times the loop is aborted. The chosen number here is at the same level of arbitrariness as the rarity that this branch of the code will be chosen

Update the number of flips. Reset the counter if the last surface is not the same as the current one and then check that the step size & the last step size are the same but of different sign

Implements Trk::IPropagator.

Definition at line 1522 of file RungeKuttaPropagator.cxx.

1533{
1534
1536 Sol.erase(Sol.begin(), Sol.end());
1537 Path = 0.;
1538 if (DS.empty())
1539 return nullptr;
1540 cache.m_direction = D;
1541
1542 // Test is it measured track parameters
1543 //
1544 bool useJac = 0;
1545 Tp.covariance() ? useJac = true : useJac = false;
1546
1547 // Magnetic field information preparation
1548 //
1549 M.magneticFieldMode() == Trk::FastField ? cache.m_solenoid = true : cache.m_solenoid = false;
1550 (useJac && m_usegradient) ? cache.m_needgradient = true : cache.m_needgradient = false;
1551 M.magneticFieldMode() != Trk::NoField ? cache.m_mcondition = true : cache.m_mcondition = false;
1552
1553 // Transform to global presentation
1554 //
1555
1556 double Po[45];
1557 double Pn[45];
1559 return nullptr;
1560 Po[42] = Po[43] = Po[44] = 0.;
1561
1562 // Straight line track propagation for small step
1563 //
1564 if (D != 0) {
1565 double S = cache.m_straightStep;
1566 if (D < 0)
1567 S = -S;
1568 S = straightLineStep(useJac, S, Po);
1569 }
1570 double Wmax = 50000.; // Max pass
1571 double W = 0.; // Current pass
1572 double Smax = 100.; // Max step
1573 if (D < 0)
1574 Smax = -Smax;
1575 if (usePathLim)
1576 Wmax = std::abs(Path);
1577
1578 std::multimap<double, int> DN;
1579 double Scut[3];
1580 int Nveto = Trk::RungeKuttaUtils::fillDistancesMap(DS, DN, Po, W, &Tp.associatedSurface(), Scut);
1581
1582 // Test conditions tor start propagation and chocse direction if D == 0
1583 //
1584 if (DN.empty())
1585 return nullptr;
1586
1587 if (D == 0 && std::abs(Scut[0]) < std::abs(Scut[1]))
1588 Smax = -Smax;
1589
1590 if (Smax < 0. && Scut[0] > Smax)
1591 Smax = Scut[0];
1592 if (Smax > 0. && Scut[1] < Smax)
1593 Smax = Scut[1];
1594 if (Wmax > 3. * Scut[2])
1595 Wmax = 3. * Scut[2];
1596
1597 double Sl = Smax;
1598 double St = Smax;
1599 bool InS = false;
1600
1601 for (int i = 0; i != 45; ++i)
1602 Pn[i] = Po[i];
1603
1604 //----------------------------------Niels van Eldik patch
1605 double last_St = 0.;
1606 bool last_InS = !InS;
1607 bool reverted_P = false;
1608 //----------------------------------
1609
1610 cache.m_newfield = true;
1619 constexpr unsigned int max_back_forth_flips{ 100 };
1620 unsigned int flips{0};
1621 int last_surface{-1};
1622
1623 while (std::abs(W) < Wmax) {
1624
1625 std::pair<double, int> SN;
1626 double S = 0;
1627
1628 if (cache.m_mcondition) {
1629
1630 //----------------------------------Niels van Eldik patch
1631 if (reverted_P && std::abs(St - last_St) <= DBL_EPSILON &&
1632 InS == last_InS) {
1633 // inputs are not changed will get same result.
1634 break;
1635 }
1636 last_St = St;
1637 last_InS = InS;
1638 //----------------------------------
1639
1640 if (!cache.m_needgradient)
1641 S = rungeKuttaStep(cache, useJac, St, Pn, InS);
1642 else
1643 S = rungeKuttaStepWithGradient(cache, St, Pn, InS);
1644 } else {
1645
1646 //----------------------------------Niels van Eldik patch
1647 if (reverted_P && std::abs(St - last_St) <= DBL_EPSILON) {
1648 // inputs are not changed will get same result.
1649 break;
1650 }
1651 last_St = St;
1652 last_InS = InS;
1653 //----------------------------------
1654
1655 S = straightLineStep(useJac, St, Pn);
1656 }
1657 //----------------------------------Niels van Eldik patch
1658 reverted_P = false;
1659 //----------------------------------
1660
1661 bool next{ false };
1662 SN = Trk::RungeKuttaUtils::stepEstimator(DS, DN, Po, Pn, W, cache.m_straightStep, Nveto, next);
1663 if (next) {
1664 for (int i = 0; i != 45; ++i)
1665 Po[i] = Pn[i];
1666 W += S;
1667 Nveto = -1;
1668 } else {
1669 for (int i = 0; i != 45; ++i)
1670 Pn[i] = Po[i];
1671 reverted_P = true;
1672 cache.m_newfield = true;
1673 }
1674
1675 if (std::abs(S) + 1. < std::abs(St))
1676 Sl = S;
1677 InS ? St = 2. * S : St = S;
1678
1679 if (SN.second >= 0) {
1680
1681 const double Sa = std::abs(SN.first);
1682
1686 flips += last_surface == SN.second ? std::abs(last_St + SN.first) < 1.e-6
1687 : -flips;
1688 last_surface = SN.second;
1689
1690
1691 if (Sa > cache.m_straightStep) {
1692 if (std::abs(St) > Sa)
1693 St = SN.first;
1694 } else {
1695 Path = W + SN.first;
1696 if (auto To{ crossPoint(Tp, DS, Sol, Pn, SN) }; To){
1697 return To;
1698 }
1699 Nveto = SN.second;
1700 St = Sl;
1701 }
1702 } else if (std::abs(S) < DBL_EPSILON){
1703 return nullptr;
1704 }
1705
1706 if (flips > max_back_forth_flips) {
1707 return nullptr;
1708 }
1709 }
1710 return nullptr;
1711}
int fillDistancesMap(std::vector< std::pair< const Trk::Surface *, Trk::BoundaryCheck > > &, std::multimap< double, int > &, const double *ATH_RESTRICT, double, const Trk::Surface *, double *ATH_RESTRICT)
double stepEstimator(int kind, double *ATH_RESTRICT Su, const double *ATH_RESTRICT P, bool &Q)
@ next
Definition BinningData.h:35

◆ propagate() [4/6]

bool Trk::RungeKuttaPropagator::propagate ( const EventContext & ctx,
Trk::PatternTrackParameters & Ta,
const Surface & Su,
Trk::PatternTrackParameters & Tb,
Trk::PropDirection D,
const MagneticFieldProperties & M,
double & S,
ParticleHypothesis particle = pion ) const
finaloverridevirtual

Main propagation method with step to surface calculation.

Implements Trk::IPatternParametersPropagator.

Definition at line 1849 of file RungeKuttaPropagator.cxx.

1857{
1859 return propagateRungeKutta(cache, true, Ta, Su, Tb, D, M, S);
1860}

◆ propagate() [5/6]

bool Trk::RungeKuttaPropagator::propagate ( const EventContext & ctx,
Trk::PatternTrackParameters & Ta,
const Surface & Su,
Trk::PatternTrackParameters & Tb,
Trk::PropDirection D,
const MagneticFieldProperties & M,
ParticleHypothesis particle = pion ) const
finaloverridevirtual

Main propagation method.

Implements Trk::IPatternParametersPropagator.

Definition at line 1831 of file RungeKuttaPropagator.cxx.

1838{
1839 double S = 0;
1841 return propagateRungeKutta(cache, true, Ta, Su, Tb, D, M, S);
1842}

◆ propagate() [6/6]

std::unique_ptr< Trk::NeutralParameters > Trk::RungeKuttaPropagator::propagate ( const NeutralParameters & Tp,
const Surface & Su,
Trk::PropDirection D,
const BoundaryCheck & B,
bool returnCurv ) const
finaloverridevirtual

Main propagation method for NeutralParameters.

Implements Trk::IPropagator.

Definition at line 1402 of file RungeKuttaPropagator.cxx.

1407{
1408 double J[25];
1409 Cache cache{};
1410 cache.m_dlt = m_dlt;
1411 cache.m_helixStep = m_helixStep;
1412 cache.m_straightStep = m_straightStep;
1413 cache.m_usegradient = m_usegradient;
1414 return propagateStraightLine(cache, true, Tp, Su, D, B, J, returnCurv);
1415}

◆ propagateM()

virtual std::unique_ptr< Trk::TrackParameters > Trk::RungeKuttaPropagator::propagateM ( const EventContext & ,
const TrackParameters & ,
std::vector< DestSurf > & ,
PropDirection ,
const MagneticFieldProperties & ,
ParticleHypothesis ,
std::vector< unsigned int > & ,
std::vector< const Trk::TrackStateOnSurface * > * ,
std::vector< std::pair< std::unique_ptr< Trk::TrackParameters >, int > > * ,
double & ,
bool ,
bool ,
const Trk::TrackingVolume * ,
Trk::ExtrapolationCache *  ) const
inlinefinaloverridevirtual

unimplemented propagateM

Implements Trk::IPropagator.

Definition at line 325 of file RungeKuttaPropagator.h.

340 {
341 ATH_MSG_ERROR("Call to non-implemented propagateM");
342 return nullptr;
343 }

◆ propagateParameters() [1/4]

std::unique_ptr< Trk::TrackParameters > Trk::RungeKuttaPropagator::propagateParameters ( const EventContext & ctx,
const TrackParameters & Tp,
const Surface & Su,
const PropDirection D,
const BoundaryCheck & B,
const MagneticFieldProperties & M,
ParticleHypothesis ,
bool returnCurv,
const TrackingVolume *  ) const
finaloverridevirtual

Main propagation method for parameters only.

Without transport jacobian production

Implements Trk::IPropagator.

Definition at line 1718 of file RungeKuttaPropagator.cxx.

1727{
1728 double J[25];
1730 return propagateRungeKutta(cache, false, Tp, Su, D, B, M, J, returnCurv);
1731}

◆ propagateParameters() [2/4]

std::unique_ptr< Trk::TrackParameters > Trk::RungeKuttaPropagator::propagateParameters ( const EventContext & ctx,
const TrackParameters & Tp,
const Surface & Su,
const PropDirection D,
const BoundaryCheck & B,
const MagneticFieldProperties & M,
std::optional< TransportJacobian > & Jac,
ParticleHypothesis ,
bool returnCurv,
const TrackingVolume *  ) const
finaloverridevirtual

Main propagation method for parameters only with transport jacobian production.

Implements Trk::IPropagator.

Definition at line 1738 of file RungeKuttaPropagator.cxx.

1748{
1749 double J[25];
1751 auto Tpn{ propagateRungeKutta(cache, true, Tp, Su, D, B, M, J, returnCurv) };
1752
1753 if (Tpn) {
1754 J[24] = J[20];
1755 J[23] = 0.;
1756 J[22] = 0.;
1757 J[21] = 0.;
1758 J[20] = 0.;
1759 Jac = std::make_optional<Trk::TransportJacobian>(J);
1760 } else
1761 Jac.reset();
1762 return Tpn;
1763}

◆ propagateParameters() [3/4]

bool Trk::RungeKuttaPropagator::propagateParameters ( const EventContext & ctx,
Trk::PatternTrackParameters & Ta,
const Surface & Su,
Trk::PatternTrackParameters & Tb,
Trk::PropDirection D,
const MagneticFieldProperties & M,
double & S,
ParticleHypothesis particle = pion ) const
finaloverridevirtual

Main propagation method for parameters only with step to surface calculation.

Implements Trk::IPatternParametersPropagator.

Definition at line 1885 of file RungeKuttaPropagator.cxx.

1893{
1895 return propagateRungeKutta(cache, false, Ta, Su, Tb, D, M, S);
1896}

◆ propagateParameters() [4/4]

bool Trk::RungeKuttaPropagator::propagateParameters ( const EventContext & ctx,
Trk::PatternTrackParameters & Ta,
const Surface & Su,
Trk::PatternTrackParameters & Tb,
Trk::PropDirection D,
const MagneticFieldProperties & M,
ParticleHypothesis particle = pion ) const
finaloverridevirtual

Main propagation method for parameters only.

Implements Trk::IPatternParametersPropagator.

Definition at line 1867 of file RungeKuttaPropagator.cxx.

1874{
1875 double S = 0;
1877 return propagateRungeKutta(cache, false, Ta, Su, Tb, D, M, S);
1878}

◆ propagateT()

virtual std::unique_ptr< Trk::TrackParameters > Trk::RungeKuttaPropagator::propagateT ( const EventContext & ,
const TrackParameters & ,
std::vector< DestSurf > & ,
PropDirection ,
const MagneticFieldProperties & ,
ParticleHypothesis ,
std::vector< unsigned int > & ,
PathLimit & ,
TimeLimit & ,
bool ,
const Trk::TrackingVolume * ,
std::vector< Trk::HitInfo > *&  ) const
inlinefinaloverridevirtual

unimplemented propagateT

Implements Trk::IPropagator.

Definition at line 306 of file RungeKuttaPropagator.h.

319 {
320 ATH_MSG_ERROR("Call to non-implemented propagateT");
321 return nullptr;
322 }

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_dlt

DoubleProperty Trk::RungeKuttaPropagator::m_dlt {this, "AccuracyParameter", 0.0002}
private

Definition at line 394 of file RungeKuttaPropagator.h.

394{this, "AccuracyParameter", 0.0002};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_fieldCondObjInputKey

SG::ReadCondHandleKey<AtlasFieldCacheCondObj> Trk::RungeKuttaPropagator::m_fieldCondObjInputKey
private
Initial value:
{
this,
"AtlasFieldCacheCondObj",
"fieldCondObj",
"Name of the Magnetic Field conditions object key"
}

Definition at line 387 of file RungeKuttaPropagator.h.

387 {
388 this,
389 "AtlasFieldCacheCondObj",
390 "fieldCondObj",
391 "Name of the Magnetic Field conditions object key"
392 };

◆ m_helixStep

DoubleProperty Trk::RungeKuttaPropagator::m_helixStep {this, "MaxHelixStep", 1.}
private

Definition at line 395 of file RungeKuttaPropagator.h.

395{this, "MaxHelixStep", 1.};

◆ m_straightStep

DoubleProperty Trk::RungeKuttaPropagator::m_straightStep {this, "MaxStraightLineStep", 0.01}
private

Definition at line 396 of file RungeKuttaPropagator.h.

396{this, "MaxStraightLineStep", 0.01};

◆ m_usegradient

BooleanProperty Trk::RungeKuttaPropagator::m_usegradient
private
Initial value:
{this, "IncludeBgradients", false,
"use magnetic field gradient into the error propagation"}

Definition at line 397 of file RungeKuttaPropagator.h.

397 {this, "IncludeBgradients", false,
398 "use magnetic field gradient into the error propagation"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: