CbmRoot
Loading...
Searching...
No Matches
KfDefs.h
Go to the documentation of this file.
1/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergei Zharko [committer] */
4
9
10#ifndef KF_CORE_KfDefs_h
11#define KF_CORE_KfDefs_h 1
12
13#include "KfSimd.h"
14
15#include <array>
16#include <functional>
17#include <limits>
18#include <tuple>
19
20namespace cbm::algo::kf
21{
22 // ---- Enumerations -------------------------------------------------------------------------------------------------
23 //
26 enum class EFieldMode
27 {
28 Intrpl,
29 Orig
30 };
31
34 // TODO: SZh 21.08.2024: Develope the concept of field types at different setup regions. At the moment the only
35 // two global options are available.
36 enum class EFieldType
37 {
38 Normal,
39 Null
40 };
41
44 template<typename T>
45 struct Literal {
46 using type = T;
47 };
48
49 template<>
50 struct Literal<fvec> {
51 using type = fscal;
52 };
53
54 template<typename T>
55 using Literal_t = typename Literal<T>::type;
56
57
58 // ---- Common data types --------------------------------------------------------------------------------------------
59 //
61 template<class T>
62 using GeoVector_t = std::array<T, 3>;
63
66 using FieldFn_t = std::function<std::tuple<double, double, double>(double, double, double)>;
67} // namespace cbm::algo::kf
68
70{
71 // ----- Array sizes -------------------------------------------------------------------------------------------------
72 //constexpr int MaxNofFieldSlices = 64; ///< Max number of field slices
73 //constexpr int MaxNofMaterialLayers = 32; ///< Max number of the material layers
74 // NOTE: max uint8_t is assumed in order to satisfy fles::Subsystem
75 constexpr int MaxNofDetSubsystems = 256;
76 constexpr int MaxNofDetComponents = 128;
77
78 // ----- Control -----------------------------------------------------------------------------------------------------
79 constexpr int DebugLvl = 0;
80 constexpr bool GetterCheck = true;
81
82
83 // ----- Math --------------------------------------------------------------------------------------------------------
84 template<class T = double>
85 constexpr auto Pi = Literal_t<T>(3.14159265358979323846L);
86
87 // ----- Physics -----------------------------------------------------------------------------------------------------
88 template<class T = double>
89 constexpr auto MuonMass = Literal_t<T>(0.105658375523L);
90
91 template<class T = double>
92 constexpr auto PionMass = Literal_t<T>(0.1395703918L);
93
94 template<class T = double>
95 constexpr auto KaonMass = Literal_t<T>(0.493677L);
96
97 template<class T = double>
98 constexpr auto ElectronMass = Literal_t<T>(0.0005109989500015L);
99
100 template<class T = double>
101 constexpr auto ProtonMass = Literal_t<T>(0.93827208816L);
102
103 template<class T = double>
104 constexpr auto SpeedOfLight = Literal_t<T>(29.9792458L);
105
106 template<class T = double>
107 constexpr auto SpeedOfLightInv = Literal_t<T>(1.L) / SpeedOfLight<T>;
108
109 template<class T = double>
110 constexpr auto MinField = Literal_t<T>(1.e-4L);
111
112 // ----- Undefined values --------------------------------------------------------------------------------------------
114 template<typename T1, typename T2 = T1>
115 constexpr T2 Undef;
116
117 template<>
118 inline constexpr int Undef<int> = std::numeric_limits<int>::min();
119
120 template<>
121 inline constexpr unsigned Undef<unsigned> = std::numeric_limits<unsigned>::max();
122
123 template<>
124 inline constexpr float Undef<float> = std::numeric_limits<float>::signaling_NaN();
125
126 template<>
127 inline constexpr double Undef<double> = std::numeric_limits<double>::signaling_NaN();
128
129 template<>
130 inline constexpr fscal Undef<fvec> = std::numeric_limits<fscal>::signaling_NaN();
131
132 // ----- Other -------------------------------------------------------------------------------------------------------
134 constexpr auto ZeroFieldFn = [](double, double, double) constexpr { return std::make_tuple(0., 0., 0.); };
135
136 // ----- Debug flags (NOTE: to be modified only by the experts) ------------------------------------------------------
137 //
138 namespace dbg
139 {
140 } // namespace dbg
141} // namespace cbm::algo::kf::defs
142
143#endif // KF_CORE_KfDefs_h
Implementation selection for the SIMD utilities (VS or pseudo)
constexpr auto PionMass
Pion mass [GeV/c2].
Definition KfDefs.h:92
constexpr auto ElectronMass
Electron mass [GeV/c2].
Definition KfDefs.h:98
constexpr auto ZeroFieldFn
Zero magnetic field function.
Definition KfDefs.h:134
constexpr T2 Undef
Undefined values.
Definition KfDefs.h:115
constexpr int MaxNofDetSubsystems
Max number of detector types (STS, TRD, RICH,...)
Definition KfDefs.h:75
constexpr auto MinField
Minimal (negligible) magnetic field value [kG].
Definition KfDefs.h:110
constexpr auto ProtonMass
Proton mass [GeV/c2] (PDG 11.08.2022)
Definition KfDefs.h:101
constexpr bool GetterCheck
Bound check in getters.
Definition KfDefs.h:80
constexpr int DebugLvl
Level of debug output.
Definition KfDefs.h:79
constexpr auto MuonMass
Muon mass [GeV/c2].
Definition KfDefs.h:89
constexpr int MaxNofDetComponents
Max number of detector components (stations, layers, ...)
Definition KfDefs.h:76
constexpr auto KaonMass
Kaon mass [GeV/c2] (PDG 22.08.2023)
Definition KfDefs.h:95
constexpr auto SpeedOfLight
Speed of light [cm/ns].
Definition KfDefs.h:104
EFieldMode
Enumiration for the magnetic field representation variants in the track fitting algorithm.
Definition KfDefs.h:27
@ Intrpl
Interpolated magnetic field.
@ Orig
Original magnetic field function.
std::array< T, 3 > GeoVector_t
Geometry (spatial) vector.
Definition KfDefs.h:62
typename Literal< T >::type Literal_t
Definition KfDefs.h:55
EFieldType
Magnetic field type in different setup regions.
Definition KfDefs.h:37
@ Normal
Field near the tracker subsystem.
@ Null
No magnetic field.
std::function< std::tuple< double, double, double >(double, double, double)> FieldFn_t
Magnetic field function type Signature: tuple<Bx, By, Bz>(x, y, z);.
Definition KfDefs.h:66
Replaces the type T with the Literal::type to handle the constant expressions for different constants...
Definition KfDefs.h:45