CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
MuPFIsoEmbedder Class Reference

#include <RecoMuon/MuPFIsoEmbedder/src/MuPFIsoEmbedder.cc>

Inheritance diagram for MuPFIsoEmbedder:
edm::stream::EDProducer<>

Public Member Functions

 MuPFIsoEmbedder (const edm::ParameterSet &)
 
 ~MuPFIsoEmbedder () override
 
- Public Member Functions inherited from edm::stream::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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

MuPFIsoHelperhelper_
 
edm::InputTag muons_
 
edm::EDGetTokenT< reco::MuonCollectionmuonToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 39 of file MuPFIsoEmbedder.cc.

Constructor & Destructor Documentation

◆ MuPFIsoEmbedder()

MuPFIsoEmbedder::MuPFIsoEmbedder ( const edm::ParameterSet iConfig)
explicit

Definition at line 56 of file MuPFIsoEmbedder.cc.

References edm::ParameterSet::getParameter(), helper_, label, muons_, and muonToken_.

57  : muons_(iConfig.getParameter<edm::InputTag>("src")) {
58  //decide what to read
59  //Define a map between the isolation and the PSet for the PFHelper
60  std::map<std::string, edm::ParameterSet> psetMap;
61 
62  //First declare what isolation you are going to read
63  std::vector<std::string> isolationLabels;
64  isolationLabels.push_back("pfIsolationR03");
65  isolationLabels.push_back("pfIsoMeanDRProfileR03");
66  isolationLabels.push_back("pfIsoSumDRProfileR03");
67  isolationLabels.push_back("pfIsolationR04");
68  isolationLabels.push_back("pfIsoMeanDRProfileR04");
69  isolationLabels.push_back("pfIsoSumDRProfileR04");
70 
71  //Fill the label,pet map and initialize MuPFIsoHelper
72  for (std::vector<std::string>::const_iterator label = isolationLabels.begin(); label != isolationLabels.end();
73  ++label)
74  psetMap[*label] = iConfig.getParameter<edm::ParameterSet>(*label);
75  helper_ = new MuPFIsoHelper(psetMap, consumesCollector());
76  muonToken_ = consumes<reco::MuonCollection>(muons_);
77  produces<reco::MuonCollection>();
78 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< reco::MuonCollection > muonToken_
char const * label
MuPFIsoHelper * helper_
edm::InputTag muons_

◆ ~MuPFIsoEmbedder()

MuPFIsoEmbedder::~MuPFIsoEmbedder ( )
override

Definition at line 80 of file MuPFIsoEmbedder.cc.

References helper_.

80  {
81  // do anything here that needs to be done at desctruction time
82  // (e.g. close files, deallocate resources etc.)
83  delete helper_;
84 }
MuPFIsoHelper * helper_

Member Function Documentation

◆ fillDescriptions()

void MuPFIsoEmbedder::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 113 of file MuPFIsoEmbedder.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

113  {
114  //The following says we do not know what parameters are allowed so do no validation
115  // Please change this to state exactly what you do use, even if it is no parameters
117  desc.setUnknown();
118  descriptions.addDefault(desc);
119 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ produce()

void MuPFIsoEmbedder::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 91 of file MuPFIsoEmbedder.cc.

References MuPFIsoHelper::beginEvent(), MuPFIsoHelper::embedPFIsolation(), helper_, mps_fire::i, iEvent, eostools::move(), PDWG_BPHSkim_cff::muons, muonToken_, and MillePedeFileConverter_cfg::out.

91  {
92  using namespace edm;
93  using namespace reco;
94 
96 
98  iEvent.getByToken(muonToken_, muons);
99 
100  auto out = std::make_unique<MuonCollection>();
101 
102  for (unsigned int i = 0; i < muons->size(); ++i) {
103  MuonRef muonRef(muons, i);
104  Muon muon = muons->at(i);
105  helper_->embedPFIsolation(muon, muonRef);
106  out->push_back(muon);
107  }
108 
109  iEvent.put(std::move(out));
110 }
edm::EDGetTokenT< reco::MuonCollection > muonToken_
int iEvent
Definition: GenABIO.cc:224
Definition: Muon.py:1
MuPFIsoHelper * helper_
int embedPFIsolation(reco::Muon &, reco::MuonRef &)
void beginEvent(const edm::Event &iEvent)
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ helper_

MuPFIsoHelper* MuPFIsoEmbedder::helper_
private

Definition at line 52 of file MuPFIsoEmbedder.cc.

Referenced by MuPFIsoEmbedder(), produce(), and ~MuPFIsoEmbedder().

◆ muons_

edm::InputTag MuPFIsoEmbedder::muons_
private

Definition at line 50 of file MuPFIsoEmbedder.cc.

Referenced by MuPFIsoEmbedder().

◆ muonToken_

edm::EDGetTokenT<reco::MuonCollection> MuPFIsoEmbedder::muonToken_
private

Definition at line 51 of file MuPFIsoEmbedder.cc.

Referenced by MuPFIsoEmbedder(), and produce().