Skip to content

Commit

Permalink
Merge branch 'main' into feat-acts-digitization
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Jan 9, 2025
2 parents 12e7460 + 567db0c commit 041e27b
Show file tree
Hide file tree
Showing 26 changed files with 195 additions and 187 deletions.
5 changes: 3 additions & 2 deletions Core/include/Acts/Navigation/DetectorNavigator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "Acts/Geometry/GeometryIdentifier.hpp"
#include "Acts/Geometry/Layer.hpp"
#include "Acts/Navigation/NavigationState.hpp"
#include "Acts/Propagator/ConstrainedStep.hpp"
#include "Acts/Propagator/NavigatorOptions.hpp"
#include "Acts/Propagator/NavigatorStatistics.hpp"
#include "Acts/Surfaces/BoundaryTolerance.hpp"
Expand Down Expand Up @@ -213,7 +214,7 @@ class DetectorNavigator {
auto surfaceStatus = stepper.updateSurfaceStatus(
state.stepping, surface, c.objectIntersection.index(),
state.options.direction, c.boundaryTolerance,
state.options.surfaceTolerance, logger());
state.options.surfaceTolerance, ConstrainedStep::navigator, logger());

ACTS_VERBOSE(volInfo(state) << posInfo(state, stepper)
<< "surface status is " << surfaceStatus);
Expand Down Expand Up @@ -284,7 +285,7 @@ class DetectorNavigator {
state.stepping, *nextSurface,
nState.surfaceCandidate().objectIntersection.index(),
state.options.direction, boundaryTolerance,
state.options.surfaceTolerance, logger());
state.options.surfaceTolerance, ConstrainedStep::navigator, logger());

