CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef edm::ValueMap< double > CandDoubleMap
 
typedef ElectronEffectiveArea EEA
 
- Public Types inherited from edm::stream::EDFilter<>
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
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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::stream::EDFilter<>
 EDFilter ()=default
 
 EDFilter (const EDFilter &)=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 EDFilteroperator= (const EDFilter &)=delete
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
 EDFilterBase (const EDFilterBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDFilterBaseoperator= (const EDFilterBase &)=delete
 
 ~EDFilterBase () override
 
- 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 ()
 
std::vector
< edm::ProductResolverIndex >
const & 
putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Static Private Member Functions

static std::map< std::string,
EEA::ElectronEffectiveAreaTarget
EEA_target ()
 
static std::map< std::string,
EEA::ElectronEffectiveAreaType
EEA_type ()
 

Private Attributes

edm::InputTag gsfElectronTag
 
edm::EDGetTokenT
< reco::GsfElectronCollection
gsfElectronToken
 
const
EEA::ElectronEffectiveAreaType 
modeEEA
 
edm::InputTag patElectronTag
 
edm::EDGetTokenT
< pat::ElectronCollection
patElectronToken
 
edm::InputTag pfElectronTag
 
edm::EDGetTokenT
< reco::PFCandidateCollection
pfElectronToken
 
edm::EDGetTokenT< double > rhoIsoToken
 
const
EEA::ElectronEffectiveAreaTarget 
targetEEA
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 14 of file ElectronIsolatorFromEffectiveArea.cc.

Member Typedef Documentation

Definition at line 16 of file ElectronIsolatorFromEffectiveArea.cc.

Definition at line 17 of file ElectronIsolatorFromEffectiveArea.cc.

Constructor & Destructor Documentation

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

Definition at line 35 of file ElectronIsolatorFromEffectiveArea.cc.

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

39  rhoIsoToken(consumes<double>(config.getParameter<edm::InputTag>("rhoIso"))),
40  modeEEA(EEA_type()[config.getParameter<std::string>("EffectiveAreaType")]),
41  targetEEA(EEA_target()[config.getParameter<std::string>("EffectiveAreaTarget")]) {
42  if (config.existsAs<edm::InputTag>("gsfElectrons"))
43  gsfElectronTag = config.getParameter<edm::InputTag>("gsfElectrons");
44  if (config.existsAs<edm::InputTag>("pfElectrons"))
45  pfElectronTag = config.getParameter<edm::InputTag>("pfElectrons");
46  if (config.existsAs<edm::InputTag>("patElectrons"))
47  patElectronTag = config.getParameter<edm::InputTag>("patElectrons");
48  if (!gsfElectronTag.label().empty())
49  gsfElectronToken = consumes<reco::GsfElectronCollection>(gsfElectronTag);
50  if (!pfElectronTag.label().empty())
51  pfElectronToken = consumes<reco::PFCandidateCollection>(pfElectronTag);
52  if (!patElectronTag.label().empty())
53  patElectronToken = consumes<pat::ElectronCollection>(patElectronTag);
54  produces<CandDoubleMap>();
55 }
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
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
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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
bool ElectronIsolatorFromEffectiveArea::filter ( edm::Event event,
const edm::EventSetup  
)
overrideprivatevirtual

Implements edm::stream::EDFilterBase.

Definition at line 57 of file ElectronIsolatorFromEffectiveArea.cc.

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

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

Member Data Documentation

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

Definition at line 29 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 28 of file ElectronIsolatorFromEffectiveArea.cc.

Referenced by filter().

const EEA::ElectronEffectiveAreaTarget ElectronIsolatorFromEffectiveArea::targetEEA
private

Definition at line 30 of file ElectronIsolatorFromEffectiveArea.cc.

Referenced by filter().