diff --git a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc index abd85c534b932..ceac229b76328 100644 --- a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc +++ b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc @@ -62,12 +62,36 @@ HLTScoutingEgammaProducer::HLTScoutingEgammaProducer(const edm::ParameterSet& iC egammaPtCut(iConfig.getParameter("egammaPtCut")), egammaEtaCut(iConfig.getParameter("egammaEtaCut")), egammaHoverECut(iConfig.getParameter("egammaHoverECut")), + egammaSigmaIEtaIEtaCut(iConfig.getParameter>("egammaSigmaIEtaIEtaCut")), + absEtaBinUpperEdges(iConfig.getParameter>("absEtaBinUpperEdges")), mantissaPrecision(iConfig.getParameter("mantissaPrecision")), saveRecHitTiming(iConfig.getParameter("saveRecHitTiming")), rechitMatrixSize(iConfig.getParameter("rechitMatrixSize")), //(2n+1)^2 rechitZeroSuppression(iConfig.getParameter("rechitZeroSuppression")), ecalRechitEB_(consumes(iConfig.getParameter("ecalRechitEB"))), ecalRechitEE_(consumes(iConfig.getParameter("ecalRechitEE"))) { + // cross-check for compatibility in input vectors + if (absEtaBinUpperEdges.size() != egammaSigmaIEtaIEtaCut.size()) { + throw cms::Exception("IncompatibleVects") + << "size of \"absEtaBinUpperEdges\" (" << absEtaBinUpperEdges.size() << ") and \"egammaSigmaIEtaIEtaCut\" (" + << egammaSigmaIEtaIEtaCut.size() << ") differ"; + } + + for (auto aIt = 1u; aIt < absEtaBinUpperEdges.size(); ++aIt) { + if (absEtaBinUpperEdges[aIt - 1] < 0 || absEtaBinUpperEdges[aIt] < 0) { + throw cms::Exception("IncorrectValue") << "absEtaBinUpperEdges entries should be greater than or equal to zero."; + } + if (absEtaBinUpperEdges[aIt - 1] >= absEtaBinUpperEdges[aIt]) { + throw cms::Exception("ImproperBinning") << "absEtaBinUpperEdges entries should be in increasing order."; + } + } + + if (not absEtaBinUpperEdges.empty() and absEtaBinUpperEdges[absEtaBinUpperEdges.size() - 1] < egammaEtaCut) { + throw cms::Exception("IncorrectValue") + << "Last entry in \"absEtaBinUpperEdges\" (" << absEtaBinUpperEdges[absEtaBinUpperEdges.size() - 1] + << ") should have a value larger than \"egammaEtaCut\" (" << egammaEtaCut << ")."; + } + //register products produces(); produces(); @@ -107,6 +131,7 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e return; } + // Get R9Map Handle R9Map; if (!iEvent.getByToken(R9Map_, R9Map)) { iEvent.put(std::move(outElectrons)); @@ -232,9 +257,21 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e } } - float HoE = 999.; - if (candidate.superCluster()->energy() != 0.) - HoE = (*HoverEMap)[candidateRef] / candidate.superCluster()->energy(); + auto const HoE = candidate.superCluster()->energy() != 0. + ? ((*HoverEMap)[candidateRef] / candidate.superCluster()->energy()) + : 999.; + if (HoE > egammaHoverECut) + continue; + + if (not absEtaBinUpperEdges.empty()) { + auto const sinin = candidate.superCluster()->energy() != 0. ? (*SigmaIEtaIEtaMap)[candidateRef] : 999.; + auto etaBinIdx = std::distance( + absEtaBinUpperEdges.begin(), + std::lower_bound(absEtaBinUpperEdges.begin(), absEtaBinUpperEdges.end(), std::abs(candidate.eta()))); + + if (sinin > egammaSigmaIEtaIEtaCut[etaBinIdx]) + continue; + } float d0 = 0.0; float dz = 0.0; @@ -319,6 +356,8 @@ void HLTScoutingEgammaProducer::fillDescriptions(edm::ConfigurationDescriptions& desc.add("egammaPtCut", 4.0); desc.add("egammaEtaCut", 2.5); desc.add("egammaHoverECut", 1.0); + desc.add>("egammaSigmaIEtaIEtaCut", {99999.0, 99999.0}); + desc.add>("absEtaBinUpperEdges", {1.479, 5.0}); desc.add("saveRecHitTiming", false); desc.add("mantissaPrecision", 10)->setComment("default float16, change to 23 for float32"); desc.add("rechitMatrixSize", 10); diff --git a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.h b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.h index 7d0d660b5299b..7d68a26e5c3d3 100644 --- a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.h +++ b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.h @@ -82,6 +82,8 @@ class HLTScoutingEgammaProducer : public edm::global::EDProducer<> { const double egammaPtCut; const double egammaEtaCut; const double egammaHoverECut; + const std::vector egammaSigmaIEtaIEtaCut; + const std::vector absEtaBinUpperEdges; const int mantissaPrecision; const bool saveRecHitTiming; const int rechitMatrixSize;