Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:22:29

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/PdgParticle.hpp"
0013 #include "Acts/Geometry/TrackingVolume.hpp"
0014 #include "Acts/Material/ISurfaceMaterial.hpp"
0015 #include "Acts/Material/MaterialInteraction.hpp"
0016 #include "Acts/Material/MaterialSlab.hpp"
0017 #include "Acts/Surfaces/Surface.hpp"
0018 
0019 namespace Acts::detail {
0020 
0021 /// @brief Struct to handle volume material interaction
0022 struct VolumeMaterialInteraction {
0023   /// The material interaction volume
0024   InteractionVolume volume{};
0025   /// The particle current position
0026   const Vector3 pos = Vector3::Zero();
0027   /// The particle current time
0028   const double time = 0;
0029   /// The particle current direction
0030   const Vector3 dir = Vector3::Zero();
0031   /// The particle q/p at the interaction
0032   const float qOverP = 0;
0033   /// The absolute particle charge
0034   const float absQ = 0;
0035   /// The particle momentum at the interaction
0036   const float momentum = 0;
0037   /// The particle mass
0038   const float mass = 0;
0039   /// The particle pdg
0040   const PdgParticle absPdg = eInvalid;
0041   /// The covariance transport decision at the interaction
0042   const bool performCovarianceTransport = false;
0043   /// The navigation direction
0044   const Direction navDir;
0045 
0046   /// Data evaluated within this struct
0047   MaterialSlab slab = MaterialSlab::Nothing();
0048   /// The path correction factor due to non-zero incidence on the surface.
0049   double pathCorrection = 0;
0050 
0051   /// @brief Constructor
0052   ///
0053   /// @tparam propagator_state_t Type of the propagator state
0054   /// @tparam stepper_t Type of the stepper
0055   ///
0056   /// @param [in] vVolume The current volume
0057   /// @param [in] state State of the propagation
0058   /// @param [in] stepper Stepper in use
0059   template <typename propagator_state_t, typename stepper_t>
0060   VolumeMaterialInteraction(const TrackingVolume* vVolume,
0061                             const propagator_state_t& state,
0062                             const stepper_t& stepper)
0063       : volume(vVolume),
0064         pos(stepper.position(state.stepping)),
0065         time(stepper.time(state.stepping)),
0066         dir(stepper.direction(state.stepping)),
0067         qOverP(stepper.qOverP(state.stepping)),
0068         absQ(stepper.particleHypothesis(state.stepping).absoluteCharge()),
0069         momentum(stepper.absoluteMomentum(state.stepping)),
0070         mass(stepper.particleHypothesis(state.stepping).mass()),
0071         absPdg(stepper.particleHypothesis(state.stepping).absolutePdg()),
0072         performCovarianceTransport(state.stepping.covTransport),
0073         navDir(state.options.direction) {}
0074 
0075   /// @brief This function evaluates the material properties to interact with
0076   ///
0077   /// @tparam propagator_state_t Type of the propagator state
0078   /// @tparam navigator_t Type of the propagator state
0079   ///
0080   /// @param [in] state State of the propagation
0081   /// @param [in] navigator Navigator of the propagation
0082   ///
0083   /// @return Boolean statement whether the material is valid
0084   template <typename propagator_state_t, typename navigator_t>
0085   bool evaluateMaterialSlab(const propagator_state_t& state,
0086                             const navigator_t& navigator) {
0087     pathCorrection = 0;
0088     if (navigator.currentVolume(state.navigation) != nullptr &&
0089         navigator.currentVolume(state.navigation)->volumeMaterial() !=
0090             nullptr) {
0091       slab = MaterialSlab(navigator.currentVolume(state.navigation)
0092                               ->volumeMaterial()
0093                               ->material(pos),
0094                           1);  // state.stepping.StepSize
0095     } else {
0096       slab = MaterialSlab::Nothing();
0097     }
0098     return !slab.isVacuum();
0099   }
0100 };
0101 
0102 }  // namespace Acts::detail