88 switch (bounds.type()) {
89 using enum Acts::SurfaceBounds::BoundsType;
91 using ParEnum_t = Acts::RectangleBounds::BoundValues;
92 const auto& cBounds =
static_cast<const Acts::RectangleBounds&
>(bounds);
93 return std::make_shared<Trk::RectangleBounds>(cBounds.get(ParEnum_t::eMaxX),
94 cBounds.get(ParEnum_t::eMaxY));
96 using ParEnum_t = Acts::TrapezoidBounds::BoundValues;
97 const auto& cBounds =
static_cast<const Acts::TrapezoidBounds&
>(bounds);
98 return std::make_shared<Trk::TrapezoidBounds>(cBounds.get(ParEnum_t::eHalfLengthXnegY),
99 cBounds.get(ParEnum_t::eHalfLengthXposY),
100 cBounds.get(ParEnum_t::eHalfLengthY));
102 using ParEnum_t = Acts::RadialBounds::BoundValues;
103 const auto& cBounds =
static_cast<const Acts::RadialBounds&
>(bounds);
104 return std::make_shared<Trk::DiscBounds>(cBounds.get(ParEnum_t::eMinR),
105 cBounds.get(ParEnum_t::eMaxR),
106 cBounds.get(ParEnum_t::eAveragePhi),
107 cBounds.get(ParEnum_t::eHalfPhiSector));
109 using ParEnum_t = Acts::CylinderBounds::BoundValues;
110 const auto& cBounds =
static_cast<const Acts::CylinderBounds&
>(bounds);
111 return std::make_shared<Trk::CylinderBounds>(cBounds.get(ParEnum_t::eR),
112 cBounds.get(ParEnum_t::eHalfPhiSector),
113 cBounds.get(ParEnum_t::eAveragePhi),
114 cBounds.get(ParEnum_t::eHalfLengthZ));
116 using ParEnum_t = Acts::LineBounds::BoundValues;
117 const auto& cBounds =
static_cast<const Acts::LineBounds&
>(bounds);
118 return std::make_shared<Trk::CylinderBounds>(cBounds.get(ParEnum_t::eR),
119 cBounds.get(ParEnum_t::eHalfLengthZ));
121 using ParEnum_t = Acts::DiamondBounds::BoundValues;
122 const auto& cBounds =
static_cast<const Acts::DiamondBounds&
>(bounds);
123 return std::make_shared<Trk::DiamondBounds>(cBounds.get(ParEnum_t::eHalfLengthXnegY),
124 cBounds.get(ParEnum_t::eHalfLengthXzeroY),
125 cBounds.get(ParEnum_t::eHalfLengthXposY),
126 cBounds.get(ParEnum_t::eHalfLengthYneg),
127 cBounds.get(ParEnum_t::eHalfLengthYpos));
227 std::shared_ptr<const Acts::Surface> actsSurface{};
228 Acts::BoundVector params{};
229 const Acts::GeometryContext tgContext =
m_ctxProvider.getGeometryContext(ctx);
234 }
catch (
const std::exception &e) {
235 ATH_MSG_ERROR(
"Could not find ACTS detector surface for this TrackParameter:");
241 const auto& atlasParam{atlasParameter.parameters()};
242 if (actsSurface->bounds().type() == Acts::SurfaceBounds::BoundsType::eAnnulus) {
246 auto result = actsSurface->globalToLocal(tgContext, position, atlasParameter.
momentum());
248 params << (*result)[0], (*result)[1], atlasParam[
Trk::phi0],
253 ATH_MSG_WARNING(
"Unable to convert annulus surface - globalToLocal failed");
261 std::optional<Acts::BoundMatrix> cov{};
262 if (atlasParameter.covariance()) {
263 cov = Acts::BoundMatrix::Identity();
264 cov->topLeftCorner(5, 5) = *atlasParameter.covariance();
269 for (
int i = 0; i < cov->rows(); ++i) {
270 (*cov)(i, 4) = (*cov)(i, 4) / 1_MeV;
272 for (
int i = 0; i < cov->cols(); ++i) {
273 (*cov)(4, i) = (*cov)(4, i) / 1_MeV;
276 return Acts::BoundTrackParameters{std::move(actsSurface), params, std::move(cov),
281 const Acts::BoundTrackParameters& actsParameter)
const {
285 if (actsParameter.covariance()) {
286 AmgSymMatrix(5) newcov(actsParameter.covariance()->topLeftCorner<5, 5>());
288 for (
int i = 0; i < newcov.rows(); i++) {
289 newcov(i, 4) = newcov(i, 4) * 1_MeV;
291 for (
int i = 0; i < newcov.cols(); i++) {
292 newcov(4, i) = newcov(4, i) * 1_MeV;
297 const Acts::Surface &actsSurface = actsParameter.referenceSurface();
299 switch (actsSurface.type()) {
300 case Acts::Surface::SurfaceType::Cone: {
301 const auto &coneSurface =
static_cast<const Trk::ConeSurface&
>(*trkSurface);
302 return std::make_unique<Trk::AtaCone>(
303 actsParameter.get<Acts::eBoundLoc0>(),
304 actsParameter.get<Acts::eBoundLoc1>(),
305 actsParameter.get<Acts::eBoundPhi>(),
306 actsParameter.get<Acts::eBoundTheta>(),
307 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, coneSurface, cov);
308 }
case Acts::Surface::SurfaceType::Cylinder: {
310 return std::make_unique<Trk::AtaCylinder>(
311 actsParameter.get<Acts::eBoundLoc0>(),
312 actsParameter.get<Acts::eBoundLoc1>(),
313 actsParameter.get<Acts::eBoundPhi>(),
314 actsParameter.get<Acts::eBoundTheta>(),
315 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, cylSurface, cov);
316 }
case Acts::Surface::SurfaceType::Disc: {
319 return std::make_unique<Trk::AtaDisc>(
320 actsParameter.get<Acts::eBoundLoc0>(),
321 actsParameter.get<Acts::eBoundLoc1>(),
322 actsParameter.get<Acts::eBoundPhi>(),
323 actsParameter.get<Acts::eBoundTheta>(),
324 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, discSurface, cov);
326 const Acts::GeometryContext tgContext =
m_ctxProvider.getGeometryContext(ctx);
329 auto helperSurface = Acts::Surface::makeShared<Acts::PlaneSurface>(planeSurface.transform());
331 auto covpc = actsParameter.covariance().value();
333 Acts::FreeVector freePars = Acts::transformBoundToFreeParameters(actsSurface, tgContext,
334 actsParameter.parameters());
337 Acts::BoundVector targetPars = Acts::transformFreeToBoundParameters(freePars,
338 *helperSurface, tgContext).value();
341 Acts::FreeMatrix freeTransportJacobian{Acts::FreeMatrix::Identity()};
343 Acts::FreeVector freeToPathDerivatives{Acts::FreeVector::Zero()};
344 freeToPathDerivatives.head<3>() = freePars.segment<3>(Acts::eFreeDir0);
346 auto boundToFreeJacobian = actsSurface.boundToFreeJacobian(tgContext,
347 freePars.segment<3>(Acts::eFreePos0),
348 freePars.segment<3>(Acts::eFreeDir0));
350 Acts::BoundMatrix boundToBoundJac =
351 Acts::detail::boundToBoundTransportJacobian(tgContext, freePars,
352 boundToFreeJacobian, freeTransportJacobian,
353 freeToPathDerivatives, *helperSurface);
355 Acts::BoundMatrix targetCov{boundToBoundJac * covpc * boundToBoundJac.transpose()};
357 return std::make_unique<Trk::AtaPlane>(
358 targetPars[Acts::eBoundLoc0], targetPars[Acts::eBoundLoc1],
359 targetPars[Acts::eBoundPhi], targetPars[Acts::eBoundTheta],
360 targetPars[Acts::eBoundQOverP] * 1_MeV, planeSurface,
361 targetCov.topLeftCorner<5, 5>());
363 throw std::domain_error(
"Acts::DiscSurface is not associated with ATLAS disc or plane surface");
366 }
case Acts::Surface::SurfaceType::Perigee: {
368 return std::make_unique<Trk::Perigee>(
369 actsParameter.get<Acts::eBoundLoc0>(),
370 actsParameter.get<Acts::eBoundLoc1>(),
371 actsParameter.get<Acts::eBoundPhi>(),
372 actsParameter.get<Acts::eBoundTheta>(),
373 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, perSurface, cov);
374 }
case Acts::Surface::SurfaceType::Plane: {
376 return std::make_unique<Trk::AtaPlane>(
377 actsParameter.get<Acts::eBoundLoc0>(),
378 actsParameter.get<Acts::eBoundLoc1>(),
379 actsParameter.get<Acts::eBoundPhi>(),
380 actsParameter.get<Acts::eBoundTheta>(),
381 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, plaSurface, cov);
382 }
case Acts::Surface::SurfaceType::Straw: {
384 return std::make_unique<Trk::AtaStraightLine>(
385 actsParameter.get<Acts::eBoundLoc0>(),
386 actsParameter.get<Acts::eBoundLoc1>(),
387 actsParameter.get<Acts::eBoundPhi>(),
388 actsParameter.get<Acts::eBoundTheta>(),
389 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, lineSurface, cov);
390 }
case Acts::Surface::SurfaceType::Curvilinear: {
391 const Acts::GeometryContext tgContext =
m_ctxProvider.getGeometryContext(ctx);
392 return std::make_unique<Trk::CurvilinearParameters>(
393 actsParameter.position(tgContext), actsParameter.get<Acts::eBoundPhi>(),
394 actsParameter.get<Acts::eBoundTheta>(),
395 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, cov);
396 }
case Acts::Surface::SurfaceType::Point:
397 case Acts::Surface::SurfaceType::Other: {
401 throw std::domain_error(
"Surface type not found");