19 previousGsfElectrons_ = consumes<reco::GsfElectronCollection>(cfg.
getParameter<
edm::InputTag>(
"previousGsfElectronsTag"));
31 nDeps_ = tokenElectronIsoVals_.size();
39 gedRegression_.reset(plugin);
41 gedRegression_.reset(
nullptr);
44 produces<reco::GsfElectronCollection> (outputCollectionLabel_);
55 auto outputElectrons_p = std::make_unique<reco::GsfElectronCollection>();
57 if( gedRegression_ ) {
58 gedRegression_->setEvent(event);
59 gedRegression_->setEventContent(setup);
65 event.getByToken(previousGsfElectrons_,gedElectronHandle);
69 event.getByToken(pfCandidates_,pfCandidateHandle);
71 std::vector< edm::Handle< edm::ValueMap<float> > > isolationValueMaps(nDeps_);
73 for(
unsigned i=0;
i < nDeps_ ; ++
i) {
74 event.getByToken(tokenElectronIsoVals_[
i],isolationValueMaps[i]);
78 std::map<reco::GsfTrackRef, const reco::PFCandidate* > gsfPFMap;
79 reco::PFCandidateCollection::const_iterator it = pfCandidateHandle->begin();
80 reco::PFCandidateCollection::const_iterator itend = pfCandidateHandle->end() ;
81 for(;it!=itend;++it) {
83 if( it->gsfTrackRef().isNonnull()) {
84 if(
abs(it->pdgId())==11)
85 gsfPFMap[it->gsfTrackRef()]=&(*it);
91 unsigned nele=gedElectronHandle->size();
92 for(
unsigned iele=0; iele<nele;++iele) {
98 isoVariables.
sumPhotonEt = (*(isolationValueMaps)[1])[myElectronRef];
100 isoVariables.
sumPUPt = (*(isolationValueMaps)[3])[myElectronRef];
109 std::map<reco::GsfTrackRef, const reco::PFCandidate * >::const_iterator itcheck=gsfPFMap.find(newElectron.
gsfTrack());
111 if(itcheck!=gsfPFMap.end()) {
117 myMvaOutput.status = 4 ;
123 if( gedRegression_ ) {
124 gedRegression_->modifyObject(newElectron);
126 outputElectrons_p->push_back(newElectron);
129 event.put(
std::move(outputElectrons_p),outputCollectionLabel_);
T getParameter(std::string const &) const
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
def setup(process, global_tag, zero_tesla=False)
void setPfIsolationVariables(const PflowIsolationVariables &iso)
void setMvaOutput(const MvaOutput &mo)
unique_ptr< JetDefinition::Plugin > plugin
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
GEDGsfElectronFinalizer(const edm::ParameterSet &)
Abs< T >::type abs(const T &t)
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
~GEDGsfElectronFinalizer() override
ParameterSet const & getParameterSet(std::string const &) const
const MvaOutput & mvaOutput() const
void setPassPflowPreselection(bool flag)
void produce(edm::Event &, const edm::EventSetup &) override
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
T get(const Candidate &c)