#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(), gather_cfg::cout, PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, edm::Event::getByLabel(), edm::HandleBase::isValid(), jpsi, 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 ); std::cout<<"valid?"<< h_muons.isValid()<<" size?"<< h_muons->size(); 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 ) { for ( edm::View<pat::Muon>::const_iterator jmuon = imuon + 1; jmuon != muonsEnd; ++jmuon ) { if ( imuon->charge() * jmuon->charge() < 0 ) { //A composite Candidate is very useful to build event hypothesis and cut on combined object information. 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 ); // Analogue to any other PAT object we can add our own information into the object via addUserFloat/Int/Data() jpsi.addUserFloat("dR", dR ); jpsiCands->push_back( jpsi ); } } } } iEvent.put( jpsiCands ); }
edm::InputTag PatJPsiProducer::muonSrc_ [private] |
Definition at line 63 of file PatJPsiProducer.cc.
Referenced by produce().