33 CHECK(h_gblLArCells.isValid());
34 const auto & gblLArCells = *h_gblLArCells;
37 static constexpr int nEta{98};
38 static constexpr int nPhi{64};
40 auto pTowerEnergies = std::make_unique<std::array<std::array<float, nPhi>, nEta>>();
41 auto & towerEnergies = *pTowerEnergies;
45 int eta_index =
static_cast<int>(std::floor(cell->eta() * 10)) + 49;
46 int phi_index =
static_cast<int>(std::floor(cell->phi() * 10)) + 32;
49 if (eta_index < 0 || eta_index >= nEta || phi_index < 0 || phi_index >= nPhi)
continue;
52 towerEnergies[eta_index][phi_index] += cell->getEnergy();
56 auto towers = std::make_unique<IOBitwise::CommonTOBContainer>();
57 towers->reserve(nEta * nPhi);
59 for (
int etaBin = 0; etaBin < nEta; ++etaBin) {
60 for (
int phiBin = 0; phiBin < nPhi; ++phiBin) {
62 if (towerEnergies[etaBin][phiBin] == 0)
continue;
66 towers->emplace_back(
new IOBitwise::CommonTOB(std::bitset<IOBitwise::ICommonTOB::s_et_width>(energyBits),
67 std::bitset<IOBitwise::ICommonTOB::s_eta_width>(etaBin),
68 std::bitset<IOBitwise::ICommonTOB::s_phi_width>(phiBin)));
72 ATH_MSG_DEBUG(
"Built " << towers->size() <<
" cell towers and stored them as GenericTobs");
74 CHECK(h_towerTOBs.record(std::move(towers)));
76 return StatusCode::SUCCESS;