28{
29 std::vector<std::vector<GepCaloCell>> window(17, std::vector<GepCaloCell>(3));
30
32
33
34 const GepCaloCell* centerCell = nullptr;
35 unsigned int centerCellId = 0;
36 bool exactMatchFound = false;
37
38 for (auto it = cellMap->begin(); it != cellMap->end(); ++it) {
39 const auto&
cell =
it->second;
40 if (
cell.sampling != 1)
continue;
41
42
46 centerCellId =
cell.id;
47 exactMatchFound = true;
48 break;
49 }
50 }
51
52
53 if (!exactMatchFound || !centerCell) {
54 return window;
55 }
56
57
58
59
60
61
62 for (int etaOffset = -8; etaOffset <= 8; etaOffset++) {
63 unsigned int windowRow = etaOffset + 8;
64
65
66 unsigned int baseId = static_cast<unsigned int>(static_cast<int>(centerCellId) + (etaOffset * 512));
67
68
69 for (int phiOffset = -1; phiOffset <= 1; phiOffset++) {
70 int windowCol = phiOffset + 1;
71
72
73 unsigned int cellId = static_cast<unsigned int>(static_cast<int>(baseId) + phiOffset * 2);
74
75
76 auto it = cellMap->find(cellId);
77 if (it != cellMap->end()) {
78 const auto&
cell =
it->second;
79 if (
cell.sampling == 1) {
80 window[windowRow][windowCol] =
cell;
81 }
82 }
83 }
84 }
85
86 return window;
87}