38 CHECK(h_gblLArCells.isValid());
39 const auto & gblLArCells = *h_gblLArCells;
42 static constexpr int nEta{98};
43 static constexpr int nPhi{64};
45 auto pTowerEnergies = std::make_unique<std::array<std::array<float, nPhi>, nEta>>();
46 auto & towerEnergies = *pTowerEnergies;
50 int eta_index =
static_cast<int>(std::floor(cell->eta() * 10)) + 49;
51 int phi_index =
static_cast<int>(std::floor(cell->phi() * 10)) + 32;
54 if (eta_index < 0 || eta_index >= nEta || phi_index < 0 || phi_index >= nPhi)
continue;
57 towerEnergies[eta_index][phi_index] += cell->getEnergy();
61 auto towers = std::make_unique<IOBitwise::CommonTOBContainer>();
62 towers->reserve(nEta * nPhi);
64 for (
int etaBin = 0; etaBin < nEta; ++etaBin) {
65 for (
int phiBin = 0; phiBin < nPhi; ++phiBin) {
67 if (towerEnergies[etaBin][phiBin] == 0)
continue;
71 towers->emplace_back(
new IOBitwise::CommonTOB(std::bitset<IOBitwise::CommonTOB::s_et_width>(energyBits),
72 std::bitset<IOBitwise::CommonTOB::s_eta_width>(etaBin),
73 std::bitset<IOBitwise::CommonTOB::s_phi_width>(phiBin)));
77 ATH_MSG_DEBUG(
"Built " << towers->size() <<
" cell towers and stored them as GenericTobs");
79 CHECK(h_towerTOBs.record(std::move(towers)));
81 return StatusCode::SUCCESS;