ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SteppingLogger.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SteppingLogger.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2018 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 
14 
15 namespace Acts {
16 
17 class Surface;
18 class Layer;
19 class TrackingVolume;
20 
21 namespace detail {
22 
24 struct Step {
26  Vector3D position = Vector3D(0., 0., 0.);
27  Vector3D momentum = Vector3D(0., 0., 0.);
28  std::shared_ptr<const Surface> surface = nullptr;
29  const TrackingVolume* volume = nullptr;
30 };
31 
37  struct this_result {
38  std::vector<Step> steps;
39  };
40 
42 
44  bool sterile = false;
45 
53  template <typename propagator_state_t, typename stepper_t>
54  void operator()(propagator_state_t& state, const stepper_t& stepper,
55  result_type& result) const {
56  // don't log if you have reached the target
57  if (sterile or state.navigation.targetReached) {
58  return;
59  }
60  // record the propagation state
61  Step step;
62  step.stepSize = state.stepping.stepSize;
63  step.position = stepper.position(state.stepping);
64  step.momentum =
65  stepper.momentum(state.stepping) * stepper.direction(state.stepping);
66 
67  if (state.navigation.currentSurface != nullptr) {
68  // hang on to surface
69  step.surface = state.navigation.currentSurface->getSharedPtr();
70  }
71 
72  step.volume = state.navigation.currentVolume;
73  result.steps.push_back(std::move(step));
74  }
75 
78  template <typename propagator_state_t, typename stepper_t>
79  void operator()(propagator_state_t& /*unused*/,
80  const stepper_t& /*unused*/) const {}
81 };
82 
83 } // namespace detail
84 } // namespace Acts