test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
GEDGsfElectronProducer Class Reference

#include <GEDGsfElectronProducer.h>

Inheritance diagram for GEDGsfElectronProducer:
GsfElectronBaseProducer edm::stream::EDProducer< edm::GlobalCache< gsfAlgoHelpers::HeavyObjectCache > > edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GEDGsfElectronProducer (const edm::ParameterSet &, const gsfAlgoHelpers::HeavyObjectCache *)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~GEDGsfElectronProducer ()
 
- Public Member Functions inherited from GsfElectronBaseProducer
 GsfElectronBaseProducer (const edm::ParameterSet &, const gsfAlgoHelpers::HeavyObjectCache *)
 
virtual ~GsfElectronBaseProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< gsfAlgoHelpers::HeavyObjectCache > >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void fillGsfElectronValueMap (edm::Event &event, edm::ValueMap< reco::GsfElectronRef >::Filler &filler)
 
void matchWithPFCandidates (edm::Event &event)
 

Private Attributes

edm::EDGetTokenT
< reco::PFCandidateCollection
egmPFCandidateCollection_
 
std::map< reco::GsfTrackRef,
reco::GsfElectron::MvaInput
gsfMVAInputMap_
 
std::map< reco::GsfTrackRef,
reco::GsfElectron::MvaOutput
gsfMVAOutputMap_
 
std::string outputValueMapLabel_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< gsfAlgoHelpers::HeavyObjectCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from GsfElectronBaseProducer
static void fillDescription (edm::ParameterSetDescription &)
 
static void globalEndJob (gsfAlgoHelpers::HeavyObjectCache const *)
 
static std::unique_ptr
< gsfAlgoHelpers::HeavyObjectCache
initializeGlobalCache (const edm::ParameterSet &conf)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from GsfElectronBaseProducer
void beginEvent (edm::Event &, const edm::EventSetup &)
 
void endEvent ()
 
void fillEvent (edm::Event &)
 
reco::GsfElectronnewElectron ()
 
const edm::OrphanHandle
< reco::GsfElectronCollection > & 
orphanHandle () const
 
- 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)
 
- Protected Attributes inherited from GsfElectronBaseProducer
GsfElectronAlgoalgo_
 
GsfElectronAlgo::CutsConfiguration cutsCfg_
 
GsfElectronAlgo::CutsConfiguration cutsCfgPflow_
 
ElectronHcalHelper::Configuration hcalCfg_
 
ElectronHcalHelper::Configuration hcalCfgPflow_
 
GsfElectronAlgo::InputTagsConfiguration inputCfg_
 
ElectronMVAEstimator::Configuration mva_Iso_Cfg_
 
SoftElectronMVAEstimator::Configuration mva_NIso_Cfg_
 
GsfElectronAlgo::StrategyConfiguration strategyCfg_
 

Detailed Description

Definition at line 9 of file GEDGsfElectronProducer.h.

Constructor & Destructor Documentation

GEDGsfElectronProducer::GEDGsfElectronProducer ( const edm::ParameterSet cfg,
const gsfAlgoHelpers::HeavyObjectCache hoc 
)
explicit

Definition at line 31 of file GEDGsfElectronProducer.cc.

References egmPFCandidateCollection_, edm::ParameterSet::getParameter(), outputValueMapLabel_, and AlCaHLTBitMon_QueryRunRegistry::string.

