Public Member Functions | |
void | endJob () |
GsfElectronFromPVSelector (const edm::ParameterSet &iConfig) | |
void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
virtual | ~GsfElectronFromPVSelector () |
Private Attributes | |
double | max_dxy_ |
double | max_dz_ |
edm::InputTag | srcPart_ |
edm::InputTag | srcPV_ |
Definition at line 31 of file ElectronFromPVSelector.cc.
GsfElectronFromPVSelector::GsfElectronFromPVSelector | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 57 of file ElectronFromPVSelector.cc.
: srcPart_(iConfig.getParameter<edm::InputTag>("srcElectron")) , srcPV_ (iConfig.getParameter<edm::InputTag>("srcVertex")) , max_dxy_(iConfig.getParameter<double>("max_dxy")) , max_dz_ (iConfig.getParameter<double>("max_dz")) { produces<std::vector<reco::GsfElectron> >(); }
GsfElectronFromPVSelector::~GsfElectronFromPVSelector | ( | ) | [virtual] |
Definition at line 68 of file ElectronFromPVSelector.cc.
{}
void GsfElectronFromPVSelector::endJob | ( | void | ) | [virtual] |
void GsfElectronFromPVSelector::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 75 of file ElectronFromPVSelector.cc.
References edm::Event::getByLabel(), max_dxy_, max_dz_, reco::Vertex::position(), edm::Event::put(), srcPart_, and srcPV_.
{ std::auto_ptr<std::vector<reco::GsfElectron> > goodGsfElectrons(new std::vector<reco::GsfElectron >); edm::Handle< std::vector<reco::Vertex> > VertexHandle; iEvent.getByLabel(srcPV_,VertexHandle); edm::Handle< std::vector<reco::GsfElectron> > GsfElectronHandle; iEvent.getByLabel(srcPart_,GsfElectronHandle); if( (VertexHandle->size() == 0) || (GsfElectronHandle->size() == 0) ) { iEvent.put(goodGsfElectrons); return ; } reco::Vertex PV = VertexHandle->front(); std::vector<reco::GsfElectron>::const_iterator GsfElectronIt ; // typename std::vector<reco::GsfElectron>::const_iterator GsfElectronIt ; for (GsfElectronIt = GsfElectronHandle->begin(); GsfElectronIt != GsfElectronHandle->end(); ++GsfElectronIt) { //int q = GsfElectronIt->gsfTrack()->charge() ; if ( fabs(GsfElectronIt->gsfTrack()->dxy(PV.position())) < max_dxy_ && fabs(GsfElectronIt->gsfTrack()->dz(PV.position())) < max_dz_ ) { goodGsfElectrons -> push_back(*GsfElectronIt) ; } } iEvent.put(goodGsfElectrons); }
double GsfElectronFromPVSelector::max_dxy_ [private] |
Definition at line 46 of file ElectronFromPVSelector.cc.
Referenced by produce().
double GsfElectronFromPVSelector::max_dz_ [private] |
Definition at line 47 of file ElectronFromPVSelector.cc.
Referenced by produce().
Definition at line 44 of file ElectronFromPVSelector.cc.
Referenced by produce().
Definition at line 45 of file ElectronFromPVSelector.cc.
Referenced by produce().