34 ptCut(iConfig.getParameter<
double>(
"muonPtMin")),
35 etaCut(iConfig.getParameter<
double>(
"muonEtaMax")),
36 photonPtCut(iConfig.getParameter<
double>(
"photonPtMin")),
37 drEtCut(iConfig.getParameter<
double>(
"deltaROverEt2Max")),
38 isoCut(iConfig.getParameter<
double>(
"isolation")) {
39 produces<std::vector<pat::GenericParticle>>();
44 ->setComment(
"packed pf candidates where to look for photons");
47 "electrons to check for footprint, the electron collection must have proper linking with the "
48 "packedCandidate collection");
50 ->setComment(
"collection of muons to correct for FSR ");
51 desc.add<
double>(
"muonPtMin", 20.)->setComment(
"minimum pt of the muon to look for a near photon");
52 desc.add<
double>(
"muonEtaMax", 2.4)->setComment(
"max eta of the muon to look for a near photon");
53 desc.add<
double>(
"photonPtMin", 2.0)->setComment(
"minimum photon Pt");
54 desc.add<
double>(
"deltaROverEt2Max", 0.05)->setComment(
"max ratio of deltsR(mu,photon) over et2 of the photon");
55 desc.add<
double>(
"isolation", 2.0)->setComment(
"relative isolation cut");
66 const double& isoConeMax,
67 const double& isoConeMin)
const;
90 auto fsrPhotons = std::make_unique<std::vector<pat::GenericParticle>>();
93 int photonPosition = -1;
94 double distance_metric_min = -1;
103 for (
auto iter_pf = pfcands->begin(); iter_pf != pfcands->end(); iter_pf++) {
104 auto const& pc = *iter_pf;
107 if (
abs(pc.pdgId()) != 22)
114 if (
abs(pc.eta()) > 1.4 and (
abs(pc.eta()) < 1.6))
116 if (
abs(pc.eta()) > 2.5)
120 double dRPhoMu =
deltaR(
muon->eta(),
muon->phi(), pc.eta(), pc.phi());
121 if (dRPhoMu < 0.0001)
126 bool skipPhoton =
false;
129 for (
auto othermuon =
muons->begin(); othermuon !=
muons->end(); ++othermuon) {
132 double dRPhoMuOther =
deltaR(othermuon->eta(), othermuon->phi(), pc.eta(), pc.phi());
133 if (dRPhoMuOther < dRPhoMu) {
144 for (
auto electrons_iter =
electrons->begin(); electrons_iter !=
electrons->end(); ++electrons_iter) {
145 for (
auto const&
cand : electrons_iter->associatedPackedPFCandidates()) {
146 if (!
cand.isAvailable())
148 if (
cand.id() != pfcandRef.
id())
150 <<
"The electron associatedPackedPFCandidates item does not have "
151 <<
"the same ID of packed candidate collection used for cleaning the electron footprint: " <<
cand.id()
152 <<
" (" << pfcandRef.
id() <<
")\n";
153 if (
cand.key() == pfcandRef.
key()) {
167 if (photon_relIso03 >
isoCut)
169 double metric =
deltaR(
muon->eta(),
muon->phi(), pc.eta(), pc.phi()) / (pc.pt() * pc.pt());
173 fsrPhotons->back().addUserFloat(
"relIso03", photon_relIso03);
175 fsrPhotons->back().addUserFloat(
"dROverEt2", metric);
178 if (photonPosition == -1
or metric < distance_metric_min) {
179 distance_metric_min = metric;
180 photonPosition = fsrPhotons->size() - 1;
190 const double& isoConeMax,
191 const double& isoConeMin)
const {
194 for (
const auto&
pfcand : pfcands) {
197 if (dRIsoCone > isoConeMax)
199 if (dRIsoCone < isoConeMin)
203 if (dRIsoCone > 0.0001)
206 if (dRIsoCone > 0.01)
211 return ptsum /
photon.pt();