CMS 3D CMS Logo

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::ElectronCollectionpatElectronsToken_
 

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::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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< pat::ElectronCollection > patElectronsToken_
edm::EDGetTokenT< edm::ValueMap< double > > eaIsolatorToken_

◆ ~PatElectronEAIsoCorrectionProducer()

PatElectronEAIsoCorrectionProducer::~PatElectronEAIsoCorrectionProducer ( )
inlineoverride

Definition at line 12 of file PatElectronEAIsoCorrectionProducer.cc.

12 {};

Member Function Documentation

◆ produce()

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

Definition at line 26 of file PatElectronEAIsoCorrectionProducer.cc.

References patElectronEAIsoCorrectionProducer_cfi::eaIsolator, eaIsolatorToken_, iEvent, eostools::move(), patElectronEAIsoCorrectionProducer_cfi::patElectrons, patElectronsToken_, pat::Lepton< LeptonType >::setIsolation(), and pat::User1Iso.

26  {
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 }
void setIsolation(IsolationKeys key, float value)
Definition: Lepton.h:115
edm::EDGetTokenT< pat::ElectronCollection > patElectronsToken_
int iEvent
Definition: GenABIO.cc:224
std::vector< Electron > ElectronCollection
Definition: Electron.h:36
edm::EDGetTokenT< edm::ValueMap< double > > eaIsolatorToken_
Analysis-level electron class.
Definition: Electron.h:51
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ eaIsolatorToken_

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

Definition at line 17 of file PatElectronEAIsoCorrectionProducer.cc.

Referenced by produce().

◆ patElectronsToken_

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

Definition at line 16 of file PatElectronEAIsoCorrectionProducer.cc.

Referenced by produce().