From 7d5b7011db7d3b433aeccc5e4f4051b0b558dc73 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Sat, 16 Nov 2024 13:19:15 +0100 Subject: [PATCH] implement --- .../Acts/Navigation/DetectorNavigator.hpp | 4 +++ Core/include/Acts/Propagator/AtlasStepper.hpp | 4 +++ .../Acts/Propagator/DirectNavigator.hpp | 4 +++ Core/include/Acts/Propagator/EigenStepper.hpp | 5 ++- Core/include/Acts/Propagator/EigenStepper.ipp | 23 +++++++++--- .../Acts/Propagator/MultiEigenStepperLoop.hpp | 4 +++ Core/include/Acts/Propagator/Navigator.hpp | 11 +++--- .../Acts/Propagator/NavigatorStatistics.hpp | 22 ++---------- Core/include/Acts/Propagator/Propagator.ipp | 6 ++-- .../Acts/Propagator/PropagatorResult.hpp | 1 + .../Acts/Propagator/StepperStatistics.hpp | 7 ++-- .../Acts/Propagator/StraightLineStepper.hpp | 14 +++++++- Core/include/Acts/Propagator/SympyStepper.hpp | 12 ++----- .../Acts/Propagator/TryAllNavigator.hpp | 4 +++ .../include/Acts/Propagator/VoidNavigator.hpp | 4 +++ Core/src/Propagator/SympyStepper.cpp | 12 ++++++- .../Propagation/PropagatorInterface.hpp | 2 ++ .../EventData/PropagationSummary.hpp | 4 +++ .../Io/Root/RootPropagationSummaryWriter.hpp | 19 +++++----- .../Root/src/RootPropagationStepsWriter.cpp | 7 ++-- .../Root/src/RootPropagationSummaryWriter.cpp | 36 +++++++++++-------- .../Core/Propagator/SympyStepperTests.cpp | 23 ------------ 22 files changed, 130 insertions(+), 98 deletions(-) diff --git a/Core/include/Acts/Navigation/DetectorNavigator.hpp b/Core/include/Acts/Navigation/DetectorNavigator.hpp index 61d8525106c..0ffcf1446bc 100644 --- a/Core/include/Acts/Navigation/DetectorNavigator.hpp +++ b/Core/include/Acts/Navigation/DetectorNavigator.hpp @@ -17,6 +17,7 @@ #include "Acts/Geometry/Layer.hpp" #include "Acts/Navigation/NavigationState.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" @@ -68,6 +69,9 @@ class DetectorNavigator { bool targetReached = false; /// Navigation state : a break has been detected bool navigationBreak = false; + + /// Navigation statistics + NavigatorStatistics statistics; }; /// Constructor with configuration object diff --git a/Core/include/Acts/Propagator/AtlasStepper.hpp b/Core/include/Acts/Propagator/AtlasStepper.hpp index f31aadbffab..88cfd39e548 100644 --- a/Core/include/Acts/Propagator/AtlasStepper.hpp +++ b/Core/include/Acts/Propagator/AtlasStepper.hpp @@ -21,6 +21,7 @@ #include "Acts/MagneticField/MagneticFieldProvider.hpp" #include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/StepperOptions.hpp" +#include "Acts/Propagator/StepperStatistics.hpp" #include "Acts/Propagator/detail/SteppingHelper.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/Intersection.hpp" @@ -305,6 +306,9 @@ class AtlasStepper { /// buffer & formatting for consistent output std::size_t debugPfxWidth = 30; std::size_t debugMsgWidth = 50; + + /// The statistics of the stepper + StepperStatistics statistics; }; explicit AtlasStepper(std::shared_ptr bField) diff --git a/Core/include/Acts/Propagator/DirectNavigator.hpp b/Core/include/Acts/Propagator/DirectNavigator.hpp index eb9db91e71f..3356ab395c4 100644 --- a/Core/include/Acts/Propagator/DirectNavigator.hpp +++ b/Core/include/Acts/Propagator/DirectNavigator.hpp @@ -14,6 +14,7 @@ #include "Acts/Geometry/TrackingGeometry.hpp" #include "Acts/Geometry/TrackingVolume.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" @@ -75,6 +76,9 @@ class DirectNavigator { /// Navigation state - external interface: a break has been detected bool navigationBreak = false; + /// Navigation statistics + NavigatorStatistics statistics; + const Surface* navSurface() const { return options.surfaces.at(surfaceIndex); } diff --git a/Core/include/Acts/Propagator/EigenStepper.hpp b/Core/include/Acts/Propagator/EigenStepper.hpp index fb1062b0c9b..09df3ce3167 100644 --- a/Core/include/Acts/Propagator/EigenStepper.hpp +++ b/Core/include/Acts/Propagator/EigenStepper.hpp @@ -13,7 +13,6 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Tolerance.hpp" -#include "Acts/Definitions/Units.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp" #include "Acts/Geometry/GeometryContext.hpp" @@ -23,6 +22,7 @@ #include "Acts/Propagator/EigenStepperDefaultExtension.hpp" #include "Acts/Propagator/PropagatorTraits.hpp" #include "Acts/Propagator/StepperOptions.hpp" +#include "Acts/Propagator/StepperStatistics.hpp" #include "Acts/Propagator/detail/SteppingHelper.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/Result.hpp" @@ -164,6 +164,9 @@ class EigenStepper { /// k_i elements of the momenta std::array kQoP{}; } stepData; + + /// Statistics of the stepper + StepperStatistics statistics; }; /// Constructor requires knowledge of the detector's magnetic field diff --git a/Core/include/Acts/Propagator/EigenStepper.ipp b/Core/include/Acts/Propagator/EigenStepper.ipp index 84b305ae431..df2f3793178 100644 --- a/Core/include/Acts/Propagator/EigenStepper.ipp +++ b/Core/include/Acts/Propagator/EigenStepper.ipp @@ -6,6 +6,7 @@ // 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 "Acts/Definitions/Direction.hpp" #include "Acts/EventData/TransformationHelpers.hpp" #include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/EigenStepperError.hpp" @@ -259,7 +260,9 @@ Acts::Result Acts::EigenStepper::step( // Select and adjust the appropriate Runge-Kutta step size as given // ATL-SOFT-PUB-2009-001 while (true) { - nStepTrials++; + ++nStepTrials; + ++state.stepping.statistics.nAttemptedSteps; + auto res = tryRungeKuttaStep(h); if (!res.ok()) { return res.error(); @@ -268,6 +271,8 @@ Acts::Result Acts::EigenStepper::step( break; } + ++state.stepping.statistics.nFailedSteps; + const double stepSizeScaling = calcStepSizeScaling(errorEstimate); h *= stepSizeScaling; @@ -286,6 +291,18 @@ Acts::Result Acts::EigenStepper::step( } } + state.stepping.pathAccumulated += h; + ++state.stepping.nSteps; + state.stepping.nStepTrials += nStepTrials; + + ++state.stepping.statistics.nSuccessfulSteps; + if (state.options.direction != + Direction::fromScalarZeroAsPositive(initialH)) { + ++state.stepping.statistics.nReverseSteps; + } + state.stepping.statistics.pathLength += h; + state.stepping.statistics.absolutePathLength += std::abs(h); + // When doing error propagation, update the associated Jacobian matrix if (state.stepping.covTransport) { // using the direction before updated below @@ -347,10 +364,6 @@ Acts::Result Acts::EigenStepper::step( state.stepping.derivative.template segment<3>(4) = sd.k4; } - state.stepping.pathAccumulated += h; - ++state.stepping.nSteps; - state.stepping.nStepTrials += nStepTrials; - const double stepSizeScaling = calcStepSizeScaling(errorEstimate); const double nextAccuracy = std::abs(h * stepSizeScaling); const double previousAccuracy = std::abs(state.stepping.stepSize.accuracy()); diff --git a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp index 1bb4ab8f55a..e21bdb2365e 100644 --- a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp +++ b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp @@ -25,6 +25,7 @@ #include "Acts/Propagator/MultiStepperError.hpp" #include "Acts/Propagator/Propagator.hpp" #include "Acts/Propagator/StepperOptions.hpp" +#include "Acts/Propagator/StepperStatistics.hpp" #include "Acts/Propagator/detail/LoopStepperUtils.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/Intersection.hpp" @@ -219,6 +220,9 @@ class MultiEigenStepperLoop : public EigenStepper { /// reached a surface std::optional stepCounterAfterFirstComponentOnSurface; + /// The stepper statistics + StepperStatistics statistics; + /// No default constructor is provided State() = delete; diff --git a/Core/include/Acts/Propagator/Navigator.hpp b/Core/include/Acts/Propagator/Navigator.hpp index c2a9427257c..a02e0958160 100644 --- a/Core/include/Acts/Propagator/Navigator.hpp +++ b/Core/include/Acts/Propagator/Navigator.hpp @@ -8,13 +8,13 @@ #pragma once -#include "Acts/Definitions/Units.hpp" #include "Acts/Geometry/GeometryIdentifier.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/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/Logger.hpp" @@ -176,9 +176,12 @@ class Navigator { bool targetReached = false; /// Navigation state : a break has been detected bool navigationBreak = false; - // The navigation stage (@todo: integrate break, target) + /// The navigation stage (@todo: integrate break, target) Stage navigationStage = Stage::undefined; + /// Navigation statistics + NavigatorStatistics statistics; + void reset() { navSurfaces.clear(); navSurfaceIndex = navSurfaces.size(); @@ -427,6 +430,7 @@ class Navigator { << "No targets found, we got lost! Attempt renavigation."); state.navigation.reset(); + ++state.navigation.statistics.nRenavigations; // We might have punched through a boundary and entered another volume // so we have to reinitialize @@ -576,6 +580,7 @@ class Navigator { state.navigation.navBoundaries.clear(); state.navigation.navBoundaryIndex = state.navigation.navBoundaries.size(); + ++state.navigation.statistics.nVolumeSwitches; } } else { // Set the navigation stage back to boundary target @@ -772,8 +777,6 @@ class Navigator { /// @return boolean return triggers exit to stepper template bool targetLayers(propagator_state_t& state, const stepper_t& stepper) const { - using namespace UnitLiterals; - if (state.navigation.navigationBreak) { return false; } diff --git a/Core/include/Acts/Propagator/NavigatorStatistics.hpp b/Core/include/Acts/Propagator/NavigatorStatistics.hpp index 93de87f0cca..84e8a2b2a82 100644 --- a/Core/include/Acts/Propagator/NavigatorStatistics.hpp +++ b/Core/include/Acts/Propagator/NavigatorStatistics.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2024 CERN for the benefit of the Acts project +// Copyright (C) 2016 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/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -16,22 +16,6 @@ struct NavigatorStatistics { std::size_t nRenavigations = 0; std::size_t nVolumeSwitches = 0; - - std::size_t nBoundaryCandidates = 0; - std::size_t nBoundaryHits = 0; - std::size_t nBoundaryDiscards = 0; - - std::size_t nLayerCandidates = 0; - std::size_t nLayerHits = 0; - std::size_t nLayerDiscards = 0; - - std::size_t nSurfaceCandidates = 0; - std::size_t nSurfaceHits = 0; - std::size_t nSurfaceDiscards = 0; - - std::size_t nTotalCandidates = 0; - std::size_t nTotalHits = 0; - std::size_t nTotalDiscards = 0; }; } // namespace Acts diff --git a/Core/include/Acts/Propagator/Propagator.ipp b/Core/include/Acts/Propagator/Propagator.ipp index 86e5a41a96a..9fd7fd2c69f 100644 --- a/Core/include/Acts/Propagator/Propagator.ipp +++ b/Core/include/Acts/Propagator/Propagator.ipp @@ -339,10 +339,8 @@ void Acts::Propagator::moveStateToResult(propagator_state_t& state, result_t& result) const { result.tuple() = std::move(state.tuple()); - result.steps = state.steps; - result.pathLength = state.pathLength; - - result.statistics = state.statistics; + result.statistics.stepping = state.stepping.statistics; + result.statistics.navigation = state.navigation.statistics; } template diff --git a/Core/include/Acts/Propagator/PropagatorResult.hpp b/Core/include/Acts/Propagator/PropagatorResult.hpp index f4ddab6606a..a67543f7b4b 100644 --- a/Core/include/Acts/Propagator/PropagatorResult.hpp +++ b/Core/include/Acts/Propagator/PropagatorResult.hpp @@ -38,6 +38,7 @@ struct PropagatorResult : private detail::Extendable { /// Signed distance over which the parameters were propagated double pathLength = 0.; + /// Propagator statistics PropagatorStatistics statistics; }; diff --git a/Core/include/Acts/Propagator/StepperStatistics.hpp b/Core/include/Acts/Propagator/StepperStatistics.hpp index 75911cb4b83..e22884a8ea1 100644 --- a/Core/include/Acts/Propagator/StepperStatistics.hpp +++ b/Core/include/Acts/Propagator/StepperStatistics.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2024 CERN for the benefit of the Acts project +// Copyright (C) 2016 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/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -16,6 +16,7 @@ struct StepperStatistics { std::size_t nAttemptedSteps = 0; std::size_t nFailedSteps = 0; std::size_t nSuccessfulSteps = 0; + std::size_t nReverseSteps = 0; double pathLength = 0; double absolutePathLength = 0; diff --git a/Core/include/Acts/Propagator/StraightLineStepper.hpp b/Core/include/Acts/Propagator/StraightLineStepper.hpp index 8ba0d72fe81..18904797fdd 100644 --- a/Core/include/Acts/Propagator/StraightLineStepper.hpp +++ b/Core/include/Acts/Propagator/StraightLineStepper.hpp @@ -23,6 +23,7 @@ #include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/PropagatorTraits.hpp" #include "Acts/Propagator/StepperOptions.hpp" +#include "Acts/Propagator/StepperStatistics.hpp" #include "Acts/Propagator/detail/SteppingHelper.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/Surface.hpp" @@ -142,6 +143,9 @@ class StraightLineStepper { // Cache the geometry context of this propagation std::reference_wrapper geoContext; + + /// Statistics of the stepper + StepperStatistics statistics; }; StraightLineStepper() = default; @@ -430,6 +434,7 @@ class StraightLineStepper { Vector3 dir = direction(state.stepping); state.stepping.pars.template segment<3>(eFreePos0) += h * dir; state.stepping.pars[eFreeTime] += h * dtds; + // Propagate the jacobian if (state.stepping.covTransport) { // The step transport matrix in global coordinates @@ -450,7 +455,14 @@ class StraightLineStepper { ++state.stepping.nSteps; ++state.stepping.nStepTrials; - // return h + ++state.stepping.statistics.nAttemptedSteps; + ++state.stepping.statistics.nSuccessfulSteps; + if (state.options.direction != Direction::fromScalarZeroAsPositive(h)) { + ++state.stepping.statistics.nReverseSteps; + } + state.stepping.statistics.pathLength += h; + state.stepping.statistics.absolutePathLength += std::abs(h); + return h; } }; diff --git a/Core/include/Acts/Propagator/SympyStepper.hpp b/Core/include/Acts/Propagator/SympyStepper.hpp index 1e771a53ba7..3b1a2125a41 100644 --- a/Core/include/Acts/Propagator/SympyStepper.hpp +++ b/Core/include/Acts/Propagator/SympyStepper.hpp @@ -22,6 +22,7 @@ #include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/PropagatorTraits.hpp" #include "Acts/Propagator/StepperOptions.hpp" +#include "Acts/Propagator/StepperStatistics.hpp" #include "Acts/Propagator/detail/SteppingHelper.hpp" namespace Acts { @@ -132,15 +133,8 @@ class SympyStepper { /// The geometry context std::reference_wrapper geoContext; - /// @brief Storage of magnetic field and the sub steps during a RKN4 step - struct { - /// Magnetic field evaulations - Vector3 B_first, B_middle, B_last; - /// k_i of the RKN4 algorithm - Vector3 k1, k2, k3, k4; - /// k_i elements of the momenta - std::array kQoP{}; - } stepData; + /// Statistics of the stepper + StepperStatistics statistics; }; /// Constructor requires knowledge of the detector's magnetic field diff --git a/Core/include/Acts/Propagator/TryAllNavigator.hpp b/Core/include/Acts/Propagator/TryAllNavigator.hpp index 83d7cbc64a4..09f6fb25e25 100644 --- a/Core/include/Acts/Propagator/TryAllNavigator.hpp +++ b/Core/include/Acts/Propagator/TryAllNavigator.hpp @@ -14,6 +14,7 @@ #include "Acts/Geometry/TrackingVolume.hpp" #include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/NavigatorOptions.hpp" +#include "Acts/Propagator/NavigatorStatistics.hpp" #include "Acts/Propagator/detail/NavigationHelpers.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/Surface.hpp" @@ -86,6 +87,9 @@ class TryAllNavigatorBase { bool targetReached = false; /// If a break has been detected bool navigationBreak = false; + + /// Navigation statistics + NavigatorStatistics statistics; }; /// Constructor with configuration object diff --git a/Core/include/Acts/Propagator/VoidNavigator.hpp b/Core/include/Acts/Propagator/VoidNavigator.hpp index d6732998d4b..6b461f79210 100644 --- a/Core/include/Acts/Propagator/VoidNavigator.hpp +++ b/Core/include/Acts/Propagator/VoidNavigator.hpp @@ -9,6 +9,7 @@ #pragma once #include "Acts/Propagator/NavigatorOptions.hpp" +#include "Acts/Propagator/NavigatorStatistics.hpp" namespace Acts { class Surface; @@ -30,6 +31,9 @@ struct VoidNavigator { /// @brief Nested State struct, minimal requirement struct State { Options options; + + /// Navigation statistics + NavigatorStatistics statistics; }; State makeState(const Options& options) const { diff --git a/Core/src/Propagator/SympyStepper.cpp b/Core/src/Propagator/SympyStepper.cpp index a33e1f567bb..15fbf2b00de 100644 --- a/Core/src/Propagator/SympyStepper.cpp +++ b/Core/src/Propagator/SympyStepper.cpp @@ -144,7 +144,8 @@ Result SympyStepper::stepImpl( double errorEstimate = 0.; while (true) { - nStepTrials++; + ++nStepTrials; + ++state.statistics.nAttemptedSteps; // For details about the factor 4 see ATL-SOFT-PUB-2009-001 Result res = @@ -164,6 +165,8 @@ Result SympyStepper::stepImpl( break; } + ++state.statistics.nFailedSteps; + const double stepSizeScaling = calcStepSizeScaling(errorEstimate); h *= stepSizeScaling; @@ -186,6 +189,13 @@ Result SympyStepper::stepImpl( ++state.nSteps; state.nStepTrials += nStepTrials; + ++state.statistics.nSuccessfulSteps; + if (stepDirection != Direction::fromScalarZeroAsPositive(initialH)) { + ++state.statistics.nReverseSteps; + } + state.statistics.pathLength += h; + state.statistics.absolutePathLength += std::abs(h); + const double stepSizeScaling = calcStepSizeScaling(errorEstimate); const double nextAccuracy = std::abs(h * stepSizeScaling); const double previousAccuracy = std::abs(state.stepSize.accuracy()); diff --git a/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagatorInterface.hpp b/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagatorInterface.hpp index 2aa3b2292ac..7f113d47b56 100644 --- a/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagatorInterface.hpp +++ b/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagatorInterface.hpp @@ -117,6 +117,8 @@ class ConcretePropagator : public PropagatorInterface { resultValue.template get(); summary.steps = std::move(steppingResults.steps); + summary.statistics = resultValue.statistics; + // Also set the material recording result - if configured if (cfg.recordMaterialInteractions) { auto materialResult = diff --git a/Examples/Framework/include/ActsExamples/EventData/PropagationSummary.hpp b/Examples/Framework/include/ActsExamples/EventData/PropagationSummary.hpp index aa9a736675f..1d1ef44f499 100644 --- a/Examples/Framework/include/ActsExamples/EventData/PropagationSummary.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/PropagationSummary.hpp @@ -10,6 +10,7 @@ #include "Acts/EventData/TrackParameters.hpp" #include "Acts/Propagator/MaterialInteractor.hpp" +#include "Acts/Propagator/PropagatorStatistics.hpp" #include "Acts/Propagator/detail/SteppingLogger.hpp" #include @@ -34,6 +35,9 @@ struct PropagationSummary { /// Steps std::vector steps; + + /// Propagation statistics + Acts::PropagatorStatistics statistics; }; using PropagationSummaries = std::vector; diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootPropagationSummaryWriter.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootPropagationSummaryWriter.hpp index c1f6afe9059..a3e4cff6945 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/RootPropagationSummaryWriter.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootPropagationSummaryWriter.hpp @@ -8,22 +8,18 @@ #pragma once -#include "Acts/Propagator/detail/SteppingLogger.hpp" #include "Acts/Utilities/Logger.hpp" #include "ActsExamples/Framework/ProcessCode.hpp" #include "ActsExamples/Framework/WriterT.hpp" #include "ActsExamples/Propagation/PropagationAlgorithm.hpp" -#include #include #include -#include class TFile; class TTree; namespace ActsExamples { -struct AlgorithmContext; /// @class RootPropagationSummaryWriter /// @@ -110,10 +106,17 @@ class RootPropagationSummaryWriter : public WriterT { int m_nMaterials = 0; int m_nPortals = 0; - // steper statistics - int m_nSteps = 0; - int m_nStepTrials = 0; - int m_pathLength = 0; + // stepper statistics + std::size_t m_nAttemptedSteps = 0; + std::size_t m_nFailedSteps = 0; + std::size_t m_nSuccessfulSteps = 0; + std::size_t m_nReverseSteps = 0; + double m_pathLength = 0; + double m_absolutePathLength = 0; + + // navigator statistics + std::size_t m_nRenavigations = 0; + std::size_t m_nVolumeSwitches = 0; }; } // namespace ActsExamples diff --git a/Examples/Io/Root/src/RootPropagationStepsWriter.cpp b/Examples/Io/Root/src/RootPropagationStepsWriter.cpp index c7866e056eb..643956a6ed1 100644 --- a/Examples/Io/Root/src/RootPropagationStepsWriter.cpp +++ b/Examples/Io/Root/src/RootPropagationStepsWriter.cpp @@ -9,15 +9,12 @@ #include "ActsExamples/Io/Root/RootPropagationStepsWriter.hpp" #include "Acts/Definitions/Algebra.hpp" +#include "Acts/Geometry/GeometryIdentifier.hpp" +#include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/VectorHelpers.hpp" #include "ActsExamples/EventData/PropagationSummary.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" -#include -#include -#include -#include -#include #include #include diff --git a/Examples/Io/Root/src/RootPropagationSummaryWriter.cpp b/Examples/Io/Root/src/RootPropagationSummaryWriter.cpp index 07a1cfa105f..3887cb432b6 100644 --- a/Examples/Io/Root/src/RootPropagationSummaryWriter.cpp +++ b/Examples/Io/Root/src/RootPropagationSummaryWriter.cpp @@ -8,19 +8,11 @@ #include "ActsExamples/Io/Root/RootPropagationSummaryWriter.hpp" -#include "Acts/Definitions/Algebra.hpp" -#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/VectorHelpers.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" #include "ActsExamples/Propagation/PropagationAlgorithm.hpp" -#include -#include -#include -#include -#include #include -#include #include #include @@ -77,9 +69,15 @@ RootPropagationSummaryWriter::RootPropagationSummaryWriter( m_outputTree->Branch("nMaterials", &m_nMaterials); m_outputTree->Branch("nPortals", &m_nPortals); - m_outputTree->Branch("nSteps", &m_nSteps); - m_outputTree->Branch("nStepTrials", &m_nStepTrials); + m_outputTree->Branch("nAttemptedSteps", &m_nAttemptedSteps); + m_outputTree->Branch("nFailedSteps", &m_nFailedSteps); + m_outputTree->Branch("nSuccessfulSteps", &m_nSuccessfulSteps); + m_outputTree->Branch("nReverseSteps", &m_nReverseSteps); m_outputTree->Branch("pathLength", &m_pathLength); + m_outputTree->Branch("absolutePathLength", &m_absolutePathLength); + + m_outputTree->Branch("nRenavigations", &m_nRenavigations); + m_outputTree->Branch("nVolumeSwitches", &m_nVolumeSwitches); } RootPropagationSummaryWriter::~RootPropagationSummaryWriter() { @@ -133,11 +131,6 @@ ProcessCode RootPropagationSummaryWriter::writeT( m_pt = static_cast(startParameters.transverseMomentum()); m_p = static_cast(startParameters.absoluteMomentum()); - // Stepper statistics - m_nSteps = static_cast(summary.steps.size()); - m_nStepTrials = static_cast(summary.nStepTrials); - m_pathLength = static_cast(summary.pathLength); - m_nMaterials = 0; m_nSensitives = 0; m_nPortals = 0; @@ -160,6 +153,19 @@ ProcessCode RootPropagationSummaryWriter::writeT( } } }); + + // Stepper statistics + m_nAttemptedSteps = summary.statistics.stepping.nAttemptedSteps; + m_nFailedSteps = summary.statistics.stepping.nFailedSteps; + m_nSuccessfulSteps = summary.statistics.stepping.nSuccessfulSteps; + m_nReverseSteps = summary.statistics.stepping.nReverseSteps; + m_pathLength = summary.statistics.stepping.pathLength; + m_absolutePathLength = summary.statistics.stepping.absolutePathLength; + + // Navigator statistics + m_nRenavigations = summary.statistics.navigation.nRenavigations; + m_nVolumeSwitches = summary.statistics.navigation.nVolumeSwitches; + m_outputTree->Fill(); } diff --git a/Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp b/Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp index fcdf13e9f8a..7ed2255afdc 100644 --- a/Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp @@ -12,52 +12,30 @@ #include "Acts/Definitions/Direction.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Definitions/Units.hpp" -#include "Acts/EventData/Charge.hpp" #include "Acts/EventData/GenericBoundTrackParameters.hpp" #include "Acts/EventData/GenericCurvilinearTrackParameters.hpp" #include "Acts/EventData/ParticleHypothesis.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/EventData/TransformationHelpers.hpp" -#include "Acts/Geometry/BoundarySurfaceT.hpp" -#include "Acts/Geometry/CuboidVolumeBuilder.hpp" #include "Acts/Geometry/GeometryContext.hpp" -#include "Acts/Geometry/TrackingGeometry.hpp" -#include "Acts/Geometry/TrackingGeometryBuilder.hpp" -#include "Acts/Geometry/TrackingVolume.hpp" #include "Acts/MagneticField/ConstantBField.hpp" #include "Acts/MagneticField/MagneticFieldContext.hpp" #include "Acts/MagneticField/MagneticFieldProvider.hpp" -#include "Acts/MagneticField/NullBField.hpp" -#include "Acts/Material/HomogeneousSurfaceMaterial.hpp" -#include "Acts/Material/HomogeneousVolumeMaterial.hpp" -#include "Acts/Material/MaterialSlab.hpp" -#include "Acts/Propagator/ActorList.hpp" #include "Acts/Propagator/ConstrainedStep.hpp" -#include "Acts/Propagator/MaterialInteractor.hpp" -#include "Acts/Propagator/Navigator.hpp" -#include "Acts/Propagator/Propagator.hpp" #include "Acts/Propagator/SympyStepper.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/CurvilinearSurface.hpp" #include "Acts/Surfaces/PlaneSurface.hpp" -#include "Acts/Surfaces/RectangleBounds.hpp" -#include "Acts/Surfaces/Surface.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" -#include "Acts/Tests/CommonHelpers/PredefinedMaterials.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/Result.hpp" -#include "Acts/Utilities/UnitVectors.hpp" #include -#include #include -#include #include -#include #include #include #include -#include #include #include #include @@ -363,7 +341,6 @@ BOOST_AUTO_TEST_CASE(sympy_stepper_test) { state.fieldCache.template as()); copy.geoContext = state.geoContext; - copy.stepData = state.stepData; return copy; };