ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Trk::SeedNewtonTrkDistanceFinder Class Referencefinal

#include <SeedNewtonTrkDistanceFinder.h>

Inheritance diagram for Trk::SeedNewtonTrkDistanceFinder:
Collaboration diagram for Trk::SeedNewtonTrkDistanceFinder:

Public Member Functions

virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 
 SeedNewtonTrkDistanceFinder (const std::string &t, const std::string &n, const IInterface *p)
 
virtual ~SeedNewtonTrkDistanceFinder ()
 
virtual std::optional< TwoPointsCalculateMinimumDistance (const Trk::Perigee &, const Trk::Perigee &) const override final
 method to do the calculation starting from two Perigees More...
 
virtual std::optional< TwoPointsCalculateMinimumDistance (const Trk::Track &, const Trk::Track &) const override final
 method to do the calculation starting from two tracks More...
 
virtual std::optional< TwoPointsCalculateMinimumDistance (const Trk::TrackParticleBase &, const Trk::TrackParticleBase &) const override final
 method to do the calculation starting from two track particles More...
 

Private Attributes

ToolHandle< Trk2dDistanceSeederm_2ddistanceseeder
 
ToolHandle< NewtonTrkDistanceFinderm_distancefinder
 
std::atomic< int > m_numberOfMinimizationFailures
 

Detailed Description

Algotool which calculates the distance between the two tracks, using: the distance finder you specify, which is an object of type NewtonTrkDistanceFinderAlgo, and using a starting position on the tracks given by Trk2dDistanceSeeder.

The class NewtonTrkDistanceFinderAlgo is based on a Newton minimization procedure, which finds the twodimensional point (position on first and second track) on which the derivatives of the distance is zero.

To avoid maxima the algorithm is initialized with two initial points on the two tracks, which are obtained using the Trk2dDistanceSeeder AlgoTool. This tool finds the point on minimum distance on the transverse plane, which is analitically well defined (intersection of two circles). In case of double intersection different possibilities were considered, at the end I found reasonably good to choose the intersection point where the tracks are nearest in the z coordinate...

Author
Giaci.nosp@m.nto..nosp@m.Piacq.nosp@m.uadi.nosp@m.o@phy.nosp@m.sik..nosp@m.uni-f.nosp@m.reib.nosp@m.urg.d.nosp@m.e

Definition at line 44 of file SeedNewtonTrkDistanceFinder.h.

Constructor & Destructor Documentation

◆ SeedNewtonTrkDistanceFinder()

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

Definition at line 29 of file SeedNewtonTrkDistanceFinder.cxx.

32  {
33  declareProperty("Trk2dDistanceSeeder", m_2ddistanceseeder);
34  declareProperty("TrkDistanceFinderImplementation", m_distancefinder);
35  }
36 

◆ ~SeedNewtonTrkDistanceFinder()

Trk::SeedNewtonTrkDistanceFinder::~SeedNewtonTrkDistanceFinder ( )
virtualdefault

Member Function Documentation

◆ CalculateMinimumDistance() [1/3]

std::optional< ITrkDistanceFinder::TwoPoints > Trk::SeedNewtonTrkDistanceFinder::CalculateMinimumDistance ( const Trk::Perigee a,
const Trk::Perigee b 
) const
finaloverridevirtual

method to do the calculation starting from two Perigees

method to do the calculation starting from two MeasuredPerigees

If successful, returns the points on the two tracks at minimum distance.

return value is true if calculation is successfull

Definition at line 65 of file SeedNewtonTrkDistanceFinder.cxx.

65  {
66  //defragmenting the meory: local variable instead of private data member
67  std::pair<PointOnTrack,PointOnTrack> minpoints;
68 
69  //try first to get the minimum directly with the Newton method
70  auto ret = m_distancefinder->GetClosestPoints(a,b);
71  if (std::holds_alternative<TwoPoints>(ret)) {
72  return std::get<TwoPoints>(ret);
73  }
74  ATH_MSG_DEBUG( "Problem with Newton finder: " <<
75  std::get<std::string>(ret) );
76  minpoints = m_2ddistanceseeder->GetSeed(TwoTracks(a,b));
77  ret = m_distancefinder->GetClosestPoints(minpoints);
78  if (std::holds_alternative<TwoPoints>(ret)) {
79  return std::get<TwoPoints>(ret);
80  }
81  ATH_MSG_DEBUG( "Problem with Newton finder, even after 2d seeder: no minimum between tracks found" << std::get<std::string>(ret));
83 
84  return std::nullopt;
85  }
86 
87 

◆ CalculateMinimumDistance() [2/3]

std::optional< ITrkDistanceFinder::TwoPoints > Trk::SeedNewtonTrkDistanceFinder::CalculateMinimumDistance ( const Trk::Track a,
const Trk::Track b 
) const
finaloverridevirtual

