File indexing completed on 2025-01-18 09:10:59
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Propagator/Propagator.hpp"
0012 #include "Acts/Surfaces/Surface.hpp"
0013
0014 #include <sstream>
0015
0016 namespace Acts {
0017
0018
0019 struct SurfaceSelector {
0020 bool selectSensitive = true;
0021 bool selectMaterial = false;
0022 bool selectPassive = false;
0023
0024
0025
0026
0027
0028
0029 SurfaceSelector(bool sSensitive = true, bool sMaterial = false,
0030 bool sPassive = false)
0031 : selectSensitive(sSensitive),
0032 selectMaterial(sMaterial),
0033 selectPassive(sPassive) {}
0034
0035
0036
0037
0038 bool operator()(const Acts::Surface& surface) const {
0039 if (selectSensitive && surface.associatedDetectorElement() != nullptr) {
0040 return true;
0041 }
0042 if (selectMaterial && surface.surfaceMaterial() != nullptr) {
0043 return true;
0044 }
0045 if (selectPassive) {
0046 return true;
0047 }
0048 return false;
0049 }
0050 };
0051
0052
0053 struct SurfaceHit {
0054 const Surface* surface = nullptr;
0055 Vector3 position;
0056 Vector3 direction;
0057 };
0058
0059
0060
0061
0062
0063
0064
0065 template <typename Selector = SurfaceSelector>
0066 struct SurfaceCollector {
0067
0068 Selector selector;
0069
0070
0071
0072
0073 struct this_result {
0074 std::vector<SurfaceHit> collected;
0075 };
0076
0077 using result_type = this_result;
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093 template <typename propagator_state_t, typename stepper_t,
0094 typename navigator_t>
0095 void act(propagator_state_t& state, const stepper_t& stepper,
0096 const navigator_t& navigator, result_type& result,
0097 const Logger& logger) const {
0098 if (state.stage == PropagatorStage::postPropagation) {
0099 return;
0100 }
0101
0102 auto currentSurface = navigator.currentSurface(state.navigation);
0103
0104
0105 if (currentSurface && selector(*currentSurface)) {
0106
0107 SurfaceHit surface_hit;
0108 surface_hit.surface = currentSurface;
0109 surface_hit.position = stepper.position(state.stepping);
0110 surface_hit.direction = stepper.direction(state.stepping);
0111
0112 result.collected.push_back(surface_hit);
0113
0114 ACTS_VERBOSE("Collect surface " << currentSurface->geometryId());
0115 }
0116 }
0117 };
0118
0119 }