Project
Loading...
Searching...
No Matches
Cell.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_CELL_H_
17#define O2_MFT_CELL_H_
18
19#include <array>
20#include <vector>
21#include <iostream>
22
24
25namespace o2
26{
27namespace mft
28{
29
30class Cell
31{
32 public:
33 Cell();
35 Cell(const Int_t, const Int_t, const Int_t, const Int_t, const Int_t);
36
37 const Int_t getFirstLayerId() const;
38 const Int_t getSecondLayerId() const;
39 const Int_t getFirstClusterIndex() const;
40 const Int_t getSecondClusterIndex() const;
41 const Int_t getLevel() const;
42 void setLevel(const Int_t);
43 void incrementLevel();
44 void updateLevel();
45 void addRightNeighbour(const Int_t, const Int_t);
46 void addLeftNeighbour(const Int_t, const Int_t);
47 void setUsed(const Bool_t suc) { mIsUsed = suc; }
48 const Bool_t isUsed() const { return mIsUsed; }
49 const Int_t getCellId() const { return mCellId; };
50 void setCellId(const Int_t);
51 const auto& getLeftNeighbours() const { return mLeftNeighbours; };
52 const auto& getRightNeighbours() const { return mRightNeighbours; };
53 const UChar_t getNLeftNeighbours() const { return mLeftNeighbours.size(); }
54 const UChar_t getNRightNeighbours() const { return mRightNeighbours.size(); }
55
57 {
58 mCoord[0] = coord[0]; // X1
59 mCoord[1] = coord[1]; // Y1
60 mCoord[2] = coord[2]; // Z1
61 mCoord[3] = coord[3]; // X2
62 mCoord[4] = coord[4]; // Y2
63 mCoord[5] = coord[5]; // Z2
64 }
65
66 const Float_t getX1() const { return mCoord[0]; }
67 const Float_t getY1() const { return mCoord[1]; }
68 const Float_t getZ1() const { return mCoord[2]; }
69 const Float_t getX2() const { return mCoord[3]; }
70 const Float_t getY2() const { return mCoord[4]; }
71 const Float_t getZ2() const { return mCoord[5]; }
72
73 private:
74 const Int_t mFirstLayerId;
75 const Int_t mSecondLayerId;
76 const Int_t mFirstClusterIndex;
77 const Int_t mSecondClusterIndex;
78 Int_t mLevel;
79 Bool_t mUpdateLevel;
80 Bool_t mIsUsed;
81 Int_t mCellId;
82 std::vector<std::pair<Int_t, Int_t>> mLeftNeighbours;
83 std::vector<std::pair<Int_t, Int_t>> mRightNeighbours;
84 Float_t mCoord[6];
85};
86
87inline Cell::Cell()
88 : mFirstLayerId{-1},
89 mSecondLayerId{-1},
90 mFirstClusterIndex{-1},
91 mSecondClusterIndex{-1},
92 mLevel{0},
93 mUpdateLevel{kFALSE},
94 mIsUsed{kFALSE},
95 mCellId{-1}
96{
97 // Default constructor, for the dictionary
98}
99
100inline Cell::Cell(const Int_t firstLayerId, const Int_t secondLayerId, const Int_t firstClusterIndex, const Int_t secondClusterIndex, const Int_t cellIndex)
101 : mFirstLayerId{firstLayerId},
102 mSecondLayerId{secondLayerId},
103 mFirstClusterIndex{firstClusterIndex},
104 mSecondClusterIndex{secondClusterIndex},
105 mLevel{1},
106 mUpdateLevel{kFALSE},
107 mIsUsed{kFALSE},
108 mCellId{cellIndex}
109{
110}
111
112inline const Int_t Cell::getFirstLayerId() const { return mFirstLayerId; }
113
114inline const Int_t Cell::getSecondLayerId() const { return mSecondLayerId; }
115
116inline const Int_t Cell::getFirstClusterIndex() const { return mFirstClusterIndex; }
117
118inline const Int_t Cell::getSecondClusterIndex() const { return mSecondClusterIndex; }
119
120inline const Int_t Cell::getLevel() const
121{
122 return mLevel;
123}
124
125inline void Cell::setLevel(const Int_t level) { mLevel = level; }
126
127inline void Cell::addRightNeighbour(const Int_t layer, const Int_t clusterId)
128{
129 mRightNeighbours.emplace_back(layer, clusterId);
130}
131
132inline void Cell::addLeftNeighbour(const Int_t layer, const Int_t clusterId)
133{
134 mLeftNeighbours.emplace_back(layer, clusterId);
135}
136
138{
139 mUpdateLevel = kTRUE;
140}
141
142inline void Cell::updateLevel()
143{
144 if (mUpdateLevel) {
145 ++mLevel;
146 mUpdateLevel = kFALSE;
147 }
148}
149
150} // namespace mft
151} // namespace o2
152#endif /* O2_MFT_CELL_H_ */
Some constants, fixed parameters and look-up-table functions.
void setCoordinates(Float_t *coord)
Definition Cell.h:56
const Float_t getZ1() const
Definition Cell.h:68
const Int_t getCellId() const
Definition Cell.h:49
const Float_t getX2() const
Definition Cell.h:69
const Float_t getY2() const
Definition Cell.h:70
const auto & getLeftNeighbours() const
Definition Cell.h:51
const UChar_t getNLeftNeighbours() const
Definition Cell.h:53
const Float_t getZ2() const
Definition Cell.h:71
const Bool_t isUsed() const
Definition Cell.h:48
void setUsed(const Bool_t suc)
Definition Cell.h:47
void incrementLevel()
Definition Cell.h:137
const Int_t getFirstLayerId() const
Definition Cell.h:112
const Float_t getY1() const
Definition Cell.h:67
const Int_t getLevel() const
Definition Cell.h:120
void addRightNeighbour(const Int_t, const Int_t)
Definition Cell.h:127
const auto & getRightNeighbours() const
Definition Cell.h:52
const UChar_t getNRightNeighbours() const
Definition Cell.h:54
const Int_t getFirstClusterIndex() const
Definition Cell.h:116
const Int_t getSecondLayerId() const
Definition Cell.h:114
void addLeftNeighbour(const Int_t, const Int_t)
Definition Cell.h:132
const Int_t getSecondClusterIndex() const
Definition Cell.h:118
const Float_t getX1() const
Definition Cell.h:66
void setCellId(const Int_t)
void updateLevel()
Definition Cell.h:142
void setLevel(const Int_t)
Definition Cell.h:125
GLenum coord
Definition glcorearb.h:4109
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLint level
Definition glcorearb.h:275
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...