File indexing completed on 2025-01-18 09:11:26
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Material/MaterialValidater.hpp"
0010
0011 #include "Acts/Material/ISurfaceMaterial.hpp"
0012 #include "Acts/Material/interface/IAssignmentFinder.hpp"
0013 #include "Acts/Utilities/StringHelpers.hpp"
0014
0015 Acts::MaterialValidater::MaterialValidater(
0016 const Acts::MaterialValidater::Config& cfg,
0017 std::unique_ptr<const Acts::Logger> mlogger)
0018 : m_cfg(cfg), m_logger(std::move(mlogger)) {
0019 if (m_cfg.materialAssigner == nullptr) {
0020 throw std::invalid_argument("Missing material assigner");
0021 }
0022 }
0023
0024 Acts::RecordedMaterialTrack Acts::MaterialValidater::recordMaterial(
0025 const GeometryContext& gctx, const MagneticFieldContext& mctx,
0026 const Vector3& position, const Vector3& direction) const {
0027 ACTS_DEBUG("MaterialValidater::recordMaterial with position "
0028 << toString(position) << " and direction " << toString(direction));
0029
0030
0031 Acts::RecordedMaterialTrack mTrack{{position, direction}, {}};
0032
0033 auto [surfaceAssignments, volumeAssignments] =
0034 m_cfg.materialAssigner->assignmentCandidates(gctx, mctx, position,
0035 direction);
0036
0037 for (const auto& [surface, sposition, sdirection] : surfaceAssignments) {
0038
0039 auto materialSlab = surface->surfaceMaterial()->materialSlab(sposition);
0040 auto pathCorrection = surface->pathCorrection(gctx, sposition, sdirection);
0041
0042 Acts::MaterialInteraction mInteraction;
0043 mInteraction.surface = surface;
0044 mInteraction.position = sposition;
0045 mInteraction.direction = sdirection;
0046 mInteraction.materialSlab = MaterialSlab(
0047 materialSlab.material(), materialSlab.thickness() * pathCorrection);
0048 mInteraction.pathCorrection = pathCorrection;
0049 mInteraction.intersection = sposition;
0050 mInteraction.intersectionID = surface->geometryId();
0051
0052 mTrack.second.materialInX0 += mInteraction.materialSlab.thicknessInX0();
0053 mTrack.second.materialInL0 += mInteraction.materialSlab.thicknessInL0();
0054 mTrack.second.materialInteractions.push_back(mInteraction);
0055 }
0056
0057 ACTS_VERBOSE("Recorded material track with "
0058 << mTrack.second.materialInteractions.size()
0059 << " material interactions.");
0060
0061 return mTrack;
0062 }