Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 07:46:13

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/Geometry/GeometryIdentifier.hpp"
0013 #include "Acts/Geometry/TrackingVolume.hpp"
0014 #include "Acts/Material/MaterialSlab.hpp"
0015 
0016 namespace Acts {
0017 
0018 class Surface;
0019 
0020 /// @brief The Material interaction volume struct
0021 ///
0022 /// @ingroup material
0023 ///
0024 /// It acts as a switch between detector and tracking volume
0025 /// as long as those co-exist alongside
0026 struct InteractionVolume {
0027   /// The tracking volume
0028   const TrackingVolume* trackingVolume = nullptr;
0029 
0030   /// Empty constructor
0031   InteractionVolume() = default;
0032 
0033   /// Constructor from tracking volume
0034   /// @param tv The tracking volume
0035   explicit InteractionVolume(const TrackingVolume* tv) : trackingVolume(tv) {}
0036 
0037   /// Forward the geometry identifier
0038   /// @return The geometry identifier from the contained volume, or invalid ID if empty
0039   GeometryIdentifier geometryId() const {
0040     if (trackingVolume != nullptr) {
0041       return trackingVolume->geometryId();
0042     } else {
0043       return GeometryIdentifier();
0044     }
0045   }
0046 
0047   /// Check if the volume is valid
0048   /// @return True if both tracking volume and detector volume pointers are null
0049   bool empty() const { return trackingVolume == nullptr; }
0050 };
0051 
0052 /// @brief The Material interaction struct
0053 /// It records the surface  and the passed material
0054 /// This is only necessary recorded when configured
0055 struct MaterialInteraction {
0056   /// The particle position at the interaction.
0057   Vector3 position = Vector3(0., 0., 0);
0058   /// The particle time at the interaction.
0059   double time = 0.0;
0060   /// The particle direction at the interaction.
0061   Vector3 direction = Vector3(0., 0., 0);
0062   /// The momentum change due to the interaction.
0063   double deltaP = 0.0;
0064   /// Expected phi variance due to the interactions.
0065   double sigmaPhi2 = 0.0;
0066   /// Expected theta variance due to the interactions.
0067   double sigmaTheta2 = 0.0;
0068   /// Expected q/p variance due to the interactions.
0069   double sigmaQoP2 = 0.0;
0070   /// The position where the interaction occurred.
0071   Vector3 intersection = Vector3(0., 0., 0);
0072   /// The ID where the interaction occurred.
0073   GeometryIdentifier intersectionID;
0074   /// The surface where the interaction occurred.
0075   const Surface* surface = nullptr;
0076   /// The volume where the interaction occurred.
0077   InteractionVolume volume{};
0078   /// Update the volume step to implement the proper step size
0079   bool updatedVolumeStep = false;
0080   /// The path correction factor due to non-zero incidence on the surface.
0081   double pathCorrection = 1.;
0082   /// The effective, passed material properties including the path correction.
0083   MaterialSlab materialSlab = MaterialSlab::Nothing();
0084 };
0085 
0086 /// Simple result struct to be returned
0087 /// It mainly acts as an internal state which is
0088 /// created for every propagation/extrapolation step
0089 struct RecordedMaterial {
0090   /// The accumulated material in units of X0 (radiation length)
0091   double materialInX0 = 0.;
0092   /// The accumulated materialInL0
0093   double materialInL0 = 0.;
0094   /// This one is only filled when recordInteractions is switched on
0095   std::vector<MaterialInteraction> materialInteractions;
0096 };
0097 
0098 /// And recorded material track
0099 /// - this is start:  position, start momentum
0100 ///   and the Recorded material
0101 using RecordedMaterialTrack =
0102     std::pair<std::pair<Acts::Vector3, Acts::Vector3>, RecordedMaterial>;
0103 
0104 }  // namespace Acts