Skip to content

Commit

Permalink
Merge pull request #39790 from bennettgberg/BranchForInclusiveHoECut124X
Browse files Browse the repository at this point in the history
Add option to cut H<a+bE+cE*E backport to 12_4_X
  • Loading branch information
cmsbuild authored Oct 20, 2022
2 parents bc6cca8 + 4294bb8 commit 04d87e0
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,28 @@ class EgammaHLTFilteredObjProducer : public edm::stream::EDProducer<> {
float cutOverE;
float cutOverE2;
bool useEt;
bool doAnd;
std::function<bool(float, float)> compFunc;

CutValues(const edm::ParameterSet& pset)
: cut(pset.getParameter<double>("cut")),
cutOverE(pset.getParameter<double>("cutOverE")),
cutOverE2(pset.getParameter<double>("cutOverE2")),
useEt(pset.getParameter<bool>("useEt")),
doAnd(pset.getParameter<bool>("doAnd")),
compFunc(std::less<float>()) {}

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);
}
}
};
Expand Down Expand Up @@ -129,9 +136,11 @@ void EgammaHLTFilteredObjProducer<OutCollType>::fillDescriptions(edm::Configurat
regionCutsDesc.add<double>("cutOverE", -1);
regionCutsDesc.add<double>("cutOverE2", -1);
regionCutsDesc.add<bool>("useEt", false);
regionCutsDesc.add<bool>("doAnd", false);
edm::ParameterSet cutDefaults;
cutDefaults.addParameter<double>("cutOverE", 0.2);
cutDefaults.addParameter<double>("useEt", false);
cutDefaults.addParameter<double>("doAnd", false);

cutsDesc.add<edm::ParameterSetDescription>("barrelCut", regionCutsDesc);
cutsDesc.add<edm::ParameterSetDescription>("endcapCut", regionCutsDesc);
Expand Down

0 comments on commit 04d87e0

Please sign in to comment.