Belle II Software development
ECLCellIdMapping.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10/* ECL headers. */
11#include <ecl/dataobjects/ECLElementNumbers.h>
12
13/* Basf2 headers. */
14#include <framework/logging/Logger.h>
15
16/* ROOT headers. */
17#include <TObject.h>
18
19namespace Belle2 {
28 class ECLCellIdMapping : public TObject {
29 public:
30
35 m_CellIdToStoreArrPosition(ECLElementNumbers::c_NCrystals + 1),
36 m_CellIdToPhi(ECLElementNumbers::c_NCrystals + 1),
37 m_CellIdToTheta(ECLElementNumbers::c_NCrystals + 1),
38 m_CellIdToPhiId(ECLElementNumbers::c_NCrystals + 1),
39 m_CellIdToThetaId(ECLElementNumbers::c_NCrystals + 1),
40 m_CellIdToNeighbours5(ECLElementNumbers::c_NCrystals + 1),
41 m_CellIdToNeighbours7(ECLElementNumbers::c_NCrystals + 1),
42 m_CellIdToNeighbours9(ECLElementNumbers::c_NCrystals + 1),
43 m_CellIdToNeighbours11(ECLElementNumbers::c_NCrystals + 1)
44 {
45 for (unsigned idx = 0; idx < ECLElementNumbers::c_NCrystals + 1; idx++) {
47 }
48 }
49
51 void setCellIdToStoreArray(const int& cellid, const int& idx)
52 {
53 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
54 m_CellIdToStoreArrPosition[cellid] = idx;
55 } else {
56 B2ERROR("Cell Id " << cellid << " does not exist.");
57 }
58 }
59
61 void setCellIdToNeighbour5(const int& cellid, const std::vector<short int>& neighbours)
62 {
63 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
64 m_CellIdToNeighbours5[cellid] = neighbours;
65 } else {
66 B2ERROR("Cell Id " << cellid << " does not exist.");
67 }
68 }
69
71 void setCellIdToNeighbour7(const int& cellid, const std::vector<short int>& neighbours)
72 {
73 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
74 m_CellIdToNeighbours7[cellid] = neighbours;
75 } else {
76 B2ERROR("Cell Id " << cellid << " does not exist.");
77 }
78 }
79
81 void setCellIdToNeighbour9(const int& cellid, const std::vector<short int>& neighbours)
82 {
83 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
84 m_CellIdToNeighbours9[cellid] = neighbours;
85 } else {
86 B2ERROR("Cell Id " << cellid << " does not exist.");
87 }
88 }
89
91 void setCellIdToNeighbour11(const int& cellid, const std::vector<short int>& neighbours)
92 {
93 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
94 m_CellIdToNeighbours11[cellid] = neighbours;
95 } else {
96 B2ERROR("Cell Id " << cellid << " does not exist.");
97 }
98 }
99
101 void setCellIdToPhi(const int& cellid, const double& phi)
102 {
103 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
104 m_CellIdToPhi[cellid] = phi;
105 } else {
106 B2ERROR("Cell Id " << cellid << " does not exist.");
107 }
108 }
109
111 void setCellIdToTheta(const int& cellid, const double& theta)
112 {
113 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
114 m_CellIdToTheta[cellid] = theta;
115 } else {
116 B2ERROR("Cell Id " << cellid << " does not exist.");
117 }
118 }
119
121 void setCellIdToPhiId(const int& cellid, const int& phiid)
122 {
123 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
124 m_CellIdToPhiId[cellid] = phiid;
125 } else {
126 B2ERROR("Cell Id " << cellid << " does not exist.");
127 }
128 }
129
131 void setCellIdToThetaId(const int& cellid, const int& thetaid)
132 {
133 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
134 m_CellIdToThetaId[cellid] = thetaid;
135 } else {
136 B2ERROR("Cell Id " << cellid << " does not exist.");
137 }
138 }
139
141 void reset()
142 {
144 }
145
147 int getCellIdToStoreArray(const int& cellid)
148 {
149 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
150 return m_CellIdToStoreArrPosition[cellid];
151 } else {
152 B2FATAL("Cell Id " << cellid << " does not exist.");
153 return -1;
154 }
155 }
156
158 std::vector<short int>& getCellIdToNeighbour5(const int& cellid)
159 {
160 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
161 return m_CellIdToNeighbours5[cellid];
162 } else {
163 B2FATAL("Cell Id " << cellid << " does not exist.");
164 }
165 }
166
168 std::vector<short int>& getCellIdToNeighbour7(const int& cellid)
169 {
170 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
171 return m_CellIdToNeighbours7[cellid];
172 } else {
173 B2FATAL("Cell Id " << cellid << " does not exist.");
174 }
175 }
176
178 std::vector<short int>& getCellIdToNeighbour9(const int& cellid)
179 {
180 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
181 return m_CellIdToNeighbours9[cellid];
182 } else {
183 B2FATAL("Cell Id " << cellid << " does not exist.");
184 }
185 }
186
188 std::vector<short int>& getCellIdToNeighbour11(const int& cellid)
189 {
190 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
191 return m_CellIdToNeighbours11[cellid];
192 } else {
193 B2FATAL("Cell Id " << cellid << " does not exist.");
194 }
195 }
196
198 double getCellIdToPhi(const int& cellid)
199 {
200 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
201 return m_CellIdToPhi[cellid];
202 } else {
203 B2FATAL("Cell Id " << cellid << " does not exist.");
204 return -1;
205 }
206 }
207
209 double getCellIdToTheta(const int& cellid)
210 {
211 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
212 return m_CellIdToTheta[cellid];
213 } else {
214 B2FATAL("Cell Id " << cellid << " does not exist.");
215 return -1;
216 }
217 }
218
219
221 int getCellIdToPhiId(const int& cellid)
222 {
223 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
224 return m_CellIdToPhiId[cellid];
225 } else {
226 B2FATAL("Cell Id " << cellid << " does not exist.");
227 return -1;
228 }
229 }
230
232 int getCellIdToThetaId(const int& cellid)
233 {
234 if (cellid > 0 and cellid < ECLElementNumbers::c_NCrystals + 1) {
235 return m_CellIdToThetaId[cellid];
236 } else {
237 B2FATAL("Cell Id " << cellid << " does not exist.");
238 return -1;
239 }
240 }
241
242
243 private:
244
247
249 std::vector<double> m_CellIdToPhi;
250
252 std::vector<double> m_CellIdToTheta;
253
255 std::vector<int> m_CellIdToPhiId;
256
258 std::vector<int> m_CellIdToThetaId;
259
261 std::vector<std::vector<short int>> m_CellIdToNeighbours5;
262
264 std::vector<std::vector<short int>> m_CellIdToNeighbours7;
265
267 std::vector<std::vector<short int>> m_CellIdToNeighbours9;
268
270 std::vector<std::vector<short int>> m_CellIdToNeighbours11;
271
273 };
274
276} // end namespace Belle2
Class to store mapping between cell id and store array positions.
std::vector< short int > & getCellIdToNeighbour9(const int &cellid)
Get store array from cell id.
std::vector< double > m_CellIdToTheta
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to phi values
void setCellIdToNeighbour7(const int &cellid, const std::vector< short int > &neighbours)
Set celld id to neighbour7.
double getCellIdToPhi(const int &cellid)
Get phi from cell id.
std::vector< int > m_CellIdToThetaId
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to phi values
std::vector< int > m_CellIdToStoreArrPosition
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to store array positions
double getCellIdToTheta(const int &cellid)
Get theta from cell id.
std::vector< std::vector< short int > > m_CellIdToNeighbours5
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to 5x5 neighbour vector
void setCellIdToNeighbour5(const int &cellid, const std::vector< short int > &neighbours)
Set celld id to neighbour5.
void setCellIdToPhiId(const int &cellid, const int &phiid)
Set celld id to phi.
void setCellIdToThetaId(const int &cellid, const int &thetaid)
Set celld id to theta.
std::vector< short int > & getCellIdToNeighbour11(const int &cellid)
Get store array from cell id.
std::vector< double > m_CellIdToPhi
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to phi values
void setCellIdToStoreArray(const int &cellid, const int &idx)
Set celld id to store array.
std::vector< int > m_CellIdToPhiId
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to phi values
ClassDef(ECLCellIdMapping, 1)
ClassDef.
int getCellIdToPhiId(const int &cellid)
Get phi from cell id.
int getCellIdToStoreArray(const int &cellid)
Get store array from cell id.
std::vector< short int > & getCellIdToNeighbour5(const int &cellid)
Get store array from cell id.
std::vector< short int > & getCellIdToNeighbour7(const int &cellid)
Get store array from cell id.
int getCellIdToThetaId(const int &cellid)
Get theta from cell id.
void reset()
Reset store array.
void setCellIdToNeighbour9(const int &cellid, const std::vector< short int > &neighbours)
Set celld id to neighbour9.
void setCellIdToNeighbour11(const int &cellid, const std::vector< short int > &neighbours)
Set celld id to neighbour11.
std::vector< std::vector< short int > > m_CellIdToNeighbours9
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to 9x9 neighbour vector
void setCellIdToTheta(const int &cellid, const double &theta)
Set celld id to theta.
std::vector< std::vector< short int > > m_CellIdToNeighbours7
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to 7x7 neighbour vector
void setCellIdToPhi(const int &cellid, const double &phi)
Set celld id to phi.
ECLCellIdMapping()
Default constructor.
std::vector< std::vector< short int > > m_CellIdToNeighbours11
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to 11x11 neighbour vector
const int c_NCrystals
Number of crystals.
Abstract base class for different kinds of events.