CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PatJPsiProducer Class Reference

#include <Analysis/PatJPsiProducer/src/PatJPsiProducer.cc>

Inheritance diagram for PatJPsiProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

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_

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 51 of file PatJPsiProducer.cc.


Constructor & Destructor Documentation

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.

{
 
}

Member Function Documentation

void PatJPsiProducer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 147 of file PatJPsiProducer.cc.

{
}
void PatJPsiProducer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 153 of file PatJPsiProducer.cc.

                        {
}
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(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, edm::Event::getByLabel(), edm::HandleBase::isValid(), jpsi, 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 );
 
}

Member Data Documentation

Definition at line 63 of file PatJPsiProducer.cc.

Referenced by produce().