Skip to content

Commit

Permalink
Merge branch 'main' into numbers-const
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger authored Oct 28, 2024
2 parents e8e1c0e + 4a3d715 commit 29c9ca8
Show file tree
Hide file tree
Showing 21 changed files with 89 additions and 97 deletions.
15 changes: 8 additions & 7 deletions Core/include/Acts/Seeding/SeedFinderGbts.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void SeedFinderGbts<external_spacepoint_t>::runGbts_TrackFinder(
.m_phiSliceWidth; // the default sliding window along phi

if (m_config.m_useEtaBinning) {
deltaPhi = 0.001f + m_maxCurv * std::fabs(rb2 - rb1);
deltaPhi = 0.001f + m_maxCurv * std::abs(rb2 - rb1);
}

unsigned int first_it = 0;
Expand Down Expand Up @@ -219,7 +219,7 @@ void SeedFinderGbts<external_spacepoint_t>::runGbts_TrackFinder(

float dz = z2 - z1;
float tau = dz / dr;
float ftau = std::fabs(tau);
float ftau = std::abs(tau);
if (ftau > 36.0) {
continue;
}
Expand Down Expand Up @@ -288,17 +288,18 @@ void SeedFinderGbts<external_spacepoint_t>::runGbts_TrackFinder(
float tau2 = edgeStorage.at(n2_in_idx).m_p[0];
float tau_ratio = tau2 * uat_1 - 1.0f;

if (std::fabs(tau_ratio) >
m_config.cut_tau_ratio_max) { // bad
// match
// bad match
if (std::abs(tau_ratio) > m_config.cut_tau_ratio_max) {
continue;
}
isGood = true; // good match found

// good match found
isGood = true;
break;
}
}
if (!isGood) {
continue; // no moatch found, skip creating [n1 <- n2] edge
continue; // no match found, skip creating [n1 <- n2] edge
}

float curv = D * std::sqrt(L2); // signed curvature
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ bool SeedFinderOrthogonal<external_spacepoint_t>::validTuple(
* Cut: Ensure that the forward angle (z / r) lies within reasonable bounds,
* which is to say the absolute value must be smaller than the max cot(θ).
*/
if (std::fabs(cotTheta) > m_config.cotThetaMax) {
if (std::abs(cotTheta) > m_config.cotThetaMax) {
return false;
}

Expand Down
10 changes: 5 additions & 5 deletions Core/src/MagneticField/BFieldMapUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ Acts::fieldMapRZ(
double zMax = zPos[nBinsZ - 1];
// calculate maxima (add one last bin, because bin value always corresponds to
// left boundary)
double stepZ = std::fabs(zMax - zMin) / (nBinsZ - 1);
double stepR = std::fabs(rMax - rMin) / (nBinsR - 1);
double stepZ = std::abs(zMax - zMin) / (nBinsZ - 1);
double stepR = std::abs(rMax - rMin) / (nBinsR - 1);
rMax += stepR;
zMax += stepZ;
if (firstQuadrant) {
Expand Down Expand Up @@ -172,9 +172,9 @@ Acts::fieldMapXYZ(
double zMax = zPos[nBinsZ - 1];
// calculate maxima (add one last bin, because bin value always corresponds to
// left boundary)
double stepZ = std::fabs(zMax - zMin) / (nBinsZ - 1);
double stepY = std::fabs(yMax - yMin) / (nBinsY - 1);
double stepX = std::fabs(xMax - xMin) / (nBinsX - 1);
double stepZ = std::abs(zMax - zMin) / (nBinsZ - 1);
double stepY = std::abs(yMax - yMin) / (nBinsY - 1);
double stepX = std::abs(xMax - xMin) / (nBinsX - 1);
xMax += stepX;
yMax += stepY;
zMax += stepZ;
Expand Down
10 changes: 5 additions & 5 deletions Core/src/Material/MaterialGridHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Acts::Grid2D Acts::createGrid(Acts::MaterialGridAxisData gridAxis1,
// calculate maxima (add one last bin, because bin value always corresponds
// to
// left boundary)
double stepAxis1 = std::fabs(maxAxis1 - minAxis1) / (nBinsAxis1 - 1);
double stepAxis2 = std::fabs(maxAxis2 - minAxis2) / (nBinsAxis2 - 1);
double stepAxis1 = std::abs(maxAxis1 - minAxis1) / (nBinsAxis1 - 1);
double stepAxis2 = std::abs(maxAxis2 - minAxis2) / (nBinsAxis2 - 1);
maxAxis1 += stepAxis1;
maxAxis2 += stepAxis2;

Expand Down Expand Up @@ -64,11 +64,11 @@ Acts::Grid3D Acts::createGrid(Acts::MaterialGridAxisData gridAxis1,
// to
// left boundary)
double stepAxis1 =
std::fabs(maxAxis1 - minAxis1) / std::max(nBinsAxis1 - 1, std::size_t{1});
std::abs(maxAxis1 - minAxis1) / std::max(nBinsAxis1 - 1, std::size_t{1});
double stepAxis2 =
std::fabs(maxAxis2 - minAxis2) / std::max(nBinsAxis2 - 1, std::size_t{1});
std::abs(maxAxis2 - minAxis2) / std::max(nBinsAxis2 - 1, std::size_t{1});
double stepAxis3 =
std::fabs(maxAxis3 - minAxis3) / std::max(nBinsAxis3 - 1, std::size_t{1});
std::abs(maxAxis3 - minAxis3) / std::max(nBinsAxis3 - 1, std::size_t{1});
maxAxis1 += stepAxis1;
maxAxis2 += stepAxis2;
maxAxis3 += stepAxis3;
Expand Down
10 changes: 5 additions & 5 deletions Core/src/Material/MaterialMapUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ auto Acts::materialMapperRZ(
double zMax = *minMaxZ.second;
// calculate maxima (add one last bin, because bin value always corresponds to
// left boundary)
double stepZ = std::fabs(zMax - zMin) / (nBinsZ - 1);
double stepR = std::fabs(rMax - rMin) / (nBinsR - 1);
double stepZ = std::abs(zMax - zMin) / (nBinsZ - 1);
double stepR = std::abs(rMax - rMin) / (nBinsR - 1);
rMax += stepR;
zMax += stepZ;

Expand Down Expand Up @@ -156,9 +156,9 @@ auto Acts::materialMapperXYZ(
double zMax = *minMaxZ.second;
// calculate maxima (add one last bin, because bin value always corresponds to
// left boundary)
double stepZ = std::fabs(zMax - zMin) / (nBinsZ - 1);
double stepY = std::fabs(yMax - yMin) / (nBinsY - 1);
double stepX = std::fabs(xMax - xMin) / (nBinsX - 1);
double stepZ = std::abs(zMax - zMin) / (nBinsZ - 1);
double stepY = std::abs(yMax - yMin) / (nBinsY - 1);
double stepX = std::abs(xMax - xMin) / (nBinsX - 1);
xMax += stepX;
yMax += stepY;
zMax += stepZ;
Expand Down
4 changes: 2 additions & 2 deletions Core/src/Surfaces/CylinderBounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ bool Acts::CylinderBounds::inside(
double localx =
lposition[0] > radius ? 2 * radius - lposition[0] : lposition[0];
Vector2 shiftedlposition = shifted(lposition);
if ((std::fabs(shiftedlposition[0]) <= halfPhi &&
std::fabs(shiftedlposition[1]) <= halfLengthZ)) {
if ((std::abs(shiftedlposition[0]) <= halfPhi &&
std::abs(shiftedlposition[1]) <= halfLengthZ)) {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion Core/src/Surfaces/CylinderSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ double Acts::CylinderSurface::pathCorrection(
const Acts::Vector3& direction) const {
Vector3 normalT = normal(gctx, position);
double cosAlpha = normalT.dot(direction);
return std::fabs(1. / cosAlpha);
return std::abs(1. / cosAlpha);
}

const Acts::CylinderBounds& Acts::CylinderSurface::bounds() const {
Expand Down
18 changes: 9 additions & 9 deletions Core/src/Utilities/SpacePointUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ Result<void> SpacePointUtility::calculateStripSPPosition(
}

// Check if m and n can be resolved in the interval (-1, 1)
if (fabs(spParams.m) <= spParams.limit &&
fabs(spParams.n) <= spParams.limit) {
if (std::abs(spParams.m) <= spParams.limit &&
std::abs(spParams.n) <= spParams.limit) {
return Result<void>::success();
}
return Result<void>::failure(m_error);
Expand All @@ -226,7 +226,7 @@ Result<void> SpacePointUtility::recoverSpacePoint(
spParams.limit + stripLengthGapTolerance / spParams.mag_firstBtmToTop;

// Check if m is just slightly outside
if (fabs(spParams.m) > spParams.limitExtended) {
if (std::abs(spParams.m) > spParams.limitExtended) {
return Result<void>::failure(m_error);
}
// Calculate n if not performed previously
Expand All @@ -236,7 +236,7 @@ Result<void> SpacePointUtility::recoverSpacePoint(
spParams.secondBtmToTop.dot(spParams.firstBtmToTopXvtxToFirstMid2);
}
// Check if n is just slightly outside
if (fabs(spParams.n) > spParams.limitExtended) {
if (std::abs(spParams.n) > spParams.limitExtended) {
return Result<void>::failure(m_error);
}
/// The following code considers an overshoot of m and n in the same direction
Expand Down Expand Up @@ -275,8 +275,8 @@ Result<void> SpacePointUtility::recoverSpacePoint(
spParams.n -= (biggerOvershoot / secOnFirstScale);
// Check if this recovered the space point

if (fabs(spParams.m) < spParams.limit &&
fabs(spParams.n) < spParams.limit) {
if (std::abs(spParams.m) < spParams.limit &&
std::abs(spParams.n) < spParams.limit) {
return Result<void>::success();
} else {
return Result<void>::failure(m_error);
Expand All @@ -294,8 +294,8 @@ Result<void> SpacePointUtility::recoverSpacePoint(
spParams.m += biggerOvershoot;
spParams.n += (biggerOvershoot / secOnFirstScale);
// Check if this recovered the space point
if (fabs(spParams.m) < spParams.limit &&
fabs(spParams.n) < spParams.limit) {
if (std::abs(spParams.m) < spParams.limit &&
std::abs(spParams.n) < spParams.limit) {
return Result<void>::success();
}
}
Expand Down Expand Up @@ -325,7 +325,7 @@ Result<double> SpacePointUtility::calcPerpendicularProjection(
double qr = (spParams.firstBtmToTop).dot(spParams.secondBtmToTop);
double denom = spParams.firstBtmToTop.dot(spParams.firstBtmToTop) - qr * qr;
// Check for numerical stability
if (fabs(denom) > 1e-6) {
if (std::abs(denom) > 1e-6) {
// Return lambda0
return Result<double>::success(
(ac.dot(spParams.secondBtmToTop) * qr -
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct SimpleReverseFilteringLogic {

bool doBackwardFiltering(
Acts::VectorMultiTrajectory::ConstTrackStateProxy trackState) const {
auto momentum = fabs(1 / trackState.filtered()[Acts::eBoundQOverP]);
auto momentum = std::abs(1 / trackState.filtered()[Acts::eBoundQOverP]);
return (momentum <= momentumThreshold);
}
};
Expand Down
8 changes: 4 additions & 4 deletions Examples/Io/Csv/src/CsvSeedWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ ActsExamples::ProcessCode ActsExamples::CsvSeedWriter::writeT(
// Compute the distance between the truth and estimated directions
float truthPhi = phi(truthUnitDir);
float truthEta = std::atanh(std::cos(theta(truthUnitDir)));
float dEta = fabs(truthEta - seedEta);
float dPhi = fabs(truthPhi - seedPhi) < std::numbers::pi_v<float>
? fabs(truthPhi - seedPhi)
: fabs(truthPhi - seedPhi) - std::numbers::pi_v<float>;
float dEta = std::abs(truthEta - seedEta);
float dPhi = std::abs(truthPhi - seedPhi) < std::numbers::pi_v<float>
? std::abs(truthPhi - seedPhi)
: std::abs(truthPhi - seedPhi) - std::numbers::pi_v<float>;
truthDistance = sqrt(dPhi * dPhi + dEta * dEta);
// If the seed is truth matched, check if it is the closest one for the
// contributing particle
Expand Down
6 changes: 3 additions & 3 deletions Examples/Scripts/MaterialMapping/Mat_map.C
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void Draw_ratio(TCanvas* c, TProfile* h1, TProfile* h2, TLegend* leg, std::strin
h5->SetStats(0); // No statistics on lower plot
h5->Divide(h1);

double maxi = min( max( fabs(h5->GetMinimum()-0.1*h5->GetMinimum()),h5->GetMaximum()+0.1*h5->GetMaximum() ), 10. );
double maxi = min( max( std::abs(h5->GetMinimum()-0.1*h5->GetMinimum()),h5->GetMaximum()+0.1*h5->GetMaximum() ), 10. );

h5->SetMinimum( 0.5 ); // Define Y ..
h5->SetMaximum( 1.1 ); // .. range
Expand Down Expand Up @@ -145,7 +145,7 @@ void Mat_map(std::string Val = "", std::string geantino = "", std::string name =

// 2D map for Validation input
TCanvas *VM = new TCanvas("VM","Validation Map") ;
Val_file->Draw("mat_y:mat_z","fabs(mat_x)<1");
Val_file->Draw("mat_y:mat_z","std::abs(mat_x)<1");

eta_0->Draw("Same");
eta_1p->Draw("Same");
Expand Down Expand Up @@ -206,7 +206,7 @@ void Mat_map(std::string Val = "", std::string geantino = "", std::string name =

// 2D map for Geantino input
TCanvas *GM = new TCanvas("GM","Geantino Map") ;
geantino_file->Draw("mat_y:mat_z","fabs(mat_x)<1");
geantino_file->Draw("mat_y:mat_z","std::abs(mat_x)<1");

eta_0->Draw("Same");
eta_1p->Draw("Same");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct NuclearInteraction {
/// The storage of the parameterisation
detail::MultiParticleNuclearInteractionParametrisation
multiParticleParameterisation;
/// The number of trials to match momenta and inveriant masses
/// The number of trials to match momenta and invariant masses
//~ unsigned int nMatchingTrials = std::numeric_limits<unsigned int>::max();
unsigned int nMatchingTrials = 100;
unsigned int nMatchingTrialsTotal = 1000;
Expand All @@ -57,7 +57,7 @@ struct NuclearInteraction {
template <typename generator_t>
std::pair<Scalar, Scalar> generatePathLimits(generator_t& generator,
const Particle& particle) const {
// Fast exit: No paramtrization provided
// Fast exit: No parameterisation provided
if (multiParticleParameterisation.empty()) {
return std::make_pair(std::numeric_limits<Scalar>::infinity(),
std::numeric_limits<Scalar>::infinity());
Expand Down Expand Up @@ -417,7 +417,7 @@ Acts::ActsDynamicVector NuclearInteraction::sampleInvariantMasses(
for (unsigned int i = 0; i < size; i++) {
float variance = parametrisation.eigenvaluesInvariantMass[i];
std::normal_distribution<Acts::ActsScalar> dist{
parametrisation.meanInvariantMass[i], sqrtf(variance)};
parametrisation.meanInvariantMass[i], std::sqrt(variance)};
parameters[i] = dist(generator);
}
// Transform to multivariate normal distribution
Expand Down Expand Up @@ -447,7 +447,7 @@ Acts::ActsDynamicVector NuclearInteraction::sampleMomenta(
for (unsigned int i = 0; i < size; i++) {
float variance = parametrisation.eigenvaluesMomentum[i];
std::normal_distribution<Acts::ActsScalar> dist{
parametrisation.meanMomentum[i], sqrtf(variance)};
parametrisation.meanMomentum[i], std::sqrt(variance)};
parameters[i] = dist(generator);
}

Expand Down
3 changes: 2 additions & 1 deletion Plugins/DD4hep/src/ConvertDD4hepDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@ std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep(
plbConfig.layerIdentification = subDetector.name();
plbConfig.centralLayerRadii = std::vector<double>(1, 0.5 * (rMax + rMin));
plbConfig.centralLayerHalflengthZ = std::vector<double>(1, halfZ);
plbConfig.centralLayerThickness = std::vector<double>(1, fabs(rMax - rMin));
plbConfig.centralLayerThickness =
std::vector<double>(1, std::abs(rMax - rMin));
plbConfig.centralLayerMaterial = {plMaterial};
auto pcLayerBuilder = std::make_shared<const Acts::PassiveLayerBuilder>(
plbConfig, logger.clone(std::string("D2A_PL:") + subDetector.name()));
Expand Down
8 changes: 4 additions & 4 deletions Plugins/DD4hep/src/DD4hepLayerBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::endcapLayers(
// create the share disc bounds
auto dBounds = std::make_shared<const RadialBounds>(
pl.min(Acts::BinningValue::binR), pl.max(Acts::BinningValue::binR));
double thickness = std::fabs(pl.max(Acts::BinningValue::binZ) -
pl.min(Acts::BinningValue::binZ));
double thickness = std::abs(pl.max(Acts::BinningValue::binZ) -
pl.min(Acts::BinningValue::binZ));
// Create the layer containing the sensitive surface
endcapLayer = DiscLayer::create(transform, dBounds, std::move(sArray),
thickness, nullptr, Acts::active);
Expand Down Expand Up @@ -357,8 +357,8 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers(
double layerR = (pl.min(Acts::BinningValue::binR) +
pl.max(Acts::BinningValue::binR)) *
0.5;
double thickness = std::fabs(pl.max(Acts::BinningValue::binR) -
pl.min(Acts::BinningValue::binR));
double thickness = std::abs(pl.max(Acts::BinningValue::binR) -
pl.min(Acts::BinningValue::binR));
auto cBounds = std::make_shared<CylinderBounds>(layerR, halfZ);
// Create the layer containing the sensitive surface
centralLayer =
Expand Down
14 changes: 7 additions & 7 deletions Plugins/GeoModel/src/detail/GeoPolygonConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ Acts::detail::GeoPolygonConverter::operator()(
// sort based on the y-coordinate
std::ranges::sort(vertices, {}, [](const auto& v) { return v[1]; });
if (nVertices == 4) {
double hlxnegy = fabs(vertices[0][0] - vertices[1][0]) / 2;
double hlxposy = fabs(vertices[2][0] - vertices[3][0]) / 2;
double hly = fabs(vertices[0][1] - vertices[3][1]) / 2;
double hlxnegy = std::abs(vertices[0][0] - vertices[1][0]) / 2;
double hlxposy = std::abs(vertices[2][0] - vertices[3][0]) / 2;
double hly = std::abs(vertices[0][1] - vertices[3][1]) / 2;
std::vector<ActsScalar> halfLengths = {hlxnegy, hlxposy, hly};

// Create the surface
Expand Down Expand Up @@ -78,10 +78,10 @@ Acts::detail::GeoPolygonConverter::operator()(
// Return the detector element and surface
return std::make_tuple(detectorElement, surface);
} else if (nVertices == 6) {
double hlxnegy = fabs(vertices[0][0] - vertices[1][0]) / 2;
double hlxzeroy = fabs(vertices[2][0] - vertices[3][0]) / 2;
double hlxposy = fabs(vertices[4][0] - vertices[5][0]) / 2;
double hly = fabs(vertices[0][1] - vertices[4][1]) / 2;
double hlxnegy = std::abs(vertices[0][0] - vertices[1][0]) / 2;
double hlxzeroy = std::abs(vertices[2][0] - vertices[3][0]) / 2;
double hlxposy = std::abs(vertices[4][0] - vertices[5][0]) / 2;
double hly = std::abs(vertices[0][1] - vertices[4][1]) / 2;
std::vector<ActsScalar> halfLengths = {hlxnegy, hlxzeroy, hlxposy, hly,
hly};

Expand Down
2 changes: 1 addition & 1 deletion Plugins/Legacy/include/Acts/Seeding/AtlasSeedFinder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ inline SPForSeed<SpacePoint>* AtlasSeedFinder<SpacePoint>::newSpacePoint(

if (m_checketa) {
// filter SP outside of eta-range
float z = (fabs(r[2]) + m_zmax);
float z = std::abs(r[2]) + m_zmax;
float x = r[0] * m_dzdrmin;
float y = r[1] * m_dzdrmin;
if ((z * z) < (x * x + y * y)) {
Expand Down
Loading

0 comments on commit 29c9ca8

Please sign in to comment.