CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
MuonFSRProducer Class Reference
Inheritance diagram for MuonFSRProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MuonFSRProducer (const edm::ParameterSet &iConfig)
 
 ~MuonFSRProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

double computeRelativeIsolation (const pat::PackedCandidate &photon, const pat::PackedCandidateCollection &pfcands, const double &isoConeMax, const double &isoConeMin) const
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

float drEtCut
 
const edm::EDGetTokenT< pat::ElectronCollectionelectrons_
 
float etaCut
 
float isoCut
 
const edm::EDGetTokenT< edm::View< reco::Muon > > muons_
 
const edm::EDGetTokenT< pat::PackedCandidateCollectionpfcands_
 
float photonPtCut
 
float ptCut
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 26 of file MuonFSRProducer.cc.

Constructor & Destructor Documentation

◆ MuonFSRProducer()

MuonFSRProducer::MuonFSRProducer ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 28 of file MuonFSRProducer.cc.

29  :
30 
31  pfcands_{consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("packedPFCandidates"))},
32  electrons_{consumes<pat::ElectronCollection>(iConfig.getParameter<edm::InputTag>("slimmedElectrons"))},
33  muons_{consumes<edm::View<reco::Muon>>(iConfig.getParameter<edm::InputTag>("muons"))},
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>>();
40  }

References edm::ParameterSet::getParameter().

◆ ~MuonFSRProducer()

MuonFSRProducer::~MuonFSRProducer ( )
inlineoverride

Definition at line 59 of file MuonFSRProducer.cc.

59 {}

Member Function Documentation

◆ computeRelativeIsolation()

double MuonFSRProducer::computeRelativeIsolation ( const pat::PackedCandidate photon,
const pat::PackedCandidateCollection pfcands,
const double &  isoConeMax,
const double &  isoConeMin 
) const
private

Definition at line 188 of file MuonFSRProducer.cc.

191  {
192  double ptsum = 0;
193 
194  for (const auto& pfcand : pfcands) {
195  // Isolation cone requirement
196  double dRIsoCone = deltaR(photon.eta(), photon.phi(), pfcand.eta(), pfcand.phi());
197  if (dRIsoCone > isoConeMax)
198  continue;
199  if (dRIsoCone < isoConeMin)
200  continue;
201 
202  if (pfcand.charge() != 0 && abs(pfcand.pdgId()) == 211 && pfcand.pt() > 0.2) {
203  if (dRIsoCone > 0.0001)
204  ptsum += pfcand.pt();
205  } else if (pfcand.charge() == 0 && (abs(pfcand.pdgId()) == 22 || abs(pfcand.pdgId()) == 130) && pfcand.pt() > 0.5) {
206  if (dRIsoCone > 0.01)
207  ptsum += pfcand.pt();
208  }
209  }
210 
211  return ptsum / photon.pt();
212 }

References funct::abs(), PbPb_ZMuSkimMuonDPG_cff::deltaR, pfDeepBoostedJetPreprocessParams_cfi::pfcand, and muons2muons_cfi::photon.

Referenced by produce().

◆ fillDescriptions()

static void MuonFSRProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 41 of file MuonFSRProducer.cc.

41  {
43  desc.add<edm::InputTag>("packedPFCandidates", edm::InputTag("packedPFCandidates"))
44  ->setComment("packed pf candidates where to look for photons");
45  desc.add<edm::InputTag>("slimmedElectrons", edm::InputTag("slimmedElectrons"))
46  ->setComment(
47  "electrons to check for footprint, the electron collection must have proper linking with the "
48  "packedCandidate collection");
49  desc.add<edm::InputTag>("muons", edm::InputTag("slimmedMuons"))
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");
56 
57  descriptions.addWithDefaultLabel(desc);
58  }

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

◆ produce()

void MuonFSRProducer::produce ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 80 of file MuonFSRProducer.cc.

