Project
Loading...
Searching...
No Matches
IndexTableConfiguration.h
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
12#ifndef ALICEO2_ITSMFT_TRACKING_INDEXTABLECONFIGURATION_H_
13#define ALICEO2_ITSMFT_TRACKING_INDEXTABLECONFIGURATION_H_
14
15// Host-only: DetectorParameters owns std::vector members and is not
16// device-compatible. Keep this boundary separate so existing host-configuration
17// consumers do not inherit IndexTableUtils.h's extra dependencies.
18#ifndef GPUCA_GPUCODE
19
20#include <cmath>
21#include <cstddef>
22#include <limits>
23
27
29{
30
37 const DetectorParameters& params,
38 int activeSurfaceCount,
40 gsl::span<const SurfaceChartRange> chartRanges) noexcept;
41
47 int activeSurfaceCount) noexcept
48{
49 if (a.getCoordType() != b.getCoordType() ||
50 a.getNrowBins() != b.getNrowBins() ||
51 a.getNcolBins() != b.getNcolBins() ||
52 a.getRowOrigin() != b.getRowOrigin() ||
53 a.getRowCoordinateSpan() != b.getRowCoordinateSpan()) {
54 return false;
55 }
56 if (activeSurfaceCount <= 0 || activeSurfaceCount > o2::itsmft::IndexTableUtilsCore::MaxLayers) {
57 return false;
58 }
59 for (int iLayer = 0; iLayer < activeSurfaceCount; ++iLayer) {
60 if (a.getLayerColMin(iLayer) != b.getLayerColMin(iLayer) ||
61 a.getLayerColMax(iLayer) != b.getLayerColMax(iLayer)) {
62 return false;
63 }
64 }
65 return true;
66}
67
70inline bool checkedIndexTableSizeProduct(std::size_t a, std::size_t b, std::size_t& result) noexcept
71{
72 if (a != 0 && b > std::numeric_limits<std::size_t>::max() / a) {
73 return false;
74 }
75 result = a * b;
76 return true;
77}
78
79} // namespace o2::itsmft::tracking
80
81#endif // GPUCA_GPUCODE
82
83#endif /* ALICEO2_ITSMFT_TRACKING_INDEXTABLECONFIGURATION_H_ */
Shared CA tracking configuration for ITS and MFT.
Shared index-table utilities for periodic-phi surface charts.
GLuint64EXT * result
Definition glcorearb.h:5662
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLenum const GLfloat * params
Definition glcorearb.h:272
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
bool checkedIndexTableSizeProduct(std::size_t a, std::size_t b, std::size_t &result) noexcept
bool indexTableConfigurationsMatch(const o2::itsmft::IndexTableUtilsCore &a, const o2::itsmft::IndexTableUtilsCore &b, int activeSurfaceCount) noexcept
bool configureIndexTableUtils(o2::itsmft::IndexTableUtilsCore &destination, const DetectorParameters &params, int activeSurfaceCount, SurfaceKind kind, gsl::span< const SurfaceChartRange > chartRanges) noexcept