Skip to content

Commit

Permalink
Merge branch 'main' into ex-refactor-relate-measuements-to-truth
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand authored Nov 11, 2024
2 parents f48e9b7 + 257473a commit ed9ccf8
Show file tree
Hide file tree
Showing 265 changed files with 2,068 additions and 1,682 deletions.
5 changes: 5 additions & 0 deletions CI/physmon/config/pythia8_ttbar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,8 @@ exclude:
- particle
- generation
- sub_particle
- e_loss
- total_x0
- total_l0
- number_of_hits
- outcome
6 changes: 2 additions & 4 deletions CI/physmon/workflows/physmon_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@
preSelectParticles=None,
postSelectParticles=ParticleSelectorConfig(removeSecondaries=True),
inputParticles="particles_input",
outputParticlesInitial="particles_initial_fatras",
outputParticlesFinal="particles_final_fatras",
outputParticles="particles_fatras",
outputSimHits="simhits_fatras",
outputDirRoot=tp / "fatras",
)
Expand All @@ -99,8 +98,7 @@
killAfterTime=25 * u.ns,
killSecondaries=True,
inputParticles="particles_input",
outputParticlesInitial="particles_initial_geant4",
outputParticlesFinal="particles_final_geant4",
outputParticles="particles_geant4",
outputSimHits="simhits_geant4",
outputDirRoot=tp / "geant4",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <cstddef>
#include <map>
#include <memory>
#include <numbers>
#include <string>
#include <tuple>
#include <vector>
Expand Down Expand Up @@ -103,8 +104,8 @@ class ScoreBasedAmbiguityResolution {
double pTMin = 0 * UnitConstants::GeV;
double pTMax = 1e5 * UnitConstants::GeV;

double phiMin = -M_PI * UnitConstants::rad;
double phiMax = M_PI * UnitConstants::rad;
double phiMin = -std::numbers::pi * UnitConstants::rad;
double phiMax = std::numbers::pi * UnitConstants::rad;

double etaMin = -5;
double etaMax = 5;
Expand Down
4 changes: 3 additions & 1 deletion Core/include/Acts/Definitions/Units.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#pragma once

#include <numbers>

namespace Acts {

/// @verbatim embed:rst:leading-slashes
Expand Down Expand Up @@ -170,7 +172,7 @@ constexpr double h = 3600.0 * s;
// Angles, native unit radian
constexpr double mrad = 1e-3;
constexpr double rad = 1.0;
constexpr double degree = 0.017453292519943295; // = M_PI / 180.0 * rad;
constexpr double degree = std::numbers::pi / 180. / rad;
// Energy/mass/momentum, native unit GeV
constexpr double GeV = 1.0;
constexpr double eV = 1e-9 * GeV;
Expand Down
7 changes: 5 additions & 2 deletions Core/include/Acts/EventData/TransformationHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "Acts/Utilities/Result.hpp"
#include "Acts/Utilities/detail/periodic.hpp"

#include <numbers>

namespace Acts {

class Surface;
Expand All @@ -25,8 +27,9 @@ class Surface;
/// @return Reflected bound track parameters vector
inline BoundVector reflectBoundParameters(const BoundVector& boundParams) {
BoundVector reflected = boundParams;
auto [phi, theta] = detail::normalizePhiTheta(
boundParams[eBoundPhi] - M_PI, M_PI - boundParams[eBoundTheta]);
auto [phi, theta] =
detail::normalizePhiTheta(boundParams[eBoundPhi] - std::numbers::pi,
std::numbers::pi - boundParams[eBoundTheta]);
reflected[eBoundPhi] = phi;
reflected[eBoundTheta] = theta;
reflected[eBoundQOverP] = -boundParams[eBoundQOverP];
Expand Down
96 changes: 0 additions & 96 deletions Core/include/Acts/EventData/detail/CalculateResiduals.hpp

This file was deleted.

7 changes: 4 additions & 3 deletions Core/include/Acts/EventData/detail/ParameterTraits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <numbers>

namespace Acts::detail {

Expand Down Expand Up @@ -106,12 +107,12 @@ struct CyclicParameterTraits {
//
// The functions names are chosen to be consistent w/ std::numeric_limits
struct PhiBoundParameterLimits {
static constexpr double lowest() { return -M_PI; }
static constexpr double max() { return M_PI; }
static constexpr double lowest() { return -std::numbers::pi; }
static constexpr double max() { return std::numbers::pi; }
};
struct ThetaBoundParameterLimits {
static constexpr double lowest() { return 0; }
static constexpr double max() { return M_PI; }
static constexpr double max() { return std::numbers::pi; }
};

// Traits implementation structs for single parameters.
Expand Down
6 changes: 4 additions & 2 deletions Core/include/Acts/Geometry/CylinderVolumeBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <initializer_list>
#include <iosfwd>
#include <memory>
#include <numbers>
#include <ostream>
#include <vector>

Expand Down Expand Up @@ -105,8 +106,9 @@ class CylinderVolumeBounds : public VolumeBounds {
/// @param bevelMinZ The bevel angle, in radians, for the negative side
/// @param bevelMaxZ The bevel angle, in radians, for the positive side
CylinderVolumeBounds(ActsScalar rmin, ActsScalar rmax, ActsScalar halfz,
ActsScalar halfphi = M_PI, ActsScalar avgphi = 0.,
ActsScalar bevelMinZ = 0., ActsScalar bevelMaxZ = 0.);
ActsScalar halfphi = std::numbers::pi_v<ActsScalar>,
ActsScalar avgphi = 0., ActsScalar bevelMinZ = 0.,
ActsScalar bevelMaxZ = 0.);

/// Constructor - from a fixed size array
///
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Geometry/SurfaceArrayCreator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <functional>
#include <iterator>
#include <memory>
#include <numbers>
#include <optional>
#include <ostream>
#include <tuple>
Expand Down Expand Up @@ -257,7 +258,7 @@ class SurfaceArrayCreator {

// ...so by injecting them into atan2, we get the angle between them
auto dPhi = std::atan2(sin_dPhi_n2, cos_dPhi_n2);
return std::abs(dPhi) < M_PI / 180.;
return std::abs(dPhi) < std::numbers::pi / 180.;
}

if (bValue == Acts::BinningValue::binZ) {
Expand Down
15 changes: 9 additions & 6 deletions Core/include/Acts/Geometry/VolumeBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <cmath>
#include <iostream>
#include <memory>
#include <numbers>
#include <utility>
#include <vector>

Expand All @@ -33,12 +34,14 @@ struct OrientedSurface {

// Planar definitions to help construct the boundary surfaces
static const Transform3 s_planeXY = Transform3::Identity();
static const Transform3 s_planeYZ = AngleAxis3(0.5 * M_PI, Vector3::UnitY()) *
AngleAxis3(0.5 * M_PI, Vector3::UnitZ()) *
Transform3::Identity();
static const Transform3 s_planeZX = AngleAxis3(-0.5 * M_PI, Vector3::UnitX()) *
AngleAxis3(-0.5 * M_PI, Vector3::UnitZ()) *
Transform3::Identity();
static const Transform3 s_planeYZ =
AngleAxis3(std::numbers::pi / 2., Vector3::UnitY()) *
AngleAxis3(std::numbers::pi / 2., Vector3::UnitZ()) *
Transform3::Identity();
static const Transform3 s_planeZX =
AngleAxis3(-std::numbers::pi / 2., Vector3::UnitX()) *
AngleAxis3(-std::numbers::pi / 2., Vector3::UnitZ()) *
Transform3::Identity();

/// @class VolumeBounds
///
Expand Down
22 changes: 14 additions & 8 deletions Core/include/Acts/Propagator/RiddersPropagator.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include "Acts/Definitions/TrackParametrization.hpp"

#include <numbers>

template <typename propagator_t>
template <typename parameters_t, typename propagator_options_t>
auto Acts::RiddersPropagator<propagator_t>::propagate(
Expand Down Expand Up @@ -150,8 +152,8 @@ bool Acts::RiddersPropagator<propagator_t>::inconsistentDerivativesOnDisc(
for (unsigned int j = 0; j < derivatives.size(); j++) {
// If there is at least one with a similar angle then it seems to work
// properly
if (i != j &&
std::abs(derivatives[i](1) - derivatives[j](1)) < 0.5 * M_PI) {
if (i != j && std::abs(derivatives[i](1) - derivatives[j](1)) <
std::numbers::pi / 2.) {
jumpedAngle = false;
break;
}
Expand Down Expand Up @@ -179,8 +181,8 @@ Acts::RiddersPropagator<propagator_t>::wiggleParameter(
// Treatment for theta
if (param == eBoundTheta) {
const double current_theta = start.template get<eBoundTheta>();
if (current_theta + h > M_PI) {
h = M_PI - current_theta;
if (current_theta + h > std::numbers::pi) {
h = std::numbers::pi - current_theta;
}
if (current_theta + h < 0) {
h = -current_theta;
Expand All @@ -202,10 +204,14 @@ Acts::RiddersPropagator<propagator_t>::wiggleParameter(
if (param == eBoundPhi) {
double phi0 = nominal(Acts::eBoundPhi);
double phi1 = r.endParameters->parameters()(Acts::eBoundPhi);
if (std::abs(phi1 + 2. * M_PI - phi0) < std::abs(phi1 - phi0)) {
derivatives.back()[Acts::eBoundPhi] = (phi1 + 2. * M_PI - phi0) / h;
} else if (std::abs(phi1 - 2. * M_PI - phi0) < std::abs(phi1 - phi0)) {
derivatives.back()[Acts::eBoundPhi] = (phi1 - 2. * M_PI - phi0) / h;
if (std::abs(phi1 + 2. * std::numbers::pi - phi0) <
std::abs(phi1 - phi0)) {
derivatives.back()[Acts::eBoundPhi] =
(phi1 + 2. * std::numbers::pi - phi0) / h;
} else if (std::abs(phi1 - 2. * std::numbers::pi - phi0) <
std::abs(phi1 - phi0)) {
derivatives.back()[Acts::eBoundPhi] =
(phi1 - 2. * std::numbers::pi - phi0) / h;
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion Core/include/Acts/Propagator/detail/LoopProtection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Utilities/Logger.hpp"

#include <numbers>

namespace Acts::detail {

/// Estimate the loop protection limit
Expand Down Expand Up @@ -46,7 +48,8 @@ void setupLoopProtection(propagator_state_t& state, const stepper_t& stepper,
// Transverse component at start is taken for the loop protection
const double p = stepper.absoluteMomentum(state.stepping);
// Calculate the full helix path
const double helixPath = state.options.direction * 2 * M_PI * p / B;
const double helixPath =
state.options.direction * 2 * std::numbers::pi * p / B;
// And set it as the loop limit if it overwrites the internal limit
const double loopLimit = state.options.loopFraction * helixPath;
const double previousLimit = pathAborter.internalLimit;
Expand Down
13 changes: 7 additions & 6 deletions Core/include/Acts/Seeding/GbtsDataStorage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <algorithm>
#include <map>
#include <numbers>
#include <vector>

namespace Acts {
Expand Down Expand Up @@ -117,12 +118,12 @@ class GbtsEtaBin {
// float phi = pN->m_sp.phi();
// float phi = (std::atan(pN->m_sp.x() / pN->m_sp.y()));
float phi = pN->m_spGbts.phi();
if (phi <= M_PI - dphi) {
if (phi <= std::numbers::pi_v<float> - dphi) {
continue;
}

m_vPhiNodes.push_back(
std::pair<float, unsigned int>(phi - 2 * M_PI, nIdx));
m_vPhiNodes.push_back(std::pair<float, unsigned int>(
phi - static_cast<float>(2. * std::numbers::pi), nIdx));
}

for (unsigned int nIdx = 0; nIdx < m_vn.size(); nIdx++) {
Expand All @@ -134,11 +135,11 @@ class GbtsEtaBin {
for (unsigned int nIdx = 0; nIdx < m_vn.size(); nIdx++) {
GbtsNode<space_point_t> *pN = m_vn.at(nIdx);
float phi = pN->m_spGbts.phi();
if (phi >= -M_PI + dphi) {
if (phi >= -std::numbers::pi_v<float> + dphi) {
break;
}
m_vPhiNodes.push_back(
std::pair<float, unsigned int>(phi + 2 * M_PI, nIdx));
m_vPhiNodes.push_back(std::pair<float, unsigned int>(
phi + static_cast<float>(2. * std::numbers::pi), nIdx));
}
}

Expand Down
Loading

0 comments on commit ed9ccf8

Please sign in to comment.