Skip to content

Commit

Permalink
also particles
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger committed Sep 11, 2024
1 parent 30dc793 commit 0029642
Show file tree
Hide file tree
Showing 17 changed files with 303 additions and 298 deletions.
6 changes: 3 additions & 3 deletions Core/include/Acts/EventData/ChargeConcept.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
namespace Acts {

template <typename C>
concept ChargeConcept = requires(C c, C c2, float f, double d) {
concept ChargeConcept = requires(C c, C c2, double f, double d) {
{ C{f} };

{ c == c2 } -> std::same_as<bool>;
{ c != c2 } -> std::same_as<bool>;

{ c.absQ() } -> std::same_as<float>;
{ c.extractCharge(d) } -> std::same_as<float>;
{ c.absQ() } -> std::same_as<double>;
{ c.extractCharge(d) } -> std::same_as<double>;
{ c.extractMomentum(d) } -> std::same_as<double>;
{ c.qOverP(d, d) } -> std::same_as<double>;
};
Expand Down
8 changes: 4 additions & 4 deletions Core/include/Acts/EventData/GenericParticleHypothesis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GenericParticleHypothesis {
/// @param absPdg the absolute PDG
/// @param mass the particle mass
/// @param chargeType the type of charge
constexpr GenericParticleHypothesis(PdgParticle absPdg, float mass,
constexpr GenericParticleHypothesis(PdgParticle absPdg, double mass,
ChargeType chargeType)
: m_absPdg{absPdg}, m_mass{mass}, m_chargeType{std::move(chargeType)} {
assert(absPdg == makeAbsolutePdgParticle(absPdg) &&
Expand Down Expand Up @@ -67,10 +67,10 @@ class GenericParticleHypothesis {
constexpr PdgParticle absolutePdg() const noexcept { return m_absPdg; }

/// Get the hypothesized mass.
constexpr float mass() const noexcept { return m_mass; }
constexpr double mass() const noexcept { return m_mass; }

/// Get the hypothesized absolute charge.
constexpr float absoluteCharge() const noexcept {
constexpr double absoluteCharge() const noexcept {
return m_chargeType.absQ();
}

Expand Down Expand Up @@ -125,7 +125,7 @@ class GenericParticleHypothesis {

private:
PdgParticle m_absPdg;
float m_mass;
double m_mass;
ChargeType m_chargeType;

friend bool operator==(const GenericParticleHypothesis<ChargeType>& lhs,
Expand Down
16 changes: 8 additions & 8 deletions Core/include/Acts/EventData/ParticleHypothesis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Acts {
class SinglyChargedParticleHypothesis
: public GenericParticleHypothesis<SinglyCharged> {
public:
constexpr SinglyChargedParticleHypothesis(PdgParticle absPdg, float mass)
constexpr SinglyChargedParticleHypothesis(PdgParticle absPdg, double mass)
: GenericParticleHypothesis(absPdg, mass, {}) {}
SinglyChargedParticleHypothesis(PdgParticle absPdg)
: GenericParticleHypothesis(absPdg) {}
Expand Down Expand Up @@ -68,7 +68,7 @@ class SinglyChargedParticleHypothesis
/// @note This serves as a factory for common neutral particles.
class NeutralParticleHypothesis : public GenericParticleHypothesis<Neutral> {
public:
constexpr NeutralParticleHypothesis(PdgParticle absPdg, float mass)
constexpr NeutralParticleHypothesis(PdgParticle absPdg, double mass)
: GenericParticleHypothesis(absPdg, mass, {}) {}
NeutralParticleHypothesis(PdgParticle absPdg)
: GenericParticleHypothesis(absPdg) {}
Expand Down Expand Up @@ -99,7 +99,7 @@ class NeutralParticleHypothesis : public GenericParticleHypothesis<Neutral> {
class NonNeutralChargedParticleHypothesis
: public GenericParticleHypothesis<NonNeutralCharge> {
public:
constexpr NonNeutralChargedParticleHypothesis(PdgParticle absPdg, float mass,
constexpr NonNeutralChargedParticleHypothesis(PdgParticle absPdg, double mass,
NonNeutralCharge chargeType)
: GenericParticleHypothesis(absPdg, mass, chargeType) {}
NonNeutralChargedParticleHypothesis(PdgParticle absPdg)
Expand All @@ -126,7 +126,7 @@ class NonNeutralChargedParticleHypothesis
return SinglyChargedParticleHypothesis::proton();
}

static NonNeutralChargedParticleHypothesis pionLike(float absQ) {
static NonNeutralChargedParticleHypothesis pionLike(double absQ) {
return NonNeutralChargedParticleHypothesis(pion().absolutePdg(),
pion().mass(), absQ);
}
Expand All @@ -135,7 +135,7 @@ class NonNeutralChargedParticleHypothesis
static const auto cache = chargedGeantino(Acts::UnitConstants::e);
return cache;
}
static NonNeutralChargedParticleHypothesis chargedGeantino(float absQ) {
static NonNeutralChargedParticleHypothesis chargedGeantino(double absQ) {
return NonNeutralChargedParticleHypothesis(PdgParticle::eInvalid, 0, absQ);
}
};
Expand All @@ -145,7 +145,7 @@ class NonNeutralChargedParticleHypothesis
/// @note This serves as a factory for common particles with any kind of charge.
class ParticleHypothesis : public GenericParticleHypothesis<AnyCharge> {
public:
constexpr ParticleHypothesis(PdgParticle absPdg, float mass,
constexpr ParticleHypothesis(PdgParticle absPdg, double mass,
AnyCharge chargeType)
: GenericParticleHypothesis(absPdg, mass, chargeType) {}
ParticleHypothesis(PdgParticle absPdg) : GenericParticleHypothesis(absPdg) {}
Expand Down Expand Up @@ -178,7 +178,7 @@ class ParticleHypothesis : public GenericParticleHypothesis<AnyCharge> {
return NeutralParticleHypothesis::pion0();
}

static ParticleHypothesis pionLike(float absQ) {
static ParticleHypothesis pionLike(double absQ) {
return ParticleHypothesis(pion().absolutePdg(), pion().mass(), absQ);
}

Expand All @@ -189,7 +189,7 @@ class ParticleHypothesis : public GenericParticleHypothesis<AnyCharge> {
static const auto cache = chargedGeantino(Acts::UnitConstants::e);
return cache;
}
static ParticleHypothesis chargedGeantino(float absQ) {
static ParticleHypothesis chargedGeantino(double absQ) {
return ParticleHypothesis(PdgParticle::eInvalid, 0, absQ);
}
};
Expand Down
60 changes: 30 additions & 30 deletions Core/include/Acts/Material/Interactions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ namespace Acts {
///
/// where -dE/dx is given by the Bethe formula. The computations are valid
/// for intermediate particle energies.
float computeEnergyLossBethe(const MaterialSlab& slab, float m, float qOverP,
float absQ);
double computeEnergyLossBethe(const MaterialSlab& slab, double m, double qOverP,
double absQ);
/// Derivative of the Bethe energy loss with respect to q/p.
///
/// @copydoc computeEnergyLossBethe
float deriveEnergyLossBetheQOverP(const MaterialSlab& slab, float m,
float qOverP, float absQ);
double deriveEnergyLossBetheQOverP(const MaterialSlab& slab, double m,
double qOverP, double absQ);

/// Compute the most propable energy loss due to ionisation and excitation.
///
Expand All @@ -46,13 +46,13 @@ float deriveEnergyLossBetheQOverP(const MaterialSlab& slab, float m,
/// the given properties and thickness as described by the mode of the
/// Landau-Vavilov-Bichsel distribution. The computations are valid
/// for intermediate particle energies.
float computeEnergyLossLandau(const MaterialSlab& slab, float m, float qOverP,
float absQ);
double computeEnergyLossLandau(const MaterialSlab& slab, double m,
double qOverP, double absQ);
/// Derivative of the most probable ionisation energy loss with respect to q/p.
///
/// @copydoc computeEnergyLossBethe
float deriveEnergyLossLandauQOverP(const MaterialSlab& slab, float m,
float qOverP, float absQ);
double deriveEnergyLossLandauQOverP(const MaterialSlab& slab, double m,
double qOverP, double absQ);

/// Compute the Gaussian-equivalent sigma for the ionisation loss fluctuations.
///
Expand All @@ -61,20 +61,20 @@ float deriveEnergyLossLandauQOverP(const MaterialSlab& slab, float m,
/// This is the sigma parameter of a Gaussian distribution with the same
/// full-width-half-maximum as the Landau-Vavilov-Bichsel distribution. The
/// computations are valid for intermediate particle energies.
float computeEnergyLossLandauSigma(const MaterialSlab& slab, float m,
float qOverP, float absQ);
double computeEnergyLossLandauSigma(const MaterialSlab& slab, double m,
double qOverP, double absQ);

/// Compute the full with half maximum of landau energy loss distribution
///
/// @see computeEnergyLossBethe for parameters description
float computeEnergyLossLandauFwhm(const MaterialSlab& slab, float m,
float qOverP, float absQ);
double computeEnergyLossLandauFwhm(const MaterialSlab& slab, double m,
double qOverP, double absQ);

/// Compute q/p Gaussian-equivalent sigma due to ionisation loss fluctuations.
///
/// @copydoc computeEnergyLossBethe
float computeEnergyLossLandauSigmaQOverP(const MaterialSlab& slab, float m,
float qOverP, float absQ);
double computeEnergyLossLandauSigmaQOverP(const MaterialSlab& slab, double m,
double qOverP, double absQ);

/// Compute the mean energy loss due to radiative effects at high energies.
///
Expand All @@ -87,14 +87,14 @@ float computeEnergyLossLandauSigmaQOverP(const MaterialSlab& slab, float m,
/// This computes the mean energy loss -dE(x) using an approximative formula.
/// Bremsstrahlung is always included; direct e+e- pair production and
/// photo-nuclear interactions only for muons.
float computeEnergyLossRadiative(const MaterialSlab& slab, PdgParticle absPdg,
float m, float qOverP, float absQ);
double computeEnergyLossRadiative(const MaterialSlab& slab, PdgParticle absPdg,
double m, double qOverP, double absQ);
/// Derivative of the mean radiative energy loss with respect to q/p.
///
/// @copydoc computeEnergyLossRadiative
float deriveEnergyLossRadiativeQOverP(const MaterialSlab& slab,
PdgParticle absPdg, float m, float qOverP,
float absQ);
double deriveEnergyLossRadiativeQOverP(const MaterialSlab& slab,
PdgParticle absPdg, double m,
double qOverP, double absQ);

/// Compute the combined mean energy loss.
///
Expand All @@ -107,24 +107,24 @@ float deriveEnergyLossRadiativeQOverP(const MaterialSlab& slab,
/// This computes the combined mean energy loss -dE(x) including ionisation and
/// radiative effects. The computations are valid over a wide range of particle
/// energies.
float computeEnergyLossMean(const MaterialSlab& slab, PdgParticle absPdg,
float m, float qOverP, float absQ);
double computeEnergyLossMean(const MaterialSlab& slab, PdgParticle absPdg,
double m, double qOverP, double absQ);
/// Derivative of the combined mean energy loss with respect to q/p.
///
/// @copydoc computeEnergyLossMean
float deriveEnergyLossMeanQOverP(const MaterialSlab& slab, PdgParticle absPdg,
float m, float qOverP, float absQ);
double deriveEnergyLossMeanQOverP(const MaterialSlab& slab, PdgParticle absPdg,
double m, double qOverP, double absQ);

/// Compute the combined most probably energy loss.
///
/// @copydoc computeEnergyLossMean
float computeEnergyLossMode(const MaterialSlab& slab, PdgParticle absPdg,
float m, float qOverP, float absQ);
double computeEnergyLossMode(const MaterialSlab& slab, PdgParticle absPdg,
double m, double qOverP, double absQ);
/// Derivative of the combined most probable energy loss with respect to q/p.
///
/// @copydoc computeEnergyLossMean
float deriveEnergyLossModeQOverP(const MaterialSlab& slab, PdgParticle absPdg,
float m, float qOverP, float absQ);
double deriveEnergyLossModeQOverP(const MaterialSlab& slab, PdgParticle absPdg,
double m, double qOverP, double absQ);

/// Compute the core width of the projected planar scattering distribution.
///
Expand All @@ -133,8 +133,8 @@ float deriveEnergyLossModeQOverP(const MaterialSlab& slab, PdgParticle absPdg,
/// @param m Particle mass
/// @param qOverP Particle charge divided by absolute momentum
/// @param absQ Absolute particle charge
float computeMultipleScatteringTheta0(const MaterialSlab& slab,
PdgParticle absPdg, float m, float qOverP,
float absQ);
double computeMultipleScatteringTheta0(const MaterialSlab& slab,
PdgParticle absPdg, double m,
double qOverP, double absQ);

} // namespace Acts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ struct VolumeMaterialInteraction {
/// The particle current direction
const Vector3 dir = Vector3::Zero();
/// The particle q/p at the interaction
const float qOverP = 0;
const double qOverP = 0;
/// The absolute particle charge
const float absQ = 0;
const double absQ = 0;
/// The particle momentum at the interaction
const float momentum = 0;
const double momentum = 0;
/// The particle mass
const float mass = 0;
const double mass = 0;
/// The particle pdg
const PdgParticle absPdg = eInvalid;
/// The covariance transport decision at the interaction
Expand Down
10 changes: 4 additions & 6 deletions Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,12 +665,10 @@ class Gx2Fitter {
const auto& particle =
parametersWithHypothesis->particleHypothesis();

const double sigma =
static_cast<double>(Acts::computeMultipleScatteringTheta0(
interaction.slab, particle.absolutePdg(), particle.mass(),
static_cast<float>(
parametersWithHypothesis->parameters()[eBoundQOverP]),
particle.absoluteCharge()));
const double sigma = Acts::computeMultipleScatteringTheta0(
interaction.slab, particle.absolutePdg(), particle.mass(),
parametersWithHypothesis->parameters()[eBoundQOverP],
particle.absoluteCharge());
ACTS_VERBOSE(
" The Highland formula gives sigma = " << sigma);
invSigma2 = 1. / std::pow(sigma, 2);
Expand Down
8 changes: 4 additions & 4 deletions Core/src/Definitions/ParticleData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ static inline auto findByPdg(std::int32_t pdg, const ColumnContainer& column)
return column[*index];
}

static constexpr inline float extractCharge(float value) {
static constexpr inline double extractCharge(double value) {
// convert three charge to regular charge in native units
return (value / 3.0f) * Acts::UnitConstants::e;
}

static constexpr inline float extractMass(float value) {
static constexpr inline double extractMass(double value) {
return value * Acts::UnitConstants::MeV;
}

} // namespace

std::optional<float> Acts::findCharge(Acts::PdgParticle pdg) {
std::optional<double> Acts::findCharge(Acts::PdgParticle pdg) {
const auto charge =
findByPdg(static_cast<std::int32_t>(pdg), kParticlesThreeCharge);
if (!charge) {
Expand All @@ -71,7 +71,7 @@ std::optional<float> Acts::findCharge(Acts::PdgParticle pdg) {
return extractCharge(*charge);
}

std::optional<float> Acts::findMass(Acts::PdgParticle pdg) {
std::optional<double> Acts::findMass(Acts::PdgParticle pdg) {
const auto mass =
findByPdg(static_cast<std::int32_t>(pdg), kParticlesMassMeV);
if (!mass) {
Expand Down
2 changes: 1 addition & 1 deletion Core/src/Material/AccumulatedMaterialSlab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void Acts::AccumulatedMaterialSlab::accumulate(MaterialSlab slab,
float pathCorrection) {
// scale the recorded material to the equivalence contribution along the
// surface normal
slab.scaleThickness(1 / pathCorrection);
slab.scaleThickness(1. / static_cast<double>(pathCorrection));
m_trackAverage = detail::combineSlabs(m_trackAverage, slab);
}

Expand Down
Loading

0 comments on commit 0029642

Please sign in to comment.