Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-17 07:58:35

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