17 std::shared_ptr<PixelDiodeMatrix>
ptr = std::make_shared<Helper>();
39 std::shared_ptr<const PixelDiodeMatrix> lowerCell,
40 std::shared_ptr<const PixelDiodeMatrix> middleCells,
42 std::shared_ptr<const PixelDiodeMatrix> upperCell)
45 std::shared_ptr<PixelDiodeMatrix>
ptr = std::make_shared<Helper>();
46 ptr->initialize(direction,
48 std::move(middleCells),
50 std::move(upperCell));
55 std::shared_ptr<const PixelDiodeMatrix> lowerCell,
56 std::shared_ptr<const PixelDiodeMatrix> middleCells,
58 std::shared_ptr<const PixelDiodeMatrix> upperCell)
160 double relPosDir = 0;
163 double pitchInverse = 0;
166 if (m_direction == phiDir) {
168 relPosDir = relPosition[
distPhi];
169 pitch = m_middleCells->phiWidth();
170 pitchInverse = m_middleCells->phiWidthInverse();
171 middleCells = m_middleCells->phiCells();
174 if (relPosDir < m_lowerCell->
phiWidth()) {
175 return m_lowerCell->cellIdOfPosition(relPosition, cellId);
177 relPosDir -= m_lowerCell->phiWidth();
178 startIndex += m_lowerCell->phiCells();
183 relPosDir = relPosition[
distEta];
184 pitch = m_middleCells->etaWidth();
185 pitchInverse = m_middleCells->etaWidthInverse();
186 middleCells = m_middleCells->etaCells();
189 if (relPosDir < m_lowerCell->etaWidth()) {
190 return m_lowerCell->cellIdOfPosition(relPosition, cellId);
192 relPosDir -= m_lowerCell->etaWidth();
193 startIndex += m_lowerCell->etaCells();
199 int index = relPosDir * pitchInverse;
203 bool outOfBounds =
index >= m_numCells;
204 if (m_upperCell !=
nullptr && outOfBounds) {
207 nextCell = m_upperCell.get();
211 if (outOfBounds)
index = m_numCells - 1;
212 nextCell = m_middleCells.get();
216 relPosDir -=
index * pitch;
217 startIndex +=
index * middleCells;
220 int newPhiIndex = cellId.phiIndex();
221 int newEtaIndex = cellId.etaIndex();
224 if (m_direction == phiDir) {
225 if (nextCell->singleCell()) {
226 newPhiIndex += startIndex;
231 cell = nextCell->cellIdOfPosition(newRelPos, relId);
232 newPhiIndex += startIndex + relId.
phiIndex();
236 if (nextCell->singleCell()) {
237 newEtaIndex += startIndex;
242 cell = nextCell->cellIdOfPosition(newRelPos, relId);
244 newEtaIndex += startIndex + relId.
etaIndex();
248 cellId =
SiCellId(newPhiIndex, newEtaIndex);
280 int rel_phi_index = cellId.
phiIndex();
281 int rel_eta_index = cellId.
etaIndex();
282 for( ;!
matrix->m_singleCell; ) {
286 int nMiddleCells = 0;
288 const auto direction =
matrix->m_direction;
292 relIndex = rel_phi_index;
296 if (relIndex < lowerCell->
phiCells()) {
307 nMiddleCells = middleCells->
phiCells();
311 relIndex = rel_eta_index;
314 if (relIndex < lowerCell->
etaCells()) {
325 nMiddleCells = middleCells->
etaCells();
330 relIndex -=
index * nMiddleCells;
331 startPos +=
index * pitch;
336 rel_phi_index = relIndex;
339 rel_eta_index = relIndex;
345 dest_position = position;
356 std::string cellSize =
"";
362 std::string cellContent =
"";
365 cellContent +=
prefix +
"completly empty (WARNING: there should always be at least one cell!)\n";
369 cellContent +=
prefix +
"direction: ";
372 else { cellContent +=
"unknown\n"; }
376 cellContent +=
prefix +
"lowerCell: \n";
384 cellContent +=
prefix +
"upperCell: \n";