Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SteppingHelper.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SteppingHelper.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
19 
20 namespace Acts {
21 namespace detail {
22 
33 template <typename stepper_t>
35  const stepper_t& stepper, typename stepper_t::State& state,
36  const Surface& surface, Direction navDir, const BoundaryCheck& bcheck,
37  ActsScalar surfaceTolerance, const Logger& logger) {
39  "Update single surface status for surface: " << surface.geometryId());
40 
41  auto sIntersection = surface.intersect(
42  state.geoContext, stepper.position(state),
43  navDir * stepper.direction(state), bcheck, surfaceTolerance);
44 
45  // The intersection is on surface already
46  if (sIntersection.closest().status() == Intersection3D::Status::onSurface) {
47  // Release navigation step size
48  state.stepSize.release(ConstrainedStep::actor);
49  ACTS_VERBOSE("Intersection: state is ON SURFACE");
50  return Intersection3D::Status::onSurface;
51  }
52 
53  // Path and overstep limit checking
54  const double pLimit = state.stepSize.value(ConstrainedStep::aborter);
55  const double oLimit = stepper.overstepLimit(state);
56 
57  for (const auto& intersection : sIntersection.split()) {
58  if (intersection &&
59  detail::checkIntersection(intersection.intersection(), pLimit, oLimit,
60  surfaceTolerance, logger)) {
61  ACTS_VERBOSE("Surface is reachable");
62  stepper.setStepSize(state, intersection.pathLength());
63  return Intersection3D::Status::reachable;
64  }
65  }
66 
67  ACTS_VERBOSE("Surface is NOT reachable");
68  return Intersection3D::Status::unreachable;
69 }
70 
79 template <typename stepper_t, typename object_intersection_t>
80 void updateSingleStepSize(typename stepper_t::State& state,
81  const object_intersection_t& oIntersection,
82  bool release = true) {
83  double stepSize = oIntersection.pathLength();
84  state.stepSize.update(stepSize, ConstrainedStep::actor, release);
85 }
86 
87 } // namespace detail
88 } // namespace Acts