80  {
81  using namespace std;
82 
84  iEvent.getByToken(pfcands_, pfcands);
86  iEvent.getByToken(muons_, muons);
88  iEvent.getByToken(electrons_, electrons);
89 
90  auto fsrPhotons = std::make_unique<std::vector<pat::GenericParticle>>();
91  // loop over all muons
92  for (auto muon = muons->begin(); muon != muons->end(); ++muon) {
93  int photonPosition = -1;
94  double distance_metric_min = -1;
95  // minimum muon pT
96  if (muon->pt() < ptCut)
97  continue;
98  // maximum muon eta
99  if (abs(muon->eta()) > etaCut)
100  continue;
101 
102  // for each muon, loop over all pf cadidates
103  for (auto iter_pf = pfcands->begin(); iter_pf != pfcands->end(); iter_pf++) {
104  auto const& pc = *iter_pf;
105 
106  // consider only photons
107  if (abs(pc.pdgId()) != 22)
108  continue;
109  // minimum pT cut
110  if (pc.pt() < photonPtCut)
111  continue;
112 
113  // eta requirements
114  if (abs(pc.eta()) > 1.4 and (abs(pc.eta()) < 1.6))
115  continue;
116  if (abs(pc.eta()) > 2.5)
117  continue;
118 
119  // 0.0001 < DeltaR(photon,muon) < 0.5 requirement
120  double dRPhoMu = deltaR(muon->eta(), muon->phi(), pc.eta(), pc.phi());
121  if (dRPhoMu < 0.0001)
122  continue;
123  if (dRPhoMu > 0.5)
124  continue;
125 
126  bool skipPhoton = false;
127  bool closest = true;
128 
129  for (auto othermuon = muons->begin(); othermuon != muons->end(); ++othermuon) {
130  if (othermuon->pt() < ptCut or abs(othermuon->eta()) > etaCut or muon == othermuon)
131  continue;
132  double dRPhoMuOther = deltaR(othermuon->eta(), othermuon->phi(), pc.eta(), pc.phi());
133  if (dRPhoMuOther < dRPhoMu) {
134  closest = false;
135  break;
136  }
137  }
138  if (!closest)
139  continue;
140 
141  // Check that is not in footprint of an electron
142  pat::PackedCandidateRef pfcandRef = pat::PackedCandidateRef(pfcands, iter_pf - pfcands->begin());
143 
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())
147  continue;
148  if (cand.id() != pfcandRef.id())
149  throw cms::Exception("Configuration")
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()) {
154  skipPhoton = true;
155  break;
156  }
157  }
158  if (skipPhoton)
159  break;
160  }
161 
162  if (skipPhoton)
163  continue;
164 
165  // use only isolated photons (very loose prelection can be tightened on analysis level)
166  float photon_relIso03 = computeRelativeIsolation(pc, *pfcands, 0.3, 0.0001);
167  if (photon_relIso03 > isoCut)
168  continue;
169  double metric = deltaR(muon->eta(), muon->phi(), pc.eta(), pc.phi()) / (pc.pt() * pc.pt());
170  if (metric > drEtCut)
171  continue;
172  fsrPhotons->push_back(pat::GenericParticle(pc));
173  fsrPhotons->back().addUserFloat("relIso03", photon_relIso03); // isolation, no CHS
174  fsrPhotons->back().addUserCand("associatedMuon", reco::CandidatePtr(muons, muon - muons->begin()));
175  fsrPhotons->back().addUserFloat("dROverEt2", metric); // dR/et2 to the closest muon
176 
177  // FSR photon defined as the one with minimum value of DeltaR/Et^2
178  if (photonPosition == -1 or metric < distance_metric_min) {
179  distance_metric_min = metric;
180  photonPosition = fsrPhotons->size() - 1;
181  }
182  }
183  }
184 
186 }

