Project
Loading...
Searching...
No Matches
Road.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.
15
16#ifndef O2_MFT_ROAD_H_
17#define O2_MFT_ROAD_H_
18
19#include "MFTTracking/Cell.h"
21
22namespace o2
23{
24namespace mft
25{
26
27class Road
28{
29 public:
30 Road() { mRoadId = 0; };
31 void reset();
32 void initialize();
33
34 void setPoint(const Int_t layer, const Int_t clusterId)
35 {
36 mClusterId[layer].push_back(clusterId);
37 }
38
39 void setRoadId(const Int_t id) { mRoadId = id; }
40 const Int_t getRoadId() const { return mRoadId; }
41
42 const Int_t getNPointsInLayer(Int_t layer) const;
43
44 void getLength(Int_t& layer1, Int_t& layer2) const;
45
46 const std::vector<Int_t>& getClustersIdInLayer(Int_t layer) const { return mClusterId[layer]; }
47
48 template <typename... T>
49 Cell& addCellInLayer(Int_t layer, T&&... args);
50
51 std::vector<Cell>& getCellsInLayer(Int_t);
52
53 void addLeftNeighbourToCell(const Int_t, const Int_t, const Int_t, const Int_t);
54 void addRightNeighbourToCell(const Int_t, const Int_t, const Int_t, const Int_t);
55
56 void incrementCellLevel(const Int_t, const Int_t);
57 void updateCellLevel(const Int_t, const Int_t);
58
59 void setCellLevel(const Int_t, const Int_t, const Int_t);
60 const Int_t getCellLevel(const Int_t, const Int_t) const;
61 void setCellUsed(const Int_t, const Int_t, const Bool_t);
62 const Bool_t isCellUsed(const Int_t, const Int_t) const;
63
64 private:
65 Int_t mRoadId;
66 std::array<std::vector<Int_t>, constants::mft::LayersNumber> mClusterId;
67 std::array<std::vector<Cell>, (constants::mft::LayersNumber - 1)> mCell;
68};
69
70inline void Road::reset()
71{
72 Int_t layer;
73 for (layer = 0; layer < (constants::mft::LayersNumber - 1); ++layer) {
74 mCell[layer].clear();
75 mClusterId[layer].clear();
76 }
77 mClusterId[layer].clear();
78}
79
80inline void Road::initialize()
81{
82 Int_t layer;
83 for (layer = 0; layer < (constants::mft::LayersNumber - 1); ++layer) {
85 mClusterId[layer].reserve(constants::mft::MaxPointsInRoad);
86 }
87 mClusterId[layer].reserve(constants::mft::MaxPointsInRoad);
88}
89
90inline const Int_t Road::getNPointsInLayer(Int_t layer) const
91{
92 return mClusterId[layer].size();
93}
94
95inline void Road::getLength(Int_t& layer1, Int_t& layer2) const
96{
97 layer1 = -1, layer2 = 10;
98 for (Int_t layer = 0; layer < constants::mft::LayersNumber; ++layer) {
99 if (mClusterId[layer].size() > 0) {
100 if (layer1 < 0) {
101 layer1 = layer;
102 }
103 layer2 = layer;
104 }
105 }
106}
107
108template <typename... T>
110{
111 mCell[layer].emplace_back(layer, std::forward<T>(values)...);
112 return mCell[layer].back();
113}
114
115inline std::vector<Cell>& Road::getCellsInLayer(Int_t layer)
116{
117 return mCell[layer];
118}
119
120inline void Road::addLeftNeighbourToCell(const Int_t layer, const Int_t cellId, const Int_t layerL, const Int_t cellIdL)
121{
122 mCell[layer][cellId].addLeftNeighbour(layerL, cellIdL);
123}
124
125inline void Road::addRightNeighbourToCell(const Int_t layer, const Int_t cellId, const Int_t layerR, const Int_t cellIdR)
126{
127 mCell[layer][cellId].addRightNeighbour(layerR, cellIdR);
128}
129
130inline void Road::incrementCellLevel(const Int_t layer, const Int_t cellId)
131{
132 mCell[layer][cellId].incrementLevel();
133}
134
135inline void Road::updateCellLevel(const Int_t layer, const Int_t cellId)
136{
137 mCell[layer][cellId].updateLevel();
138}
139
140inline const Int_t Road::getCellLevel(const Int_t layer, const Int_t cellId) const
141{
142 return mCell[layer][cellId].getLevel();
143}
144
145inline const Bool_t Road::isCellUsed(const Int_t layer, const Int_t cellId) const
146{
147 return mCell[layer][cellId].isUsed();
148}
149
150inline void Road::setCellUsed(const Int_t layer, const Int_t cellId, const Bool_t suc)
151{
152 mCell[layer][cellId].setUsed(suc);
153}
154
155inline void Road::setCellLevel(const Int_t layer, const Int_t cellId, const Int_t level)
156{
157 mCell[layer][cellId].setLevel(level);
158}
159
160} // namespace mft
161} // namespace o2
162
163#endif /* O2_MFT_ROAD_H_ */
A segment connecting two clusters from two planes.
Some constants, fixed parameters and look-up-table functions.
const Int_t getRoadId() const
Definition Road.h:40
Cell & addCellInLayer(Int_t layer, T &&... args)
Definition Road.h:109
void setRoadId(const Int_t id)
Definition Road.h:39
void updateCellLevel(const Int_t, const Int_t)
Definition Road.h:135
const Int_t getNPointsInLayer(Int_t layer) const
Definition Road.h:90
const Bool_t isCellUsed(const Int_t, const Int_t) const
Definition Road.h:145
const std::vector< Int_t > & getClustersIdInLayer(Int_t layer) const
Definition Road.h:46
void getLength(Int_t &layer1, Int_t &layer2) const
Definition Road.h:95
void setPoint(const Int_t layer, const Int_t clusterId)
Definition Road.h:34
void initialize()
Definition Road.h:80
void reset()
Definition Road.h:70
void addLeftNeighbourToCell(const Int_t, const Int_t, const Int_t, const Int_t)
Definition Road.h:120
std::vector< Cell > & getCellsInLayer(Int_t)
Definition Road.h:115
const Int_t getCellLevel(const Int_t, const Int_t) const
Definition Road.h:140
void setCellLevel(const Int_t, const Int_t, const Int_t)
Definition Road.h:155
void incrementCellLevel(const Int_t, const Int_t)
Definition Road.h:130
void addRightNeighbourToCell(const Int_t, const Int_t, const Int_t, const Int_t)
Definition Road.h:125
void setCellUsed(const Int_t, const Int_t, const Bool_t)
Definition Road.h:150
GLsizeiptr size
Definition glcorearb.h:659
GLenum GLsizei GLsizei GLint * values
Definition glcorearb.h:1576
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLuint id
Definition glcorearb.h:650
constexpr Int_t LayersNumber
Definition Constants.h:37
constexpr Int_t MaxCellsInRoad
Definition Constants.h:53
constexpr Int_t MaxPointsInRoad
Definition Constants.h:52
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...