Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:56

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;
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 Constructor
0076   ///
0077   /// @tparam propagator_state_t Type of the propagator state
0078   /// @tparam stepper_t Type of the stepper
0079   ///
0080   /// @param [in] vVolume The current volume
0081   /// @param [in] state State of the propagation
0082   /// @param [in] stepper Stepper in use
0083   template <typename propagator_state_t, typename stepper_t>
0084   VolumeMaterialInteraction(const Acts::Experimental::DetectorVolume* vVolume,
0085                             const propagator_state_t& state,
0086                             const stepper_t& stepper)
0087       : volume(vVolume),
0088         pos(stepper.position(state.stepping)),
0089         time(stepper.time(state.stepping)),
0090         dir(stepper.direction(state.stepping)),
0091         qOverP(stepper.qOverP(state.stepping)),
0092         absQ(stepper.particleHypothesis(state.stepping).absoluteCharge()),
0093         momentum(stepper.absoluteMomentum(state.stepping)),
0094         mass(stepper.particleHypothesis(state.stepping).mass()),
0095         absPdg(stepper.particleHypothesis(state.stepping).absolutePdg()),
0096         performCovarianceTransport(state.stepping.covTransport),
0097         navDir(state.options.direction) {}
0098 
0099   /// @brief This function evaluates the material properties to interact with
0100   ///
0101   /// @tparam propagator_state_t Type of the propagator state
0102   /// @tparam navigator_t Type of the propagator state
0103   ///
0104   /// @param [in] state State of the propagation
0105   /// @param [in] navigator Navigator of the propagation
0106   ///
0107   /// @return Boolean statement whether the material is valid
0108   template <typename propagator_state_t, typename navigator_t>
0109   bool evaluateMaterialSlab(const propagator_state_t& state,
0110                             const navigator_t& navigator) {
0111     pathCorrection = 0;
0112     if (navigator.currentVolume(state.navigation) != nullptr &&
0113         navigator.currentVolume(state.navigation)->volumeMaterial() !=
0114             nullptr) {
0115       slab = MaterialSlab(navigator.currentVolume(state.navigation)
0116                               ->volumeMaterial()
0117                               ->material(pos),
0118                           1);  // state.stepping.StepSize
0119     } else {
0120       slab = MaterialSlab();
0121     }
0122     return slab.isValid();
0123   }
0124 };
0125 
0126 }  // namespace Acts::detail