References funct::abs(), computeRelativeIsolation(), PbPb_ZMuSkimMuonDPG_cff::deltaR, drEtCut, pwdgSkimBPark_cfi::electrons, electrons_, etaCut, edm::Ref< C, T, F >::id(), iEvent, isoCut, edm::Ref< C, T, F >::key(), eostools::move(), HLT_FULL_cff::muon, PDWG_BPHSkim_cff::muons, muons_, or, pfcands_, photonPtCut, and ptCut.

Member Data Documentation

◆ drEtCut

float MuonFSRProducer::drEtCut
private

Definition at line 76 of file MuonFSRProducer.cc.

Referenced by produce().

◆ electrons_

const edm::EDGetTokenT<pat::ElectronCollection> MuonFSRProducer::electrons_
private

Definition at line 71 of file MuonFSRProducer.cc.

Referenced by produce().

◆ etaCut

float MuonFSRProducer::etaCut
private

Definition at line 74 of file MuonFSRProducer.cc.

Referenced by produce().

◆ isoCut

float MuonFSRProducer::isoCut
private

Definition at line 77 of file MuonFSRProducer.cc.

Referenced by produce().

◆ muons_

const edm::EDGetTokenT<edm::View<reco::Muon> > MuonFSRProducer::muons_
private

Definition at line 72 of file MuonFSRProducer.cc.

Referenced by produce().

◆ pfcands_

const edm::EDGetTokenT<pat::PackedCandidateCollection> MuonFSRProducer::pfcands_
private

Definition at line 70 of file MuonFSRProducer.cc.

Referenced by produce().

◆ photonPtCut

float MuonFSRProducer::photonPtCut
private

Definition at line 75 of file MuonFSRProducer.cc.

Referenced by produce().

◆ ptCut

float MuonFSRProducer::ptCut
private

Definition at line 73 of file MuonFSRProducer.cc.

Referenced by produce().

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
muons2muons_cfi.photon
photon
Definition: muons2muons_cfi.py:28
muon
Definition: MuonCocktails.h:17
MuonFSRProducer::isoCut
float isoCut
Definition: MuonFSRProducer.cc:77
MuonFSRProducer::drEtCut
float drEtCut
Definition: MuonFSRProducer.cc:76
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
MuonFSRProducer::etaCut
float etaCut
Definition: MuonFSRProducer.cc:74
edm::Handle< pat::PackedCandidateCollection >
edm::Ref< pat::PackedCandidateCollection >
pfDeepBoostedJetPreprocessParams_cfi.pfcand
pfcand
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:8
MuonFSRProducer::muons_
const edm::EDGetTokenT< edm::View< reco::Muon > > muons_
Definition: MuonFSRProducer.cc:72
MuonFSRProducer::computeRelativeIsolation
double computeRelativeIsolation(const pat::PackedCandidate &photon, const pat::PackedCandidateCollection &pfcands, const double &isoConeMax, const double &isoConeMin) const
Definition: MuonFSRProducer.cc:188
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11710
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
pat::GenericParticle
Analysis-level Generic Particle class (e.g. for hadron or muon not fully reconstructed)
Definition: GenericParticle.h:38
cand
Definition: decayParser.h:32
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::Ptr< Candidate >
MuonFSRProducer::pfcands_
const edm::EDGetTokenT< pat::PackedCandidateCollection > pfcands_
Definition: MuonFSRProducer.cc:70
MuonFSRProducer::photonPtCut
float photonPtCut
Definition: MuonFSRProducer.cc:75
edm::Ref::id
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::OrphanHandle
Definition: EDProductfwd.h:39
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
or
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
Definition: Activities.doc:12
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
cms::Exception
Definition: Exception.h:70
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MuonFSRProducer::ptCut
float ptCut
Definition: MuonFSRProducer.cc:73
MuonFSRProducer::electrons_
const edm::EDGetTokenT< pat::ElectronCollection > electrons_
Definition: MuonFSRProducer.cc:71
edm::InputTag
Definition: InputTag.h:15
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87
pat::PackedCandidateRef
edm::Ref< pat::PackedCandidateCollection > PackedCandidateRef
Definition: PackedCandidate.h:1131