CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
ElectronIsolatorFromEffectiveArea Class Reference
Inheritance diagram for ElectronIsolatorFromEffectiveArea:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef edm::ValueMap< double > CandDoubleMap
 
typedef ElectronEffectiveArea EEA
 
- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 ElectronIsolatorFromEffectiveArea (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- 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
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 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)
 

Private Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)
 

Static Private Member Functions

static std::map< std::string, EEA::ElectronEffectiveAreaTargetEEA_target ()
 
static std::map< std::string, EEA::ElectronEffectiveAreaTypeEEA_type ()
 

Private Attributes

edm::InputTag gsfElectronTag
 
edm::EDGetTokenT< reco::GsfElectronCollectiongsfElectronToken
 
const EEA::ElectronEffectiveAreaType modeEEA
 
edm::InputTag patElectronTag
 
edm::EDGetTokenT< pat::ElectronCollectionpatElectronToken
 
edm::InputTag pfElectronTag
 
edm::EDGetTokenT< reco::PFCandidateCollectionpfElectronToken
 
edm::EDGetTokenT< double > rhoIsoToken
 
const EEA::ElectronEffectiveAreaTarget targetEEA
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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

Definition at line 14 of file ElectronIsolatorFromEffectiveArea.cc.

Member Typedef Documentation

Definition at line 17 of file ElectronIsolatorFromEffectiveArea.cc.

Definition at line 18 of file ElectronIsolatorFromEffectiveArea.cc.

Constructor & Destructor Documentation

ElectronIsolatorFromEffectiveArea::ElectronIsolatorFromEffectiveArea ( const edm::ParameterSet config)
explicit

Definition at line 39 of file ElectronIsolatorFromEffectiveArea.cc.

References edm::ParameterSet::existsAs(), filter(), edm::ParameterSet::getParameter(), gsfElectronTag, gsfElectronToken, edm::InputTag::label(), patElectronTag, patElectronToken, pfElectronTag, and pfElectronToken.

