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/Material/AccumulatedVolumeMaterial.hpp"
0013 #include "Acts/Material/Material.hpp"
0014 #include "Acts/Utilities/Axis.hpp"
0015 #include "Acts/Utilities/AxisDefinitions.hpp"
0016 #include "Acts/Utilities/BinUtility.hpp"
0017 #include "Acts/Utilities/BinningType.hpp"
0018 #include "Acts/Utilities/Grid.hpp"
0019 
0020 #include <array>
0021 #include <cstddef>
0022 #include <functional>
0023 #include <tuple>
0024 #include <utility>
0025 #include <vector>
0026 
0027 namespace Acts {
0028 
0029 class MaterialSlab;
0030 
0031 /// @brief Type alias for equidistant axis with open boundary type
0032 /// @details Used for defining grid axes with equally spaced bins and open boundaries
0033 using EAxis = Acts::Axis<AxisType::Equidistant>;
0034 
0035 /// @brief Type alias for a 2-dimensional grid
0036 /// @details Grid structure for storing values with two dimensions
0037 using Grid2D = Acts::Grid<Acts::AccumulatedVolumeMaterial, EAxis, EAxis>;
0038 
0039 /// @brief Type alias for a 3-dimensional grid
0040 /// @details Grid structure for storing values with three dimensions
0041 using Grid3D = Acts::Grid<Acts::AccumulatedVolumeMaterial, EAxis, EAxis, EAxis>;
0042 
0043 /// @brief Type alias for a 2-dimensional material grid
0044 /// @details Grid structure for storing material parameters with two dimensions
0045 using MaterialGrid2D =
0046     Acts::Grid<Acts::Material::ParametersVector, EAxis, EAxis>;
0047 
0048 /// @brief Type alias for a 3-dimensional material grid
0049 /// @details Grid structure for storing material parameters with three dimensions
0050 using MaterialGrid3D =
0051     Acts::Grid<Acts::Material::ParametersVector, EAxis, EAxis, EAxis>;
0052 
0053 /// @brief Type alias for the axis data in material grids
0054 /// @details Tuple containing the minimum value, maximum value, and number of bins for an axis
0055 using MaterialGridAxisData = std::tuple<double, double, std::size_t>;
0056 
0057 /// @brief Helper method that creates the cache grid for the mapping. This
0058 /// grid allows the collection of material at a the anchor points.
0059 ///
0060 /// @param [in] gridAxis1 Axis data
0061 /// @param [in] gridAxis2 Axis data
0062 /// @note The data of the axes is given in the std::array as {minimum value,
0063 /// maximum value, number of bins}
0064 ///
0065 /// @return The grid
0066 Grid2D createGrid(MaterialGridAxisData gridAxis1,
0067                   MaterialGridAxisData gridAxis2);
0068 
0069 /// @brief Helper method that creates the cache grid for the mapping. This
0070 /// grid allows the collection of material at a the anchor points.
0071 ///
0072 /// @param [in] gridAxis1 Axis data
0073 /// @param [in] gridAxis2 Axis data
0074 /// @param [in] gridAxis3 Axis data
0075 /// @note The data of the axes is given in the std::array as {minimum value,
0076 /// maximum value, number of bins}
0077 ///
0078 /// @return The grid
0079 Grid3D createGrid(MaterialGridAxisData gridAxis1,
0080                   MaterialGridAxisData gridAxis2,
0081                   MaterialGridAxisData gridAxis3);
0082 
0083 /// @brief return a function that return the coordinate corresponding to type of
0084 /// bin
0085 ///
0086 /// @param [in] type Type of bin
0087 ///
0088 /// @return a coordinate transform function
0089 std::function<double(Acts::Vector3)> globalToLocalFromBin(
0090     Acts::AxisDirection& type);
0091 
0092 /// @brief Create a 2DGrid using a BinUtility.
0093 /// Also determine the corresponding global to local transform and grid mapping
0094 /// function
0095 ///
0096 /// @param [in] bins BinUtility of the volume to be mapped
0097 /// @param [in] transfoGlobalToLocal Global to local transform to be updated.
0098 ///
0099 /// @return the 3D grid
0100 Grid2D createGrid2D(
0101     const BinUtility& bins,
0102     std::function<Acts::Vector2(Acts::Vector3)>& transfoGlobalToLocal);
0103 
0104 /// @brief Create a 3DGrid using a BinUtility.
0105 /// Also determine the corresponding global to local transform and grid mapping
0106 /// function
0107 ///
0108 /// @param [in] bins BinUtility of the volume to be mapped
0109 /// @param [in] transfoGlobalToLocal Global to local transform to be updated.
0110 ///
0111 /// @return the 3D grid
0112 Grid3D createGrid3D(
0113     const BinUtility& bins,
0114     std::function<Acts::Vector3(Acts::Vector3)>& transfoGlobalToLocal);
0115 
0116 /// @brief Average the material collected in a 2D grid and use it to create a 2D material grid
0117 ///
0118 /// @param [in] grid The material collecting grid
0119 /// coordinate
0120 ///
0121 /// @return The average material grid decomposed into classification numbers
0122 MaterialGrid2D mapMaterialPoints(Grid2D& grid);
0123 
0124 /// @brief Average the material collected in a 3D grid and use it to create a 3D material grid
0125 ///
0126 /// @param [in] grid The material collecting grid
0127 /// coordinate
0128 ///
0129 /// @return The average material grid decomposed into classification numbers
0130 MaterialGrid3D mapMaterialPoints(Grid3D& grid);
0131 
0132 }  // namespace Acts