Public Member Functions | |
MuonSelectorVertex (const edm::ParameterSet &iConfig) | |
virtual void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
~MuonSelectorVertex () | |
Private Attributes | |
double | maxDZ_ |
edm::InputTag | muonSource_ |
edm::InputTag | vertexSource_ |
Definition at line 11 of file MuonSelectorVertex.cc.
MuonSelectorVertex::MuonSelectorVertex | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 36 of file MuonSelectorVertex.cc.
: muonSource_( iConfig.getParameter< edm::InputTag >( "muonSource" ) ) , vertexSource_( iConfig.getParameter< edm::InputTag >( "vertexSource" ) ) , maxDZ_( iConfig.getParameter< double >( "maxDZ" ) ) { produces< std::vector< pat::Muon > >(); }
MuonSelectorVertex::~MuonSelectorVertex | ( | ) | [inline] |
Definition at line 16 of file MuonSelectorVertex.cc.
{};
void MuonSelectorVertex::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 47 of file MuonSelectorVertex.cc.
References edm::Event::getByLabel(), maxDZ_, patZpeak::muons, muonSource_, edm::Event::put(), ValidateTausOnRealMuonsData_cff::selectedMuons, and vertexSource_.
{ edm::Handle< std::vector< pat::Muon > > muons; iEvent.getByLabel( muonSource_, muons ); edm::Handle< std::vector< reco::Vertex > > vertices; iEvent.getByLabel( vertexSource_, vertices ); std::vector< pat::Muon > * selectedMuons( new std::vector< pat::Muon > ); if ( vertices->size() > 0 ) { for ( unsigned iMuon = 0; iMuon < muons->size(); ++iMuon ) { if ( std::fabs( muons->at( iMuon ).vertex().z() - vertices->at( 0 ).z() ) < maxDZ_ ) { selectedMuons->push_back( muons->at( iMuon ) ); } } } std::auto_ptr< std::vector< pat::Muon > > selectedMuonsPtr( selectedMuons ); iEvent.put( selectedMuonsPtr ); }
double MuonSelectorVertex::maxDZ_ [private] |
Definition at line 23 of file MuonSelectorVertex.cc.
Referenced by produce().
edm::InputTag MuonSelectorVertex::muonSource_ [private] |
Definition at line 21 of file MuonSelectorVertex.cc.
Referenced by produce().
Definition at line 22 of file MuonSelectorVertex.cc.
Referenced by produce().