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>>();
92 for (
auto muon = muons->begin();
muon != muons->end(); ++
muon) {
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 (
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();
T getParameter(std::string const &) const
void setComment(std::string const &value)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
~MuonFSRProducer() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< pat::PackedCandidate > PackedCandidateCollection
const edm::EDGetTokenT< pat::PackedCandidateCollection > pfcands_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
key_type key() const
Accessor for product key.
ProductID id() const
Accessor for product ID.
Analysis-level Generic Particle class (e.g. for hadron or muon not fully reconstructed) ...
#define DEFINE_FWK_MODULE(type)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
edm::Ref< pat::PackedCandidateCollection > PackedCandidateRef
Abs< T >::type abs(const T &t)
MuonFSRProducer(const edm::ParameterSet &iConfig)
double pt() const override
transverse momentum
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetTokenT< edm::View< reco::Muon > > muons_
double eta() const override
momentum pseudorapidity
double phi() const override
momentum azimuthal angle
double computeRelativeIsolation(const pat::PackedCandidate &photon, const pat::PackedCandidateCollection &pfcands, const double &isoConeMax, const double &isoConeMin) const
const edm::EDGetTokenT< pat::ElectronCollection > electrons_