5 #ifndef MUONGETCLOSESTPARAMETERS_H
6 #define MUONGETCLOSESTPARAMETERS_H
17 return (
pars.position() -
pos).dot(
pars.momentum().unit());
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;
68 if (std::abs(dist) < std::abs(prevDist))
70 else if (
it ==
pars->rbegin())
86 bool onlyUseMeasured =
false) {
92 bool onlyUseMeasured =
false) {