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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MuPFIsoEmbedder (const edm::ParameterSet &)
 
 ~MuPFIsoEmbedder ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

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

Private Member Functions

virtual 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::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 40 of file MuPFIsoEmbedder.cc.

Constructor & Destructor Documentation

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

Definition at line 62 of file MuPFIsoEmbedder.cc.

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

62  :
63  muons_(iConfig.getParameter<edm::InputTag>("src"))
64 {
65 
66  //decide what to read
67  //Define a map between the isolation and the PSet for the PFHelper
68  std::map<std::string,edm::ParameterSet> psetMap;
69 
70  //First declare what isolation you are going to read
71  std::vector<std::string> isolationLabels;
72  isolationLabels.push_back("pfIsolationR03");
73  isolationLabels.push_back("pfIsoMeanDRProfileR03");
74  isolationLabels.push_back("pfIsoSumDRProfileR03");
75  isolationLabels.push_back("pfIsolationR04");
76  isolationLabels.push_back("pfIsoMeanDRProfileR04");
77  isolationLabels.push_back("pfIsoSumDRProfileR04");
78 
79  //Fill the label,pet map and initialize MuPFIsoHelper
80  for( std::vector<std::string>::const_iterator label = isolationLabels.begin();label != isolationLabels.end();++label)
81  psetMap[*label] =iConfig.getParameter<edm::ParameterSet >(*label);
82  helper_ = new MuPFIsoHelper(psetMap,consumesCollector());
83  muonToken_ = consumes<reco::MuonCollection>(muons_);
84  produces<reco::MuonCollection>();
85 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::MuonCollection > muonToken_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
MuPFIsoHelper * helper_
edm::InputTag muons_
MuPFIsoEmbedder::~MuPFIsoEmbedder ( )

Definition at line 88 of file MuPFIsoEmbedder.cc.

89 {
90 
91  // do anything here that needs to be done at desctruction time
92  // (e.g. close files, deallocate resources etc.)
93 
94 }

Member Function Documentation

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

Definition at line 129 of file MuPFIsoEmbedder.cc.

References edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and edm::ParameterSetDescription::setUnknown().

129  {
130  //The following says we do not know what parameters are allowed so do no validation
131  // Please change this to state exactly what you do use, even if it is no parameters
133  desc.setUnknown();
134  descriptions.addDefault(desc);
135 }
void addDefault(ParameterSetDescription const &psetDescription)
void MuPFIsoEmbedder::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Definition at line 103 of file MuPFIsoEmbedder.cc.

References MuPFIsoHelper::beginEvent(), MuPFIsoHelper::embedPFIsolation(), edm::Event::getByToken(), helper_, mps_fire::i, eostools::move(), electronCleaner_cfi::muons, muonToken_, MillePedeFileConverter_cfg::out, and edm::Event::put().

104 {
105  using namespace edm;
106  using namespace reco;
107 
108 
109  helper_->beginEvent(iEvent);
110 
112  iEvent.getByToken(muonToken_,muons);
113 
114 
115  auto out = std::make_unique<MuonCollection>();
116 
117  for(unsigned int i=0;i<muons->size();++i) {
118  MuonRef muonRef(muons,i);
119  Muon muon = muons->at(i);
120  helper_->embedPFIsolation(muon,muonRef);
121  out->push_back(muon);
122  }
123 
124  iEvent.put(std::move(out));
125 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::EDGetTokenT< reco::MuonCollection > muonToken_
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:510

Member Data Documentation

MuPFIsoHelper* MuPFIsoEmbedder::helper_
private

Definition at line 54 of file MuPFIsoEmbedder.cc.

Referenced by MuPFIsoEmbedder(), and produce().

edm::InputTag MuPFIsoEmbedder::muons_
private

Definition at line 52 of file MuPFIsoEmbedder.cc.

Referenced by MuPFIsoEmbedder().

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

Definition at line 53 of file MuPFIsoEmbedder.cc.

Referenced by MuPFIsoEmbedder(), and produce().