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