From cafee589c1f1bcbec1e08354127f54dbfe21d321 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Sat, 23 Nov 2024 13:17:49 +0100 Subject: [PATCH 1/7] chore: Cleanup some Geant4 Examples code (#3895) Accumulated changes I wanted to branch out from https://github.com/acts-project/acts/pull/3498 - Improve namespaces - Use namespaces in source files - Clean includes --- .../DDG4/DDG4DetectorConstruction.hpp | 10 +- .../Geant4/DetectorConstructionFactory.hpp | 4 +- .../ActsExamples/Geant4/EventStore.hpp | 6 +- .../Geant4/GdmlDetectorConstruction.hpp | 10 +- .../ActsExamples/Geant4/Geant4Manager.hpp | 12 +- .../ActsExamples/Geant4/Geant4Simulation.hpp | 18 +-- .../Geant4/MagneticFieldWrapper.hpp | 4 +- .../Geant4/MaterialPhysicsList.hpp | 5 +- .../Geant4/MaterialSteppingAction.hpp | 4 +- .../Geant4/ParticleKillAction.hpp | 4 +- .../Geant4/ParticleTrackingAction.hpp | 5 +- .../Geant4/PhysicsListFactory.hpp | 4 +- .../ActsExamples/Geant4/RegionCreator.hpp | 6 +- .../Geant4/SensitiveSteppingAction.hpp | 4 +- .../Geant4/SensitiveSurfaceMapper.hpp | 5 +- .../Geant4/SimParticleTranslation.hpp | 4 +- .../Geant4/SteppingActionList.hpp | 11 +- .../GeoModelDetectorConstruction.hpp | 12 +- .../TelescopeG4DetectorConstruction.hpp | 10 +- .../Geant4/src/DDG4DetectorConstruction.cpp | 26 +++-- .../Geant4/src/GdmlDetectorConstruction.cpp | 6 +- .../Algorithms/Geant4/src/Geant4Manager.cpp | 18 +-- .../Geant4/src/Geant4Simulation.cpp | 107 +++++++++--------- .../src/GeoModelDetectorConstruction.cpp | 6 +- .../Geant4/src/MagneticFieldWrapper.cpp | 13 ++- .../Geant4/src/MaterialPhysicsList.cpp | 12 +- .../Geant4/src/MaterialSteppingAction.cpp | 11 +- .../Geant4/src/ParticleKillAction.cpp | 8 +- .../Geant4/src/ParticleTrackingAction.cpp | 23 ++-- .../Geant4/src/PhysicsListFactory.cpp | 4 +- .../Algorithms/Geant4/src/RegionCreator.cpp | 6 +- .../Geant4/src/SensitiveSteppingAction.cpp | 12 +- .../Geant4/src/SensitiveSurfaceMapper.cpp | 18 +-- .../Geant4/src/SimParticleTranslation.cpp | 12 +- .../src/TelescopeG4DetectorConstruction.cpp | 23 ++-- .../Geant4HepMC/EventRecording.hpp | 12 +- .../Geant4HepMC/src/EventRecording.cpp | 38 +++---- Examples/Python/src/Geant4Component.cpp | 48 ++++---- Examples/Python/src/Geant4DD4hepComponent.cpp | 8 +- .../Python/src/Geant4GeoModelComponent.cpp | 8 +- .../Geant4/Geant4DetectorSurfaceFactory.hpp | 2 +- Plugins/Geant4/src/Geant4DetectorElement.cpp | 21 ++-- .../GeoModel/GeoModelDetectorElementITk.hpp | 8 -- .../src/GeoModelDetectorElementITk.cpp | 8 -- .../GeoModelDetectorElementITkTests.cpp | 8 -- 45 files changed, 304 insertions(+), 300 deletions(-) diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/DDG4/DDG4DetectorConstruction.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/DDG4/DDG4DetectorConstruction.hpp index 529a3725980..54c590ac4d3 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/DDG4/DDG4DetectorConstruction.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/DDG4/DDG4DetectorConstruction.hpp @@ -31,7 +31,7 @@ class DDG4DetectorConstruction final : public G4VUserDetectorConstruction { public: DDG4DetectorConstruction( std::shared_ptr detector, - std::vector> regionCreators = {}); + std::vector> regionCreators = {}); ~DDG4DetectorConstruction() final; /// Convert the stored DD4hep detector to a Geant4 description. @@ -47,7 +47,7 @@ class DDG4DetectorConstruction final : public G4VUserDetectorConstruction { /// The Acts DD4hep detector instance std::shared_ptr m_detector; /// Region creators - std::vector> m_regionCreators; + std::vector> m_regionCreators; /// The world volume G4VPhysicalVolume* m_world = nullptr; @@ -56,11 +56,11 @@ class DDG4DetectorConstruction final : public G4VUserDetectorConstruction { }; class DDG4DetectorConstructionFactory final - : public DetectorConstructionFactory { + : public Geant4::DetectorConstructionFactory { public: DDG4DetectorConstructionFactory( std::shared_ptr detector, - std::vector> regionCreators = {}); + std::vector> regionCreators = {}); ~DDG4DetectorConstructionFactory() final; std::unique_ptr factorize() const override; @@ -69,7 +69,7 @@ class DDG4DetectorConstructionFactory final /// The Acts DD4hep detector instance std::shared_ptr m_detector; /// Region creators - std::vector> m_regionCreators; + std::vector> m_regionCreators; }; } // namespace ActsExamples diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/DetectorConstructionFactory.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/DetectorConstructionFactory.hpp index a0f5b3e41cd..16cb2c3eae6 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/DetectorConstructionFactory.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/DetectorConstructionFactory.hpp @@ -12,7 +12,7 @@ #include -namespace ActsExamples { +namespace ActsExamples::Geant4 { /// Silly Geant4 will destroy the detector construction after the run manager is /// destructed. This class works around it by factorizing a factory. @@ -23,4 +23,4 @@ class DetectorConstructionFactory { virtual std::unique_ptr factorize() const = 0; }; -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/EventStore.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/EventStore.hpp index a46512ce299..7ca1775b81a 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/EventStore.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/EventStore.hpp @@ -21,8 +21,10 @@ #include "G4Types.hh" namespace ActsExamples { - class WhiteBoard; +} + +namespace ActsExamples::Geant4 { /// Common event store for all Geant4 related sub algorithms struct EventStore { @@ -80,4 +82,4 @@ struct EventStore { std::unordered_map subparticleMap; }; -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/GdmlDetectorConstruction.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/GdmlDetectorConstruction.hpp index 24924bd7867..69156e94e06 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/GdmlDetectorConstruction.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/GdmlDetectorConstruction.hpp @@ -26,7 +26,7 @@ class GdmlDetectorConstruction final : public G4VUserDetectorConstruction { /// @param regionCreators are the region creators GdmlDetectorConstruction( std::string path, - std::vector> regionCreators = {}); + std::vector> regionCreators = {}); /// Read the file and parse it to construct the Geant4 description /// @@ -38,17 +38,17 @@ class GdmlDetectorConstruction final : public G4VUserDetectorConstruction { /// Path to the Gdml file std::string m_path; /// Region creators - std::vector> m_regionCreators; + std::vector> m_regionCreators; /// Cached world volume G4VPhysicalVolume* m_world = nullptr; }; class GdmlDetectorConstructionFactory final - : public DetectorConstructionFactory { + : public Geant4::DetectorConstructionFactory { public: GdmlDetectorConstructionFactory( std::string path, - std::vector> regionCreators = {}); + std::vector> regionCreators = {}); std::unique_ptr factorize() const override; @@ -56,7 +56,7 @@ class GdmlDetectorConstructionFactory final /// Path to the Gdml file std::string m_path; /// Region creators - std::vector> m_regionCreators; + std::vector> m_regionCreators; }; } // namespace ActsExamples diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/Geant4Manager.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/Geant4Manager.hpp index c3db1c3f2fe..bdf9ab7bb82 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/Geant4Manager.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/Geant4Manager.hpp @@ -18,8 +18,10 @@ class G4VUserPhysicsList; namespace ActsExamples { -class PhysicsListFactory; class Geant4Manager; +namespace Geant4 { +class PhysicsListFactory; +} /// Manages the life time of G4RunManager and G4VUserPhysicsList. /// @@ -75,12 +77,14 @@ class Geant4Manager { /// Registers a named physics list factory to the manager for easy /// instantiation when needed. void registerPhysicsListFactory( - std::string name, std::shared_ptr physicsListFactory); + std::string name, + std::shared_ptr physicsListFactory); std::unique_ptr createPhysicsList( const std::string &name) const; /// Get the current list of physics list factories. - const std::unordered_map> & + const std::unordered_map> & getPhysicsListFactories() const; private: @@ -89,7 +93,7 @@ class Geant4Manager { bool m_created = false; std::weak_ptr m_handle; - std::unordered_map> + std::unordered_map> m_physicsListFactories; }; diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/Geant4Simulation.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/Geant4Simulation.hpp index f735dcd3859..88f526fff4f 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/Geant4Simulation.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/Geant4Simulation.hpp @@ -39,14 +39,15 @@ class MagneticFieldProvider; class Volume; } // namespace Acts -class G4VUserDetectorConstruction; - namespace ActsExamples { +struct Geant4Handle; +namespace Geant4 { class DetectorConstructionFactory; class SensitiveSurfaceMapper; struct EventStore; -struct Geant4Handle; +class RegionCreator; +} // namespace Geant4 /// Abstracts common Geant4 Acts algorithm behaviour. class Geant4SimulationBase : public IAlgorithm { @@ -61,7 +62,8 @@ class Geant4SimulationBase : public IAlgorithm { /// Detector construction object. /// G4RunManager will take care of deletion - std::shared_ptr detectorConstructionFactory; + std::shared_ptr + detectorConstructionFactory; /// Optional Geant4 instance overwrite. std::shared_ptr geant4Handle; @@ -91,11 +93,11 @@ class Geant4SimulationBase : public IAlgorithm { G4RunManager& runManager() const; - EventStore& eventStore() const; + Geant4::EventStore& eventStore() const; std::unique_ptr m_logger; - std::shared_ptr m_eventStore; + std::shared_ptr m_eventStore; int m_geant4Level{}; @@ -122,8 +124,8 @@ class Geant4Simulation final : public Geant4SimulationBase { std::string outputParticles = "particles_simulated"; /// The ACTS sensitive surfaces in a mapper, used for hit creation - std::shared_ptr sensitiveSurfaceMapper = - nullptr; + std::shared_ptr + sensitiveSurfaceMapper = nullptr; /// The ACTS Magnetic field provider std::shared_ptr magneticField = nullptr; diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MagneticFieldWrapper.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MagneticFieldWrapper.hpp index a73663fb503..7581d5b6cf5 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MagneticFieldWrapper.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MagneticFieldWrapper.hpp @@ -18,7 +18,7 @@ namespace Acts { class MagneticFieldProvider; } -namespace ActsExamples { +namespace ActsExamples::Geant4 { /// A magnetic field wrapper for the Acts magnetic field /// to be used with Geant4. @@ -58,4 +58,4 @@ class MagneticFieldWrapper : public G4MagneticField { std::unique_ptr m_logger; }; -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MaterialPhysicsList.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MaterialPhysicsList.hpp index 9cfb45d0453..924c1b54e59 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MaterialPhysicsList.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MaterialPhysicsList.hpp @@ -12,11 +12,10 @@ #include #include -#include #include -namespace ActsExamples { +namespace ActsExamples::Geant4 { /// @class MaterialPhysicsList /// @@ -57,4 +56,4 @@ class MaterialPhysicsList final : public G4VUserPhysicsList { std::unique_ptr m_logger; }; -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MaterialSteppingAction.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MaterialSteppingAction.hpp index 8b21c41a7ce..23ccb88764e 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MaterialSteppingAction.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MaterialSteppingAction.hpp @@ -19,7 +19,7 @@ class G4Step; -namespace ActsExamples { +namespace ActsExamples::Geant4 { /// @class MaterialSteppingAction /// @@ -66,4 +66,4 @@ class MaterialSteppingAction final : public G4UserSteppingAction { std::unique_ptr m_logger; }; -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/ParticleKillAction.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/ParticleKillAction.hpp index 4eb45d4f6ec..fe15a2d185c 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/ParticleKillAction.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/ParticleKillAction.hpp @@ -22,7 +22,7 @@ namespace Acts { class Volume; } // namespace Acts -namespace ActsExamples { +namespace ActsExamples::Geant4 { /// A G4SteppingAction that is called for every step in the simulation process. /// @@ -67,4 +67,4 @@ class ParticleKillAction : public G4UserSteppingAction { std::unique_ptr m_logger; }; -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/ParticleTrackingAction.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/ParticleTrackingAction.hpp index acf07ec75dc..4ff1d413f34 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/ParticleTrackingAction.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/ParticleTrackingAction.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Utilities/Logger.hpp" -#include "ActsExamples/EventData/SimHit.hpp" #include "ActsExamples/EventData/SimParticle.hpp" #include "ActsExamples/Geant4/EventStore.hpp" @@ -22,7 +21,7 @@ class G4Track; -namespace ActsExamples { +namespace ActsExamples::Geant4 { /// The G4UserTrackingAction that is called for every track in /// the simulation process. @@ -82,4 +81,4 @@ class ParticleTrackingAction : public G4UserTrackingAction { std::unique_ptr m_logger; }; -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/PhysicsListFactory.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/PhysicsListFactory.hpp index 6bbc39b4f04..e248beaffd4 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/PhysicsListFactory.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/PhysicsListFactory.hpp @@ -13,7 +13,7 @@ class G4VUserPhysicsList; -namespace ActsExamples { +namespace ActsExamples::Geant4 { /// A factory around G4VUserPhysicsList which allows on demand instantiation. class PhysicsListFactory { @@ -36,4 +36,4 @@ class PhysicsListFactoryFunction final : public PhysicsListFactory { Function m_function; }; -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/RegionCreator.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/RegionCreator.hpp index b141948ec90..5327e4f37eb 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/RegionCreator.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/RegionCreator.hpp @@ -13,7 +13,7 @@ #include #include -namespace ActsExamples { +namespace ActsExamples::Geant4 { /// Geant4 Region Creator /// @@ -49,7 +49,7 @@ class RegionCreator { Acts::Logging::Level level); /// Construct the region - void Construct(); + void construct(); /// Readonly access to the configuration const Config& config() const { return m_cfg; } @@ -68,4 +68,4 @@ class RegionCreator { std::unique_ptr m_logger; }; -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SensitiveSteppingAction.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SensitiveSteppingAction.hpp index 664522349df..d415e77e940 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SensitiveSteppingAction.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SensitiveSteppingAction.hpp @@ -23,7 +23,7 @@ namespace Acts { class Surface; } -namespace ActsExamples { +namespace ActsExamples::Geant4 { /// The G4SteppingAction that is called for every step in /// the simulation process. @@ -83,4 +83,4 @@ class SensitiveSteppingAction : public G4UserSteppingAction { m_surfaceMapping; }; -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SensitiveSurfaceMapper.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SensitiveSurfaceMapper.hpp index 60f86d0d4e3..7614635ff93 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SensitiveSurfaceMapper.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SensitiveSurfaceMapper.hpp @@ -12,7 +12,6 @@ #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/GeometryIdentifier.hpp" #include "Acts/Geometry/TrackingGeometry.hpp" -#include "Acts/Utilities/GridAccessHelpers.hpp" #include "Acts/Utilities/Logger.hpp" #include @@ -26,7 +25,7 @@ namespace Acts { class Surface; } -namespace ActsExamples { +namespace ActsExamples::Geant4 { struct SensitiveCandidatesBase { /// Get the sensitive surfaces for a given position @@ -148,4 +147,4 @@ class SensitiveSurfaceMapper { std::unique_ptr m_logger; }; -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SimParticleTranslation.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SimParticleTranslation.hpp index 8a20f91ae39..5b43102d812 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SimParticleTranslation.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SimParticleTranslation.hpp @@ -20,7 +20,7 @@ class G4Event; -namespace ActsExamples { +namespace ActsExamples::Geant4 { /// @class SimParticleTranslation /// @@ -81,4 +81,4 @@ class SimParticleTranslation final : public G4VUserPrimaryGeneratorAction { std::unique_ptr m_logger; }; -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SteppingActionList.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SteppingActionList.hpp index b4a6d7e5d68..807417cf1f4 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SteppingActionList.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SteppingActionList.hpp @@ -8,17 +8,12 @@ #pragma once -#include "Acts/Utilities/Logger.hpp" -#include "ActsExamples/EventData/SimHit.hpp" -#include "ActsExamples/EventData/SimParticle.hpp" - #include -#include -#include +#include #include -namespace ActsExamples { +namespace ActsExamples::Geant4 { /// Geant4 only allows one user action of each type. This simple wrapper /// dispatches multiple actions to Geant4. @@ -42,4 +37,4 @@ class SteppingActionList : public G4UserSteppingAction { Config m_cfg; }; -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/GeoModelG4/GeoModelDetectorConstruction.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/GeoModelG4/GeoModelDetectorConstruction.hpp index a919d2866b0..d3070bbc590 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/GeoModelG4/GeoModelDetectorConstruction.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/GeoModelG4/GeoModelDetectorConstruction.hpp @@ -12,8 +12,6 @@ #include "ActsExamples/Geant4/DetectorConstructionFactory.hpp" #include "ActsExamples/Geant4/RegionCreator.hpp" -#include - #include class G4VPhysicalVolume; @@ -27,7 +25,7 @@ class GeoModelDetectorConstruction final : public G4VUserDetectorConstruction { /// @param regionCreators are the region creators GeoModelDetectorConstruction( const Acts::GeoModelTree& geoModelTree, - std::vector> regionCreators = {}); + std::vector> regionCreators = {}); /// Read the file and parse it to construct the Geant4 description /// @@ -39,17 +37,17 @@ class GeoModelDetectorConstruction final : public G4VUserDetectorConstruction { /// The GeoModel tree Acts::GeoModelTree m_geoModelTree; /// Region creators - std::vector> m_regionCreators; + std::vector> m_regionCreators; /// The world volume G4VPhysicalVolume* m_g4World = nullptr; }; class GeoModelDetectorConstructionFactory final - : public DetectorConstructionFactory { + : public Geant4::DetectorConstructionFactory { public: GeoModelDetectorConstructionFactory( const Acts::GeoModelTree& geoModelTree, - std::vector> regionCreators = {}); + std::vector> regionCreators = {}); std::unique_ptr factorize() const override; @@ -57,7 +55,7 @@ class GeoModelDetectorConstructionFactory final /// The GeoModel tree Acts::GeoModelTree m_geoModelTree; /// Region creators - std::vector> m_regionCreators; + std::vector> m_regionCreators; }; } // namespace ActsExamples diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/TelescopeDetector/TelescopeG4DetectorConstruction.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/TelescopeDetector/TelescopeG4DetectorConstruction.hpp index 66fc363fe53..0d0fc522217 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/TelescopeDetector/TelescopeG4DetectorConstruction.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/TelescopeDetector/TelescopeG4DetectorConstruction.hpp @@ -24,7 +24,7 @@ class TelescopeG4DetectorConstruction final public: TelescopeG4DetectorConstruction( const TelescopeDetector::Config& cfg, - std::vector> regionCreators = {}); + std::vector> regionCreators = {}); G4VPhysicalVolume* Construct() final; @@ -32,17 +32,17 @@ class TelescopeG4DetectorConstruction final /// The configuration of the telescope detector TelescopeDetector::Config m_cfg; /// Region creators - std::vector> m_regionCreators; + std::vector> m_regionCreators; /// The world volume G4VPhysicalVolume* m_world{}; }; class TelescopeG4DetectorConstructionFactory final - : public DetectorConstructionFactory { + : public Geant4::DetectorConstructionFactory { public: TelescopeG4DetectorConstructionFactory( const TelescopeDetector::Config& cfg, - std::vector> regionCreators = {}); + std::vector> regionCreators = {}); std::unique_ptr factorize() const override; @@ -50,7 +50,7 @@ class TelescopeG4DetectorConstructionFactory final /// The configuration of the telescope detector TelescopeDetector::Config m_cfg; /// Region creators - std::vector> m_regionCreators; + std::vector> m_regionCreators; }; } // namespace ActsExamples::Telescope diff --git a/Examples/Algorithms/Geant4/src/DDG4DetectorConstruction.cpp b/Examples/Algorithms/Geant4/src/DDG4DetectorConstruction.cpp index ae6a4609180..2868fbb3a63 100644 --- a/Examples/Algorithms/Geant4/src/DDG4DetectorConstruction.cpp +++ b/Examples/Algorithms/Geant4/src/DDG4DetectorConstruction.cpp @@ -22,22 +22,23 @@ class G4VPhysicalVolume; -ActsExamples::DDG4DetectorConstruction::DDG4DetectorConstruction( +namespace ActsExamples { + +DDG4DetectorConstruction::DDG4DetectorConstruction( std::shared_ptr detector, - std::vector> regionCreators) + std::vector> regionCreators) : G4VUserDetectorConstruction(), m_detector(std::move(detector)), m_regionCreators(std::move(regionCreators)) {} -ActsExamples::DDG4DetectorConstruction::~DDG4DetectorConstruction() = default; +DDG4DetectorConstruction::~DDG4DetectorConstruction() = default; -dd4hep::Detector& ActsExamples::DDG4DetectorConstruction::dd4hepDetector() - const { +dd4hep::Detector& DDG4DetectorConstruction::dd4hepDetector() const { return m_detector->geometryService->detector(); } // See DD4hep::Simulation::Geant4DetectorConstruction::Construct() -G4VPhysicalVolume* ActsExamples::DDG4DetectorConstruction::Construct() { +G4VPhysicalVolume* DDG4DetectorConstruction::Construct() { if (m_world == nullptr) { dd4hep::sim::Geant4Mapping& g4map = dd4hep::sim::Geant4Mapping::instance(); auto conv = dd4hep::sim::Geant4Converter(dd4hepDetector(), @@ -52,23 +53,24 @@ G4VPhysicalVolume* ActsExamples::DDG4DetectorConstruction::Construct() { // Create regions for (const auto& regionCreator : m_regionCreators) { - regionCreator->Construct(); + regionCreator->construct(); } } return m_world; } -ActsExamples::DDG4DetectorConstructionFactory::DDG4DetectorConstructionFactory( +DDG4DetectorConstructionFactory::DDG4DetectorConstructionFactory( std::shared_ptr detector, - std::vector> regionCreators) + std::vector> regionCreators) : m_detector(std::move(detector)), m_regionCreators(std::move(regionCreators)) {} -ActsExamples::DDG4DetectorConstructionFactory:: - ~DDG4DetectorConstructionFactory() = default; +DDG4DetectorConstructionFactory::~DDG4DetectorConstructionFactory() = default; std::unique_ptr -ActsExamples::DDG4DetectorConstructionFactory::factorize() const { +DDG4DetectorConstructionFactory::factorize() const { return std::make_unique(m_detector, m_regionCreators); } + +} // namespace ActsExamples diff --git a/Examples/Algorithms/Geant4/src/GdmlDetectorConstruction.cpp b/Examples/Algorithms/Geant4/src/GdmlDetectorConstruction.cpp index 5a10933bb3f..242597ac175 100644 --- a/Examples/Algorithms/Geant4/src/GdmlDetectorConstruction.cpp +++ b/Examples/Algorithms/Geant4/src/GdmlDetectorConstruction.cpp @@ -18,7 +18,7 @@ using namespace ActsExamples; GdmlDetectorConstruction::GdmlDetectorConstruction( std::string path, - std::vector> regionCreators) + std::vector> regionCreators) : G4VUserDetectorConstruction(), m_path(std::move(path)), m_regionCreators(std::move(regionCreators)) {} @@ -32,7 +32,7 @@ G4VPhysicalVolume* GdmlDetectorConstruction::Construct() { // Create regions for (const auto& regionCreator : m_regionCreators) { - regionCreator->Construct(); + regionCreator->construct(); } } return m_world; @@ -40,7 +40,7 @@ G4VPhysicalVolume* GdmlDetectorConstruction::Construct() { GdmlDetectorConstructionFactory::GdmlDetectorConstructionFactory( std::string path, - std::vector> regionCreators) + std::vector> regionCreators) : m_path(std::move(path)), m_regionCreators(std::move(regionCreators)) {} std::unique_ptr diff --git a/Examples/Algorithms/Geant4/src/Geant4Manager.cpp b/Examples/Algorithms/Geant4/src/Geant4Manager.cpp index fb981704561..13e7428ac60 100644 --- a/Examples/Algorithms/Geant4/src/Geant4Manager.cpp +++ b/Examples/Algorithms/Geant4/src/Geant4Manager.cpp @@ -109,7 +109,8 @@ std::shared_ptr Geant4Manager::createHandle( } void Geant4Manager::registerPhysicsListFactory( - std::string name, std::shared_ptr physicsListFactory) { + std::string name, + std::shared_ptr physicsListFactory) { if (m_physicsListFactories.contains(name)) { throw std::invalid_argument("name already mapped"); } @@ -126,22 +127,23 @@ std::unique_ptr Geant4Manager::createPhysicsList( return it->second->factorize(); } -const std::unordered_map>& +const std::unordered_map>& Geant4Manager::getPhysicsListFactories() const { return m_physicsListFactories; } Geant4Manager::Geant4Manager() { registerPhysicsListFactory( - "FTFP_BERT", std::make_shared( + "FTFP_BERT", std::make_shared( []() { return std::make_unique(); })); registerPhysicsListFactory( - "FTFP_BERT_ATL", std::make_shared( + "FTFP_BERT_ATL", std::make_shared( []() { return std::make_unique(); })); - registerPhysicsListFactory("MaterialPhysicsList", - std::make_shared([]() { - return std::make_unique(); - })); + registerPhysicsListFactory( + "MaterialPhysicsList", + std::make_shared( + []() { return std::make_unique(); })); } Geant4Manager::~Geant4Manager() = default; diff --git a/Examples/Algorithms/Geant4/src/Geant4Simulation.cpp b/Examples/Algorithms/Geant4/src/Geant4Simulation.cpp index 795ddad78fa..bbc5c533e5c 100644 --- a/Examples/Algorithms/Geant4/src/Geant4Simulation.cpp +++ b/Examples/Algorithms/Geant4/src/Geant4Simulation.cpp @@ -28,7 +28,6 @@ #include "ActsExamples/Geant4/SimParticleTranslation.hpp" #include "ActsExamples/Geant4/SteppingActionList.hpp" -#include #include #include @@ -47,22 +46,24 @@ #include #include -ActsExamples::Geant4SimulationBase::Geant4SimulationBase( - const Config& cfg, std::string name, Acts::Logging::Level level) +namespace ActsExamples { + +Geant4SimulationBase::Geant4SimulationBase(const Config& cfg, std::string name, + Acts::Logging::Level level) : IAlgorithm(std::move(name), level) { if (cfg.inputParticles.empty()) { throw std::invalid_argument("Missing input particle collection"); } - if (!cfg.detectorConstructionFactory) { + if (cfg.detectorConstructionFactory == nullptr) { throw std::invalid_argument("Missing detector construction factory"); } - if (!cfg.randomNumbers) { + if (cfg.randomNumbers == nullptr) { throw std::invalid_argument("Missing random numbers"); } m_logger = Acts::getDefaultLogger("Geant4", level); - m_eventStore = std::make_shared(); + m_eventStore = std::make_shared(); // tweak logging // If we are in VERBOSE mode, set the verbose level in Geant4 to 2. @@ -70,9 +71,9 @@ ActsExamples::Geant4SimulationBase::Geant4SimulationBase( m_geant4Level = logger().level() == Acts::Logging::VERBOSE ? 2 : 0; } -ActsExamples::Geant4SimulationBase::~Geant4SimulationBase() = default; +Geant4SimulationBase::~Geant4SimulationBase() = default; -void ActsExamples::Geant4SimulationBase::commonInitialization() { +void Geant4SimulationBase::commonInitialization() { // Set the detector construction { // Clear detector construction if it exists @@ -89,24 +90,22 @@ void ActsExamples::Geant4SimulationBase::commonInitialization() { m_geant4Instance->tweakLogging(m_geant4Level); } -G4RunManager& ActsExamples::Geant4SimulationBase::runManager() const { +G4RunManager& Geant4SimulationBase::runManager() const { return *m_geant4Instance->runManager.get(); } -ActsExamples::EventStore& ActsExamples::Geant4SimulationBase::eventStore() - const { +Geant4::EventStore& Geant4SimulationBase::eventStore() const { return *m_eventStore; } -ActsExamples::ProcessCode ActsExamples::Geant4SimulationBase::initialize() { +ProcessCode Geant4SimulationBase::initialize() { // Initialize the Geant4 run manager runManager().Initialize(); - return ActsExamples::ProcessCode::SUCCESS; + return ProcessCode::SUCCESS; } -ActsExamples::ProcessCode ActsExamples::Geant4SimulationBase::execute( - const ActsExamples::AlgorithmContext& ctx) const { +ProcessCode Geant4SimulationBase::execute(const AlgorithmContext& ctx) const { // Ensure exclusive access to the Geant4 run manager std::lock_guard guard(m_geant4Instance->mutex); @@ -114,7 +113,7 @@ ActsExamples::ProcessCode ActsExamples::Geant4SimulationBase::execute( G4Random::setTheSeed(config().randomNumbers->generateSeed(ctx)); // Get and reset event registry state - eventStore() = EventStore{}; + eventStore() = Geant4::EventStore{}; // Register the current event store to the registry // this will allow access from the User*Actions @@ -153,16 +152,15 @@ ActsExamples::ProcessCode ActsExamples::Geant4SimulationBase::execute( "Step merging: max hits per hit: " << eventStore().maxStepsForHit); } - return ActsExamples::ProcessCode::SUCCESS; + return ProcessCode::SUCCESS; } -std::shared_ptr -ActsExamples::Geant4SimulationBase::geant4Handle() const { +std::shared_ptr Geant4SimulationBase::geant4Handle() const { return m_geant4Instance; } -ActsExamples::Geant4Simulation::Geant4Simulation(const Config& cfg, - Acts::Logging::Level level) +Geant4Simulation::Geant4Simulation(const Config& cfg, + Acts::Logging::Level level) : Geant4SimulationBase(cfg, "Geant4Simulation", level), m_cfg(cfg) { m_geant4Instance = m_cfg.geant4Handle @@ -180,10 +178,10 @@ ActsExamples::Geant4Simulation::Geant4Simulation(const Config& cfg, if (runManager().GetUserPrimaryGeneratorAction() != nullptr) { delete runManager().GetUserPrimaryGeneratorAction(); } - SimParticleTranslation::Config prCfg; + Geant4::SimParticleTranslation::Config prCfg; prCfg.eventStore = m_eventStore; // G4RunManager will take care of deletion - auto primaryGeneratorAction = new SimParticleTranslation( + auto primaryGeneratorAction = new Geant4::SimParticleTranslation( prCfg, m_logger->cloneWithSuffix("SimParticleTranslation")); // Set the primary generator action runManager().SetUserAction(primaryGeneratorAction); @@ -195,48 +193,49 @@ ActsExamples::Geant4Simulation::Geant4Simulation(const Config& cfg, if (runManager().GetUserTrackingAction() != nullptr) { delete runManager().GetUserTrackingAction(); } - ParticleTrackingAction::Config trackingCfg; + Geant4::ParticleTrackingAction::Config trackingCfg; trackingCfg.eventStore = m_eventStore; trackingCfg.keepParticlesWithoutHits = cfg.keepParticlesWithoutHits; // G4RunManager will take care of deletion - auto trackingAction = new ParticleTrackingAction( + auto trackingAction = new Geant4::ParticleTrackingAction( trackingCfg, m_logger->cloneWithSuffix("ParticleTracking")); runManager().SetUserAction(trackingAction); } // Stepping actions - SensitiveSteppingAction* sensitiveSteppingActionAccess = nullptr; + Geant4::SensitiveSteppingAction* sensitiveSteppingActionAccess = nullptr; { // Clear stepping action if it exists if (runManager().GetUserSteppingAction() != nullptr) { delete runManager().GetUserSteppingAction(); } - ParticleKillAction::Config particleKillCfg; + Geant4::ParticleKillAction::Config particleKillCfg; particleKillCfg.eventStore = m_eventStore; particleKillCfg.volume = cfg.killVolume; particleKillCfg.maxTime = cfg.killAfterTime; particleKillCfg.secondaries = cfg.killSecondaries; - SensitiveSteppingAction::Config stepCfg; + Geant4::SensitiveSteppingAction::Config stepCfg; stepCfg.eventStore = m_eventStore; stepCfg.charged = true; stepCfg.neutral = cfg.recordHitsOfNeutrals; stepCfg.primary = true; stepCfg.secondary = cfg.recordHitsOfSecondaries; - SteppingActionList::Config steppingCfg; - steppingCfg.actions.push_back(std::make_unique( + Geant4::SteppingActionList::Config steppingCfg; + steppingCfg.actions.push_back(std::make_unique( particleKillCfg, m_logger->cloneWithSuffix("Killer"))); - auto sensitiveSteppingAction = std::make_unique( - stepCfg, m_logger->cloneWithSuffix("SensitiveStepping")); + auto sensitiveSteppingAction = + std::make_unique( + stepCfg, m_logger->cloneWithSuffix("SensitiveStepping")); sensitiveSteppingActionAccess = sensitiveSteppingAction.get(); steppingCfg.actions.push_back(std::move(sensitiveSteppingAction)); // G4RunManager will take care of deletion - auto steppingAction = new SteppingActionList(steppingCfg); + auto steppingAction = new Geant4::SteppingActionList(steppingCfg); runManager().SetUserAction(steppingAction); } @@ -251,9 +250,10 @@ ActsExamples::Geant4Simulation::Geant4Simulation(const Config& cfg, if (cfg.magneticField) { ACTS_INFO("Setting ACTS configured field to Geant4."); - MagneticFieldWrapper::Config g4FieldCfg; + Geant4::MagneticFieldWrapper::Config g4FieldCfg; g4FieldCfg.magneticField = cfg.magneticField; - m_magneticField = std::make_unique(g4FieldCfg); + m_magneticField = + std::make_unique(g4FieldCfg); // Set the field or the G4Field manager m_fieldManager = std::make_unique(); @@ -266,7 +266,7 @@ ActsExamples::Geant4Simulation::Geant4Simulation(const Config& cfg, // ACTS sensitive surfaces are provided, so hit creation is turned on if (cfg.sensitiveSurfaceMapper != nullptr) { - SensitiveSurfaceMapper::State sState; + Geant4::SensitiveSurfaceMapper::State sState; ACTS_INFO( "Remapping selected volumes from Geant4 to Acts::Surface::GeometryID"); cfg.sensitiveSurfaceMapper->remapSensitiveNames( @@ -288,10 +288,9 @@ ActsExamples::Geant4Simulation::Geant4Simulation(const Config& cfg, m_outputParticles.initialize(cfg.outputParticles); } -ActsExamples::Geant4Simulation::~Geant4Simulation() = default; +Geant4Simulation::~Geant4Simulation() = default; -ActsExamples::ProcessCode ActsExamples::Geant4Simulation::execute( - const ActsExamples::AlgorithmContext& ctx) const { +ProcessCode Geant4Simulation::execute(const AlgorithmContext& ctx) const { auto ret = Geant4SimulationBase::execute(ctx); if (ret != ProcessCode::SUCCESS) { return ret; @@ -313,18 +312,18 @@ ActsExamples::ProcessCode ActsExamples::Geant4Simulation::execute( ctx, SimHitContainer(eventStore().hits.begin(), eventStore().hits.end())); #endif - return ActsExamples::ProcessCode::SUCCESS; + return ProcessCode::SUCCESS; } -ActsExamples::Geant4MaterialRecording::Geant4MaterialRecording( - const Config& cfg, Acts::Logging::Level level) +Geant4MaterialRecording::Geant4MaterialRecording(const Config& cfg, + Acts::Logging::Level level) : Geant4SimulationBase(cfg, "Geant4Simulation", level), m_cfg(cfg) { auto physicsListName = "MaterialPhysicsList"; m_geant4Instance = m_cfg.geant4Handle ? m_cfg.geant4Handle : Geant4Manager::instance().createHandle( - std::make_unique( + std::make_unique( m_logger->cloneWithSuffix("MaterialPhysicsList")), physicsListName); if (m_geant4Instance->physicsListName != physicsListName) { @@ -340,14 +339,14 @@ ActsExamples::Geant4MaterialRecording::Geant4MaterialRecording( delete runManager().GetUserPrimaryGeneratorAction(); } - SimParticleTranslation::Config prCfg; + Geant4::SimParticleTranslation::Config prCfg; prCfg.eventStore = m_eventStore; prCfg.forcedPdgCode = 0; prCfg.forcedCharge = 0.; prCfg.forcedMass = 0.; // G4RunManager will take care of deletion - auto primaryGeneratorAction = new SimParticleTranslation( + auto primaryGeneratorAction = new Geant4::SimParticleTranslation( prCfg, m_logger->cloneWithSuffix("SimParticleTranslation")); // Set the primary generator action runManager().SetUserAction(primaryGeneratorAction); @@ -359,11 +358,11 @@ ActsExamples::Geant4MaterialRecording::Geant4MaterialRecording( if (runManager().GetUserTrackingAction() != nullptr) { delete runManager().GetUserTrackingAction(); } - ParticleTrackingAction::Config trackingCfg; + Geant4::ParticleTrackingAction::Config trackingCfg; trackingCfg.eventStore = m_eventStore; trackingCfg.keepParticlesWithoutHits = true; // G4RunManager will take care of deletion - auto trackingAction = new ParticleTrackingAction( + auto trackingAction = new Geant4::ParticleTrackingAction( trackingCfg, m_logger->cloneWithSuffix("ParticleTracking")); runManager().SetUserAction(trackingAction); } @@ -374,11 +373,11 @@ ActsExamples::Geant4MaterialRecording::Geant4MaterialRecording( if (runManager().GetUserSteppingAction() != nullptr) { delete runManager().GetUserSteppingAction(); } - MaterialSteppingAction::Config steppingCfg; + Geant4::MaterialSteppingAction::Config steppingCfg; steppingCfg.eventStore = m_eventStore; steppingCfg.excludeMaterials = m_cfg.excludeMaterials; // G4RunManager will take care of deletion - auto steppingAction = new MaterialSteppingAction( + auto steppingAction = new Geant4::MaterialSteppingAction( steppingCfg, m_logger->cloneWithSuffix("MaterialSteppingAction")); runManager().SetUserAction(steppingAction); } @@ -389,10 +388,10 @@ ActsExamples::Geant4MaterialRecording::Geant4MaterialRecording( m_outputMaterialTracks.initialize(cfg.outputMaterialTracks); } -ActsExamples::Geant4MaterialRecording::~Geant4MaterialRecording() = default; +Geant4MaterialRecording::~Geant4MaterialRecording() = default; -ActsExamples::ProcessCode ActsExamples::Geant4MaterialRecording::execute( - const ActsExamples::AlgorithmContext& ctx) const { +ProcessCode Geant4MaterialRecording::execute( + const AlgorithmContext& ctx) const { const auto ret = Geant4SimulationBase::execute(ctx); if (ret != ProcessCode::SUCCESS) { return ret; @@ -402,5 +401,7 @@ ActsExamples::ProcessCode ActsExamples::Geant4MaterialRecording::execute( m_outputMaterialTracks( ctx, decltype(eventStore().materialTracks)(eventStore().materialTracks)); - return ActsExamples::ProcessCode::SUCCESS; + return ProcessCode::SUCCESS; } + +} // namespace ActsExamples diff --git a/Examples/Algorithms/Geant4/src/GeoModelDetectorConstruction.cpp b/Examples/Algorithms/Geant4/src/GeoModelDetectorConstruction.cpp index c3ad0eea6de..8d33622714b 100644 --- a/Examples/Algorithms/Geant4/src/GeoModelDetectorConstruction.cpp +++ b/Examples/Algorithms/Geant4/src/GeoModelDetectorConstruction.cpp @@ -21,7 +21,7 @@ using namespace ActsExamples; GeoModelDetectorConstruction::GeoModelDetectorConstruction( const Acts::GeoModelTree& geoModelTree, - std::vector> regionCreators) + std::vector> regionCreators) : G4VUserDetectorConstruction(), m_geoModelTree(geoModelTree), m_regionCreators(std::move(regionCreators)) { @@ -42,7 +42,7 @@ G4VPhysicalVolume* GeoModelDetectorConstruction::Construct() { // Create regions for (const auto& regionCreator : m_regionCreators) { - regionCreator->Construct(); + regionCreator->construct(); } } return m_g4World; @@ -50,7 +50,7 @@ G4VPhysicalVolume* GeoModelDetectorConstruction::Construct() { GeoModelDetectorConstructionFactory::GeoModelDetectorConstructionFactory( const Acts::GeoModelTree& geoModelTree, - std::vector> regionCreators) + std::vector> regionCreators) : m_geoModelTree(geoModelTree), m_regionCreators(std::move(regionCreators)) {} diff --git a/Examples/Algorithms/Geant4/src/MagneticFieldWrapper.cpp b/Examples/Algorithms/Geant4/src/MagneticFieldWrapper.cpp index 33f15fa6586..757cac35fea 100644 --- a/Examples/Algorithms/Geant4/src/MagneticFieldWrapper.cpp +++ b/Examples/Algorithms/Geant4/src/MagneticFieldWrapper.cpp @@ -12,21 +12,20 @@ #include "Acts/Definitions/Units.hpp" #include "Acts/MagneticField/MagneticFieldContext.hpp" #include "Acts/MagneticField/MagneticFieldProvider.hpp" -#include "Acts/Utilities/Result.hpp" -#include -#include #include #include #include -ActsExamples::MagneticFieldWrapper::MagneticFieldWrapper( +namespace ActsExamples::Geant4 { + +MagneticFieldWrapper::MagneticFieldWrapper( const Config& cfg, std::unique_ptr logger) : G4MagneticField(), m_cfg(cfg), m_logger(std::move(logger)) {} -void ActsExamples::MagneticFieldWrapper::GetFieldValue(const G4double Point[4], - G4double* Bfield) const { +void MagneticFieldWrapper::GetFieldValue(const G4double Point[4], + G4double* Bfield) const { constexpr double convertLength = CLHEP::mm / Acts::UnitConstants::mm; constexpr double convertField = CLHEP::tesla / Acts::UnitConstants::T; @@ -47,3 +46,5 @@ void ActsExamples::MagneticFieldWrapper::GetFieldValue(const G4double Point[4], Bfield[1] = convertField * field[1]; Bfield[2] = convertField * field[2]; } + +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/src/MaterialPhysicsList.cpp b/Examples/Algorithms/Geant4/src/MaterialPhysicsList.cpp index d115e9e1794..bc0d228e87d 100644 --- a/Examples/Algorithms/Geant4/src/MaterialPhysicsList.cpp +++ b/Examples/Algorithms/Geant4/src/MaterialPhysicsList.cpp @@ -15,27 +15,31 @@ #include #include -ActsExamples::MaterialPhysicsList::MaterialPhysicsList( +namespace ActsExamples::Geant4 { + +MaterialPhysicsList::MaterialPhysicsList( std::unique_ptr logger) : G4VUserPhysicsList(), m_logger(std::move(logger)) { defaultCutValue = 1.0 * CLHEP::cm; } -void ActsExamples::MaterialPhysicsList::ConstructParticle() { +void MaterialPhysicsList::ConstructParticle() { ACTS_DEBUG("Construct Geantinos and Charged Geantinos."); G4Geantino::GeantinoDefinition(); G4ChargedGeantino::ChargedGeantinoDefinition(); } -void ActsExamples::MaterialPhysicsList::ConstructProcess() { +void MaterialPhysicsList::ConstructProcess() { ACTS_DEBUG("Adding Transport as single supperted Process."); AddTransportation(); } -void ActsExamples::MaterialPhysicsList::SetCuts() { +void MaterialPhysicsList::SetCuts() { SetCutsWithDefault(); if (verboseLevel > 0) { DumpCutValuesTable(); } } + +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/src/MaterialSteppingAction.cpp b/Examples/Algorithms/Geant4/src/MaterialSteppingAction.cpp index c4f0e6528bd..6773079dcd7 100644 --- a/Examples/Algorithms/Geant4/src/MaterialSteppingAction.cpp +++ b/Examples/Algorithms/Geant4/src/MaterialSteppingAction.cpp @@ -24,14 +24,15 @@ #include #include -ActsExamples::MaterialSteppingAction::MaterialSteppingAction( +namespace ActsExamples::Geant4 { + +MaterialSteppingAction::MaterialSteppingAction( const Config& cfg, std::unique_ptr logger) : G4UserSteppingAction(), m_cfg(cfg), m_logger(std::move(logger)) {} -ActsExamples::MaterialSteppingAction::~MaterialSteppingAction() = default; +MaterialSteppingAction::~MaterialSteppingAction() = default; -void ActsExamples::MaterialSteppingAction::UserSteppingAction( - const G4Step* step) { +void MaterialSteppingAction::UserSteppingAction(const G4Step* step) { // Get the material & check if it is present G4Material* material = step->GetPreStepPoint()->GetMaterial(); if (material == nullptr) { @@ -111,3 +112,5 @@ void ActsExamples::MaterialSteppingAction::UserSteppingAction( mInteraction); } } + +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/src/ParticleKillAction.cpp b/Examples/Algorithms/Geant4/src/ParticleKillAction.cpp index 5090a74dafa..bbc55390c69 100644 --- a/Examples/Algorithms/Geant4/src/ParticleKillAction.cpp +++ b/Examples/Algorithms/Geant4/src/ParticleKillAction.cpp @@ -23,11 +23,13 @@ #include #include -ActsExamples::ParticleKillAction::ParticleKillAction( +namespace ActsExamples::Geant4 { + +ParticleKillAction::ParticleKillAction( const Config& cfg, std::unique_ptr logger) : G4UserSteppingAction(), m_cfg(cfg), m_logger(std::move(logger)) {} -void ActsExamples::ParticleKillAction::UserSteppingAction(const G4Step* step) { +void ParticleKillAction::UserSteppingAction(const G4Step* step) { constexpr double convertLength = Acts::UnitConstants::mm / CLHEP::mm; constexpr double convertTime = Acts::UnitConstants::ns / CLHEP::ns; @@ -72,3 +74,5 @@ void ActsExamples::ParticleKillAction::UserSteppingAction(const G4Step* step) { } } } + +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/src/ParticleTrackingAction.cpp b/Examples/Algorithms/Geant4/src/ParticleTrackingAction.cpp index ba59debc893..886646a3655 100644 --- a/Examples/Algorithms/Geant4/src/ParticleTrackingAction.cpp +++ b/Examples/Algorithms/Geant4/src/ParticleTrackingAction.cpp @@ -25,12 +25,13 @@ #include #include -ActsExamples::ParticleTrackingAction::ParticleTrackingAction( +namespace ActsExamples::Geant4 { + +ParticleTrackingAction::ParticleTrackingAction( const Config& cfg, std::unique_ptr logger) : G4UserTrackingAction(), m_cfg(cfg), m_logger(std::move(logger)) {} -void ActsExamples::ParticleTrackingAction::PreUserTrackingAction( - const G4Track* aTrack) { +void ParticleTrackingAction::PreUserTrackingAction(const G4Track* aTrack) { // If this is not the case, there are unhandled cases of particle stopping in // the SensitiveSteppingAction // TODO We could also merge the remaining hits to a hit here, but it would be @@ -66,8 +67,7 @@ void ActsExamples::ParticleTrackingAction::PreUserTrackingAction( } } -void ActsExamples::ParticleTrackingAction::PostUserTrackingAction( - const G4Track* aTrack) { +void ParticleTrackingAction::PostUserTrackingAction(const G4Track* aTrack) { // The initial particle maybe was not registered because of a particle ID // collision if (!eventStore().trackIdMapping.contains(aTrack->GetTrackID())) { @@ -83,7 +83,7 @@ void ActsExamples::ParticleTrackingAction::PostUserTrackingAction( if (!m_cfg.keepParticlesWithoutHits && !hasHits) { [[maybe_unused]] auto n = eventStore().particlesSimulated.erase( - ActsExamples::SimParticle(barcode, Acts::PdgParticle::eInvalid)); + SimParticle(barcode, Acts::PdgParticle::eInvalid)); assert(n == 1); return; } @@ -107,8 +107,8 @@ void ActsExamples::ParticleTrackingAction::PostUserTrackingAction( } } -ActsExamples::SimParticleState ActsExamples::ParticleTrackingAction::convert( - const G4Track& aTrack, SimBarcode particleId) const { +SimParticleState ParticleTrackingAction::convert(const G4Track& aTrack, + SimBarcode particleId) const { // Unit conversions G4->::ACTS constexpr double convertTime = Acts::UnitConstants::ns / CLHEP::ns; constexpr double convertLength = Acts::UnitConstants::mm / CLHEP::mm; @@ -147,9 +147,8 @@ ActsExamples::SimParticleState ActsExamples::ParticleTrackingAction::convert( return aParticle; } -std::optional -ActsExamples::ParticleTrackingAction::makeParticleId(G4int trackId, - G4int parentId) const { +std::optional ParticleTrackingAction::makeParticleId( + G4int trackId, G4int parentId) const { // We already have this particle registered (it is one of the input particles // or we are making a final particle state) if (eventStore().trackIdMapping.contains(trackId)) { @@ -174,3 +173,5 @@ ActsExamples::ParticleTrackingAction::makeParticleId(G4int trackId, return pid; } + +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/src/PhysicsListFactory.cpp b/Examples/Algorithms/Geant4/src/PhysicsListFactory.cpp index 95866efa188..e1b88971b5b 100644 --- a/Examples/Algorithms/Geant4/src/PhysicsListFactory.cpp +++ b/Examples/Algorithms/Geant4/src/PhysicsListFactory.cpp @@ -10,7 +10,7 @@ #include -namespace ActsExamples { +namespace ActsExamples::Geant4 { PhysicsListFactoryFunction::PhysicsListFactoryFunction(Function function) : m_function(std::move(function)) {} @@ -20,4 +20,4 @@ std::unique_ptr PhysicsListFactoryFunction::factorize() return m_function(); } -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/src/RegionCreator.cpp b/Examples/Algorithms/Geant4/src/RegionCreator.cpp index 4e3384a98b7..c38dcf83078 100644 --- a/Examples/Algorithms/Geant4/src/RegionCreator.cpp +++ b/Examples/Algorithms/Geant4/src/RegionCreator.cpp @@ -13,7 +13,7 @@ #include #include -namespace ActsExamples { +namespace ActsExamples::Geant4 { RegionCreator::RegionCreator(const Config& cfg, std::string name, Acts::Logging::Level level) @@ -21,7 +21,7 @@ RegionCreator::RegionCreator(const Config& cfg, std::string name, m_cfg(cfg), m_logger(Acts::getDefaultLogger(m_name, level)) {} -void RegionCreator::Construct() { +void RegionCreator::construct() { // create a new G4Region G4Region* region = new G4Region(m_name); @@ -68,4 +68,4 @@ void RegionCreator::Construct() { region->SetProductionCuts(cuts); } -} // namespace ActsExamples +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp b/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp index 17df42bdb21..098cce7b3aa 100644 --- a/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp +++ b/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp @@ -13,7 +13,6 @@ #include "Acts/Geometry/GeometryIdentifier.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/MultiIndex.hpp" -#include "ActsExamples/EventData/SimHit.hpp" #include "ActsExamples/Geant4/EventStore.hpp" #include "ActsExamples/Geant4/SensitiveSurfaceMapper.hpp" #include "ActsFatras/EventData/Barcode.hpp" @@ -33,8 +32,6 @@ #include #include -class G4PrimaryParticle; - #if BOOST_VERSION >= 107800 #include @@ -95,12 +92,13 @@ ActsFatras::Hit hitFromStep(const G4StepPoint* preStepPoint, } } // namespace -ActsExamples::SensitiveSteppingAction::SensitiveSteppingAction( +namespace ActsExamples::Geant4 { + +SensitiveSteppingAction::SensitiveSteppingAction( const Config& cfg, std::unique_ptr logger) : G4UserSteppingAction(), m_cfg(cfg), m_logger(std::move(logger)) {} -void ActsExamples::SensitiveSteppingAction::UserSteppingAction( - const G4Step* step) { +void SensitiveSteppingAction::UserSteppingAction(const G4Step* step) { // Unit conversions G4->::ACTS static constexpr double convertLength = Acts::UnitConstants::mm / CLHEP::mm; @@ -279,3 +277,5 @@ void ActsExamples::SensitiveSteppingAction::UserSteppingAction( assert(false && "should never reach this"); } + +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp index 2fd1a924d94..924a898c238 100644 --- a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp +++ b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp @@ -63,6 +63,7 @@ struct access, Index> { } // namespace boost::geometry::traits namespace { + void writeG4Polyhedron( Acts::IVisualization3D& visualizer, const G4Polyhedron& polyhedron, const Acts::Transform3& trafo = Acts::Transform3::Identity(), @@ -89,10 +90,12 @@ void writeG4Polyhedron( visualizer.face(faces, color); } } + } // namespace -std::vector -ActsExamples::SensitiveCandidates::queryPosition( +namespace ActsExamples::Geant4 { + +std::vector SensitiveCandidates::queryPosition( const Acts::GeometryContext& gctx, const Acts::Vector3& position) const { std::vector surfaces; @@ -119,8 +122,7 @@ ActsExamples::SensitiveCandidates::queryPosition( return surfaces; } -std::vector ActsExamples::SensitiveCandidates::queryAll() - const { +std::vector SensitiveCandidates::queryAll() const { std::vector surfaces; const bool restrictToSensitives = true; @@ -130,11 +132,11 @@ std::vector ActsExamples::SensitiveCandidates::queryAll() return surfaces; } -ActsExamples::SensitiveSurfaceMapper::SensitiveSurfaceMapper( +SensitiveSurfaceMapper::SensitiveSurfaceMapper( const Config& cfg, std::unique_ptr logger) : m_cfg(cfg), m_logger(std::move(logger)) {} -void ActsExamples::SensitiveSurfaceMapper::remapSensitiveNames( +void SensitiveSurfaceMapper::remapSensitiveNames( State& state, const Acts::GeometryContext& gctx, G4VPhysicalVolume* g4PhysicalVolume, const Acts::Transform3& motherTransform) const { @@ -291,7 +293,7 @@ void ActsExamples::SensitiveSurfaceMapper::remapSensitiveNames( state.g4VolumeToSurfaces.insert({g4PhysicalVolume, mappedSurface}); } -bool ActsExamples::SensitiveSurfaceMapper::checkMapping( +bool SensitiveSurfaceMapper::checkMapping( const State& state, const Acts::GeometryContext& gctx, bool writeMissingG4VolsAsObj, bool writeMissingSurfacesAsObj) const { auto allSurfaces = m_cfg.candidateSurfaces->queryAll(); @@ -343,3 +345,5 @@ bool ActsExamples::SensitiveSurfaceMapper::checkMapping( return missing.empty(); } + +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/src/SimParticleTranslation.cpp b/Examples/Algorithms/Geant4/src/SimParticleTranslation.cpp index 8b8156ff3e4..e505edafa76 100644 --- a/Examples/Algorithms/Geant4/src/SimParticleTranslation.cpp +++ b/Examples/Algorithms/Geant4/src/SimParticleTranslation.cpp @@ -28,19 +28,17 @@ #include #include -namespace ActsExamples { -class WhiteBoard; -} // namespace ActsExamples +namespace ActsExamples::Geant4 { -ActsExamples::SimParticleTranslation::SimParticleTranslation( +SimParticleTranslation::SimParticleTranslation( const Config& cfg, std::unique_ptr logger) : G4VUserPrimaryGeneratorAction(), m_cfg(cfg), m_logger(std::move(logger)) {} -ActsExamples::SimParticleTranslation::~SimParticleTranslation() = default; +SimParticleTranslation::~SimParticleTranslation() = default; -void ActsExamples::SimParticleTranslation::GeneratePrimaries(G4Event* anEvent) { +void SimParticleTranslation::GeneratePrimaries(G4Event* anEvent) { anEvent->SetEventID(m_eventNr++); unsigned int eventID = anEvent->GetEventID(); @@ -158,3 +156,5 @@ void ActsExamples::SimParticleTranslation::GeneratePrimaries(G4Event* anEvent) { << lastVertex->transpose()); } } + +} // namespace ActsExamples::Geant4 diff --git a/Examples/Algorithms/Geant4/src/TelescopeG4DetectorConstruction.cpp b/Examples/Algorithms/Geant4/src/TelescopeG4DetectorConstruction.cpp index 423acf7e2a5..9d309932fbe 100644 --- a/Examples/Algorithms/Geant4/src/TelescopeG4DetectorConstruction.cpp +++ b/Examples/Algorithms/Geant4/src/TelescopeG4DetectorConstruction.cpp @@ -26,18 +26,18 @@ #include "G4RunManager.hh" #include "G4SystemOfUnits.hh" -ActsExamples::Telescope::TelescopeG4DetectorConstruction:: - TelescopeG4DetectorConstruction( - const TelescopeDetector::Config& cfg, - std::vector> regionCreators) +namespace ActsExamples { + +Telescope::TelescopeG4DetectorConstruction::TelescopeG4DetectorConstruction( + const TelescopeDetector::Config& cfg, + std::vector> regionCreators) : m_cfg(cfg), m_regionCreators(std::move(regionCreators)) { throw_assert(cfg.surfaceType == static_cast(Telescope::TelescopeSurfaceType::Plane), "only plan is supported right now"); } -G4VPhysicalVolume* -ActsExamples::Telescope::TelescopeG4DetectorConstruction::Construct() { +G4VPhysicalVolume* Telescope::TelescopeG4DetectorConstruction::Construct() { if (m_world != nullptr) { return m_world; } @@ -162,21 +162,22 @@ ActsExamples::Telescope::TelescopeG4DetectorConstruction::Construct() { // Create regions for (const auto& regionCreator : m_regionCreators) { - regionCreator->Construct(); + regionCreator->construct(); } return m_world; } -ActsExamples::Telescope::TelescopeG4DetectorConstructionFactory:: +Telescope::TelescopeG4DetectorConstructionFactory:: TelescopeG4DetectorConstructionFactory( const TelescopeDetector::Config& cfg, - std::vector> regionCreators) + std::vector> regionCreators) : m_cfg(cfg), m_regionCreators(std::move(regionCreators)) {} std::unique_ptr -ActsExamples::Telescope::TelescopeG4DetectorConstructionFactory::factorize() - const { +Telescope::TelescopeG4DetectorConstructionFactory::factorize() const { return std::make_unique(m_cfg, m_regionCreators); } + +} // namespace ActsExamples diff --git a/Examples/Algorithms/Geant4HepMC/include/ActsExamples/Geant4HepMC/EventRecording.hpp b/Examples/Algorithms/Geant4HepMC/include/ActsExamples/Geant4HepMC/EventRecording.hpp index 256a82a4471..6f45940182c 100644 --- a/Examples/Algorithms/Geant4HepMC/include/ActsExamples/Geant4HepMC/EventRecording.hpp +++ b/Examples/Algorithms/Geant4HepMC/include/ActsExamples/Geant4HepMC/EventRecording.hpp @@ -8,8 +8,6 @@ #pragma once -#include "Acts/Definitions/Algebra.hpp" -#include "Acts/Propagator/MaterialInteractor.hpp" #include "Acts/Utilities/Logger.hpp" #include "ActsExamples/EventData/SimParticle.hpp" #include "ActsExamples/Framework/DataHandle.hpp" @@ -24,9 +22,12 @@ class G4RunManager; -namespace ActsExamples { - +namespace ActsExamples::Geant4 { class DetectorConstructionFactory; +class RegionCreator; +} // namespace ActsExamples::Geant4 + +namespace ActsExamples { class EventRecording final : public ActsExamples::IAlgorithm { public: @@ -37,7 +38,8 @@ class EventRecording final : public ActsExamples::IAlgorithm { /// The recorded events output std::string outputHepMcTracks = "geant-outcome-tracks"; - std::shared_ptr detectorConstructionFactory; + std::shared_ptr + detectorConstructionFactory; /// random number seed 1 int seed1 = 12345; diff --git a/Examples/Algorithms/Geant4HepMC/src/EventRecording.cpp b/Examples/Algorithms/Geant4HepMC/src/EventRecording.cpp index e4900f63c05..93c27b0c1c1 100644 --- a/Examples/Algorithms/Geant4HepMC/src/EventRecording.cpp +++ b/Examples/Algorithms/Geant4HepMC/src/EventRecording.cpp @@ -11,9 +11,7 @@ #include "ActsExamples/EventData/SimParticle.hpp" #include "ActsExamples/Framework/WhiteBoard.hpp" #include "ActsExamples/Geant4/DetectorConstructionFactory.hpp" -#include "ActsExamples/Geant4/GdmlDetectorConstruction.hpp" -#include #include #include @@ -26,14 +24,15 @@ #include "RunAction.hpp" #include "SteppingAction.hpp" -ActsExamples::EventRecording::~EventRecording() { +namespace ActsExamples { + +EventRecording::~EventRecording() { m_runManager = nullptr; } -ActsExamples::EventRecording::EventRecording( - const ActsExamples::EventRecording::Config& config, - Acts::Logging::Level level) - : ActsExamples::IAlgorithm("EventRecording", level), +EventRecording::EventRecording(const EventRecording::Config& config, + Acts::Logging::Level level) + : IAlgorithm("EventRecording", level), m_cfg(config), m_runManager(std::make_unique()) { if (m_cfg.inputParticles.empty()) { @@ -42,7 +41,7 @@ ActsExamples::EventRecording::EventRecording( if (m_cfg.outputHepMcTracks.empty()) { throw std::invalid_argument("Missing output event collection"); } - if (!m_cfg.detectorConstructionFactory) { + if (m_cfg.detectorConstructionFactory == nullptr) { throw std::invalid_argument("Missing detector construction object"); } @@ -55,19 +54,17 @@ ActsExamples::EventRecording::EventRecording( m_runManager->SetUserInitialization( m_cfg.detectorConstructionFactory->factorize().release()); m_runManager->SetUserInitialization(new FTFP_BERT); - m_runManager->SetUserAction(new ActsExamples::Geant4::HepMC3::RunAction()); + m_runManager->SetUserAction(new Geant4::HepMC3::RunAction()); m_runManager->SetUserAction( - new ActsExamples::Geant4::HepMC3::EventAction(m_cfg.processesCombine)); + new Geant4::HepMC3::EventAction(m_cfg.processesCombine)); m_runManager->SetUserAction( - new ActsExamples::Geant4::HepMC3::PrimaryGeneratorAction(m_cfg.seed1, - m_cfg.seed2)); + new Geant4::HepMC3::PrimaryGeneratorAction(m_cfg.seed1, m_cfg.seed2)); m_runManager->SetUserAction( - new ActsExamples::Geant4::HepMC3::SteppingAction(m_cfg.processesReject)); + new Geant4::HepMC3::SteppingAction(m_cfg.processesReject)); m_runManager->Initialize(); } -ActsExamples::ProcessCode ActsExamples::EventRecording::execute( - const ActsExamples::AlgorithmContext& context) const { +ProcessCode EventRecording::execute(const AlgorithmContext& context) const { // ensure exclusive access to the geant run manager std::lock_guard guard(m_runManagerLock); @@ -80,8 +77,8 @@ ActsExamples::ProcessCode ActsExamples::EventRecording::execute( for (const auto& part : initialParticles) { // Prepare the particle gun - ActsExamples::Geant4::HepMC3::PrimaryGeneratorAction::instance() - ->prepareParticleGun(part); + Geant4::HepMC3::PrimaryGeneratorAction::instance()->prepareParticleGun( + part); // Begin with the simulation m_runManager->BeamOn(1); @@ -92,8 +89,7 @@ ActsExamples::ProcessCode ActsExamples::EventRecording::execute( } // Set event start time - HepMC3::GenEvent event = - ActsExamples::Geant4::HepMC3::EventAction::instance()->event(); + HepMC3::GenEvent event = Geant4::HepMC3::EventAction::instance()->event(); HepMC3::FourVector shift(0., 0., 0., part.time() / Acts::UnitConstants::mm); event.shift_position_by(shift); @@ -174,5 +170,7 @@ ActsExamples::ProcessCode ActsExamples::EventRecording::execute( // Write the recorded material to the event store m_outputEvents(context, std::move(events)); - return ActsExamples::ProcessCode::SUCCESS; + return ProcessCode::SUCCESS; } + +} // namespace ActsExamples diff --git a/Examples/Python/src/Geant4Component.cpp b/Examples/Python/src/Geant4Component.cpp index 1a7edd58e7f..abba9cefe98 100644 --- a/Examples/Python/src/Geant4Component.cpp +++ b/Examples/Python/src/Geant4Component.cpp @@ -16,7 +16,6 @@ #include "Acts/Plugins/Python/Utilities.hpp" #include "Acts/Surfaces/SurfaceVisitorConcept.hpp" #include "Acts/Utilities/Logger.hpp" -#include "ActsExamples/Framework/AlgorithmContext.hpp" #include "ActsExamples/Framework/IContextDecorator.hpp" #include "ActsExamples/Geant4/DetectorConstructionFactory.hpp" #include "ActsExamples/Geant4/GdmlDetectorConstruction.hpp" @@ -65,7 +64,8 @@ namespace Acts::Python { void addGeant4HepMC3(Context& ctx); } -struct ExperimentalSensitiveCandidates : public SensitiveCandidatesBase { +struct ExperimentalSensitiveCandidates + : public Geant4::SensitiveCandidatesBase { std::shared_ptr detector; /// Find the sensitive surfaces for a given position @@ -97,8 +97,8 @@ struct ExperimentalSensitiveCandidates : public SensitiveCandidatesBase { }; PYBIND11_MODULE(ActsPythonBindingsGeant4, mod) { - py::class_>( + py::class_>( mod, "DetectorConstructionFactory"); py::class_>( @@ -129,14 +129,14 @@ PYBIND11_MODULE(ActsPythonBindingsGeant4, mod) { } { - using Config = SensitiveSurfaceMapper::Config; - using State = SensitiveSurfaceMapper::State; + using Config = Geant4::SensitiveSurfaceMapper::Config; + using State = Geant4::SensitiveSurfaceMapper::State; auto sm = - py::class_>( + py::class_>( mod, "SensitiveSurfaceMapper") .def(py::init([](const Config& cfg, Acts::Logging::Level level) { - return std::make_shared( + return std::make_shared( cfg, getDefaultLogger("SensitiveSurfaceMapper", level)); })); @@ -155,10 +155,10 @@ PYBIND11_MODULE(ActsPythonBindingsGeant4, mod) { // Set a new surface finder Config ccfg = cfg; auto candidateSurfaces = - std::make_shared(); + std::make_shared(); candidateSurfaces->trackingGeometry = tGeometry; ccfg.candidateSurfaces = candidateSurfaces; - return std::make_shared( + return std::make_shared( ccfg, getDefaultLogger("SensitiveSurfaceMapper", level)); }); @@ -173,20 +173,21 @@ PYBIND11_MODULE(ActsPythonBindingsGeant4, mod) { std::make_shared(); candidateSurfaces->detector = detector; ccfg.candidateSurfaces = candidateSurfaces; - return std::make_shared( + return std::make_shared( ccfg, getDefaultLogger("SensitiveSurfaceMapper", level)); }); sm.def( "remapSensitiveNames", - [](SensitiveSurfaceMapper& self, State& state, GeometryContext& gctx, - DetectorConstructionFactory& factory, Transform3& transform) { + [](Geant4::SensitiveSurfaceMapper& self, State& state, + GeometryContext& gctx, Geant4::DetectorConstructionFactory& factory, + Transform3& transform) { return self.remapSensitiveNames( state, gctx, factory.factorize()->Construct(), transform); }, "state"_a, "gctx"_a, "g4physicalVolume"_a, "motherTransform"_a); - sm.def("checkMapping", &SensitiveSurfaceMapper::checkMapping, "state"_a, - "gctx"_a, "writeMappedAsObj"_a, "writeMissingAsObj"_a); + sm.def("checkMapping", &Geant4::SensitiveSurfaceMapper::checkMapping, + "state"_a, "gctx"_a, "writeMappedAsObj"_a, "writeMissingAsObj"_a); } { @@ -237,27 +238,28 @@ PYBIND11_MODULE(ActsPythonBindingsGeant4, mod) { } { - py::class_>( mod, "GdmlDetectorConstructionFactory") .def(py::init>>(), + std::vector>>(), py::arg("path"), py::arg("regionCreators") = - std::vector>()); + std::vector>()); } { py::class_< Telescope::TelescopeG4DetectorConstructionFactory, - DetectorConstructionFactory, + Geant4::DetectorConstructionFactory, std::shared_ptr>( mod, "TelescopeG4DetectorConstructionFactory") .def(py::init>>(), + std::vector>>(), py::arg("cfg"), py::arg("regionCreators") = - std::vector>()); + std::vector>()); } { @@ -412,7 +414,7 @@ PYBIND11_MODULE(ActsPythonBindingsGeant4, mod) { } { - using Tool = RegionCreator; + using Tool = Geant4::RegionCreator; using Config = Tool::Config; auto tool = py::class_>(mod, "RegionCreator") .def(py::init(), diff --git a/Examples/Python/src/Geant4DD4hepComponent.cpp b/Examples/Python/src/Geant4DD4hepComponent.cpp index 16ed3b40223..f8dec7d35d1 100644 --- a/Examples/Python/src/Geant4DD4hepComponent.cpp +++ b/Examples/Python/src/Geant4DD4hepComponent.cpp @@ -8,7 +8,6 @@ #include "ActsExamples/DD4hepDetector/DD4hepDetector.hpp" #include "ActsExamples/DDG4/DDG4DetectorConstruction.hpp" -#include "ActsExamples/Framework/ProcessCode.hpp" #include "ActsExamples/Geant4/RegionCreator.hpp" #include @@ -25,12 +24,13 @@ using namespace Acts; PYBIND11_MODULE(ActsPythonBindingsDDG4, m) { py::module_::import("acts.ActsPythonBindingsGeant4"); - py::class_>( m, "DDG4DetectorConstructionFactory") .def(py::init, - std::vector>>(), + std::vector>>(), py::arg("detector"), py::arg("regionCreators") = - std::vector>()); + std::vector>()); } diff --git a/Examples/Python/src/Geant4GeoModelComponent.cpp b/Examples/Python/src/Geant4GeoModelComponent.cpp index 80f6f89eec8..d9c372984db 100644 --- a/Examples/Python/src/Geant4GeoModelComponent.cpp +++ b/Examples/Python/src/Geant4GeoModelComponent.cpp @@ -6,7 +6,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -#include "ActsExamples/Framework/ProcessCode.hpp" #include "ActsExamples/Geant4/DetectorConstructionFactory.hpp" #include "ActsExamples/Geant4/RegionCreator.hpp" #include "ActsExamples/GeoModelG4/GeoModelDetectorConstruction.hpp" @@ -25,12 +24,13 @@ using namespace Acts; PYBIND11_MODULE(ActsPythonBindingsGeoModelG4, m) { py::module_::import("acts.ActsPythonBindingsGeant4"); - py::class_>( m, "GeoModelDetectorConstructionFactory") .def(py::init>>(), + std::vector>>(), py::arg("geoModelTree"), py::arg("regionCreators") = - std::vector>()); + std::vector>()); } diff --git a/Plugins/Geant4/include/Acts/Plugins/Geant4/Geant4DetectorSurfaceFactory.hpp b/Plugins/Geant4/include/Acts/Plugins/Geant4/Geant4DetectorSurfaceFactory.hpp index d06c77412e4..e5868effd19 100644 --- a/Plugins/Geant4/include/Acts/Plugins/Geant4/Geant4DetectorSurfaceFactory.hpp +++ b/Plugins/Geant4/include/Acts/Plugins/Geant4/Geant4DetectorSurfaceFactory.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/Common.hpp" #include "Acts/Plugins/Geant4/Geant4PhysicalVolumeSelectors.hpp" #include "Acts/Surfaces/Surface.hpp" @@ -91,4 +90,5 @@ class Geant4DetectorSurfaceFactory { void construct(Cache& cache, const G4Transform3D& g4ToGlobal, const G4VPhysicalVolume& g4PhysVol, const Options& option); }; + } // namespace Acts diff --git a/Plugins/Geant4/src/Geant4DetectorElement.cpp b/Plugins/Geant4/src/Geant4DetectorElement.cpp index d5410d3b3de..179b351d50e 100644 --- a/Plugins/Geant4/src/Geant4DetectorElement.cpp +++ b/Plugins/Geant4/src/Geant4DetectorElement.cpp @@ -12,31 +12,36 @@ #include -Acts::Geant4DetectorElement::Geant4DetectorElement( - std::shared_ptr surface, const G4VPhysicalVolume& g4physVol, - const Acts::Transform3& toGlobal, Acts::ActsScalar thickness) +namespace Acts { + +Geant4DetectorElement::Geant4DetectorElement(std::shared_ptr surface, + const G4VPhysicalVolume& g4physVol, + const Transform3& toGlobal, + ActsScalar thickness) : m_surface(std::move(surface)), m_g4physVol(&g4physVol), m_toGlobal(toGlobal), m_thickness(thickness) {} -const Acts::Transform3& Acts::Geant4DetectorElement::transform( +const Transform3& Geant4DetectorElement::transform( const GeometryContext& /*gctx*/) const { return m_toGlobal; } -const Acts::Surface& Acts::Geant4DetectorElement::surface() const { +const Surface& Geant4DetectorElement::surface() const { return *m_surface; } -Acts::Surface& Acts::Geant4DetectorElement::surface() { +Surface& Geant4DetectorElement::surface() { return *m_surface; } -Acts::ActsScalar Acts::Geant4DetectorElement::thickness() const { +ActsScalar Geant4DetectorElement::thickness() const { return m_thickness; } -const G4VPhysicalVolume& Acts::Geant4DetectorElement::g4PhysicalVolume() const { +const G4VPhysicalVolume& Geant4DetectorElement::g4PhysicalVolume() const { return *m_g4physVol; } + +} // namespace Acts diff --git a/Plugins/GeoModel/include/Acts/Plugins/GeoModel/GeoModelDetectorElementITk.hpp b/Plugins/GeoModel/include/Acts/Plugins/GeoModel/GeoModelDetectorElementITk.hpp index 31cce3360e9..bbd12562eac 100644 --- a/Plugins/GeoModel/include/Acts/Plugins/GeoModel/GeoModelDetectorElementITk.hpp +++ b/Plugins/GeoModel/include/Acts/Plugins/GeoModel/GeoModelDetectorElementITk.hpp @@ -6,14 +6,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -// This file is part of the Acts project. -// -// Copyright (C) 2024 CERN for the benefit of the Acts project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// 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/. - #pragma once #include "Acts/Plugins/GeoModel/GeoModelDetectorElement.hpp" diff --git a/Plugins/GeoModel/src/GeoModelDetectorElementITk.cpp b/Plugins/GeoModel/src/GeoModelDetectorElementITk.cpp index f671386dec6..1f45a10d391 100644 --- a/Plugins/GeoModel/src/GeoModelDetectorElementITk.cpp +++ b/Plugins/GeoModel/src/GeoModelDetectorElementITk.cpp @@ -6,14 +6,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -// This file is part of the Acts project. -// -// Copyright (C) 2024 CERN for the benefit of the Acts project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// 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 "Acts/Plugins/GeoModel/GeoModelDetectorElementITk.hpp" #include "Acts/Surfaces/AnnulusBounds.hpp" diff --git a/Tests/UnitTests/Plugins/GeoModel/GeoModelDetectorElementITkTests.cpp b/Tests/UnitTests/Plugins/GeoModel/GeoModelDetectorElementITkTests.cpp index 0c945ebb6dd..f3e96e4a6f8 100644 --- a/Tests/UnitTests/Plugins/GeoModel/GeoModelDetectorElementITkTests.cpp +++ b/Tests/UnitTests/Plugins/GeoModel/GeoModelDetectorElementITkTests.cpp @@ -6,14 +6,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -// This file is part of the Acts project. -// -// Copyright (C) 2024 CERN for the benefit of the Acts project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// 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 #include "Acts/Plugins/GeoModel/GeoModelDetectorElementITk.hpp" From 195dca3f46b12800f3f2ea408c905fa840be42fe Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Sat, 23 Nov 2024 22:54:43 +0100 Subject: [PATCH 2/7] refactor!: Single type/alias for intersection status (#3898) Seems more concise and consistent --- .../Acts/Navigation/DetectorNavigator.hpp | 4 +- .../Acts/Navigation/NavigationStream.hpp | 2 +- Core/include/Acts/Propagator/AtlasStepper.hpp | 2 +- .../Acts/Propagator/DirectNavigator.hpp | 12 ++-- Core/include/Acts/Propagator/EigenStepper.hpp | 2 +- .../Acts/Propagator/MultiEigenStepperLoop.hpp | 12 ++-- .../Acts/Propagator/MultiEigenStepperLoop.ipp | 9 ++- .../Acts/Propagator/MultiStepperAborters.hpp | 8 +-- Core/include/Acts/Propagator/Navigator.hpp | 10 +-- .../Acts/Propagator/StandardAborters.hpp | 2 +- .../Acts/Propagator/StraightLineStepper.hpp | 2 +- Core/include/Acts/Propagator/SympyStepper.hpp | 2 +- .../Acts/Propagator/TryAllNavigator.hpp | 8 +-- .../Acts/Propagator/detail/SteppingHelper.hpp | 10 +-- .../Acts/Surfaces/detail/PlanarHelper.hpp | 6 +- .../Acts/TrackFitting/GaussianSumFitter.hpp | 3 +- .../Acts/TrackFitting/detail/GsfActor.hpp | 31 ++++----- Core/include/Acts/Utilities/Intersection.hpp | 23 +++---- Core/src/Surfaces/ConeSurface.cpp | 16 ++--- Core/src/Surfaces/CylinderSurface.cpp | 22 +++--- Core/src/Surfaces/DiscSurface.cpp | 6 +- Core/src/Surfaces/IntersectionHelper2D.cpp | 18 ++--- Core/src/Surfaces/LineSurface.cpp | 8 +-- Core/src/Surfaces/PlaneSurface.cpp | 4 +- Core/src/Utilities/Intersection.cpp | 2 + .../Core/Propagator/MultiStepperTests.cpp | 20 +++--- .../Core/Propagator/NavigatorTests.cpp | 2 +- .../Core/Surfaces/CylinderSurfaceTests.cpp | 2 +- .../Core/Surfaces/DiscSurfaceTests.cpp | 2 +- .../Core/Surfaces/PlaneSurfaceTests.cpp | 2 +- .../Surfaces/SurfaceIntersectionTests.cpp | 67 +++++++------------ Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp | 2 +- .../Core/Utilities/IntersectionTests.cpp | 55 +++++++-------- 33 files changed, 169 insertions(+), 207 deletions(-) diff --git a/Core/include/Acts/Navigation/DetectorNavigator.hpp b/Core/include/Acts/Navigation/DetectorNavigator.hpp index 0ffcf1446bc..3bc324e187f 100644 --- a/Core/include/Acts/Navigation/DetectorNavigator.hpp +++ b/Core/include/Acts/Navigation/DetectorNavigator.hpp @@ -223,7 +223,7 @@ class DetectorNavigator { ACTS_VERBOSE(volInfo(state) << posInfo(state, stepper) << "surface status is " << surfaceStatus); - if (surfaceStatus == Intersection3D::Status::reachable) { + if (surfaceStatus == IntersectionStatus::reachable) { ACTS_VERBOSE(volInfo(state) << posInfo(state, stepper) << "surface " << surface.center(state.geoContext).transpose() @@ -292,7 +292,7 @@ class DetectorNavigator { state.options.surfaceTolerance, logger()); // Check if we are at a surface - if (surfaceStatus == Intersection3D::Status::onSurface) { + if (surfaceStatus == IntersectionStatus::onSurface) { ACTS_VERBOSE(volInfo(state) << posInfo(state, stepper) << "landed on surface"); diff --git a/Core/include/Acts/Navigation/NavigationStream.hpp b/Core/include/Acts/Navigation/NavigationStream.hpp index 97e154214d7..d579c0d7392 100644 --- a/Core/include/Acts/Navigation/NavigationStream.hpp +++ b/Core/include/Acts/Navigation/NavigationStream.hpp @@ -9,13 +9,13 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" +#include "Acts/Definitions/Tolerance.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/Portal.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Utilities/Intersection.hpp" #include -#include #include namespace Acts { diff --git a/Core/include/Acts/Propagator/AtlasStepper.hpp b/Core/include/Acts/Propagator/AtlasStepper.hpp index 88cfd39e548..50fd78de145 100644 --- a/Core/include/Acts/Propagator/AtlasStepper.hpp +++ b/Core/include/Acts/Propagator/AtlasStepper.hpp @@ -419,7 +419,7 @@ class AtlasStepper { /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection /// @param [in] logger Logger instance to use - Intersection3D::Status updateSurfaceStatus( + IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance = s_onSurfaceTolerance, diff --git a/Core/include/Acts/Propagator/DirectNavigator.hpp b/Core/include/Acts/Propagator/DirectNavigator.hpp index 3356ab395c4..d2f66468168 100644 --- a/Core/include/Acts/Propagator/DirectNavigator.hpp +++ b/Core/include/Acts/Propagator/DirectNavigator.hpp @@ -9,20 +9,18 @@ #pragma once #include "Acts/Definitions/Direction.hpp" -#include "Acts/Geometry/BoundarySurfaceT.hpp" +#include "Acts/Definitions/Units.hpp" #include "Acts/Geometry/Layer.hpp" #include "Acts/Geometry/TrackingGeometry.hpp" #include "Acts/Geometry/TrackingVolume.hpp" +#include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/NavigatorOptions.hpp" #include "Acts/Propagator/NavigatorStatistics.hpp" -#include "Acts/Propagator/Propagator.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/Logger.hpp" -#include -#include #include #include #include @@ -259,7 +257,7 @@ class DirectNavigator { state.stepping, surface, index, state.options.direction, BoundaryTolerance::Infinite(), state.options.surfaceTolerance, *m_logger); - if (surfaceStatus == Intersection3D::Status::unreachable) { + if (surfaceStatus == IntersectionStatus::unreachable) { ACTS_VERBOSE( "Surface not reachable anymore, switching to next one in " "sequence"); @@ -313,7 +311,7 @@ class DirectNavigator { state.stepping, surface, index, state.options.direction, BoundaryTolerance::Infinite(), state.options.surfaceTolerance, *m_logger); - if (surfaceStatus == Intersection3D::Status::onSurface) { + if (surfaceStatus == IntersectionStatus::onSurface) { // Set the current surface state.navigation.currentSurface = state.navigation.navSurface(); ACTS_VERBOSE("Current surface set to " @@ -326,7 +324,7 @@ class DirectNavigator { .at(state.navigation.surfaceIndex) ->geometryId()); } - } else if (surfaceStatus == Intersection3D::Status::reachable) { + } else if (surfaceStatus == IntersectionStatus::reachable) { ACTS_VERBOSE("Next surface reachable at distance " << stepper.outputStepSize(state.stepping)); } diff --git a/Core/include/Acts/Propagator/EigenStepper.hpp b/Core/include/Acts/Propagator/EigenStepper.hpp index 09df3ce3167..47f2db687b6 100644 --- a/Core/include/Acts/Propagator/EigenStepper.hpp +++ b/Core/include/Acts/Propagator/EigenStepper.hpp @@ -270,7 +270,7 @@ class EigenStepper { /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection /// @param [in] logger A @c Logger instance - Intersection3D::Status updateSurfaceStatus( + IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance = s_onSurfaceTolerance, diff --git a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp index e21bdb2365e..dff30746cf6 100644 --- a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp +++ b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp @@ -197,7 +197,7 @@ class MultiEigenStepperLoop : public EigenStepper { struct Component { SingleState state; ActsScalar weight; - Intersection3D::Status status; + IntersectionStatus status; }; /// Particle hypothesis @@ -255,7 +255,7 @@ class MultiEigenStepperLoop : public EigenStepper { const auto& [weight, singlePars] = multipars[i]; components.push_back( {SingleState(gctx, bfield->makeCache(mctx), singlePars, ssize), - weight, Intersection3D::Status::onSurface}); + weight, IntersectionStatus::onSurface}); } if (std::get<2>(multipars.components().front())) { @@ -398,7 +398,7 @@ class MultiEigenStepperLoop : public EigenStepper { void removeMissedComponents(State& state) const { auto new_end = std::remove_if( state.components.begin(), state.components.end(), [](const auto& cmp) { - return cmp.status == Intersection3D::Status::missed; + return cmp.status == IntersectionStatus::missed; }); state.components.erase(new_end, state.components.end()); @@ -441,7 +441,7 @@ class MultiEigenStepperLoop : public EigenStepper { {SingleState(state.geoContext, SingleStepper::m_bField->makeCache(state.magContext), pars), - weight, Intersection3D::Status::onSurface}); + weight, IntersectionStatus::onSurface}); return ComponentProxy{state.components.back(), state}; } @@ -520,12 +520,12 @@ class MultiEigenStepperLoop : public EigenStepper { /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection /// @param [in] logger A @c Logger instance - Intersection3D::Status updateSurfaceStatus( + IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance = s_onSurfaceTolerance, const Logger& logger = getDummyLogger()) const { - using Status = Intersection3D::Status; + using Status = IntersectionStatus; std::array counts = {0, 0, 0}; diff --git a/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp b/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp index fab3e3f0779..67aa98e94bb 100644 --- a/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp +++ b/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp @@ -93,7 +93,7 @@ template template Result MultiEigenStepperLoop::step( propagator_state_t& state, const navigator_t& navigator) const { - using Status = Acts::Intersection3D::Status; + using Status = Acts::IntersectionStatus; State& stepping = state.stepping; auto& components = stepping.components; @@ -137,10 +137,9 @@ Result MultiEigenStepperLoop::step( // If at least one component is on a surface, we can remove all missed // components before the step. If not, we must keep them for the case that all // components miss and we need to retarget - const auto cmpsOnSurface = - std::count_if(components.cbegin(), components.cend(), [&](auto& cmp) { - return cmp.status == Intersection3D::Status::onSurface; - }); + const auto cmpsOnSurface = std::count_if( + components.cbegin(), components.cend(), + [&](auto& cmp) { return cmp.status == IntersectionStatus::onSurface; }); if (cmpsOnSurface > 0) { removeMissedComponents(stepping); diff --git a/Core/include/Acts/Propagator/MultiStepperAborters.hpp b/Core/include/Acts/Propagator/MultiStepperAborters.hpp index 0e28375df94..e42d3387e2f 100644 --- a/Core/include/Acts/Propagator/MultiStepperAborters.hpp +++ b/Core/include/Acts/Propagator/MultiStepperAborters.hpp @@ -59,12 +59,12 @@ struct MultiStepperSurfaceReached : public SurfaceReached { averageOnSurfaceTolerance) .closest(); - if (sIntersection.status() == Intersection3D::Status::onSurface) { + if (sIntersection.status() == IntersectionStatus::onSurface) { ACTS_VERBOSE( "MultiStepperSurfaceReached aborter | " "Reached target in average mode"); for (auto cmp : stepper.componentIterable(state.stepping)) { - cmp.status() = Intersection3D::Status::onSurface; + cmp.status() = IntersectionStatus::onSurface; } return true; @@ -84,10 +84,10 @@ struct MultiStepperSurfaceReached : public SurfaceReached { if (!SurfaceReached::checkAbort(singleState, singleStepper, navigator, logger)) { - cmp.status() = Acts::Intersection3D::Status::reachable; + cmp.status() = Acts::IntersectionStatus::reachable; reached = false; } else { - cmp.status() = Acts::Intersection3D::Status::onSurface; + cmp.status() = Acts::IntersectionStatus::onSurface; } } diff --git a/Core/include/Acts/Propagator/Navigator.hpp b/Core/include/Acts/Propagator/Navigator.hpp index a02e0958160..504912b507f 100644 --- a/Core/include/Acts/Propagator/Navigator.hpp +++ b/Core/include/Acts/Propagator/Navigator.hpp @@ -649,7 +649,7 @@ class Navigator { auto surfaceStatus = stepper.updateSurfaceStatus( state.stepping, *surface, intersection.index(), state.options.direction, BoundaryTolerance::None(), state.options.surfaceTolerance, logger()); - if (surfaceStatus == Intersection3D::Status::onSurface) { + if (surfaceStatus == IntersectionStatus::onSurface) { ACTS_VERBOSE(volInfo(state) << "Status Surface successfully hit, storing it."); // Set in navigation state, so actors and aborters can access it @@ -725,7 +725,7 @@ class Navigator { state.stepping, *surface, intersection.index(), state.options.direction, boundaryTolerance, state.options.surfaceTolerance, logger()); - if (surfaceStatus == Intersection3D::Status::reachable) { + if (surfaceStatus == IntersectionStatus::reachable) { ACTS_VERBOSE(volInfo(state) << "Surface reachable, step size updated to " << stepper.outputStepSize(state.stepping)); @@ -815,7 +815,7 @@ class Navigator { state.stepping, *layerSurface, intersection.index(), state.options.direction, BoundaryTolerance::None(), state.options.surfaceTolerance, logger()); - if (layerStatus == Intersection3D::Status::reachable) { + if (layerStatus == IntersectionStatus::reachable) { ACTS_VERBOSE(volInfo(state) << "Layer reachable, step size updated to " << stepper.outputStepSize(state.stepping)); return true; @@ -937,7 +937,7 @@ class Navigator { state.stepping, *boundarySurface, intersection.index(), state.options.direction, BoundaryTolerance::None(), state.options.surfaceTolerance, logger()); - if (boundaryStatus == Intersection3D::Status::reachable) { + if (boundaryStatus == IntersectionStatus::reachable) { ACTS_VERBOSE(volInfo(state) << "Boundary reachable, step size updated to " << stepper.outputStepSize(state.stepping)); @@ -1160,7 +1160,7 @@ class Navigator { state.options.direction, BoundaryTolerance::None(), state.options.surfaceTolerance, logger()); // the only advance could have been to the target - if (targetStatus == Intersection3D::Status::onSurface) { + if (targetStatus == IntersectionStatus::onSurface) { // set the target surface state.navigation.currentSurface = state.navigation.targetSurface; ACTS_VERBOSE(volInfo(state) diff --git a/Core/include/Acts/Propagator/StandardAborters.hpp b/Core/include/Acts/Propagator/StandardAborters.hpp index 706b0ce0697..271ebd85239 100644 --- a/Core/include/Acts/Propagator/StandardAborters.hpp +++ b/Core/include/Acts/Propagator/StandardAborters.hpp @@ -118,7 +118,7 @@ struct SurfaceReached { bool reached = false; - if (closest.status() == Intersection3D::Status::onSurface) { + if (closest.status() == IntersectionStatus::onSurface) { const double distance = closest.pathLength(); ACTS_VERBOSE( "SurfaceReached aborter | " diff --git a/Core/include/Acts/Propagator/StraightLineStepper.hpp b/Core/include/Acts/Propagator/StraightLineStepper.hpp index 18904797fdd..59f10b1d980 100644 --- a/Core/include/Acts/Propagator/StraightLineStepper.hpp +++ b/Core/include/Acts/Propagator/StraightLineStepper.hpp @@ -242,7 +242,7 @@ class StraightLineStepper { /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection /// @param [in] logger A logger instance - Intersection3D::Status updateSurfaceStatus( + IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance = s_onSurfaceTolerance, diff --git a/Core/include/Acts/Propagator/SympyStepper.hpp b/Core/include/Acts/Propagator/SympyStepper.hpp index 3b1a2125a41..f5773a8a409 100644 --- a/Core/include/Acts/Propagator/SympyStepper.hpp +++ b/Core/include/Acts/Propagator/SympyStepper.hpp @@ -237,7 +237,7 @@ class SympyStepper { /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection /// @param [in] logger A @c Logger instance - Intersection3D::Status updateSurfaceStatus( + IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance = s_onSurfaceTolerance, diff --git a/Core/include/Acts/Propagator/TryAllNavigator.hpp b/Core/include/Acts/Propagator/TryAllNavigator.hpp index 09f6fb25e25..7470fa0da0c 100644 --- a/Core/include/Acts/Propagator/TryAllNavigator.hpp +++ b/Core/include/Acts/Propagator/TryAllNavigator.hpp @@ -434,7 +434,7 @@ class TryAllNavigator : public TryAllNavigatorBase { const auto& intersection = candidate.intersection; const Surface& surface = *intersection.object(); - Intersection3D::Status surfaceStatus = stepper.updateSurfaceStatus( + IntersectionStatus surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, intersection.index(), state.options.direction, BoundaryTolerance::Infinite(), state.options.surfaceTolerance, logger()); @@ -463,7 +463,7 @@ class TryAllNavigator : public TryAllNavigatorBase { const auto& intersection = candidate.intersection; const Surface& surface = *intersection.object(); - Intersection3D::Status surfaceStatus = stepper.updateSurfaceStatus( + IntersectionStatus surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, intersection.index(), state.options.direction, BoundaryTolerance::None(), state.options.surfaceTolerance, logger()); @@ -788,7 +788,7 @@ class TryAllOverstepNavigator : public TryAllNavigatorBase { const auto& intersection = candidate.intersection; const Surface& surface = *intersection.object(); - Intersection3D::Status surfaceStatus = stepper.updateSurfaceStatus( + IntersectionStatus surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, intersection.index(), state.options.direction, BoundaryTolerance::Infinite(), state.options.surfaceTolerance, logger()); @@ -815,7 +815,7 @@ class TryAllOverstepNavigator : public TryAllNavigatorBase { const auto& intersection = candidate.intersection; const Surface& surface = *intersection.object(); - Intersection3D::Status surfaceStatus = stepper.updateSurfaceStatus( + IntersectionStatus surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, intersection.index(), state.options.direction, BoundaryTolerance::None(), state.options.surfaceTolerance, logger()); diff --git a/Core/include/Acts/Propagator/detail/SteppingHelper.hpp b/Core/include/Acts/Propagator/detail/SteppingHelper.hpp index c78f0ea1f51..c0589d739c7 100644 --- a/Core/include/Acts/Propagator/detail/SteppingHelper.hpp +++ b/Core/include/Acts/Propagator/detail/SteppingHelper.hpp @@ -32,7 +32,7 @@ namespace Acts::detail { /// @param surface [in] The surface provided /// @param boundaryTolerance [in] The boundary check for this status update template -Acts::Intersection3D::Status updateSingleSurfaceStatus( +Acts::IntersectionStatus updateSingleSurfaceStatus( const stepper_t& stepper, typename stepper_t::State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance, @@ -46,11 +46,11 @@ Acts::Intersection3D::Status updateSingleSurfaceStatus( surfaceTolerance)[index]; // The intersection is on surface already - if (sIntersection.status() == Intersection3D::Status::onSurface) { + if (sIntersection.status() == IntersectionStatus::onSurface) { // Release navigation step size state.stepSize.release(ConstrainedStep::actor); ACTS_VERBOSE("Intersection: state is ON SURFACE"); - return Intersection3D::Status::onSurface; + return IntersectionStatus::onSurface; } const double nearLimit = std::numeric_limits::lowest(); @@ -62,11 +62,11 @@ Acts::Intersection3D::Status updateSingleSurfaceStatus( ACTS_VERBOSE("Surface is reachable"); stepper.updateStepSize(state, sIntersection.pathLength(), ConstrainedStep::actor); - return Intersection3D::Status::reachable; + return IntersectionStatus::reachable; } ACTS_VERBOSE("Surface is NOT reachable"); - return Intersection3D::Status::unreachable; + return IntersectionStatus::unreachable; } /// Update the Step size - single component diff --git a/Core/include/Acts/Surfaces/detail/PlanarHelper.hpp b/Core/include/Acts/Surfaces/detail/PlanarHelper.hpp index f7b21a960aa..99e1803126f 100644 --- a/Core/include/Acts/Surfaces/detail/PlanarHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/PlanarHelper.hpp @@ -35,9 +35,9 @@ inline Intersection3D intersect(const Transform3& transform, // Translate that into a path ActsScalar path = (pnormal.dot((pcenter - position))) / (denom); // Is valid hence either on surface or reachable - Intersection3D::Status status = std::abs(path) < std::abs(tolerance) - ? Intersection3D::Status::onSurface - : Intersection3D::Status::reachable; + IntersectionStatus status = std::abs(path) < std::abs(tolerance) + ? IntersectionStatus::onSurface + : IntersectionStatus::reachable; // Return the intersection return Intersection3D{(position + path * direction), path, status}; } diff --git a/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp b/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp index f6c990a696d..4efcd82e4c4 100644 --- a/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp +++ b/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp @@ -14,6 +14,7 @@ #include "Acts/Propagator/Navigator.hpp" #include "Acts/Propagator/StandardAborters.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" +#include "Acts/TrackFitting/GsfError.hpp" #include "Acts/TrackFitting/GsfOptions.hpp" #include "Acts/TrackFitting/detail/GsfActor.hpp" #include "Acts/Utilities/Helpers.hpp" @@ -217,7 +218,7 @@ struct GaussianSumFitter { .closest() .status(); - if (intersectionStatusStartSurface != Intersection3D::Status::onSurface) { + if (intersectionStatusStartSurface != IntersectionStatus::onSurface) { ACTS_DEBUG( "Surface intersection of start parameters WITH bound-check failed"); } diff --git a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp index 92c5529d319..eeb7636103b 100644 --- a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp +++ b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp @@ -12,14 +12,9 @@ #include "Acts/EventData/MultiComponentTrackParameters.hpp" #include "Acts/EventData/MultiTrajectory.hpp" #include "Acts/EventData/MultiTrajectoryHelpers.hpp" -#include "Acts/MagneticField/MagneticFieldProvider.hpp" -#include "Acts/Material/ISurfaceMaterial.hpp" -#include "Acts/Surfaces/CylinderSurface.hpp" +#include "Acts/Propagator/detail/PointwiseMaterialInteraction.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/TrackFitting/BetheHeitlerApprox.hpp" -#include "Acts/TrackFitting/GsfError.hpp" #include "Acts/TrackFitting/GsfOptions.hpp" -#include "Acts/TrackFitting/KalmanFitter.hpp" #include "Acts/TrackFitting/detail/GsfComponentMerging.hpp" #include "Acts/TrackFitting/detail/GsfUtils.hpp" #include "Acts/TrackFitting/detail/KalmanUpdateHelpers.hpp" @@ -28,7 +23,6 @@ #include #include -#include namespace Acts::detail { @@ -53,8 +47,8 @@ struct GsfResult { std::size_t measurementHoles = 0; std::size_t processedStates = 0; - std::vector visitedSurfaces; - std::vector surfacesVisitedBwdAgain; + std::vector visitedSurfaces; + std::vector surfacesVisitedBwdAgain; /// Statistics about material encounterings Updatable nInvalidBetheHeitler; @@ -74,7 +68,7 @@ struct GsfActor { /// Enforce default construction GsfActor() = default; - using ComponentCache = Acts::GsfComponent; + using ComponentCache = GsfComponent; /// Broadcast the result_type using result_type = GsfResult; @@ -189,7 +183,7 @@ struct GsfActor { // All components must have status "on surface". It is however possible, // that currentSurface is nullptr and all components are "on surface" (e.g., // for surfaces excluded from the navigation) - using Status [[maybe_unused]] = Acts::Intersection3D::Status; + using Status [[maybe_unused]] = IntersectionStatus; assert(std::all_of( stepperComponents.begin(), stepperComponents.end(), [](const auto& cmp) { return cmp.status() == Status::onSurface; })); @@ -484,7 +478,7 @@ struct GsfActor { // we set ignored components to missed, so we can remove them after // the loop if (tmpStates.weights.at(idx) < m_cfg.weightCutoff) { - cmp.status() = Intersection3D::Status::missed; + cmp.status() = IntersectionStatus::missed; continue; } @@ -534,9 +528,9 @@ struct GsfActor { state.geoContext, freeParams.template segment<3>(eFreePos0), freeParams.template segment<3>(eFreeDir0)); cmp.pathAccumulated() = state.stepping.pathAccumulated; - cmp.jacobian() = Acts::BoundMatrix::Identity(); - cmp.derivative() = Acts::FreeVector::Zero(); - cmp.jacTransport() = Acts::FreeMatrix::Identity(); + cmp.jacobian() = BoundMatrix::Identity(); + cmp.derivative() = FreeVector::Zero(); + cmp.jacTransport() = FreeMatrix::Identity(); } } @@ -574,8 +568,7 @@ struct GsfActor { // If at least one component is no outlier, we consider the whole thing // as a measurementState - if (trackStateProxy.typeFlags().test( - Acts::TrackStateFlag::MeasurementFlag)) { + if (trackStateProxy.typeFlags().test(TrackStateFlag::MeasurementFlag)) { is_valid_measurement = true; } @@ -621,7 +614,7 @@ struct GsfActor { stepper.particleHypothesis(state.stepping)); // Return success - return Acts::Result::success(); + return Result::success(); } template & options) { + void setOptions(const GsfOptions& options) { m_cfg.maxComponents = options.maxComponents; m_cfg.extensions = options.extensions; m_cfg.abortOnError = options.abortOnError; diff --git a/Core/include/Acts/Utilities/Intersection.hpp b/Core/include/Acts/Utilities/Intersection.hpp index 6276538ed5e..11adf0bdece 100644 --- a/Core/include/Acts/Utilities/Intersection.hpp +++ b/Core/include/Acts/Utilities/Intersection.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/Tolerance.hpp" #include "Acts/Utilities/Logger.hpp" #include @@ -47,8 +46,6 @@ class Intersection { public: /// Position type using Position = ActsVector; - /// Status enum - using Status = IntersectionStatus; /// Constructor with arguments /// @@ -56,11 +53,13 @@ class Intersection { /// @param pathLength is the path length to the intersection /// @param status is an enum indicating the status of the intersection constexpr Intersection(const Position& position, double pathLength, - Status status) + IntersectionStatus status) : m_position(position), m_pathLength(pathLength), m_status(status) {} /// Returns whether the intersection was successful or not - constexpr bool isValid() const { return m_status != Status::missed; } + constexpr bool isValid() const { + return m_status != IntersectionStatus::missed; + } /// Returns the position of the interseciton constexpr const Position& position() const { return m_position; } @@ -69,7 +68,7 @@ class Intersection { constexpr ActsScalar pathLength() const { return m_pathLength; } /// Returns the intersection status enum - constexpr Status status() const { return m_status; } + constexpr IntersectionStatus status() const { return m_status; } /// Static factory to creae an invalid instesection constexpr static Intersection invalid() { return Intersection(); } @@ -87,12 +86,12 @@ class Intersection { /// be first. constexpr static bool closestOrder(const Intersection& aIntersection, const Intersection& bIntersection) { - if ((aIntersection.status() == Status::unreachable) && - (bIntersection.status() != Status::unreachable)) { + if ((aIntersection.status() == IntersectionStatus::unreachable) && + (bIntersection.status() != IntersectionStatus::unreachable)) { return false; } - if ((aIntersection.status() != Status::unreachable) && - (bIntersection.status() == Status::unreachable)) { + if ((aIntersection.status() != IntersectionStatus::unreachable) && + (bIntersection.status() == IntersectionStatus::unreachable)) { return true; } // both are reachable or onSurface now @@ -117,7 +116,7 @@ class Intersection { /// Signed path length to the intersection (if valid) ActsScalar m_pathLength = std::numeric_limits::infinity(); /// The Status of the intersection - Status m_status = Status::unreachable; + IntersectionStatus m_status = IntersectionStatus::unreachable; constexpr Intersection() = default; }; @@ -161,7 +160,7 @@ class ObjectIntersection { } /// Returns the status of the interseciton - constexpr Intersection3D::Status status() const { + constexpr IntersectionStatus status() const { return m_intersection.status(); } diff --git a/Core/src/Surfaces/ConeSurface.cpp b/Core/src/Surfaces/ConeSurface.cpp index b6d04e87e06..0ad869f2a4e 100644 --- a/Core/src/Surfaces/ConeSurface.cpp +++ b/Core/src/Surfaces/ConeSurface.cpp @@ -295,23 +295,23 @@ Acts::SurfaceMultiIntersection Acts::ConeSurface::intersect( // Check the validity of the first solution Vector3 solution1 = position + qe.first * direction; - Intersection3D::Status status1 = std::abs(qe.first) < std::abs(tolerance) - ? Intersection3D::Status::onSurface - : Intersection3D::Status::reachable; + IntersectionStatus status1 = std::abs(qe.first) < std::abs(tolerance) + ? IntersectionStatus::onSurface + : IntersectionStatus::reachable; if (!boundaryTolerance.isInfinite() && !isOnSurface(gctx, solution1, direction, boundaryTolerance)) { - status1 = Intersection3D::Status::missed; + status1 = IntersectionStatus::missed; } // Check the validity of the second solution Vector3 solution2 = position + qe.first * direction; - Intersection3D::Status status2 = std::abs(qe.second) < std::abs(tolerance) - ? Intersection3D::Status::onSurface - : Intersection3D::Status::reachable; + IntersectionStatus status2 = std::abs(qe.second) < std::abs(tolerance) + ? IntersectionStatus::onSurface + : IntersectionStatus::reachable; if (!boundaryTolerance.isInfinite() && !isOnSurface(gctx, solution2, direction, boundaryTolerance)) { - status2 = Intersection3D::Status::missed; + status2 = IntersectionStatus::missed; } const auto& tf = transform(gctx); diff --git a/Core/src/Surfaces/CylinderSurface.cpp b/Core/src/Surfaces/CylinderSurface.cpp index 4b3cd2db7be..d34726c2a7f 100644 --- a/Core/src/Surfaces/CylinderSurface.cpp +++ b/Core/src/Surfaces/CylinderSurface.cpp @@ -243,14 +243,13 @@ Acts::SurfaceMultiIntersection Acts::CylinderSurface::intersect( // Check the validity of the first solution Vector3 solution1 = position + qe.first * direction; - Intersection3D::Status status1 = std::abs(qe.first) < std::abs(tolerance) - ? Intersection3D::Status::onSurface - : Intersection3D::Status::reachable; + IntersectionStatus status1 = std::abs(qe.first) < std::abs(tolerance) + ? IntersectionStatus::onSurface + : IntersectionStatus::reachable; // Helper method for boundary check - auto boundaryCheck = - [&](const Vector3& solution, - Intersection3D::Status status) -> Intersection3D::Status { + auto boundaryCheck = [&](const Vector3& solution, + IntersectionStatus status) -> IntersectionStatus { // No check to be done, return current status if (boundaryTolerance.isInfinite()) { return status; @@ -266,12 +265,11 @@ Acts::SurfaceMultiIntersection Acts::CylinderSurface::intersect( double cZ = vecLocal.dot(tMatrix.block<3, 1>(0, 2)); double modifiedTolerance = tolerance + absoluteBound->tolerance1; double hZ = cBounds.get(CylinderBounds::eHalfLengthZ) + modifiedTolerance; - return std::abs(cZ) < std::abs(hZ) ? status - : Intersection3D::Status::missed; + return std::abs(cZ) < std::abs(hZ) ? status : IntersectionStatus::missed; } return isOnSurface(gctx, solution, direction, boundaryTolerance) ? status - : Intersection3D::Status::missed; + : IntersectionStatus::missed; }; // Check first solution for boundary compatibility status1 = boundaryCheck(solution1, status1); @@ -282,9 +280,9 @@ Acts::SurfaceMultiIntersection Acts::CylinderSurface::intersect( } // Check the validity of the second solution Vector3 solution2 = position + qe.second * direction; - Intersection3D::Status status2 = std::abs(qe.second) < std::abs(tolerance) - ? Intersection3D::Status::onSurface - : Intersection3D::Status::reachable; + IntersectionStatus status2 = std::abs(qe.second) < std::abs(tolerance) + ? IntersectionStatus::onSurface + : IntersectionStatus::reachable; // Check first solution for boundary compatibility status2 = boundaryCheck(solution2, status2); Intersection3D second(solution2, qe.second, status2); diff --git a/Core/src/Surfaces/DiscSurface.cpp b/Core/src/Surfaces/DiscSurface.cpp index da1aa2b54bc..9e957346965 100644 --- a/Core/src/Surfaces/DiscSurface.cpp +++ b/Core/src/Surfaces/DiscSurface.cpp @@ -286,7 +286,7 @@ Acts::SurfaceMultiIntersection Acts::DiscSurface::intersect( PlanarHelper::intersect(gctxTransform, position, direction, tolerance); auto status = intersection.status(); // Evaluate boundary check if requested (and reachable) - if (intersection.status() != Intersection3D::Status::unreachable && + if (intersection.status() != IntersectionStatus::unreachable && m_bounds != nullptr && !boundaryTolerance.isInfinite()) { // Built-in local to global for speed reasons const auto& tMatrix = gctxTransform.matrix(); @@ -297,11 +297,11 @@ Acts::SurfaceMultiIntersection Acts::DiscSurface::intersect( double modifiedTolerance = tolerance + absoluteBound->tolerance0; if (!m_bounds->insideRadialBounds(VectorHelpers::perp(lcartesian), modifiedTolerance)) { - status = Intersection3D::Status::missed; + status = IntersectionStatus::missed; } } else if (!insideBounds(localCartesianToPolar(lcartesian), boundaryTolerance)) { - status = Intersection3D::Status::missed; + status = IntersectionStatus::missed; } } return {{Intersection3D(intersection.position(), intersection.pathLength(), diff --git a/Core/src/Surfaces/IntersectionHelper2D.cpp b/Core/src/Surfaces/IntersectionHelper2D.cpp index 1053021034f..c196b1a4131 100644 --- a/Core/src/Surfaces/IntersectionHelper2D.cpp +++ b/Core/src/Surfaces/IntersectionHelper2D.cpp @@ -30,11 +30,11 @@ Acts::Intersection2D Acts::detail::IntersectionHelper2D::intersectSegment( auto d = line.intersectionParameter(Plane::Through(s0, s1)); Vector2 intersection(origin + d * dir); - Intersection2D::Status status = Intersection2D::Status::reachable; + IntersectionStatus status = IntersectionStatus::reachable; if (boundCheck) { auto edgeToSol = intersection - s0; if (edgeToSol.dot(edge) < 0. || edgeToSol.norm() > (edge).norm()) { - status = Intersection2D::Status::unreachable; + status = IntersectionStatus::unreachable; } } return Intersection2D(intersection, d, status); @@ -55,11 +55,11 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(ActsScalar Rx, ActsScalar altD = std::copysign(toAltD.norm(), toAltD.dot(dir)); if (std::abs(solD) < std::abs(altD)) { - return {Intersection2D(sol, solD, Intersection2D::Status::reachable), - Intersection2D(alt, altD, Intersection2D::Status::reachable)}; + return {Intersection2D(sol, solD, IntersectionStatus::reachable), + Intersection2D(alt, altD, IntersectionStatus::reachable)}; } - return {Intersection2D(alt, altD, Intersection2D::Status::reachable), - Intersection2D(sol, solD, Intersection2D::Status::reachable)}; + return {Intersection2D(alt, altD, IntersectionStatus::reachable), + Intersection2D(sol, solD, IntersectionStatus::reachable)}; }; // Special cases first @@ -73,7 +73,7 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(ActsScalar Rx, return createSolution(sol, alt); } else if (std::abs(D) < s_epsilon) { return {Intersection2D(Vector2(solx, 0.), -origin.y(), - Intersection2D::Status::reachable), + IntersectionStatus::reachable), Intersection2D::invalid()}; } return {Intersection2D::invalid(), Intersection2D::invalid()}; @@ -87,7 +87,7 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(ActsScalar Rx, return createSolution(sol, alt); } else if (std::abs(D) < s_epsilon) { return {Intersection2D(Vector2(0., soly), -origin.x(), - Intersection2D::Status::reachable), + IntersectionStatus::reachable), Intersection2D::invalid()}; } return {Intersection2D::invalid(), Intersection2D::invalid()}; @@ -105,7 +105,7 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(ActsScalar Rx, Vector2 sol(x, k * x + d); Vector2 toSolD(sol - origin); ActsScalar solD = std::copysign(toSolD.norm(), toSolD.dot(dir)); - return {Intersection2D(sol, solD, Intersection2D::Status::reachable), + return {Intersection2D(sol, solD, IntersectionStatus::reachable), Intersection2D::invalid()}; } else if (solver.solutions > 1) { ActsScalar x0 = solver.first; diff --git a/Core/src/Surfaces/LineSurface.cpp b/Core/src/Surfaces/LineSurface.cpp index f67fe038aa9..00d1fc6dd17 100644 --- a/Core/src/Surfaces/LineSurface.cpp +++ b/Core/src/Surfaces/LineSurface.cpp @@ -174,9 +174,9 @@ Acts::SurfaceMultiIntersection Acts::LineSurface::intersect( double u = (mab.dot(ea) - mab.dot(eb) * eaTeb) / denom; // Check if we are on the surface already - Intersection3D::Status status = std::abs(u) > std::abs(tolerance) - ? Intersection3D::Status::reachable - : Intersection3D::Status::onSurface; + IntersectionStatus status = std::abs(u) > std::abs(tolerance) + ? IntersectionStatus::reachable + : IntersectionStatus::onSurface; Vector3 result = ma + u * ea; // Evaluate the boundary check if requested // m_bounds == nullptr prevents unnecessary calculations for PerigeeSurface @@ -185,7 +185,7 @@ Acts::SurfaceMultiIntersection Acts::LineSurface::intersect( double cZ = vecLocal.dot(eb); double cR = (vecLocal - cZ * eb).norm(); if (!m_bounds->inside({cR, cZ}, boundaryTolerance)) { - status = Intersection3D::Status::missed; + status = IntersectionStatus::missed; } } diff --git a/Core/src/Surfaces/PlaneSurface.cpp b/Core/src/Surfaces/PlaneSurface.cpp index 658920e6686..db21709a192 100644 --- a/Core/src/Surfaces/PlaneSurface.cpp +++ b/Core/src/Surfaces/PlaneSurface.cpp @@ -168,14 +168,14 @@ Acts::SurfaceMultiIntersection Acts::PlaneSurface::intersect( PlanarHelper::intersect(gctxTransform, position, direction, tolerance); auto status = intersection.status(); // Evaluate boundary check if requested (and reachable) - if (intersection.status() != Intersection3D::Status::unreachable) { + if (intersection.status() != IntersectionStatus::unreachable) { // Built-in local to global for speed reasons const auto& tMatrix = gctxTransform.matrix(); // Create the reference vector in local const Vector3 vecLocal(intersection.position() - tMatrix.block<3, 1>(0, 3)); if (!insideBounds(tMatrix.block<3, 2>(0, 0).transpose() * vecLocal, boundaryTolerance)) { - status = Intersection3D::Status::missed; + status = IntersectionStatus::missed; } } return {{Intersection3D(intersection.position(), intersection.pathLength(), diff --git a/Core/src/Utilities/Intersection.cpp b/Core/src/Utilities/Intersection.cpp index 23378f0b381..8a99870b282 100644 --- a/Core/src/Utilities/Intersection.cpp +++ b/Core/src/Utilities/Intersection.cpp @@ -8,6 +8,8 @@ #include "Acts/Utilities/Intersection.hpp" +#include "Acts/Definitions/Tolerance.hpp" + namespace Acts { bool detail::checkPathLength(double pathLength, double nearLimit, diff --git a/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp b/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp index 3fee9d4b6dd..a851d7592d9 100644 --- a/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp @@ -308,7 +308,7 @@ void test_multi_stepper_vs_eigen_stepper() { SingleStepper single_stepper(defaultBField); for (auto cmp : multi_stepper.componentIterable(multi_state)) { - cmp.status() = Acts::Intersection3D::Status::reachable; + cmp.status() = Acts::IntersectionStatus::reachable; } // Do some steps and check that the results match @@ -483,14 +483,14 @@ void test_multi_stepper_surface_status_update() { multi_state, *right_surface, 0, Direction::Forward, BoundaryTolerance::Infinite()); - BOOST_CHECK_EQUAL(status, Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(status, IntersectionStatus::reachable); auto cmp_iterable = multi_stepper.constComponentIterable(multi_state); auto cmp_1 = *cmp_iterable.begin(); auto cmp_2 = *(++cmp_iterable.begin()); - BOOST_CHECK_EQUAL(cmp_1.status(), Intersection3D::Status::reachable); - BOOST_CHECK_EQUAL(cmp_2.status(), Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(cmp_1.status(), IntersectionStatus::reachable); + BOOST_CHECK_EQUAL(cmp_2.status(), IntersectionStatus::reachable); BOOST_CHECK_EQUAL(cmp_1.cmp.state.stepSize.value(), 1.0); BOOST_CHECK_EQUAL(cmp_2.cmp.state.stepSize.value(), -1.0); @@ -512,14 +512,14 @@ void test_multi_stepper_surface_status_update() { multi_state, *right_surface, 0, Direction::Forward, BoundaryTolerance::Infinite()); - BOOST_CHECK_EQUAL(status, Intersection3D::Status::onSurface); + BOOST_CHECK_EQUAL(status, IntersectionStatus::onSurface); auto cmp_iterable = multi_stepper.constComponentIterable(multi_state); auto cmp_1 = *cmp_iterable.begin(); auto cmp_2 = *(++cmp_iterable.begin()); - BOOST_CHECK_EQUAL(cmp_1.status(), Intersection3D::Status::onSurface); - BOOST_CHECK_EQUAL(cmp_2.status(), Intersection3D::Status::onSurface); + BOOST_CHECK_EQUAL(cmp_1.status(), IntersectionStatus::onSurface); + BOOST_CHECK_EQUAL(cmp_2.status(), IntersectionStatus::onSurface); } // Start surface should be reachable @@ -528,14 +528,14 @@ void test_multi_stepper_surface_status_update() { multi_state, *start_surface, 0, Direction::Forward, BoundaryTolerance::Infinite()); - BOOST_CHECK_EQUAL(status, Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(status, IntersectionStatus::reachable); auto cmp_iterable = multi_stepper.constComponentIterable(multi_state); auto cmp_1 = *cmp_iterable.begin(); auto cmp_2 = *(++cmp_iterable.begin()); - BOOST_CHECK_EQUAL(cmp_1.status(), Intersection3D::Status::reachable); - BOOST_CHECK_EQUAL(cmp_2.status(), Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(cmp_1.status(), IntersectionStatus::reachable); + BOOST_CHECK_EQUAL(cmp_2.status(), IntersectionStatus::reachable); BOOST_CHECK_EQUAL(cmp_1.cmp.state.stepSize.value(), -1.0); BOOST_CHECK_EQUAL(cmp_2.cmp.state.stepSize.value(), 1.0); diff --git a/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp b/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp index b9c6fdf87df..e47589c7c63 100644 --- a/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp +++ b/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp @@ -140,7 +140,7 @@ struct PropagatorState { return s_onSurfaceTolerance; } - Intersection3D::Status updateSurfaceStatus( + IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance, const Logger& logger) const { diff --git a/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp index 4dd6f7f6905..152ec791201 100644 --- a/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp @@ -199,7 +199,7 @@ BOOST_AUTO_TEST_CASE(CylinderSurfaceProperties) { auto sfIntersection = cylinderSurfaceObject->intersect( testContext, offSurface, direction, BoundaryTolerance::Infinite()); Intersection3D expectedIntersect{Vector3{1, 1, 2}, 99., - Intersection3D::Status::reachable}; + IntersectionStatus::reachable}; BOOST_CHECK(sfIntersection[0].isValid()); CHECK_CLOSE_ABS(sfIntersection[0].position(), expectedIntersect.position(), 1e-9); diff --git a/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp index b5d1eec5f43..401b6e5bf12 100644 --- a/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp @@ -217,7 +217,7 @@ BOOST_AUTO_TEST_CASE(DiscSurfaceProperties) { BoundaryTolerance::Infinite()) .closest(); Intersection3D expectedIntersect{Vector3{1.2, 0., 0.}, 10., - Intersection3D::Status::reachable}; + IntersectionStatus::reachable}; BOOST_CHECK(sfIntersection.isValid()); CHECK_CLOSE_ABS(sfIntersection.position(), expectedIntersect.position(), 1e-9); diff --git a/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp index 99d0569b9d2..de2a87483e0 100644 --- a/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp @@ -172,7 +172,7 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceProperties) { BoundaryTolerance::None()) .closest(); Intersection3D expectedIntersect{Vector3{0, 1, 2}, 4., - Intersection3D::Status::reachable}; + IntersectionStatus::reachable}; BOOST_CHECK(sfIntersection.isValid()); BOOST_CHECK_EQUAL(sfIntersection.position(), expectedIntersect.position()); BOOST_CHECK_EQUAL(sfIntersection.pathLength(), diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceIntersectionTests.cpp b/Tests/UnitTests/Core/Surfaces/SurfaceIntersectionTests.cpp index e6294fc27ca..0fcabe9ad81 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceIntersectionTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceIntersectionTests.cpp @@ -71,15 +71,13 @@ BOOST_AUTO_TEST_CASE(CylinderIntersectionTests) { // Check the validity of the intersection BOOST_CHECK(aIntersection[0].isValid()); // The status of this one should be on surface - BOOST_CHECK_EQUAL(aIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(aIntersection[0].status(), IntersectionStatus::reachable); // The intersection is at 2 meter distance CHECK_CLOSE_ABS(aIntersection[0].pathLength(), -2_m, s_onSurfaceTolerance); // There MUST be a second solution BOOST_CHECK(aIntersection[1].isValid()); // The other intersection MUST be reachable - BOOST_CHECK_EQUAL(aIntersection[1].status(), - Intersection3D::Status::onSurface); + BOOST_CHECK_EQUAL(aIntersection[1].status(), IntersectionStatus::onSurface); // Intersect from the center auto cIntersection = aCylinder->intersect(tgContext, atCenter, alongX, @@ -88,13 +86,11 @@ BOOST_AUTO_TEST_CASE(CylinderIntersectionTests) { // Check the validity of the intersection BOOST_CHECK(cIntersection[0].isValid()); // The status of this one MUST be reachable - BOOST_CHECK_EQUAL(cIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(cIntersection[0].status(), IntersectionStatus::reachable); // There MUST be a second solution BOOST_CHECK(cIntersection[1].isValid()); // The other intersection MUST be reachable - BOOST_CHECK_EQUAL(cIntersection[1].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(cIntersection[1].status(), IntersectionStatus::reachable); // There MUST be one forward one backwards solution BOOST_CHECK_LT( cIntersection[1].pathLength() * cIntersection[0].pathLength(), 0); @@ -106,13 +102,11 @@ BOOST_AUTO_TEST_CASE(CylinderIntersectionTests) { // Check the validity of the intersection BOOST_CHECK(oIntersection[0].isValid()); // The status of this one MUST be reachable - BOOST_CHECK_EQUAL(oIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(oIntersection[0].status(), IntersectionStatus::reachable); // There MUST be a second solution BOOST_CHECK(oIntersection[1].isValid()); // The other intersection MUST be reachable - BOOST_CHECK_EQUAL(oIntersection[1].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(oIntersection[1].status(), IntersectionStatus::reachable); // There MUST be one forward one backwards solution BOOST_CHECK_GT( oIntersection[1].pathLength() * oIntersection[0].pathLength(), 0); @@ -133,13 +127,11 @@ BOOST_AUTO_TEST_CASE(CylinderIntersectionTests) { // This should be the positive one BOOST_CHECK_LT(eIntersection[0].pathLength(), 0.); // The status of this one should be reachable - BOOST_CHECK_EQUAL(eIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(eIntersection[0].status(), IntersectionStatus::reachable); // There MUST be a second solution BOOST_CHECK(eIntersection[1].isValid()); // The other intersection MUST be reachable - BOOST_CHECK_EQUAL(eIntersection[1].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(eIntersection[1].status(), IntersectionStatus::reachable); // And be the negative one BOOST_CHECK_GT(eIntersection[1].pathLength(), 0.); @@ -149,13 +141,11 @@ BOOST_AUTO_TEST_CASE(CylinderIntersectionTests) { // This should be the negative one BOOST_CHECK_LT(eIntersection[0].pathLength(), 0.); // The status of this one should be reachable - BOOST_CHECK_EQUAL(eIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(eIntersection[0].status(), IntersectionStatus::reachable); // There MUST be a second solution BOOST_CHECK(!eIntersection[1].isValid()); // The other intersection MUST NOT be reachable - BOOST_CHECK_EQUAL(eIntersection[1].status(), - Intersection3D::Status::missed); + BOOST_CHECK_EQUAL(eIntersection[1].status(), IntersectionStatus::missed); // And be the positive one BOOST_CHECK_GT(eIntersection[1].pathLength(), 0.); }; @@ -196,15 +186,13 @@ BOOST_AUTO_TEST_CASE(ConeIntersectionTest) { // Check the validity of the intersection BOOST_CHECK(aIntersection[0].isValid()); // The status of this one should be on surface - BOOST_CHECK_EQUAL(aIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(aIntersection[0].status(), IntersectionStatus::reachable); // The intersection is at 4 mm distance CHECK_CLOSE_ABS(aIntersection[0].pathLength(), -4., s_onSurfaceTolerance); // There MUST be a second solution BOOST_CHECK(aIntersection[1].isValid()); // The other intersection MUST be reachable - BOOST_CHECK_EQUAL(aIntersection[1].status(), - Intersection3D::Status::onSurface); + BOOST_CHECK_EQUAL(aIntersection[1].status(), IntersectionStatus::onSurface); // Intersection from outside without chance of hitting the cylinder auto iIntersection = aCone->intersect(tgContext, outCone, perpXY, @@ -254,8 +242,7 @@ BOOST_AUTO_TEST_CASE(PlanarIntersectionTest) { // The intersection MUST be valid BOOST_CHECK(fIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(fIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(fIntersection[0].status(), IntersectionStatus::reachable); // The path length MUST be positive BOOST_CHECK_GT(fIntersection[0].pathLength(), 0.); // The intersection MUST be unique @@ -267,8 +254,7 @@ BOOST_AUTO_TEST_CASE(PlanarIntersectionTest) { // The intersection MUST be valid BOOST_CHECK(oIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(oIntersection[0].status(), - Intersection3D::Status::onSurface); + BOOST_CHECK_EQUAL(oIntersection[0].status(), IntersectionStatus::onSurface); // The path length MUST be positive BOOST_CHECK_LT(std::abs(oIntersection[0].pathLength()), s_onSurfaceTolerance); @@ -281,8 +267,7 @@ BOOST_AUTO_TEST_CASE(PlanarIntersectionTest) { // The intersection MUST be valid BOOST_CHECK(bIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(bIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(bIntersection[0].status(), IntersectionStatus::reachable); // The path length MUST be negative BOOST_CHECK_LT(bIntersection[0].pathLength(), 0.); // The intersection MUST be unique @@ -294,8 +279,7 @@ BOOST_AUTO_TEST_CASE(PlanarIntersectionTest) { // The intersection MUST NOT be valid BOOST_CHECK(!mIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(mIntersection[0].status(), - Intersection3D::Status::missed); + BOOST_CHECK_EQUAL(mIntersection[0].status(), IntersectionStatus::missed); // The path length MUST be negative BOOST_CHECK_GT(mIntersection[0].pathLength(), 0.); // The intersection MUST be unique @@ -308,7 +292,7 @@ BOOST_AUTO_TEST_CASE(PlanarIntersectionTest) { BOOST_CHECK(!iIntersection[0].isValid()); // The intersection MUST be reachable BOOST_CHECK_EQUAL(iIntersection[0].status(), - Intersection3D::Status::unreachable); + IntersectionStatus::unreachable); // The intersection MUST be unique BOOST_CHECK(!iIntersection[1].isValid()); }; @@ -352,8 +336,7 @@ BOOST_AUTO_TEST_CASE(LineIntersectionTest) { // The intersection MUST be valid BOOST_CHECK(fIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(fIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(fIntersection[0].status(), IntersectionStatus::reachable); // The path length MUST be positive BOOST_CHECK_GT(fIntersection[0].pathLength(), 0.); // The intersection MUST be unique @@ -365,8 +348,7 @@ BOOST_AUTO_TEST_CASE(LineIntersectionTest) { // The intersection MUST be valid BOOST_CHECK(oIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(oIntersection[0].status(), - Intersection3D::Status::onSurface); + BOOST_CHECK_EQUAL(oIntersection[0].status(), IntersectionStatus::onSurface); // The path length MUST be positive BOOST_CHECK_LT(std::abs(oIntersection[0].pathLength()), s_onSurfaceTolerance); @@ -379,8 +361,7 @@ BOOST_AUTO_TEST_CASE(LineIntersectionTest) { // The intersection MUST be valid BOOST_CHECK(oIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(oIntersection[0].status(), - Intersection3D::Status::onSurface); + BOOST_CHECK_EQUAL(oIntersection[0].status(), IntersectionStatus::onSurface); // The path length MUST be positive BOOST_CHECK_LT(std::abs(oIntersection[0].pathLength()), s_onSurfaceTolerance); @@ -393,8 +374,7 @@ BOOST_AUTO_TEST_CASE(LineIntersectionTest) { // The intersection MUST be valid BOOST_CHECK(bIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(bIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(bIntersection[0].status(), IntersectionStatus::reachable); // The path length MUST be negative BOOST_CHECK_LT(bIntersection[0].pathLength(), 0.); // The intersection MUST be unique @@ -406,8 +386,7 @@ BOOST_AUTO_TEST_CASE(LineIntersectionTest) { // The intersection MUST NOT be valid BOOST_CHECK(!mIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(mIntersection[0].status(), - Intersection3D::Status::missed); + BOOST_CHECK_EQUAL(mIntersection[0].status(), IntersectionStatus::missed); // The path length MUST be negative BOOST_CHECK_LT(mIntersection[0].pathLength(), 0.); // The intersection MUST be unique @@ -420,7 +399,7 @@ BOOST_AUTO_TEST_CASE(LineIntersectionTest) { BOOST_CHECK(!iIntersection[0].isValid()); // The intersection MUST be reachable BOOST_CHECK_EQUAL(iIntersection[0].status(), - Intersection3D::Status::unreachable); + IntersectionStatus::unreachable); // The intersection MUST be unique BOOST_CHECK(!iIntersection[1].isValid()); }; diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp b/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp index c61508a6d89..72ad444fd8a 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp @@ -89,7 +89,7 @@ class SurfaceStub : public RegularSurface { const BoundaryTolerance& /*boundaryTolerance*/, const ActsScalar /*tolerance*/) const final { Intersection3D stubIntersection(Vector3(20., 0., 0.), 20., - Intersection3D::Status::reachable); + IntersectionStatus::reachable); return SurfaceMultiIntersection( {stubIntersection, Intersection3D::invalid()}, this); } diff --git a/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp b/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp index 41581b08b8d..bda4cad2da2 100644 --- a/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp +++ b/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp @@ -32,19 +32,15 @@ class Object {}; BOOST_AUTO_TEST_CASE(IntersectionTest) { // a few valid intersections // all positively sortered - Intersection3D fIp(Vector3(0., 1., 0.), 1., - Intersection3D::Status::reachable); - Intersection3D sIp(Vector3(0., 2., 0.), 2., - Intersection3D::Status::reachable); - Intersection3D tIp(Vector3(0., 3., 0.), 3., - Intersection3D::Status::reachable); + Intersection3D fIp(Vector3(0., 1., 0.), 1., IntersectionStatus::reachable); + Intersection3D sIp(Vector3(0., 2., 0.), 2., IntersectionStatus::reachable); + Intersection3D tIp(Vector3(0., 3., 0.), 3., IntersectionStatus::reachable); BOOST_CHECK(fIp.isValid()); BOOST_CHECK(sIp.isValid()); BOOST_CHECK(tIp.isValid()); // a non-valid intersection - Intersection3D nIp(Vector3(3., 3., 0.), 3., - Intersection3D::Status::unreachable); + Intersection3D nIp(Vector3(3., 3., 0.), 3., IntersectionStatus::unreachable); BOOST_CHECK(!nIp.isValid()); std::vector fstpIntersections = {fIp, sIp, tIp}; @@ -82,12 +78,9 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { tfnsnpIntersections[2].pathLength()); /// let's make a bunch of negative solution - Intersection3D fIn(Vector3(0., -1., 0.), -1., - Intersection3D::Status::reachable); - Intersection3D sIn(Vector3(0., -2., 0.), -2., - Intersection3D::Status::reachable); - Intersection3D tIn(Vector3(0., -3., 0.), -3., - Intersection3D::Status::reachable); + Intersection3D fIn(Vector3(0., -1., 0.), -1., IntersectionStatus::reachable); + Intersection3D sIn(Vector3(0., -2., 0.), -2., IntersectionStatus::reachable); + Intersection3D tIn(Vector3(0., -3., 0.), -3., IntersectionStatus::reachable); std::vector tsfnIntersections = {tIn, sIn, fIn}; std::vector fstnIntersections = {fIn, sIn, tIn}; @@ -113,7 +106,7 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { BOOST_CHECK_EQUAL(pnsolutions[5].pathLength(), 3.); // sort intersections with zero path length - Intersection3D zI(Vector3(0., 0., 0.), 0., Intersection3D::Status::onSurface); + Intersection3D zI(Vector3(0., 0., 0.), 0., IntersectionStatus::onSurface); std::vector tszfpIntersections = {tIp, sIp, zI, fIp}; std::ranges::sort(tszfpIntersections, Intersection3D::pathLengthOrder); @@ -147,25 +140,25 @@ BOOST_AUTO_TEST_CASE(ObjectIntersectionTest) { using PlaneIntersection = ObjectIntersection; - PlaneIntersection int6(Intersection3D(Vector3(6., 0., 0.), 6., - Intersection3D::Status::reachable), - psf6.get()); - PlaneIntersection int7(Intersection3D(Vector3(7., 0., 0.), 7., - Intersection3D::Status::reachable), - psf7.get()); - PlaneIntersection int8(Intersection3D(Vector3(8., 0., 0.), 8., - Intersection3D::Status::reachable), - psf8.get()); - PlaneIntersection int9a(Intersection3D(Vector3(9., 0., 0.), 9., - Intersection3D::Status::reachable), - psf9.get()); + PlaneIntersection int6( + Intersection3D(Vector3(6., 0., 0.), 6., IntersectionStatus::reachable), + psf6.get()); + PlaneIntersection int7( + Intersection3D(Vector3(7., 0., 0.), 7., IntersectionStatus::reachable), + psf7.get()); + PlaneIntersection int8( + Intersection3D(Vector3(8., 0., 0.), 8., IntersectionStatus::reachable), + psf8.get()); + PlaneIntersection int9a( + Intersection3D(Vector3(9., 0., 0.), 9., IntersectionStatus::reachable), + psf9.get()); PlaneIntersection int9b( Intersection3D(Vector3(9., 1., 0.), std::hypot(9., 1.), - Intersection3D::Status::reachable), + IntersectionStatus::reachable), psf9.get()); - PlaneIntersection int10(Intersection3D(Vector3(10., 0., 0.), 10., - Intersection3D::Status::reachable), - psf10.get()); + PlaneIntersection int10( + Intersection3D(Vector3(10., 0., 0.), 10., IntersectionStatus::reachable), + psf10.get()); std::vector firstSet = {int6, int7, int9b, int10}; std::vector secondSet = {int8, int9a, int9b, int10}; From f17f64094e958d8821921e117e06cb00c997844c Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Sun, 24 Nov 2024 09:12:28 +0100 Subject: [PATCH 3/7] fix: boost progress include fails on next boost major release (#3896) Fix for the rare case, that boost will make a major release. --- Examples/Scripts/MaterialMapping/MaterialComposition.cpp | 2 +- Examples/Scripts/TrackingPerformance/TrackSummary.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/Scripts/MaterialMapping/MaterialComposition.cpp b/Examples/Scripts/MaterialMapping/MaterialComposition.cpp index 348a4912f29..7e7731af846 100644 --- a/Examples/Scripts/MaterialMapping/MaterialComposition.cpp +++ b/Examples/Scripts/MaterialMapping/MaterialComposition.cpp @@ -24,7 +24,7 @@ #include #define BOOST_AVAILABLE 1 -#if ((BOOST_VERSION / 100) % 1000) <= 71 +#if BOOST_VERSION < 107200 // Boost <=1.71 and lower do not have progress_display.hpp as a replacement yet #include diff --git a/Examples/Scripts/TrackingPerformance/TrackSummary.cpp b/Examples/Scripts/TrackingPerformance/TrackSummary.cpp index deba72311d5..0e806ff0a90 100644 --- a/Examples/Scripts/TrackingPerformance/TrackSummary.cpp +++ b/Examples/Scripts/TrackingPerformance/TrackSummary.cpp @@ -27,7 +27,7 @@ #include #define BOOST_AVAILABLE 1 -#if ((BOOST_VERSION / 100) % 1000) <= 71 +#if BOOST_VERSION < 107200 // Boost <=1.71 and lower do not have progress_display.hpp as a replacement yet #include From 7b64bace6f77642f1b608b0c4729f96db9720531 Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Sun, 24 Nov 2024 21:24:37 +0100 Subject: [PATCH 4/7] ci: wrong directory formating in update-pip bot (#3903) --- .github/workflows/update-pip-requirements.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-pip-requirements.yml b/.github/workflows/update-pip-requirements.yml index 444ade7b287..e205abc75ce 100755 --- a/.github/workflows/update-pip-requirements.yml +++ b/.github/workflows/update-pip-requirements.yml @@ -34,7 +34,7 @@ jobs: CI/clang_tidy CI/fpe_masks docs - Examples/Python/tests/ + Examples/Python/tests Examples/Scripts ) for folder in "${folder_list[@]}"; do From 0e64ff54eb53333f371a99e8f134312f9765ecd1 Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Sun, 24 Nov 2024 22:51:34 +0100 Subject: [PATCH 5/7] docs: remove http-relics for license (#3902) We had the docs test failing quite frequently during the last week, like in here: https://github.com/acts-project/acts/actions/runs/11990353442/job/33427764861?pr=3896 due to ``` ( license: line 4) broken http://mozilla.org/MPL/2.0/ - 404 Client Error: Not Found for url: https://www.mozilla.org/en-US/mpl/2.0/ ``` It seems, that mozilla forwards http sometimes to the wrong address with everything lovercase, which makes problems with `mpl` vs `MPL`. --- .../ITkModuleSplitting/ITkModuleSplitting.hpp | 8 -------- README.md | 2 +- docs/license.rst | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Examples/Detectors/ITkModuleSplitting/include/ActsExamples/ITkModuleSplitting/ITkModuleSplitting.hpp b/Examples/Detectors/ITkModuleSplitting/include/ActsExamples/ITkModuleSplitting/ITkModuleSplitting.hpp index 591671bffb7..61a827ca29d 100644 --- a/Examples/Detectors/ITkModuleSplitting/include/ActsExamples/ITkModuleSplitting/ITkModuleSplitting.hpp +++ b/Examples/Detectors/ITkModuleSplitting/include/ActsExamples/ITkModuleSplitting/ITkModuleSplitting.hpp @@ -6,14 +6,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -// This file is part of the Acts project. -// -// Copyright (C) 2024 CERN for the benefit of the Acts project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// 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/. - #pragma once #include "Acts/Definitions/Algebra.hpp" diff --git a/README.md b/README.md index 7b75acee190..5337e811908 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Contributors to the Acts project are listed in the [AUTHORS](AUTHORS) file. The Acts project is published under the terms of the Mozilla Public License, v. 2.0. A copy of the license can be found in the [LICENSE](LICENSE) file or at -http://mozilla.org/MPL/2.0/ . +https://mozilla.org/MPL/2.0/ . The Acts project contains copies of the following external packages: diff --git a/docs/license.rst b/docs/license.rst index dd058963b4b..90f69479545 100644 --- a/docs/license.rst +++ b/docs/license.rst @@ -2,7 +2,7 @@ License ======= ACTS is licensed under the `Mozilla Public License Version 2.0 -`_. The full text of the license can be found +`_. The full text of the license can be found below. .. literalinclude:: ../LICENSE From d6b1ee3fcd87b264e4307d4c6693972135f23888 Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Mon, 25 Nov 2024 10:34:29 +0100 Subject: [PATCH 6/7] refactor: remove custom scalar in classes (#3894) --- .../EventData/GenericBoundTrackParameters.hpp | 21 ++- .../GenericCurvilinearTrackParameters.hpp | 7 +- .../EventData/GenericFreeTrackParameters.hpp | 27 ++-- .../MultiComponentTrackParameters.hpp | 21 ++- .../Acts/EventData/TrackParametersConcept.hpp | 1 - .../Acts/EventData/TrackStateProxy.hpp | 22 ++- .../Acts/Propagator/ConstrainedStep.hpp | 36 +++-- .../EigenStepperDefaultExtension.hpp | 14 +- .../Propagator/EigenStepperDenseExtension.hpp | 42 +++--- .../ParametricParticleGenerator.cpp | 4 +- .../Generators/Pythia8ProcessGenerator.cpp | 3 +- .../ActsExamples/EventData/DriftCircle.hpp | 22 ++- .../ActsExamples/EventData/SimParticle.hpp | 12 +- .../ActsExamples/EventData/SimSpacePoint.hpp | 44 +++--- .../ActsExamples/EventData/SimVertex.hpp | 9 +- Examples/Io/Csv/src/CsvDriftCircleReader.cpp | 7 +- Examples/Io/Csv/src/CsvMuonSimHitReader.cpp | 22 ++- Examples/Io/Csv/src/CsvSimHitReader.cpp | 6 +- .../include/ActsFatras/Geant4/Geant4Decay.hpp | 18 ++- Fatras/Geant4/src/Geant4Decay.cpp | 4 +- .../Digitization/DigitizationData.hpp | 5 +- .../Digitization/UncorrelatedHitSmearer.hpp | 2 - Fatras/include/ActsFatras/EventData/Hit.hpp | 30 ++-- .../include/ActsFatras/EventData/Particle.hpp | 86 ++++++----- .../ActsFatras/Kernel/InteractionList.hpp | 10 +- .../include/ActsFatras/Kernel/Simulation.hpp | 4 +- .../ActsFatras/Kernel/SimulationResult.hpp | 7 +- .../Kernel/detail/SimulationActor.hpp | 4 +- .../ActsFatras/Physics/Decay/NoDecay.hpp | 4 +- .../Physics/ElectroMagnetic/BetheHeitler.hpp | 11 +- .../ElectroMagnetic/PhotonConversion.hpp | 136 +++++++++--------- .../NuclearInteraction/NuclearInteraction.hpp | 29 ++-- .../Selectors/ParticleSelectors.hpp | 8 +- Fatras/src/Physics/BetheHeitler.cpp | 16 +-- .../NuclearInteraction/NuclearInteraction.cpp | 14 +- Fatras/src/Physics/PhotonConversion.cpp | 5 +- .../Acts/Plugins/Hashing/HashingAnnoy.ipp | 22 ++- .../Acts/Plugins/Hashing/HashingTraining.ipp | 18 ++- .../Core/Seeding/HoughTransformTest.cpp | 15 +- .../Core/Utilities/BoundingBoxTest.cpp | 129 ++++++++--------- Tests/UnitTests/Fatras/EventData/HitTests.cpp | 64 +++++---- .../Fatras/EventData/ParticleTests.cpp | 36 +++-- .../Fatras/Kernel/InteractionListTests.cpp | 23 ++- .../Fatras/Kernel/SimulationActorTests.cpp | 35 ++--- .../Fatras/Physics/PhotonConversionTests.cpp | 28 ++-- 45 files changed, 499 insertions(+), 584 deletions(-) diff --git a/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp b/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp index 38f297764b1..22567d8adf5 100644 --- a/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp +++ b/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp @@ -36,7 +36,6 @@ namespace Acts { template class GenericBoundTrackParameters { public: - using Scalar = ActsScalar; using ParametersVector = BoundVector; using CovarianceMatrix = BoundSquareMatrix; using ParticleHypothesis = particle_hypothesis_t; @@ -92,10 +91,10 @@ class GenericBoundTrackParameters { /// successfully be converted to on-surface parameters. static Result create( std::shared_ptr surface, const GeometryContext& geoCtx, - const Vector4& pos4, const Vector3& dir, Scalar qOverP, + const Vector4& pos4, const Vector3& dir, double qOverP, std::optional cov, ParticleHypothesis particleHypothesis, - ActsScalar tolerance = s_onSurfaceTolerance) { + double tolerance = s_onSurfaceTolerance) { Result bound = transformFreeToBoundParameters(pos4.segment<3>(ePos0), pos4[eTime], dir, qOverP, *surface, geoCtx, tolerance); @@ -168,7 +167,7 @@ class GenericBoundTrackParameters { /// /// @tparam kIndex Track parameter index template - Scalar get() const { + double get() const { return m_params[kIndex]; } @@ -203,14 +202,14 @@ class GenericBoundTrackParameters { return m_surface->localToGlobal(geoCtx, localPosition(), direction()); } /// Time coordinate. - Scalar time() const { return m_params[eBoundTime]; } + double time() const { return m_params[eBoundTime]; } /// Phi direction. - Scalar phi() const { return m_params[eBoundPhi]; } + double phi() const { return m_params[eBoundPhi]; } /// Theta direction. - Scalar theta() const { return m_params[eBoundTheta]; } + double theta() const { return m_params[eBoundTheta]; } /// Charge over momentum. - Scalar qOverP() const { return m_params[eBoundQOverP]; } + double qOverP() const { return m_params[eBoundQOverP]; } /// Unit direction three-vector, i.e. the normalized momentum /// three-vector. @@ -219,18 +218,18 @@ class GenericBoundTrackParameters { m_params[eBoundTheta]); } /// Absolute momentum. - Scalar absoluteMomentum() const { + double absoluteMomentum() const { return m_particleHypothesis.extractMomentum(m_params[eBoundQOverP]); } /// Transverse momentum. - Scalar transverseMomentum() const { + double transverseMomentum() const { return std::sin(m_params[eBoundTheta]) * absoluteMomentum(); } /// Momentum three-vector. Vector3 momentum() const { return absoluteMomentum() * direction(); } /// Particle electric charge. - Scalar charge() const { + double charge() const { return m_particleHypothesis.extractCharge(get()); } diff --git a/Core/include/Acts/EventData/GenericCurvilinearTrackParameters.hpp b/Core/include/Acts/EventData/GenericCurvilinearTrackParameters.hpp index 6e4ed9bae7a..9764ad68cfc 100644 --- a/Core/include/Acts/EventData/GenericCurvilinearTrackParameters.hpp +++ b/Core/include/Acts/EventData/GenericCurvilinearTrackParameters.hpp @@ -30,7 +30,6 @@ class GenericCurvilinearTrackParameters using Base = GenericBoundTrackParameters; public: - using Scalar = ActsScalar; using ParametersVector = BoundVector; using CovarianceMatrix = BoundSquareMatrix; using ParticleHypothesis = particle_hypothesis_t; @@ -43,7 +42,7 @@ class GenericCurvilinearTrackParameters /// @param cov Curvilinear bound parameters covariance matrix /// @param particleHypothesis Particle hypothesis GenericCurvilinearTrackParameters(const Vector4& pos4, const Vector3& dir, - Scalar qOverP, + double qOverP, std::optional cov, ParticleHypothesis particleHypothesis) : Base(CurvilinearSurface(pos4.segment<3>(ePos0), dir).surface(), @@ -58,8 +57,8 @@ class GenericCurvilinearTrackParameters /// @param qOverP Charge over momentum /// @param cov Curvilinear bound parameters covariance matrix /// @param particleHypothesis Particle hypothesis - GenericCurvilinearTrackParameters(const Vector4& pos4, Scalar phi, - Scalar theta, Scalar qOverP, + GenericCurvilinearTrackParameters(const Vector4& pos4, double phi, + double theta, double qOverP, std::optional cov, ParticleHypothesis particleHypothesis) : Base(CurvilinearSurface(pos4.segment<3>(ePos0), diff --git a/Core/include/Acts/EventData/GenericFreeTrackParameters.hpp b/Core/include/Acts/EventData/GenericFreeTrackParameters.hpp index 7a2b4b46522..b0499dd3137 100644 --- a/Core/include/Acts/EventData/GenericFreeTrackParameters.hpp +++ b/Core/include/Acts/EventData/GenericFreeTrackParameters.hpp @@ -33,7 +33,6 @@ namespace Acts { template class GenericFreeTrackParameters { public: - using Scalar = ActsScalar; using ParametersVector = FreeVector; using CovarianceMatrix = FreeSquareMatrix; using ParticleHypothesis = particle_hypothesis_t; @@ -66,7 +65,7 @@ class GenericFreeTrackParameters { /// @param cov Free parameters covariance matrix /// @param particleHypothesis Particle hypothesis GenericFreeTrackParameters(const Vector4& pos4, const Vector3& dir, - Scalar qOverP, std::optional cov, + double qOverP, std::optional cov, ParticleHypothesis particleHypothesis) : m_params(FreeVector::Zero()), m_cov(std::move(cov)), @@ -91,8 +90,8 @@ class GenericFreeTrackParameters { /// @param qOverP Charge over momentum /// @param cov Free parameters covariance matrix /// @param particleHypothesis Particle hypothesis - GenericFreeTrackParameters(const Vector4& pos4, Scalar phi, Scalar theta, - Scalar qOverP, std::optional cov, + GenericFreeTrackParameters(const Vector4& pos4, double phi, double theta, + double qOverP, std::optional cov, ParticleHypothesis particleHypothesis) : m_params(FreeVector::Zero()), m_cov(std::move(cov)), @@ -146,7 +145,7 @@ class GenericFreeTrackParameters { /// /// @tparam kIndex Track parameter index template - Scalar get() const { + double get() const { return m_params[kIndex]; } @@ -162,33 +161,33 @@ class GenericFreeTrackParameters { /// Spatial position three-vector. Vector3 position() const { return m_params.segment<3>(eFreePos0); } /// Time coordinate. - Scalar time() const { return m_params[eFreeTime]; } + double time() const { return m_params[eFreeTime]; } /// Phi direction. - Scalar phi() const { return VectorHelpers::phi(direction()); } + double phi() const { return VectorHelpers::phi(direction()); } /// Theta direction. - Scalar theta() const { return VectorHelpers::theta(direction()); } + double theta() const { return VectorHelpers::theta(direction()); } /// Charge over momentum. - Scalar qOverP() const { return m_params[eFreeQOverP]; } + double qOverP() const { return m_params[eFreeQOverP]; } /// Unit direction three-vector, i.e. the normalized momentum three-vector. Vector3 direction() const { return m_params.segment<3>(eFreeDir0).normalized(); } /// Absolute momentum. - Scalar absoluteMomentum() const { + double absoluteMomentum() const { return m_particleHypothesis.extractMomentum(m_params[eFreeQOverP]); } /// Transverse momentum. - Scalar transverseMomentum() const { + double transverseMomentum() const { // direction vector w/ arbitrary normalization can be parametrized as // [f*sin(theta)*cos(phi), f*sin(theta)*sin(phi), f*cos(theta)] // w/ f,sin(theta) positive, the transverse magnitude is then // sqrt(f^2*sin^2(theta)) = f*sin(theta) - Scalar transverseMagnitude2 = + double transverseMagnitude2 = square(m_params[eFreeDir0]) + square(m_params[eFreeDir1]); // absolute magnitude is f by construction - Scalar magnitude2 = transverseMagnitude2 + square(m_params[eFreeDir2]); + double magnitude2 = transverseMagnitude2 + square(m_params[eFreeDir2]); // such that we can extract sin(theta) = f*sin(theta) / f return std::sqrt(transverseMagnitude2 / magnitude2) * absoluteMomentum(); } @@ -196,7 +195,7 @@ class GenericFreeTrackParameters { Vector3 momentum() const { return absoluteMomentum() * direction(); } /// Particle electric charge. - Scalar charge() const { + double charge() const { return m_particleHypothesis.extractCharge(get()); } diff --git a/Core/include/Acts/EventData/MultiComponentTrackParameters.hpp b/Core/include/Acts/EventData/MultiComponentTrackParameters.hpp index 70ad87f8d77..cf932fc0470 100644 --- a/Core/include/Acts/EventData/MultiComponentTrackParameters.hpp +++ b/Core/include/Acts/EventData/MultiComponentTrackParameters.hpp @@ -34,7 +34,6 @@ class MultiComponentBoundTrackParameters { public: using Parameters = BoundTrackParameters; using ParticleHypothesis = Parameters::ParticleHypothesis; - using Scalar = typename Parameters::Scalar; using ParametersVector = typename Parameters::ParametersVector; using CovarianceMatrix = typename Parameters::CovarianceMatrix; @@ -159,7 +158,7 @@ class MultiComponentBoundTrackParameters { /// /// @tparam kIndex Track parameter index template - Scalar get() const { + double get() const { return reduce([&](const Parameters& p) { return p.get(); }); } @@ -180,7 +179,7 @@ class MultiComponentBoundTrackParameters { } /// Time coordinate. - Scalar time() const { + double time() const { return reduce([](const Parameters& p) { return p.time(); }); } @@ -192,21 +191,21 @@ class MultiComponentBoundTrackParameters { } /// Phi direction. - Scalar phi() const { return VectorHelpers::phi(direction()); } + double phi() const { return VectorHelpers::phi(direction()); } /// Theta direction. - Scalar theta() const { return VectorHelpers::theta(direction()); } + double theta() const { return VectorHelpers::theta(direction()); } /// Charge over momentum. - Scalar qOverP() const { return get(); } + double qOverP() const { return get(); } /// Absolute momentum. - Scalar absoluteMomentum() const { + double absoluteMomentum() const { return reduce([](const Parameters& p) { return p.absoluteMomentum(); }); } /// Transverse momentum. - Scalar transverseMomentum() const { + double transverseMomentum() const { return reduce([](const Parameters& p) { return p.transverseMomentum(); }); } @@ -216,7 +215,7 @@ class MultiComponentBoundTrackParameters { } /// Particle electric charge. - Scalar charge() const { + double charge() const { return reduce([](const Parameters& p) { return p.charge(); }); } @@ -238,8 +237,8 @@ class MultiComponentCurvilinearTrackParameters using covariance_t = BoundSquareMatrix; public: - using ConstructionTuple = std::tuple; + using ConstructionTuple = + std::tuple; private: using Base = MultiComponentBoundTrackParameters; diff --git a/Core/include/Acts/EventData/TrackParametersConcept.hpp b/Core/include/Acts/EventData/TrackParametersConcept.hpp index 5e4982545a4..4369fe57141 100644 --- a/Core/include/Acts/EventData/TrackParametersConcept.hpp +++ b/Core/include/Acts/EventData/TrackParametersConcept.hpp @@ -21,7 +21,6 @@ class Surface; namespace Concepts { template concept BasicTrackParameters = requires { - typename Parameters::Scalar; typename Parameters::ParametersVector; typename Parameters::CovarianceMatrix; diff --git a/Core/include/Acts/EventData/TrackStateProxy.hpp b/Core/include/Acts/EventData/TrackStateProxy.hpp index 741bfa5b511..b7b991fa2ee 100644 --- a/Core/include/Acts/EventData/TrackStateProxy.hpp +++ b/Core/include/Acts/EventData/TrackStateProxy.hpp @@ -82,17 +82,15 @@ template struct FixedSizeTypes { constexpr static auto Flags = Eigen::ColMajor | Eigen::AutoAlign; - using Scalar = ActsScalar; - // single items - using Coefficients = Eigen::Matrix; - using Covariance = Eigen::Matrix; + using Coefficients = Eigen::Matrix; + using Covariance = Eigen::Matrix; using CoefficientsMap = Eigen::Map>; using CovarianceMap = Eigen::Map>; - using DynamicCoefficients = Eigen::Matrix; + using DynamicCoefficients = Eigen::Matrix; using DynamicCovariance = - Eigen::Matrix; + Eigen::Matrix; using DynamicCoefficientsMap = Eigen::Map>; using DynamicCovarianceMap = @@ -105,11 +103,9 @@ template struct DynamicSizeTypes { constexpr static auto Flags = Eigen::ColMajor | Eigen::AutoAlign; - using Scalar = ActsScalar; - - using Coefficients = Eigen::Matrix; + using Coefficients = Eigen::Matrix; using Covariance = - Eigen::Matrix; + Eigen::Matrix; using CoefficientsMap = Eigen::Map>; using CovarianceMap = Eigen::Map>; }; @@ -119,8 +115,6 @@ struct DynamicSizeTypes { // This is public template struct TrackStateTraits { - using Scalar = ActsScalar; - using Parameters = typename detail_lt::FixedSizeTypes::CoefficientsMap; using Covariance = @@ -135,8 +129,8 @@ struct TrackStateTraits { typename detail_lt::DynamicSizeTypes::CovarianceMap; constexpr static auto ProjectorFlags = Eigen::RowMajor | Eigen::AutoAlign; - using Projector = Eigen::Matrix; - using EffectiveProjector = Eigen::Matrix; + using EffectiveProjector = Eigen::Matrix; }; diff --git a/Core/include/Acts/Propagator/ConstrainedStep.hpp b/Core/include/Acts/Propagator/ConstrainedStep.hpp index e957b001281..412f308bac9 100644 --- a/Core/include/Acts/Propagator/ConstrainedStep.hpp +++ b/Core/include/Acts/Propagator/ConstrainedStep.hpp @@ -40,11 +40,9 @@ namespace Acts { /// The hierarchy is: /// - Overstepping resolution / backpropagation /// - Convergence -/// - Step into the void with `std::numeric_limits::max()` +/// - Step into the void with `std::numeric_limits::max()` class ConstrainedStep { public: - using Scalar = ActsScalar; - /// the types of constraints /// from actor - this would be a typical navigation step /// from aborter - this would be a target condition @@ -53,26 +51,26 @@ class ConstrainedStep { constexpr ConstrainedStep() = default; - /// constructor from Scalar + /// constructor /// @param value is the user given initial value - constexpr explicit ConstrainedStep(Scalar value) { setUser(value); } + constexpr explicit ConstrainedStep(double value) { setUser(value); } - /// set accuracy by one Scalar + /// set accuracy /// /// this will set only the accuracy, as this is the most /// exposed to the Propagator /// /// @param value is the new accuracy value - constexpr void setAccuracy(Scalar value) { + constexpr void setAccuracy(double value) { assert(value > 0 && "ConstrainedStep accuracy must be > 0."); // set the accuracy value m_accuracy = value; } - /// set user by one Scalar + /// set user /// /// @param value is the new user value - constexpr void setUser(Scalar value) { + constexpr void setUser(double value) { // TODO enable assert; see https://github.com/acts-project/acts/issues/2543 // assert(value != 0 && "ConstrainedStep user must be != 0."); // set the user value @@ -80,20 +78,20 @@ class ConstrainedStep { } /// returns the min step size - constexpr Scalar value() const { - Scalar min = *std::min_element(m_values.begin(), m_values.end()); + constexpr double value() const { + double min = *std::min_element(m_values.begin(), m_values.end()); // accuracy is always positive and therefore handled separately - Scalar result = std::min(std::abs(min), m_accuracy); + double result = std::min(std::abs(min), m_accuracy); return std::signbit(min) ? -result : result; } /// Access a specific value /// /// @param type is the requested parameter type - constexpr Scalar value(Type type) const { return m_values[type]; } + constexpr double value(Type type) const { return m_values[type]; } /// Access the accuracy value - constexpr Scalar accuracy() const { return m_accuracy; } + constexpr double accuracy() const { return m_accuracy; } /// release a certain constraint value /// @@ -111,7 +109,7 @@ class ConstrainedStep { /// @param value is the new value to be updated /// @param type is the constraint type /// @param releaseStep Allow step size to increase again - constexpr void update(Scalar value, Type type, bool releaseStep = false) { + constexpr void update(double value, Type type, bool releaseStep = false) { if (releaseStep) { release(type); } @@ -127,7 +125,7 @@ class ConstrainedStep { std::ostream& toStream(std::ostream& os) const { // Helper method to avoid unreadable screen output - auto streamValue = [&](Scalar val) { + auto streamValue = [&](double val) { os << std::setw(5); if (std::abs(val) == kNotSet) { os << (val > 0 ? "+∞" : "-∞"); @@ -156,12 +154,12 @@ class ConstrainedStep { } private: - static constexpr auto kNotSet = std::numeric_limits::max(); + static constexpr auto kNotSet = std::numeric_limits::max(); /// the step size tuple - std::array m_values = {kNotSet, kNotSet, kNotSet}; + std::array m_values = {kNotSet, kNotSet, kNotSet}; /// the accuracy value - this can vary up and down given a good step estimator - Scalar m_accuracy = kNotSet; + double m_accuracy = kNotSet; }; inline std::ostream& operator<<(std::ostream& os, const ConstrainedStep& step) { diff --git a/Core/include/Acts/Propagator/EigenStepperDefaultExtension.hpp b/Core/include/Acts/Propagator/EigenStepperDefaultExtension.hpp index 2810b11a2a2..cb7939534f5 100644 --- a/Core/include/Acts/Propagator/EigenStepperDefaultExtension.hpp +++ b/Core/include/Acts/Propagator/EigenStepperDefaultExtension.hpp @@ -16,14 +16,10 @@ namespace Acts { -/// @brief Default evaluater of the k_i's and elements of the transport matrix +/// @brief Default evaluator of the k_i's and elements of the transport matrix /// D of the RKN4 stepping. This is a pure implementation by textbook. struct EigenStepperDefaultExtension { - using Scalar = ActsScalar; - /// @brief Vector3 replacement for the custom scalar type - using ThisVector3 = Eigen::Matrix; - - /// @brief Evaluater of the k_i's of the RKN4. For the case of i = 0 this + /// @brief Evaluator of the k_i's of the RKN4. For the case of i = 0 this /// step sets up qop, too. /// /// @tparam i Index of the k_i, i = [0, 3] @@ -43,9 +39,9 @@ struct EigenStepperDefaultExtension { template bool k(const propagator_state_t& state, const stepper_t& stepper, - const navigator_t& /*navigator*/, ThisVector3& knew, - const Vector3& bField, std::array& kQoP, - const double h = 0., const ThisVector3& kprev = ThisVector3::Zero()) + const navigator_t& /*navigator*/, Vector3& knew, const Vector3& bField, + std::array& kQoP, const double h = 0., + const Vector3& kprev = Vector3::Zero()) requires(i >= 0 && i <= 3) { auto qop = stepper.qOverP(state.stepping); diff --git a/Core/include/Acts/Propagator/EigenStepperDenseExtension.hpp b/Core/include/Acts/Propagator/EigenStepperDenseExtension.hpp index 70dbb1cb820..a3d88ea1997 100644 --- a/Core/include/Acts/Propagator/EigenStepperDenseExtension.hpp +++ b/Core/include/Acts/Propagator/EigenStepperDenseExtension.hpp @@ -21,44 +21,40 @@ namespace Acts { -/// @brief Evaluater of the k_i's and elements of the transport matrix +/// @brief Evaluator of the k_i's and elements of the transport matrix /// D of the RKN4 stepping. This implementation involves energy loss due to -/// ioninisation, bremsstrahlung, pair production and photonuclear interaction -/// in the propagation and the jacobian. These effects will only occur if the +/// ionisation, bremsstrahlung, pair production and photonuclear interaction +/// in the propagation and the Jacobian. These effects will only occur if the /// propagation is in a TrackingVolume with attached material. struct EigenStepperDenseExtension { - using Scalar = ActsScalar; - /// @brief Vector3 replacement for the custom scalar type - using ThisVector3 = Eigen::Matrix; - /// Fallback extension EigenStepperDefaultExtension defaultExtension; /// Momentum at a certain point - Scalar currentMomentum = 0.; + double currentMomentum = 0.; /// Particles momentum at k1 - Scalar initialMomentum = 0.; + double initialMomentum = 0.; /// Material that will be passed /// TODO : Might not be needed anymore Material material; /// Derivatives dLambda''dlambda at each sub-step point - std::array dLdl{}; + std::array dLdl{}; /// q/p at each sub-step - std::array qop{}; + std::array qop{}; /// Derivatives dPds at each sub-step - std::array dPds{}; + std::array dPds{}; /// Derivative d(dEds)d(q/p) evaluated at the initial point - Scalar dgdqopValue = 0.; + double dgdqopValue = 0.; /// Derivative dEds at the initial point - Scalar g = 0.; + double g = 0.; /// k_i equivalent for the time propagation - std::array tKi{}; + std::array tKi{}; /// Lambda''_i - std::array Lambdappi{}; + std::array Lambdappi{}; /// Energy at each sub-step - std::array energy{}; + std::array energy{}; - /// @brief Evaluater of the k_i's of the RKN4. For the case of i = 0 this + /// @brief Evaluator of the k_i's of the RKN4. For the case of i = 0 this /// step sets up member parameters, too. /// /// @tparam i Index of the k_i, i = [0, 3] @@ -79,9 +75,9 @@ struct EigenStepperDenseExtension { template bool k(const propagator_state_t& state, const stepper_t& stepper, - const navigator_t& navigator, ThisVector3& knew, const Vector3& bField, - std::array& kQoP, const double h = 0., - const ThisVector3& kprev = ThisVector3::Zero()) + const navigator_t& navigator, Vector3& knew, const Vector3& bField, + std::array& kQoP, const double h = 0., + const Vector3& kprev = Vector3::Zero()) requires(i >= 0 && i <= 3) { const auto* volumeMaterial = @@ -98,7 +94,7 @@ struct EigenStepperDenseExtension { // i = 0 is used for setup and evaluation of k if constexpr (i == 0) { // Set up for energy loss - ThisVector3 position = stepper.position(state.stepping); + Vector3 position = stepper.position(state.stepping); material = volumeMaterial->material(position.template cast()); initialMomentum = stepper.absoluteMomentum(state.stepping); currentMomentum = initialMomentum; @@ -217,7 +213,7 @@ struct EigenStepperDenseExtension { } private: - /// @brief Evaluates the transport matrix D for the jacobian + /// @brief Evaluates the transport matrix D for the Jacobian /// /// @tparam propagator_state_t Type of the state of the propagator /// @tparam stepper_t Type of the stepper diff --git a/Examples/Algorithms/Generators/ActsExamples/Generators/ParametricParticleGenerator.cpp b/Examples/Algorithms/Generators/ActsExamples/Generators/ParametricParticleGenerator.cpp index 34363410f42..00411fc64c3 100644 --- a/Examples/Algorithms/Generators/ActsExamples/Generators/ParametricParticleGenerator.cpp +++ b/Examples/Algorithms/Generators/ActsExamples/Generators/ParametricParticleGenerator.cpp @@ -92,8 +92,8 @@ ParametricParticleGenerator::operator()(RandomEngine& rng) { SimParticleContainer::sequence_type particles; // create the primary vertex - auto& primaryVertex = vertices.emplace_back( - SimVertexBarcode{0}, SimVertex::Vector4(0., 0., 0., 0.)); + auto& primaryVertex = + vertices.emplace_back(SimVertexBarcode{0}, Acts::Vector4(0., 0., 0., 0.)); // counter will be reused as barcode particle number which must be non-zero. for (std::size_t ip = 1; ip <= m_cfg.numParticles; ++ip) { diff --git a/Examples/Algorithms/GeneratorsPythia8/ActsExamples/Generators/Pythia8ProcessGenerator.cpp b/Examples/Algorithms/GeneratorsPythia8/ActsExamples/Generators/Pythia8ProcessGenerator.cpp index cd80d64bf08..1b774a7bdf0 100644 --- a/Examples/Algorithms/GeneratorsPythia8/ActsExamples/Generators/Pythia8ProcessGenerator.cpp +++ b/Examples/Algorithms/GeneratorsPythia8/ActsExamples/Generators/Pythia8ProcessGenerator.cpp @@ -121,8 +121,7 @@ Pythia8Generator::operator()(RandomEngine& rng) { } // create the primary vertex - vertices.emplace_back(SimVertexBarcode{0}, - SimVertex::Vector4(0., 0., 0., 0.)); + vertices.emplace_back(SimVertexBarcode{0}, Acts::Vector4(0., 0., 0., 0.)); // convert generated final state particles into internal format for (int ip = 0; ip < m_pythia8->event.size(); ++ip) { diff --git a/Examples/Framework/include/ActsExamples/EventData/DriftCircle.hpp b/Examples/Framework/include/ActsExamples/EventData/DriftCircle.hpp index 88cad84fffe..3d9ab8c241f 100644 --- a/Examples/Framework/include/ActsExamples/EventData/DriftCircle.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/DriftCircle.hpp @@ -23,8 +23,6 @@ namespace ActsExamples { /// representation of a drift circle measurement used for track finding class DriftCircle { - using Scalar = Acts::ActsScalar; - public: /// Construct the drift circle from the drift radius and tube location /// @@ -52,11 +50,11 @@ class DriftCircle { m_tubeLayer(tubeLayer), m_tube(tube) {} - constexpr Scalar x() const { return m_x; } - constexpr Scalar y() const { return m_y; } - constexpr Scalar z() const { return m_z; } - constexpr Scalar rDrift() const { return m_rho; } - constexpr Scalar rDriftError() const { return m_sigmaRho; } + constexpr double x() const { return m_x; } + constexpr double y() const { return m_y; } + constexpr double z() const { return m_z; } + constexpr double rDrift() const { return m_rho; } + constexpr double rDriftError() const { return m_sigmaRho; } constexpr int stationName() const { return m_stationName; } constexpr int stationEta() const { return m_stationEta; } constexpr int stationPhi() const { return m_stationPhi; } @@ -66,11 +64,11 @@ class DriftCircle { private: // Global position - Scalar m_x = 0.0f; - Scalar m_y = 0.0f; - Scalar m_z = 0.0f; - Scalar m_rho = 0.0f; - Scalar m_sigmaRho = 0.0f; + double m_x = 0.; + double m_y = 0.; + double m_z = 0.; + double m_rho = 0.; + double m_sigmaRho = 0.; int m_stationName = 0; int m_stationEta = 0; int m_stationPhi = 0; diff --git a/Examples/Framework/include/ActsExamples/EventData/SimParticle.hpp b/Examples/Framework/include/ActsExamples/EventData/SimParticle.hpp index cfcf8a5e25e..2bf9dcc8cbc 100644 --- a/Examples/Framework/include/ActsExamples/EventData/SimParticle.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/SimParticle.hpp @@ -23,10 +23,6 @@ using SimParticleState = ::ActsFatras::Particle; class SimParticle final { public: - using Scalar = Acts::ActsScalar; - using Vector3 = Acts::ActsVector<3>; - using Vector4 = Acts::ActsVector<4>; - /// Construct a default particle with invalid identity. SimParticle() = default; @@ -39,8 +35,8 @@ class SimParticle final { /// /// @warning It is the users responsibility that charge and mass match /// the PDG particle number. - SimParticle(SimBarcode particleId, Acts::PdgParticle pdg, Scalar charge, - Scalar mass) + SimParticle(SimBarcode particleId, Acts::PdgParticle pdg, double charge, + double mass) : m_initial(particleId, pdg, charge, mass), m_final(particleId, pdg, charge, mass) {} @@ -89,13 +85,13 @@ class SimParticle final { return *this; } /// Set the charge. - SimParticle& setCharge(Scalar charge) { + SimParticle& setCharge(double charge) { initial().setCharge(charge); final().setCharge(charge); return *this; } /// Set the mass. - SimParticle& setMass(Scalar mass) { + SimParticle& setMass(double mass) { initial().setMass(mass); final().setMass(mass); return *this; diff --git a/Examples/Framework/include/ActsExamples/EventData/SimSpacePoint.hpp b/Examples/Framework/include/ActsExamples/EventData/SimSpacePoint.hpp index 0359913199f..bf5780c5a76 100644 --- a/Examples/Framework/include/ActsExamples/EventData/SimSpacePoint.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/SimSpacePoint.hpp @@ -23,8 +23,6 @@ namespace ActsExamples { /// Space point representation of a measurement suitable for track seeding. class SimSpacePoint { - using Scalar = Acts::ActsScalar; - public: /// Construct the space point from global position and selected variances. /// @@ -44,10 +42,10 @@ class SimSpacePoint { /// @param validDoubleMeasurementDetails boolean to check if double measurements are valid template SimSpacePoint( - const Eigen::MatrixBase& pos, std::optional t, - Scalar varRho, Scalar varZ, std::optional varT, + const Eigen::MatrixBase& pos, std::optional t, + double varRho, double varZ, std::optional varT, boost::container::static_vector sourceLinks, - Scalar topHalfStripLength, Scalar bottomHalfStripLength, + double topHalfStripLength, double bottomHalfStripLength, const Acts::Vector3& topStripDirection, const Acts::Vector3& bottomStripDirection, const Acts::Vector3& stripCenterDistance, @@ -82,8 +80,8 @@ class SimSpacePoint { /// @param sourceLinks sourceLinks of the measurements template SimSpacePoint( - const Eigen::MatrixBase& pos, std::optional t, - Scalar varRho, Scalar varZ, std::optional varT, + const Eigen::MatrixBase& pos, std::optional t, + double varRho, double varZ, std::optional varT, boost::container::static_vector sourceLinks) : m_x(pos[Acts::ePos0]), m_y(pos[Acts::ePos1]), @@ -97,14 +95,14 @@ class SimSpacePoint { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(position_t, 3); } - constexpr Scalar x() const { return m_x; } - constexpr Scalar y() const { return m_y; } - constexpr Scalar z() const { return m_z; } - constexpr std::optional t() const { return m_t; } - constexpr Scalar r() const { return m_rho; } - constexpr Scalar varianceR() const { return m_varianceRho; } - constexpr Scalar varianceZ() const { return m_varianceZ; } - constexpr std::optional varianceT() const { return m_varianceT; } + constexpr double x() const { return m_x; } + constexpr double y() const { return m_y; } + constexpr double z() const { return m_z; } + constexpr std::optional t() const { return m_t; } + constexpr double r() const { return m_rho; } + constexpr double varianceR() const { return m_varianceRho; } + constexpr double varianceZ() const { return m_varianceZ; } + constexpr std::optional varianceT() const { return m_varianceT; } const boost::container::static_vector& sourceLinks() const { @@ -127,15 +125,15 @@ class SimSpacePoint { private: // Global position - Scalar m_x; - Scalar m_y; - Scalar m_z; - std::optional m_t; - Scalar m_rho; + double m_x; + double m_y; + double m_z; + std::optional m_t; + double m_rho; // Variance in rho/z of the global coordinates - Scalar m_varianceRho; - Scalar m_varianceZ; - std::optional m_varianceT; + double m_varianceRho; + double m_varianceZ; + std::optional m_varianceT; // SourceLinks of the corresponding measurements. A Pixel (strip) SP has one // (two) sourceLink(s). boost::container::static_vector m_sourceLinks; diff --git a/Examples/Framework/include/ActsExamples/EventData/SimVertex.hpp b/Examples/Framework/include/ActsExamples/EventData/SimVertex.hpp index 0bdfbb4925c..db906790e8b 100644 --- a/Examples/Framework/include/ActsExamples/EventData/SimVertex.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/SimVertex.hpp @@ -77,13 +77,10 @@ class SimVertexBarcode { /// A simulated vertex e.g. from a physics process. struct SimVertex { - using Scalar = Acts::ActsScalar; - using Vector4 = Acts::ActsVector<4>; - /// The vertex ID SimVertexBarcode id; /// The vertex four-position - Vector4 position4 = Vector4::Zero(); + Acts::Vector4 position4 = Acts::Vector4::Zero(); /// The vertex process type ActsFatras::ProcessType process = ActsFatras::ProcessType::eUndefined; /// The incoming particles into the vertex @@ -99,7 +96,7 @@ struct SimVertex { /// Associated particles are left empty by default and must be filled by the /// user after construction. SimVertex( - SimVertexBarcode id_, const Vector4& position4_, + SimVertexBarcode id_, const Acts::Vector4& position4_, ActsFatras::ProcessType process_ = ActsFatras::ProcessType::eUndefined) : id(id_), position4(position4_), process(process_) {} // explicitly default rule-of-five. @@ -113,7 +110,7 @@ struct SimVertex { /// The vertex three-position. auto position() const { return position4.head<3>(); } /// The vertex time. - Scalar time() const { return position4[3]; } + double time() const { return position4[3]; } }; namespace detail { diff --git a/Examples/Io/Csv/src/CsvDriftCircleReader.cpp b/Examples/Io/Csv/src/CsvDriftCircleReader.cpp index ce179d9d5be..ad2500637ed 100644 --- a/Examples/Io/Csv/src/CsvDriftCircleReader.cpp +++ b/Examples/Io/Csv/src/CsvDriftCircleReader.cpp @@ -61,10 +61,9 @@ ActsExamples::ProcessCode ActsExamples::CsvDriftCircleReader::read( MuonDriftCircleData data; while (reader.read(data)) { - ActsFatras::Hit::Vector3 tube_pos{ - data.tubePositionx * Acts::UnitConstants::mm, - data.tubePositiony * Acts::UnitConstants::mm, - data.tubePositionz * Acts::UnitConstants::mm}; + Acts::Vector3 tube_pos{data.tubePositionx * Acts::UnitConstants::mm, + data.tubePositiony * Acts::UnitConstants::mm, + data.tubePositionz * Acts::UnitConstants::mm}; DriftCircles.push_back(DriftCircle(std::move(tube_pos), data.driftRadius, 0.0f, data.stationName, data.stationEta, diff --git a/Examples/Io/Csv/src/CsvMuonSimHitReader.cpp b/Examples/Io/Csv/src/CsvMuonSimHitReader.cpp index 58240dcecce..28836dc48de 100644 --- a/Examples/Io/Csv/src/CsvMuonSimHitReader.cpp +++ b/Examples/Io/Csv/src/CsvMuonSimHitReader.cpp @@ -61,18 +61,16 @@ ActsExamples::ProcessCode ActsExamples::CsvMuonSimHitReader::read( SimHitContainer::sequence_type unordered; while (reader.read(data)) { - ActsFatras::Hit::Vector4 pos{ - data.LocalPositionExtrx * Acts::UnitConstants::mm, - data.LocalPositionExtry * Acts::UnitConstants::mm, - data.LocalPositionExtrz * Acts::UnitConstants::mm, 0}; - ActsFatras::Hit::Vector4 mom{ - data.LocalDirectionx * Acts::UnitConstants::GeV, - data.LocalDirectiony * Acts::UnitConstants::GeV, - data.LocalDirectionz * Acts::UnitConstants::GeV, - std::sqrt(data.LocalDirectionx * data.LocalDirectionx + - data.LocalDirectiony * data.LocalDirectiony + - data.LocalDirectionz * data.LocalDirectionz) * - Acts::UnitConstants::GeV}; + Acts::Vector4 pos{data.LocalPositionExtrx * Acts::UnitConstants::mm, + data.LocalPositionExtry * Acts::UnitConstants::mm, + data.LocalPositionExtrz * Acts::UnitConstants::mm, 0}; + Acts::Vector4 mom{data.LocalDirectionx * Acts::UnitConstants::GeV, + data.LocalDirectiony * Acts::UnitConstants::GeV, + data.LocalDirectionz * Acts::UnitConstants::GeV, + std::sqrt(data.LocalDirectionx * data.LocalDirectionx + + data.LocalDirectiony * data.LocalDirectiony + + data.LocalDirectionz * data.LocalDirectionz) * + Acts::UnitConstants::GeV}; MuonMdtIdentifierFields f; f.multilayer = 0; f.tube = 0; diff --git a/Examples/Io/Csv/src/CsvSimHitReader.cpp b/Examples/Io/Csv/src/CsvSimHitReader.cpp index 949b6d4ce5c..ca77c7e0aa4 100644 --- a/Examples/Io/Csv/src/CsvSimHitReader.cpp +++ b/Examples/Io/Csv/src/CsvSimHitReader.cpp @@ -66,19 +66,19 @@ ActsExamples::ProcessCode ActsExamples::CsvSimHitReader::read( // TODO validate geo id consistency const auto particleId = ActsFatras::Barcode(data.particle_id); - ActsFatras::Hit::Vector4 pos4{ + Acts::Vector4 pos4{ data.tx * Acts::UnitConstants::mm, data.ty * Acts::UnitConstants::mm, data.tz * Acts::UnitConstants::mm, data.tt * Acts::UnitConstants::mm, }; - ActsFatras::Hit::Vector4 mom4{ + Acts::Vector4 mom4{ data.tpx * Acts::UnitConstants::GeV, data.tpy * Acts::UnitConstants::GeV, data.tpz * Acts::UnitConstants::GeV, data.te * Acts::UnitConstants::GeV, }; - ActsFatras::Hit::Vector4 delta4{ + Acts::Vector4 delta4{ data.deltapx * Acts::UnitConstants::GeV, data.deltapy * Acts::UnitConstants::GeV, data.deltapz * Acts::UnitConstants::GeV, diff --git a/Fatras/Geant4/include/ActsFatras/Geant4/Geant4Decay.hpp b/Fatras/Geant4/include/ActsFatras/Geant4/Geant4Decay.hpp index 177e3ac6221..758df351071 100644 --- a/Fatras/Geant4/include/ActsFatras/Geant4/Geant4Decay.hpp +++ b/Fatras/Geant4/include/ActsFatras/Geant4/Geant4Decay.hpp @@ -27,8 +27,6 @@ namespace ActsFatras { /// Handle particle decays using the Geant4 decay models. class Geant4Decay { public: - using Scalar = Particle::Scalar; - /// Constructor Geant4Decay(); @@ -40,7 +38,7 @@ class Geant4Decay { /// /// @return Proper time limit of the particle template - Scalar generateProperTimeLimit(generator_t& generator, + double generateProperTimeLimit(generator_t& generator, const Particle& particle) const; /// Decay the particle and create the decay products. @@ -67,13 +65,13 @@ class Geant4Decay { }; template -Particle::Scalar Geant4Decay::generateProperTimeLimit( - generator_t& generator, const Particle& particle) const { +double Geant4Decay::generateProperTimeLimit(generator_t& generator, + const Particle& particle) const { // Get the particle properties const Acts::PdgParticle pdgCode = particle.pdg(); // Keep muons stable if (makeAbsolutePdgParticle(pdgCode) == Acts::PdgParticle::eMuon) { - return std::numeric_limits::infinity(); + return std::numeric_limits::infinity(); } // Get the Geant4 particle @@ -81,14 +79,14 @@ Particle::Scalar Geant4Decay::generateProperTimeLimit( // Fast exit if the particle is stable if (!pDef || pDef->GetPDGStable()) { - return std::numeric_limits::infinity(); + return std::numeric_limits::infinity(); } // Get average lifetime - constexpr Scalar convertTime = Acts::UnitConstants::mm / CLHEP::s; - const Scalar tau = pDef->GetPDGLifeTime() * convertTime; + constexpr double convertTime = Acts::UnitConstants::mm / CLHEP::s; + const double tau = pDef->GetPDGLifeTime() * convertTime; // Sample & return the lifetime - std::uniform_real_distribution uniformDistribution{0., 1.}; + std::uniform_real_distribution uniformDistribution{0., 1.}; return -tau * std::log(uniformDistribution(generator)); } diff --git a/Fatras/Geant4/src/Geant4Decay.cpp b/Fatras/Geant4/src/Geant4Decay.cpp index 41b5a3656b1..bf23566aa05 100644 --- a/Fatras/Geant4/src/Geant4Decay.cpp +++ b/Fatras/Geant4/src/Geant4Decay.cpp @@ -50,7 +50,7 @@ std::vector ActsFatras::Geant4Decay::decayParticle( } // Boost the decay products using the parents four-momentum - const Particle::Vector4 mom4 = parent.fourMomentum(); + const Acts::Vector4 mom4 = parent.fourMomentum(); products->Boost(mom4[Acts::eMom0] / mom4[Acts::eEnergy], mom4[Acts::eMom1] / mom4[Acts::eEnergy], mom4[Acts::eMom2] / mom4[Acts::eEnergy]); @@ -64,7 +64,7 @@ std::vector ActsFatras::Geant4Decay::decayParticle( // Convert the decay product from Geant4 to Acts const G4ThreeVector& mom = prod->GetMomentum(); - constexpr Scalar convertEnergy = Acts::UnitConstants::GeV / CLHEP::GeV; + constexpr double convertEnergy = Acts::UnitConstants::GeV / CLHEP::GeV; Acts::Vector3 amgMom(mom.x(), mom.y(), mom.z()); amgMom *= convertEnergy; const std::int32_t pdg = prod->GetPDGcode(); diff --git a/Fatras/include/ActsFatras/Digitization/DigitizationData.hpp b/Fatras/include/ActsFatras/Digitization/DigitizationData.hpp index 314cbcc5eb1..f2e808e00cb 100644 --- a/Fatras/include/ActsFatras/Digitization/DigitizationData.hpp +++ b/Fatras/include/ActsFatras/Digitization/DigitizationData.hpp @@ -17,7 +17,7 @@ namespace ActsFatras { /// A single cell definition: index, cell central value -using Cell = std::pair; +using Cell = std::pair; /// A channel definition: Cell identification, readout word, links /// @@ -35,7 +35,7 @@ struct Channel { /// Channel constructor /// - /// @param cellId_ The Cell idenficiation and position + /// @param cellId_ The Cell identification and position /// @param value_ The Cell value /// @param links_ The (optional) links to e.g. truth indices Channel(std::array cellId_, signal_t value_, @@ -51,7 +51,6 @@ struct Channel { /// @tparam kSize Number of cluster coordinates template struct Cluster { - using Scalar = Acts::ActsScalar; using ParametersVector = Acts::ActsVector; using CovarianceMatrix = Acts::ActsSquareMatrix; diff --git a/Fatras/include/ActsFatras/Digitization/UncorrelatedHitSmearer.hpp b/Fatras/include/ActsFatras/Digitization/UncorrelatedHitSmearer.hpp index 4420c8a6200..caf5efa8c61 100644 --- a/Fatras/include/ActsFatras/Digitization/UncorrelatedHitSmearer.hpp +++ b/Fatras/include/ActsFatras/Digitization/UncorrelatedHitSmearer.hpp @@ -41,7 +41,6 @@ using SingleParameterSmearFunction = /// vector and associated covariance matrix. template struct BoundParametersSmearer { - using Scalar = Acts::ActsScalar; using ParametersVector = Acts::ActsVector; using CovarianceMatrix = Acts::ActsSquareMatrix; using Result = Acts::Result>; @@ -116,7 +115,6 @@ struct BoundParametersSmearer { /// individually is not recommended template struct FreeParametersSmearer { - using Scalar = Acts::ActsScalar; using ParametersVector = Acts::ActsVector; using CovarianceMatrix = Acts::ActsSquareMatrix; using Result = Acts::Result>; diff --git a/Fatras/include/ActsFatras/EventData/Hit.hpp b/Fatras/include/ActsFatras/EventData/Hit.hpp index d5eb25662f8..b3838299ca6 100644 --- a/Fatras/include/ActsFatras/EventData/Hit.hpp +++ b/Fatras/include/ActsFatras/EventData/Hit.hpp @@ -26,10 +26,6 @@ namespace ActsFatras { /// thus stored as two separate four-vectors. class Hit { public: - using Scalar = Acts::ActsScalar; - using Vector3 = Acts::ActsVector<3>; - using Vector4 = Acts::ActsVector<4>; - /// Construct default hit with (mostly) invalid information. Hit() = default; /// Construct from four-position and four-momenta. @@ -45,8 +41,8 @@ class Hit { /// users responsibility to ensure that the position correspond to a /// position on the given surface. Hit(Acts::GeometryIdentifier geometryId, Barcode particleId, - const Vector4& pos4, const Vector4& before4, const Vector4& after4, - std::int32_t index_ = -1) + const Acts::Vector4& pos4, const Acts::Vector4& before4, + const Acts::Vector4& after4, std::int32_t index_ = -1) : m_geometryId(geometryId), m_particleId(particleId), m_index(index_), @@ -68,26 +64,26 @@ class Hit { constexpr std::int32_t index() const { return m_index; } /// Space-time position four-vector. - const Vector4& fourPosition() const { return m_pos4; } + const Acts::Vector4& fourPosition() const { return m_pos4; } /// Three-position, i.e. spatial coordinates without the time. auto position() const { return m_pos4.segment<3>(Acts::ePos0); } /// Time coordinate. - Scalar time() const { return m_pos4[Acts::eTime]; } + double time() const { return m_pos4[Acts::eTime]; } /// Particle four-momentum before the hit. - const Vector4& momentum4Before() const { return m_before4; } + const Acts::Vector4& momentum4Before() const { return m_before4; } /// Particle four-momentum after the hit. - const Vector4& momentum4After() const { return m_after4; } + const Acts::Vector4& momentum4After() const { return m_after4; } /// Normalized particle direction vector before the hit. - Vector3 directionBefore() const { + Acts::Vector3 directionBefore() const { return m_before4.segment<3>(Acts::eMom0).normalized(); } /// Normalized particle direction vector the hit. - Vector3 directionAfter() const { + Acts::Vector3 directionAfter() const { return m_after4.segment<3>(Acts::eMom0).normalized(); } /// Average normalized particle direction vector through the surface. - Vector3 direction() const { + Acts::Vector3 direction() const { auto dir0 = m_before4.segment<3>(Acts::eMom0).normalized(); auto dir1 = m_after4.segment<3>(Acts::eMom0).normalized(); return ((dir0 + dir1) / 2.).segment<3>(Acts::eMom0).normalized(); @@ -96,7 +92,7 @@ class Hit { /// /// @retval positive if the particle lost energy when it passed the surface /// @retval negative if magic was involved - Scalar depositedEnergy() const { + double depositedEnergy() const { return m_before4[Acts::eEnergy] - m_after4[Acts::eEnergy]; } @@ -108,11 +104,11 @@ class Hit { /// Index of the hit along the particle trajectory. std::int32_t m_index = -1; /// Global space-time position four-vector. - Vector4 m_pos4 = Vector4::Zero(); + Acts::Vector4 m_pos4 = Acts::Vector4::Zero(); /// Global particle energy-momentum four-vector before the hit. - Vector4 m_before4 = Vector4::Zero(); + Acts::Vector4 m_before4 = Acts::Vector4::Zero(); /// Global particle energy-momentum four-vector after the hit. - Vector4 m_after4 = Vector4::Zero(); + Acts::Vector4 m_after4 = Acts::Vector4::Zero(); }; } // namespace ActsFatras diff --git a/Fatras/include/ActsFatras/EventData/Particle.hpp b/Fatras/include/ActsFatras/EventData/Particle.hpp index 5b6eb2f7a61..fbf9244fcea 100644 --- a/Fatras/include/ActsFatras/EventData/Particle.hpp +++ b/Fatras/include/ActsFatras/EventData/Particle.hpp @@ -32,10 +32,6 @@ namespace ActsFatras { /// Also stores some simulation-specific properties. class Particle { public: - using Scalar = Acts::ActsScalar; - using Vector3 = Acts::ActsVector<3>; - using Vector4 = Acts::ActsVector<4>; - /// Construct a default particle with invalid identity. Particle() = default; /// Construct a particle at rest with explicit mass and charge. @@ -47,8 +43,8 @@ class Particle { /// /// @warning It is the users responsibility that charge and mass match /// the PDG particle number. - Particle(Barcode particleId, Acts::PdgParticle pdg, Scalar charge, - Scalar mass) + Particle(Barcode particleId, Acts::PdgParticle pdg, double charge, + double mass) : m_particleId(particleId), m_pdg(pdg), m_charge(charge), m_mass(mass) {} /// Construct a particle at rest from a PDG particle number. /// @@ -84,12 +80,12 @@ class Particle { return *this; } /// Set the charge. - Particle setCharge(Scalar charge) { + Particle setCharge(double charge) { m_charge = charge; return *this; } /// Set the mass. - Particle setMass(Scalar mass) { + Particle setMass(double mass) { m_mass = mass; return *this; } @@ -99,18 +95,18 @@ class Particle { return *this; } /// Set the space-time position four-vector. - Particle &setPosition4(const Vector4 &pos4) { + Particle &setPosition4(const Acts::Vector4 &pos4) { m_position4 = pos4; return *this; } /// Set the space-time position four-vector from three-position and time. - Particle &setPosition4(const Vector3 &position, Scalar time) { + Particle &setPosition4(const Acts::Vector3 &position, double time) { m_position4.segment<3>(Acts::ePos0) = position; m_position4[Acts::eTime] = time; return *this; } /// Set the space-time position four-vector from scalar components. - Particle &setPosition4(Scalar x, Scalar y, Scalar z, Scalar time) { + Particle &setPosition4(double x, double y, double z, double time) { m_position4[Acts::ePos0] = x; m_position4[Acts::ePos1] = y; m_position4[Acts::ePos2] = z; @@ -118,13 +114,13 @@ class Particle { return *this; } /// Set the direction three-vector - Particle &setDirection(const Vector3 &direction) { + Particle &setDirection(const Acts::Vector3 &direction) { m_direction = direction; m_direction.normalize(); return *this; } /// Set the direction three-vector from scalar components. - Particle &setDirection(Scalar dx, Scalar dy, Scalar dz) { + Particle &setDirection(double dx, double dy, double dz) { m_direction[Acts::ePos0] = dx; m_direction[Acts::ePos1] = dy; m_direction[Acts::ePos2] = dz; @@ -132,7 +128,7 @@ class Particle { return *this; } /// Set the absolute momentum. - Particle &setAbsoluteMomentum(Scalar absMomentum) { + Particle &setAbsoluteMomentum(double absMomentum) { m_absMomentum = absMomentum; return *this; } @@ -142,10 +138,10 @@ class Particle { /// Energy loss corresponds to a negative change. If the updated energy /// would result in an unphysical value, the particle is put to rest, i.e. /// its absolute momentum is set to zero. - Particle &correctEnergy(Scalar delta) { + Particle &correctEnergy(double delta) { const auto newEnergy = std::hypot(m_mass, m_absMomentum) + delta; if (newEnergy <= m_mass) { - m_absMomentum = Scalar{0}; + m_absMomentum = 0.; } else { m_absMomentum = std::sqrt(newEnergy * newEnergy - m_mass * m_mass); } @@ -163,30 +159,30 @@ class Particle { return Acts::makeAbsolutePdgParticle(pdg()); } /// Particle charge. - Scalar charge() const { return m_charge; } + double charge() const { return m_charge; } /// Particle absolute charge. - Scalar absoluteCharge() const { return std::abs(m_charge); } + double absoluteCharge() const { return std::abs(m_charge); } /// Particle mass. - Scalar mass() const { return m_mass; } + double mass() const { return m_mass; } /// Particle hypothesis. Acts::ParticleHypothesis hypothesis() const { return Acts::ParticleHypothesis(absolutePdg(), mass(), absoluteCharge()); } /// Particl qOverP. - Scalar qOverP() const { + double qOverP() const { return hypothesis().qOverP(absoluteMomentum(), charge()); } /// Space-time position four-vector. - const Vector4 &fourPosition() const { return m_position4; } + const Acts::Vector4 &fourPosition() const { return m_position4; } /// Three-position, i.e. spatial coordinates without the time. auto position() const { return m_position4.segment<3>(Acts::ePos0); } /// Time coordinate. - Scalar time() const { return m_position4[Acts::eTime]; } + double time() const { return m_position4[Acts::eTime]; } /// Energy-momentum four-vector. - Vector4 fourMomentum() const { - Vector4 mom4; + Acts::Vector4 fourMomentum() const { + Acts::Vector4 mom4; // stored direction is always normalized mom4[Acts::eMom0] = m_absMomentum * m_direction[Acts::ePos0]; mom4[Acts::eMom1] = m_absMomentum * m_direction[Acts::ePos1]; @@ -195,24 +191,24 @@ class Particle { return mom4; } /// Unit three-direction, i.e. the normalized momentum three-vector. - const Vector3 &direction() const { return m_direction; } + const Acts::Vector3 &direction() const { return m_direction; } /// Polar angle. - Scalar theta() const { return Acts::VectorHelpers::theta(direction()); } + double theta() const { return Acts::VectorHelpers::theta(direction()); } /// Azimuthal angle. - Scalar phi() const { return Acts::VectorHelpers::phi(direction()); } + double phi() const { return Acts::VectorHelpers::phi(direction()); } /// Absolute momentum in the x-y plane. - Scalar transverseMomentum() const { + double transverseMomentum() const { return m_absMomentum * m_direction.segment<2>(Acts::eMom0).norm(); } /// Absolute momentum. - Scalar absoluteMomentum() const { return m_absMomentum; } + double absoluteMomentum() const { return m_absMomentum; } /// Absolute momentum. - Vector3 momentum() const { return absoluteMomentum() * direction(); } + Acts::Vector3 momentum() const { return absoluteMomentum() * direction(); } /// Total energy, i.e. norm of the four-momentum. - Scalar energy() const { return std::hypot(m_mass, m_absMomentum); } + double energy() const { return std::hypot(m_mass, m_absMomentum); } /// Check if the particle is alive, i.e. is not at rest. - bool isAlive() const { return Scalar{0} < m_absMomentum; } + bool isAlive() const { return 0. < m_absMomentum; } /// Check if this is a secondary particle. bool isSecondary() const { @@ -225,26 +221,26 @@ class Particle { /// Set the proper time in the particle rest frame. /// /// @param properTime passed proper time in the rest frame - Particle &setProperTime(Scalar properTime) { + Particle &setProperTime(double properTime) { m_properTime = properTime; return *this; } /// Proper time in the particle rest frame. - Scalar properTime() const { return m_properTime; } + double properTime() const { return m_properTime; } /// Set the accumulated material measured in radiation/interaction lengths. /// /// @param pathInX0 accumulated material measured in radiation lengths /// @param pathInL0 accumulated material measured in interaction lengths - Particle &setMaterialPassed(Scalar pathInX0, Scalar pathInL0) { + Particle &setMaterialPassed(double pathInX0, double pathInL0) { m_pathInX0 = pathInX0; m_pathInL0 = pathInL0; return *this; } /// Accumulated path within material measured in radiation lengths. - Scalar pathInX0() const { return m_pathInX0; } + double pathInX0() const { return m_pathInX0; } /// Accumulated path within material measured in interaction lengths. - Scalar pathInL0() const { return m_pathInL0; } + double pathInL0() const { return m_pathInL0; } /// Set the reference surface. /// @@ -314,17 +310,17 @@ class Particle { /// PDG particle number. Acts::PdgParticle m_pdg = Acts::PdgParticle::eInvalid; // Particle charge and mass. - Scalar m_charge = Scalar{0}; - Scalar m_mass = Scalar{0}; + double m_charge = 0.; + double m_mass = 0.; // kinematics, i.e. things that change over the particle lifetime. - Vector3 m_direction = Vector3::UnitZ(); - Scalar m_absMomentum = Scalar{0}; - Vector4 m_position4 = Vector4::Zero(); + Acts::Vector3 m_direction = Acts::Vector3::UnitZ(); + double m_absMomentum = 0.; + Acts::Vector4 m_position4 = Acts::Vector4::Zero(); /// proper time in the particle rest frame - Scalar m_properTime = Scalar{0}; + double m_properTime = 0.; // accumulated material - Scalar m_pathInX0 = Scalar{0}; - Scalar m_pathInL0 = Scalar{0}; + double m_pathInX0 = 0.; + double m_pathInL0 = 0.; /// number of hits std::uint32_t m_numberOfHits = 0; /// reference surface diff --git a/Fatras/include/ActsFatras/Kernel/InteractionList.hpp b/Fatras/include/ActsFatras/Kernel/InteractionList.hpp index eb6816c490a..b8faaf7f0ad 100644 --- a/Fatras/include/ActsFatras/Kernel/InteractionList.hpp +++ b/Fatras/include/ActsFatras/Kernel/InteractionList.hpp @@ -83,9 +83,7 @@ template concept PointLikeProcessConcept = requires( const process_t& p, std::uniform_int_distribution& rng, const Particle& prt) { - { - p.generatePathLimits(rng, prt) - } -> std::same_as>; + { p.generatePathLimits(rng, prt) } -> std::same_as>; }; template @@ -177,10 +175,8 @@ class InteractionList { public: /// Point-like interaction selection. struct Selection { - Particle::Scalar x0Limit = - std::numeric_limits::infinity(); - Particle::Scalar l0Limit = - std::numeric_limits::infinity(); + double x0Limit = std::numeric_limits::infinity(); + double l0Limit = std::numeric_limits::infinity(); std::size_t x0Process = std::numeric_limits::max(); std::size_t l0Process = std::numeric_limits::max(); }; diff --git a/Fatras/include/ActsFatras/Kernel/Simulation.hpp b/Fatras/include/ActsFatras/Kernel/Simulation.hpp index b6975c34172..07c03bb5d40 100644 --- a/Fatras/include/ActsFatras/Kernel/Simulation.hpp +++ b/Fatras/include/ActsFatras/Kernel/Simulation.hpp @@ -224,7 +224,7 @@ struct Simulation { // only need to switch between charged/neutral. SingleParticleSimulationResult result = SingleParticleSimulationResult::success({}); - if (initialParticle.charge() != Particle::Scalar{0}) { + if (initialParticle.charge() != 0.) { result = charged.simulate(geoCtx, magCtx, generator, initialParticle); } else { result = neutral.simulate(geoCtx, magCtx, generator, initialParticle); @@ -267,7 +267,7 @@ struct Simulation { private: /// Select if the particle should be simulated at all. bool selectParticle(const Particle &particle) const { - if (particle.charge() != Particle::Scalar{0}) { + if (particle.charge() != 0.) { return selectCharged(particle); } else { return selectNeutral(particle); diff --git a/Fatras/include/ActsFatras/Kernel/SimulationResult.hpp b/Fatras/include/ActsFatras/Kernel/SimulationResult.hpp index 2750e01b616..fa6cf211673 100644 --- a/Fatras/include/ActsFatras/Kernel/SimulationResult.hpp +++ b/Fatras/include/ActsFatras/Kernel/SimulationResult.hpp @@ -38,11 +38,10 @@ struct SimulationResult { // Whether the particle is still alive and the simulation should continue bool isAlive = true; // Proper time limit before decay. - Particle::Scalar properTimeLimit = - std::numeric_limits::quiet_NaN(); + double properTimeLimit = std::numeric_limits::quiet_NaN(); // Accumulated radiation/interaction length limit before next interaction. - Particle::Scalar x0Limit = std::numeric_limits::quiet_NaN(); - Particle::Scalar l0Limit = std::numeric_limits::quiet_NaN(); + double x0Limit = std::numeric_limits::quiet_NaN(); + double l0Limit = std::numeric_limits::quiet_NaN(); // Process selection for the next interaction. std::size_t x0Process = std::numeric_limits::max(); std::size_t l0Process = std::numeric_limits::max(); diff --git a/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp b/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp index acbaaaa713d..bee570485b0 100644 --- a/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp +++ b/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp @@ -53,7 +53,7 @@ struct SimulationActor { Particle initialParticle; /// Relative tolerance of the particles proper time limit - Particle::Scalar properTimeRelativeTolerance = 1e-3; + double properTimeRelativeTolerance = 1e-3; /// Simulate the interaction with a single surface. /// @@ -180,7 +180,7 @@ struct SimulationActor { result.hits.emplace_back( surface.geometryId(), before.particleId(), // the interaction could potentially modify the particle position - Hit::Scalar{0.5} * (before.fourPosition() + after.fourPosition()), + 0.5 * (before.fourPosition() + after.fourPosition()), before.fourMomentum(), after.fourMomentum(), result.hits.size()); after.setNumberOfHits(result.hits.size()); diff --git a/Fatras/include/ActsFatras/Physics/Decay/NoDecay.hpp b/Fatras/include/ActsFatras/Physics/Decay/NoDecay.hpp index 17aefd7341b..11889f3af06 100644 --- a/Fatras/include/ActsFatras/Physics/Decay/NoDecay.hpp +++ b/Fatras/include/ActsFatras/Physics/Decay/NoDecay.hpp @@ -21,9 +21,9 @@ struct NoDecay { /// /// @returns Always returns infinity as limit. template - constexpr Particle::Scalar generateProperTimeLimit( + constexpr double generateProperTimeLimit( generator_t& /* rng */, const Particle& /* particle */) const { - return std::numeric_limits::infinity(); + return std::numeric_limits::infinity(); } /// Decay the particle without generating any descendant particles. template diff --git a/Fatras/include/ActsFatras/Physics/ElectroMagnetic/BetheHeitler.hpp b/Fatras/include/ActsFatras/Physics/ElectroMagnetic/BetheHeitler.hpp index d0529837b7f..6cfbce087c9 100644 --- a/Fatras/include/ActsFatras/Physics/ElectroMagnetic/BetheHeitler.hpp +++ b/Fatras/include/ActsFatras/Physics/ElectroMagnetic/BetheHeitler.hpp @@ -25,9 +25,6 @@ namespace ActsFatras { /// "A Gaussian-mixture approximation of the Bethe–Heitler model of electron /// energy loss by bremsstrahlung" R. Frühwirth struct BetheHeitler { - using Scalar = Particle::Scalar; - using Vector3 = Particle::Vector3; - /// A scaling factor to double scaleFactor = 1.; @@ -42,9 +39,9 @@ struct BetheHeitler { /// @param [in] rndTheta1 Random number for the polar angle /// @param [in] rndTheta2 Random number for the polar angle /// @param [in] rndTheta3 Random number for the polar angle - Particle bremPhoton(const Particle &particle, Scalar gammaE, Scalar rndPsi, - Scalar rndTheta1, Scalar rndTheta2, - Scalar rndTheta3) const; + Particle bremPhoton(const Particle &particle, double gammaE, double rndPsi, + double rndTheta1, double rndTheta2, + double rndTheta3) const; /// Simulate energy loss and update the particle parameters. /// @@ -67,7 +64,7 @@ struct BetheHeitler { const auto sampledEnergyLoss = std::abs(scaleFactor * particle.energy() * (z - 1.)); - std::uniform_real_distribution uDist(0., 1.); + std::uniform_real_distribution uDist(0., 1.); // Build the produced photon Particle photon = bremPhoton(particle, sampledEnergyLoss, uDist(generator), diff --git a/Fatras/include/ActsFatras/Physics/ElectroMagnetic/PhotonConversion.hpp b/Fatras/include/ActsFatras/Physics/ElectroMagnetic/PhotonConversion.hpp index d54b17e7407..af45481258e 100644 --- a/Fatras/include/ActsFatras/Physics/ElectroMagnetic/PhotonConversion.hpp +++ b/Fatras/include/ActsFatras/Physics/ElectroMagnetic/PhotonConversion.hpp @@ -34,12 +34,10 @@ namespace ActsFatras { /// interaction itself. class PhotonConversion { public: - using Scalar = ActsFatras::Particle::Scalar; - /// Scaling factor of children energy - Scalar childEnergyScaleFactor = 2.; + double childEnergyScaleFactor = 2.; /// Scaling factor for photon conversion probability - Scalar conversionProbScaleFactor = 0.98; + double conversionProbScaleFactor = 0.98; /// Method for evaluating the distance after which the photon /// conversion will occur. @@ -50,7 +48,7 @@ class PhotonConversion { /// /// @return valid X0 limit and no limit on L0 template - std::pair generatePathLimits(generator_t& generator, + std::pair generatePathLimits(generator_t& generator, const Particle& particle) const; /// This method evaluates the final state due to the photon conversion. @@ -74,8 +72,8 @@ class PhotonConversion { /// /// @return Array containing the produced leptons std::array generateChildren( - const Particle& photon, Scalar childEnergy, - const Particle::Vector3& childDirection) const; + const Particle& photon, double childEnergy, + const Acts::Vector3& childDirection) const; /// Generate the energy fraction of the first child particle. /// @@ -85,8 +83,8 @@ class PhotonConversion { /// /// @return The energy of the child particle template - Scalar generateFirstChildEnergyFraction(generator_t& generator, - Scalar gammaMom) const; + double generateFirstChildEnergyFraction(generator_t& generator, + double gammaMom) const; /// Generate the direction of the child particles. /// @@ -96,27 +94,27 @@ class PhotonConversion { /// /// @return The direction vector of the child particle template - Particle::Vector3 generateChildDirection(generator_t& generator, - const Particle& particle) const; + Acts::Vector3 generateChildDirection(generator_t& generator, + const Particle& particle) const; /// Helper methods for momentum evaluation /// @note These methods are taken from the Geant4 class /// G4PairProductionRelModel - Scalar screenFunction1(Scalar delta) const; - Scalar screenFunction2(Scalar delta) const; + double screenFunction1(double delta) const; + double screenFunction2(double delta) const; /// Electron mass. This is an static constant and not a member variable so the /// struct has no internal state. Otherwise, the interaction list breaks. - static const Scalar kElectronMass; + static const double kElectronMass; }; -inline Particle::Scalar PhotonConversion::screenFunction1(Scalar delta) const { +inline double PhotonConversion::screenFunction1(double delta) const { // Compute the value of the screening function 3*PHI1(delta) - PHI2(delta) return (delta > 1.4) ? 42.038 - 8.29 * std::log(delta + 0.958) : 42.184 - delta * (7.444 - 1.623 * delta); } -inline Particle::Scalar PhotonConversion::screenFunction2(Scalar delta) const { +inline double PhotonConversion::screenFunction2(double delta) const { // Compute the value of the screening function 1.5*PHI1(delta) // +0.5*PHI2(delta) return (delta > 1.4) ? 42.038 - 8.29 * std::log(delta + 0.958) @@ -124,16 +122,15 @@ inline Particle::Scalar PhotonConversion::screenFunction2(Scalar delta) const { } template -std::pair -PhotonConversion::generatePathLimits(generator_t& generator, - const Particle& particle) const { +std::pair PhotonConversion::generatePathLimits( + generator_t& generator, const Particle& particle) const { /// This method is based upon the Athena class PhotonConversionTool // Fast exit if not a photon or the energy is too low if (particle.pdg() != Acts::PdgParticle::eGamma || particle.absoluteMomentum() < (2 * kElectronMass)) { - return std::make_pair(std::numeric_limits::infinity(), - std::numeric_limits::infinity()); + return std::make_pair(std::numeric_limits::infinity(), + std::numeric_limits::infinity()); } // Use for the moment only Al data - Yung Tsai - Rev.Mod.Particle Physics Vol. @@ -149,73 +146,73 @@ PhotonConversion::generatePathLimits(generator_t& generator, // 1 p0 -7.01612e-03 8.43478e-01 1.62766e-04 1.11914e-05 // 2 p1 7.69040e-02 1.00059e+00 8.90718e-05 -8.41167e-07 // 3 p2 -6.07682e-01 5.13256e+00 6.07228e-04 -9.44448e-07 - constexpr Scalar p0 = -7.01612e-03; - constexpr Scalar p1 = 7.69040e-02; - constexpr Scalar p2 = -6.07682e-01; + constexpr double p0 = -7.01612e-03; + constexpr double p1 = 7.69040e-02; + constexpr double p2 = -6.07682e-01; // Calculate xi - const Scalar xi = p0 + p1 * std::pow(particle.absoluteMomentum(), p2); + const double xi = p0 + p1 * std::pow(particle.absoluteMomentum(), p2); - std::uniform_real_distribution uniformDistribution{0., 1.}; + std::uniform_real_distribution uniformDistribution{0., 1.}; // This is a transformation of eq. 3.75 return std::make_pair(-9. / 7. * std::log(conversionProbScaleFactor * (1 - uniformDistribution(generator))) / (1. - xi), - std::numeric_limits::infinity()); + std::numeric_limits::infinity()); } template -Particle::Scalar PhotonConversion::generateFirstChildEnergyFraction( - generator_t& generator, Scalar gammaMom) const { +double PhotonConversion::generateFirstChildEnergyFraction( + generator_t& generator, double gammaMom) const { /// This method is based upon the Geant4 class G4PairProductionRelModel /// @note This method is from the Geant4 class G4Element // // Compute Coulomb correction factor (Phys Rev. D50 3-1 (1994) page 1254) - constexpr Scalar k1 = 0.0083; - constexpr Scalar k2 = 0.20206; - constexpr Scalar k3 = 0.0020; // This term is missing in Athena - constexpr Scalar k4 = 0.0369; - constexpr Scalar alphaEM = 1. / 137.; - constexpr Scalar m_Z = 13.; // Aluminium - constexpr Scalar az2 = (alphaEM * m_Z) * (alphaEM * m_Z); - constexpr Scalar az4 = az2 * az2; - constexpr Scalar coulombFactor = + constexpr double k1 = 0.0083; + constexpr double k2 = 0.20206; + constexpr double k3 = 0.0020; // This term is missing in Athena + constexpr double k4 = 0.0369; + constexpr double alphaEM = 1. / 137.; + constexpr double m_Z = 13.; // Aluminium + constexpr double az2 = (alphaEM * m_Z) * (alphaEM * m_Z); + constexpr double az4 = az2 * az2; + constexpr double coulombFactor = (k1 * az4 + k2 + 1. / (1. + az2)) * az2 - (k3 * az4 + k4) * az4; - const Scalar logZ13 = std::log(m_Z) * 1. / 3.; - const Scalar FZ = 8. * (logZ13 + coulombFactor); - const Scalar deltaMax = exp((42.038 - FZ) * 0.1206) - 0.958; + const double logZ13 = std::log(m_Z) * 1. / 3.; + const double FZ = 8. * (logZ13 + coulombFactor); + const double deltaMax = std::exp((42.038 - FZ) * 0.1206) - 0.958; - const Scalar deltaPreFactor = 136. / std::pow(m_Z, 1. / 3.); - const Scalar eps0 = kElectronMass / gammaMom; - const Scalar deltaFactor = deltaPreFactor * eps0; - const Scalar deltaMin = 4. * deltaFactor; + const double deltaPreFactor = 136. / std::pow(m_Z, 1. / 3.); + const double eps0 = kElectronMass / gammaMom; + const double deltaFactor = deltaPreFactor * eps0; + const double deltaMin = 4. * deltaFactor; // Compute the limits of eps - const Scalar epsMin = + const double epsMin = std::max(eps0, 0.5 - 0.5 * std::sqrt(1. - deltaMin / deltaMax)); - const Scalar epsRange = 0.5 - epsMin; + const double epsRange = 0.5 - epsMin; // Sample the energy rate (eps) of the created electron (or positron) - const Scalar F10 = screenFunction1(deltaMin) - FZ; - const Scalar F20 = screenFunction2(deltaMin) - FZ; - const Scalar NormF1 = F10 * epsRange * epsRange; - const Scalar NormF2 = 1.5 * F20; + const double F10 = screenFunction1(deltaMin) - FZ; + const double F20 = screenFunction2(deltaMin) - FZ; + const double NormF1 = F10 * epsRange * epsRange; + const double NormF2 = 1.5 * F20; // We will need 3 uniform random number for each trial of sampling - Scalar greject = 0.; - Scalar eps = 0.; - std::uniform_real_distribution rndmEngine; + double greject = 0.; + double eps = 0.; + std::uniform_real_distribution rndmEngine; do { if (NormF1 > rndmEngine(generator) * (NormF1 + NormF2)) { eps = 0.5 - epsRange * std::pow(rndmEngine(generator), 1. / 3.); - const Scalar delta = deltaFactor / (eps * (1. - eps)); + const double delta = deltaFactor / (eps * (1. - eps)); greject = (screenFunction1(delta) - FZ) / F10; } else { eps = epsMin + epsRange * rndmEngine(generator); - const Scalar delta = deltaFactor / (eps * (1. - eps)); + const double delta = deltaFactor / (eps * (1. - eps)); greject = (screenFunction2(delta) - FZ) / F20; } } while (greject < rndmEngine(generator)); @@ -224,16 +221,16 @@ Particle::Scalar PhotonConversion::generateFirstChildEnergyFraction( } template -Particle::Vector3 PhotonConversion::generateChildDirection( +Acts::Vector3 PhotonConversion::generateChildDirection( generator_t& generator, const Particle& particle) const { /// This method is based upon the Athena class PhotonConversionTool // Following the Geant4 approximation from L. Urban // the azimutal angle - Scalar theta = kElectronMass / particle.energy(); + double theta = kElectronMass / particle.energy(); - std::uniform_real_distribution uniformDistribution{0., 1.}; - const Scalar u = -std::log(uniformDistribution(generator) * + std::uniform_real_distribution uniformDistribution{0., 1.}; + const double u = -std::log(uniformDistribution(generator) * uniformDistribution(generator)) * 1.6; @@ -257,20 +254,20 @@ Particle::Vector3 PhotonConversion::generateChildDirection( } inline std::array PhotonConversion::generateChildren( - const Particle& photon, Scalar childEnergy, - const Particle::Vector3& childDirection) const { + const Particle& photon, double childEnergy, + const Acts::Vector3& childDirection) const { using namespace Acts::UnitLiterals; // Calculate the child momentum - const Scalar massChild = kElectronMass; - const Scalar momentum1 = + const double massChild = kElectronMass; + const double momentum1 = sqrt(childEnergy * childEnergy - massChild * massChild); // Use energy-momentum conservation for the other child - const Particle::Vector3 vtmp = + const Acts::Vector3 vtmp = photon.fourMomentum().template segment<3>(Acts::eMom0) - momentum1 * childDirection; - const Scalar momentum2 = vtmp.norm(); + const double momentum2 = vtmp.norm(); // The daughter particles are created with the explicit electron mass used in // the calculations for consistency. Using the full Particle constructor with @@ -304,17 +301,16 @@ bool PhotonConversion::run(generator_t& generator, Particle& particle, } // Fast exit if momentum is too low - const Scalar p = particle.absoluteMomentum(); + const double p = particle.absoluteMomentum(); if (p < (2 * kElectronMass)) { return false; } // Get one child energy - const Scalar childEnergy = p * generateFirstChildEnergyFraction(generator, p); + const double childEnergy = p * generateFirstChildEnergyFraction(generator, p); // Now get the deflection - const Particle::Vector3 childDir = - generateChildDirection(generator, particle); + const Acts::Vector3 childDir = generateChildDirection(generator, particle); // Produce the final state const std::array finalState = diff --git a/Fatras/include/ActsFatras/Physics/NuclearInteraction/NuclearInteraction.hpp b/Fatras/include/ActsFatras/Physics/NuclearInteraction/NuclearInteraction.hpp index 89072e78536..d372cf8ffc9 100644 --- a/Fatras/include/ActsFatras/Physics/NuclearInteraction/NuclearInteraction.hpp +++ b/Fatras/include/ActsFatras/Physics/NuclearInteraction/NuclearInteraction.hpp @@ -38,7 +38,6 @@ namespace ActsFatras { /// interaction. Either the initial particle survives (soft) or it gets /// destroyed (hard) by this process. struct NuclearInteraction { - using Scalar = Particle::Scalar; /// The storage of the parameterisation detail::MultiParticleNuclearInteractionParametrisation multiParticleParameterisation; @@ -55,12 +54,12 @@ struct NuclearInteraction { /// /// @return valid X0 limit and no limit on L0 template - std::pair generatePathLimits(generator_t& generator, + std::pair generatePathLimits(generator_t& generator, const Particle& particle) const { // Fast exit: No parameterisation provided if (multiParticleParameterisation.empty()) { - return std::make_pair(std::numeric_limits::infinity(), - std::numeric_limits::infinity()); + return std::make_pair(std::numeric_limits::infinity(), + std::numeric_limits::infinity()); } // Find the parametrisation that corresponds to the particle type for (const auto& particleParametrisation : multiParticleParameterisation) { @@ -79,14 +78,14 @@ struct NuclearInteraction { const auto& distribution = parametrisation.nuclearInteractionProbability; auto limits = - std::make_pair(std::numeric_limits::infinity(), + std::make_pair(std::numeric_limits::infinity(), sampleContinuousValues( uniformDistribution(generator), distribution)); return limits; } } - return std::make_pair(std::numeric_limits::infinity(), - std::numeric_limits::infinity()); + return std::make_pair(std::numeric_limits::infinity(), + std::numeric_limits::infinity()); } /// This method performs a nuclear interaction. @@ -292,10 +291,8 @@ struct NuclearInteraction { /// /// @return Azimuthal and polar angle of the second particle in the global /// coordinate system - std::pair - globalAngle(ActsFatras::Particle::Scalar phi1, - ActsFatras::Particle::Scalar theta1, float phi2, - float theta2) const; + std::pair globalAngle(double phi1, double theta1, float phi2, + float theta2) const; /// Converter from sampled numbers to a vector of particles /// @@ -337,7 +334,7 @@ struct NuclearInteraction { /// neighbouring bins should be performed instead of a bin lookup /// /// @return The sampled value - Scalar sampleContinuousValues( + double sampleContinuousValues( double rnd, const detail::NuclearInteractionParameters::CumulativeDistribution& distribution, @@ -416,8 +413,8 @@ Acts::ActsDynamicVector NuclearInteraction::sampleInvariantMasses( // Sample in the eigenspace for (unsigned int i = 0; i < size; i++) { float variance = parametrisation.eigenvaluesInvariantMass[i]; - std::normal_distribution dist{ - parametrisation.meanInvariantMass[i], std::sqrt(variance)}; + std::normal_distribution dist{parametrisation.meanInvariantMass[i], + std::sqrt(variance)}; parameters[i] = dist(generator); } // Transform to multivariate normal distribution @@ -446,8 +443,8 @@ Acts::ActsDynamicVector NuclearInteraction::sampleMomenta( // Sample in the eigenspace for (unsigned int i = 0; i < size; i++) { float variance = parametrisation.eigenvaluesMomentum[i]; - std::normal_distribution dist{ - parametrisation.meanMomentum[i], std::sqrt(variance)}; + std::normal_distribution dist{parametrisation.meanMomentum[i], + std::sqrt(variance)}; parameters[i] = dist(generator); } diff --git a/Fatras/include/ActsFatras/Selectors/ParticleSelectors.hpp b/Fatras/include/ActsFatras/Selectors/ParticleSelectors.hpp index 4deb110969e..d784048abbd 100644 --- a/Fatras/include/ActsFatras/Selectors/ParticleSelectors.hpp +++ b/Fatras/include/ActsFatras/Selectors/ParticleSelectors.hpp @@ -21,28 +21,28 @@ struct EveryParticle { /// Select neutral particles. struct NeutralSelector { bool operator()(const Particle &particle) const { - return (particle.charge() == Particle::Scalar{0}); + return (particle.charge() == 0.); } }; /// Select all charged particles. struct ChargedSelector { bool operator()(const Particle &particle) const { - return (particle.charge() != Particle::Scalar{0}); + return (particle.charge() != 0.); } }; /// Select positively charged particles. struct PositiveSelector { bool operator()(const Particle &particle) const { - return (Particle::Scalar{0} < particle.charge()); + return (0. < particle.charge()); } }; /// Select negatively charged particles. struct NegativeSelector { bool operator()(const Particle &particle) const { - return (particle.charge() < Particle::Scalar{0}); + return (particle.charge() < 0.); } }; diff --git a/Fatras/src/Physics/BetheHeitler.cpp b/Fatras/src/Physics/BetheHeitler.cpp index af8cbd2711f..bb635ecb934 100644 --- a/Fatras/src/Physics/BetheHeitler.cpp +++ b/Fatras/src/Physics/BetheHeitler.cpp @@ -20,8 +20,8 @@ #include ActsFatras::Particle ActsFatras::BetheHeitler::bremPhoton( - const Particle &particle, Scalar gammaE, Scalar rndPsi, Scalar rndTheta1, - Scalar rndTheta2, Scalar rndTheta3) const { + const Particle &particle, double gammaE, double rndPsi, double rndTheta1, + double rndTheta2, double rndTheta3) const { // ------------------------------------------------------ // simple approach // (a) simulate theta uniform within the opening angle of the relativistic @@ -31,10 +31,10 @@ ActsFatras::Particle ActsFatras::BetheHeitler::bremPhoton( // later // the azimutal angle - Scalar psi = 2. * std::numbers::pi * rndPsi; + double psi = 2. * std::numbers::pi * rndPsi; // the start of the equation - Scalar theta = 0.; + double theta = 0.; if (uniformHertzDipoleAngle) { // the simplest simulation theta = particle.mass() / particle.energy() * rndTheta1; @@ -42,13 +42,13 @@ ActsFatras::Particle ActsFatras::BetheHeitler::bremPhoton( // -----> theta = particle.mass() / particle.energy(); // follow - constexpr Scalar a = 0.625; // 5/8 - Scalar u = -log(rndTheta2 * rndTheta3) / a; + constexpr double a = 0.625; // 5/8 + double u = -log(rndTheta2 * rndTheta3) / a; theta *= (rndTheta1 < 0.25) ? u : u / 3.; // 9./(9.+27) = 0.25 } - Vector3 particleDirection = particle.direction(); - Vector3 photonDirection = particleDirection; + Acts::Vector3 particleDirection = particle.direction(); + Acts::Vector3 photonDirection = particleDirection; // construct the combined rotation to the scattered direction Acts::RotationMatrix3 rotation( diff --git a/Fatras/src/Physics/NuclearInteraction/NuclearInteraction.cpp b/Fatras/src/Physics/NuclearInteraction/NuclearInteraction.cpp index 1515fc3c626..84ab93921fe 100644 --- a/Fatras/src/Physics/NuclearInteraction/NuclearInteraction.cpp +++ b/Fatras/src/Physics/NuclearInteraction/NuclearInteraction.cpp @@ -67,14 +67,14 @@ unsigned int NuclearInteraction::sampleDiscreteValues( return static_cast(distribution.first[iBin]); } -Particle::Scalar NuclearInteraction::sampleContinuousValues( +double NuclearInteraction::sampleContinuousValues( double rnd, const detail::NuclearInteractionParameters::CumulativeDistribution& distribution, bool interpolate) const { // Fast exit if (distribution.second.empty()) { - return std::numeric_limits::infinity(); + return std::numeric_limits::infinity(); } // Find the bin @@ -82,7 +82,7 @@ Particle::Scalar NuclearInteraction::sampleContinuousValues( std::numeric_limits::max() * rnd); // Fast exit for non-normalised CDFs like interaction probability if (int_rnd > distribution.second.back()) { - return std::numeric_limits::infinity(); + return std::numeric_limits::infinity(); } const auto it = std::upper_bound(distribution.second.begin(), distribution.second.end(), int_rnd); @@ -111,10 +111,10 @@ unsigned int NuclearInteraction::finalStateMultiplicity( return sampleDiscreteValues(rnd, distribution); } -std::pair -NuclearInteraction::globalAngle(ActsFatras::Particle::Scalar phi1, - ActsFatras::Particle::Scalar theta1, float phi2, - float theta2) const { +std::pair NuclearInteraction::globalAngle(double phi1, + double theta1, + float phi2, + float theta2) const { // Rotation around the global y-axis Acts::SquareMatrix3 rotY = Acts::SquareMatrix3::Zero(); rotY(0, 0) = std::cos(theta1); diff --git a/Fatras/src/Physics/PhotonConversion.cpp b/Fatras/src/Physics/PhotonConversion.cpp index 73bb83ad413..bf71af4cae2 100644 --- a/Fatras/src/Physics/PhotonConversion.cpp +++ b/Fatras/src/Physics/PhotonConversion.cpp @@ -10,6 +10,5 @@ #include "Acts/Definitions/ParticleData.hpp" -const ActsFatras::PhotonConversion::Scalar - ActsFatras::PhotonConversion::kElectronMass = - Acts::findMass(Acts::PdgParticle::eElectron).value(); +const double ActsFatras::PhotonConversion::kElectronMass = + Acts::findMass(Acts::PdgParticle::eElectron).value(); diff --git a/Plugins/Hashing/include/Acts/Plugins/Hashing/HashingAnnoy.ipp b/Plugins/Hashing/include/Acts/Plugins/Hashing/HashingAnnoy.ipp index d5e4f28f3a5..223fc3c4573 100644 --- a/Plugins/Hashing/include/Acts/Plugins/Hashing/HashingAnnoy.ipp +++ b/Plugins/Hashing/include/Acts/Plugins/Hashing/HashingAnnoy.ipp @@ -28,8 +28,6 @@ void HashingAnnoy:: const unsigned int phiBins, const double layerRMin, const double layerRMax, const double layerZMin, const double layerZMax) { - using Scalar = Acts::ActsScalar; - static thread_local std::vector> bucketsSetSPMap; bucketsSetSPMap.clear(); @@ -61,21 +59,21 @@ void HashingAnnoy:: }; // Functions to get the bin index - auto getBinIndexZ = [&zBins, &layerZMin, &layerZMax](Scalar z) { - Scalar binSize = (layerZMax - layerZMin) / zBins; + auto getBinIndexZ = [&zBins, &layerZMin, &layerZMax](double z) { + double binSize = (layerZMax - layerZMin) / zBins; auto binIndex = static_cast((z - layerZMin + 0.5 * binSize) / binSize); return binIndex; }; - auto getBinIndexPhi = [&phiBins](Scalar phi) { - Scalar binSize = 2 * std::numbers::pi / phiBins; + auto getBinIndexPhi = [&phiBins](double phi) { + double binSize = 2 * std::numbers::pi / phiBins; auto binIndex = static_cast((phi + std::numbers::pi) / binSize); return binIndex; }; // Function pointers to a unified bin index function for z and phi auto getBinIndex = [&zBins, &phiBins, &getBinIndexZ, &getBinIndexPhi]( - Scalar z, Scalar phi) -> int { + double z, double phi) -> int { if (zBins > 0) { return getBinIndexZ(z); } else if (phiBins > 0) { @@ -89,16 +87,16 @@ void HashingAnnoy:: for (unsigned int spacePointIndex = 0; spacePointIndex < spacePoints.size(); spacePointIndex++) { external_spacepoint_t spacePoint = spacePoints[spacePointIndex]; - Scalar x = spacePoint->x() / Acts::UnitConstants::mm; - Scalar y = spacePoint->y() / Acts::UnitConstants::mm; - Scalar z = spacePoint->z() / Acts::UnitConstants::mm; + double x = spacePoint->x() / Acts::UnitConstants::mm; + double y = spacePoint->y() / Acts::UnitConstants::mm; + double z = spacePoint->z() / Acts::UnitConstants::mm; // Helix transform - if (Scalar r2 = x * x + y * y; !layerSelection(r2, z)) { + if (double r2 = x * x + y * y; !layerSelection(r2, z)) { continue; } - Scalar phi = atan2(y, x); + double phi = atan2(y, x); int binIndex = getBinIndex(z, phi); if (binIndex < 0 || static_cast(binIndex) >= nBins) { diff --git a/Plugins/Hashing/include/Acts/Plugins/Hashing/HashingTraining.ipp b/Plugins/Hashing/include/Acts/Plugins/Hashing/HashingTraining.ipp index 3e24e828177..b3abefa2a11 100644 --- a/Plugins/Hashing/include/Acts/Plugins/Hashing/HashingTraining.ipp +++ b/Plugins/Hashing/include/Acts/Plugins/Hashing/HashingTraining.ipp @@ -40,18 +40,16 @@ AnnoyModel HashingTrainingAlgorithm::execute( auto annoyModel = AnnoyModel(f); - using Scalar = Acts::ActsScalar; - annoyModel.set_seed(annoySeed); unsigned int spacePointIndex = 0; // Add spacePoints parameters to Annoy for (const auto& spacePoint : spacePoints) { - Scalar x = spacePoint->x() / Acts::UnitConstants::mm; - Scalar y = spacePoint->y() / Acts::UnitConstants::mm; + double x = spacePoint->x() / Acts::UnitConstants::mm; + double y = spacePoint->y() / Acts::UnitConstants::mm; // Helix transform - Scalar phi = std::atan2(y, x); + double phi = std::atan2(y, x); std::vector vec(f); // Avoid potential null pointer dereference @@ -59,11 +57,11 @@ AnnoyModel HashingTrainingAlgorithm::execute( vec[0] = phi; } if (f >= 2) { - Scalar z = spacePoint->z() / Acts::UnitConstants::mm; - Scalar r2 = x * x + y * y; - Scalar rho = std::sqrt(r2 + z * z); - Scalar theta = std::acos(z / rho); - Scalar eta = Acts::AngleHelpers::etaFromTheta(theta); + double z = spacePoint->z() / Acts::UnitConstants::mm; + double r2 = x * x + y * y; + double rho = std::sqrt(r2 + z * z); + double theta = std::acos(z / rho); + double eta = Acts::AngleHelpers::etaFromTheta(theta); vec[1] = eta; } diff --git a/Tests/UnitTests/Core/Seeding/HoughTransformTest.cpp b/Tests/UnitTests/Core/Seeding/HoughTransformTest.cpp index 30e3164f62c..b469c6d7c1c 100644 --- a/Tests/UnitTests/Core/Seeding/HoughTransformTest.cpp +++ b/Tests/UnitTests/Core/Seeding/HoughTransformTest.cpp @@ -19,17 +19,16 @@ namespace Acts::Test { -using Scalar = Acts::ActsScalar; auto logger = Acts::getDefaultLogger("UnitTests", Acts::Logging::VERBOSE); struct DriftCircle { - Scalar y{0.}; - Scalar z{0.}; - Scalar rDrift{0.}; - Scalar rDriftError{0.}; + double y{0.}; + double z{0.}; + double rDrift{0.}; + double rDriftError{0.}; - DriftCircle(const Scalar _y, const Scalar _z, const Scalar _r, - const Scalar _rUncert) + DriftCircle(const double _y, const double _z, const double _r, + const double _rUncert) : y{_y}, z{_z}, rDrift{_r}, rDriftError{_rUncert} {} }; @@ -92,7 +91,7 @@ BOOST_AUTO_TEST_CASE(hough_transform_seeder) { Acts::HoughTransformUtils::HoughPlane houghPlane(planeCfg); - // also insantiate the peak finder + // also instantiate the peak finder Acts::HoughTransformUtils::PeakFinders::IslandsAroundMax< Acts::GeometryIdentifier::Value> peakFinder(peakFinderCfg); diff --git a/Tests/UnitTests/Core/Utilities/BoundingBoxTest.cpp b/Tests/UnitTests/Core/Utilities/BoundingBoxTest.cpp index 675d7d49320..b65d533acfa 100644 --- a/Tests/UnitTests/Core/Utilities/BoundingBoxTest.cpp +++ b/Tests/UnitTests/Core/Utilities/BoundingBoxTest.cpp @@ -37,13 +37,11 @@ namespace Acts::Test { struct Object {}; -using BoundingBoxScalar = ActsScalar; +using ObjectBBox = Acts::AxisAlignedBoundingBox; -using ObjectBBox = Acts::AxisAlignedBoundingBox; - -using Vector2F = Eigen::Matrix; -using Vector3F = Eigen::Matrix; -using AngleAxis3F = Eigen::AngleAxis; +using Vector2F = Eigen::Matrix; +using Vector3F = Eigen::Matrix; +using AngleAxis3F = Eigen::AngleAxis; std::filesystem::path tmp_path = []() { auto tmpPath = std::filesystem::temp_directory_path() / "acts_unit_tests"; @@ -59,11 +57,11 @@ std::ofstream tmp(const std::string& path) { BOOST_AUTO_TEST_CASE(box_construction) { BOOST_TEST_CONTEXT("2D") { Object o; - using Box = Acts::AxisAlignedBoundingBox; + using Box = Acts::AxisAlignedBoundingBox; Box bb(&o, {-1, -1}, {2, 2}); typename Box::transform_type rot; - rot = Eigen::Rotation2D(std::numbers::pi / 7.); + rot = Eigen::Rotation2D(std::numbers::pi / 7.); Box bb_rot = bb.transformed(rot); CHECK_CLOSE_ABS(bb_rot.min(), Vector2F(-1.76874, -1.33485), 1e-4); @@ -72,7 +70,7 @@ BOOST_AUTO_TEST_CASE(box_construction) { BOOST_TEST_CONTEXT("3D") { Object o; - using Box = Acts::AxisAlignedBoundingBox; + using Box = Acts::AxisAlignedBoundingBox; Box bb(&o, {-1, -1, -1}, {2, 2, 2}); typename Box::transform_type rot; @@ -141,14 +139,14 @@ BOOST_AUTO_TEST_CASE(intersect_points) { BOOST_AUTO_TEST_CASE(intersect_rays) { BOOST_TEST_CONTEXT("2D") { - using Box = AxisAlignedBoundingBox; + using Box = AxisAlignedBoundingBox; Object o; Box bb(&o, {-1, -1}, {1, 1}); // ray in positive x direction - Ray ray({-2, 0}, {1, 0}); + Ray ray({-2, 0}, {1, 0}); BOOST_CHECK(bb.intersect(ray)); ray = {{-2, 2}, {1, 0}}; @@ -273,10 +271,10 @@ BOOST_AUTO_TEST_CASE(intersect_rays) { // let's make sure it also works in 3d ObjectBBox bb3(&o, {-1, -1, -1}, {1, 1, 1}); - Ray ray3({0, 0, -2}, {0, 0, 1}); + Ray ray3({0, 0, -2}, {0, 0, 1}); BOOST_CHECK(bb3.intersect(ray3)); - PlyVisualization3D ply; + PlyVisualization3D ply; ray3.draw(ply); auto os = tmp("ray3d.ply"); @@ -290,7 +288,7 @@ BOOST_AUTO_TEST_CASE(intersect_rays) { // let's make sure it also works in 3d ObjectBBox bb3(&o, {-1, -1, -1}, {1, 1, 1}); - Ray ray3({0, 0, -2}, {0, 0, 1}); + Ray ray3({0, 0, -2}, {0, 0, 1}); BOOST_CHECK(bb3.intersect(ray3)); // facing away from box @@ -451,7 +449,7 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { return os; }; - using Frustum2 = Frustum; + using Frustum2 = Frustum; std::ofstream os; @@ -460,19 +458,18 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { const std::size_t nSteps = 10; // Visualise the parameters - const BoundingBoxScalar min = -20; - const BoundingBoxScalar max = 20; + const double min = -20; + const double max = 20; os = make_svg("frust2d_parameters.svg", svgWidth, svgHeight); - const BoundingBoxScalar step = (max - min) / nSteps; + const double step = (max - min) / nSteps; for (std::size_t i = 0; i <= nSteps; i++) { for (std::size_t j = 0; j <= nSteps; j++) { Vector2F dir(1, 0); Vector2F origin(min + step * i, min + step * j); origin.x() *= 1.10; - Eigen::Rotation2D rot(2 * std::numbers::pi / nSteps * - i); - BoundingBoxScalar angle = std::numbers::pi / 2. / nSteps * j; + Eigen::Rotation2D rot(2 * std::numbers::pi / nSteps * i); + double angle = std::numbers::pi / 2. / nSteps * j; Frustum2 fr(origin, rot * dir, angle); fr.svg(os, svgWidth, svgHeight, 2); } @@ -481,18 +478,18 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { os << ""; os.close(); - const BoundingBoxScalar unit = 20; + const double unit = 20.; - using Box = AxisAlignedBoundingBox; + using Box = AxisAlignedBoundingBox; Object o; - Box::Size size(Eigen::Matrix(2, 2)); + Box::Size size(Eigen::Matrix(2, 2)); - const BoundingBoxScalar minX = -20; - const BoundingBoxScalar minY = -20; - const BoundingBoxScalar maxX = 20; - const BoundingBoxScalar maxY = 20; - const BoundingBoxScalar stepX = (maxX - minX) / nSteps; - const BoundingBoxScalar stepY = (maxY - minY) / nSteps; + const double minX = -20.; + const double minY = -20.; + const double maxX = 20.; + const double maxY = 20.; + const double stepX = (maxX - minX) / nSteps; + const double stepY = (maxY - minY) / nSteps; std::set idxsAct; @@ -579,10 +576,10 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { boxes.reserve((nSteps + 1) * (nSteps + 1)); for (std::size_t i = 0; i <= nSteps; i++) { for (std::size_t j = 0; j <= nSteps; j++) { - boxes.emplace_back(&o, - Eigen::Matrix{ - minX + i * stepX, minY + j * stepY}, - size); + boxes.emplace_back( + &o, + Eigen::Matrix{minX + i * stepX, minY + j * stepY}, + size); std::stringstream st; st << boxes.size() - 1; @@ -605,9 +602,9 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { } } - PlyVisualization3D helper; + PlyVisualization3D helper; BOOST_TEST_CONTEXT("3D - 3 Sides") { - using Frustum3 = Frustum; + using Frustum3 = Frustum; std::ofstream os; std::size_t n = 10; const std::size_t nSteps = 5; @@ -619,7 +616,7 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { auto make = [&](double angle, const Vector3F& origin, std::ofstream& osTmp) { helper.clear(); - BoundingBoxScalar far = 1; + double far = 1.; Frustum3 fr(origin, {0, 0, 1}, angle); fr.draw(helper, far); fr = Frustum3(origin, {0, 0, -1}, angle); @@ -655,7 +652,7 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { for (std::size_t i = 0; i <= n; i++) { Vector3F origin(i * 4, 0, 0); AngleAxis3F rot(std::numbers::pi / n * i, Vector3F::UnitY()); - BoundingBoxScalar angle = (std::numbers::pi / 2.) / n * (1 + i); + double angle = (std::numbers::pi / 2.) / n * (1 + i); Vector3F dir(1, 0, 0); Frustum3 fr(origin, rot * dir, angle); fr.draw(helper, 2); @@ -850,16 +847,16 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { step = (max - min) / n; Object o; - using Box = AxisAlignedBoundingBox; - Box::Size size(Eigen::Matrix(2, 2, 2)); + using Box = AxisAlignedBoundingBox; + Box::Size size(Eigen::Matrix(2, 2, 2)); std::size_t idx = 0; for (std::size_t i = 0; i <= n; i++) { for (std::size_t j = 0; j <= n; j++) { for (std::size_t k = 0; k <= n; k++) { - Eigen::Matrix pos( - min + i * step, min + j * step, min + k * step); + Eigen::Matrix pos(min + i * step, min + j * step, + min + k * step); Box bb(&o, pos, size); Color color = {255, 0, 0}; @@ -883,7 +880,7 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { } BOOST_TEST_CONTEXT("3D - 4 Sides") { - using Frustum34 = Frustum; + using Frustum34 = Frustum; const std::size_t n = 10; double min = -10; double max = 10; @@ -902,7 +899,7 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { Vector3F origin(min + i * step, min + j * step, min + k * step); Vector3F dir(1, 0, 0); - BoundingBoxScalar piOverS = std::numbers::pi_v / s; + double piOverS = std::numbers::pi / s; AngleAxis3F rot; rot = AngleAxis3F(piOverS * i, Vector3F::UnitX()) * AngleAxis3F(piOverS * j, Vector3F::UnitY()) * @@ -1104,15 +1101,15 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { fr.draw(helper, 50); Object o; - using Box = AxisAlignedBoundingBox; - Box::Size size(Eigen::Matrix(2, 2, 2)); + using Box = AxisAlignedBoundingBox; + Box::Size size(Eigen::Matrix(2, 2, 2)); std::size_t idx = 0; for (std::size_t i = 0; i <= n; i++) { for (std::size_t j = 0; j <= n; j++) { for (std::size_t k = 0; k <= n; k++) { - Eigen::Matrix pos( - min + i * step, min + j * step, min + k * step); + Eigen::Matrix pos(min + i * step, min + j * step, + min + k * step); Box bb(&o, pos, size); Color color = {255, 0, 0}; @@ -1136,13 +1133,13 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { } BOOST_TEST_CONTEXT("3D - 5 Sides") { - using Frustum = Frustum; - using Box = AxisAlignedBoundingBox; - Box::Size size(Eigen::Matrix(2, 2, 2)); + using Frustum = Frustum; + using Box = AxisAlignedBoundingBox; + Box::Size size(Acts::Vector3(2, 2, 2)); Object o; - PlyVisualization3D ply; + PlyVisualization3D ply; Frustum fr({0, 0, 0}, {0, 0, 1}, std::numbers::pi / 8.); fr.draw(ply, 10); @@ -1158,17 +1155,16 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { } BOOST_TEST_CONTEXT("3D - 10 Sides") { - using Frustum = Frustum; - using Box = AxisAlignedBoundingBox; - using vec3 = Eigen::Matrix; - Box::Size size(vec3(2, 2, 2)); + using Frustum = Frustum; + using Box = AxisAlignedBoundingBox; + Box::Size size(Acts::Vector3(2, 2, 2)); Object o; - PlyVisualization3D ply; + PlyVisualization3D ply; - vec3 pos = {-12.4205, 29.3578, 44.6207}; - vec3 dir = {-0.656862, 0.48138, 0.58035}; + Acts::Vector3 pos = {-12.4205, 29.3578, 44.6207}; + Acts::Vector3 dir = {-0.656862, 0.48138, 0.58035}; Frustum fr(pos, dir, 0.972419); fr.draw(ply, 10); @@ -1183,20 +1179,19 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { } BOOST_TEST_CONTEXT("3D - 4 Sides - Big box") { - using Frustum = Frustum; - using Box = AxisAlignedBoundingBox; - using vec3 = Eigen::Matrix; + using Frustum = Frustum; + using Box = AxisAlignedBoundingBox; Object o; - PlyVisualization3D ply; + PlyVisualization3D ply; - vec3 pos = {0, 0, 0}; - vec3 dir = {0, 0, 1}; + Acts::Vector3 pos = {0, 0, 0}; + Acts::Vector3 dir = {0, 0, 1}; Frustum fr(pos, dir, 0.972419); fr.draw(ply, 10); - Box::Size size(vec3(100, 100, 2)); + Box::Size size(Acts::Vector3(100, 100, 2)); Box bb(&o, pos + dir * 7, size); bb.draw(ply); @@ -1210,7 +1205,7 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { BOOST_AUTO_TEST_CASE(ostream_operator) { Object o; - using Box = Acts::AxisAlignedBoundingBox; + using Box = Acts::AxisAlignedBoundingBox; Box bb(&o, {-1, -1}, {2, 2}); std::stringstream ss; diff --git a/Tests/UnitTests/Fatras/EventData/HitTests.cpp b/Tests/UnitTests/Fatras/EventData/HitTests.cpp index 765db8378a8..4fc89f8b686 100644 --- a/Tests/UnitTests/Fatras/EventData/HitTests.cpp +++ b/Tests/UnitTests/Fatras/EventData/HitTests.cpp @@ -18,7 +18,7 @@ using namespace ActsFatras; namespace { -constexpr auto eps = std::numeric_limits::epsilon(); +constexpr auto eps = std::numeric_limits::epsilon(); const auto pid = Barcode().setVertexPrimary(12).setParticle(23); const auto gid = Acts::GeometryIdentifier().setVolume(1).setLayer(2).setSensitive(3); @@ -28,93 +28,95 @@ BOOST_AUTO_TEST_SUITE(FatrasHit) BOOST_AUTO_TEST_CASE(WithoutInteraction) { // some hit position - auto p4 = Hit::Vector4(1, 2, 3, 4); + auto p4 = Acts::Vector4(1, 2, 3, 4); // before/after four-momenta are the same - auto m4 = Hit::Vector4(1, 1, 1, 4); + auto m4 = Acts::Vector4(1, 1, 1, 4); auto h = Hit(gid, pid, p4, m4, m4, 12u); BOOST_CHECK_EQUAL(h.geometryId(), gid); BOOST_CHECK_EQUAL(h.particleId(), pid); BOOST_CHECK_EQUAL(h.index(), 12u); CHECK_CLOSE_REL(h.fourPosition(), p4, eps); - CHECK_CLOSE_REL(h.position(), Hit::Vector3(1, 2, 3), eps); + CHECK_CLOSE_REL(h.position(), Acts::Vector3(1, 2, 3), eps); CHECK_CLOSE_REL(h.time(), 4, eps); CHECK_CLOSE_REL(h.momentum4Before(), m4, eps); CHECK_CLOSE_REL(h.momentum4After(), m4, eps); - CHECK_CLOSE_REL(h.directionBefore(), Hit::Vector3(1, 1, 1).normalized(), eps); - CHECK_CLOSE_REL(h.directionAfter(), Hit::Vector3(1, 1, 1).normalized(), eps); - CHECK_CLOSE_REL(h.direction(), Hit::Vector3(1, 1, 1).normalized(), eps); + CHECK_CLOSE_REL(h.directionBefore(), Acts::Vector3(1, 1, 1).normalized(), + eps); + CHECK_CLOSE_REL(h.directionAfter(), Acts::Vector3(1, 1, 1).normalized(), eps); + CHECK_CLOSE_REL(h.direction(), Acts::Vector3(1, 1, 1).normalized(), eps); CHECK_SMALL(h.depositedEnergy(), eps); } BOOST_AUTO_TEST_CASE(WithEnergyLoss) { // some hit position - auto p4 = Hit::Vector4(1, 2, 3, 4); + auto p4 = Acts::Vector4(1, 2, 3, 4); // before/after four-momenta differ by energy loss, use zero mass to simplify - auto m40 = Hit::Vector4(2, 0, 0, 2); - auto m41 = Hit::Vector4(1.5, 0, 0, 1.5); + auto m40 = Acts::Vector4(2, 0, 0, 2); + auto m41 = Acts::Vector4(1.5, 0, 0, 1.5); auto h = Hit(gid, pid, p4, m40, m41, 13u); BOOST_CHECK_EQUAL(h.geometryId(), gid); BOOST_CHECK_EQUAL(h.particleId(), pid); BOOST_CHECK_EQUAL(h.index(), 13u); CHECK_CLOSE_REL(h.fourPosition(), p4, eps); - CHECK_CLOSE_REL(h.position(), Hit::Vector3(1, 2, 3), eps); + CHECK_CLOSE_REL(h.position(), Acts::Vector3(1, 2, 3), eps); CHECK_CLOSE_REL(h.time(), 4, eps); CHECK_CLOSE_OR_SMALL(h.momentum4Before(), m40, eps, eps); CHECK_CLOSE_OR_SMALL(h.momentum4After(), m41, eps, eps); - CHECK_CLOSE_OR_SMALL(h.directionBefore(), Hit::Vector3(1, 0, 0), eps, eps); - CHECK_CLOSE_OR_SMALL(h.directionAfter(), Hit::Vector3(1, 0, 0), eps, eps); - CHECK_CLOSE_OR_SMALL(h.direction(), Hit::Vector3(1, 0, 0), eps, eps); + CHECK_CLOSE_OR_SMALL(h.directionBefore(), Acts::Vector3(1, 0, 0), eps, eps); + CHECK_CLOSE_OR_SMALL(h.directionAfter(), Acts::Vector3(1, 0, 0), eps, eps); + CHECK_CLOSE_OR_SMALL(h.direction(), Acts::Vector3(1, 0, 0), eps, eps); CHECK_CLOSE_REL(h.depositedEnergy(), 0.5, eps); } BOOST_AUTO_TEST_CASE(WithScattering) { // some hit position - auto p4 = Hit::Vector4(1, 2, 3, 4); + auto p4 = Acts::Vector4(1, 2, 3, 4); // before/after four-momenta differ only by direction - auto m40 = Hit::Vector4(2, 0, 2, 5); - auto m41 = Hit::Vector4(0, -2, 2, 5); + auto m40 = Acts::Vector4(2, 0, 2, 5); + auto m41 = Acts::Vector4(0, -2, 2, 5); auto h = Hit(gid, pid, p4, m40, m41, 42u); BOOST_CHECK_EQUAL(h.geometryId(), gid); BOOST_CHECK_EQUAL(h.particleId(), pid); BOOST_CHECK_EQUAL(h.index(), 42u); CHECK_CLOSE_REL(h.fourPosition(), p4, eps); - CHECK_CLOSE_REL(h.position(), Hit::Vector3(1, 2, 3), eps); + CHECK_CLOSE_REL(h.position(), Acts::Vector3(1, 2, 3), eps); CHECK_CLOSE_REL(h.time(), 4, eps); CHECK_CLOSE_OR_SMALL(h.momentum4Before(), m40, eps, eps); CHECK_CLOSE_OR_SMALL(h.momentum4After(), m41, eps, eps); - CHECK_CLOSE_OR_SMALL(h.directionBefore(), Hit::Vector3(1, 0, 1).normalized(), + CHECK_CLOSE_OR_SMALL(h.directionBefore(), Acts::Vector3(1, 0, 1).normalized(), eps, eps); - CHECK_CLOSE_OR_SMALL(h.directionAfter(), Hit::Vector3(0, -1, 1).normalized(), + CHECK_CLOSE_OR_SMALL(h.directionAfter(), Acts::Vector3(0, -1, 1).normalized(), eps, eps); - CHECK_CLOSE_REL(h.direction(), Hit::Vector3(1, -1, 2).normalized(), eps); + CHECK_CLOSE_REL(h.direction(), Acts::Vector3(1, -1, 2).normalized(), eps); CHECK_SMALL(h.depositedEnergy(), eps); } BOOST_AUTO_TEST_CASE(WithEverything) { // some hit position - auto p4 = Hit::Vector4(1, 2, 3, 4); + auto p4 = Acts::Vector4(1, 2, 3, 4); // before/after four-momenta differ by direction and norm - auto m40 = Hit::Vector4(3, 2, 2, 5); - auto m41 = Hit::Vector4(2, 1, 2, 4); + auto m40 = Acts::Vector4(3, 2, 2, 5); + auto m41 = Acts::Vector4(2, 1, 2, 4); auto h = Hit(gid, pid, p4, m40, m41, 1u); BOOST_CHECK_EQUAL(h.geometryId(), gid); BOOST_CHECK_EQUAL(h.particleId(), pid); BOOST_CHECK_EQUAL(h.index(), 1u); CHECK_CLOSE_REL(h.fourPosition(), p4, eps); - CHECK_CLOSE_REL(h.position(), Hit::Vector3(1, 2, 3), eps); + CHECK_CLOSE_REL(h.position(), Acts::Vector3(1, 2, 3), eps); CHECK_CLOSE_REL(h.time(), 4, eps); CHECK_CLOSE_OR_SMALL(h.momentum4Before(), m40, eps, eps); CHECK_CLOSE_OR_SMALL(h.momentum4After(), m41, eps, eps); - CHECK_CLOSE_REL(h.directionBefore(), Hit::Vector3(3, 2, 2).normalized(), eps); - CHECK_CLOSE_REL(h.directionAfter(), Hit::Vector3(2, 1, 2).normalized(), eps); - CHECK_CLOSE_REL( - h.direction(), - Hit::Vector3(0.7023994590205035, 0.41229136135810396, 0.5802161953247991), - eps); + CHECK_CLOSE_REL(h.directionBefore(), Acts::Vector3(3, 2, 2).normalized(), + eps); + CHECK_CLOSE_REL(h.directionAfter(), Acts::Vector3(2, 1, 2).normalized(), eps); + CHECK_CLOSE_REL(h.direction(), + Acts::Vector3(0.7023994590205035, 0.41229136135810396, + 0.5802161953247991), + eps); CHECK_CLOSE_REL(h.depositedEnergy(), 1, eps); } diff --git a/Tests/UnitTests/Fatras/EventData/ParticleTests.cpp b/Tests/UnitTests/Fatras/EventData/ParticleTests.cpp index a6858dacc74..e3fce039dab 100644 --- a/Tests/UnitTests/Fatras/EventData/ParticleTests.cpp +++ b/Tests/UnitTests/Fatras/EventData/ParticleTests.cpp @@ -23,7 +23,7 @@ using ActsFatras::Particle; using namespace Acts::UnitLiterals; namespace { -constexpr auto eps = std::numeric_limits::epsilon(); +constexpr auto eps = std::numeric_limits::epsilon(); } BOOST_AUTO_TEST_SUITE(FatrasParticle) @@ -35,17 +35,17 @@ BOOST_AUTO_TEST_CASE(Construct) { BOOST_CHECK_EQUAL(particle.particleId(), pid); BOOST_CHECK_EQUAL(particle.pdg(), PdgParticle::eProton); // particle is at rest at the origin - BOOST_CHECK_EQUAL(particle.fourPosition(), Particle::Vector4::Zero()); - BOOST_CHECK_EQUAL(particle.position(), Particle::Vector3::Zero()); - BOOST_CHECK_EQUAL(particle.time(), Particle::Scalar{0}); + BOOST_CHECK_EQUAL(particle.fourPosition(), Acts::Vector4::Zero()); + BOOST_CHECK_EQUAL(particle.position(), Acts::Vector3::Zero()); + BOOST_CHECK_EQUAL(particle.time(), 0.); BOOST_CHECK_EQUAL(particle.fourPosition().x(), particle.position().x()); BOOST_CHECK_EQUAL(particle.fourPosition().y(), particle.position().y()); BOOST_CHECK_EQUAL(particle.fourPosition().z(), particle.position().z()); BOOST_CHECK_EQUAL(particle.fourPosition().w(), particle.time()); // particle direction is undefined, but must be normalized CHECK_CLOSE_REL(particle.direction().norm(), 1, eps); - BOOST_CHECK_EQUAL(particle.transverseMomentum(), Particle::Scalar{0}); - BOOST_CHECK_EQUAL(particle.absoluteMomentum(), Particle::Scalar{0}); + BOOST_CHECK_EQUAL(particle.transverseMomentum(), 0.); + BOOST_CHECK_EQUAL(particle.absoluteMomentum(), 0.); // particle is created at rest and thus not alive BOOST_CHECK(!particle.isAlive()); } @@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(Construct) { BOOST_AUTO_TEST_CASE(CorrectEnergy) { const auto pid = Barcode().setVertexPrimary(1).setParticle(42); auto particle = Particle(pid, PdgParticle::eProton, 1_e, 1_GeV) - .setDirection(Particle::Vector3::UnitX()) + .setDirection(Acts::Vector3::UnitX()) .setAbsoluteMomentum(2_GeV); BOOST_CHECK_EQUAL(particle.mass(), 1_GeV); @@ -68,39 +68,37 @@ BOOST_AUTO_TEST_CASE(CorrectEnergy) { // particle direction must be normalized CHECK_CLOSE_REL(particle.direction().norm(), 1, eps); - // loose some energy + // lose some energy particle.correctEnergy(-100_MeV); BOOST_CHECK_LT(particle.transverseMomentum(), 2_GeV); BOOST_CHECK_LT(particle.absoluteMomentum(), 2_GeV); - BOOST_CHECK_EQUAL(particle.energy(), - Particle::Scalar{std::hypot(1_GeV, 2_GeV) - 100_MeV}); + BOOST_CHECK_EQUAL(particle.energy(), std::hypot(1_GeV, 2_GeV) - 100_MeV); CHECK_CLOSE_REL(particle.direction().norm(), 1, eps); // particle is still alive BOOST_CHECK(particle.isAlive()); - // loose some more energy + // lose some more energy particle.correctEnergy(-200_MeV); BOOST_CHECK_LT(particle.transverseMomentum(), 2_GeV); BOOST_CHECK_LT(particle.absoluteMomentum(), 2_GeV); - BOOST_CHECK_EQUAL(particle.energy(), - Particle::Scalar{std::hypot(1_GeV, 2_GeV) - 300_MeV}); + BOOST_CHECK_EQUAL(particle.energy(), std::hypot(1_GeV, 2_GeV) - 300_MeV); CHECK_CLOSE_REL(particle.direction().norm(), 1, eps); // particle is still alive BOOST_CHECK(particle.isAlive()); - // loose a lot of energy + // lose a lot of energy particle.correctEnergy(-3_GeV); - BOOST_CHECK_EQUAL(particle.transverseMomentum(), Particle::Scalar{0}); - BOOST_CHECK_EQUAL(particle.absoluteMomentum(), Particle::Scalar{0}); + BOOST_CHECK_EQUAL(particle.transverseMomentum(), 0.); + BOOST_CHECK_EQUAL(particle.absoluteMomentum(), 0.); BOOST_CHECK_EQUAL(particle.energy(), particle.mass()); CHECK_CLOSE_REL(particle.direction().norm(), 1, eps); // particle is not alive anymore BOOST_CHECK(!particle.isAlive()); - // lossing even more energy does nothing + // losing even more energy does nothing particle.correctEnergy(-10_GeV); - BOOST_CHECK_EQUAL(particle.transverseMomentum(), Particle::Scalar{0}); - BOOST_CHECK_EQUAL(particle.absoluteMomentum(), Particle::Scalar{0}); + BOOST_CHECK_EQUAL(particle.transverseMomentum(), 0.); + BOOST_CHECK_EQUAL(particle.absoluteMomentum(), 0.); BOOST_CHECK_EQUAL(particle.energy(), particle.mass()); CHECK_CLOSE_REL(particle.direction().norm(), 1, eps); // particle is still not alive diff --git a/Tests/UnitTests/Fatras/Kernel/InteractionListTests.cpp b/Tests/UnitTests/Fatras/Kernel/InteractionListTests.cpp index 167025ad739..0364fe810d6 100644 --- a/Tests/UnitTests/Fatras/Kernel/InteractionListTests.cpp +++ b/Tests/UnitTests/Fatras/Kernel/InteractionListTests.cpp @@ -25,7 +25,6 @@ using namespace Acts::UnitLiterals; using namespace ActsFatras; using Acts::MaterialSlab; -using Scalar = Particle::Scalar; namespace { @@ -63,9 +62,9 @@ static_assert(!detail::PointLikeProcessConcept, /// Each run call creates one descendant particle. struct X0PointLikeProcess { template - std::pair generatePathLimits( + std::pair generatePathLimits( generator_t & /*generator*/, const Particle & /*particle*/) const { - return {0.5, std::numeric_limits::infinity()}; + return {0.5, std::numeric_limits::infinity()}; } template @@ -87,9 +86,9 @@ static_assert(detail::PointLikeProcessConcept, /// Each run call creates two descendant particles. struct L0PointLikeProcess { template - std::pair generatePathLimits( + std::pair generatePathLimits( generator_t & /*generator*/, const Particle & /*particle*/) const { - return {std::numeric_limits::infinity(), 1.5}; + return {std::numeric_limits::infinity(), 1.5}; } template @@ -129,8 +128,8 @@ BOOST_AUTO_TEST_CASE(Empty) { // w/o processes there should be no selection auto sel = l.armPointLike(f.rng, f.incoming); - BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits::infinity()); - BOOST_CHECK_EQUAL(sel.l0Limit, std::numeric_limits::infinity()); + BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits::infinity()); + BOOST_CHECK_EQUAL(sel.l0Limit, std::numeric_limits::infinity()); BOOST_CHECK_EQUAL(sel.x0Process, std::numeric_limits::max()); BOOST_CHECK_EQUAL(sel.l0Process, std::numeric_limits::max()); @@ -179,7 +178,7 @@ BOOST_AUTO_TEST_CASE(PointLikeX0) { // w/o processes the list should never abort auto sel = l.armPointLike(f.rng, f.incoming); BOOST_CHECK_EQUAL(sel.x0Limit, 0.5); - BOOST_CHECK_EQUAL(sel.l0Limit, std::numeric_limits::infinity()); + BOOST_CHECK_EQUAL(sel.l0Limit, std::numeric_limits::infinity()); BOOST_CHECK_EQUAL(sel.x0Process, 0u); BOOST_CHECK_EQUAL(sel.l0Process, std::numeric_limits::max()); @@ -198,7 +197,7 @@ BOOST_AUTO_TEST_CASE(PointLikeL0) { // w/o processes the list should never abort auto sel = l.armPointLike(f.rng, f.incoming); - BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits::infinity()); + BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits::infinity()); BOOST_CHECK_EQUAL(sel.l0Limit, 1.5); BOOST_CHECK_EQUAL(sel.x0Process, std::numeric_limits::max()); BOOST_CHECK_EQUAL(sel.l0Process, 0u); @@ -253,7 +252,7 @@ BOOST_AUTO_TEST_CASE(Disable) { l.disable(); { auto sel = l.armPointLike(f.rng, f.incoming); - BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits::infinity()); + BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits::infinity()); BOOST_CHECK_EQUAL(sel.l0Limit, 1.5); BOOST_CHECK_EQUAL(sel.x0Process, std::numeric_limits::max()); BOOST_CHECK_EQUAL(sel.l0Process, 3u); @@ -271,8 +270,8 @@ BOOST_AUTO_TEST_CASE(Disable) { l.disable(); { auto sel = l.armPointLike(f.rng, f.incoming); - BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits::infinity()); - BOOST_CHECK_EQUAL(sel.l0Limit, std::numeric_limits::infinity()); + BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits::infinity()); + BOOST_CHECK_EQUAL(sel.l0Limit, std::numeric_limits::infinity()); BOOST_CHECK_EQUAL(sel.x0Process, std::numeric_limits::max()); BOOST_CHECK_EQUAL(sel.l0Process, std::numeric_limits::max()); diff --git a/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp b/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp index 3306c5702d6..c31f33547e0 100644 --- a/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp +++ b/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp @@ -44,15 +44,15 @@ using namespace ActsFatras; namespace { -constexpr auto tol = 4 * std::numeric_limits::epsilon(); -constexpr auto inf = std::numeric_limits::infinity(); +constexpr auto tol = 4 * std::numeric_limits::epsilon(); +constexpr auto inf = std::numeric_limits::infinity(); struct MockDecay { - Particle::Scalar properTimeLimit = inf; + double properTimeLimit = inf; template - constexpr Particle::Scalar generateProperTimeLimit( - generator_t & /*generator*/, const Particle &particle) const { + constexpr double generateProperTimeLimit(generator_t & /*generator*/, + const Particle &particle) const { return particle.properTime() + properTimeLimit; } template @@ -97,26 +97,21 @@ struct MockInteractionList { }; struct MockStepperState { - using Scalar = Acts::ActsScalar; - using Vector3 = Acts::ActsVector<3>; - - Vector3 pos = Vector3::Zero(); - Scalar time = 0; - Vector3 dir = Vector3::Zero(); - Scalar p = 0; + Acts::Vector3 pos = Acts::Vector3::Zero(); + double time = 0; + Acts::Vector3 dir = Acts::Vector3::Zero(); + double p = 0; }; struct MockStepper { using State = MockStepperState; - using Scalar = MockStepperState::Scalar; - using Vector3 = MockStepperState::Vector3; auto position(const State &state) const { return state.pos; } auto time(const State &state) const { return state.time; } auto direction(const State &state) const { return state.dir; } auto absoluteMomentum(const State &state) const { return state.p; } - void update(State &state, const Vector3 &pos, const Vector3 &dir, Scalar qop, - Scalar time) { + void update(State &state, const Acts::Vector3 &pos, const Acts::Vector3 &dir, + double qop, double time) { state.pos = pos; state.time = time; state.dir = dir; @@ -181,10 +176,10 @@ struct Fixture { Barcode pid = Barcode().setVertexPrimary(12u).setParticle(3u); ProcessType proc = ProcessType::eUndefined; Acts::PdgParticle pdg = Acts::PdgParticle::eProton; - Particle::Scalar q = 1_e; - Particle::Scalar m = 1_GeV; - Particle::Scalar p = 1_GeV; - Particle::Scalar e; + double q = 1_e; + double m = 1_GeV; + double p = 1_GeV; + double e; Generator generator; std::shared_ptr surface; Actor actor; diff --git a/Tests/UnitTests/Fatras/Physics/PhotonConversionTests.cpp b/Tests/UnitTests/Fatras/Physics/PhotonConversionTests.cpp index f5340ab4cc7..3b7d6fe1b1c 100644 --- a/Tests/UnitTests/Fatras/Physics/PhotonConversionTests.cpp +++ b/Tests/UnitTests/Fatras/Physics/PhotonConversionTests.cpp @@ -32,7 +32,6 @@ BOOST_AUTO_TEST_SUITE(FatrasPhotonConversion) BOOST_DATA_TEST_CASE(NoPhoton, Dataset::parametersPhotonConversion, phi, theta, seed) { - using Scalar = ActsFatras::PhotonConversion::Scalar; using namespace Acts::UnitLiterals; Generator gen(seed); @@ -45,10 +44,10 @@ BOOST_DATA_TEST_CASE(NoPhoton, Dataset::parametersPhotonConversion, phi, theta, ActsFatras::PhotonConversion pc; // No limits should be set - std::pair limits; + std::pair limits; limits = pc.generatePathLimits(gen, particle); - BOOST_CHECK_EQUAL(limits.first, std::numeric_limits::infinity()); - BOOST_CHECK_EQUAL(limits.second, std::numeric_limits::infinity()); + BOOST_CHECK_EQUAL(limits.first, std::numeric_limits::infinity()); + BOOST_CHECK_EQUAL(limits.second, std::numeric_limits::infinity()); // No particles should be generated std::vector generated; @@ -65,7 +64,6 @@ BOOST_DATA_TEST_CASE(NoPhoton, Dataset::parametersPhotonConversion, phi, theta, BOOST_DATA_TEST_CASE(DeadPhoton, Dataset::parametersPhotonConversion, phi, theta, seed) { - using Scalar = ActsFatras::PhotonConversion::Scalar; using namespace Acts::UnitLiterals; Generator gen(seed); @@ -78,9 +76,9 @@ BOOST_DATA_TEST_CASE(DeadPhoton, Dataset::parametersPhotonConversion, phi, ActsFatras::PhotonConversion pc; // No limits should be set - momentum too low - std::pair limits = pc.generatePathLimits(gen, particle); - BOOST_CHECK_EQUAL(limits.first, std::numeric_limits::infinity()); - BOOST_CHECK_EQUAL(limits.second, std::numeric_limits::infinity()); + std::pair limits = pc.generatePathLimits(gen, particle); + BOOST_CHECK_EQUAL(limits.first, std::numeric_limits::infinity()); + BOOST_CHECK_EQUAL(limits.second, std::numeric_limits::infinity()); // No particles should be generated - momentum too low std::vector generated; @@ -97,7 +95,6 @@ BOOST_DATA_TEST_CASE(DeadPhoton, Dataset::parametersPhotonConversion, phi, BOOST_DATA_TEST_CASE(LowMomentumPhoton, Dataset::parametersPhotonConversion, phi, theta, seed) { - using Scalar = ActsFatras::PhotonConversion::Scalar; using namespace Acts::UnitLiterals; Generator gen(seed); @@ -110,9 +107,9 @@ BOOST_DATA_TEST_CASE(LowMomentumPhoton, Dataset::parametersPhotonConversion, ActsFatras::PhotonConversion pc; // No limits should be set - momentum too low - std::pair limits = pc.generatePathLimits(gen, particle); - BOOST_CHECK_EQUAL(limits.first, std::numeric_limits::infinity()); - BOOST_CHECK_EQUAL(limits.second, std::numeric_limits::infinity()); + std::pair limits = pc.generatePathLimits(gen, particle); + BOOST_CHECK_EQUAL(limits.first, std::numeric_limits::infinity()); + BOOST_CHECK_EQUAL(limits.second, std::numeric_limits::infinity()); // No particles should be generated - momentum too low std::vector generated; @@ -129,7 +126,6 @@ BOOST_DATA_TEST_CASE(LowMomentumPhoton, Dataset::parametersPhotonConversion, BOOST_DATA_TEST_CASE(HighMomentumPhoton, Dataset::parametersPhotonConversion, phi, theta, seed) { - using Scalar = ActsFatras::PhotonConversion::Scalar; using namespace Acts::UnitLiterals; Generator gen(seed); @@ -142,9 +138,9 @@ BOOST_DATA_TEST_CASE(HighMomentumPhoton, Dataset::parametersPhotonConversion, ActsFatras::PhotonConversion pc; // No limits should be set - momentum too low - std::pair limits = pc.generatePathLimits(gen, particle); - BOOST_CHECK_NE(limits.first, std::numeric_limits::infinity()); - BOOST_CHECK_EQUAL(limits.second, std::numeric_limits::infinity()); + std::pair limits = pc.generatePathLimits(gen, particle); + BOOST_CHECK_NE(limits.first, std::numeric_limits::infinity()); + BOOST_CHECK_EQUAL(limits.second, std::numeric_limits::infinity()); // No particles should be generated - momentum too low std::vector generated; From c5391bec86cd97573fdbfce7edd1d6997fa4ad43 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Mon, 25 Nov 2024 13:01:21 +0100 Subject: [PATCH 7/7] chore!: Clean some Material code (#3897) Accumulated changed from https://github.com/acts-project/acts/pull/3862 - use namespaces in source files - remove operator overloads (breaking) - move some implementations to source --- .../Acts/Material/BinnedSurfaceMaterial.hpp | 8 ++-- .../Acts/Material/GridSurfaceMaterial.hpp | 14 +++---- .../Material/HomogeneousSurfaceMaterial.hpp | 41 ++++++++----------- .../Material/HomogeneousVolumeMaterial.hpp | 31 +++++++------- .../Acts/Material/ISurfaceMaterial.hpp | 17 ++++---- Core/include/Acts/Material/Material.hpp | 14 +++++-- Core/include/Acts/Material/MaterialSlab.hpp | 9 ++++ .../Acts/Material/ProtoSurfaceMaterial.hpp | 5 +-- Core/src/Material/BinnedSurfaceMaterial.cpp | 5 +-- .../Material/HomogeneousSurfaceMaterial.cpp | 31 ++++++++++---- .../Material/HomogeneousVolumeMaterial.cpp | 17 +++++--- Core/src/Material/Material.cpp | 30 ++++++++------ Core/src/Material/MaterialSlab.cpp | 1 - .../Io/Root/src/RootMaterialTrackWriter.cpp | 3 -- .../Plugins/Json/MaterialJsonConverter.hpp | 2 +- .../Material/GridSurfaceMaterialTests.cpp | 8 ++-- .../HomogeneousSurfaceMaterialTests.cpp | 2 +- .../Core/Material/ISurfaceMaterialTests.cpp | 3 +- 18 files changed, 131 insertions(+), 110 deletions(-) diff --git a/Core/include/Acts/Material/BinnedSurfaceMaterial.hpp b/Core/include/Acts/Material/BinnedSurfaceMaterial.hpp index 97d3347c9e1..d5534803d08 100644 --- a/Core/include/Acts/Material/BinnedSurfaceMaterial.hpp +++ b/Core/include/Acts/Material/BinnedSurfaceMaterial.hpp @@ -13,9 +13,7 @@ #include "Acts/Material/MaterialSlab.hpp" #include "Acts/Utilities/BinUtility.hpp" -#include #include -#include namespace Acts { @@ -83,10 +81,10 @@ class BinnedSurfaceMaterial : public ISurfaceMaterial { /// Destructor ~BinnedSurfaceMaterial() override = default; - /// Scale operator + /// Scale operation /// - /// @param scale is the scale factor for the full material - BinnedSurfaceMaterial& operator*=(double scale) final; + /// @param factor is the scale factor for the full material + BinnedSurfaceMaterial& scale(double factor) final; /// Return the BinUtility const BinUtility& binUtility() const; diff --git a/Core/include/Acts/Material/GridSurfaceMaterial.hpp b/Core/include/Acts/Material/GridSurfaceMaterial.hpp index 6c2d6045ca2..d27912c85f3 100644 --- a/Core/include/Acts/Material/GridSurfaceMaterial.hpp +++ b/Core/include/Acts/Material/GridSurfaceMaterial.hpp @@ -11,10 +11,8 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Material/ISurfaceMaterial.hpp" #include "Acts/Material/MaterialSlab.hpp" -#include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Delegate.hpp" #include "Acts/Utilities/GridAccessHelpers.hpp" -#include "Acts/Utilities/VectorHelpers.hpp" #include #include @@ -44,7 +42,7 @@ struct GridMaterialAccessor { /// /// @note this is not particularly fast template - void scale(grid_type& grid, ActsScalar scale) { + void scale(grid_type& grid, double scale) { // Loop through the grid bins, get the indices and scale the material for (std::size_t ib = 0; ib < grid.size(); ++ib) { grid.at(ib).scaleThickness(scale); @@ -74,7 +72,7 @@ struct IndexedMaterialAccessor { /// /// @param scale the amount of the scaling template - void scale(grid_type& /*grid*/, ActsScalar scale) { + void scale(grid_type& /*grid*/, double scale) { for (auto& m : material) { m.scaleThickness(scale); } @@ -118,7 +116,7 @@ struct GloballyIndexedMaterialAccessor { /// outcome is unpredictable. /// template - void scale(grid_type& grid, ActsScalar scale) { + void scale(grid_type& grid, double scale) { if (sharedEntries) { throw std::invalid_argument( "GloballyIndexedMaterialAccessor: shared entry scaling is not " @@ -197,9 +195,9 @@ class GridSurfaceMaterialT : public ISurfaceMaterial { /// Scale operator /// - /// @param scale is the scale factor applied - ISurfaceMaterial& operator*=(ActsScalar scale) final { - m_materialAccessor.scale(m_grid, scale); + /// @param factor is the scale factor applied + ISurfaceMaterial& scale(double factor) final { + m_materialAccessor.scale(m_grid, factor); return (*this); } diff --git a/Core/include/Acts/Material/HomogeneousSurfaceMaterial.hpp b/Core/include/Acts/Material/HomogeneousSurfaceMaterial.hpp index 1ea14e632ac..37cad2a18d6 100644 --- a/Core/include/Acts/Material/HomogeneousSurfaceMaterial.hpp +++ b/Core/include/Acts/Material/HomogeneousSurfaceMaterial.hpp @@ -12,7 +12,6 @@ #include "Acts/Material/ISurfaceMaterial.hpp" #include "Acts/Material/MaterialSlab.hpp" -#include #include namespace Acts { @@ -62,13 +61,8 @@ class HomogeneousSurfaceMaterial : public ISurfaceMaterial { /// Scale operator /// - it is effectively a thickness scaling /// - /// @param scale is the scale factor - HomogeneousSurfaceMaterial& operator*=(double scale) final; - - /// Equality operator - /// - /// @param hsm is the source material - bool operator==(const HomogeneousSurfaceMaterial& hsm) const; + /// @param factor is the scale factor + HomogeneousSurfaceMaterial& scale(double factor) final; /// @copydoc ISurfaceMaterial::materialSlab(const Vector2&) const /// @@ -94,22 +88,21 @@ class HomogeneousSurfaceMaterial : public ISurfaceMaterial { private: /// The five different MaterialSlab - MaterialSlab m_fullMaterial = MaterialSlab(); -}; - -inline const MaterialSlab& HomogeneousSurfaceMaterial::materialSlab( - const Vector2& /*lp*/) const { - return (m_fullMaterial); -} + MaterialSlab m_fullMaterial; -inline const MaterialSlab& HomogeneousSurfaceMaterial::materialSlab( - const Vector3& /*gp*/) const { - return (m_fullMaterial); -} - -inline bool HomogeneousSurfaceMaterial::operator==( - const HomogeneousSurfaceMaterial& hsm) const { - return (m_fullMaterial == hsm.m_fullMaterial); -} + /// @brief Check if two materials are exactly equal. + /// + /// This is a strict equality check, i.e. the materials must have identical + /// properties. + /// + /// @param lhs is the left hand side material + /// @param rhs is the right hand side material + /// + /// @return true if the materials are equal + friend constexpr bool operator==(const HomogeneousSurfaceMaterial& lhs, + const HomogeneousSurfaceMaterial& rhs) { + return lhs.m_fullMaterial == rhs.m_fullMaterial; + } +}; } // namespace Acts diff --git a/Core/include/Acts/Material/HomogeneousVolumeMaterial.hpp b/Core/include/Acts/Material/HomogeneousVolumeMaterial.hpp index 91005dcae55..2034387e764 100644 --- a/Core/include/Acts/Material/HomogeneousVolumeMaterial.hpp +++ b/Core/include/Acts/Material/HomogeneousVolumeMaterial.hpp @@ -46,11 +46,6 @@ class HomogeneousVolumeMaterial : public IVolumeMaterial { HomogeneousVolumeMaterial& operator=(const HomogeneousVolumeMaterial& hvm) = default; - /// Equality operator - /// - /// @param hvm is the source material - bool operator==(const HomogeneousVolumeMaterial& hvm) const; - /// Access to actual material /// /// @param position is the request position for the material call @@ -64,17 +59,21 @@ class HomogeneousVolumeMaterial : public IVolumeMaterial { std::ostream& toStream(std::ostream& sl) const final; private: - Material m_material = Material(); -}; - -inline const Material HomogeneousVolumeMaterial::material( - const Vector3& /*position*/) const { - return (m_material); -} + Material m_material; -inline bool HomogeneousVolumeMaterial::operator==( - const HomogeneousVolumeMaterial& hvm) const { - return (m_material == hvm.m_material); -} + /// @brief Check if two materials are exactly equal. + /// + /// This is a strict equality check, i.e. the materials must have identical + /// properties. + /// + /// @param lhs is the left hand side material + /// @param rhs is the right hand side material + /// + /// @return true if the materials are equal + friend constexpr bool operator==(const HomogeneousVolumeMaterial& lhs, + const HomogeneousVolumeMaterial& rhs) { + return lhs.m_material == rhs.m_material; + } +}; } // namespace Acts diff --git a/Core/include/Acts/Material/ISurfaceMaterial.hpp b/Core/include/Acts/Material/ISurfaceMaterial.hpp index a379e18e715..cad6832441a 100644 --- a/Core/include/Acts/Material/ISurfaceMaterial.hpp +++ b/Core/include/Acts/Material/ISurfaceMaterial.hpp @@ -11,12 +11,9 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Common.hpp" #include "Acts/Definitions/Direction.hpp" -#include "Acts/Geometry/GeometryIdentifier.hpp" #include "Acts/Material/MaterialSlab.hpp" -#include #include -#include namespace Acts { @@ -50,10 +47,10 @@ class ISurfaceMaterial { /// Destructor virtual ~ISurfaceMaterial() = default; - /// Scale operator + /// Scale material /// - /// @param scale is the scale factor applied - virtual ISurfaceMaterial& operator*=(double scale) = 0; + /// @param factor is the scale factor applied + virtual ISurfaceMaterial& scale(double factor) = 0; /// Return method for full material description of the Surface /// - from local coordinate on the surface @@ -128,9 +125,11 @@ class ISurfaceMaterial { } protected: - double m_splitFactor{1.}; //!< the split factor in favour of oppositePre - MappingType m_mappingType{ - Acts::MappingType::Default}; //!< Use the default mapping type by default + /// the split factor in favour of oppositePre + double m_splitFactor{1.}; + + /// Use the default mapping type by default + MappingType m_mappingType{Acts::MappingType::Default}; }; inline double ISurfaceMaterial::factor(Direction pDir, diff --git a/Core/include/Acts/Material/Material.hpp b/Core/include/Acts/Material/Material.hpp index ae42e08cf68..1caf59e97ec 100644 --- a/Core/include/Acts/Material/Material.hpp +++ b/Core/include/Acts/Material/Material.hpp @@ -8,11 +8,10 @@ #pragma once -#include "Acts/Definitions/Algebra.hpp" - #include #include -#include + +#include namespace Acts { @@ -112,6 +111,15 @@ class Material { float m_z = 0.0f; float m_molarRho = 0.0f; + /// @brief Check if two materials are exactly equal. + /// + /// This is a strict equality check, i.e. the materials must have identical + /// properties. + /// + /// @param lhs is the left hand side material + /// @param rhs is the right hand side material + /// + /// @return true if the materials are equal friend constexpr bool operator==(const Material& lhs, const Material& rhs) { return (lhs.m_x0 == rhs.m_x0) && (lhs.m_l0 == rhs.m_l0) && (lhs.m_ar == rhs.m_ar) && (lhs.m_z == rhs.m_z) && diff --git a/Core/include/Acts/Material/MaterialSlab.hpp b/Core/include/Acts/Material/MaterialSlab.hpp index 71c56c1a154..63fd7378e8b 100644 --- a/Core/include/Acts/Material/MaterialSlab.hpp +++ b/Core/include/Acts/Material/MaterialSlab.hpp @@ -79,6 +79,15 @@ class MaterialSlab { float m_thicknessInX0 = 0.0f; float m_thicknessInL0 = 0.0f; + /// @brief Check if two materials are exactly equal. + /// + /// This is a strict equality check, i.e. the materials must have identical + /// properties. + /// + /// @param lhs is the left hand side material + /// @param rhs is the right hand side material + /// + /// @return true if the materials are equal friend constexpr bool operator==(const MaterialSlab& lhs, const MaterialSlab& rhs) { // t/X0 and t/L0 are dependent variables and need not be checked diff --git a/Core/include/Acts/Material/ProtoSurfaceMaterial.hpp b/Core/include/Acts/Material/ProtoSurfaceMaterial.hpp index 58dee9d01c7..8b6dfed3287 100644 --- a/Core/include/Acts/Material/ProtoSurfaceMaterial.hpp +++ b/Core/include/Acts/Material/ProtoSurfaceMaterial.hpp @@ -14,7 +14,6 @@ #include "Acts/Material/MaterialSlab.hpp" #include "Acts/Utilities/BinUtility.hpp" -#include #include namespace Acts { @@ -67,9 +66,9 @@ class ProtoSurfaceMaterialT : public ISurfaceMaterial { ProtoSurfaceMaterialT& operator=( ProtoSurfaceMaterialT&& smproxy) = default; - /// Scale operator - dummy implementation + /// Scale operation - dummy implementation /// - ProtoSurfaceMaterialT& operator*=(double /*scale*/) final { + ProtoSurfaceMaterialT& scale(double /*factor*/) final { return (*this); } diff --git a/Core/src/Material/BinnedSurfaceMaterial.cpp b/Core/src/Material/BinnedSurfaceMaterial.cpp index 0113e89a6e3..aae46bd02d7 100644 --- a/Core/src/Material/BinnedSurfaceMaterial.cpp +++ b/Core/src/Material/BinnedSurfaceMaterial.cpp @@ -29,11 +29,10 @@ Acts::BinnedSurfaceMaterial::BinnedSurfaceMaterial( m_binUtility(binUtility), m_fullMaterial(std::move(fullProperties)) {} -Acts::BinnedSurfaceMaterial& Acts::BinnedSurfaceMaterial::operator*=( - double scale) { +Acts::BinnedSurfaceMaterial& Acts::BinnedSurfaceMaterial::scale(double factor) { for (auto& materialVector : m_fullMaterial) { for (auto& materialBin : materialVector) { - materialBin.scaleThickness(scale); + materialBin.scaleThickness(factor); } } return (*this); diff --git a/Core/src/Material/HomogeneousSurfaceMaterial.cpp b/Core/src/Material/HomogeneousSurfaceMaterial.cpp index ec56cfd4c81..c3bef1f9de3 100644 --- a/Core/src/Material/HomogeneousSurfaceMaterial.cpp +++ b/Core/src/Material/HomogeneousSurfaceMaterial.cpp @@ -12,20 +12,33 @@ #include -Acts::HomogeneousSurfaceMaterial::HomogeneousSurfaceMaterial( - const MaterialSlab& full, double splitFactor, Acts::MappingType mappingType) +namespace Acts { + +HomogeneousSurfaceMaterial::HomogeneousSurfaceMaterial(const MaterialSlab& full, + double splitFactor, + MappingType mappingType) : ISurfaceMaterial(splitFactor, mappingType), m_fullMaterial(full) {} -Acts::HomogeneousSurfaceMaterial& Acts::HomogeneousSurfaceMaterial::operator*=( - double scale) { - m_fullMaterial.scaleThickness(scale); - return (*this); +HomogeneousSurfaceMaterial& HomogeneousSurfaceMaterial::scale(double factor) { + m_fullMaterial.scaleThickness(factor); + return *this; +} + +const MaterialSlab& HomogeneousSurfaceMaterial::materialSlab( + const Vector2& /*lp*/) const { + return m_fullMaterial; } -std::ostream& Acts::HomogeneousSurfaceMaterial::toStream( - std::ostream& sl) const { - sl << "Acts::HomogeneousSurfaceMaterial : " << std::endl; +const MaterialSlab& HomogeneousSurfaceMaterial::materialSlab( + const Vector3& /*gp*/) const { + return m_fullMaterial; +} + +std::ostream& HomogeneousSurfaceMaterial::toStream(std::ostream& sl) const { + sl << "HomogeneousSurfaceMaterial : " << std::endl; sl << " - fullMaterial : " << m_fullMaterial << std::endl; sl << " - split factor : " << m_splitFactor << std::endl; return sl; } + +} // namespace Acts diff --git a/Core/src/Material/HomogeneousVolumeMaterial.cpp b/Core/src/Material/HomogeneousVolumeMaterial.cpp index 574859bb648..a5ea578f0ce 100644 --- a/Core/src/Material/HomogeneousVolumeMaterial.cpp +++ b/Core/src/Material/HomogeneousVolumeMaterial.cpp @@ -12,13 +12,20 @@ #include -Acts::HomogeneousVolumeMaterial::HomogeneousVolumeMaterial( - const Material& material) +namespace Acts { + +HomogeneousVolumeMaterial::HomogeneousVolumeMaterial(const Material& material) : m_material(material) {} -std::ostream& Acts::HomogeneousVolumeMaterial::toStream( - std::ostream& sl) const { - sl << "Acts::HomogeneousVolumeMaterial : " << std::endl; +const Material HomogeneousVolumeMaterial::material( + const Vector3& /*position*/) const { + return m_material; +} + +std::ostream& HomogeneousVolumeMaterial::toStream(std::ostream& sl) const { + sl << "HomogeneousVolumeMaterial : " << std::endl; sl << " - material : " << m_material << std::endl; return sl; } + +} // namespace Acts diff --git a/Core/src/Material/Material.cpp b/Core/src/Material/Material.cpp index dd8c1e5cca1..29d9502fde9 100644 --- a/Core/src/Material/Material.cpp +++ b/Core/src/Material/Material.cpp @@ -13,6 +13,8 @@ #include #include +namespace Acts { + namespace { enum MaterialClassificationNumberIndices { eRadiationLength = 0, @@ -23,12 +25,12 @@ enum MaterialClassificationNumberIndices { }; // Avogadro constant -constexpr double kAvogadro = 6.02214076e23 / Acts::UnitConstants::mol; +constexpr double kAvogadro = 6.02214076e23 / UnitConstants::mol; } // namespace -Acts::Material Acts::Material::fromMassDensity(float x0, float l0, float ar, - float z, float massRho) { - using namespace Acts::UnitLiterals; +Material Material::fromMassDensity(float x0, float l0, float ar, float z, + float massRho) { + using namespace UnitLiterals; Material mat; mat.m_x0 = x0; @@ -51,8 +53,8 @@ Acts::Material Acts::Material::fromMassDensity(float x0, float l0, float ar, return mat; } -Acts::Material Acts::Material::fromMolarDensity(float x0, float l0, float ar, - float z, float molarRho) { +Material Material::fromMolarDensity(float x0, float l0, float ar, float z, + float molarRho) { Material mat; mat.m_x0 = x0; mat.m_l0 = l0; @@ -62,15 +64,15 @@ Acts::Material Acts::Material::fromMolarDensity(float x0, float l0, float ar, return mat; } -Acts::Material::Material(const ParametersVector& parameters) +Material::Material(const ParametersVector& parameters) : m_x0(parameters[eRadiationLength]), m_l0(parameters[eInteractionLength]), m_ar(parameters[eRelativeAtomicMass]), m_z(parameters[eNuclearCharge]), m_molarRho(parameters[eMolarDensity]) {} -float Acts::Material::massDensity() const { - using namespace Acts::UnitLiterals; +float Material::massDensity() const { + using namespace UnitLiterals; // perform computations in double precision to avoid loss of precision const double atomicMass = static_cast(m_ar) * 1_u; @@ -78,14 +80,14 @@ float Acts::Material::massDensity() const { return atomicMass * numberDensity; } -float Acts::Material::meanExcitationEnergy() const { - using namespace Acts::UnitLiterals; +float Material::meanExcitationEnergy() const { + using namespace UnitLiterals; // use approximative computation as defined in ATL-SOFT-PUB-2008-003 return 16_eV * std::pow(m_z, 0.9f); } -Acts::Material::ParametersVector Acts::Material::parameters() const { +Material::ParametersVector Material::parameters() const { ParametersVector parameters; parameters[eRadiationLength] = m_x0; parameters[eInteractionLength] = m_l0; @@ -95,7 +97,7 @@ Acts::Material::ParametersVector Acts::Material::parameters() const { return parameters; } -std::ostream& Acts::operator<<(std::ostream& os, const Material& material) { +std::ostream& operator<<(std::ostream& os, const Material& material) { if (!material.isValid()) { os << "vacuum"; } else { @@ -107,3 +109,5 @@ std::ostream& Acts::operator<<(std::ostream& os, const Material& material) { } return os; } + +} // namespace Acts diff --git a/Core/src/Material/MaterialSlab.cpp b/Core/src/Material/MaterialSlab.cpp index acfd7064936..4fad731c6c1 100644 --- a/Core/src/Material/MaterialSlab.cpp +++ b/Core/src/Material/MaterialSlab.cpp @@ -11,7 +11,6 @@ #include "Acts/Material/detail/AverageMaterials.hpp" #include -#include #include #include diff --git a/Examples/Io/Root/src/RootMaterialTrackWriter.cpp b/Examples/Io/Root/src/RootMaterialTrackWriter.cpp index a7a5ee39f8c..bec096d2ca7 100644 --- a/Examples/Io/Root/src/RootMaterialTrackWriter.cpp +++ b/Examples/Io/Root/src/RootMaterialTrackWriter.cpp @@ -10,7 +10,6 @@ #include "Acts/Geometry/GeometryIdentifier.hpp" #include "Acts/Geometry/TrackingVolume.hpp" -#include "Acts/Geometry/Volume.hpp" #include "Acts/Material/Material.hpp" #include "Acts/Material/MaterialInteraction.hpp" #include "Acts/Material/MaterialSlab.hpp" @@ -23,11 +22,9 @@ #include "Acts/Utilities/VectorHelpers.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" -#include #include #include #include -#include #include #include diff --git a/Plugins/Json/include/Acts/Plugins/Json/MaterialJsonConverter.hpp b/Plugins/Json/include/Acts/Plugins/Json/MaterialJsonConverter.hpp index 1c49376e421..3aa1ddac0af 100644 --- a/Plugins/Json/include/Acts/Plugins/Json/MaterialJsonConverter.hpp +++ b/Plugins/Json/include/Acts/Plugins/Json/MaterialJsonConverter.hpp @@ -8,7 +8,6 @@ #pragma once -#include "Acts/Definitions/Algebra.hpp" #include "Acts/Material/ISurfaceMaterial.hpp" #include "Acts/Material/IVolumeMaterial.hpp" #include "Acts/Material/Material.hpp" @@ -21,6 +20,7 @@ // can not match our naming guidelines. namespace Acts { +class Surface; class ISurfaceMaterial; class IVolumeMaterial; class BinUtility; diff --git a/Tests/UnitTests/Core/Material/GridSurfaceMaterialTests.cpp b/Tests/UnitTests/Core/Material/GridSurfaceMaterialTests.cpp index fbce80b8d5e..c66df1d6027 100644 --- a/Tests/UnitTests/Core/Material/GridSurfaceMaterialTests.cpp +++ b/Tests/UnitTests/Core/Material/GridSurfaceMaterialTests.cpp @@ -178,7 +178,7 @@ BOOST_AUTO_TEST_CASE(GridIndexedMaterial1D) { BOOST_CHECK_EQUAL(ml4.material().X0(), 21.); // Now scale it - and access again - ism *= 2.; + ism.scale(2.); const Acts::MaterialSlab& sml0 = ism.materialSlab(l0); const Acts::MaterialSlab& sml1 = ism.materialSlab(l1); const Acts::MaterialSlab& sml2 = ism.materialSlab(l2); @@ -337,7 +337,7 @@ BOOST_AUTO_TEST_CASE(GridGloballyIndexedMaterialNonShared) { BOOST_CHECK_EQUAL(ml0g1.material().X0(), 31.); // Scale - ism1 *= 2.; + ism1.scale(2.); const Acts::MaterialSlab& sml0g1 = ism1.materialSlab(l0g1); BOOST_CHECK_EQUAL(sml0g1.thickness(), 8.); @@ -400,7 +400,7 @@ BOOST_AUTO_TEST_CASE(GridGloballyIndexedMaterialShared) { BOOST_CHECK_EQUAL(ml0g1.material().X0(), 1.); // scaling shared material should throw a std::invalid_argument - BOOST_CHECK_THROW(ism1 *= 2., std::invalid_argument); + BOOST_CHECK_THROW(ism1.scale(2.), std::invalid_argument); } // This test covers the grid material (non-indexed accessor) @@ -472,7 +472,7 @@ BOOST_AUTO_TEST_CASE(GridSurfaceMaterialTests) { BOOST_CHECK_EQUAL(ml4.thickness(), 4.); // Now scale it - and access again - gsm *= 2.; + gsm.scale(2.); const Acts::MaterialSlab& sml0 = gsm.materialSlab(l0); const Acts::MaterialSlab& sml1 = gsm.materialSlab(l1); diff --git a/Tests/UnitTests/Core/Material/HomogeneousSurfaceMaterialTests.cpp b/Tests/UnitTests/Core/Material/HomogeneousSurfaceMaterialTests.cpp index 7c310b7c11a..10db0c4b689 100644 --- a/Tests/UnitTests/Core/Material/HomogeneousSurfaceMaterialTests.cpp +++ b/Tests/UnitTests/Core/Material/HomogeneousSurfaceMaterialTests.cpp @@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(HomogeneousSurfaceMaterial_scaling_test) { matHalf.scaleThickness(0.5); HomogeneousSurfaceMaterial hsm(mat, 1.); - hsm *= 0.5; + hsm.scale(0.5); auto matBin = hsm.materialSlab(Vector3(0., 0., 0.)); diff --git a/Tests/UnitTests/Core/Material/ISurfaceMaterialTests.cpp b/Tests/UnitTests/Core/Material/ISurfaceMaterialTests.cpp index 067e460b71f..1bdb2cef716 100644 --- a/Tests/UnitTests/Core/Material/ISurfaceMaterialTests.cpp +++ b/Tests/UnitTests/Core/Material/ISurfaceMaterialTests.cpp @@ -14,7 +14,6 @@ #include "Acts/Material/ISurfaceMaterial.hpp" #include "Acts/Material/MaterialSlab.hpp" -#include #include namespace Acts::Test { @@ -22,7 +21,7 @@ namespace Acts::Test { class SurfaceMaterialStub : public ISurfaceMaterial { using ISurfaceMaterial::ISurfaceMaterial; - ISurfaceMaterial& operator*=(double /*scale*/) override { return *this; }; + ISurfaceMaterial& scale(double /*factor*/) override { return *this; }; const MaterialSlab& materialSlab(const Vector2& /*lp*/) const override { return m_fullMaterial;