Public Member Functions | |
void | endJob () |
MuonFromPVSelector (const edm::ParameterSet &iConfig) | |
void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
virtual | ~MuonFromPVSelector () |
Private Attributes | |
double | max_dxy_ |
double | max_dz_ |
edm::InputTag | srcPart_ |
edm::InputTag | srcPV_ |
Definition at line 25 of file MuonFromPVSelector.cc.
MuonFromPVSelector::MuonFromPVSelector | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 51 of file MuonFromPVSelector.cc.
: srcPart_(iConfig.getParameter<edm::InputTag>("srcMuon")) , srcPV_ (iConfig.getParameter<edm::InputTag>("srcVertex")) , max_dxy_(iConfig.getParameter<double>("max_dxy")) , max_dz_ (iConfig.getParameter<double>("max_dz")) { produces<std::vector<reco::Muon> >(); }
MuonFromPVSelector::~MuonFromPVSelector | ( | ) | [virtual] |
Definition at line 62 of file MuonFromPVSelector.cc.
{}
void MuonFromPVSelector::endJob | ( | void | ) | [virtual] |
void MuonFromPVSelector::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 69 of file MuonFromPVSelector.cc.
References edm::Event::getByLabel(), goldenZmmSelectionVBTF_cfi::goodMuons, max_dxy_, max_dz_, reco::Vertex::position(), edm::Event::put(), srcPart_, and srcPV_.
{ std::auto_ptr<std::vector<reco::Muon> > goodMuons(new std::vector<reco::Muon >); edm::Handle< std::vector<reco::Vertex> > VertexHandle; iEvent.getByLabel(srcPV_,VertexHandle); edm::Handle< std::vector<reco::Muon> > MuonHandle; iEvent.getByLabel(srcPart_,MuonHandle); if( (VertexHandle->size() == 0) || (MuonHandle->size() == 0) ) { iEvent.put(goodMuons); return ; } reco::Vertex PV = VertexHandle->front(); //typename std::vector<reco::Muon>::const_iterator MuonIt ; std::vector<reco::Muon>::const_iterator MuonIt ; for (MuonIt = MuonHandle->begin(); MuonIt != MuonHandle->end(); ++MuonIt) { if ( MuonIt->innerTrack().isNonnull() && fabs(MuonIt->innerTrack()->dxy(PV.position())) < max_dxy_ && fabs(MuonIt->innerTrack()->dz(PV.position())) < max_dz_ ){ goodMuons -> push_back(*MuonIt) ; } } iEvent.put(goodMuons); }
double MuonFromPVSelector::max_dxy_ [private] |
Definition at line 40 of file MuonFromPVSelector.cc.
Referenced by produce().
double MuonFromPVSelector::max_dz_ [private] |
Definition at line 41 of file MuonFromPVSelector.cc.
Referenced by produce().
edm::InputTag MuonFromPVSelector::srcPart_ [private] |
Definition at line 38 of file MuonFromPVSelector.cc.
Referenced by produce().
edm::InputTag MuonFromPVSelector::srcPV_ [private] |
Definition at line 39 of file MuonFromPVSelector.cc.
Referenced by produce().