CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
MuPFIsoHelper Class Reference

#include <MuPFIsoHelper.h>

Public Types

typedef edm::ValueMap< double > CandDoubleMap
 

Public Member Functions

void beginEvent (const edm::Event &iEvent)
 
int embedPFIsolation (reco::Muon &, reco::MuonRef &)
 
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 > &)
 
 MuPFIsoHelper (const std::map< std::string, edm::ParameterSet > &, edm::ConsumesCollector &&)
 
 ~MuPFIsoHelper ()
 

Private Attributes

std::vector< edm::Handle< CandDoubleMap > > chargedHadron_
 
std::vector< edm::EDGetTokenT< CandDoubleMap > > chargedHadronToken_
 
std::vector< edm::Handle< CandDoubleMap > > chargedParticle_
 
std::vector< edm::EDGetTokenT< CandDoubleMap > > chargedParticleToken_
 
std::map< std::string, edm::ParameterSetlabelMap_
 
std::vector< edm::Handle< CandDoubleMap > > neutralHadron_
 
std::vector< edm::Handle< CandDoubleMap > > neutralHadronHighThreshold_
 
std::vector< edm::EDGetTokenT< CandDoubleMap > > neutralHadronHighThresholdToken_
 
std::vector< edm::EDGetTokenT< CandDoubleMap > > neutralHadronToken_
 
std::vector< edm::Handle< CandDoubleMap > > photon_
 
std::vector< edm::Handle< CandDoubleMap > > photonHighThreshold_
 
std::vector< edm::EDGetTokenT< CandDoubleMap > > photonHighThresholdToken_
 
std::vector< edm::EDGetTokenT< CandDoubleMap > > photonToken_
 
std::vector< edm::Handle< CandDoubleMap > > pu_
 
std::vector< edm::EDGetTokenT< CandDoubleMap > > puToken_
 

Detailed Description

Definition at line 25 of file MuPFIsoHelper.h.

Member Typedef Documentation

◆ CandDoubleMap

Definition at line 27 of file MuPFIsoHelper.h.

Constructor & Destructor Documentation

◆ MuPFIsoHelper()

MuPFIsoHelper::MuPFIsoHelper ( const std::map< std::string, edm::ParameterSet > &  labelMap,
edm::ConsumesCollector &&  iC 
)

Definition at line 3 of file MuPFIsoHelper.cc.

References chargedHadron_, chargedHadronToken_, chargedParticle_, chargedParticleToken_, mps_fire::i, labelMap_, neutralHadron_, neutralHadronHighThreshold_, neutralHadronHighThresholdToken_, neutralHadronToken_, photon_, photonHighThreshold_, photonHighThresholdToken_, photonToken_, pu_, and puToken_.

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 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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
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
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
std::vector< edm::EDGetTokenT< CandDoubleMap > > puToken_
Definition: MuPFIsoHelper.h:62
edm::ValueMap< double > CandDoubleMap
Definition: MuPFIsoHelper.h:27
std::vector< edm::Handle< CandDoubleMap > > photonHighThreshold_
Definition: MuPFIsoHelper.h:53
std::vector< edm::EDGetTokenT< CandDoubleMap > > photonToken_
Definition: MuPFIsoHelper.h:60

◆ ~MuPFIsoHelper()

MuPFIsoHelper::~MuPFIsoHelper ( )

Definition at line 28 of file MuPFIsoHelper.cc.

28 {}

Member Function Documentation

◆ beginEvent()

void MuPFIsoHelper::beginEvent ( const edm::Event iEvent)

Definition at line 82 of file MuPFIsoHelper.cc.

References chargedHadron_, chargedHadronToken_, chargedParticle_, chargedParticleToken_, submitPVResolutionJobs::count, mps_fire::i, iEvent, labelMap_, neutralHadron_, neutralHadronHighThreshold_, neutralHadronHighThresholdToken_, neutralHadronToken_, photon_, photonHighThreshold_, photonHighThresholdToken_, photonToken_, pu_, and puToken_.

Referenced by MuPFIsoEmbedder::produce(), and MuonProducer::produce().

