5#ifndef MUONGETCLOSESTPARAMETERS_H
6#define MUONGETCLOSESTPARAMETERS_H
21 if (!pars || pars->
empty()) {
return nullptr; }
23 bool firstOk = onlyUseMeasured ? pars->
front()->covariance() != nullptr :
true;
24 bool lastOk = onlyUseMeasured ? pars->
back()->covariance() != nullptr :
true;
27 if (distFront > 0. && firstOk) {
return pars->
front()->uniqueClone(); }
30 if (distBack < 0. && lastOk) {
return pars->
back()->uniqueClone(); }
32 bool startFront = std::abs(distFront) < distBack;
36 double prevDist = distFront - 1.;
40 for (; it != it_end; ++it) {
41 if (onlyUseMeasured && !(*it)->covariance())
continue;
46 if (std::abs(dist) < std::abs(prevDist))
48 else if (it == pars->
begin())
58 double prevDist = distBack + 1.;
62 for (; it != it_end; ++it) {
63 if (onlyUseMeasured && !(*it)->covariance())
continue;
65 const double dist =
distance(**it, pos);
68 if (std::abs(dist) < std::abs(prevDist))
70 else if (it == pars->
rbegin())
81 return result ? result->uniqueClone() :
nullptr;
86 bool onlyUseMeasured =
false) {
92 bool onlyUseMeasured =
false) {
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
const T * back() const
Access the last element in the collection as an rvalue.
const_reverse_iterator rend() const noexcept
Return a const_reverse_iterator pointing at the beginning of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_reverse_iterator rbegin() const noexcept
Return a const_reverse_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
std::reverse_iterator< const_iterator > const_reverse_iterator
Standard const_reverse_iterator.
const T * front() const
Access the first element in the collection as an rvalue.
bool empty() const noexcept
Returns true if the collection is empty.
static std::unique_ptr< Trk::TrackParameters > closestParameters(const Trk::Track &track, const Trk::Surface &surf, bool onlyUseMeasured=false)
static std::unique_ptr< Trk::TrackParameters > closestParameters(const Trk::Track &track, const Trk::TrackParameters &pars, bool onlyUseMeasured=false)
static double distance(const Trk::TrackParameters &pars, const Amg::Vector3D &pos)
static std::unique_ptr< Trk::TrackParameters > closestParameters(const Trk::Track &track, const Amg::Vector3D &pos, bool onlyUseMeasured=false)
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
Abstract Base Class for tracking surfaces.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
Eigen::Matrix< double, 3, 1 > Vector3D
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
ParametersBase< TrackParametersDim, Charged > TrackParameters