66 std::vector<const l1t::HGCalMulticluster *> selected_multiclusters;
67 std::map<std::pair<int, int>, std::vector<const l1t::HGCalMulticluster *>> etaphi_bins;
70 for (
auto cl3d = multiclusters.
begin(0); cl3d != multiclusters.
end(0); cl3d++) {
72 if (cl3d->et() > minEt_) {
84 l1EgammaBxCollection->push_back(0, eg);
85 if (hw_quality == 2) {
88 cl3d->iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM), cl3d->eta(), cl3d->phi(), 0.));
92 l1EgammaBxCollection->push_back(0, eg_emint);
94 selected_multiclusters.push_back(&(*cl3d));
96 auto bucket = etaphi_bins.find(eta_phi_bin);
97 if (bucket == etaphi_bins.end()) {
98 std::vector<const l1t::HGCalMulticluster *> vec;
99 vec.push_back(&(*cl3d));
100 etaphi_bins[eta_phi_bin] = vec;
102 bucket->second.push_back(&(*cl3d));
110 std::set<const l1t::HGCalMulticluster *> used_clusters;
111 for (
const auto &cl3d : selected_multiclusters) {
112 if (used_clusters.find(cl3d) == used_clusters.end()) {
113 float pt = cl3d->pt();
115 if (cl3d->hOverE() != -1)
116 pt = cl3d->pt() / (1 + cl3d->hOverE());
119 cl3d->iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM), cl3d->eta(), cl3d->phi(), 0.);
122 used_clusters.insert(cl3d);
125 for (
int eta_bin : {eta_phi_bin.first - 1, eta_phi_bin.first, eta_phi_bin.first + 1}) {
126 for (
int phi_bin : {eta_phi_bin.second - 1, eta_phi_bin.second, eta_phi_bin.second + 1}) {
127 auto bucket = etaphi_bins.find(std::make_pair(eta_bin, phi_bin));
128 if (bucket != etaphi_bins.end()) {
130 for (
const auto &other_cl_ptr : bucket->second) {
131 if (used_clusters.find(other_cl_ptr) == used_clusters.end()) {
132 if (
std::abs(other_cl_ptr->eta() - cl3d->eta()) < 0.02) {
134 float pt_other = other_cl_ptr->pt();
135 if (other_cl_ptr->hOverE() != -1)
136 pt_other = other_cl_ptr->pt() / (1 + other_cl_ptr->hOverE());
139 other_cl_ptr->iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM),
143 used_clusters.insert(other_cl_ptr);
156 l1EgammaBxCollection->push_back(0, eg);
162 l1EgammaBxCollection->push_back(0, eg_emint_brec);
166 iEvent.put(
std::move(l1EgammaBxCollection),
"L1EGammaCollectionBXVWithCuts");