Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: Make BoundaryCheck constructor from bool explicit #2592

Merged
8 changes: 4 additions & 4 deletions Core/include/Acts/EventData/MultiComponentTrackParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ class MultiComponentCurvilinearTrackParameters

// Project the position onto the surface, keep everything else as is
for (const auto& [w, pos4, dir, qop, cov] : curvi) {
Vector3 newPos =
s->intersect(gctx, pos4.template segment<3>(eFreePos0), dir, false)
.closest()
.position();
Vector3 newPos = s->intersect(gctx, pos4.template segment<3>(eFreePos0),
dir, BoundaryCheck(false))
.closest()
.position();

BoundVector bv =
detail::transformFreeToCurvilinearParameters(pos4[eTime], dir, qop);
Expand Down
5 changes: 3 additions & 2 deletions Core/include/Acts/Geometry/Layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ class Layer : public virtual GeometryObject {
/// @param bcheck is the boundary check directive
///
/// @return boolean that indicates success of the operation
virtual bool isOnLayer(const GeometryContext& gctx, const Vector3& position,
const BoundaryCheck& bcheck = true) const;
virtual bool isOnLayer(
const GeometryContext& gctx, const Vector3& position,
const BoundaryCheck& bcheck = BoundaryCheck(true)) const;

/// Return method for the approach descriptor, can be nullptr
const ApproachDescriptor* approachDescriptor() const;
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Geometry/NavigationLayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class NavigationLayer : public Layer {
///
/// @return boolean that indicates if the position is on surface
bool isOnLayer(const GeometryContext& gctx, const Vector3& gp,
const BoundaryCheck& bcheck = true) const final;
const BoundaryCheck& bcheck = BoundaryCheck(true)) const final;

/// Accept layer according to the following collection directives
///
Expand Down
7 changes: 4 additions & 3 deletions Core/include/Acts/Navigation/DetectorNavigator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "Acts/Geometry/Layer.hpp"
#include "Acts/Navigation/NavigationState.hpp"
#include "Acts/Propagator/Propagator.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/Logger.hpp"

Expand Down Expand Up @@ -229,7 +230,7 @@ class DetectorNavigator {
bool boundaryCheck = c.boundaryCheck;
auto surfaceStatus = stepper.updateSurfaceStatus(
state.stepping, surface, c.objectIntersection.index(),
state.options.direction, boundaryCheck,
state.options.direction, BoundaryCheck(boundaryCheck),
state.options.surfaceTolerance, logger());
if (surfaceStatus == Intersection3D::Status::reachable) {
ACTS_VERBOSE(volInfo(state)
Expand Down Expand Up @@ -299,8 +300,8 @@ class DetectorNavigator {
auto surfaceStatus = stepper.updateSurfaceStatus(
state.stepping, *nextSurface,
nState.surfaceCandidate->objectIntersection.index(),
state.options.direction, boundaryCheck, state.options.surfaceTolerance,
logger());
state.options.direction, BoundaryCheck(boundaryCheck),
state.options.surfaceTolerance, logger());

// Check if we are at a surface
if (surfaceStatus == Intersection3D::Status::onSurface) {
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/Navigation/NavigationState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct NavigationState {
const Portal* portal = nullptr;
/// The boundary check used for the candidate, boundary checks
/// can differ for sensitive surfaces and portals
BoundaryCheck boundaryCheck = true;
BoundaryCheck boundaryCheck = BoundaryCheck(true);
};

/// Surface candidate vector alias, this allows to use e.g. boost_small vector
Expand Down Expand Up @@ -83,7 +83,7 @@ struct NavigationState {
SurfaceCandidates::const_iterator surfaceCandidate = surfaceCandidates.cend();

/// Boundary directives for surfaces
BoundaryCheck surfaceBoundaryCheck = true;
BoundaryCheck surfaceBoundaryCheck = BoundaryCheck(true);

/// An overstep tolerance
ActsScalar overstepTolerance = -0.1;
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Navigation/NavigationStateFillers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ struct PortalsFiller {
const std::vector<const Portal*>& portals) {
std::for_each(portals.begin(), portals.end(), [&](const auto& p) {
nState.surfaceCandidates.push_back(NavigationState::SurfaceCandidate{
ObjectIntersection<Surface>::invalid(), nullptr, p, true});
ObjectIntersection<Surface>::invalid(), nullptr, p,
BoundaryCheck(true)});
});
}
};
Expand Down
12 changes: 6 additions & 6 deletions Core/include/Acts/Propagator/DirectNavigator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,13 @@ class DirectNavigator {
chooseIntersection(
state.geoContext, surface, stepper.position(state.stepping),
state.options.direction * stepper.direction(state.stepping),
false, std::numeric_limits<double>::max(),
BoundaryCheck(false), std::numeric_limits<double>::max(),
stepper.overstepLimit(state.stepping),
state.options.surfaceTolerance)
.index();
auto surfaceStatus = stepper.updateSurfaceStatus(
state.stepping, surface, index, state.options.direction, false,
state.options.surfaceTolerance, *m_logger);
state.stepping, surface, index, state.options.direction,
BoundaryCheck(false), state.options.surfaceTolerance, *m_logger);
if (surfaceStatus == Intersection3D::Status::unreachable) {
ACTS_VERBOSE(
"Surface not reachable anymore, switching to next one in "
Expand Down Expand Up @@ -313,13 +313,13 @@ class DirectNavigator {
chooseIntersection(
state.geoContext, surface, stepper.position(state.stepping),
state.options.direction * stepper.direction(state.stepping),
false, std::numeric_limits<double>::max(),
BoundaryCheck(false), std::numeric_limits<double>::max(),
stepper.overstepLimit(state.stepping),
state.options.surfaceTolerance)
.index();
auto surfaceStatus = stepper.updateSurfaceStatus(
state.stepping, surface, index, state.options.direction, false,
state.options.surfaceTolerance, *m_logger);
state.stepping, surface, index, state.options.direction,
BoundaryCheck(false), state.options.surfaceTolerance, *m_logger);
if (surfaceStatus == Intersection3D::Status::onSurface) {
// Set the current surface
state.navigation.currentSurface = *state.navigation.navSurfaceIter;
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ class MultiEigenStepperLoop
auto intersection = surface.intersect(
component.state.geoContext, SingleStepper::position(component.state),
direction * SingleStepper::direction(component.state),
true)[oIntersection.index()];
BoundaryCheck(true))[oIntersection.index()];

SingleStepper::updateStepSize(component.state, intersection, direction,
release);
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ auto MultiEigenStepperLoop<E, R, A>::boundState(
surface
.intersect(state.geoContext,
cmpState.pars.template segment<3>(eFreePos0),
cmpState.pars.template segment<3>(eFreeDir0), false)
cmpState.pars.template segment<3>(eFreeDir0),
BoundaryCheck(false))
.closest()
.position();

Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Propagator/MultiStepperAborters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct MultiStepperSurfaceReached {
.intersect(
state.geoContext, stepper.position(state.stepping),
state.options.direction * stepper.direction(state.stepping),
true, averageOnSurfaceTolerance)
BoundaryCheck(true), averageOnSurfaceTolerance)
.closest();

if (sIntersection.status() == Intersection3D::Status::onSurface) {
Expand Down
22 changes: 11 additions & 11 deletions Core/include/Acts/Propagator/Navigator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace Acts {
template <typename object_t>
struct NavigationOptions {
/// The boundary check directive
BoundaryCheck boundaryCheck = true;
BoundaryCheck boundaryCheck = BoundaryCheck(true);

// How to resolve the geometry
/// Always look for sensitive
Expand Down Expand Up @@ -125,7 +125,7 @@ class Navigator {

/// Whether to perform boundary checks for layer resolving (improves
/// navigation for bended tracks)
BoundaryCheck boundaryCheckLayerResolving = true;
BoundaryCheck boundaryCheckLayerResolving = BoundaryCheck(true);
};

/// Nested State struct
Expand Down Expand Up @@ -602,7 +602,7 @@ class Navigator {
// it the current one to pass it to the other actors
auto surfaceStatus = stepper.updateSurfaceStatus(
state.stepping, *surface, intersection.index(), state.options.direction,
true, state.options.surfaceTolerance, logger());
BoundaryCheck(true), state.options.surfaceTolerance, logger());
if (surfaceStatus == Intersection3D::Status::onSurface) {
ACTS_VERBOSE(volInfo(state)
<< "Status Surface successfully hit, storing it.");
Expand Down Expand Up @@ -693,7 +693,7 @@ class Navigator {
}
auto surfaceStatus = stepper.updateSurfaceStatus(
state.stepping, *surface, intersection.index(),
state.options.direction, boundaryCheck,
state.options.direction, BoundaryCheck(boundaryCheck),
state.options.surfaceTolerance, logger());
if (surfaceStatus == Intersection3D::Status::reachable) {
ACTS_VERBOSE(volInfo(state)
Expand Down Expand Up @@ -864,8 +864,8 @@ class Navigator {
// Try to step towards it
auto layerStatus = stepper.updateSurfaceStatus(
state.stepping, *layerSurface, intersection.index(),
state.options.direction, true, state.options.surfaceTolerance,
logger());
state.options.direction, BoundaryCheck(true),
state.options.surfaceTolerance, logger());
if (layerStatus == Intersection3D::Status::reachable) {
ACTS_VERBOSE(volInfo(state) << "Layer reachable, step size updated to "
<< stepper.outputStepSize(state.stepping));
Expand Down Expand Up @@ -1009,8 +1009,8 @@ class Navigator {
// Step towards the boundary surfrace
auto boundaryStatus = stepper.updateSurfaceStatus(
state.stepping, *boundarySurface, intersection.index(),
state.options.direction, true, state.options.surfaceTolerance,
logger());
state.options.direction, BoundaryCheck(true),
state.options.surfaceTolerance, logger());
if (boundaryStatus == Intersection3D::Status::reachable) {
ACTS_VERBOSE(volInfo(state)
<< "Boundary reachable, step size updated to "
Expand Down Expand Up @@ -1093,7 +1093,7 @@ class Navigator {
->intersect(
state.geoContext, stepper.position(state.stepping),
state.options.direction * stepper.direction(state.stepping),
false, state.options.surfaceTolerance)
BoundaryCheck(false), state.options.surfaceTolerance)
.closest();
if (targetIntersection) {
ACTS_VERBOSE(volInfo(state)
Expand Down Expand Up @@ -1316,8 +1316,8 @@ class Navigator {
// TODO we do not know the intersection index - passing 0
auto targetStatus = stepper.updateSurfaceStatus(
state.stepping, *state.navigation.targetSurface, 0,
state.options.direction, true, state.options.surfaceTolerance,
logger());
state.options.direction, BoundaryCheck(true),
state.options.surfaceTolerance, logger());
// the only advance could have been to the target
if (targetStatus == Intersection3D::Status::onSurface) {
// set the target surface
Expand Down
6 changes: 3 additions & 3 deletions Core/include/Acts/Propagator/StandardAborters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct TargetOptions {
Direction navDir = Direction::Forward;

/// Target Boundary check directive - always false here
BoundaryCheck boundaryCheck = false;
BoundaryCheck boundaryCheck = BoundaryCheck(false);

/// Object to check against - always nullptr here
const Surface* startObject = nullptr;
Expand Down Expand Up @@ -149,8 +149,8 @@ struct SurfaceReached {

const auto sIntersection = targetSurface.intersect(
state.geoContext, stepper.position(state.stepping),
state.options.direction * stepper.direction(state.stepping), true,
tolerance);
state.options.direction * stepper.direction(state.stepping),
BoundaryCheck(true), tolerance);
const auto closest = sIntersection.closest();

// Return true if you fall below tolerance
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Surfaces/BoundaryCheck.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace Acts {
class BoundaryCheck {
public:
/// Construct either hard cut in both dimensions or no cut at all.
BoundaryCheck(bool check);
explicit BoundaryCheck(bool check);

/// Construct a tolerance based check.
///
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Surfaces/ConeBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ConeBounds : public SurfaceBounds {
/// @param bcheck is the boundary check directive
/// @return is a boolean indicating if the position is inside
bool inside(const Vector2& lposition,
const BoundaryCheck& bcheck = true) const final;
const BoundaryCheck& bcheck = BoundaryCheck(true)) const final;

/// Output Method for std::ostream
///
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Surfaces/ConeSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ class ConeSurface : public Surface {
/// @return @c SurfaceMultiIntersection object (contains intersection & surface)
SurfaceMultiIntersection intersect(
const GeometryContext& gctx, const Vector3& position,
const Vector3& direction, const BoundaryCheck& bcheck = false,
const Vector3& direction,
const BoundaryCheck& bcheck = BoundaryCheck(false),
double tolerance = s_onSurfaceTolerance) const final;

/// The pathCorrection for derived classes with thickness
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Surfaces/CylinderBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class CylinderBounds : public SurfaceBounds {
/// @param bcheck is the boundary check directive
/// @return boolean indicator for operation success
bool inside3D(const Vector3& position,
const BoundaryCheck& bcheck = true) const;
const BoundaryCheck& bcheck = BoundaryCheck(true)) const;

/// Access to the bound values
/// @param bValue the class nested enum for the array access
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Surfaces/CylinderSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ class CylinderSurface : public Surface {
/// @return SurfaceIntersection object (contains intersection & surface)
SurfaceMultiIntersection intersect(
const GeometryContext& gctx, const Vector3& position,
const Vector3& direction, const BoundaryCheck& bcheck = false,
const Vector3& direction,
const BoundaryCheck& bcheck = BoundaryCheck(false),
ActsScalar tolerance = s_onSurfaceTolerance) const final;

/// Path correction due to incident of the track
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Surfaces/DiscSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ class DiscSurface : public Surface {
/// @return The @c SurfaceMultiIntersection object
SurfaceMultiIntersection intersect(
const GeometryContext& gctx, const Vector3& position,
const Vector3& direction, const BoundaryCheck& bcheck = false,
const Vector3& direction,
const BoundaryCheck& bcheck = BoundaryCheck(false),
ActsScalar tolerance = s_onSurfaceTolerance) const final;

/// Implement the binningValue
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class DiscTrapezoidBounds : public DiscBounds {
/// coordinates)
/// @param bcheck is the boundary check directive
bool inside(const Vector2& lposition,
const BoundaryCheck& bcheck = true) const final;
const BoundaryCheck& bcheck = BoundaryCheck(true)) const final;

/// Output Method for std::ostream
std::ostream& toStream(std::ostream& sl) const final;
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Surfaces/LineSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ class LineSurface : public Surface {
/// @return is the intersection object
SurfaceMultiIntersection intersect(
const GeometryContext& gctx, const Vector3& position,
const Vector3& direction, const BoundaryCheck& bcheck = false,
const Vector3& direction,
const BoundaryCheck& bcheck = BoundaryCheck(false),
ActsScalar tolerance = s_onSurfaceTolerance) const final;

/// the pathCorrection for derived classes with thickness
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Surfaces/PlaneSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ class PlaneSurface : public Surface {
/// @return the @c SurfaceMultiIntersection object
SurfaceMultiIntersection intersect(
const GeometryContext& gctx, const Vector3& position,
const Vector3& direction, const BoundaryCheck& bcheck = false,
const Vector3& direction,
const BoundaryCheck& bcheck = BoundaryCheck(false),
ActsScalar tolerance = s_onSurfaceTolerance) const final;

/// Return a Polyhedron for the surfaces
Expand Down
10 changes: 6 additions & 4 deletions Core/include/Acts/Surfaces/Surface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,16 @@ class Surface : public virtual GeometryObject,
/// @return boolean indication if operation was successful
bool isOnSurface(const GeometryContext& gctx, const Vector3& position,
const Vector3& direction,
const BoundaryCheck& bcheck = true) const;
const BoundaryCheck& bcheck = BoundaryCheck(true)) const;

/// The insideBounds method for local positions
///
/// @param lposition The local position to check
/// @param bcheck BoundaryCheck directive for this onSurface check
/// @return boolean indication if operation was successful
virtual bool insideBounds(const Vector2& lposition,
const BoundaryCheck& bcheck = true) const;
virtual bool insideBounds(
const Vector2& lposition,
const BoundaryCheck& bcheck = BoundaryCheck(true)) const;

/// Local to global transformation
/// Generalized local to global transformation for the surface types. Since
Expand Down Expand Up @@ -412,7 +413,8 @@ class Surface : public virtual GeometryObject,
/// @return @c SurfaceMultiIntersection object (contains intersection & surface)
virtual SurfaceMultiIntersection intersect(
const GeometryContext& gctx, const Vector3& position,
const Vector3& direction, const BoundaryCheck& bcheck = false,
const Vector3& direction,
const BoundaryCheck& bcheck = BoundaryCheck(false),
ActsScalar tolerance = s_onSurfaceTolerance) const = 0;

/// Output Method for std::ostream, to be overloaded by child classes
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "Acts/Propagator/Propagator.hpp"
#include "Acts/Propagator/StandardAborters.hpp"
#include "Acts/Propagator/detail/PointwiseMaterialInteraction.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/TrackFinding/CombinatorialKalmanFilterError.hpp"
#include "Acts/TrackFinding/SourceLinkAccessorConcept.hpp"
#include "Acts/TrackFitting/KalmanFitter.hpp"
Expand Down Expand Up @@ -1238,7 +1239,7 @@ class CombinatorialKalmanFilter {
->intersect(
state.geoContext, freeVector.segment<3>(eFreePos0),
state.options.direction * freeVector.segment<3>(eFreeDir0),
true, state.options.surfaceTolerance)
BoundaryCheck(true), state.options.surfaceTolerance)
.closest();
};

Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/TrackFitting/GaussianSumFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ struct GaussianSumFitter {
sParameters.referenceSurface()
.intersect(GeometryContext{},
sParameters.position(GeometryContext{}),
sParameters.direction(), true)
sParameters.direction(), BoundaryCheck(true))
.closest()
.status();

Expand Down
Loading
Loading