From f77218a1c496c2afcf2ee3d1566b9a706f935448 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Fri, 22 Nov 2024 14:37:55 +0100 Subject: [PATCH 1/4] accumulate --- Core/include/Acts/Material/AccumulatedMaterialSlab.hpp | 2 +- Core/src/Material/AccumulatedMaterialSlab.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/include/Acts/Material/AccumulatedMaterialSlab.hpp b/Core/include/Acts/Material/AccumulatedMaterialSlab.hpp index 5f0013bcc3b..68b0ffb1daa 100644 --- a/Core/include/Acts/Material/AccumulatedMaterialSlab.hpp +++ b/Core/include/Acts/Material/AccumulatedMaterialSlab.hpp @@ -46,7 +46,7 @@ class AccumulatedMaterialSlab { /// /// Vacuum steps with a non-zero thickness can be added to account for holes /// in material structures. - void accumulate(MaterialSlab slabAlongTrack, float pathCorrection = 1); + void accumulate(MaterialSlab slabAlongTrack, double pathCorrection = 1.); /// Use the accumulated material to update the material variance /// diff --git a/Core/src/Material/AccumulatedMaterialSlab.cpp b/Core/src/Material/AccumulatedMaterialSlab.cpp index b8b7ebf88fe..02035b6be1f 100644 --- a/Core/src/Material/AccumulatedMaterialSlab.cpp +++ b/Core/src/Material/AccumulatedMaterialSlab.cpp @@ -12,10 +12,10 @@ #include "Acts/Material/detail/AverageMaterials.hpp" void Acts::AccumulatedMaterialSlab::accumulate(MaterialSlab slab, - float pathCorrection) { + double pathCorrection) { // scale the recorded material to the equivalence contribution along the // surface normal - slab.scaleThickness(1 / pathCorrection); + slab.scaleThickness(1. / pathCorrection); m_trackAverage = detail::combineSlabs(m_trackAverage, slab); } From cd212b2214f33f49f5e5dbe31018385c83a2df00 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Fri, 22 Nov 2024 14:59:09 +0100 Subject: [PATCH 2/4] scaling --- Core/include/Acts/Material/MaterialSlab.hpp | 2 +- Core/include/Acts/Material/VolumeMaterialMapper.hpp | 2 +- Core/src/Material/MaterialSlab.cpp | 2 +- Core/src/Material/VolumeMaterialMapper.cpp | 2 +- .../ActsFatras/Kernel/detail/SimulationActor.hpp | 10 +++++----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Core/include/Acts/Material/MaterialSlab.hpp b/Core/include/Acts/Material/MaterialSlab.hpp index 71c56c1a154..a203e3d0ca3 100644 --- a/Core/include/Acts/Material/MaterialSlab.hpp +++ b/Core/include/Acts/Material/MaterialSlab.hpp @@ -59,7 +59,7 @@ class MaterialSlab { MaterialSlab& operator=(const MaterialSlab&) = default; /// Scale the material thickness by the given factor. - void scaleThickness(float scale); + void scaleThickness(double scale); /// Check if the material is valid, i.e. it is finite and not vacuum. bool isValid() const { return m_material.isValid() && (0.0f < m_thickness); } diff --git a/Core/include/Acts/Material/VolumeMaterialMapper.hpp b/Core/include/Acts/Material/VolumeMaterialMapper.hpp index baf29d7b3d1..9da3b9caf59 100644 --- a/Core/include/Acts/Material/VolumeMaterialMapper.hpp +++ b/Core/include/Acts/Material/VolumeMaterialMapper.hpp @@ -78,7 +78,7 @@ class VolumeMaterialMapper { /// @struct State /// - /// Nested State struct which is used for the mapping prococess + /// Nested State struct which is used for the mapping process struct State { /// Constructor of the State with contexts State(const GeometryContext& gctx, const MagneticFieldContext& mctx) diff --git a/Core/src/Material/MaterialSlab.cpp b/Core/src/Material/MaterialSlab.cpp index acfd7064936..b7b5fd1648b 100644 --- a/Core/src/Material/MaterialSlab.cpp +++ b/Core/src/Material/MaterialSlab.cpp @@ -55,7 +55,7 @@ MaterialSlab MaterialSlab::averageLayers( return result; } -void MaterialSlab::scaleThickness(float scale) { +void MaterialSlab::scaleThickness(double scale) { if (scale < 0) { throw std::runtime_error("scale < 0"); } diff --git a/Core/src/Material/VolumeMaterialMapper.cpp b/Core/src/Material/VolumeMaterialMapper.cpp index ca7c00b5730..8519993b4d1 100644 --- a/Core/src/Material/VolumeMaterialMapper.cpp +++ b/Core/src/Material/VolumeMaterialMapper.cpp @@ -253,7 +253,7 @@ void Acts::VolumeMaterialMapper::createExtraHits( // Computing the extra hits properties based on the mappingStep length int volumeStep = static_cast(std::floor(properties.thickness() / m_cfg.mappingStep)); - float remainder = properties.thickness() - m_cfg.mappingStep * volumeStep; + double remainder = properties.thickness() - m_cfg.mappingStep * volumeStep; properties.scaleThickness(m_cfg.mappingStep / properties.thickness()); direction = direction * (m_cfg.mappingStep / direction.norm()); diff --git a/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp b/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp index acbaaaa713d..ce7f3ff82b7 100644 --- a/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp +++ b/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp @@ -252,7 +252,7 @@ struct SimulationActor { void interact(const Acts::MaterialSlab &slab, result_type &result) const { // run the continuous processes over a fraction of the material. returns // true on break condition (same as the underlying physics lists). - auto runContinuousPartial = [&, this](float fraction) { + auto runContinuousPartial = [&, this](double fraction) { Acts::MaterialSlab partialSlab = slab; partialSlab.scaleThickness(fraction); // material after passing this slab @@ -303,17 +303,17 @@ struct SimulationActor { const float fracL0 = std::clamp(static_cast(l0Dist / slabL0), 0.0f, 1.0f); // fraction of the material where the first point-like interaction occurs - const float frac = std::min(fracX0, fracL0); + const double frac = std::min(fracX0, fracL0); // do not run if there is zero material before the point-like interaction - if (0.0f < frac) { + if (0. < frac) { // simulate continuous processes before the point-like interaction if (runContinuousPartial(frac)) { return; } } // do not run if there is no point-like interaction - if (frac < 1.0f) { + if (frac < 1.) { // select which process to simulate const std::size_t process = (fracX0 < fracL0) ? result.x0Process : result.l0Process; @@ -324,7 +324,7 @@ struct SimulationActor { return; } // simulate continuous processes after the point-like interaction - if (runContinuousPartial(1.0 - frac)) { + if (runContinuousPartial(1. - frac)) { return; } From c2d932faa4cd8024e2174aa08633c22e2dcb39cd Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Fri, 29 Nov 2024 10:09:25 +0100 Subject: [PATCH 3/4] Revert "scaling" This reverts commit cd212b2214f33f49f5e5dbe31018385c83a2df00. --- Core/include/Acts/Material/MaterialSlab.hpp | 2 +- Core/include/Acts/Material/VolumeMaterialMapper.hpp | 2 +- Core/src/Material/MaterialSlab.cpp | 2 +- Core/src/Material/VolumeMaterialMapper.cpp | 2 +- .../ActsFatras/Kernel/detail/SimulationActor.hpp | 10 +++++----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Core/include/Acts/Material/MaterialSlab.hpp b/Core/include/Acts/Material/MaterialSlab.hpp index a203e3d0ca3..71c56c1a154 100644 --- a/Core/include/Acts/Material/MaterialSlab.hpp +++ b/Core/include/Acts/Material/MaterialSlab.hpp @@ -59,7 +59,7 @@ class MaterialSlab { MaterialSlab& operator=(const MaterialSlab&) = default; /// Scale the material thickness by the given factor. - void scaleThickness(double scale); + void scaleThickness(float scale); /// Check if the material is valid, i.e. it is finite and not vacuum. bool isValid() const { return m_material.isValid() && (0.0f < m_thickness); } diff --git a/Core/include/Acts/Material/VolumeMaterialMapper.hpp b/Core/include/Acts/Material/VolumeMaterialMapper.hpp index 9da3b9caf59..baf29d7b3d1 100644 --- a/Core/include/Acts/Material/VolumeMaterialMapper.hpp +++ b/Core/include/Acts/Material/VolumeMaterialMapper.hpp @@ -78,7 +78,7 @@ class VolumeMaterialMapper { /// @struct State /// - /// Nested State struct which is used for the mapping process + /// Nested State struct which is used for the mapping prococess struct State { /// Constructor of the State with contexts State(const GeometryContext& gctx, const MagneticFieldContext& mctx) diff --git a/Core/src/Material/MaterialSlab.cpp b/Core/src/Material/MaterialSlab.cpp index b7b5fd1648b..acfd7064936 100644 --- a/Core/src/Material/MaterialSlab.cpp +++ b/Core/src/Material/MaterialSlab.cpp @@ -55,7 +55,7 @@ MaterialSlab MaterialSlab::averageLayers( return result; } -void MaterialSlab::scaleThickness(double scale) { +void MaterialSlab::scaleThickness(float scale) { if (scale < 0) { throw std::runtime_error("scale < 0"); } diff --git a/Core/src/Material/VolumeMaterialMapper.cpp b/Core/src/Material/VolumeMaterialMapper.cpp index 8519993b4d1..ca7c00b5730 100644 --- a/Core/src/Material/VolumeMaterialMapper.cpp +++ b/Core/src/Material/VolumeMaterialMapper.cpp @@ -253,7 +253,7 @@ void Acts::VolumeMaterialMapper::createExtraHits( // Computing the extra hits properties based on the mappingStep length int volumeStep = static_cast(std::floor(properties.thickness() / m_cfg.mappingStep)); - double remainder = properties.thickness() - m_cfg.mappingStep * volumeStep; + float remainder = properties.thickness() - m_cfg.mappingStep * volumeStep; properties.scaleThickness(m_cfg.mappingStep / properties.thickness()); direction = direction * (m_cfg.mappingStep / direction.norm()); diff --git a/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp b/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp index ce7f3ff82b7..acbaaaa713d 100644 --- a/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp +++ b/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp @@ -252,7 +252,7 @@ struct SimulationActor { void interact(const Acts::MaterialSlab &slab, result_type &result) const { // run the continuous processes over a fraction of the material. returns // true on break condition (same as the underlying physics lists). - auto runContinuousPartial = [&, this](double fraction) { + auto runContinuousPartial = [&, this](float fraction) { Acts::MaterialSlab partialSlab = slab; partialSlab.scaleThickness(fraction); // material after passing this slab @@ -303,17 +303,17 @@ struct SimulationActor { const float fracL0 = std::clamp(static_cast(l0Dist / slabL0), 0.0f, 1.0f); // fraction of the material where the first point-like interaction occurs - const double frac = std::min(fracX0, fracL0); + const float frac = std::min(fracX0, fracL0); // do not run if there is zero material before the point-like interaction - if (0. < frac) { + if (0.0f < frac) { // simulate continuous processes before the point-like interaction if (runContinuousPartial(frac)) { return; } } // do not run if there is no point-like interaction - if (frac < 1.) { + if (frac < 1.0f) { // select which process to simulate const std::size_t process = (fracX0 < fracL0) ? result.x0Process : result.l0Process; @@ -324,7 +324,7 @@ struct SimulationActor { return; } // simulate continuous processes after the point-like interaction - if (runContinuousPartial(1. - frac)) { + if (runContinuousPartial(1.0 - frac)) { return; } From f867207fbf7fd106601f944821575d6380afb1be Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Fri, 29 Nov 2024 13:15:47 +0100 Subject: [PATCH 4/4] avoid conversion --- Core/src/Material/AccumulatedMaterialSlab.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/Material/AccumulatedMaterialSlab.cpp b/Core/src/Material/AccumulatedMaterialSlab.cpp index 02035b6be1f..c16c1cda0bf 100644 --- a/Core/src/Material/AccumulatedMaterialSlab.cpp +++ b/Core/src/Material/AccumulatedMaterialSlab.cpp @@ -15,7 +15,7 @@ void Acts::AccumulatedMaterialSlab::accumulate(MaterialSlab slab, double pathCorrection) { // scale the recorded material to the equivalence contribution along the // surface normal - slab.scaleThickness(1. / pathCorrection); + slab.scaleThickness(static_cast(1. / pathCorrection)); m_trackAverage = detail::combineSlabs(m_trackAverage, slab); }