// Check if we are at a surface
if (surfaceStatus == IntersectionStatus::onSurface) {
Expand Down
35 changes: 19 additions & 16 deletions Core/include/Acts/Propagator/AtlasStepper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,15 +407,16 @@ class AtlasStepper {
/// @param [in] navDir The navigation direction
/// @param [in] boundaryTolerance The boundary check for this status update
/// @param [in] surfaceTolerance Surface tolerance used for intersection
/// @param [in] stype The step size type to be set
/// @param [in] logger Logger instance to use
IntersectionStatus updateSurfaceStatus(
State& state, const Surface& surface, std::uint8_t index,
Direction navDir, const BoundaryTolerance& boundaryTolerance,
double surfaceTolerance = s_onSurfaceTolerance,
double surfaceTolerance, ConstrainedStep::Type stype,
const Logger& logger = getDummyLogger()) const {
return detail::updateSingleSurfaceStatus<AtlasStepper>(
*this, state, surface, index, navDir, boundaryTolerance,
surfaceTolerance, logger);
surfaceTolerance, stype, logger);
}

/// Update step size
Expand All @@ -425,31 +426,25 @@ class AtlasStepper {
///
/// @param state [in,out] The stepping state (thread-local cache)
/// @param oIntersection [in] The ObjectIntersection to layer, boundary, etc
/// @param release [in] boolean to trigger step size release
/// @param direction [in] The propagation direction
/// @param stype [in] The step size type to be set
template <typename object_intersection_t>
void updateStepSize(State& state, const object_intersection_t& oIntersection,
Direction /*direction*/, bool release = true) const {
detail::updateSingleStepSize<AtlasStepper>(state, oIntersection, release);
Direction direction, ConstrainedStep::Type stype) const {
(void)direction;
double stepSize = oIntersection.pathLength();
updateStepSize(state, stepSize, stype);
}

/// Update step size - explicitly with a double
///
/// @param [in,out] state The stepping state (thread-local cache)
/// @param [in] stepSize The step size value
/// @param [in] stype The step size type to be set
/// @param release [in] Do we release the step size?
void updateStepSize(State& state, double stepSize,
ConstrainedStep::Type stype, bool release = true) const {
ConstrainedStep::Type stype) const {
state.previousStepSize = state.stepSize.value();
state.stepSize.update(stepSize, stype, release);
}

/// Get the step size
///
/// @param state [in] The stepping state (thread-local cache)
/// @param stype [in] The step size type to be returned
double getStepSize(const State& state, ConstrainedStep::Type stype) const {
return state.stepSize.value(stype);
state.stepSize.update(stepSize, stype);
}

/// Release the Step size
Expand All @@ -460,6 +455,14 @@ class AtlasStepper {
state.stepSize.release(stype);
}

/// Get the step size
///
/// @param state [in] The stepping state (thread-local cache)
/// @param stype [in] The step size type to be returned
double getStepSize(const State& state, ConstrainedStep::Type stype) const {
return state.stepSize.value(stype);
}

/// Output the Step Size - single component
///
/// @param [in,out] state The stepping state (thread-local cache)
Expand Down
20 changes: 7 additions & 13 deletions Core/include/Acts/Propagator/ConstrainedStep.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

#pragma once

#include "Acts/Definitions/Algebra.hpp"

#include <algorithm>
#include <array>
#include <cassert>
Expand Down Expand Up @@ -44,10 +42,10 @@ namespace Acts {
class ConstrainedStep {
public:
/// the types of constraints
/// from actor - this would be a typical navigation step
/// from aborter - this would be a target condition
/// from user - this is user given for what reason ever
enum Type : int { actor = 0, aborter = 1, user = 2 };
/// from navigator - this would be a navigation step
/// from actor - this would be an actor condition
/// from user - this is user given for what reason ever
enum Type : int { navigator = 0, actor = 1, user = 2 };

constexpr ConstrainedStep() = default;

Expand Down Expand Up @@ -108,11 +106,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(double value, Type type, bool releaseStep = false) {
if (releaseStep) {
release(type);
}
constexpr void update(double value, Type type) {
// check the current value and set it if appropriate
// this will also allow signed values due to overstepping
if (std::abs(value) < std::abs(m_values[type])) {
Expand All @@ -137,9 +131,9 @@ class ConstrainedStep {
os << "(";
streamValue(m_accuracy);
os << ", ";
streamValue(value(actor));
streamValue(value(navigator));
os << ", ";
streamValue(value(aborter));
streamValue(value(actor));
os << ", ";
streamValue(value(user));
os << ")";
Expand Down
6 changes: 3 additions & 3 deletions Core/include/Acts/Propagator/DirectNavigator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class DirectNavigator {
// Set the navigation break
ACTS_VERBOSE("End of surfaces reached, navigation break.");
state.navigation.navigationBreak = true;
stepper.releaseStepSize(state.stepping, ConstrainedStep::actor);
stepper.releaseStepSize(state.stepping, ConstrainedStep::navigator);
// If no externally provided target is given, the target is reached
if (state.navigation.options.targetSurface == nullptr) {
state.navigation.targetReached = true;
Expand All @@ -256,7 +256,7 @@ class DirectNavigator {
auto surfaceStatus = stepper.updateSurfaceStatus(
state.stepping, surface, index, state.options.direction,
BoundaryTolerance::Infinite(), state.options.surfaceTolerance,
*m_logger);
ConstrainedStep::navigator, *m_logger);
if (surfaceStatus == IntersectionStatus::unreachable) {
ACTS_VERBOSE(
"Surface not reachable anymore, switching to next one in "
Expand Down Expand Up @@ -310,7 +310,7 @@ class DirectNavigator {
auto surfaceStatus = stepper.updateSurfaceStatus(
state.stepping, surface, index, state.options.direction,
BoundaryTolerance::Infinite(), state.options.surfaceTolerance,
*m_logger);
ConstrainedStep::navigator, *m_logger);
if (surfaceStatus == IntersectionStatus::onSurface) {
// Set the current surface
state.navigation.currentSurface = state.navigation.navSurface();
Expand Down
20 changes: 11 additions & 9 deletions Core/include/Acts/Propagator/EigenStepper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "Acts/Utilities/detail/ReferenceWrapperAnyCompat.hpp"

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/Tolerance.hpp"
#include "Acts/EventData/TrackParameters.hpp"
#include "Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp"
#include "Acts/MagneticField/MagneticFieldProvider.hpp"
Expand Down Expand Up @@ -239,15 +238,16 @@ class EigenStepper {
/// @param [in] navDir The navigation direction
/// @param [in] boundaryTolerance The boundary check for this status update
/// @param [in] surfaceTolerance Surface tolerance used for intersection
/// @param [in] stype The step size type to be set
/// @param [in] logger A @c Logger instance
IntersectionStatus updateSurfaceStatus(
State& state, const Surface& surface, std::uint8_t index,
Direction navDir, const BoundaryTolerance& boundaryTolerance,
double surfaceTolerance = s_onSurfaceTolerance,
double surfaceTolerance, ConstrainedStep::Type stype,
const Logger& logger = getDummyLogger()) const {
return detail::updateSingleSurfaceStatus<EigenStepper>(
*this, state, surface, index, navDir, boundaryTolerance,
surfaceTolerance, logger);
surfaceTolerance, stype, logger);
}

/// Update step size
Expand All @@ -259,23 +259,25 @@ class EigenStepper {
///
/// @param state [in,out] The stepping state (thread-local cache)
/// @param oIntersection [in] The ObjectIntersection to layer, boundary, etc
/// @param release [in] boolean to trigger step size release
/// @param direction [in] The propagation direction
/// @param stype [in] The step size type to be set
template <typename object_intersection_t>
void updateStepSize(State& state, const object_intersection_t& oIntersection,
Direction /*direction*/, bool release = true) const {
detail::updateSingleStepSize<EigenStepper>(state, oIntersection, release);
Direction direction, ConstrainedStep::Type stype) const {
(void)direction;
double stepSize = oIntersection.pathLength();
updateStepSize(state, stepSize, stype);
}

/// Update step size - explicitly with a double
///
/// @param state [in,out] The stepping state (thread-local cache)
/// @param stepSize [in] The step size value
/// @param stype [in] The step size type to be set
/// @param release [in] Do we release the step size?
void updateStepSize(State& state, double stepSize,
ConstrainedStep::Type stype, bool release = true) const {
ConstrainedStep::Type stype) const {
state.previousStepSize = state.stepSize.value();
state.stepSize.update(stepSize, stype, release);
state.stepSize.update(stepSize, stype);
}

/// Get the step size
Expand Down
16 changes: 8 additions & 8 deletions Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,11 +499,12 @@ class MultiEigenStepperLoop : public EigenStepper<extension_t> {
/// @param [in] navDir The navigation direction
/// @param [in] boundaryTolerance The boundary check for this status update
/// @param [in] surfaceTolerance Surface tolerance used for intersection
/// @param [in] stype The step size type to be set
/// @param [in] logger A @c Logger instance
IntersectionStatus updateSurfaceStatus(
State& state, const Surface& surface, std::uint8_t index,
Direction navDir, const BoundaryTolerance& boundaryTolerance,
double surfaceTolerance = s_onSurfaceTolerance,
double surfaceTolerance, ConstrainedStep::Type stype,
const Logger& logger = getDummyLogger()) const {
using Status = IntersectionStatus;

Expand All @@ -512,7 +513,7 @@ class MultiEigenStepperLoop : public EigenStepper<extension_t> {
for (auto& component : state.components) {
component.status = detail::updateSingleSurfaceStatus<SingleStepper>(
*this, component.state, surface, index, navDir, boundaryTolerance,
surfaceTolerance, logger);
surfaceTolerance, stype, logger);
++counts[static_cast<std::size_t>(component.status)];
}

Expand Down Expand Up @@ -576,10 +577,10 @@ class MultiEigenStepperLoop : public EigenStepper<extension_t> {
/// @param state [in,out] The stepping state (thread-local cache)
/// @param oIntersection [in] The ObjectIntersection to layer, boundary, etc
/// @param direction [in] The propagation direction
/// @param release [in] boolean to trigger step size release
/// @param stype [in] The step size type to be set
template <typename object_intersection_t>
void updateStepSize(State& state, const object_intersection_t& oIntersection,
Direction direction, bool release = true) const {
Direction direction, ConstrainedStep::Type stype) const {
const Surface& surface = *oIntersection.object();

for (auto& component : state.components) {
Expand All @@ -590,7 +591,7 @@ class MultiEigenStepperLoop : public EigenStepper<extension_t> {
BoundaryTolerance::None())[oIntersection.index()];

SingleStepper::updateStepSize(component.state, intersection, direction,
release);
stype);
}
}

Expand All @@ -599,11 +600,10 @@ class MultiEigenStepperLoop : public EigenStepper<extension_t> {
/// @param state [in,out] The stepping state (thread-local cache)
/// @param stepSize [in] The step size value
/// @param stype [in] The step size type to be set
/// @param release [in] Do we release the step size?
void updateStepSize(State& state, double stepSize,
ConstrainedStep::Type stype, bool release = true) const {
ConstrainedStep::Type stype) const {
for (auto& component : state.components) {
SingleStepper::updateStepSize(component.state, stepSize, stype, release);
SingleStepper::updateStepSize(component.state, stepSize, stype);
}
}

Expand Down
Loading

0 comments on commit 041e27b

Please sign in to comment.