49 CHECK(h_eventInfo.isValid());
53 CHECK(h_gepCellsMap.isValid());
54 auto gepCellsMap = *h_gepCellsMap;
56 ATH_MSG_DEBUG(
"Read in " << gepCellsMap.size() <<
" GEP cells");
61 CHECK(h_outputCaloClusters.
record(std::make_unique<xAOD::CaloClusterContainer>(),
62 std::make_unique<xAOD::CaloClusterAuxContainer>()));
65 std::unique_ptr<Gep::IClusterMaker> clusterMaker{};
78 return StatusCode::FAILURE;
81 ATH_MSG_DEBUG(
"Running " << clusterMaker->getName() <<
" cluster algorithm." );
84 auto pCellMap = gepCellsMap.getCellMap();
85 std::vector<Gep::Cluster> customClusters = clusterMaker->makeClusters(pCellMap);
89 if (!customClusters.empty()){
94 h_outputCaloClusters->reserve(customClusters.size());
96 for(
const auto& gepclus: customClusters){
99 auto caloCluster = std::make_unique<xAOD::CaloCluster>();
100 auto *ptr = caloCluster.get();
103 h_outputCaloClusters->push_back(std::move(caloCluster));
107 ptr->setE(gepclus.vec.E());
108 ptr->setEta(gepclus.vec.Eta());
109 ptr->setPhi(gepclus.vec.Phi());
110 ptr->setTime(gepclus.time);
120 const double clusEta = gepclus.vec.Eta();
121 std::vector<float> layerEnergies(
static_cast<int>(CaloSampling::Unknown), 0.f);
122 for (
auto cell_id : gepclus.cell_id) {
123 const auto& cell = pCellMap->at(cell_id);
124 if (cell.sampling <
static_cast<unsigned int>(CaloSampling::Unknown))
125 layerEnergies[cell.sampling] += cell.et;
127 uint32_t samplingPattern = 0;
128 for (
int i = 0; i < static_cast<int>(CaloSampling::Unknown); ++i)
129 if (layerEnergies[i] != 0) samplingPattern |= (0x1U << i);
130 ptr->clearSamplingData();
131 ptr->setSamplingPattern(samplingPattern);
132 for (
int i = 0; i < static_cast<int>(CaloSampling::Unknown); ++i) {
133 if (layerEnergies[i] != 0)
135 layerEnergies[i] * std::cosh(clusEta));
140 for (
auto cell_id : gepclus.cell_id)
141 cccl->
addCell(pCellMap->at(cell_id).index, 1.0);
143 ptr->addCellLink(std::make_unique<CaloClusterCellLink>(*cccl));
147 return StatusCode::SUCCESS;