38 std::vector<std::vector<GepCaloCell>> window(etaWindowSize, std::vector<GepCaloCell>(phiWindowSize));
44 unsigned int centerCellId = 0;
45 bool exactMatchFound =
false;
47 for (
auto it = cellMap->begin(); it != cellMap->end(); ++it) {
48 const auto& cell = it->second;
49 if (cell.sampling != 1)
continue;
52 if (cell.etaMin < seed.eta() && seed.eta() < cell.etaMax &&
53 cell.phiMin < seed.phi() && seed.phi() < cell.phiMax) {
55 centerCellId = cell.id;
56 exactMatchFound =
true;
62 if (!exactMatchFound || !centerCell) {
71 for (
int etaOffset = -8; etaOffset <= 8; etaOffset++) {
72 unsigned int windowRow = etaOffset + 8;
75 unsigned int baseId =
static_cast<unsigned int>(
static_cast<int>(centerCellId) + (etaOffset * 512));
78 for (
int phiOffset = -1; phiOffset <= 1; phiOffset++) {
79 int windowCol = phiOffset + 1;
82 unsigned int cellId =
static_cast<unsigned int>(
static_cast<int>(baseId) + phiOffset * 2);
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;
112 std::vector<LocalMax> localMaxima;
114 int rows = window.size();
115 int cols = window[0].size();
117 for (
int i = 0; i < rows; ++i) {
118 for (
int j = 0; j < cols; ++j) {
119 double current = window[i][j].e;
122 for (
int di = -1; di <= 1; ++di) {
123 for (
int dj = -1; dj <= 1; ++dj) {
124 if (di == 0 && dj == 0)
continue;
127 if (ni >= 0 && ni < rows && nj >= 0 && nj < cols) {
128 if (window[ni][nj].e >= current) {
137 if (isMax) localMaxima.push_back({current, i, j });
141 if (localMaxima.empty())
return {0., 0.};
144 std::sort(localMaxima.begin(), localMaxima.end(),
145 [](
const LocalMax&
a,
const LocalMax& b){ return a.energy > b.energy; });
147 double E1 = localMaxima[0].energy;
148 double E2 = (localMaxima.size() > 1) ? localMaxima[1].energy : 0.0;