method to do the calculation starting from two tracks

Definition at line 92 of file SeedNewtonTrkDistanceFinder.cxx.

92  {
93  if (std::isnan(a.perigeeParameters()->parameters()[Trk::d0])||std::isnan(b.perigeeParameters()->parameters()[Trk::d0])) {
94  ATH_MSG_ERROR( "Nan parameters in tracks. Cannot use them" );
95  return std::nullopt;
96  }
97 
98  return CalculateMinimumDistance(*(a.perigeeParameters()),*(b.perigeeParameters()));
99 
100  }
101 

◆ CalculateMinimumDistance() [3/3]

std::optional< ITrkDistanceFinder::TwoPoints > Trk::SeedNewtonTrkDistanceFinder::CalculateMinimumDistance ( const Trk::TrackParticleBase a,
const Trk::TrackParticleBase b 
) const
finaloverridevirtual

method to do the calculation starting from two track particles

Definition at line 106 of file SeedNewtonTrkDistanceFinder.cxx.

106  {
107  const Trk::TrackParameters& para=a.definingParameters();
108  const Trk::TrackParameters& parb=b.definingParameters();
109 
110  const Trk::Perigee* parpera=dynamic_cast<const Trk::Perigee*>(&para);
111  const Trk::Perigee* parperb=dynamic_cast<const Trk::Perigee*>(&parb);
112 
113  if (parpera==nullptr||parperb==nullptr) {
114  ATH_MSG_WARNING( "Cannot cast to perigee. Neutral will be supported soon" );
115  return std::nullopt;
116  }
117 
118  if (std::isnan(parpera->parameters()[Trk::d0])||std::isnan(parperb->parameters()[Trk::d0])) {
119  ATH_MSG_ERROR( "Nan parameters in tracks. Cannot use them" );
120  return std::nullopt;
121  }
122 
123  return CalculateMinimumDistance(*(parpera),*(parperb));
124 
125  }
126 
127 } // namespace Trk

◆ finalize()

StatusCode Trk::SeedNewtonTrkDistanceFinder::finalize ( )
overridevirtual

Definition at line 54 of file SeedNewtonTrkDistanceFinder.cxx.

55  : " << m_numberOfMinimizationFailures << ". Few per events is OK!" );
56  return StatusCode::SUCCESS;
57  }
58 
59 

◆ initialize()

StatusCode Trk::SeedNewtonTrkDistanceFinder::initialize ( )
overridevirtual

Definition at line 41 of file SeedNewtonTrkDistanceFinder.cxx.

53  {

Member Data Documentation

◆ m_2ddistanceseeder

ToolHandle<Trk2dDistanceSeeder> Trk::SeedNewtonTrkDistanceFinder::m_2ddistanceseeder
private

Definition at line 71 of file SeedNewtonTrkDistanceFinder.h.

◆ m_distancefinder

ToolHandle<NewtonTrkDistanceFinder> Trk::SeedNewtonTrkDistanceFinder::m_distancefinder
private

Definition at line 72 of file SeedNewtonTrkDistanceFinder.h.

◆ m_numberOfMinimizationFailures

std::atomic<int> Trk::SeedNewtonTrkDistanceFinder::m_numberOfMinimizationFailures
mutableprivate

Definition at line 73 of file SeedNewtonTrkDistanceFinder.h.


The documentation for this class was generated from the following files:
Trk::SeedNewtonTrkDistanceFinder::m_2ddistanceseeder
ToolHandle< Trk2dDistanceSeeder > m_2ddistanceseeder
Definition: SeedNewtonTrkDistanceFinder.h:71
Trk::SeedNewtonTrkDistanceFinder::CalculateMinimumDistance
virtual std::optional< TwoPoints > CalculateMinimumDistance(const Trk::Perigee &, const Trk::Perigee &) const override final
method to do the calculation starting from two Perigees
Definition: SeedNewtonTrkDistanceFinder.cxx:65
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
python.DataFormatRates.events
events
Definition: DataFormatRates.py:105
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ret
T ret(T t)
Definition: rootspy.cxx:260
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::SeedNewtonTrkDistanceFinder::~SeedNewtonTrkDistanceFinder
virtual ~SeedNewtonTrkDistanceFinder()
Trk::d0
@ d0
Definition: ParamDefs.h:69
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
a
TList * a
Definition: liststreamerinfos.cxx:10
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::SeedNewtonTrkDistanceFinder::m_distancefinder
ToolHandle< NewtonTrkDistanceFinder > m_distancefinder
Definition: SeedNewtonTrkDistanceFinder.h:72
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
Trk::SeedNewtonTrkDistanceFinder::m_numberOfMinimizationFailures
std::atomic< int > m_numberOfMinimizationFailures
Definition: SeedNewtonTrkDistanceFinder.h:73