Skip to content

Commit

Permalink
refactor: Use hypot across codebase (#2109)
Browse files Browse the repository at this point in the history
Use hypot and deduplicate in Helpers and in other occasions

discovered with regex `(std::)?sqrt\((.+?) \* \2 \+`
  • Loading branch information
andiwand committed May 19, 2023
1 parent ce2f672 commit c676ece
Show file tree
Hide file tree
Showing 40 changed files with 102 additions and 122 deletions.
Binary file modified CI/physmon/reference/performance_amvf_orthogonal_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_amvf_seeded_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_amvf_truth_estimated_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_amvf_truth_smeared_hist.root
Binary file not shown.
2 changes: 1 addition & 1 deletion Core/include/Acts/Propagator/AtlasStepper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ class AtlasStepper {
P[45] *= p;
P[46] *= p;

double An = sqrt(P[4] * P[4] + P[5] * P[5]);
double An = std::hypot(P[4], P[5]);
double Ax[3];
if (An != 0.) {
Ax[0] = -P[5] / An;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "Acts/Utilities/Helpers.hpp"

#include <array>
#include <cmath>
#include <functional>

namespace Acts {
Expand Down Expand Up @@ -132,7 +133,6 @@ struct GenericDenseEnvironmentExtension {
-qop[0] * qop[0] * qop[0] * g * energy[0] /
(stepper.charge(state.stepping) * stepper.charge(state.stepping));
//~ tKi[0] = std::hypot(1, state.options.mass / initialMomentum);
using std::hypot;
tKi[0] = hypot(1, state.options.mass * qop[0]);
kQoP[0] = Lambdappi[0];
} else {
Expand All @@ -150,7 +150,6 @@ struct GenericDenseEnvironmentExtension {
-qopNew * qopNew * qopNew * g * energy[i] /
(stepper.charge(state.stepping) * stepper.charge(state.stepping) *
UnitConstants::C * UnitConstants::C);
using std::hypot;
tKi[i] = hypot(1, state.options.mass * qopNew);
kQoP[i] = Lambdappi[i];
}
Expand Down Expand Up @@ -186,17 +185,13 @@ struct GenericDenseEnvironmentExtension {
}

// Add derivative dlambda/ds = Lambda''
using std::sqrt;
state.stepping.derivative(7) =
-sqrt(state.options.mass * state.options.mass +
newMomentum * newMomentum) *
g / (newMomentum * newMomentum * newMomentum);
state.stepping.derivative(7) = -hypot(state.options.mass, newMomentum) * g /
(newMomentum * newMomentum * newMomentum);

// Update momentum
state.stepping.pars[eFreeQOverP] =
stepper.charge(state.stepping) / newMomentum;
// Add derivative dt/ds = 1/(beta * c) = sqrt(m^2 * p^{-2} + c^{-2})
using std::hypot;
state.stepping.derivative(3) = hypot(1, state.options.mass / newMomentum);
// Update time
state.stepping.pars[eFreeTime] +=
Expand Down Expand Up @@ -394,7 +389,6 @@ struct GenericDenseEnvironmentExtension {
/// @param [in] state Deliverer of configurations
template <typename propagator_state_t>
void initializeEnergyLoss(const propagator_state_t& state) {
using std::hypot;
energy[0] = hypot(initialMomentum, state.options.mass);
// use unit length as thickness to compute the energy loss per unit length
Acts::MaterialSlab slab(material, 1);
Expand Down Expand Up @@ -451,8 +445,7 @@ struct GenericDenseEnvironmentExtension {
const stepper_t& stepper, const int i) {
// Update parameters related to a changed momentum
currentMomentum = initialMomentum + h * dPds[i - 1];
using std::sqrt;
energy[i] = sqrt(currentMomentum * currentMomentum + mass * mass);
energy[i] = hypot(currentMomentum, mass);
dPds[i] = g * energy[i] / currentMomentum;
qop[i] = stepper.charge(state.stepping) / currentMomentum;
// Calculate term for later error propagation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ struct PointwiseMaterialInteraction {
NoiseUpdateMode updateMode = addNoise) {
// in forward(backward) propagation, energy decreases(increases) and
// variances increase(decrease)
const auto nextE =
std::sqrt(mass * mass + momentum * momentum) - Eloss * navDir;
const auto nextE = std::hypot(mass, momentum) - Eloss * navDir;
// put particle at rest if energy loss is too large
nextP = (mass < nextE) ? std::sqrt(nextE * nextE - mass * mass) : 0;
// minimum momentum below which we will not push particles via material
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Seeding/InternalSpacePoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ inline InternalSpacePoint<SpacePoint>::InternalSpacePoint(
m_x(globalPos.x() - offsetXY.x()),
m_y(globalPos.y() - offsetXY.y()),
m_z(globalPos.z()),
m_r(std::sqrt(m_x * m_x + m_y * m_y)),
m_r(std::hypot(m_x, m_y)),
m_varianceR(variance.x()),
m_varianceZ(variance.y()),
m_sp(sp) {}
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Seeding/SeedFinder.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ inline void SeedFinder<external_spacepoint_t, platform_t>::filterCandidates(
cotThetaB = -zB * std::sqrt(iDeltaRB2);
cotThetaT = zT * std::sqrt(iDeltaRT2);

rMxy = std::sqrt(rMTransf[0] * rMTransf[0] + rMTransf[1] * rMTransf[1]);
rMxy = std::hypot(rMTransf[0], rMTransf[1]);
float Ax = rMTransf[0] / rMxy;
float Ay = rMTransf[1] / rMxy;

Expand Down
6 changes: 3 additions & 3 deletions Core/include/Acts/Utilities/Helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ double perp(const Eigen::MatrixBase<Derived>& v) noexcept {
std::abort();
}
}
return std::sqrt(v[0] * v[0] + v[1] * v[1]);
return std::hypot(v[0], v[1]);
}

/// Calculate the theta angle (longitudinal w.r.t. z axis) of a vector
Expand All @@ -122,7 +122,7 @@ double theta(const Eigen::MatrixBase<Derived>& v) noexcept {
}
}

return std::atan2(std::sqrt(v[0] * v[0] + v[1] * v[1]), v[2]);
return std::atan2(perp(v), v[2]);
}

/// @brief Fast evaluation of trigonomic functions.
Expand All @@ -137,7 +137,7 @@ static inline const std::array<ActsScalar, 5> evaluateTrigonomics(
const ActsScalar z = direction(2); // == cos(theta)
// can be turned into cosine/sine
const ActsScalar cosTheta = z;
const ActsScalar sinTheta = std::sqrt(x * x + y * y);
const ActsScalar sinTheta = std::hypot(x, y);
const ActsScalar invSinTheta = 1. / sinTheta;
const ActsScalar cosPhi = x * invSinTheta;
const ActsScalar sinPhi = y * invSinTheta;
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>::fitImpl(
currentVtxInfo.oldPosition = currentVtx->fullPosition();

Vector4 dist = currentVtxInfo.oldPosition - currentVtxInfo.linPoint;
double perpDist = std::sqrt(dist[0] * dist[0] + dist[1] * dist[1]);
double perpDist = std::hypot(dist[0], dist[1]);
// Determine if relinearization is needed
if (perpDist > m_cfg.maxDistToLinPoint) {
// Relinearization needed, distance too big
Expand Down
4 changes: 2 additions & 2 deletions Core/src/Material/Interactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ float Acts::computeEnergyLossRadiative(const MaterialSlab& slab, int pdg,
// particle momentum and energy
// do not need to care about the sign since it is only used squared
const auto momentum = q / qOverP;
const auto energy = std::sqrt(m * m + momentum * momentum);
const auto energy = std::hypot(m, momentum);

auto dEdx = computeBremsstrahlungLossMean(m, energy);
if (((pdg == PdgParticle::eMuon) or (pdg == PdgParticle::eAntiMuon)) and
Expand All @@ -406,7 +406,7 @@ float Acts::deriveEnergyLossRadiativeQOverP(const MaterialSlab& slab, int pdg,
// particle momentum and energy
// do not need to care about the sign since it is only used squared
const auto momentum = q / qOverP;
const auto energy = std::sqrt(m * m + momentum * momentum);
const auto energy = std::hypot(m, momentum);

// compute derivative w/ respect to energy.
auto derE = deriveBremsstrahlungLossMeanE(m);
Expand Down
6 changes: 3 additions & 3 deletions Core/src/Propagator/detail/CovarianceEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ FreeToBoundMatrix freeToCurvilinearJacobian(const Vector3& direction) {
const double z = direction(2); // == cos(theta)
// can be turned into cosine/sine
const double cosTheta = z;
const double sinTheta = sqrt(x * x + y * y);
const double sinTheta = std::hypot(x, y);
const double invSinTheta = 1. / sinTheta;
const double cosPhi = x * invSinTheta;
const double sinPhi = y * invSinTheta;
Expand All @@ -52,7 +52,7 @@ FreeToBoundMatrix freeToCurvilinearJacobian(const Vector3& direction) {
} else {
// Under grazing incidence to z, the above coordinate system definition
// becomes numerically unstable, and we need to switch to another one
const double c = sqrt(y * y + z * z);
const double c = std::hypot(y, z);
const double invC = 1. / c;
jacToCurv(0, 1) = -z * invC;
jacToCurv(0, 2) = y * invC;
Expand Down Expand Up @@ -232,7 +232,7 @@ void reinitializeJacobians(FreeMatrix& freeTransportJacobian,
const double z = direction(2); // == cos(theta)
// can be turned into cosine/sine
const double cosTheta = z;
const double sinTheta = sqrt(x * x + y * y);
const double sinTheta = std::hypot(x, y);
const double invSinTheta = 1. / sinTheta;
const double cosPhi = x * invSinTheta;
const double sinPhi = y * invSinTheta;
Expand Down
2 changes: 1 addition & 1 deletion Core/src/Propagator/detail/JacobianEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ FreeToBoundMatrix freeToCurvilinearJacobian(const Vector3& direction) {
const ActsScalar x = direction(0); // == cos(phi) * sin(theta)
const ActsScalar y = direction(1); // == sin(phi) * sin(theta)
const ActsScalar z = direction(2); // == cos(theta)
const ActsScalar c = std::sqrt(y * y + z * z);
const ActsScalar c = std::hypot(y, z);
const ActsScalar invC = 1. / c;
freeToCurvJacobian(eBoundLoc0, eFreePos1) = -z * invC;
freeToCurvJacobian(eBoundLoc0, eFreePos2) = y * invC;
Expand Down
7 changes: 3 additions & 4 deletions Core/src/Surfaces/DiscSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,8 @@ Acts::Vector2 Acts::DiscSurface::localPolarToCartesian(

Acts::Vector2 Acts::DiscSurface::localCartesianToPolar(
const Vector2& lcart) const {
return Vector2(sqrt(lcart[eBoundLoc0] * lcart[eBoundLoc0] +
lcart[eBoundLoc1] * lcart[eBoundLoc1]),
atan2(lcart[eBoundLoc1], lcart[eBoundLoc0]));
return Vector2(std::hypot(lcart[eBoundLoc0], lcart[eBoundLoc1]),
std::atan2(lcart[eBoundLoc1], lcart[eBoundLoc0]));
}

Acts::BoundToFreeMatrix Acts::DiscSurface::boundToFreeJacobian(
Expand Down Expand Up @@ -251,7 +250,7 @@ Acts::FreeToBoundMatrix Acts::DiscSurface::freeToBoundJacobian(
const double z = direction(2); // == cos(theta)
// can be turned into cosine/sine
const double cosTheta = z;
const double sinTheta = sqrt(x * x + y * y);
const double sinTheta = std::hypot(x, y);
const double invSinTheta = 1. / sinTheta;
const double cosPhi = x * invSinTheta;
const double sinPhi = y * invSinTheta;
Expand Down
44 changes: 22 additions & 22 deletions Examples/Python/tests/root_file_hashes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ test_itk_seeding__particles_initial.root: 88315e93ed4cb5d40a8721502048a9d1fc100e
test_propagation__propagation_steps.root: 174301b25784dbb881196b658f2d7f99c0a2ea688a0129e6110fc19aa5cf8e54
test_material_recording__geant4_material_tracks.root: e411152d370775463c22b19a351dfc7bfe40b51985e10a7c1a010aebde80715d
test_truth_tracking_kalman[generic-0.0]__trackstates_fitter.root: 3f99b6c0e1a6bdfb339e3d162e034b72a034c9ee2d56f0579322f0915b360d8d
test_truth_tracking_kalman[generic-0.0]__tracksummary_fitter.root: 7b419d783c08e3ac7145ba64d67a08baff698c5d888fb35fef280714b727827a
test_truth_tracking_kalman[generic-0.0]__tracksummary_fitter.root: a6794a05025e86fd480d42c510d38e5de551de351b06e9f63684bed27e3113a5
test_truth_tracking_kalman[generic-0.0]__performance_track_finder.root: 7fc6f717723c9eddcbf44820b384b373cee6f04b72f79902f938f35e3ff9b470
test_truth_tracking_kalman[generic-1000.0]__trackstates_fitter.root: 8c7e4f81a2e089fb692fe262eb0100317b41f9e076fd2a03dd0df73bb74656a6
test_truth_tracking_kalman[generic-1000.0]__tracksummary_fitter.root: a15a3f361d0bbf6a1f7a43e738fd9d754bc04553ffe1e11d37a97193cb077e35
test_truth_tracking_kalman[generic-1000.0]__tracksummary_fitter.root: b533d624fd0dfe69d737c79272f157de7a8bf8bf7ad6e41485b94bffa4bb30a0
test_truth_tracking_kalman[generic-1000.0]__performance_track_finder.root: 7fc6f717723c9eddcbf44820b384b373cee6f04b72f79902f938f35e3ff9b470
test_truth_tracking_kalman[odd-0.0]__trackstates_fitter.root: ca02817b31ed69faf7679406e9c2a822320ab10309a53099ef17e7e831b390bd
test_truth_tracking_kalman[odd-0.0]__tracksummary_fitter.root: b638239caa71e0636cc1f4669544ec5a217aeeda63c69d16e90052a70db83562
test_truth_tracking_kalman[odd-0.0]__trackstates_fitter.root: e25f23687eb5ea893687f806ba202c4c4f88e003ec4e707617f6b3b17aee1143
test_truth_tracking_kalman[odd-0.0]__tracksummary_fitter.root: 88162a46905043ee3bbf7a8387e4006ee4b81a61c1788ba106c94eb99db96541
test_truth_tracking_kalman[odd-0.0]__performance_track_finder.root: 39aec6316cceb90e314e16b02947faa691c18f57c3a851a25e547a8fc05a4593
test_truth_tracking_kalman[odd-1000.0]__trackstates_fitter.root: 8dda58e1e86c4b00a8aec31b4aaf4740fc55942bb526ed9562a9f79c45283bb2
test_truth_tracking_kalman[odd-1000.0]__tracksummary_fitter.root: 11f66720a86d762e1a66a104df1e39eab9b8f4e35ad968771c26bffada10bd40
test_truth_tracking_kalman[odd-1000.0]__trackstates_fitter.root: 25dd2cd396133da19b8f320d14d673a9cc0f6c1eff81696529e7ff404cec9e39
test_truth_tracking_kalman[odd-1000.0]__tracksummary_fitter.root: 6efe3eae003bc1bd435b4407995a2f26c9eae4f918440ffa7aa535e25ab631dd
test_truth_tracking_kalman[odd-1000.0]__performance_track_finder.root: 39aec6316cceb90e314e16b02947faa691c18f57c3a851a25e547a8fc05a4593
test_truth_tracking_gsf[generic]__trackstates_gsf.root: 266c0fba7b48208277dd45da033ad3e7e7f81e316d7916ec9f9aca02ebecdd49
test_truth_tracking_gsf[generic]__tracksummary_gsf.root: 2111b760a225f67b364fcb2f5103263ea048c850bc0316748100ac387c7c75cd
test_truth_tracking_gsf[odd]__trackstates_gsf.root: 8a119fc2d0ce732a80585d990171fc5f1be4957a29303ecf9df1240248b7e8ca
test_truth_tracking_gsf[odd]__tracksummary_gsf.root: c6debe8e3a634f5b184b1380f702f9f2ad9c8bb23061d3714d8c9719d54e915e
test_truth_tracking_gsf[generic]__trackstates_gsf.root: e158422929fefae3977c73169113eb91a28f0855a4cd9bb7f8300e0a920dbc24
test_truth_tracking_gsf[generic]__tracksummary_gsf.root: 93a2f447402fe1fb0e8db9508c061b5a63dd5160eea566b8525ee1b0be467dce
test_truth_tracking_gsf[odd]__trackstates_gsf.root: 19efc9a17c2c24132e90e32f071bc1dfade2a6af3cb718033a0041a3db825d28
test_truth_tracking_gsf[odd]__tracksummary_gsf.root: 0c2934cbeebc7a21bcec6acfc35aefa0eaa2bc79dfa2b731e8f6d037422040bd
test_particle_gun__particles.root: 8549ba6e20338004ab8ba299fc65e1ee5071985b46df8f77f887cb6fef56a8ec
test_material_mapping__material-map_tracks.root: 4e1c866038f0c06b099aa74fd01c3d875f07b89f54898f90debd9b558d8e4025
test_material_mapping__propagation-material.root: 646b8e2bbacec40d0bc4132236f9ab3f03b088e656e6e9b80c47ae03eaf6eab5
Expand All @@ -46,22 +46,22 @@ test_volume_material_mapping__propagation-volume-material.root: b7597dada372d1b4
test_digitization_example__measurements.root: 96c75125b172d206f3e8c0458ace8f7e7687a5ed651dc00200d08682b5275e9d
test_digitization_example_input__particles.root: 8549ba6e20338004ab8ba299fc65e1ee5071985b46df8f77f887cb6fef56a8ec
test_digitization_example_input__measurements.root: 97d695ea55114aa3cb6c967c43e820472ceb8129afbb4f1f22bf1b3eca55ced9
test_ckf_tracks_example[generic-full_seeding]__trackstates_ckf.root: 81e77961c8aa2b45b0d9559b8158661a8fd81c3da070a511cb94ad9c49798de1
test_ckf_tracks_example[generic-full_seeding]__tracksummary_ckf.root: 2b24372052a4166c2dca2df3deb30c85491699b09b2c373da1cbcab1a7ca4db3
test_ckf_tracks_example[generic-full_seeding]__trackstates_ckf.root: 5fd202a141ca98db3c3dd9c567eecfa94aecd38099cfa8cf5d88236097824498
test_ckf_tracks_example[generic-full_seeding]__tracksummary_ckf.root: 329378d774d511a91adadd3f524f8dfc218b42a62e2072daff315951f9c62c97
test_ckf_tracks_example[generic-full_seeding]__performance_seeding_trees.root: 0e0676ffafdb27112fbda50d1cf627859fa745760f98073261dcf6db3f2f991e
test_ckf_tracks_example[generic-truth_estimated]__trackstates_ckf.root: ba3eec9c72b977f40879b5517f9f42ee186ce612aedaafcd7268b52b7751af4d
test_ckf_tracks_example[generic-truth_estimated]__tracksummary_ckf.root: d2b6780ecd666e8c55ba2ec3bfc2404ac4ffcdf6e18d1d787ecdb4f5f4af7e3a
test_ckf_tracks_example[generic-truth_estimated]__trackstates_ckf.root: 96c04ba1772465f791f8582e10b1741d3d5c8deb95bab8de36656642e5f83a45
test_ckf_tracks_example[generic-truth_estimated]__tracksummary_ckf.root: 273432afb39a1f9b93ce4efbf1f038c9b2b1a96aae7c858447405f923132f687
test_ckf_tracks_example[generic-truth_estimated]__performance_seeding.root: 1facb05c066221f6361b61f015cdf0918e94d9f3fce2269ec7b6a4dffeb2bc7e
test_ckf_tracks_example[generic-truth_smeared]__trackstates_ckf.root: 07ead78560081f1d8c0d62b9fe380bf1d2d706eab0e444f5c0c4636c25cf4379
test_ckf_tracks_example[generic-truth_smeared]__tracksummary_ckf.root: 1824382dff1fa4c3b08ee2a42f008df3dd7647cbb67f11dacd7dd5136956fe97
test_ckf_tracks_example[odd-full_seeding]__trackstates_ckf.root: 5ebd1df3fa885e1c30f16093e06efedd346e0050025c037a63aec6da2c43d095
test_ckf_tracks_example[odd-full_seeding]__tracksummary_ckf.root: 7ee63de00941cfb690a5ac1cae4fff835c389896749e8aebe78cf877b401088c
test_ckf_tracks_example[generic-truth_smeared]__trackstates_ckf.root: 5dd89134280d06beb6866242c8091f2494bcc93bb37cc19bdd3573afe4fc622c
test_ckf_tracks_example[generic-truth_smeared]__tracksummary_ckf.root: 74c86d8b88874d936250dad90aa7a650cb6f4085c12583381923d31baca7c8a2
test_ckf_tracks_example[odd-full_seeding]__trackstates_ckf.root: f425ecd386cb32bcd7fe72f64a6e05414398cd2f07e709953c2d80cb4b0785c4
test_ckf_tracks_example[odd-full_seeding]__tracksummary_ckf.root: 4a258db4545e50b5a6d4cbe7705c38aafbbc11d803d9f6cf19b31aff03350bf1
test_ckf_tracks_example[odd-full_seeding]__performance_seeding_trees.root: 43c58577aafe07645e5660c4f43904efadf91d8cda45c5c04c248bbe0f59814f
test_ckf_tracks_example[odd-truth_estimated]__trackstates_ckf.root: 4780fc2e8e9d3b41ceaa8aba6954346a3acc712ce88b37a55b83595b0835863e
test_ckf_tracks_example[odd-truth_estimated]__tracksummary_ckf.root: cd4c8340933835afe42056a5f0b723fea60727706dd6c96cb4e874a3ee3318f7
test_ckf_tracks_example[odd-truth_estimated]__trackstates_ckf.root: 3e3bc5bcdde16f0ca74b35b20dcae3760d57e28eff95fa617d9e37f6dfb4bc52
test_ckf_tracks_example[odd-truth_estimated]__tracksummary_ckf.root: 0e423f659bc2fb9ead9565e883dce31c8004a107384cd524f320ad50bf8ea053
test_ckf_tracks_example[odd-truth_estimated]__performance_seeding.root: 1a36b7017e59f1c08602ef3c2cb0483c51df248f112e3780c66594110719c575
test_ckf_tracks_example[odd-truth_smeared]__trackstates_ckf.root: 90fe3960e1193f10376df536b0aa894f6f2c76c4b21cb0ec223dec68598009f3
test_ckf_tracks_example[odd-truth_smeared]__tracksummary_ckf.root: 030796542d40cf11ed17f543ceeeccd20009d47050be2bff9e534e7c6f8588fd
test_ckf_tracks_example[odd-truth_smeared]__trackstates_ckf.root: 2ec0661cd604c5e3b867a857c9aa2005e682ed95296d852e5f52a353c200b0cc
test_ckf_tracks_example[odd-truth_smeared]__tracksummary_ckf.root: 84ca3fab8275f35ae9d500e161b16a0ce9b3681fce00c3d63e24fca712d965ec
test_vertex_fitting_reading[Truth-False-100]__performance_vertexing.root: 76ef6084d758dfdfc0151ddec2170e12d73394424e3dac4ffe46f0f339ec8293
test_vertex_fitting_reading[Iterative-False-100]__performance_vertexing.root: 60372210c830a04f95ceb78c6c68a9b0de217746ff59e8e73053750c837b57eb
test_vertex_fitting_reading[Iterative-True-100]__performance_vertexing.root: e34f217d524a5051dbb04a811d3407df3ebe2cc4bb7f54f6bda0847dbd7b52c3
Expand Down
2 changes: 1 addition & 1 deletion Examples/Run/Misc/TabulateEnergyLoss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static void printHeader(std::ostream& os, const Acts::MaterialSlab& slab,

static void printLine(std::ostream& os, float mass, float momentum, float delta,
float deltaIon, float deltaRad, float sigma) {
const auto energy = std::sqrt(mass * mass + momentum * momentum);
const auto energy = std::hypot(mass, momentum);
const auto beta = momentum / energy;
const auto betaGamma = momentum / mass;
os << std::right << std::fixed << std::setprecision(precision);
Expand Down
3 changes: 2 additions & 1 deletion Examples/Scripts/MaterialMapping/materialComposition.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#include <cmath>
#include <iostream>
#include <map>
#include <string>
Expand Down Expand Up @@ -183,7 +184,7 @@ void materialComposition(const std::string& inFile, const std::string& treeName,
float x = stepX->at(is);
float y = stepY->at(is);
float z = stepZ->at(is);
float r = sqrt(x * x + y * y);
float r = std::hypot(x, y);

if (minR > r or minZ > z or maxR < r or maxZ < z) {
continue;
Expand Down

0 comments on commit c676ece

Please sign in to comment.