CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

Public Member Functions

 PatJPsiProducer (const edm::ParameterSet &)
 
 ~PatJPsiProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::InputTag muonSrc_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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.

78  :
79  muonSrc_ ( iConfig.getParameter<edm::InputTag>("muonSrc") )
80 {
81  produces<std::vector<pat::CompositeCandidate> > ();
82 
83 }
T getParameter(std::string const &) const
edm::InputTag muonSrc_
PatJPsiProducer::~PatJPsiProducer ( )

Definition at line 86 of file PatJPsiProducer.cc.

87 {
88 
89 }

Member Function Documentation

void PatJPsiProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 140 of file PatJPsiProducer.cc.

141 {
142 }
void PatJPsiProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 146 of file PatJPsiProducer.cc.

146  {
147 }
void PatJPsiProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

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().

99 {
100 
101  std::auto_ptr<std::vector<pat::CompositeCandidate> > jpsiCands( new std::vector<pat::CompositeCandidate> );
103  iEvent.getByLabel( muonSrc_, h_muons );
104  std::cout<<"valid?"<< h_muons.isValid()<<" size?"<< h_muons->size();
105  if ( h_muons.isValid() && h_muons->size() > 1 ) {
106 
107  for ( edm::View<pat::Muon>::const_iterator muonsBegin = h_muons->begin(),
108  muonsEnd = h_muons->end(), imuon = muonsBegin;
109  imuon != muonsEnd - 1; ++imuon ) {
110 
111  for ( edm::View<pat::Muon>::const_iterator jmuon = imuon + 1;
112  jmuon != muonsEnd; ++jmuon ) {
113  if ( imuon->charge() * jmuon->charge() < 0 ) {
114 
115  //A composite Candidate is very useful to build event hypothesis and cut on combined object information.
117  jpsi.addDaughter( *imuon, "mu1");
118  jpsi.addDaughter( *jmuon, "mu2");
119 
120  AddFourMomenta addp4;
121  addp4.set( jpsi );
122 
123  double dR = reco::deltaR<pat::Muon,pat::Muon>( *imuon, *jmuon );
124 
125  // Analogue to any other PAT object we can add our own information into the object via addUserFloat/Int/Data()
126  jpsi.addUserFloat("dR", dR );
127 
128  jpsiCands->push_back( jpsi );
129 
130  }
131  }
132  }
133  }
134  iEvent.put( jpsiCands );
135 
136 }
Analysis-level particle class.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
edm::InputTag muonSrc_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
void addUserFloat(const std::string &label, float data)
Set user-defined float.
Definition: PATObject.h:763
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
#define jpsi
tuple cout
Definition: gather_cfg.py:121
void set(reco::Candidate &c) const
set up a candidate

Member Data Documentation

edm::InputTag PatJPsiProducer::muonSrc_
private

Definition at line 63 of file PatJPsiProducer.cc.

Referenced by produce().