Back to home page

EIC code displayed by LXR

 
 

    


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

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