Back to home page

EIC code displayed by LXR

 
 

    


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

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