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 Attributes
RecoMuonFromPFProducer Class Reference

Produces a collection of reco::Muons referred to by the PFCandidates of type muons in a collection of PFCandidates. More...

#include <RecoMuonFromPFProducer.h>

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

Public Member Functions

virtual void beginJob ()
 
virtual void beginRun (edm::Run &, const edm::EventSetup &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 RecoMuonFromPFProducer (const edm::ParameterSet &)
 
 ~RecoMuonFromPFProducer ()
 
- 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 Attributes

edm::InputTag inputTagPF_
 
bool verbose_
 verbose ? More...
 

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

Produces a collection of reco::Muons referred to by the PFCandidates of type muons in a collection of PFCandidates.

Definition at line 23 of file RecoMuonFromPFProducer.h.

Constructor & Destructor Documentation

RecoMuonFromPFProducer::RecoMuonFromPFProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 20 of file RecoMuonFromPFProducer.cc.

References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

20  {
21 
23  = iConfig.getParameter<InputTag>("particles");
24 
25  verbose_ =
26  iConfig.getUntrackedParameter<bool>("verbose",false);
27 
28  // register products
29  produces<reco::MuonCollection>();
30 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
RecoMuonFromPFProducer::~RecoMuonFromPFProducer ( )

Definition at line 34 of file RecoMuonFromPFProducer.cc.

34 {}

Member Function Documentation

void RecoMuonFromPFProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 38 of file RecoMuonFromPFProducer.cc.

38 {}
void RecoMuonFromPFProducer::beginRun ( edm::Run run,
const edm::EventSetup es 
)
virtual

Reimplemented from edm::EDProducer.

Definition at line 41 of file RecoMuonFromPFProducer.cc.

42  {}
void RecoMuonFromPFProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 47 of file RecoMuonFromPFProducer.cc.

References gather_cfg::cout, edm::Event::getByLabel(), edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::isAvailable(), reco::PFCandidate::mu, reco::PFCandidate::muonRef(), reco::PFCandidate::particleId(), reco::tau::pfCandidates(), and edm::Event::put().

48  {
49 
50 
51  std::auto_ptr< reco::MuonCollection >
52  pOutput( new reco::MuonCollection);
53 
55  iEvent.getByLabel( inputTagPF_, pfCandidates);
56 
57  typedef reco::PFCandidateCollection::const_iterator IP;
58  for (IP ip=pfCandidates->begin(); ip !=pfCandidates->end(); ++ip ) {
59 
60  const reco::PFCandidate& cand = *ip;
61  if( cand.particleId() == reco::PFCandidate::mu) {
62  if( !cand.muonRef().isAvailable() ) {
63  cout<<cand.muonRef().id()<<endl;
64  LogError("RecoMuonFromPFProducer")<<"reference to reco::Muon not available for muon PFCandidate "<<cand<<endl;
65 
66  assert( false );
67  }
68 
69  pOutput->push_back( *(cand.muonRef()) );
70  }
71  }
72 
73  iEvent.put(pOutput);
74 
75 }
bool isAvailable() const
Definition: Ref.h:275
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
reco::MuonRef muonRef() const
Definition: PFCandidate.cc:347
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:33
tuple cout
Definition: gather_cfg.py:41
ProductID id() const
Accessor for product ID.
Definition: Ref.h:255
virtual ParticleType particleId() const
Definition: PFCandidate.h:314

Member Data Documentation

edm::InputTag RecoMuonFromPFProducer::inputTagPF_
private

Definition at line 34 of file RecoMuonFromPFProducer.h.

bool RecoMuonFromPFProducer::verbose_
private

verbose ?

Definition at line 37 of file RecoMuonFromPFProducer.h.