CMS 3D CMS Logo

MuPFIsoHelper.cc
Go to the documentation of this file.
2 
3 MuPFIsoHelper::MuPFIsoHelper(const std::map<std::string, edm::ParameterSet>& labelMap, edm::ConsumesCollector&& iC)
4  : labelMap_(labelMap) {
6  for (std::map<std::string, edm::ParameterSet>::const_iterator i = labelMap_.begin(); i != labelMap_.end(); ++i) {
7  chargedParticle_.push_back(nullHandle);
8  chargedHadron_.push_back(nullHandle);
9  neutralHadron_.push_back(nullHandle);
10  neutralHadronHighThreshold_.push_back(nullHandle);
11  photon_.push_back(nullHandle);
12  photonHighThreshold_.push_back(nullHandle);
13  pu_.push_back(nullHandle);
14 
15  chargedParticleToken_.push_back(
16  iC.consumes<CandDoubleMap>(i->second.getParameter<edm::InputTag>("chargedParticle")));
17  chargedHadronToken_.push_back(iC.consumes<CandDoubleMap>(i->second.getParameter<edm::InputTag>("chargedHadron")));
18  neutralHadronToken_.push_back(iC.consumes<CandDoubleMap>(i->second.getParameter<edm::InputTag>("neutralHadron")));
20  iC.consumes<CandDoubleMap>(i->second.getParameter<edm::InputTag>("neutralHadronHighThreshold")));
21  photonToken_.push_back(iC.consumes<CandDoubleMap>(i->second.getParameter<edm::InputTag>("photon")));
22  photonHighThresholdToken_.push_back(
23  iC.consumes<CandDoubleMap>(i->second.getParameter<edm::InputTag>("photonHighThreshold")));
24  puToken_.push_back(iC.consumes<CandDoubleMap>(i->second.getParameter<edm::InputTag>("pu")));
25  }
26 }
27 
29 
39  if (chargedParticle.isValid())
40  iso.sumChargedParticlePt = (*chargedParticle)[muonRef];
41 
42  if (chargedHadron.isValid())
43  iso.sumChargedHadronPt = (*chargedHadron)[muonRef];
44 
45  if (neutralHadron.isValid())
46  iso.sumNeutralHadronEt = (*neutralHadron)[muonRef];
47 
48  if (neutralHadronHighThreshold.isValid())
49  iso.sumNeutralHadronEtHighThreshold = (*neutralHadronHighThreshold)[muonRef];
50 
51  if (photon.isValid())
52  iso.sumPhotonEt = (*photon)[muonRef];
53 
54  if (photonHighThreshold.isValid())
55  iso.sumPhotonEtHighThreshold = (*photonHighThreshold)[muonRef];
56 
57  if (pu.isValid())
58  iso.sumPUPt = (*pu)[muonRef];
59 
60  return iso;
61 }
62 
64  unsigned int count = 0;
65  for (std::map<std::string, edm::ParameterSet>::const_iterator i = labelMap_.begin(); i != labelMap_.end(); ++i) {
71  photon_[count],
73  pu_[count]);
74 
75  muon.setPFIsolation(i->first, iso);
76  count++;
77  }
78 
79  return 0;
80 }
81 
83  unsigned int count = 0;
84  for (std::map<std::string, edm::ParameterSet>::const_iterator i = labelMap_.begin(); i != labelMap_.end(); ++i) {
89  iEvent.getByToken(photonToken_[count], photon_[count]);
91  iEvent.getByToken(puToken_[count], pu_[count]);
92  count++;
93  }
94 }
std::vector< edm::EDGetTokenT< CandDoubleMap > > neutralHadronHighThresholdToken_
Definition: MuPFIsoHelper.h:59
std::vector< edm::EDGetTokenT< CandDoubleMap > > chargedHadronToken_
Definition: MuPFIsoHelper.h:57
std::vector< edm::Handle< CandDoubleMap > > chargedHadron_
Definition: MuPFIsoHelper.h:49
std::vector< edm::EDGetTokenT< CandDoubleMap > > photonHighThresholdToken_
Definition: MuPFIsoHelper.h:61
reco::MuonPFIsolation makeIsoDeposit(reco::MuonRef &, const edm::Handle< CandDoubleMap > &, const edm::Handle< CandDoubleMap > &, const edm::Handle< CandDoubleMap > &, const edm::Handle< CandDoubleMap > &, const edm::Handle< CandDoubleMap > &, const edm::Handle< CandDoubleMap > &, const edm::Handle< CandDoubleMap > &)
std::vector< edm::Handle< CandDoubleMap > > pu_
Definition: MuPFIsoHelper.h:54
std::vector< edm::EDGetTokenT< CandDoubleMap > > neutralHadronToken_
Definition: MuPFIsoHelper.h:58
std::vector< edm::Handle< CandDoubleMap > > neutralHadronHighThreshold_
Definition: MuPFIsoHelper.h:51
int iEvent
Definition: GenABIO.cc:224
std::map< std::string, edm::ParameterSet > labelMap_
Definition: MuPFIsoHelper.h:46
std::vector< edm::EDGetTokenT< CandDoubleMap > > chargedParticleToken_
Definition: MuPFIsoHelper.h:56
std::vector< edm::Handle< CandDoubleMap > > chargedParticle_
Definition: MuPFIsoHelper.h:48
std::vector< edm::Handle< CandDoubleMap > > photon_
Definition: MuPFIsoHelper.h:52
std::vector< edm::Handle< CandDoubleMap > > neutralHadron_
Definition: MuPFIsoHelper.h:50
int embedPFIsolation(reco::Muon &, reco::MuonRef &)
std::vector< edm::EDGetTokenT< CandDoubleMap > > puToken_
Definition: MuPFIsoHelper.h:62
std::vector< edm::Handle< CandDoubleMap > > photonHighThreshold_
Definition: MuPFIsoHelper.h:53
void beginEvent(const edm::Event &iEvent)
std::vector< edm::EDGetTokenT< CandDoubleMap > > photonToken_
Definition: MuPFIsoHelper.h:60
MuPFIsoHelper(const std::map< std::string, edm::ParameterSet > &, edm::ConsumesCollector &&)
Definition: MuPFIsoHelper.cc:3