26 const double cylinderR) {
35 assert (cylinderR > 0.);
36 Acts::detail::RealQuadraticEquation solution{dir.block<2,1>(0,0).
perp2(),
37 2.*pos.block<2,1>(0,0).
dot(dir.block<2,1>(0,0)),
38 pos.block<2,1>(0,0).
perp2() - Acts::square(cylinderR)};
39 switch(solution.solutions) {
41 auto ret = std::array{solution.first, solution.second};
42 if ((ret[1] > 0 && (ret[0] < 0 || ret[0] > ret[1])) ||
43 (ret[1] < 0 && (ret[0] < ret[1]))) {
48 return std::array{solution.first, std::numeric_limits<double>::max()};
52 return std::array<double , 2>{};
56 const Acts::BoundTrackParameters& boundPars,
57 const double cylinderR,
58 const Acts::Direction dir) {
65 const double solution = (dir == Acts::Direction::Forward() ? paths[0] :
66 paths[0] < 0 ? paths[0] : paths[1]);
68 if ( (solution < 0. && dir == Acts::Direction::Forward()) ||
69 (solution > 0. && dir == Acts::Direction::Backward())) {
72 auto outSurface = Acts::Surface::makeShared<Acts::CylinderSurface>(Acts::Transform3::Identity(),
73 cylinderR, halfLength);
74 const Amg::Vector3D globPos = boundPars.position(tgContext) + solution * globDir;
75 const auto locPos = outSurface->globalToLocal(tgContext, globPos);
79 Acts::BoundVector outPars{boundPars.parameters()};
80 outPars[Acts::eBoundLoc0] = (*locPos)[Acts::eX];
81 outPars[Acts::eBoundLoc1] = (*locPos)[Acts::eY];
83 outPars[Acts::eBoundTime] += solution;
85 std::optional<Acts::BoundMatrix> cov = boundPars.covariance();
87 if (cov && outSurface->type() != boundPars.referenceSurface().type()) {
88 const Acts::BoundMatrix trf = outSurface->freeToBoundJacobian(tgContext, globPos, globDir) *
89 boundPars.referenceSurface().boundToFreeJacobian(tgContext, globPos, globDir);
90 (*cov) = trf.transpose() * (*cov) * trf;
92 return Acts::BoundTrackParameters{outSurface, outPars, cov,
93 boundPars.particleHypothesis()};
97 const Acts::BoundTrackParameters& boundPars,
98 std::span<const double> cylinderRadii,
99 const Acts::Direction dir) {
100 std::vector<Acts::BoundTrackParameters> result{};
101 result.reserve(cylinderRadii.size());
102 for (
const auto radius : cylinderRadii) {
107 result.emplace_back(std::move(*pars));
110 std::ranges::sort(result, [](
const Acts::BoundTrackParameters&
a,
111 const Acts::BoundTrackParameters& b){
112 using enum Acts::CylinderBounds::BoundValues;
113 return static_cast<const Acts::CylinderBounds&
>(
a.referenceSurface().bounds()).get(eR) <
114 static_cast<const Acts::CylinderBounds&
>(b.referenceSurface().bounds()).get(eR) ;
std::vector< Acts::BoundTrackParameters > expressOnCylinders(const Acts::GeometryContext &tgContext, const Acts::BoundTrackParameters &boundPars, std::span< const double > cylinderRadii, const Acts::Direction dir=Acts::Direction::Forward())
Propgate the track parameters to a set of cylinders.
std::array< double, 2 > cylinderIntersectPaths(const Amg::Vector3D &pos, const Amg::Vector3D &dir, const double cylinderR)
Returns the two path lengths for a track state with position and direction to intersect the cylinder ...
std::optional< Acts::BoundTrackParameters > expressOnCylinder(const Acts::GeometryContext &tgContext, const Acts::BoundTrackParameters &boundPars, const double cylinderR, const Acts::Direction dir=Acts::Direction::Forward())
Propagates the track parameters to a cylinder with radius R and expresses them as bound track paramet...