Project
Loading...
Searching...
No Matches
IndexTableConfiguration.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13
14#include <array>
15#include <cstdint>
16#include <limits>
17
19#include "GPUCommonMath.h"
20
22{
23
25
28 int activeSurfaceCount,
30 gsl::span<const SurfaceChartRange> chartRanges) noexcept
31{
33 return false;
34 }
35 if (!(activeSurfaceCount > 0 && activeSurfaceCount <= o2::itsmft::IndexTableUtilsCore::MaxLayers)) {
36 return false;
37 }
38 if (params.RowBins <= 0) {
39 return false;
40 }
41 if (params.ColBins <= 0) {
42 return false;
43 }
44
45 const std::uint64_t binCount = static_cast<std::uint64_t>(params.RowBins) * static_cast<std::uint64_t>(params.ColBins);
46 if (binCount > static_cast<std::uint64_t>(std::numeric_limits<int>::max())) {
47 return false;
48 }
49
50 if (chartRanges.size() < static_cast<std::size_t>(activeSurfaceCount)) {
51 return false;
52 }
53 std::array<float, o2::itsmft::IndexTableUtilsCore::MaxLayers> colMin{};
54 std::array<float, o2::itsmft::IndexTableUtilsCore::MaxLayers> colMax{};
55 for (int iLayer = 0; iLayer < activeSurfaceCount; ++iLayer) {
56 if (!o2::gpu::GPUCommonMath::Finite(chartRanges[iLayer].min) ||
57 !o2::gpu::GPUCommonMath::Finite(chartRanges[iLayer].max)) {
58 return false;
59 }
60 if (!(chartRanges[iLayer].max > chartRanges[iLayer].min)) {
61 return false;
62 }
63 colMin[iLayer] = chartRanges[iLayer].min;
64 colMax[iLayer] = chartRanges[iLayer].max;
65 }
66
68 params.RowBins, params.ColBins, 0.f, o2::constants::math::TwoPI,
69 gsl::span<const float>{colMin.data(), static_cast<std::size_t>(activeSurfaceCount)},
70 gsl::span<const float>{colMax.data(), static_cast<std::size_t>(activeSurfaceCount)});
71 return true;
72}
73
74} // namespace o2::itsmft::tracking
useful math constants
GLenum const GLfloat * params
Definition glcorearb.h:272
bool configureIndexTableUtils(o2::itsmft::IndexTableUtilsCore &destination, const DetectorParameters &params, int activeSurfaceCount, SurfaceKind kind, gsl::span< const SurfaceChartRange > chartRanges) noexcept
constexpr size_t min
constexpr size_t max