32  : GsfElectronBaseProducer(cfg,hoc)
33  {
34  egmPFCandidateCollection_ = consumes<reco::PFCandidateCollection>(cfg.getParameter<edm::InputTag>("egmPFCandidatesTag"));
35  outputValueMapLabel_ = cfg.getParameter<std::string>("outputEGMPFValueMap");
36 
37  produces<edm::ValueMap<reco::GsfElectronRef> >(outputValueMapLabel_);
38 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::PFCandidateCollection > egmPFCandidateCollection_
GsfElectronBaseProducer(const edm::ParameterSet &, const gsfAlgoHelpers::HeavyObjectCache *)
GEDGsfElectronProducer::~GEDGsfElectronProducer ( )
virtual

Definition at line 40 of file GEDGsfElectronProducer.cc.

41  {}

Member Function Documentation

void GEDGsfElectronProducer::fillGsfElectronValueMap ( edm::Event event,
edm::ValueMap< reco::GsfElectronRef >::Filler &  filler 
)
private

Definition at line 64 of file GEDGsfElectronProducer.cc.

References begin, egmPFCandidateCollection_, end, newFWLiteAna::found, edm::helper::Filler< Map >::insert(), GsfElectronBaseProducer::orphanHandle(), reco::tau::pfCandidates(), and makeHLTPrescaleTable::values.

Referenced by produce().

65 {
66  // Read the collection of PFCandidates
68 
69  bool found = event.getByToken(egmPFCandidateCollection_, pfCandidates);
70  if(!found) {
71  edm::LogError("GEDGsfElectronProducer")
72  <<" cannot get PFCandidates! ";
73  }
74 
75  //Loop over the collection of PFFCandidates
76  reco::PFCandidateCollection::const_iterator it = pfCandidates->begin();
77  reco::PFCandidateCollection::const_iterator itend = pfCandidates->end() ;
78  std::vector<reco::GsfElectronRef> values;
79 
80  for ( ; it != itend ; ++it) {
82  // First check that the GsfTrack is non null
83  if( it->gsfTrackRef().isNonnull()) {
84  // now look for the corresponding GsfElectron
85  GsfElectronEqual myEqual(it->gsfTrackRef());
86  const reco::GsfElectronCollection::const_iterator itcheck=
87  std::find_if(orphanHandle()->begin(),orphanHandle()->end(),myEqual);
88  if (itcheck != orphanHandle()->end()) {
89  // Build the Ref from the handle and the index
90  myRef = reco::GsfElectronRef(orphanHandle(),itcheck-orphanHandle()->begin());
91  }
92  }
93  values.push_back(myRef);
94  }
95  filler.insert(pfCandidates,values.begin(),values.end());
96 }
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
#define end
Definition: vmac.h:37
edm::EDGetTokenT< reco::PFCandidateCollection > egmPFCandidateCollection_
edm::Ref< GsfElectronCollection > GsfElectronRef
reference to an object in a collection of GsfElectron objects
const edm::OrphanHandle< reco::GsfElectronCollection > & orphanHandle() const
#define begin
Definition: vmac.h:30
void GEDGsfElectronProducer::matchWithPFCandidates ( edm::Event event)
private

Definition at line 102 of file GEDGsfElectronProducer.cc.

References reco::GsfElectron::MvaInput::deltaEta, reco::GsfElectron::MvaInput::earlyBrem, egmPFCandidateCollection_, newFWLiteAna::found, gsfMVAInputMap_, gsfMVAOutputMap_, reco::GsfElectron::MvaInput::hadEnergy, reco::GsfElectron::MvaInput::lateBrem, reco::PFCandidateEGammaExtra::MVA_DeltaEtaTrackCluster, reco::PFCandidateEGammaExtra::MVA_FirstBrem, reco::PFCandidateEGammaExtra::MVA_LateBrem, reco::tau::pfCandidates(), reco::GsfElectron::MvaInput::sigmaEtaEta, and reco::GsfElectron::MvaOutput::status.

Referenced by produce().

103 {
104  gsfMVAInputMap_.clear();
105  gsfMVAOutputMap_.clear();
106 
107  // Read the collection of PFCandidates
109 
110  bool found = event.getByToken(egmPFCandidateCollection_, pfCandidates);
111  if(!found) {
112  edm::LogError("GEDGsfElectronProducer")
113  <<" cannot get PFCandidates! ";
114  }
115 
116  //Loop over the collection of PFFCandidates
117  reco::PFCandidateCollection::const_iterator it = pfCandidates->begin();
118  reco::PFCandidateCollection::const_iterator itend = pfCandidates->end() ;
119 
120  for ( ; it != itend ; ++it) {
121  reco::GsfElectronRef myRef;
122  // First check that the GsfTrack is non null
123  if( it->gsfTrackRef().isNonnull()) {
124 
125  reco::GsfElectron::MvaOutput myMvaOutput;
126  // at the moment, undefined
127  myMvaOutput.status = it->egammaExtraRef()->electronStatus() ;
128  gsfMVAOutputMap_[it->gsfTrackRef()] = myMvaOutput;
129 
130  reco::GsfElectron::MvaInput myMvaInput;
131  myMvaInput.earlyBrem = it->egammaExtraRef()->mvaVariable(reco::PFCandidateEGammaExtra::MVA_FirstBrem);
132  myMvaInput.lateBrem = it->egammaExtraRef()->mvaVariable(reco::PFCandidateEGammaExtra::MVA_LateBrem);
133  myMvaInput.deltaEta = it->egammaExtraRef()->mvaVariable(reco::PFCandidateEGammaExtra::MVA_DeltaEtaTrackCluster);
134  myMvaInput.sigmaEtaEta = it->egammaExtraRef()->sigmaEtaEta();
135  myMvaInput.hadEnergy = it->egammaExtraRef()->hadEnergy();
136  gsfMVAInputMap_[it->gsfTrackRef()] = myMvaInput;
137  }
138  }
139 }
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
edm::EDGetTokenT< reco::PFCandidateCollection > egmPFCandidateCollection_
std::map< reco::GsfTrackRef, reco::GsfElectron::MvaOutput > gsfMVAOutputMap_
std::map< reco::GsfTrackRef, reco::GsfElectron::MvaInput > gsfMVAInputMap_
void GEDGsfElectronProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 44 of file GEDGsfElectronProducer.cc.

References GsfElectronBaseProducer::algo_, GsfElectronBaseProducer::beginEvent(), GsfElectronAlgo::completeElectrons(), GsfElectronBaseProducer::endEvent(), edm::helper::Filler< Map >::fill(), GsfElectronBaseProducer::fillEvent(), fillGsfElectronValueMap(), gsfMVAInputMap_, gsfMVAOutputMap_, matchWithPFCandidates(), outputValueMapLabel_, GsfElectronAlgo::setMVAInputs(), and GsfElectronAlgo::setMVAOutputs().

45  {
46  beginEvent(event,setup) ;
47  matchWithPFCandidates(event);
48  algo_->completeElectrons(globalCache()) ;
49  algo_->setMVAOutputs(globalCache(),gsfMVAOutputMap_);
51  fillEvent(event) ;
52 
53  // ValueMap
54  std::auto_ptr<edm::ValueMap<reco::GsfElectronRef> > valMap_p(new edm::ValueMap<reco::GsfElectronRef>);
55  edm::ValueMap<reco::GsfElectronRef>::Filler valMapFiller(*valMap_p);
56  fillGsfElectronValueMap(event,valMapFiller);
57  valMapFiller.fill();
58  event.put(valMap_p,outputValueMapLabel_);
59  // Done with the ValueMap
60 
61  endEvent() ;
62  }
void matchWithPFCandidates(edm::Event &event)
void setMVAOutputs(const gsfAlgoHelpers::HeavyObjectCache *, const std::map< reco::GsfTrackRef, reco::GsfElectron::MvaOutput > &mvaOutputs)
void setMVAInputs(const std::map< reco::GsfTrackRef, reco::GsfElectron::MvaInput > &mvaInputs)
void completeElectrons(const gsfAlgoHelpers::HeavyObjectCache *)
void fillGsfElectronValueMap(edm::Event &event, edm::ValueMap< reco::GsfElectronRef >::Filler &filler)
std::map< reco::GsfTrackRef, reco::GsfElectron::MvaOutput > gsfMVAOutputMap_
void beginEvent(edm::Event &, const edm::EventSetup &)
std::map< reco::GsfTrackRef, reco::GsfElectron::MvaInput > gsfMVAInputMap_

Member Data Documentation

edm::EDGetTokenT<reco::PFCandidateCollection> GEDGsfElectronProducer::egmPFCandidateCollection_
private
std::map<reco::GsfTrackRef,reco::GsfElectron::MvaInput> GEDGsfElectronProducer::gsfMVAInputMap_
private

Definition at line 22 of file GEDGsfElectronProducer.h.

Referenced by matchWithPFCandidates(), and produce().

std::map<reco::GsfTrackRef,reco::GsfElectron::MvaOutput> GEDGsfElectronProducer::gsfMVAOutputMap_
private

Definition at line 23 of file GEDGsfElectronProducer.h.

Referenced by matchWithPFCandidates(), and produce().

std::string GEDGsfElectronProducer::outputValueMapLabel_
private

Definition at line 21 of file GEDGsfElectronProducer.h.

Referenced by GEDGsfElectronProducer(), and produce().