14 return cl1->
pt() >
cl2->pt();
19 static float constexpr
eta_min = 1.;
20 static float constexpr
eta_max = 4.;
29 static constexpr
float phi_min = -
M_PI;
30 static constexpr
float phi_max =
M_PI;
31 static constexpr
unsigned n_phi_bins = 63;
49 : multiclusters_token_(
51 calibrator_(iConfig.getParameter<
edm::
ParameterSet>(
"calibrationConfig")) {
52 produces<BXVector<l1t::EGamma>>(
"L1EGammaCollectionBXVWithCuts");
65 std::vector<const l1t::HGCalMulticluster *> selected_multiclusters;
66 std::map<std::pair<int, int>, std::vector<const l1t::HGCalMulticluster *>> etaphi_bins;
69 for (
auto cl3d = multiclusters.
begin(0); cl3d != multiclusters.
end(0); cl3d++) {
71 if (cl3d->et() > minEt_) {
83 l1EgammaBxCollection->push_back(0, eg);
84 if (hw_quality == 2) {
87 cl3d->iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM), cl3d->eta(), cl3d->phi(), 0.));
91 l1EgammaBxCollection->push_back(0, eg_emint);
93 selected_multiclusters.push_back(&(*cl3d));
95 auto bucket = etaphi_bins.find(eta_phi_bin);
96 if (bucket == etaphi_bins.end()) {
97 std::vector<const l1t::HGCalMulticluster *> vec;
98 vec.push_back(&(*cl3d));
99 etaphi_bins[eta_phi_bin] = vec;
101 bucket->second.push_back(&(*cl3d));
109 std::set<const l1t::HGCalMulticluster *> used_clusters;
110 for (
const auto &cl3d : selected_multiclusters) {
111 if (used_clusters.find(cl3d) == used_clusters.end()) {
112 float pt = cl3d->pt();
114 if (cl3d->hOverE() != -1)
115 pt = cl3d->pt() / (1 + cl3d->hOverE());
118 cl3d->iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM), cl3d->eta(), cl3d->phi(), 0.);
121 used_clusters.insert(cl3d);
124 for (
int eta_bin : {eta_phi_bin.first - 1, eta_phi_bin.first, eta_phi_bin.first + 1}) {
125 for (
int phi_bin : {eta_phi_bin.second - 1, eta_phi_bin.second, eta_phi_bin.second + 1}) {
126 auto bucket = etaphi_bins.find(std::make_pair(eta_bin, phi_bin));
127 if (bucket != etaphi_bins.end()) {
129 for (
const auto &other_cl_ptr : bucket->second) {
130 if (used_clusters.find(other_cl_ptr) == used_clusters.end()) {
131 if (
std::abs(other_cl_ptr->eta() - cl3d->eta()) < 0.02) {
133 float pt_other = other_cl_ptr->pt();
134 if (other_cl_ptr->hOverE() != -1)
135 pt_other = other_cl_ptr->pt() / (1 + other_cl_ptr->hOverE());
138 other_cl_ptr->iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM),
142 used_clusters.insert(other_cl_ptr);
155 l1EgammaBxCollection->push_back(0, eg);
161 l1EgammaBxCollection->push_back(0, eg_emint_brec);
165 iEvent.put(
std::move(l1EgammaBxCollection),
"L1EGammaCollectionBXVWithCuts");
constexpr double deltaPhi(double phi1, double phi2)
double pt() const final
transverse momentum
#define DEFINE_FWK_MODULE(type)
void produce(edm::Event &, const edm::EventSetup &) override
static constexpr int n_eta_bins
edm::EDGetToken multiclusters_token_
const_iterator begin(int bx) const
L1EGammaEECalibrator calibrator_
pair< int, int > get_eta_phi_bin(const l1t::HGCalMulticluster *cl)
int get_phi_bin(const l1t::HGCalMulticluster *cl)
L1EGammaEEProducer(const edm::ParameterSet &)
BXVector< HGCalMulticluster > HGCalMulticlusterBxCollection
Abs< T >::type abs(const T &t)
bool compare_cluster_pt(const l1t::HGCalMulticluster *cl1, const l1t::HGCalMulticluster *cl2)
void setIsoEt(short int iso)
const_iterator end(int bx) const
float calibrationFactor(const float &pt, const float &eta) const
int etaBin(const l1t::HGCalMulticluster *cl)
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.