Project
Loading...
Searching...
No Matches
SurfaceTrackState.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_SURFACETRACKSTATE_H_
13#define ALICEO2_ITSMFT_TRACKING_SURFACETRACKSTATE_H_
14
15#include <cmath>
16#include <cstddef>
17#include <cstdint>
18#include <type_traits>
19
20#include "GPUCommonDef.h"
23
25{
26
27// The interpretation of parameters and covariance is selected by kind:
28// Barrel: (Y, Z, Snp, Tgl, Q2Pt), referenceCoordinate is local X, alpha is frame angle.
29// Forward: (X, Y, Phi, Tgl, Q2Pt), referenceCoordinate is global Z, alpha is unused (zero).
30
31// Fitted surface state for charged particles; valid tracks have absCharge > 0.
32// The field order keeps the device-facing representation
33// compact while the parameter-only linearization state remains independent.
35 float parameters[5]{};
36 float covariance[15]{};
38 float alpha{0.f};
40 uint8_t flags{0};
41 uint8_t absCharge{0};
42 o2::track::PID pid{o2::track::PID::Pion};
43
44 GPUhdi() float getP() const noexcept
45 {
46 return absCharge * std::sqrt(1.f + parameters[3] * parameters[3]) / std::abs(parameters[4]);
47 }
48
49 GPUhdi() constexpr bool hasRecognizedKind() const noexcept { return isRecognizedSurfaceKind(kind); }
50};
51
52// Covariance-free surface parameters used as the propagation linearization
53// point paired with one SurfaceTrackState.
55 float parameters[5]{};
57 float alpha{0.f};
59
60 GPUhdi() constexpr SurfaceTrackParameters() noexcept = default;
63 {
64 for (uint8_t i = 0; i < 5; ++i) {
65 parameters[i] = state.parameters[i];
66 }
67 }
68
69 GPUhdi() constexpr bool hasRecognizedKind() const noexcept { return isRecognizedSurfaceKind(kind); }
70};
71
72GPUhdi() constexpr uint8_t packedCovarianceIndex(uint8_t row, uint8_t column) noexcept
73{
74 return row >= column ? row * (row + 1) / 2 + column : column * (column + 1) / 2 + row;
75}
76
77// Sanitize a packed covariance after a successful mutation. Diagonal values
78// are made non-negative and capped, with corresponding row/column rescaling;
79// off-diagonals are then limited to their pairwise Cauchy-Schwarz bounds.
80GPUhdi() void sanitizeCovariance(SurfaceTrackState& state, const float (&maxDiagonal)[5]) noexcept
81{
82 auto& c = state.covariance;
83 for (uint8_t i = 0; i < 5; ++i) {
84 const uint8_t diagIndex = packedCovarianceIndex(i, i);
85 c[diagIndex] = c[diagIndex] < 0.f ? -c[diagIndex] : c[diagIndex];
86 if (c[diagIndex] > maxDiagonal[i]) {
87 const float scale = std::sqrt(maxDiagonal[i] / c[diagIndex]);
88 c[diagIndex] = maxDiagonal[i];
89 for (uint8_t j = 0; j < 5; ++j) {
90 if (j != i) {
91 c[packedCovarianceIndex(i, j)] *= scale;
92 }
93 }
94 }
95 }
96 for (uint8_t i = 0; i < 5; ++i) {
97 for (uint8_t j = 0; j < i; ++j) {
98 const float bound = std::sqrt(c[packedCovarianceIndex(i, i)] * c[packedCovarianceIndex(j, j)]);
99 const uint8_t offIndex = packedCovarianceIndex(i, j);
100 if (c[offIndex] > bound) {
101 c[offIndex] = bound;
102 } else if (c[offIndex] < -bound) {
103 c[offIndex] = -bound;
104 }
105 }
106 }
107}
108
109} // namespace o2::itsmft::tracking
110
111#endif // ALICEO2_ITSMFT_TRACKING_SURFACETRACKSTATE_H_
particle ids, masses, names class definition
int32_t i
SurfaceTrackState state
uint32_t j
Definition RawData.h:0
uint32_t c
Definition RawData.h:2
GLfloat GLfloat GLfloat alpha
Definition glcorearb.h:279
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLbitfield flags
Definition glcorearb.h:1570
uint32_t trackClusterIndicesSize noexcept
GPUhdi() const expr bool isRecognizedSurfaceKind(SurfaceKind kind) noexcept
Definition IdTypes.h:65
GPUhdi() const expr SurfaceTrackParameters() noexcept=default
GPUhdi() const expr bool hasRecognizedKind() const noexcept
GPUhdi() float getP() const noexcept
GPUhdi() const expr bool hasRecognizedKind() const noexcept
std::vector< int > row