#include <Analysis/PatJPsiProducer/src/PatJPsiProducer.cc>
Public Member Functions | |
PatJPsiProducer (const edm::ParameterSet &) | |
~PatJPsiProducer () | |
Private Member Functions | |
virtual void | beginJob () |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
edm::InputTag | muonSrc_ |
Description: <one line="" class="" summary>="">
Implementation: <Notes on="" implementation>="">
Definition at line 51 of file PatJPsiProducer.cc.
PatJPsiProducer::PatJPsiProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 78 of file PatJPsiProducer.cc.
: muonSrc_ ( iConfig.getParameter<edm::InputTag>("muonSrc") ) { produces<std::vector<pat::CompositeCandidate> > (); }
PatJPsiProducer::~PatJPsiProducer | ( | ) |
Definition at line 86 of file PatJPsiProducer.cc.
{ }
void PatJPsiProducer::beginJob | ( | void | ) | [private, virtual] |
void PatJPsiProducer::endJob | ( | void | ) | [private, virtual] |
void PatJPsiProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 98 of file PatJPsiProducer.cc.
References reco::CompositeCandidate::addDaughter(), pat::PATObject< ObjectType >::addUserFloat(), edm::Event::getByLabel(), edm::HandleBase::isValid(), reco::LeafCandidate::mass(), muonSrc_, edm::Event::put(), and AddFourMomenta::set().
{ std::auto_ptr<std::vector<pat::CompositeCandidate> > jpsiCands( new std::vector<pat::CompositeCandidate> ); edm::Handle<edm::View<pat::Muon> > h_muons; iEvent.getByLabel( muonSrc_, h_muons ); // const double MUON_MASS = 0.106; const double JPSI_MASS = 3.097; if ( h_muons.isValid() && h_muons->size() > 1 ) { for ( edm::View<pat::Muon>::const_iterator muonsBegin = h_muons->begin(), muonsEnd = h_muons->end(), imuon = muonsBegin; imuon != muonsEnd - 1; ++imuon ) { if ( imuon->pt() > 1.0 ) { for ( edm::View<pat::Muon>::const_iterator jmuon = imuon + 1; jmuon != muonsEnd; ++jmuon ) { if ( imuon->charge() * jmuon->charge() < 0 ) { pat::CompositeCandidate jpsi; jpsi.addDaughter( *imuon, "mu1"); jpsi.addDaughter( *jmuon, "mu2"); AddFourMomenta addp4; addp4.set( jpsi ); double dR = reco::deltaR<pat::Muon,pat::Muon>( *imuon, *jmuon ); jpsi.addUserFloat("dR", dR ); if ( fabs( jpsi.mass() - JPSI_MASS ) < 1.0 ) { jpsiCands->push_back( jpsi ); } } } } } } iEvent.put( jpsiCands ); }
edm::InputTag PatJPsiProducer::muonSrc_ [private] |
Definition at line 63 of file PatJPsiProducer.cc.
Referenced by produce().