15#ifndef ALICEO2_ITS3_TOPOLOGYDICTIONARY_H
16#define ALICEO2_ITS3_TOPOLOGYDICTIONARY_H
24class BuildTopologyDictionary;
34 void print() const noexcept;
47 static constexpr int RowClassSpan = 4;
48 static constexpr int ColClassSpan = 4;
51 static constexpr int NumberOfRareGroups = MaxNumberOfRowClasses * MaxNumberOfColClasses;
53 void reset() noexcept;
54 void resetMaps(
bool IB = true) noexcept;
58 void writeBinaryFile(const
std::
string& outputFile);
60 void readBinaryFile(const
std::
string& fileName);
62 void print() const noexcept;
65 [[nodiscard]]
float getXCOG(
int n,
bool IB = true)
const
67 const auto&
data = (IB) ? mDataIB : mDataOB;
68 assert(
n >= 0 ||
n < (
int)
data.mVectorOfIDs.size());
69 return data.mVectorOfIDs[
n].mXCOG;
72 [[nodiscard]]
float getErrX(
int n,
bool IB =
true)
const
74 const auto&
data = (IB) ? mDataIB : mDataOB;
75 assert(
n >= 0 ||
n < (
int)
data.mVectorOfIDs.size());
76 return data.mVectorOfIDs[
n].mErrX;
79 [[nodiscard]]
float getZCOG(
int n,
bool IB =
true)
const
81 const auto&
data = (IB) ? mDataIB : mDataOB;
82 assert(
n >= 0 ||
n < (
int)
data.mVectorOfIDs.size());
83 return data.mVectorOfIDs[
n].mZCOG;
86 [[nodiscard]]
float getErrZ(
int n,
bool IB =
true)
const
88 const auto&
data = (IB) ? mDataIB : mDataOB;
89 assert(
n >= 0 ||
n < (
int)
data.mVectorOfIDs.size());
90 return data.mVectorOfIDs[
n].mErrZ;
93 [[nodiscard]]
float getErr2X(
int n,
bool IB =
true)
const
95 const auto&
data = (IB) ? mDataIB : mDataOB;
96 assert(
n >= 0 ||
n < (
int)
data.mVectorOfIDs.size());
97 return data.mVectorOfIDs[
n].mErr2X;
100 [[nodiscard]]
float getErr2Z(
int n,
bool IB =
true)
const
102 const auto&
data = (IB) ? mDataIB : mDataOB;
103 assert(
n >= 0 ||
n < (
int)
data.mVectorOfIDs.size());
104 return data.mVectorOfIDs[
n].mErr2Z;
107 [[nodiscard]]
unsigned long getHash(
int n,
bool IB =
true)
const
109 const auto&
data = (IB) ? mDataIB : mDataOB;
110 assert(
n >= 0 ||
n < (
int)
data.mVectorOfIDs.size());
111 return data.mVectorOfIDs[
n].mHash;
116 const auto&
data = (IB) ? mDataIB : mDataOB;
117 assert(
n >= 0 ||
n < (
int)
data.mVectorOfIDs.size());
118 return data.mVectorOfIDs[
n].mNpixels;
123 const auto&
data = (IB) ? mDataIB : mDataOB;
124 assert(
n >= 0 ||
n < (
int)
data.mVectorOfIDs.size());
125 return data.mVectorOfIDs[
n].mFrequency;
128 [[nodiscard]]
bool isGroup(
int n,
bool IB =
true)
const
130 const auto&
data = (IB) ? mDataIB : mDataOB;
131 assert(
n >= 0 ||
n < (
int)
data.mVectorOfIDs.size());
132 return data.mVectorOfIDs[
n].mIsGroup;
137 const auto&
data = (IB) ? mDataIB : mDataOB;
138 assert(
n >= 0 ||
n < (
int)
data.mVectorOfIDs.size());
139 return data.mVectorOfIDs[
n].mPattern;
143 [[nodiscard]] TH1F* getTopologyDistribution(
const std::string_view hname,
bool IB =
true)
const;
147 return static_cast<int>((IB) ? mDataIB.mVectorOfIDs.size() : mDataOB.mVectorOfIDs.size());
152 template <
typename T =
float>
156 template <
typename T =
float>
159 static TopologyDictionary* loadFrom(
const std::string& fileName =
"",
const std::string& objName =
"ccdb_object");
const itsmft::ClusterPattern & getPattern(int n, bool IB=true) const
Returns the pattern of the topology.
float getErr2Z(int n, bool IB=true) const
Returns the error^2 on the z position of the COG for the n_th element.
float getErrZ(int n, bool IB=true) const
Returns the error on the z position of the COG for the n_th element.
unsigned long getHash(int n, bool IB=true) const
Returns the hash of the n_th element.
int getNpixels(int n, bool IB=true) const
Returns the number of fired pixels of the n_th element.
double getFrequency(int n, bool IB=true) const
Returns the frequency of the n_th element;.
float getErrX(int n, bool IB=true) const
Returns the error on the x position of the COG for the n_th element.
float getZCOG(int n, bool IB=true) const
Returns the z position of the COG for the n_th element.
int getSize(bool IB) const
Returns the number of elements in the dicionary;.
bool isGroup(int n, bool IB=true) const
Returns true if the element corresponds to a group of rare topologies.
float getErr2X(int n, bool IB=true) const
Returns the error^2 on the x position of the COG for the n_th element.
static constexpr uint8_t MaxRowSpan
static constexpr uint8_t MaxColSpan
TGeoManager * readFromFile(std::string filename)
Defining DataPointCompositeObject explicitly as copiable.
static constexpr int STopoSize
std::unordered_map< unsigned long, int > mCommonMap
Map of pair <hash, position in mVectorOfIDs>
void print() const noexcept
std::vector< itsmft::GroupStruct > mVectorOfIDs
Vector of topologies and groups.
ClassDefNV(TopologyDictionaryData, 1)
std::unordered_map< int, int > mGroupMap
Map of pair <groudID, position in mVectorOfIDs>
std::array< int, STopoSize > mSmallTopologiesLUT
Look-Up Table for the topologies with 1-byte linearised matrix.