40  : gsfElectronTag( edm::InputTag( "" ) )
41  , pfElectronTag( edm::InputTag( "" ) )
42  , patElectronTag( edm::InputTag( "" ) )
43  , rhoIsoToken( consumes<double>( config.getParameter<edm::InputTag>("rhoIso") ) )
44  , modeEEA( EEA_type()[ config.getParameter<std::string>("EffectiveAreaType") ] )
45  , targetEEA( EEA_target()[ config.getParameter<std::string>("EffectiveAreaTarget") ] )
46 {
47  if ( config.existsAs<edm::InputTag>("gsfElectrons") ) gsfElectronTag = config.getParameter<edm::InputTag>("gsfElectrons");
48  if ( config.existsAs<edm::InputTag>("pfElectrons") ) pfElectronTag = config.getParameter<edm::InputTag>("pfElectrons");
49  if ( config.existsAs<edm::InputTag>("patElectrons") ) patElectronTag = config.getParameter<edm::InputTag>("patElectrons");
50  if ( !gsfElectronTag.label().empty() ) gsfElectronToken = consumes<reco::GsfElectronCollection>( gsfElectronTag );
51  if ( !pfElectronTag.label().empty() ) pfElectronToken = consumes<reco::PFCandidateCollection>( pfElectronTag );
52  if ( !patElectronTag.label().empty() ) patElectronToken = consumes<pat::ElectronCollection>( patElectronTag );
53  produces<CandDoubleMap>();
54 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
static std::map< std::string, EEA::ElectronEffectiveAreaTarget > EEA_target()
static std::map< std::string, EEA::ElectronEffectiveAreaType > EEA_type()
edm::EDGetTokenT< pat::ElectronCollection > patElectronToken
const EEA::ElectronEffectiveAreaType modeEEA
edm::EDGetTokenT< reco::PFCandidateCollection > pfElectronToken
std::string const & label() const
Definition: InputTag.h:36
const EEA::ElectronEffectiveAreaTarget targetEEA
edm::EDGetTokenT< reco::GsfElectronCollection > gsfElectronToken

Member Function Documentation

std::map< std::string, ElectronEffectiveArea::ElectronEffectiveAreaTarget > ElectronIsolatorFromEffectiveArea::EEA_target ( )
staticprivate
std::map< std::string, ElectronEffectiveArea::ElectronEffectiveAreaType > ElectronIsolatorFromEffectiveArea::EEA_type ( )
staticprivate

Definition at line 107 of file ElectronIsolatorFromEffectiveArea.cc.

References ElectronEffectiveArea::kEleGammaAndNeutralHadronIso03, ElectronEffectiveArea::kEleGammaAndNeutralHadronIso04, and funct::m.

108 {
109  std::map<std::string,EEA::ElectronEffectiveAreaType> m;
110  m["kEleGammaAndNeutralHadronIso03"] = EEA::kEleGammaAndNeutralHadronIso03;
111  m["kEleGammaAndNeutralHadronIso04"] = EEA::kEleGammaAndNeutralHadronIso04;
112  return m;
113 }
bool ElectronIsolatorFromEffectiveArea::filter ( edm::Event event,
const edm::EventSetup  
)
privatevirtual

Definition at line 59 of file ElectronIsolatorFromEffectiveArea.cc.

References edm::helper::Filler< Map >::fill(), objects.autophobj::filler, ElectronEffectiveArea::GetElectronEffectiveArea(), gsfElectrons_cfi::gsfElectrons, gsfElectronTag, gsfElectronToken, edm::helper::Filler< Map >::insert(), edm::HandleBase::isValid(), edm::InputTag::label(), modeEEA, eostools::move(), electronProducer_cfi::patElectrons, patElectronTag, patElectronToken, pfElectronTag, pfElectronToken, rho, rhoIsoToken, and targetEEA.

Referenced by ElectronIsolatorFromEffectiveArea(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

60 {
61  std::unique_ptr<CandDoubleMap> product(new CandDoubleMap());
62  CandDoubleMap::Filler filler(*product);
63 
64  edm::Handle<double> rho; event.getByToken(rhoIsoToken, rho);
65 
66  if ( !gsfElectronTag.label().empty() ) {
68  std::vector<double> gsfCorrectionsEA;
69  if(gsfElectrons.isValid()) {
70  for ( reco::GsfElectronCollection::const_iterator it = gsfElectrons->begin(); it != gsfElectrons->end(); ++it)
71  gsfCorrectionsEA.push_back( (*rho) * EEA::GetElectronEffectiveArea( modeEEA, it->superCluster()->eta(), targetEEA ) );
72  filler.insert(gsfElectrons, gsfCorrectionsEA.begin(), gsfCorrectionsEA.end() );
73  }
74  }
75 
76  if ( !pfElectronTag.label().empty() ) {
77  edm::Handle<reco::PFCandidateCollection> pfElectrons; event.getByToken( pfElectronToken, pfElectrons);
78  std::vector<double> pfCorrectionsEA;
79  if(pfElectrons.isValid()) {
80  for ( reco::PFCandidateCollection::const_iterator it = pfElectrons->begin(); it != pfElectrons->end(); ++it)
81  pfCorrectionsEA.push_back( (*rho) * EEA::GetElectronEffectiveArea( modeEEA, it->gsfElectronRef()->superCluster()->eta(), targetEEA ) );
82  filler.insert( pfElectrons, pfCorrectionsEA.begin(), pfCorrectionsEA.end() );
83  }
84  }
85 
86  if ( !patElectronTag.label().empty() ) {
87  edm::Handle<pat::ElectronCollection> patElectrons; event.getByToken( patElectronToken, patElectrons);
88  std::vector<double> patCorrectionsEA;
89  if(patElectrons.isValid()) {
90  for ( pat::ElectronCollection::const_iterator it = patElectrons->begin(); it != patElectrons->end(); ++it)
91  patCorrectionsEA.push_back( (*rho) * EEA::GetElectronEffectiveArea( modeEEA, it->superCluster()->eta(), targetEEA ) );
92  filler.insert( patElectrons, patCorrectionsEA.begin(), patCorrectionsEA.end() );
93  }
94  }
95 
96  filler.fill();
97  event.put(std::move(product));
98  return true;
99 }
static Double_t GetElectronEffectiveArea(ElectronEffectiveAreaType type, Double_t SCEta, ElectronEffectiveAreaTarget EffectiveAreaTarget=kEleEAData2011)
edm::EDGetTokenT< pat::ElectronCollection > patElectronToken
const EEA::ElectronEffectiveAreaType modeEEA
bool isValid() const
Definition: HandleBase.h:74
helper::Filler< ValueMap< T > > Filler
Definition: ValueMap.h:169
edm::EDGetTokenT< reco::PFCandidateCollection > pfElectronToken
std::string const & label() const
Definition: InputTag.h:36
const EEA::ElectronEffectiveAreaTarget targetEEA
edm::EDGetTokenT< reco::GsfElectronCollection > gsfElectronToken
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::InputTag ElectronIsolatorFromEffectiveArea::gsfElectronTag
private
edm::EDGetTokenT<reco::GsfElectronCollection> ElectronIsolatorFromEffectiveArea::gsfElectronToken
private
const EEA::ElectronEffectiveAreaType ElectronIsolatorFromEffectiveArea::modeEEA
private

Definition at line 30 of file ElectronIsolatorFromEffectiveArea.cc.

Referenced by filter().

edm::InputTag ElectronIsolatorFromEffectiveArea::patElectronTag
private
edm::EDGetTokenT<pat::ElectronCollection> ElectronIsolatorFromEffectiveArea::patElectronToken
private
edm::InputTag ElectronIsolatorFromEffectiveArea::pfElectronTag
private
edm::EDGetTokenT<reco::PFCandidateCollection> ElectronIsolatorFromEffectiveArea::pfElectronToken
private
edm::EDGetTokenT<double> ElectronIsolatorFromEffectiveArea::rhoIsoToken
private

Definition at line 29 of file ElectronIsolatorFromEffectiveArea.cc.

Referenced by filter().

const EEA::ElectronEffectiveAreaTarget ElectronIsolatorFromEffectiveArea::targetEEA
private

Definition at line 31 of file ElectronIsolatorFromEffectiveArea.cc.

Referenced by filter().