Skip to content

Commit

Permalink
fix: Remove unit C (#2142)
Browse files Browse the repository at this point in the history
Not sure what this is and why it was there in this place?

**Note**
This contains a very odd fix for a problem I was facing in the integration test which compares the analytical covariance with the numerical one. For some reason the numerical derivative breaks down in the case where we step towards a surface which is 1 cm away with a single step. Using 0.9 cm it works because it will do a second step which seems to provide the necessary accuracy for the differential quotient.
This is not pretty and I would like to take a second look why a single step is not sufficient in this case.
  • Loading branch information
andiwand committed Jul 8, 2023
1 parent 5b1de63 commit d0ad664
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Core/include/Acts/Definitions/Units.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ constexpr double g = 1.0 / 1.782662e-24;
constexpr double kg = 1.0 / 1.782662e-27;
// Charge, native unit e (elementary charge)
constexpr double e = 1.0;
constexpr double C = J / eV;
// Magnetic field, native unit GeV/(e*mm)
constexpr double T = 0.000299792458; // equivalent to c in appropriate SI units
constexpr double Gauss = 1e-4 * T;
Expand Down Expand Up @@ -240,7 +239,6 @@ ACTS_DEFINE_UNIT_LITERAL(u)
ACTS_DEFINE_UNIT_LITERAL(g)
ACTS_DEFINE_UNIT_LITERAL(kg)
ACTS_DEFINE_UNIT_LITERAL(e)
ACTS_DEFINE_UNIT_LITERAL(C)
ACTS_DEFINE_UNIT_LITERAL(T)
ACTS_DEFINE_UNIT_LITERAL(Gauss)
ACTS_DEFINE_UNIT_LITERAL(kGauss)
Expand All @@ -253,6 +251,8 @@ ACTS_DEFINE_UNIT_LITERAL(mol)
///
/// Unit constants are intentionally not listed.
namespace PhysicalConstants {
// Speed of light
constexpr double c = 1.0;
/// Reduced Planck constant h/2*pi.
///
/// Computed from CODATA 2018 constants to double precision.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ struct GenericDenseEnvironmentExtension {
(stepper.direction(state.stepping) + h * kprev).cross(bField);
// Evaluate k_i for the time propagation
auto qopNew = qop[0] + h * Lambdappi[i - 1];
Lambdappi[i] = -qopNew * qopNew * qopNew * g * energy[i] /
(q * q * UnitConstants::C * UnitConstants::C);
Lambdappi[i] = -qopNew * qopNew * qopNew * g * energy[i] / (q * q);
tKi[i] = hypot(1, state.options.mass * qopNew);
kQoP[i] = Lambdappi[i];
}
Expand Down
1 change: 0 additions & 1 deletion Examples/Python/src/Base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ void addUnits(Context& ctx) {
UNIT(g)
UNIT(kg)
UNIT(e)
UNIT(C)
UNIT(T)
UNIT(Gauss)
UNIT(kGauss)
Expand Down
2 changes: 1 addition & 1 deletion Tests/IntegrationTests/PropagationTests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ inline std::pair<Acts::BoundTrackParameters, double> transportToSurface(
options_t<Actions, Aborts> options(geoCtx, magCtx);
options.direction = Acts::Direction::Forward;
options.pathLimit = pathLimit;
options.maxStepSize = 1_cm;
options.maxStepSize = 0.9_cm;

auto result = propagator.propagate(initialParams, targetSurface, options);
BOOST_CHECK(result.ok());
Expand Down
10 changes: 5 additions & 5 deletions Tests/UnitTests/Core/Definitions/UnitsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ BOOST_AUTO_TEST_CASE(DecayWidthTime) {
CHECK_CLOSE_REL(hbar / 1.42_GeV, 4.635295432723526e-10_fs, 1e-7);
}

BOOST_AUTO_TEST_CASE(Charge) {
CHECK_CLOSE_REL(1_C, 6.241509074460763e18_e, eps);
}

BOOST_AUTO_TEST_CASE(MagneticField) {
CHECK_CLOSE_REL(10_kGauss, 1_T, eps);
CHECK_CLOSE_REL(1_kGauss, 1000_Gauss, eps);
Expand All @@ -128,10 +124,14 @@ BOOST_AUTO_TEST_CASE(MomentumRadius) {
}

BOOST_AUTO_TEST_CASE(PhysicalConstants) {
using namespace Acts::PhysicalConstants;
using Acts::PhysicalConstants::hbar;
// see https://en.wikipedia.org/wiki/Planck_constant
CHECK_CLOSE_REL(hbar, 6.62607015e-34 * 1_J * 1_s / (2 * M_PI), 1e-6);
CHECK_CLOSE_REL(hbar, 4.135667696e-15 * 1_eV * 1_s / (2 * M_PI), 1e-7);

using Acts::PhysicalConstants::c;
// we really want c to be 1
BOOST_CHECK(c == 1.0);
}

BOOST_AUTO_TEST_SUITE_END()

0 comments on commit d0ad664

Please sign in to comment.