82  {
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
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
std::vector< edm::EDGetTokenT< CandDoubleMap > > puToken_
Definition: MuPFIsoHelper.h:62
std::vector< edm::Handle< CandDoubleMap > > photonHighThreshold_
Definition: MuPFIsoHelper.h:53
std::vector< edm::EDGetTokenT< CandDoubleMap > > photonToken_
Definition: MuPFIsoHelper.h:60

◆ embedPFIsolation()

int MuPFIsoHelper::embedPFIsolation ( reco::Muon muon,
reco::MuonRef muonRef 
)

Definition at line 63 of file MuPFIsoHelper.cc.

References chargedHadron_, chargedParticle_, submitPVResolutionJobs::count, mps_fire::i, genparticles_cff::iso, labelMap_, makeIsoDeposit(), neutralHadron_, neutralHadronHighThreshold_, photon_, photonHighThreshold_, and pu_.

Referenced by MuPFIsoEmbedder::produce(), and MuonProducer::produce().

63  {
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 }
std::vector< edm::Handle< CandDoubleMap > > chargedHadron_
Definition: MuPFIsoHelper.h:49
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::Handle< CandDoubleMap > > neutralHadronHighThreshold_
Definition: MuPFIsoHelper.h:51
std::map< std::string, edm::ParameterSet > labelMap_
Definition: MuPFIsoHelper.h:46
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
std::vector< edm::Handle< CandDoubleMap > > photonHighThreshold_
Definition: MuPFIsoHelper.h:53

◆ makeIsoDeposit()

reco::MuonPFIsolation MuPFIsoHelper::makeIsoDeposit ( reco::MuonRef muonRef,
const edm::Handle< CandDoubleMap > &  chargedParticle,
const edm::Handle< CandDoubleMap > &  chargedHadron,
const edm::Handle< CandDoubleMap > &  neutralHadron,
const edm::Handle< CandDoubleMap > &  neutralHadronHighThreshold,
const edm::Handle< CandDoubleMap > &  photon,
const edm::Handle< CandDoubleMap > &  photonHighThreshold,
const edm::Handle< CandDoubleMap > &  pu 
)

Definition at line 30 of file MuPFIsoHelper.cc.

References HPSPFTauProducerPuppi_cfi::chargedHadron, displacedMuons_cfi::chargedParticle, genparticles_cff::iso, displacedMuons_cfi::neutralHadron, displacedMuons_cfi::neutralHadronHighThreshold, displacedMuons_cfi::photon, displacedMuons_cfi::photonHighThreshold, and displacedMuons_cfi::pu.

Referenced by embedPFIsolation().

37  {
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 }

Member Data Documentation

◆ chargedHadron_

std::vector<edm::Handle<CandDoubleMap> > MuPFIsoHelper::chargedHadron_
private

Definition at line 49 of file MuPFIsoHelper.h.

Referenced by beginEvent(), embedPFIsolation(), and MuPFIsoHelper().

◆ chargedHadronToken_

std::vector<edm::EDGetTokenT<CandDoubleMap> > MuPFIsoHelper::chargedHadronToken_
private

Definition at line 57 of file MuPFIsoHelper.h.

Referenced by beginEvent(), and MuPFIsoHelper().

◆ chargedParticle_

std::vector<edm::Handle<CandDoubleMap> > MuPFIsoHelper::chargedParticle_
private

Definition at line 48 of file MuPFIsoHelper.h.

Referenced by beginEvent(), embedPFIsolation(), and MuPFIsoHelper().

◆ chargedParticleToken_

std::vector<edm::EDGetTokenT<CandDoubleMap> > MuPFIsoHelper::chargedParticleToken_
private

Definition at line 56 of file MuPFIsoHelper.h.

Referenced by beginEvent(), and MuPFIsoHelper().

◆ labelMap_

std::map<std::string, edm::ParameterSet> MuPFIsoHelper::labelMap_
private

Definition at line 46 of file MuPFIsoHelper.h.

Referenced by beginEvent(), embedPFIsolation(), and MuPFIsoHelper().

◆ neutralHadron_

std::vector<edm::Handle<CandDoubleMap> > MuPFIsoHelper::neutralHadron_
private

Definition at line 50 of file MuPFIsoHelper.h.

Referenced by beginEvent(), embedPFIsolation(), and MuPFIsoHelper().

◆ neutralHadronHighThreshold_

std::vector<edm::Handle<CandDoubleMap> > MuPFIsoHelper::neutralHadronHighThreshold_
private

Definition at line 51 of file MuPFIsoHelper.h.

Referenced by beginEvent(), embedPFIsolation(), and MuPFIsoHelper().

◆ neutralHadronHighThresholdToken_

std::vector<edm::EDGetTokenT<CandDoubleMap> > MuPFIsoHelper::neutralHadronHighThresholdToken_
private

Definition at line 59 of file MuPFIsoHelper.h.

Referenced by beginEvent(), and MuPFIsoHelper().

◆ neutralHadronToken_

std::vector<edm::EDGetTokenT<CandDoubleMap> > MuPFIsoHelper::neutralHadronToken_
private

Definition at line 58 of file MuPFIsoHelper.h.

Referenced by beginEvent(), and MuPFIsoHelper().

◆ photon_

std::vector<edm::Handle<CandDoubleMap> > MuPFIsoHelper::photon_
private

Definition at line 52 of file MuPFIsoHelper.h.

Referenced by beginEvent(), embedPFIsolation(), and MuPFIsoHelper().

◆ photonHighThreshold_

std::vector<edm::Handle<CandDoubleMap> > MuPFIsoHelper::photonHighThreshold_
private

Definition at line 53 of file MuPFIsoHelper.h.

Referenced by beginEvent(), embedPFIsolation(), and MuPFIsoHelper().

◆ photonHighThresholdToken_

std::vector<edm::EDGetTokenT<CandDoubleMap> > MuPFIsoHelper::photonHighThresholdToken_
private

Definition at line 61 of file MuPFIsoHelper.h.

Referenced by beginEvent(), and MuPFIsoHelper().

◆ photonToken_

std::vector<edm::EDGetTokenT<CandDoubleMap> > MuPFIsoHelper::photonToken_
private

Definition at line 60 of file MuPFIsoHelper.h.

Referenced by beginEvent(), and MuPFIsoHelper().

◆ pu_

std::vector<edm::Handle<CandDoubleMap> > MuPFIsoHelper::pu_
private

Definition at line 54 of file MuPFIsoHelper.h.

Referenced by beginEvent(), embedPFIsolation(), and MuPFIsoHelper().

◆ puToken_

std::vector<edm::EDGetTokenT<CandDoubleMap> > MuPFIsoHelper::puToken_
private

Definition at line 62 of file MuPFIsoHelper.h.

Referenced by beginEvent(), and MuPFIsoHelper().