|
||||
File indexing completed on 2025-01-19 09:23:24
0001 // This file is part of the Acts project. 0002 // 0003 // Copyright (C) 2019 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 http://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/Grid.hpp" 0016 #include "Acts/Utilities/detail/AxisFwd.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 MaterialMapper<Grid<Material::ParametersVector, detail::EquidistantAxis, 0063 detail::EquidistantAxis>> 0064 materialMapperRZ( 0065 const std::function<std::size_t(std::array<std::size_t, 2> binsRZ, 0066 std::array<std::size_t, 2> nBinsRZ)>& 0067 materialVectorToGridMapper, 0068 std::vector<double> rPos, std::vector<double> zPos, 0069 const std::vector<Acts::Material>& material, 0070 double lengthUnit = UnitConstants::mm); 0071 0072 /// Method to setup the MaterialMapper 0073 /// @param [in] materialVectorToGridMapper Function mapping the vector of 0074 /// material to the map of material values 0075 /// 0076 /// e.g.: we have small grid with the values: x={2,3}, y={3,4}, z ={4,5}, the 0077 /// corresponding indices are i (belonging to x), j (belonging to y) and k 0078 /// (belonging to z), the globalIndex is M (belonging to the values of the 0079 /// Material) and the map is: 0080 ///| x | i | y | j | z | k | M | 0081 ///|----:|:----:|:----:|:----:|:----:|:----:|:----| 0082 ///| 2 | 0 | 3 | 0 | 4 | 0 | 0 | 0083 ///| 2 | 0 | 3 | 0 | 5 | 1 | 1 | 0084 ///| 2 | 0 | 4 | 1 | 4 | 0 | 2 | 0085 ///| 2 | 0 | 4 | 1 | 5 | 1 | 3 | 0086 ///| 3 | 1 | 3 | 0 | 4 | 0 | 4 | 0087 ///| 3 | 1 | 3 | 0 | 5 | 1 | 5 | 0088 ///| 3 | 1 | 4 | 1 | 4 | 0 | 6 | 0089 ///| 3 | 1 | 4 | 1 | 5 | 1 | 7 | 0090 /// 0091 /// In this case the function would look like: 0092 /// @code 0093 /// [](std::array<std::size_t, 3> binsXYZ, std::array<std::size_t, 3> nBinsXYZ) 0094 /// { 0095 /// return (binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) 0096 /// + binsXYZ.at(1) * nBinsXYZ.at(2) 0097 /// + binsXYZ.at(2)); 0098 /// } 0099 /// @endcode 0100 /// @param[in] xPos Values of the grid points in x 0101 /// @note The values do not need to be sorted or unique (this will be done 0102 /// inside the function) 0103 /// @param[in] yPos Values of the grid points in y 0104 /// @note The values do not need to be sorted or unique (this will be done 0105 /// inside the function) 0106 /// @param[in] zPos Values of the grid points in z 0107 /// @note The values do not need to be sorted or unique (this will be done 0108 /// inside the function) 0109 /// @param [in] material The material classification values in x, y and z for 0110 /// all given grid points stored in a vector 0111 /// @note The function localToGlobalBin determines how the material was 0112 /// stored in the vector in respect to the grid values 0113 /// @param [in] lengthUnit The unit of the grid points 0114 MaterialMapper<Grid<Material::ParametersVector, detail::EquidistantAxis, 0115 detail::EquidistantAxis, detail::EquidistantAxis>> 0116 materialMapperXYZ( 0117 const std::function<std::size_t(std::array<std::size_t, 3> binsXYZ, 0118 std::array<std::size_t, 3> nBinsXYZ)>& 0119 materialVectorToGridMapper, 0120 std::vector<double> xPos, std::vector<double> yPos, 0121 std::vector<double> zPos, const std::vector<Material>& material, 0122 double lengthUnit = UnitConstants::mm); 0123 0124 } // 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 |