CbmRoot
Loading...
Searching...
No Matches
CaWindowData.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#pragma once
11
12#include "CaDefs.h"
13#include "CaGrid.h"
14#include "CaHit.h"
15#include "CaIteration.h"
16#include "CaTrack.h"
17#include "KfFieldRegion.h"
18#include "KfMeasurementXy.h"
19
20#include <array>
21
22namespace cbm::algo::ca
23{
26 class WindowData {
27 public:
29 WindowData() = default;
30
32 ~WindowData() = default;
33
36 [[gnu::always_inline]] ca::Grid& Grid(int iStation) { return fvGrid[iStation]; }
37
40 [[gnu::always_inline]] const ca::Grid& Grid(int iStation) const { return fvGrid[iStation]; }
41
44 [[gnu::always_inline]] ca::Hit& Hit(int iHit) { return fvHits[iHit]; }
45
48 [[gnu::always_inline]] const ca::Hit& Hit(int iHit) const { return fvHits[iHit]; }
49
51 [[gnu::always_inline]] Vector<ca::Hit>& Hits() { return fvHits; }
52
54 [[gnu::always_inline]] const Vector<ca::Hit>& Hits() const { return fvHits; }
55
58 [[gnu::always_inline]] uint8_t IsHitSuppressed(int iHit) const { return fvbHitSuppressed[iHit]; }
59
62 void ResetHitData(int nHits);
63
65 [[gnu::always_inline]] void ResetHitSuppressionFlags() { fvbHitSuppressed.reset(fvHits.size(), 0); }
66
68 [[gnu::always_inline]] void SuppressHit(int iHit) { fvbHitSuppressed[iHit] = 1; }
69
72 [[gnu::always_inline]] HitIndex_t& HitStartIndexOnStation(int iStation)
73 {
74 return fvHitStartIndexOnStation[iStation];
75 }
76
79 [[gnu::always_inline]] unsigned char IsHitKeyUsed(HitKeyIndex_t iKey) const { return fvbHitKeyFlags[iKey]; }
80
83 [[gnu::always_inline]] unsigned char& IsHitKeyUsed(HitKeyIndex_t iKey) { return fvbHitKeyFlags[iKey]; }
84
86 [[gnu::always_inline]] Vector<unsigned char>& HitKeyFlags() { return fvbHitKeyFlags; }
87
90 [[gnu::always_inline]] HitIndex_t HitStartIndexOnStation(int iStation) const
91 {
92 return fvHitStartIndexOnStation[iStation];
93 }
94
97 [[gnu::always_inline]] HitIndex_t& NofHitsOnStation(int iStation) { return fvNofHitsOnStation[iStation]; }
98
101 [[gnu::always_inline]] HitIndex_t NofHitsOnStation(int iStation) const { return fvNofHitsOnStation[iStation]; }
102
104 [[gnu::always_inline]] Vector<HitIndex_t>& RecoHitIndices() { return fvRecoHitIndices; }
105
107 [[gnu::always_inline]] const Vector<HitIndex_t>& RecoHitIndices() const { return fvRecoHitIndices; }
108
112 [[gnu::always_inline]] HitIndex_t& RecoHitIndex(int iHit) { return fvRecoHitIndices[iHit]; }
113
117 [[gnu::always_inline]] HitIndex_t RecoHitIndex(int iHit) const { return fvRecoHitIndices[iHit]; }
118
121 [[gnu::always_inline]] Track& RecoTrack(int iTrack) { return fvRecoTracks[iTrack]; }
122
125 [[gnu::always_inline]] const Track& RecoTrack(int iTrack) const { return fvRecoTracks[iTrack]; }
126
128 [[gnu::always_inline]] Vector<Track>& RecoTracks() { return fvRecoTracks; }
129
131 [[gnu::always_inline]] const Vector<Track>& RecoTracks() const { return fvRecoTracks; }
132
136 [[gnu::always_inline]] HitIndex_t TsHitIndex(int iSt, int iHit) const { return fvTsHitIndices[iSt][iHit]; }
137
140 [[gnu::always_inline]] Vector<HitIndex_t>& TsHitIndices(int iSt) { return fvTsHitIndices[iSt]; }
141
144 [[gnu::always_inline]] const Vector<HitIndex_t>& TsHitIndices(int iSt) const { return fvTsHitIndices[iSt]; }
145
147 [[gnu::always_inline]] void SetCurrentIteration(const Iteration* ptr) { fpCurrentIteration = ptr; }
148
150 [[gnu::always_inline]] const Iteration* CurrentIteration() const { return fpCurrentIteration; }
151
153 [[gnu::always_inline]] kf::FieldValue<fvec>& TargB() { return fTargB; }
154
156 [[gnu::always_inline]] const kf::FieldValue<fvec>& TargB() const { return fTargB; }
157
160
162 [[gnu::always_inline]] const kf::MeasurementXy<fvec>& TargetMeasurement() const { return fTargetMeasurement; }
163
164 private:
166
168 std::array<ca::Grid, kMaxNofStations> fvGrid;
169
174 Vector<ca::Hit> fvHits{"WindowData::fHits"};
175
178 Vector<unsigned char> fvbHitKeyFlags{"WindowData::fvbHitKeyFlags"};
179
181 Vector<unsigned char> fvbHitSuppressed{"WindowData::fvbHitSuppressed"};
182
184 std::array<HitIndex_t, kMaxNofStations + 1> fvHitStartIndexOnStation = {0};
185
187 std::array<HitIndex_t, kMaxNofStations + 1> fvNofHitsOnStation = {0};
188
190 Vector<Track> fvRecoTracks{"WindowData::fvRecoTracks"};
191
193 Vector<HitIndex_t> fvRecoHitIndices{"WindowData::fvRecoHitIndices"};
194
196 std::array<Vector<HitIndex_t>, kMaxNofStations> fvTsHitIndices{"WindowData::fvFullDSHitIndex"};
197
200
203
205} // namespace cbm::algo::ca
Compile-time constants definition for the CA tracking algorithm.
A class to store hit information in a backet-sorted way on 2D grid.
A generic hit for the CA tracker (header)
source file for the ca::Track class
Magnetic flux density interpolation along the track vs. z-coordinate (header)
Definition of the KfMeasurementXy class.
Class for storing 2d objects in a grid.
Definition CaGrid.h:32
ca::Hit class describes a generic hit for the CA tracker
Definition CaHit.h:32
A set of parameters for the CA Track finder iteration.
Class representing an output track in the CA tracking algorithm.
void reset(std::size_t count, Tinput... value)
Clears vector and resizes it to the selected size with selected values.
Definition CaVector.h:121
Container for internal data, processed on a single time window.
HitIndex_t & HitStartIndexOnStation(int iStation)
Index of the first hit on the station.
std::array< HitIndex_t, kMaxNofStations+1 > fvNofHitsOnStation
Number of hits on the station.
HitIndex_t & NofHitsOnStation(int iStation)
Number of hits on station.
Track & RecoTrack(int iTrack)
Accesses reconstructed track by index.
const ca::Grid & Grid(int iStation) const
Gets grid for station index.
const Vector< Track > & RecoTracks() const
Accesses reconstructed track container.
unsigned char & IsHitKeyUsed(HitKeyIndex_t iKey)
Hit key flag: if this hit or cluster was already used.
Vector< Track > & RecoTracks()
Accesses reconstructed track container.
const Iteration * fpCurrentIteration
Current track-finder iteration.
kf::MeasurementXy< fvec > fTargetMeasurement
target constraint
void ResetHitData(int nHits)
Resets hit data.
std::array< HitIndex_t, kMaxNofStations+1 > fvHitStartIndexOnStation
First hit index of the station.
void ResetHitSuppressionFlags()
Reset suppressed hit flags.
ca::Grid & Grid(int iStation)
Gets grid for station index.
HitIndex_t TsHitIndex(int iSt, int iHit) const
Maps hit index from the time window to the time slice.
Vector< Track > fvRecoTracks
Sample of reconstructed tracks.
void SuppressHit(int iHit)
Set hit suppression flag.
const Vector< ca::Hit > & Hits() const
Gets hit vector.
void SetCurrentIteration(const Iteration *ptr)
Accesses current iteration.
const Iteration * CurrentIteration() const
Accesses current iteration.
HitIndex_t HitStartIndexOnStation(int iStation) const
Index of the first hit on the station.
static constexpr int kMaxNofStations
Alias to max number of stations.
Vector< unsigned char > fvbHitSuppressed
Flag, if the hit is suppressed for tracking.
const Vector< HitIndex_t > & TsHitIndices(int iSt) const
Accesses container of hit index map from the time window to the time slice.
std::array< ca::Grid, kMaxNofStations > fvGrid
Grid vs. station index.
WindowData()=default
Constructor.
~WindowData()=default
Destructor.
Vector< unsigned char > & HitKeyFlags()
Access to the hit key flags container.
kf::FieldValue< fvec > & TargB()
Accesses magnetic field in starting point (target or first station)
HitIndex_t & RecoHitIndex(int iHit)
Accesses index of hit in the input data.
uint8_t IsHitSuppressed(int iHit) const
Gets hit suppression flag.
Vector< ca::Hit > fvHits
Hits of the current time window.
kf::FieldValue< fvec > fTargB
field in the target point (modifiable, do not touch!!)
Vector< HitIndex_t > & TsHitIndices(int iSt)
Accesses container of hit index map from the time window to the time slice.
Vector< unsigned char > fvbHitKeyFlags
List of used hit keys.
Vector< ca::Hit > & Hits()
Gets hit vector.
std::array< Vector< HitIndex_t >, kMaxNofStations > fvTsHitIndices
Map of hit indices from the time window to the time slice.
const Vector< HitIndex_t > & RecoHitIndices() const
Accesses indices of hits.
HitIndex_t NofHitsOnStation(int iStation) const
Number of hits on station.
kf::MeasurementXy< fvec > & TargetMeasurement()
Measurement of the target with the uncertainty.
unsigned char IsHitKeyUsed(HitKeyIndex_t iKey) const
Hit key flag: if this hit or cluster was already used.
ca::Hit & Hit(int iHit)
Gets hit by index.
HitIndex_t RecoHitIndex(int iHit) const
Accesses index of hit in the input data.
Vector< HitIndex_t > fvRecoHitIndices
Sample of reconstructed hit indices.
const ca::Hit & Hit(int iHit) const
Gets hit by index.
const kf::FieldValue< fvec > & TargB() const
Accesses magnetic field in starting point (target or first station)
const kf::MeasurementXy< fvec > & TargetMeasurement() const
Measurement of the target with the uncertainty.
const Track & RecoTrack(int iTrack) const
Accesses reconstructed track by index.
Vector< HitIndex_t > & RecoHitIndices()
Accesses indices of hits, used by reconstructed tracks.
Magnetic flux density vector.
The class describes a 2D - measurement (x, y) in XY coordinate system.
constexpr int MaxNstations
Max number of stations, 2^6 = 64.
Definition CaDefs.h:44
TODO: SZh 8.11.2022: add selection of parameterisation.
Definition CaBranch.h:14
class cbm::algo::ca::WindowData _fvecalignment
unsigned int HitKeyIndex_t
Index of the hit key (e.g. front / back cluster id for STS)
Definition CaHit.h:28
unsigned int HitIndex_t
Index of ca::Hit.
Definition CaHit.h:27