From 4294bb8a25c34267a5e19d1fba11d30970057500 Mon Sep 17 00:00:00 2001 From: Bennett Greenberg Date: Thu, 20 Oct 2022 11:51:28 +0200 Subject: [PATCH] Add option to cut H { 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);