|
||||
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/Material/AccumulatedMaterialSlab.hpp" 0013 #include "Acts/Material/MaterialSlab.hpp" 0014 #include "Acts/Utilities/BinUtility.hpp" 0015 0016 #include <array> 0017 #include <cstddef> 0018 #include <memory> 0019 #include <vector> 0020 0021 namespace Acts { 0022 0023 class ISurfaceMaterial; 0024 0025 /// @class AccumulatedSurfaceMaterial 0026 /// 0027 /// This class is used by the SurfaceMaterialMapper in order to 0028 /// accumulate/collect material information during the mapping process. 0029 /// 0030 /// It performs event- and run-average when called, and returns 0031 /// a new SurfaceMaterial object as a unique_ptr after finalisation 0032 class AccumulatedSurfaceMaterial { 0033 public: 0034 using AccumulatedVector = std::vector<AccumulatedMaterialSlab>; 0035 using AccumulatedMatrix = std::vector<AccumulatedVector>; 0036 0037 /// Default Constructor - for homogeneous material 0038 /// 0039 /// @param splitFactor is the pre/post splitting directive 0040 AccumulatedSurfaceMaterial(double splitFactor = 0.); 0041 0042 /// Explicit constructor with only full MaterialSlab, 0043 /// for one-dimensional binning. 0044 /// 0045 /// The split factors: 0046 /// - 1. : oppositePre 0047 /// - 0. : alongPre 0048 /// ===> 1 Dimensional array 0049 /// 0050 /// @param binUtility defines the binning structure on the surface 0051 /// @param splitFactor is the pre/post splitting directive 0052 AccumulatedSurfaceMaterial(const BinUtility& binUtility, 0053 double splitFactor = 0.); 0054 0055 /// Copy Constructor 0056 /// 0057 /// @param asma is the source object to be copied 0058 AccumulatedSurfaceMaterial(const AccumulatedSurfaceMaterial& asma) = default; 0059 0060 /// Copy Move Constructor 0061 /// 0062 /// @param asma is the source object to be copied 0063 AccumulatedSurfaceMaterial(AccumulatedSurfaceMaterial&& asma) = default; 0064 0065 /// Assignment Move operator 0066 /// 0067 /// @param asma is the source object to be copied 0068 AccumulatedSurfaceMaterial& operator=(AccumulatedSurfaceMaterial&& asma) = 0069 default; 0070 0071 /// Assignment operator 0072 /// 0073 /// @param asma is the source object to be copied 0074 AccumulatedSurfaceMaterial& operator=( 0075 const AccumulatedSurfaceMaterial& asma) = default; 0076 0077 /// Destructor 0078 ~AccumulatedSurfaceMaterial() = default; 0079 0080 /// Return the BinUtility 0081 const BinUtility& binUtility() const; 0082 0083 /// Assign a material properties object 0084 /// 0085 /// @param lp local position for the bin assignment 0086 /// @param mp material properties to be assigned 0087 /// @param pathCorrection Correction factor for the effective path length 0088 /// 0089 /// @return the bin triple to which the material was assigned 0090 std::array<std::size_t, 3> accumulate(const Vector2& lp, 0091 const MaterialSlab& mp, 0092 double pathCorrection = 1.); 0093 0094 /// Assign a material properties object 0095 /// 0096 /// @param gp global position for the bin assignment 0097 /// @param mp material properties to be assigned 0098 /// @param pathCorrection Correction factor for the effective path length 0099 /// 0100 /// @return the bin triple to which the material was assigned 0101 std::array<std::size_t, 3> accumulate(const Vector3& gp, 0102 const MaterialSlab& mp, 0103 double pathCorrection = 1.); 0104 0105 /// Use the accumulated material to update the material variance 0106 /// 0107 /// @param trackBins The bins that were touched by this event 0108 /// @param emptyHit indicator if this is an empty assignment 0109 /// @param slabReference reference slab (from the map) used to compute the variance 0110 /// If none is given, the average runs over all bins in the surface map 0111 void trackVariance(const std::vector<std::array<std::size_t, 3>>& trackBins, 0112 MaterialSlab slabReference, bool emptyHit = false); 0113 0114 /// Use the accumulated material to update the material variance 0115 /// 0116 /// @param gp global position for the bin assignment 0117 /// @param emptyHit indicator if this is an empty assignment 0118 /// @param slabReference indicator if this is an empty assignment 0119 void trackVariance(const Vector3& gp, MaterialSlab slabReference, 0120 bool emptyHit = false); 0121 0122 /// Average the information accumulated from one mapped track 0123 /// 0124 /// @param trackBins The bins that were touched by this event 0125 /// @param emptyHit indicator if this is an empty assignment 0126 /// If none is given, the average runs over all bins in the surface map 0127 void trackAverage( 0128 const std::vector<std::array<std::size_t, 3>>& trackBins = {}, 0129 bool emptyHit = false); 0130 0131 /// Average the information accumulated from one mapped track 0132 /// 0133 /// @param gp global position for the bin assignment 0134 /// @param emptyHit indicator if this is an empty assignment 0135 void trackAverage(const Vector3& gp, bool emptyHit = false); 0136 0137 /// Total average creates SurfaceMaterial 0138 std::unique_ptr<const ISurfaceMaterial> totalAverage(); 0139 0140 /// Access to the accumulated material 0141 const AccumulatedMatrix& accumulatedMaterial() const; 0142 0143 /// Access to the split factor 0144 double splitFactor() const; 0145 0146 private: 0147 /// The helper for the bin finding 0148 BinUtility m_binUtility{}; 0149 0150 /// the split factor 0151 double m_splitFactor{0.}; 0152 0153 /// The stored accumulated material matrix 0154 AccumulatedMatrix m_accumulatedMaterial; 0155 }; 0156 0157 inline const BinUtility& AccumulatedSurfaceMaterial::binUtility() const { 0158 return (m_binUtility); 0159 } 0160 0161 inline const AccumulatedSurfaceMaterial::AccumulatedMatrix& 0162 AccumulatedSurfaceMaterial::accumulatedMaterial() const { 0163 return (m_accumulatedMaterial); 0164 } 0165 0166 inline double AccumulatedSurfaceMaterial::splitFactor() const { 0167 return m_splitFactor; 0168 } 0169 } // namespace Acts
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |