38 ptCutMu(iConfig.getParameter<
double>(
"muonPtMin")),
39 etaCutMu(iConfig.getParameter<
double>(
"muonEtaMax")),
40 ptCutE(iConfig.getParameter<
double>(
"elePtMin")),
41 etaCutE(iConfig.getParameter<
double>(
"eleEtaMax")),
42 photonPtCut(iConfig.getParameter<
double>(
"photonPtMin")),
43 drEtCut(iConfig.getParameter<
double>(
"deltaROverEt2Max")),
44 isoCut(iConfig.getParameter<
double>(
"isolation")),
46 produces<std::vector<pat::GenericParticle>>();
47 produces<edm::ValueMap<int>>(
"muFsrIndex");
48 produces<edm::ValueMap<int>>(
"eleFsrIndex");
53 ->setComment(
"packed pf candidates where to look for photons");
56 "electrons to check for footprint, the electron collection must have proper linking with the " 57 "packedCandidate collection");
59 ->setComment(
"collection of muons to match with FSR ");
61 ->setComment(
"collection of electrons to match with FSR ");
62 desc.add<
double>(
"muonPtMin", 3.)->setComment(
"minimum pt of the muon to look for a near photon");
63 desc.add<
double>(
"muonEtaMax", 2.4)->setComment(
"max eta of the muon to look for a near photon");
64 desc.add<
double>(
"elePtMin", 5.)->setComment(
"minimum pt of the electron to look for a near photon");
65 desc.add<
double>(
"eleEtaMax", 2.5)->setComment(
"max eta of the electron to look for a near photon");
66 desc.add<
double>(
"photonPtMin", 2.0)->setComment(
"minimum photon Pt");
67 desc.add<
double>(
"deltaROverEt2Max", 0.05)->setComment(
"max ratio of deltaR(lep,photon) over et2 of the photon");
68 desc.add<
double>(
"isolation", 2.0)->setComment(
"photon relative isolation cut");
79 const double& isoConeMax2,
80 const double& isoConeMin2)
const;
113 auto fsrPhotons = std::make_unique<std::vector<pat::GenericParticle>>();
115 std::vector<int> muPhotonIdxs(
muons->size(), -1);
116 std::vector<double> muPhotonDRET2(
muons->size(), 1e9);
118 std::vector<int> elePhotonIdxs(
electrons->size(), -1);
119 std::vector<double> elePhotonDRET2(
electrons->size(), 1e9);
136 double photon_relIso03 = 1e9;
137 bool skipPhoton =
false;
145 if (dR < dRMin && dR >
drSafe && dR < drEtCut * pc->
pt() * pc->pt()) {
148 if (photon_relIso03 >
isoCut) {
172 double dR =
deltaR(ele->eta(), ele->phi(), pc->eta(), pc->phi());
173 if (dR < dRMin && dR >
drSafe && dR < drEtCut * pc->
pt() * pc->pt()) {
175 if (photon_relIso03 > 1e8) {
178 if (photon_relIso03 >
isoCut) {
194 if (closestMu >= 0 || closestEle >= 0) {
196 double dRET2 =
dRMin / pc->pt() / pc->pt();
197 int iPhoton = fsrPhotons->size();
199 fsrPhotons->back().addUserFloat(
"relIso03", photon_relIso03);
200 fsrPhotons->back().addUserFloat(
"dROverEt2", dRET2);
202 if (closestMu >= 0) {
205 if (dRET2 < muPhotonDRET2[closestMu]) {
206 muPhotonDRET2[closestMu] = dRET2;
207 muPhotonIdxs[closestMu] = iPhoton;
209 }
else if (closestEle >= 0) {
212 if (dRET2 < elePhotonDRET2[closestEle]) {
213 elePhotonDRET2[closestEle] = dRET2;
214 elePhotonIdxs[closestEle] = iPhoton;
225 fillerBareIdx.
insert(
muons, muPhotonIdxs.begin(), muPhotonIdxs.end());
226 fillerBareIdx.
fill();
233 fillerBareIdx.
insert(
electrons, elePhotonIdxs.begin(), elePhotonIdxs.end());
234 fillerBareIdx.
fill();
241 const double& isoConeMax2,
242 const double& isoConeMin2)
const {
248 if (dRIsoCone2 > isoConeMax2 || dRIsoCone2 < isoConeMin2)
256 dRIsoCone2 > 0.01 * 0.01) {
261 return ptsum /
photon.pt();
266 bool skipPhoton =
false;
267 for (
auto electrons_iter = electronsForVeto->begin(); electrons_iter != electronsForVeto->end(); ++electrons_iter) {
268 for (
auto const&
cand : electrons_iter->associatedPackedPFCandidates()) {
269 if (!
cand.isAvailable())
271 if (
cand.id() != pfcandRef.
id())
273 <<
"The electron associatedPackedPFCandidates item does not have " 274 <<
"the same ID of packed candidate collection used for cleaning the electron footprint: " <<
cand.id()
275 <<
" (" << pfcandRef.
id() <<
")\n";
276 if (
cand.key() == pfcandRef.
key()) {
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
ProductID id() const
Accessor for product ID.
double computeRelativeIsolation(const pat::PackedCandidate &photon, const pat::PackedCandidateCollection &pfcands, const double &isoConeMax2, const double &isoConeMin2) const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
#define DEFINE_FWK_MODULE(type)
std::vector< pat::PackedCandidate > PackedCandidateCollection
void insert(const H &h, I begin, I end)
const edm::EDGetTokenT< pat::PackedCandidateCollection > pfcands_
bool electronFootprintVeto(pat::PackedCandidateRef &pfcandRef, edm::Handle< pat::ElectronCollection > electronsForVeto) const
key_type key() const
Accessor for product key.
Analysis-level Generic Particle class (e.g. for hadron or muon not fully reconstructed) ...
~LeptonFSRProducer() override=default
edm::Ref< pat::PackedCandidateCollection > PackedCandidateRef
Abs< T >::type abs(const T &t)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< edm::View< reco::Muon > > muons_
const edm::EDGetTokenT< pat::ElectronCollection > electronsForVeto_
LeptonFSRProducer(const edm::ParameterSet &iConfig)
const edm::EDGetTokenT< edm::View< reco::GsfElectron > > electrons_