|
|
|||
File indexing completed on 2025-10-24 08:18:38
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/Definitions/Units.hpp" 0013 #include "Acts/Material/InterpolatedMaterialMap.hpp" 0014 #include "Acts/Material/Material.hpp" 0015 #include "Acts/Utilities/AxisDefinitions.hpp" 0016 #include "Acts/Utilities/Grid.hpp" 0017 0018 #include <array> 0019 #include <cstddef> 0020 #include <functional> 0021 #include <vector> 0022 0023 // Convenience functions to ease creation of and Acts::InterpolatedMaterialMap 0024 // and to avoid code duplication. Currently implemented for the two most common 0025 // formats: rz and xyz. 0026 0027 namespace Acts { 0028 0029 class Material; 0030 0031 /// Method to setup the MaterialMapper 0032 /// @param [in] materialVectorToGridMapper Function mapping the vector of 0033 /// material to the map of material values 0034 /// 0035 /// e.g.: we have small grid with the values: r={2,3}, z ={4,5}, the 0036 /// corresponding indices are i (belonging to r) and j (belonging to z), the 0037 /// globalIndex is M (belonging to the values of the Material) and the map is: 0038 ///| r | i | z | j | M | 0039 ///|----:|:----:|:----:|:----:|:----| 0040 ///| 2 | 0 | 4 | 0 | 0 | 0041 ///| 2 | 0 | 5 | 1 | 1 | 0042 ///| 3 | 1 | 4 | 0 | 2 | 0043 ///| 3 | 1 | 5 | 1 | 3 | 0044 /// 0045 /// In this case the function would look like: 0046 /// @code 0047 /// [](std::array<std::size_t, 2> binsRZ, std::array<std::size_t, 2> nBinsRZ) { 0048 /// return (binsRZ.at(0) * nBinsRZ.at(1) + binsRZ.at(1)); 0049 /// } 0050 /// @endcode 0051 /// @param [in] rPos Values of the grid points in r 0052 /// @note The values do not need to be sorted or unique (this will be done 0053 /// inside the function) 0054 /// @param [in] zPos Values of the grid points in z 0055 /// @note The values do not need to be sorted or unique (this will be done 0056 /// inside the function) 0057 /// @param [in] material The material classification values in r and z for all 0058 /// given grid points stored in a vector 0059 /// @note The function localToGlobalBin determines how the material was 0060 /// stored in the vector in respect to the grid values 0061 /// @param [in] lengthUnit The unit of the grid points 0062 /// @return A material mapper for RZ coordinate system with equidistant grid 0063 MaterialMapper< 0064 Grid<Material::ParametersVector, Axis<Acts::AxisType::Equidistant>, 0065 Axis<Acts::AxisType::Equidistant>>> 0066 materialMapperRZ( 0067 const std::function<std::size_t(std::array<std::size_t, 2> binsRZ, 0068 std::array<std::size_t, 2> nBinsRZ)>& 0069 materialVectorToGridMapper, 0070 std::vector<double> rPos, std::vector<double> zPos, 0071 const std::vector<Acts::Material>& material, 0072 double lengthUnit = UnitConstants::mm); 0073 0074 /// Method to setup the MaterialMapper 0075 /// @param [in] materialVectorToGridMapper Function mapping the vector of 0076 /// material to the map of material values 0077 /// 0078 /// e.g.: we have small grid with the values: x={2,3}, y={3,4}, z ={4,5}, the 0079 /// corresponding indices are i (belonging to x), j (belonging to y) and k 0080 /// (belonging to z), the globalIndex is M (belonging to the values of the 0081 /// Material) and the map is: 0082 ///| x | i | y | j | z | k | M | 0083 ///|----:|:----:|:----:|:----:|:----:|:----:|:----| 0084 ///| 2 | 0 | 3 | 0 | 4 | 0 | 0 | 0085 ///| 2 | 0 | 3 | 0 | 5 | 1 | 1 | 0086 ///| 2 | 0 | 4 | 1 | 4 | 0 | 2 | 0087 ///| 2 | 0 | 4 | 1 | 5 | 1 | 3 | 0088 ///| 3 | 1 | 3 | 0 | 4 | 0 | 4 | 0089 ///| 3 | 1 | 3 | 0 | 5 | 1 | 5 | 0090 ///| 3 | 1 | 4 | 1 | 4 | 0 | 6 | 0091 ///| 3 | 1 | 4 | 1 | 5 | 1 | 7 | 0092 /// 0093 /// In this case the function would look like: 0094 /// @code 0095 /// [](std::array<std::size_t, 3> binsXYZ, std::array<std::size_t, 3> nBinsXYZ) 0096 /// { 0097 /// return (binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) 0098 /// + binsXYZ.at(1) * nBinsXYZ.at(2) 0099 /// + binsXYZ.at(2)); 0100 /// } 0101 /// @endcode 0102 /// @param[in] xPos Values of the grid points in x 0103 /// @note The values do not need to be sorted or unique (this will be done 0104 /// inside the function) 0105 /// @param[in] yPos Values of the grid points in y 0106 /// @note The values do not need to be sorted or unique (this will be done 0107 /// inside the function) 0108 /// @param[in] zPos Values of the grid points in z 0109 /// @note The values do not need to be sorted or unique (this will be done 0110 /// inside the function) 0111 /// @param [in] material The material classification values in x, y and z for 0112 /// all given grid points stored in a vector 0113 /// @note The function localToGlobalBin determines how the material was 0114 /// stored in the vector in respect to the grid values 0115 /// @param [in] lengthUnit The unit of the grid points 0116 /// @return A material mapper for XYZ coordinate system with equidistant grid 0117 MaterialMapper< 0118 Grid<Material::ParametersVector, Axis<Acts::AxisType::Equidistant>, 0119 Axis<Acts::AxisType::Equidistant>, Axis<Acts::AxisType::Equidistant>>> 0120 materialMapperXYZ( 0121 const std::function<std::size_t(std::array<std::size_t, 3> binsXYZ, 0122 std::array<std::size_t, 3> nBinsXYZ)>& 0123 materialVectorToGridMapper, 0124 std::vector<double> xPos, std::vector<double> yPos, 0125 std::vector<double> zPos, const std::vector<Material>& material, 0126 double lengthUnit = UnitConstants::mm); 0127 0128 } // 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 |
|