diff --git a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTFilteredObjProducer.h b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTFilteredObjProducer.h index bfa83e5476f3b..b392c4fa52daf 100644 --- a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTFilteredObjProducer.h +++ b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTFilteredObjProducer.h @@ -60,6 +60,7 @@ class EgammaHLTFilteredObjProducer : public edm::stream::EDProducer<> { float cutOverE; float cutOverE2; bool useEt; + bool doAnd; std::function compFunc; CutValues(const edm::ParameterSet& pset) @@ -67,14 +68,20 @@ class EgammaHLTFilteredObjProducer : public edm::stream::EDProducer<> { cutOverE(pset.getParameter("cutOverE")), cutOverE2(pset.getParameter("cutOverE2")), useEt(pset.getParameter("useEt")), + doAnd(pset.getParameter("doAnd")), compFunc(std::less()) {} bool operator()(const reco::RecoEcalCandidate& cand, float value) const { - if (compFunc(value, cut)) - return true; - else { - float energyInv = useEt ? 1. / cand.et() : 1. / cand.energy(); - return compFunc(value * energyInv, cutOverE) || compFunc(value * energyInv * energyInv, cutOverE2); + if (!doAnd) { + if (compFunc(value, cut)) + return true; + else { + float energyInv = useEt ? 1. / cand.et() : 1. / cand.energy(); + return compFunc(value * energyInv, cutOverE) || compFunc(value * energyInv * energyInv, cutOverE2); + } + } else { + float energy = useEt ? cand.et() : cand.energy(); + return compFunc(value, cut + cutOverE * energy + cutOverE2 * energy * energy); } } }; @@ -129,9 +136,11 @@ void EgammaHLTFilteredObjProducer::fillDescriptions(edm::Configurat regionCutsDesc.add("cutOverE", -1); regionCutsDesc.add("cutOverE2", -1); regionCutsDesc.add("useEt", false); + regionCutsDesc.add("doAnd", false); edm::ParameterSet cutDefaults; cutDefaults.addParameter("cutOverE", 0.2); cutDefaults.addParameter("useEt", false); + cutDefaults.addParameter("doAnd", false); cutsDesc.add("barrelCut", regionCutsDesc); cutsDesc.add("endcapCut", regionCutsDesc);