File indexing completed on 2025-01-18 09:27:44
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Common.hpp"
0013 #include "Acts/Definitions/Direction.hpp"
0014 #include "Acts/Definitions/PdgParticle.hpp"
0015 #include "Acts/Definitions/TrackParametrization.hpp"
0016 #include "Acts/Definitions/Units.hpp"
0017 #include "Acts/Material/ISurfaceMaterial.hpp"
0018 #include "Acts/Material/MaterialSlab.hpp"
0019 #include "Acts/Surfaces/Surface.hpp"
0020
0021 #include <algorithm>
0022 #include <cmath>
0023
0024 namespace Acts::detail {
0025
0026
0027 struct PointwiseMaterialInteraction {
0028
0029 const Surface* surface = nullptr;
0030
0031
0032 const Vector3 pos = Vector3(0., 0., 0);
0033
0034 const double time = 0.0;
0035
0036 const Vector3 dir = Vector3(0., 0., 0);
0037
0038 const float qOverP = 0.0;
0039
0040 const float absQ = 0.0;
0041
0042 const float momentum = 0.0;
0043
0044 const float mass = 0.0;
0045
0046 const PdgParticle absPdg = PdgParticle::eInvalid;
0047
0048 const bool performCovarianceTransport = false;
0049
0050 const Direction navDir;
0051
0052
0053 MaterialSlab slab;
0054
0055 double pathCorrection = 0.;
0056
0057 double variancePhi = 0.;
0058
0059 double varianceTheta = 0.;
0060
0061 double varianceQoverP = 0.;
0062
0063 double Eloss = 0.;
0064
0065 double nextP = 0.;
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075 template <typename propagator_state_t, typename stepper_t>
0076 PointwiseMaterialInteraction(const Surface* sSurface,
0077 const propagator_state_t& state,
0078 const stepper_t& stepper)
0079 : surface(sSurface),
0080 pos(stepper.position(state.stepping)),
0081 time(stepper.time(state.stepping)),
0082 dir(stepper.direction(state.stepping)),
0083 qOverP(stepper.qOverP(state.stepping)),
0084 absQ(stepper.particleHypothesis(state.stepping).absoluteCharge()),
0085 momentum(stepper.absoluteMomentum(state.stepping)),
0086 mass(stepper.particleHypothesis(state.stepping).mass()),
0087 absPdg(stepper.particleHypothesis(state.stepping).absolutePdg()),
0088 performCovarianceTransport(state.stepping.covTransport),
0089 navDir(state.options.direction) {}
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101 template <typename propagator_state_t, typename navigator_t>
0102 bool evaluateMaterialSlab(
0103 const propagator_state_t& state, const navigator_t& navigator,
0104 MaterialUpdateStage updateStage = MaterialUpdateStage::FullUpdate) {
0105
0106 if (surface == navigator.startSurface(state.navigation)) {
0107 updateStage = MaterialUpdateStage::PostUpdate;
0108
0109 } else if (surface == navigator.targetSurface(state.navigation)) {
0110 updateStage = MaterialUpdateStage::PreUpdate;
0111 }
0112
0113
0114 slab = navigator.currentSurface(state.navigation)
0115 ->surfaceMaterial()
0116 ->materialSlab(pos, navDir, updateStage);
0117
0118
0119 pathCorrection = surface->pathCorrection(state.geoContext, pos, dir);
0120 slab.scaleThickness(pathCorrection);
0121
0122
0123 return slab;
0124 }
0125
0126
0127
0128
0129
0130
0131 void evaluatePointwiseMaterialInteraction(bool multipleScattering,
0132 bool energyLoss);
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142 template <typename propagator_state_t, typename stepper_t>
0143 void updateState(propagator_state_t& state, const stepper_t& stepper,
0144 NoiseUpdateMode updateMode = addNoise) {
0145
0146
0147 const auto nextE = std::hypot(mass, momentum) - Eloss * navDir;
0148
0149 nextP = (mass < nextE) ? std::sqrt(nextE * nextE - mass * mass) : 0;
0150
0151
0152
0153 static constexpr double minP = 10 * Acts::UnitConstants::MeV;
0154 nextP = std::max(minP, nextP);
0155
0156 stepper.update(state.stepping, pos, dir,
0157 std::copysign(absQ / nextP, qOverP), time);
0158 state.stepping.cov(eBoundPhi, eBoundPhi) = updateVariance(
0159 state.stepping.cov(eBoundPhi, eBoundPhi), variancePhi, updateMode);
0160 state.stepping.cov(eBoundTheta, eBoundTheta) =
0161 updateVariance(state.stepping.cov(eBoundTheta, eBoundTheta),
0162 varianceTheta, updateMode);
0163 state.stepping.cov(eBoundQOverP, eBoundQOverP) =
0164 updateVariance(state.stepping.cov(eBoundQOverP, eBoundQOverP),
0165 varianceQoverP, updateMode);
0166 }
0167
0168 private:
0169
0170
0171
0172
0173
0174 void covarianceContributions(bool multipleScattering, bool energyLoss);
0175
0176
0177
0178
0179
0180
0181
0182
0183 double updateVariance(double variance, double change,
0184 NoiseUpdateMode updateMode = addNoise) const;
0185 };
0186
0187 }