CbmRoot
Loading...
Searching...
No Matches
CaHit.h
Go to the documentation of this file.
1/* Copyright (C) 2007-2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Valentina Akishina, Igor Kulakov, Sergey Gorbunov [committer], Maksym Zyzak */
4
8
9#pragma once // include this header only once per compilation unit
10
11#include "CaSimd.h"
12
13#include <boost/serialization/access.hpp>
14
15#include <string>
16
17namespace cbm::algo::ca
18{
20 fscal fEventTimeMin{-std::numeric_limits<fscal>::max() / 2.};
21 fscal fEventTimeMax{std::numeric_limits<fscal>::max() / 2.};
22 fscal fMaxTimeBeforeHit{0.}; //< max event time for hits [0 .. hit] in the station hit array
23 fscal fMinTimeAfterHit{0.}; //< min event time for hits [hit ... ] in the station hit array
24 };
25
26 // FIXME: Move typedefs to another header (potential problems with dependencies)
27 using HitIndex_t = unsigned int;
28 using HitKeyIndex_t = unsigned int;
29
32 class Hit {
34
35 public:
37 Hit() = default;
38
42 bool Check() const;
43
46
48 void SetFrontKey(HitKeyIndex_t key) { fFrontKey = key; }
49
51 void SetBackKey(HitKeyIndex_t key) { fBackKey = key; }
52
54 void SetX(fscal x) { fX = x; }
55
57 void SetY(fscal y) { fY = y; }
58
60 void SetZ(fscal z) { fZ = z; }
61
63 void SetT(fscal t) { fT = t; }
64
66 void SetDx2(fscal dx2) { fDx2 = dx2; }
67
69 void SetDy2(fscal dy2) { fDy2 = dy2; }
70
72 void SetDxy(fscal dxy) { fDxy = dxy; }
73
75 void SetDt2(fscal dt2) { fDt2 = dt2; }
76
78 void SetRangeX(fscal rangeX) { fRangeX = rangeX; }
79
81 void SetRangeY(fscal rangeY) { fRangeY = rangeY; }
82
84 void SetRangeT(fscal rangeT) { fRangeT = rangeT; }
85
87 void SetId(HitIndex_t id) { fId = id; }
88
90 void SetStation(int station) { fStation = station; }
91
94
96 HitKeyIndex_t FrontKey() const { return fFrontKey; }
97
99 HitKeyIndex_t BackKey() const { return fBackKey; }
100
102 fscal X() const { return fX; }
103
105 fscal Y() const { return fY; }
106
108 fscal Z() const { return fZ; }
109
111 fscal T() const { return fT; }
112
114 fscal dX2() const { return fDx2; }
115
117 fscal dY2() const { return fDy2; }
118
120 fscal dXY() const { return fDxy; }
121
123 fscal dT2() const { return fDt2; }
124
126 fscal RangeX() const { return fRangeX; }
127
129 fscal RangeY() const { return fRangeY; }
130
132 fscal RangeT() const { return fRangeT; }
133
135 HitIndex_t Id() const { return fId; }
136
138 int Station() const { return fStation; }
139
141 std::string ToString() const;
142
146 std::string ToString(int verbose, bool bHeader) const;
147
148 private:
151
152
158
159 fscal fX{0.};
160 fscal fY{0.};
161 fscal fZ{0.};
162 fscal fT{0.};
170
172 int fStation{-1};
173
174 private:
176 template<class Archive>
177 void serialize(Archive& ar, const unsigned int /*version*/)
178 {
179 ar& fFrontKey;
180 ar& fBackKey;
181 ar& fX;
182 ar& fY;
183 ar& fZ;
184 ar& fT;
185 ar& fDx2;
186 ar& fDy2;
187 ar& fDxy;
188 ar& fDt2;
189 ar& fRangeX;
190 ar& fRangeY;
191 ar& fRangeT;
192 ar& fId;
193 ar& fStation;
194 }
195 };
196
197 // -------------------------------------------------------------------------------------------------------------------
198 //
199 inline bool Hit::Check() const
200 {
201 bool res = true;
202 res &= std::isfinite(fX);
203 res &= std::isfinite(fY);
204 res &= std::isfinite(fZ);
205 res &= std::isfinite(fT);
206 res &= std::isfinite(fDx2);
207 res &= std::isfinite(fDy2);
208 res &= std::isfinite(fDxy);
209 res &= std::isfinite(fDt2);
210 res &= (fDx2 || fDy2 || fDxy || fDt2); // TODO: research
211 res &= (fT < 1.e+9);
212 return res;
213 }
214
215} // namespace cbm::algo::ca
ca::Hit class describes a generic hit for the CA tracker
Definition CaHit.h:32
fscal fRangeT
+/- range of uncertainty of time [ns]
Definition CaHit.h:169
fscal fDx2
rms^2 of uncertainty of X coordinate [cm2]
Definition CaHit.h:163
void SetX(fscal x)
Set the X coordinate.
Definition CaHit.h:54
fscal Z() const
Get the Z coordinate.
Definition CaHit.h:108
HitKeyIndex_t BackKey() const
Get the back key index.
Definition CaHit.h:99
int fStation
index of station in the active stations array
Definition CaHit.h:172
fscal fDt2
measured uncertainty of time [ns2]
Definition CaHit.h:166
HitIndex_t fId
id of the hit
Definition CaHit.h:171
void SetRangeT(fscal rangeT)
Set the +/- range of uncertainty of time.
Definition CaHit.h:84
void SetDt2(fscal dt2)
Set the uncertainty of time.
Definition CaHit.h:75
fscal RangeX() const
Get the +/- range of uncertainty of X coordinate.
Definition CaHit.h:126
void SetDy2(fscal dy2)
Set the uncertainty of Y coordinate.
Definition CaHit.h:69
void SetRangeY(fscal rangeY)
Set the +/- range of uncertainty of Y coordinate.
Definition CaHit.h:81
fscal dT2() const
Get the uncertainty of time.
Definition CaHit.h:123
void SetStation(int station)
Set the station index.
Definition CaHit.h:90
std::string ToString() const
Simple string representation of the hit class.
Definition CaHit.cxx:17
Hit()=default
Default constructor.
void SetDx2(fscal dx2)
Set the uncertainty of X coordinate.
Definition CaHit.h:66
void SetRangeX(fscal rangeX)
Set the +/- range of uncertainty of X coordinate.
Definition CaHit.h:78
fscal dXY() const
Get the X/Y covariance.
Definition CaHit.h:120
fscal fDy2
rms^2 of uncertainty of Y coordinate [cm2]
Definition CaHit.h:164
void SetZ(fscal z)
Set the Z coordinate.
Definition CaHit.h:60
fscal fRangeX
+/- range of uncertainty of X coordinate [cm]
Definition CaHit.h:167
void SetBackKey(HitKeyIndex_t key)
Set the back key index.
Definition CaHit.h:51
fscal dX2() const
Get the uncertainty of X coordinate.
Definition CaHit.h:114
fscal Y() const
Get the Y coordinate.
Definition CaHit.h:105
void serialize(Archive &ar, const unsigned int)
Serialization method, used to save ca::Hit objects into binary or text file in a defined order.
Definition CaHit.h:177
void SetFrontKey(HitKeyIndex_t key)
Set the front key index.
Definition CaHit.h:48
fscal RangeY() const
Get the +/- range of uncertainty of Y coordinate.
Definition CaHit.h:129
void SetId(HitIndex_t id)
Set the hit id.
Definition CaHit.h:87
fscal RangeT() const
Get the +/- range of uncertainty of time.
Definition CaHit.h:132
bool Check() const
Checks, if the hit is defined.
Definition CaHit.h:199
fscal fZ
fixed Z coordinate [cm]
Definition CaHit.h:161
HitKeyIndex_t FrontKey() const
Get the front key index.
Definition CaHit.h:96
fscal T() const
Get the time.
Definition CaHit.h:111
void SetT(fscal t)
Set the time.
Definition CaHit.h:63
HitKeyIndex_t fFrontKey
front hit key index
Definition CaHit.h:156
fscal X() const
Get the X coordinate.
Definition CaHit.h:102
HitIndex_t Id() const
Get the hit id.
Definition CaHit.h:135
fscal fY
measured Y coordinate [cm]
Definition CaHit.h:160
friend class boost::serialization::access
Definition CaHit.h:33
fscal fRangeY
+/- range of uncertainty of Y coordinate [cm]
Definition CaHit.h:168
int Station() const
Get the station index.
Definition CaHit.h:138
fscal fDxy
X/Y covariance [cm2].
Definition CaHit.h:165
void SetDxy(fscal dxy)
Set the X/Y covariance.
Definition CaHit.h:72
HitKeyIndex_t fBackKey
back hit key index
Definition CaHit.h:157
fscal fT
measured time [ns]
Definition CaHit.h:162
void SetY(fscal y)
Set the Y coordinate.
Definition CaHit.h:57
fscal fX
measured X coordinate [cm]
Definition CaHit.h:159
fscal dY2() const
Get the uncertainty of Y coordinate.
Definition CaHit.h:117
TODO: SZh 8.11.2022: add selection of parameterisation.
Definition CaBranch.h:14
unsigned int HitKeyIndex_t
Index of the hit key (e.g. front / back cluster id for STS)
Definition CaHit.h:28
kf::fscal fscal
Definition CaSimd.h:14
unsigned int HitIndex_t
Index of ca::Hit.
Definition CaHit.h:27