diff --git a/Core/include/Acts/Propagator/NavigatorStatistics.hpp b/Core/include/Acts/Propagator/NavigatorStatistics.hpp new file mode 100644 index 000000000000..93de87f0ccaf --- /dev/null +++ b/Core/include/Acts/Propagator/NavigatorStatistics.hpp @@ -0,0 +1,37 @@ +// 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 + +namespace Acts { + +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 49f67f88f941..4aacbd0c4f66 100644 --- a/Core/include/Acts/Propagator/Propagator.ipp +++ b/Core/include/Acts/Propagator/Propagator.ipp @@ -335,6 +335,8 @@ void Acts::Propagator::moveStateToResult(propagator_state_t& state, result.steps = state.steps; result.pathLength = state.pathLength; + + result.statistics = state.statistics; } template diff --git a/Core/include/Acts/Propagator/PropagatorResult.hpp b/Core/include/Acts/Propagator/PropagatorResult.hpp index 3c4998d72912..6e9e4d623f5e 100644 --- a/Core/include/Acts/Propagator/PropagatorResult.hpp +++ b/Core/include/Acts/Propagator/PropagatorResult.hpp @@ -9,6 +9,7 @@ #pragma once #include "Acts/Definitions/TrackParametrization.hpp" +#include "Acts/Propagator/PropagatorStatistics.hpp" #include "Acts/Utilities/detail/Extendable.hpp" #include @@ -36,6 +37,8 @@ struct PropagatorResult : private detail::Extendable { /// Signed distance over which the parameters were propagated double pathLength = 0.; + + PropagatorStatistics statistics; }; } // namespace Acts diff --git a/Core/include/Acts/Propagator/PropagatorState.hpp b/Core/include/Acts/Propagator/PropagatorState.hpp index c7ed3394df77..f0f25a6f86b3 100644 --- a/Core/include/Acts/Propagator/PropagatorState.hpp +++ b/Core/include/Acts/Propagator/PropagatorState.hpp @@ -9,6 +9,7 @@ #pragma once #include "Acts/Geometry/GeometryContext.hpp" +#include "Acts/Propagator/PropagatorStatistics.hpp" #include "Acts/Utilities/detail/Extendable.hpp" #include @@ -72,6 +73,9 @@ struct PropagatorState : private detail::Extendable { /// Signed distance over which the parameters were propagated double pathLength = 0.; + + /// Statistics of the propagation + PropagatorStatistics statistics; }; } // namespace Acts diff --git a/Core/include/Acts/Propagator/PropagatorStatistics.hpp b/Core/include/Acts/Propagator/PropagatorStatistics.hpp new file mode 100644 index 000000000000..0131fcfe13dd --- /dev/null +++ b/Core/include/Acts/Propagator/PropagatorStatistics.hpp @@ -0,0 +1,21 @@ +// 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 +#include + +namespace Acts { + +struct PropagatorStatistics { + StepperStatistics stepping; + NavigatorStatistics navigation; +}; + +} // namespace Acts diff --git a/Core/include/Acts/Propagator/StepperStatistics.hpp b/Core/include/Acts/Propagator/StepperStatistics.hpp new file mode 100644 index 000000000000..75911cb4b832 --- /dev/null +++ b/Core/include/Acts/Propagator/StepperStatistics.hpp @@ -0,0 +1,24 @@ +// 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 + +namespace Acts { + +struct StepperStatistics { + std::size_t nAttemptedSteps = 0; + std::size_t nFailedSteps = 0; + std::size_t nSuccessfulSteps = 0; + + double pathLength = 0; + double absolutePathLength = 0; +}; + +} // namespace Acts diff --git a/Examples/Scripts/Python/propagation.py b/Examples/Scripts/Python/propagation.py index ea54919a89f2..2d7a5a1143a7 100755 --- a/Examples/Scripts/Python/propagation.py +++ b/Examples/Scripts/Python/propagation.py @@ -127,8 +127,5 @@ def runPropagation(trackingGeometry, field, outputDir, s=None, decorators=[]): os.makedirs(os.getcwd() + "/propagation", exist_ok=True) runPropagation( - trackingGeometry, - field, - os.getcwd() + "/propagation", - decorators=contextDecorators, + trackingGeometry, field, os.getcwd() + "/propagation", decorators=contextDecorators ).run()