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