4#ifndef ACTSINTEROPS_UNITCONVERTER_H
5#define ACTSINTEROPS_UNITCONVERTER_H
9#include "GaudiKernel/SystemOfUnits.h"
12#include "Acts/Definitions/Units.hpp"
13#include "Acts/Definitions/Algebra.hpp"
14#include "Acts/Definitions/Common.hpp"
15#include "Acts/Utilities/MathHelpers.hpp"
24 using namespace Acts::UnitLiterals;
25 constexpr double energyCnv = 1_MeV / Gaudi::Units::MeV;
26 return energyCnv * athenaE;
31 using namespace Acts::UnitLiterals;
32 constexpr double energyCnv = Gaudi::Units::MeV / 1_MeV;
33 return energyCnv * actsE;
38 using namespace Acts::UnitLiterals;
39 constexpr double lengthCnv = 1_mm / Gaudi::Units::mm;
40 return lengthCnv * athenaL;
45 using namespace Acts::UnitLiterals;
46 constexpr double lengthCnv = Gaudi::Units::mm / 1_mm;
47 return lengthCnv * actsL;
51 template <std::
floating_po
int T>
53 using namespace Acts::UnitLiterals;
54 constexpr auto timeCnv =
static_cast<T
>(1_ns / Gaudi::Units::ns);
55 return timeCnv * athenaT;
59 template <std::
floating_po
int T>
61 using namespace Acts::UnitLiterals;
62 constexpr auto timeCnv =
static_cast<T
>(Gaudi::Units::ns/ 1_ns);
63 return timeCnv * actsT;
67 template <std::
floating_po
int T>
69 using namespace Acts::UnitLiterals;
70 constexpr auto sqr=[](
double a) {
return a*
a;};
71 constexpr auto timeCnv =
static_cast<T
>(
sqr(1_ns / Gaudi::Units::ns));
72 return timeCnv * athenaTCov;
76 template <std::
floating_po
int T>
78 using namespace Acts::UnitLiterals;
79 constexpr auto sqr=[](
double a) {
return a*
a;};
80 constexpr auto timeCnv =
static_cast<T
>(
sqr(Gaudi::Units::ns/ 1_ns));
81 return timeCnv * actsTCov;
107 const double athenaTime =0.) {
108 Acts::Vector4 pos{Acts::Vector4::Zero()};
123 return std::make_pair(std::move(pos),
timeToAthena(actsPos[Acts::eTime]));
130 using namespace Acts::UnitLiterals;
131 Acts::Vector4 fourMom{Acts::Vector4::Zero()};
132 fourMom[Acts::eEnergy] =
energyToActs(std::sqrt(threeMom.dot(threeMom) + mass*mass));
146 return std::make_pair(std::move(threeMom),
energyToAthena(actsMom[Acts::eEnergy]));
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
constexpr double energyToActs(const double athenaE)
Converts an energy scalar from Athena to Acts units.
constexpr double lengthToActs(const double athenaL)
Converts a length scalar from Acts to Athena units.
constexpr double velocityToActs(const double athenaV)
Converts a velocity from Athena to Acts units.
constexpr double accelerationToActs(const double athenaA)
Converts an acceleration from Athena to Acts units.
Amg::Vector3D convertDirFromActs(const Acts::Vector3 &actsDir)
Converts a direction vector from acts units into athena units.
constexpr auto timeCovToActs(T athenaTCov)
Converts a time covariance element from Athena to Acts units.
constexpr double energyToAthena(const double actsE)
Converts an energy scalar from Acts to Athena units.
std::pair< Amg::Vector3D, double > convertMomFromActs(const Acts::Vector4 &actsMom)
Converts an Acts four-momentum vector into an pair of an Athena three-momentum and the paritcle's ene...
constexpr double timeCovToAthena(T actsTCov)
Converts a time covariance element from Acts to Athena units.
constexpr double timeToAthena(T actsT)
Converts a time unit from Acts to Athena units.
std::pair< Amg::Vector3D, double > convertPosFromActs(const Acts::Vector4 &actsPos)
Converts an Acts 4-vector into a pair of an Athena spatial vector and the passed time.
constexpr double lengthToAthena(const double actsL)
Converts a length scalar from Acts to Athena units.
constexpr auto timeToActs(T athenaT)
Converts a time unit from Athena to Acts units.
Acts::Vector4 convertMomToActs(const Amg::Vector3D &threeMom, const double mass=0.)
Converts a three momentum vector from Athena together with the associated particle mass into an Acts ...
Acts::Vector3 convertDirToActs(const Amg::Vector3D &athenaDir)
Converts a direction vector from athena units into acts units.
Acts::Vector4 convertPosToActs(const Amg::Vector3D &athenaPos, const double athenaTime=0.)
Converts a position vector & time from Athena units into Acts units.
Eigen::Matrix< double, 3, 1 > Vector3D