CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuPFIsoHelper.cc
Go to the documentation of this file.
2 
3 
4 MuPFIsoHelper::MuPFIsoHelper(const std::map<std::string,edm::ParameterSet>& labelMap, edm::ConsumesCollector&& iC):
5  labelMap_(labelMap)
6 {
8  for(std::map<std::string,edm::ParameterSet>::const_iterator i = labelMap_.begin();i!=labelMap_.end();++i) {
9  chargedParticle_.push_back(nullHandle);
10  chargedHadron_.push_back(nullHandle);
11  neutralHadron_.push_back(nullHandle);
12  neutralHadronHighThreshold_.push_back(nullHandle);
13  photon_.push_back(nullHandle);
14  photonHighThreshold_.push_back(nullHandle);
15  pu_.push_back(nullHandle);
16 
17  chargedParticleToken_.push_back(iC.consumes<CandDoubleMap>(i->second.getParameter<edm::InputTag>("chargedParticle")));
18  chargedHadronToken_.push_back(iC.consumes<CandDoubleMap>(i->second.getParameter<edm::InputTag>("chargedHadron")));
19  neutralHadronToken_.push_back(iC.consumes<CandDoubleMap>(i->second.getParameter<edm::InputTag>("neutralHadron")));
20  neutralHadronHighThresholdToken_.push_back(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(iC.consumes<CandDoubleMap>(i->second.getParameter<edm::InputTag>("photonHighThreshold")));
23  puToken_.push_back(iC.consumes<CandDoubleMap>(i->second.getParameter<edm::InputTag>("pu")));
24  }
25 
26 
27 
28 
29 }
30 
31 
32 
34 
35 }
36 
37 
39  const edm::Handle<CandDoubleMap>& chargedParticle,
40  const edm::Handle<CandDoubleMap>& chargedHadron,
41  const edm::Handle<CandDoubleMap>& neutralHadron,
42  const edm::Handle<CandDoubleMap>& neutralHadronHighThreshold,
43  const edm::Handle<CandDoubleMap>& photon,
44  const edm::Handle<CandDoubleMap>& photonHighThreshold,
45  const edm::Handle<CandDoubleMap>& pu) {
46 
48  if(chargedParticle.isValid())
49  iso.sumChargedParticlePt = (*chargedParticle)[muonRef];
50 
51  if(chargedHadron.isValid())
52  iso.sumChargedHadronPt = (*chargedHadron)[muonRef];
53 
54  if(neutralHadron.isValid())
55  iso.sumNeutralHadronEt = (*neutralHadron)[muonRef];
56 
57  if(neutralHadronHighThreshold.isValid())
58  iso.sumNeutralHadronEtHighThreshold = (*neutralHadronHighThreshold)[muonRef];
59 
60  if(photon.isValid())
61  iso.sumPhotonEt = (*photon)[muonRef];
62 
63  if(photonHighThreshold.isValid())
64  iso.sumPhotonEtHighThreshold = (*photonHighThreshold)[muonRef];
65 
66  if(pu.isValid())
67  iso.sumPUPt = (*pu)[muonRef];
68 
69  return iso;
70 }
71 
72 
74 
75  unsigned int count=0;
76  for(std::map<std::string,edm::ParameterSet>::const_iterator i = labelMap_.begin();i!=labelMap_.end();++i) {
78  chargedParticle_[count],
79  chargedHadron_[count],
80  neutralHadron_[count],
82  photon_[count],
83  photonHighThreshold_[count],
84  pu_[count]);
85 
86  muon.setPFIsolation(i->first,iso);
87  count++;
88  }
89 
90 
91  return 0;
92 }
93 
94 
95 
97 
98  unsigned int count=0;
99  for(std::map<std::string,edm::ParameterSet>::const_iterator i = labelMap_.begin();i!=labelMap_.end();++i) {
100  iEvent.getByToken(chargedParticleToken_[count],chargedParticle_[count]);
101  iEvent.getByToken(chargedHadronToken_[count],chargedHadron_[count]);
102  iEvent.getByToken(neutralHadronToken_[count],neutralHadron_[count]);
104  iEvent.getByToken(photonToken_[count],photon_[count]);
106  iEvent.getByToken(puToken_[count],pu_[count]);
107  count++;
108  }
109 
110 }
int i
Definition: DBlmapReader.cc:9
std::vector< edm::EDGetTokenT< CandDoubleMap > > neutralHadronHighThresholdToken_
Definition: MuPFIsoHelper.h:66
std::vector< edm::EDGetTokenT< CandDoubleMap > > chargedHadronToken_
Definition: MuPFIsoHelper.h:64
std::vector< edm::Handle< CandDoubleMap > > chargedHadron_
Definition: MuPFIsoHelper.h:56
float sumNeutralHadronEtHighThreshold
sum pt of neutral hadrons with a higher threshold
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
std::vector< edm::EDGetTokenT< CandDoubleMap > > photonHighThresholdToken_
Definition: MuPFIsoHelper.h:68
float sumPhotonEt
sum pt of PF photons
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:61
std::vector< edm::EDGetTokenT< CandDoubleMap > > neutralHadronToken_
Definition: MuPFIsoHelper.h:65
float sumNeutralHadronEt
sum pt of neutral hadrons
float sumChargedParticlePt
sum-pt of charged Particles(inludes e/mu)
std::vector< edm::Handle< CandDoubleMap > > neutralHadronHighThreshold_
Definition: MuPFIsoHelper.h:58
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
int iEvent
Definition: GenABIO.cc:230
void setPFIsolation(const std::string &label, const reco::MuonPFIsolation &deposit)
std::vector< edm::EDGetTokenT< CandDoubleMap > > chargedParticleToken_
Definition: MuPFIsoHelper.h:63
bool isValid() const
Definition: HandleBase.h:75
std::vector< edm::Handle< CandDoubleMap > > chargedParticle_
Definition: MuPFIsoHelper.h:55
std::vector< edm::Handle< CandDoubleMap > > photon_
Definition: MuPFIsoHelper.h:59
std::vector< edm::Handle< CandDoubleMap > > neutralHadron_
Definition: MuPFIsoHelper.h:57
int embedPFIsolation(reco::Muon &, reco::MuonRef &)
std::vector< edm::EDGetTokenT< CandDoubleMap > > puToken_
Definition: MuPFIsoHelper.h:69
std::vector< edm::Handle< CandDoubleMap > > photonHighThreshold_
Definition: MuPFIsoHelper.h:60
void beginEvent(const edm::Event &iEvent)
std::map< std::string, edm::ParameterSet > labelMap_
Definition: MuPFIsoHelper.h:53
float sumPhotonEtHighThreshold
sum pt of PF photons with a higher threshold
std::vector< edm::EDGetTokenT< CandDoubleMap > > photonToken_
Definition: MuPFIsoHelper.h:67
MuPFIsoHelper(const std::map< std::string, edm::ParameterSet > &, edm::ConsumesCollector &&)
Definition: MuPFIsoHelper.cc:4
float sumChargedHadronPt
sum-pt of charged Hadron