41 std::vector<Gep::GepCaloCell> cells;
44 CHECK(h_gepCellsMap.isValid());
45 const auto & gepCellsMap = *h_gepCellsMap;
47 auto cell_map = gepCellsMap.getCellMap();
50 for (
auto const& cell_itr : *cell_map) {
51 cells.push_back(cell_itr.second);
57 CHECK(h_outputCaloClusters.
record(std::make_unique<xAOD::CaloClusterContainer>(),
58 std::make_unique<xAOD::CaloClusterAuxContainer>()));
62 std::vector<std::vector<unsigned int>> cell_ids;
63 auto customTowers = std::make_unique<xAOD::CaloTowerContainer>();
64 auto aux = std::make_unique<xAOD::CaloTowerAuxContainer>();
65 customTowers->setStore(
aux.get());
68 static constexpr int nEta{98};
69 static constexpr int nPhi{64};
70 customTowers->configureGrid(nEta,-4.9,4.9,nPhi);
72 int nTowers = customTowers->nTowers();
73 cell_ids.resize(nTowers);
75 for (
int iTower=0; iTower < nTowers; ++iTower) {
76 auto tower = std::make_unique<xAOD::CaloTower>();
77 customTowers->push_back(std::move(tower));
78 customTowers->at(iTower)->reset();
82 for (
const auto& cell : cells) {
83 if (cell.isBadCell())
continue;
85 int idx = customTowers->index(cell.eta,cell.phi);
86 if (idx < 0)
continue;
90 customTowers->at(idx)->addEnergy(cell.et);
91 cell_ids[idx].push_back(cell.id);
95 for(
auto tower: *customTowers){
96 auto p4 = tower->p4();
99 if ( p4.E() <=
m_minEt )
continue;
102 auto *ptr = h_outputCaloClusters->push_back(std::make_unique<xAOD::CaloCluster>());
108 double eta = p4.Eta();
109 double phi = p4.Phi();
110 double e = p4.E() * std::cosh(
eta);
122 auto cccl = std::make_unique<CaloClusterCellLink>();
124 for (
auto cell_id : cell_ids[tower->index()])
125 cccl->addCell(cell_map->at(cell_id).index, 1.0);
127 ptr->addCellLink(std::move(cccl));
131 return StatusCode::SUCCESS;