Project
Loading...
Searching...
No Matches
TopologyDictionary.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#ifndef ALICEO2_ITS3_TOPOLOGYDICTIONARY_H
16#define ALICEO2_ITS3_TOPOLOGYDICTIONARY_H
17
20
21namespace o2::its3
22{
23
24class BuildTopologyDictionary;
25class LookUp;
26
28{
29 public:
31 TopologyDictionary(const std::string& fileName);
32
35 static constexpr int RowClassSpan = 4;
36 static constexpr int ColClassSpan = 4;
41 friend std::ostream& operator<<(std::ostream& os, const its3::TopologyDictionary& dictionary);
43 void writeBinaryFile(const std::string& outputFile);
45 int readBinaryFile(const std::string& fileName);
46
47 int readFromFile(const std::string& fileName);
48
50 inline float getXCOG(int n) const
51 {
52 assert(n >= 0 || n < (int)mVectorOfIDs.size());
53 return mVectorOfIDs[n].mXCOG;
54 }
56 inline float getErrX(int n) const
57 {
58 assert(n >= 0 || n < (int)mVectorOfIDs.size());
59 return mVectorOfIDs[n].mErrX;
60 }
62 inline float getZCOG(int n) const
63 {
64 assert(n >= 0 || n < (int)mVectorOfIDs.size());
65 return mVectorOfIDs[n].mZCOG;
66 }
68 inline float getErrZ(int n) const
69 {
70 assert(n >= 0 || n < (int)mVectorOfIDs.size());
71 return mVectorOfIDs[n].mErrZ;
72 }
74 inline float getErr2X(int n) const
75 {
76 assert(n >= 0 || n < (int)mVectorOfIDs.size());
77 return mVectorOfIDs[n].mErr2X;
78 }
80 inline float getErr2Z(int n) const
81 {
82 assert(n >= 0 || n < (int)mVectorOfIDs.size());
83 return mVectorOfIDs[n].mErr2Z;
84 }
86 inline unsigned long getHash(int n) const
87 {
88 assert(n >= 0 || n < (int)mVectorOfIDs.size());
89 return mVectorOfIDs[n].mHash;
90 }
92 inline int getNpixels(int n) const
93 {
94 assert(n >= 0 || n < (int)mVectorOfIDs.size());
95 return mVectorOfIDs[n].mNpixels;
96 }
98 inline double getFrequency(int n) const
99 {
100 assert(n >= 0 || n < (int)mVectorOfIDs.size());
101 return mVectorOfIDs[n].mFrequency;
102 }
104 inline bool isGroup(int n) const
105 {
106 assert(n >= 0 || n < (int)mVectorOfIDs.size());
107 return mVectorOfIDs[n].mIsGroup;
108 }
110 inline const itsmft::ClusterPattern& getPattern(int n) const
111 {
112 assert(n >= 0 || n < (int)mVectorOfIDs.size());
113 return mVectorOfIDs[n].mPattern;
114 }
115
117 TH1F* getTopologyDistribution(const std::string_view hname = "h_topo_dist") const;
119 int getSize() const { return (int)mVectorOfIDs.size(); }
121
123 template <typename T = float>
125
127 template <typename T = float>
129
130 static TopologyDictionary* loadFrom(const std::string& fileName = "", const std::string& objName = "ccdb_object");
131
133 friend its3::LookUp;
134
135 private:
136 static constexpr int STopoSize{8 * 255 + 1};
137 std::unordered_map<unsigned long, int> mCommonMap{};
138 std::unordered_map<int, int> mGroupMap{};
139 int mSmallTopologiesLUT[STopoSize]{};
140 std::vector<itsmft::GroupStruct> mVectorOfIDs{};
141
142 ClassDefNV(TopologyDictionary, 3);
143};
144} // namespace o2::its3
145
146#endif
Definition of the ClusterTopology class.
static constexpr int ColClassSpan
Column span of the classes of rare topologies.
math_utils::Point3D< T > getClusterCoordinates(const itsmft::CompClusterExt &cl) const
Returns the local position of a compact cluster.
float getErr2X(int n) const
Returns the error^2 on the x position of the COG for the n_th element.
int getSize() const
Returns the number of elements in the dicionary;.
static constexpr int MaxNumberOfRowClasses
Maximum number of row classes for the groups of rare topologies.
static constexpr int NumberOfRareGroups
unsigned long getHash(int n) const
Returns the hash of the n_th element.
static constexpr int MaxNumberOfColClasses
Maximum number of col classes for the groups of rare topologies.
static constexpr int RowClassSpan
Row span of the classes of rare topologies.
float getErrZ(int n) const
Returns the error on the z position of the COG for the n_th element.
static TopologyDictionary * loadFrom(const std::string &fileName="", const std::string &objName="ccdb_object")
int readBinaryFile(const std::string &fileName)
Reads the dictionary from a binary file.
bool isGroup(int n) const
Returns true if the element corresponds to a group of rare topologies.
float getZCOG(int n) const
Returns the z position of the COG for the n_th element.
TH1F * getTopologyDistribution(const std::string_view hname="h_topo_dist") const
Fills a hostogram with the distribution of the IDs.
float getXCOG(int n) const
Returns the x position of the COG for the n_th element.
float getErrX(int n) const
Returns the error on the x position of the COG for the n_th element.
void writeBinaryFile(const std::string &outputFile)
Prints the dictionary in a binary file.
double getFrequency(int n) const
Returns the frequency of the n_th element;.
friend std::ostream & operator<<(std::ostream &os, const its3::TopologyDictionary &dictionary)
Prints the dictionary.
int readFromFile(const std::string &fileName)
int getNpixels(int n) const
Returns the number of fired pixels of the n_th element.
const itsmft::ClusterPattern & getPattern(int n) const
Returns the pattern of the topology.
float getErr2Z(int n) const
Returns the error^2 on the z position of the COG for the n_th element.
static constexpr uint8_t MaxRowSpan
static constexpr uint8_t MaxColSpan
GLdouble n
Definition glcorearb.h:1982