Belle II Software  release-05-01-25
ECLCellIdMapping.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 - Belle II Collaboration *
4  * *
5  * ECL dataobject ECLCellIdMapping to provide quick access of *
6  * cellid storearray position. *
7  * *
8  * Author: The Belle II Collaboration *
9  * Contributors: Torben Ferber (torben.ferber@desy.de) (TF) *
10  * *
11  * This software is provided "as is" without any warranty. *
12  **************************************************************************/
13 #pragma once
14 
15 #include <framework/logging/Logger.h>
16 
17 #include <TObject.h>
18 
19 namespace Belle2 {
28  class ECLCellIdMapping : public TObject {
29  public:
30 
32  static constexpr int c_nECLCellIds = 8736;
33 
45  {
46  for (unsigned idx = 0; idx < c_nECLCellIds + 1; idx++) {
48  }
49  }
50 
52  void setCellIdToStoreArray(const int& cellid, const int& idx)
53  {
54  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
55  m_CellIdToStoreArrPosition[cellid] = idx;
56  } else {
57  B2ERROR("Cell Id " << cellid << " does not exist.");
58  }
59  }
60 
62  void setCellIdToNeighbour5(const int& cellid, const std::vector<short int>& neighbours)
63  {
64  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
65  m_CellIdToNeighbours5[cellid] = neighbours;
66  } else {
67  B2ERROR("Cell Id " << cellid << " does not exist.");
68  }
69  }
70 
72  void setCellIdToNeighbour7(const int& cellid, const std::vector<short int>& neighbours)
73  {
74  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
75  m_CellIdToNeighbours7[cellid] = neighbours;
76  } else {
77  B2ERROR("Cell Id " << cellid << " does not exist.");
78  }
79  }
80 
82  void setCellIdToPhi(const int& cellid, const double& phi)
83  {
84  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
85  m_CellIdToPhi[cellid] = phi;
86  } else {
87  B2ERROR("Cell Id " << cellid << " does not exist.");
88  }
89  }
90 
92  void setCellIdToTheta(const int& cellid, const double& theta)
93  {
94  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
95  m_CellIdToTheta[cellid] = theta;
96  } else {
97  B2ERROR("Cell Id " << cellid << " does not exist.");
98  }
99  }
100 
102  void setCellIdToPhiId(const int& cellid, const int& phiid)
103  {
104  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
105  m_CellIdToPhiId[cellid] = phiid;
106  } else {
107  B2ERROR("Cell Id " << cellid << " does not exist.");
108  }
109  }
110 
112  void setCellIdToThetaId(const int& cellid, const int& thetaid)
113  {
114  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
115  m_CellIdToThetaId[cellid] = thetaid;
116  } else {
117  B2ERROR("Cell Id " << cellid << " does not exist.");
118  }
119  }
120 
122  void reset()
123  {
125  }
126 
128  int getCellIdToStoreArray(const int& cellid)
129  {
130  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
131  return m_CellIdToStoreArrPosition[cellid];
132  } else {
133  B2FATAL("Cell Id " << cellid << " does not exist.");
134  return -1;
135  }
136  }
137 
139  std::vector<short int>& getCellIdToNeighbour5(const int& cellid)
140  {
141  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
142  return m_CellIdToNeighbours5[cellid];
143  } else {
144  B2FATAL("Cell Id " << cellid << " does not exist.");
145  }
146  }
147 
149  std::vector<short int>& getCellIdToNeighbour7(const int& cellid)
150  {
151  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
152  return m_CellIdToNeighbours7[cellid];
153  } else {
154  B2FATAL("Cell Id " << cellid << " does not exist.");
155  }
156  }
157 
159  double getCellIdToPhi(const int& cellid)
160  {
161  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
162  return m_CellIdToPhi[cellid];
163  } else {
164  B2FATAL("Cell Id " << cellid << " does not exist.");
165  return -1;
166  }
167  }
168 
170  double getCellIdToTheta(const int& cellid)
171  {
172  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
173  return m_CellIdToTheta[cellid];
174  } else {
175  B2FATAL("Cell Id " << cellid << " does not exist.");
176  return -1;
177  }
178  }
179 
180 
182  int getCellIdToPhiId(const int& cellid)
183  {
184  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
185  return m_CellIdToPhiId[cellid];
186  } else {
187  B2FATAL("Cell Id " << cellid << " does not exist.");
188  return -1;
189  }
190  }
191 
193  int getCellIdToThetaId(const int& cellid)
194  {
195  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
196  return m_CellIdToThetaId[cellid];
197  } else {
198  B2FATAL("Cell Id " << cellid << " does not exist.");
199  return -1;
200  }
201  }
202 
203 
204  private:
205 
207  std::vector<int> m_CellIdToStoreArrPosition;
208 
210  std::vector<double> m_CellIdToPhi;
211 
213  std::vector<double> m_CellIdToTheta;
214 
216  std::vector<int> m_CellIdToPhiId;
217 
219  std::vector<int> m_CellIdToThetaId;
220 
222  std::vector<std::vector<short int>> m_CellIdToNeighbours5;
223 
225  std::vector<std::vector<short int>> m_CellIdToNeighbours7;
226 
228  };
229 
231 } // end namespace Belle2
Belle2::ECLCellIdMapping::setCellIdToNeighbour7
void setCellIdToNeighbour7(const int &cellid, const std::vector< short int > &neighbours)
Set celld id to neighbour7.
Definition: ECLCellIdMapping.h:83
Belle2::ECLCellIdMapping::m_CellIdToNeighbours5
std::vector< std::vector< short int > > m_CellIdToNeighbours5
vector (8736+1 entries) with cell id to 5x5 neighbour vector
Definition: ECLCellIdMapping.h:233
Belle2::ECLCellIdMapping::getCellIdToStoreArray
int getCellIdToStoreArray(const int &cellid)
Get store array from cell id.
Definition: ECLCellIdMapping.h:139
Belle2::ECLCellIdMapping
Class to store mapping between cell id and store array positions.
Definition: ECLCellIdMapping.h:39
Belle2::ECLCellIdMapping::getCellIdToPhi
double getCellIdToPhi(const int &cellid)
Get phi from cell id.
Definition: ECLCellIdMapping.h:170
Belle2::ECLCellIdMapping::setCellIdToTheta
void setCellIdToTheta(const int &cellid, const double &theta)
Set celld id to theta.
Definition: ECLCellIdMapping.h:103
Belle2::ECLCellIdMapping::m_CellIdToPhi
std::vector< double > m_CellIdToPhi
vector (8736+1 entries) with cell id to phi values
Definition: ECLCellIdMapping.h:221
Belle2::ECLCellIdMapping::setCellIdToThetaId
void setCellIdToThetaId(const int &cellid, const int &thetaid)
Set celld id to theta.
Definition: ECLCellIdMapping.h:123
Belle2::ECLCellIdMapping::getCellIdToNeighbour7
std::vector< short int > & getCellIdToNeighbour7(const int &cellid)
Get store array from cell id.
Definition: ECLCellIdMapping.h:160
Belle2::ECLCellIdMapping::m_CellIdToNeighbours7
std::vector< std::vector< short int > > m_CellIdToNeighbours7
vector (8736+1 entries) with cell id to 7x7 neighbour vector
Definition: ECLCellIdMapping.h:236
Belle2::ECLCellIdMapping::setCellIdToPhi
void setCellIdToPhi(const int &cellid, const double &phi)
Set celld id to phi.
Definition: ECLCellIdMapping.h:93
Belle2::ECLCellIdMapping::reset
void reset()
Reset store array.
Definition: ECLCellIdMapping.h:133
Belle2::ECLCellIdMapping::getCellIdToThetaId
int getCellIdToThetaId(const int &cellid)
Get theta from cell id.
Definition: ECLCellIdMapping.h:204
Belle2::ECLCellIdMapping::getCellIdToNeighbour5
std::vector< short int > & getCellIdToNeighbour5(const int &cellid)
Get store array from cell id.
Definition: ECLCellIdMapping.h:150
Belle2::ECLCellIdMapping::m_CellIdToTheta
std::vector< double > m_CellIdToTheta
vector (8736+1 entries) with cell id to phi values
Definition: ECLCellIdMapping.h:224
Belle2::ECLCellIdMapping::m_CellIdToThetaId
std::vector< int > m_CellIdToThetaId
vector (8736+1 entries) with cell id to phi values
Definition: ECLCellIdMapping.h:230
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ECLCellIdMapping::getCellIdToTheta
double getCellIdToTheta(const int &cellid)
Get theta from cell id.
Definition: ECLCellIdMapping.h:181
Belle2::ECLCellIdMapping::ECLCellIdMapping
ECLCellIdMapping()
Default constructor.
Definition: ECLCellIdMapping.h:48
Belle2::ECLCellIdMapping::ClassDef
ClassDef(ECLCellIdMapping, 1)
ClassDef.
Belle2::ECLCellIdMapping::setCellIdToStoreArray
void setCellIdToStoreArray(const int &cellid, const int &idx)
Set celld id to store array.
Definition: ECLCellIdMapping.h:63
Belle2::ECLCellIdMapping::setCellIdToPhiId
void setCellIdToPhiId(const int &cellid, const int &phiid)
Set celld id to phi.
Definition: ECLCellIdMapping.h:113
Belle2::ECLCellIdMapping::m_CellIdToPhiId
std::vector< int > m_CellIdToPhiId
vector (8736+1 entries) with cell id to phi values
Definition: ECLCellIdMapping.h:227
Belle2::ECLCellIdMapping::getCellIdToPhiId
int getCellIdToPhiId(const int &cellid)
Get phi from cell id.
Definition: ECLCellIdMapping.h:193
Belle2::ECLCellIdMapping::setCellIdToNeighbour5
void setCellIdToNeighbour5(const int &cellid, const std::vector< short int > &neighbours)
Set celld id to neighbour5.
Definition: ECLCellIdMapping.h:73
Belle2::ECLCellIdMapping::m_CellIdToStoreArrPosition
std::vector< int > m_CellIdToStoreArrPosition
vector (8736+1 entries) with cell id to store array positions
Definition: ECLCellIdMapping.h:218
Belle2::ECLCellIdMapping::c_nECLCellIds
static constexpr int c_nECLCellIds
Number of ECL CellId.
Definition: ECLCellIdMapping.h:43