Belle II Software  release-06-01-15
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 #include <framework/logging/Logger.h>
11 
12 #include <TObject.h>
13 
14 namespace Belle2 {
23  class ECLCellIdMapping : public TObject {
24  public:
25 
27  static constexpr int c_nECLCellIds = 8736;
28 
40  {
41  for (unsigned idx = 0; idx < c_nECLCellIds + 1; idx++) {
43  }
44  }
45 
47  void setCellIdToStoreArray(const int& cellid, const int& idx)
48  {
49  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
50  m_CellIdToStoreArrPosition[cellid] = idx;
51  } else {
52  B2ERROR("Cell Id " << cellid << " does not exist.");
53  }
54  }
55 
57  void setCellIdToNeighbour5(const int& cellid, const std::vector<short int>& neighbours)
58  {
59  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
60  m_CellIdToNeighbours5[cellid] = neighbours;
61  } else {
62  B2ERROR("Cell Id " << cellid << " does not exist.");
63  }
64  }
65 
67  void setCellIdToNeighbour7(const int& cellid, const std::vector<short int>& neighbours)
68  {
69  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
70  m_CellIdToNeighbours7[cellid] = neighbours;
71  } else {
72  B2ERROR("Cell Id " << cellid << " does not exist.");
73  }
74  }
75 
77  void setCellIdToPhi(const int& cellid, const double& phi)
78  {
79  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
80  m_CellIdToPhi[cellid] = phi;
81  } else {
82  B2ERROR("Cell Id " << cellid << " does not exist.");
83  }
84  }
85 
87  void setCellIdToTheta(const int& cellid, const double& theta)
88  {
89  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
90  m_CellIdToTheta[cellid] = theta;
91  } else {
92  B2ERROR("Cell Id " << cellid << " does not exist.");
93  }
94  }
95 
97  void setCellIdToPhiId(const int& cellid, const int& phiid)
98  {
99  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
100  m_CellIdToPhiId[cellid] = phiid;
101  } else {
102  B2ERROR("Cell Id " << cellid << " does not exist.");
103  }
104  }
105 
107  void setCellIdToThetaId(const int& cellid, const int& thetaid)
108  {
109  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
110  m_CellIdToThetaId[cellid] = thetaid;
111  } else {
112  B2ERROR("Cell Id " << cellid << " does not exist.");
113  }
114  }
115 
117  void reset()
118  {
120  }
121 
123  int getCellIdToStoreArray(const int& cellid)
124  {
125  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
126  return m_CellIdToStoreArrPosition[cellid];
127  } else {
128  B2FATAL("Cell Id " << cellid << " does not exist.");
129  return -1;
130  }
131  }
132 
134  std::vector<short int>& getCellIdToNeighbour5(const int& cellid)
135  {
136  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
137  return m_CellIdToNeighbours5[cellid];
138  } else {
139  B2FATAL("Cell Id " << cellid << " does not exist.");
140  }
141  }
142 
144  std::vector<short int>& getCellIdToNeighbour7(const int& cellid)
145  {
146  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
147  return m_CellIdToNeighbours7[cellid];
148  } else {
149  B2FATAL("Cell Id " << cellid << " does not exist.");
150  }
151  }
152 
154  double getCellIdToPhi(const int& cellid)
155  {
156  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
157  return m_CellIdToPhi[cellid];
158  } else {
159  B2FATAL("Cell Id " << cellid << " does not exist.");
160  return -1;
161  }
162  }
163 
165  double getCellIdToTheta(const int& cellid)
166  {
167  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
168  return m_CellIdToTheta[cellid];
169  } else {
170  B2FATAL("Cell Id " << cellid << " does not exist.");
171  return -1;
172  }
173  }
174 
175 
177  int getCellIdToPhiId(const int& cellid)
178  {
179  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
180  return m_CellIdToPhiId[cellid];
181  } else {
182  B2FATAL("Cell Id " << cellid << " does not exist.");
183  return -1;
184  }
185  }
186 
188  int getCellIdToThetaId(const int& cellid)
189  {
190  if (cellid > 0 and cellid < c_nECLCellIds + 1) {
191  return m_CellIdToThetaId[cellid];
192  } else {
193  B2FATAL("Cell Id " << cellid << " does not exist.");
194  return -1;
195  }
196  }
197 
198 
199  private:
200 
202  std::vector<int> m_CellIdToStoreArrPosition;
203 
205  std::vector<double> m_CellIdToPhi;
206 
208  std::vector<double> m_CellIdToTheta;
209 
211  std::vector<int> m_CellIdToPhiId;
212 
214  std::vector<int> m_CellIdToThetaId;
215 
217  std::vector<std::vector<short int>> m_CellIdToNeighbours5;
218 
220  std::vector<std::vector<short int>> m_CellIdToNeighbours7;
221 
223  };
224 
226 } // end namespace Belle2
Class to store mapping between cell id and store array positions.
std::vector< double > m_CellIdToTheta
vector (8736+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 (8736+1 entries) with cell id to phi values
std::vector< int > m_CellIdToStoreArrPosition
vector (8736+1 entries) with cell id to store array positions
double getCellIdToTheta(const int &cellid)
Get theta from cell id.
std::vector< short int > & getCellIdToNeighbour7(const int &cellid)
Get store array from cell id.
std::vector< std::vector< short int > > m_CellIdToNeighbours5
vector (8736+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< double > m_CellIdToPhi
vector (8736+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 (8736+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.
static constexpr int c_nECLCellIds
Number of ECL CellId.
int getCellIdToThetaId(const int &cellid)
Get theta from cell id.
void reset()
Reset store array.
std::vector< short int > & getCellIdToNeighbour5(const int &cellid)
Get store array from cell id.
void setCellIdToTheta(const int &cellid, const double &theta)
Set celld id to theta.
std::vector< std::vector< short int > > m_CellIdToNeighbours7
vector (8736+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.
Abstract base class for different kinds of events.