#include <ElectronMatchedCandidateProducer.h>
Public Member Functions | |
ElectronMatchedCandidateProducer (const edm::ParameterSet &) | |
~ElectronMatchedCandidateProducer () | |
Private Member Functions | |
virtual void | beginJob () |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
double | delRMatchingCut_ |
edm::InputTag | electronCollection_ |
edm::InputTag | scCollection_ |
Definition at line 16 of file ElectronMatchedCandidateProducer.h.
ElectronMatchedCandidateProducer::ElectronMatchedCandidateProducer | ( | const edm::ParameterSet & | params | ) | [explicit] |
Definition at line 9 of file ElectronMatchedCandidateProducer.cc.
References delRMatchingCut_, electronCollection_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and scCollection_.
{ const edm::InputTag allelectrons("gsfElectrons"); electronCollection_ = params.getUntrackedParameter<edm::InputTag>("ReferenceElectronCollection", allelectrons); scCollection_ = params.getParameter<edm::InputTag>("src"); delRMatchingCut_ = params.getUntrackedParameter<double>("deltaR", 0.30); produces< edm::PtrVector<reco::Candidate> >(); produces< edm::RefToBaseVector<reco::Candidate> >(); }
ElectronMatchedCandidateProducer::~ElectronMatchedCandidateProducer | ( | ) |
Definition at line 29 of file ElectronMatchedCandidateProducer.cc.
{ }
void ElectronMatchedCandidateProducer::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 99 of file ElectronMatchedCandidateProducer.cc.
{}
void ElectronMatchedCandidateProducer::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 103 of file ElectronMatchedCandidateProducer.cc.
{}
void ElectronMatchedCandidateProducer::produce | ( | edm::Event & | event, |
const edm::EventSetup & | eventSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 42 of file ElectronMatchedCandidateProducer.cc.
References cmsDriverOptions::counter, delRMatchingCut_, deltaR(), electronCollection_, and scCollection_.
{ // Create the output collection std::auto_ptr< edm::RefToBaseVector<reco::Candidate> > outColRef( new edm::RefToBaseVector<reco::Candidate> ); std::auto_ptr< edm::PtrVector<reco::Candidate> > outColPtr( new edm::PtrVector<reco::Candidate> ); // Read electrons edm::Handle<edm::View<reco::GsfElectron> > electrons; event.getByLabel(electronCollection_, electrons); //Read candidates edm::Handle<edm::View<reco::Candidate> > recoCandColl; event.getByLabel( scCollection_ , recoCandColl); const edm::PtrVector<reco::Candidate>& ptrVect = recoCandColl->ptrVector(); const edm::RefToBaseVector<reco::Candidate>& refs = recoCandColl->refVector(); unsigned int counter=0; // Loop over candidates for(edm::View<reco::Candidate>::const_iterator scIt = recoCandColl->begin(); scIt != recoCandColl->end(); ++scIt, ++counter){ // Now loop over electrons for(edm::View<reco::GsfElectron>::const_iterator elec = electrons->begin(); elec != electrons->end(); ++elec) { reco::SuperClusterRef eSC = elec->superCluster(); double dRval = reco::deltaR((float)eSC->eta(), (float)eSC->phi(), scIt->eta(), scIt->phi()); if( dRval < delRMatchingCut_ ) { //outCol->push_back( *scIt ); outColRef->push_back( refs[counter] ); outColPtr->push_back( ptrVect[counter] ); } // end if loop } // end electron loop } // end candidate loop event.put(outColRef); event.put(outColPtr); }
double ElectronMatchedCandidateProducer::delRMatchingCut_ [private] |
Definition at line 31 of file ElectronMatchedCandidateProducer.h.
Referenced by ElectronMatchedCandidateProducer(), and produce().
Definition at line 29 of file ElectronMatchedCandidateProducer.h.
Referenced by ElectronMatchedCandidateProducer(), and produce().
Definition at line 30 of file ElectronMatchedCandidateProducer.h.
Referenced by ElectronMatchedCandidateProducer(), and produce().