CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
PatElectronEAIsoCorrectionProducer Class Reference
Inheritance diagram for PatElectronEAIsoCorrectionProducer:
edm::stream::EDProducer<>

Public Member Functions

 PatElectronEAIsoCorrectionProducer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~PatElectronEAIsoCorrectionProducer () 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
 

Private Attributes

edm::EDGetTokenT
< edm::ValueMap< double > > 
eaIsolatorToken_
 
edm::EDGetTokenT
< pat::ElectronCollection
patElectronsToken_
 

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

Definition at line 9 of file PatElectronEAIsoCorrectionProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 20 of file PatElectronEAIsoCorrectionProducer.cc.

21  : patElectronsToken_(consumes<pat::ElectronCollection>(iConfig.getParameter<edm::InputTag>("patElectrons"))),
22  eaIsolatorToken_(consumes<edm::ValueMap<double> >(iConfig.getParameter<edm::InputTag>("eaIsolator"))) {
23  produces<pat::ElectronCollection>();
24 }
edm::EDGetTokenT< pat::ElectronCollection > patElectronsToken_
edm::EDGetTokenT< edm::ValueMap< double > > eaIsolatorToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PatElectronEAIsoCorrectionProducer::~PatElectronEAIsoCorrectionProducer ( )
inlineoverride

Definition at line 12 of file PatElectronEAIsoCorrectionProducer.cc.

12 {};

Member Function Documentation

void PatElectronEAIsoCorrectionProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 26 of file PatElectronEAIsoCorrectionProducer.cc.

References eaIsolatorToken_, edm::Event::getByToken(), eostools::move(), electronProducer_cfi::patElectrons, patElectronsToken_, edm::Event::put(), pat::Lepton< LeptonType >::setIsolation(), and pat::User1Iso.

26  {
28  iEvent.getByToken(patElectronsToken_, patElectrons);
30  iEvent.getByToken(eaIsolatorToken_, eaIsolator);
31 
32  std::unique_ptr<pat::ElectronCollection> updatedPatElectrons(new pat::ElectronCollection);
33 
34  for (size_t iElectron = 0; iElectron < patElectrons->size(); ++iElectron) {
35  pat::Electron* updatedPatElectron = patElectrons->at(iElectron).clone();
36  pat::ElectronRef electronRef(patElectrons, iElectron);
37  updatedPatElectron->setIsolation(pat::User1Iso, (*eaIsolator)[electronRef]); // FIXME: hard-coded isolation key
38  updatedPatElectrons->push_back(*updatedPatElectron);
39  }
40 
41  iEvent.put(std::move(updatedPatElectrons));
42 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
void setIsolation(IsolationKeys key, float value)
Definition: Lepton.h:115
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< pat::ElectronCollection > patElectronsToken_
std::vector< Electron > ElectronCollection
Definition: Electron.h:36
edm::EDGetTokenT< edm::ValueMap< double > > eaIsolatorToken_
def move
Definition: eostools.py:511
Analysis-level electron class.
Definition: Electron.h:51

Member Data Documentation

edm::EDGetTokenT<edm::ValueMap<double> > PatElectronEAIsoCorrectionProducer::eaIsolatorToken_
private

Definition at line 17 of file PatElectronEAIsoCorrectionProducer.cc.

Referenced by produce().

edm::EDGetTokenT<pat::ElectronCollection> PatElectronEAIsoCorrectionProducer::patElectronsToken_
private

Definition at line 16 of file PatElectronEAIsoCorrectionProducer.cc.

Referenced by produce().