Take care of unit conversion between the two.
275 using namespace Acts::UnitLiterals;
277 if (actsParameter.covariance()) {
279 newcov(actsParameter.covariance()->topLeftCorner<5, 5>());
281 for (
int i = 0;
i < newcov.
rows();
i++) {
282 newcov(
i, 4) = newcov(
i, 4) * 1_MeV;
284 for (
int i = 0;
i < newcov.cols();
i++) {
285 newcov(4,
i) = newcov(4,
i) * 1_MeV;
287 cov = std::optional<AmgSymMatrix(5)>(newcov);
290 const Acts::Surface &actsSurface = actsParameter.referenceSurface();
292 switch (actsSurface.type()) {
298 return std::make_unique<Trk::AtaCone>(
299 actsParameter.get<Acts::eBoundLoc0>(),
300 actsParameter.get<Acts::eBoundLoc1>(),
301 actsParameter.get<Acts::eBoundPhi>(),
302 actsParameter.get<Acts::eBoundTheta>(),
303 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, coneSurface,
cov);
311 return std::make_unique<Trk::AtaCylinder>(
312 actsParameter.get<Acts::eBoundLoc0>(),
313 actsParameter.get<Acts::eBoundLoc1>(),
314 actsParameter.get<Acts::eBoundPhi>(),
315 actsParameter.get<Acts::eBoundTheta>(),
316 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, cylSurface,
cov);
322 discSurface !=
nullptr) {
323 return std::make_unique<Trk::AtaDisc>(
324 actsParameter.get<Acts::eBoundLoc0>(),
325 actsParameter.get<Acts::eBoundLoc1>(),
326 actsParameter.get<Acts::eBoundPhi>(),
327 actsParameter.get<Acts::eBoundTheta>(),
328 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, *discSurface,
cov);
329 }
else if (
const auto *planeSurface =
332 planeSurface !=
nullptr) {
334 auto helperSurface = Acts::Surface::makeShared<Acts::PlaneSurface>(
335 planeSurface->transform());
337 auto covpc = actsParameter.covariance().value();
339 Acts::FreeVector freePars =
340 Acts::transformBoundToFreeParameters(
341 actsSurface, gctx, actsParameter.parameters());
343 Acts::BoundVector targetPars =
344 Acts::transformFreeToBoundParameters(freePars,
345 *helperSurface, gctx)
348 Acts::FreeMatrix freeTransportJacobian = Acts::FreeMatrix::Identity();
351 freeToPathDerivatives.head<3>() = freePars.segment<3>(Acts::eFreeDir0);
353 auto boundToFreeJacobian = actsSurface.boundToFreeJacobian(
354 gctx, freePars.segment<3>(Acts::eFreePos0),
355 freePars.segment<3>(Acts::eFreeDir0));
357 Acts::BoundMatrix boundToBoundJac = Acts::detail::boundToBoundTransportJacobian(
358 gctx, freePars, boundToFreeJacobian, freeTransportJacobian,
359 freeToPathDerivatives, *helperSurface);
361 Acts::BoundMatrix targetCov =
362 boundToBoundJac * covpc * boundToBoundJac.transpose();
364 auto pars = std::make_unique<Trk::AtaPlane>(
365 targetPars[Acts::eBoundLoc0], targetPars[Acts::eBoundLoc1],
366 targetPars[Acts::eBoundPhi], targetPars[Acts::eBoundTheta],
367 targetPars[Acts::eBoundQOverP] * 1_MeV, *planeSurface,
368 targetCov.topLeftCorner<5, 5>());
371 ActsTrackParameterCheck(actsParameter, gctx, covpc, targetPars,
372 targetCov, planeSurface);
378 throw std::runtime_error{
379 "Acts::DiscSurface is not associated with ATLAS disc or plane "
384 case Acts::Surface::SurfaceType::Perigee: {
386 return std::make_unique<Trk::Perigee>(
387 actsParameter.get<Acts::eBoundLoc0>(),
388 actsParameter.get<Acts::eBoundLoc1>(),
389 actsParameter.get<Acts::eBoundPhi>(),
390 actsParameter.get<Acts::eBoundTheta>(),
391 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, perSurface,
cov);
399 return std::make_unique<Trk::AtaPlane>(
400 actsParameter.get<Acts::eBoundLoc0>(),
401 actsParameter.get<Acts::eBoundLoc1>(),
402 actsParameter.get<Acts::eBoundPhi>(),
403 actsParameter.get<Acts::eBoundTheta>(),
404 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, plaSurface,
cov);
411 return std::make_unique<Trk::AtaStraightLine>(
412 actsParameter.get<Acts::eBoundLoc0>(),
413 actsParameter.get<Acts::eBoundLoc1>(),
414 actsParameter.get<Acts::eBoundPhi>(),
415 actsParameter.get<Acts::eBoundTheta>(),
416 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, lineSurface,
cov);
420 return std::make_unique<Trk::CurvilinearParameters>(
421 actsParameter.position(gctx), actsParameter.get<Acts::eBoundPhi>(),
422 actsParameter.get<Acts::eBoundTheta>(),
423 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV,
cov);
426 case Acts::Surface::SurfaceType::Other: {
431 throw std::domain_error(
"Surface type not found");