34 const EventContext& ctx)
const {
37 if (dc){dc->collect(*
this,
"start");}
41 CHECK(h_gblLArCells.isValid());
42 const auto & gblLArCells = *h_gblLArCells;
45 static constexpr int nEta{98};
46 static constexpr int nPhi{64};
48 auto pTowerEnergies = std::make_unique<std::array<std::array<float, nPhi>, nEta>>();
49 auto & towerEnergies = *pTowerEnergies;
53 int eta_index =
static_cast<int>(std::floor(cell->eta() * 10)) + 49;
54 int phi_index =
static_cast<int>(std::floor(cell->phi() * 10)) + 32;
57 if (eta_index < 0 || eta_index >= nEta || phi_index < 0 || phi_index >= nPhi)
continue;
60 towerEnergies[eta_index][phi_index] += cell->getEnergy();
64 auto towers = std::make_unique<IOBitwise::CommonTOBContainer>();
65 towers->reserve(nEta * nPhi);
67 for (
int etaBin = 0; etaBin < nEta; ++etaBin) {
68 for (
int phiBin = 0; phiBin < nPhi; ++phiBin) {
70 if (towerEnergies[etaBin][phiBin] == 0)
continue;
74 towers->emplace_back(
new IOBitwise::CommonTOB(std::bitset<IOBitwise::CommonTOB::s_et_width>(energyBits),
75 std::bitset<IOBitwise::CommonTOB::s_eta_width>(etaBin),
76 std::bitset<IOBitwise::CommonTOB::s_phi_width>(phiBin)));
80 ATH_MSG_DEBUG(
"Built " << towers->size() <<
" cell towers and stored them as GenericTobs");
82 CHECK(h_towerTOBs.record(std::move(towers)));
84 if (dc){dc->collect(*
this,
"end");}
86 return StatusCode::SUCCESS;