CbmRoot
Loading...
Searching...
No Matches
CaInputData.h
Go to the documentation of this file.
1/* Copyright (C) 2022-2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergey Gorbunov, Sergei Zharko [committer] */
4
9
10#pragma once // include this header only once per compilation unit
11
12#include "CaDefs.h"
13#include "CaHit.h"
14#include "CaVector.h"
15
16#include <boost/serialization/access.hpp>
17#include <boost/serialization/array.hpp>
18
19namespace cbm::algo::ca
20{
24 class alignas(constants::misc::Alignment) InputData {
25 public:
26 friend class DataManager;
28
30 InputData();
31
33 ~InputData() = default;
34
36 InputData(const InputData& other);
37
39 InputData(InputData&&) noexcept;
40
42 InputData& operator=(const InputData& other);
43
45 InputData& operator=(InputData&& other) noexcept;
46
48 HitIndex_t GetSampleSize() const { return fvHits.size(); }
49
51 int GetNdataStreams() const { return fvStreamStartIndices.size(); }
52
55 const Hit& GetHit(HitIndex_t index) const { return fvHits[index]; }
56
58 const Vector<Hit>& GetHits() const { return fvHits; }
59
61 HitIndex_t GetNhits() const { return fvHits.size(); }
62
64 int GetNhitKeys() const { return fNhitKeys; }
65
68 HitIndex_t GetStreamStartIndex(int iStream) const { return fvStreamStartIndices[iStream]; }
69
72 HitIndex_t GetStreamStopIndex(int iStream) const { return fvStreamStopIndices[iStream]; }
73
76 HitIndex_t GetStreamNhits(int iStream) const
77 {
78 return fvStreamStopIndices[iStream] - fvStreamStartIndices[iStream];
79 }
80
81
82 private:
84 void Swap(InputData& other) noexcept;
85
87 template<class Archive>
88 void serialize(Archive& ar, const unsigned int /*versino*/)
89 {
90 ar& fvHits;
93 ar& fNhitKeys;
94 }
95
96 // ***************************
97 // ** Member variables list **
98 // ***************************
99
101 Vector<Hit> fvHits{"InputData::fHits"};
102
104 Vector<HitIndex_t> fvStreamStartIndices{"InputData::fStreamStartIndices"};
105 Vector<HitIndex_t> fvStreamStopIndices{"InputData::fStreamStopIndices"};
106
108 int fNhitKeys = -1;
109 };
110
111
112 // ********************************************
113 // ** Inline member functions initialization **
114 // *********************************************
115
116 // -------------------------------------------------------------------------------------------------------------------
117 //
118 [[gnu::always_inline]] inline void InputData::Swap(InputData& other) noexcept
119 {
120 std::swap(fvHits, other.fvHits);
121 std::swap(fvStreamStartIndices, other.fvStreamStartIndices);
122 std::swap(fvStreamStopIndices, other.fvStreamStopIndices);
123 std::swap(fNhitKeys, other.fNhitKeys);
124 }
125
126} // namespace cbm::algo::ca
Compile-time constants definition for the CA tracking algorithm.
A generic hit for the CA tracker (header)
A manager for the input-output data of the CA tracking algorithm.
ca::Hit class describes a generic hit for the CA tracker
Definition CaHit.h:32
HitIndex_t GetNhits() const
Gets number of hits in the hits vector.
Definition CaInputData.h:61
const Hit & GetHit(HitIndex_t index) const
Gets reference to hit by its index.
Definition CaInputData.h:55
int fNhitKeys
Number of hit keys used for rejecting fake STS hits.
void Swap(InputData &other) noexcept
Swap method.
Vector< HitIndex_t > fvStreamStopIndices
void serialize(Archive &ar, const unsigned int)
Data serialization method.
Definition CaInputData.h:88
int GetNdataStreams() const
Gets number of data streams.
Definition CaInputData.h:51
HitIndex_t GetStreamNhits(int iStream) const
Gets n hits for the data stream.
Definition CaInputData.h:76
int GetNhitKeys() const
Gets total number of stored keys.
Definition CaInputData.h:64
Vector< Hit > fvHits
Sample of input hits.
const Vector< Hit > & GetHits() const
Gets reference to hits vector.
Definition CaInputData.h:58
~InputData()=default
Destructor.
HitIndex_t GetSampleSize() const
Gets hits sample size.
Definition CaInputData.h:48
HitIndex_t GetStreamStartIndex(int iStream) const
Gets index of the first hit in the sorted hits vector.
Definition CaInputData.h:68
friend class boost::serialization::access
Definition CaInputData.h:27
Vector< HitIndex_t > fvStreamStartIndices
Index of the first hit in the sorted hits vector for a given data stream.
HitIndex_t GetStreamStopIndex(int iStream) const
Gets index of (the last + 1) hit in the sorted hits vector.
Definition CaInputData.h:72
InputData()
Default constructor.
TODO: SZh 8.11.2022: add selection of parameterisation.
Definition CaBranch.h:14
unsigned int HitIndex_t
Index of ca::Hit.
Definition CaHit.h:27