CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RecoMuonFromPFProducer.cc
Go to the documentation of this file.
3 
4 #include <sstream>
5 
6 using namespace std;
7 
8 using namespace boost;
9 
10 using namespace edm;
11 
14 
17 
18 
19 
21 
22  inputTagPF_
23  = iConfig.getParameter<InputTag>("particles");
24 
25  verbose_ =
26  iConfig.getUntrackedParameter<bool>("verbose",false);
27 
28  // register products
29  produces<reco::MuonCollection>();
30 }
31 
32 
33 
35 
36 
37 void
39 
40 void
42  const edm::EventSetup & es) {}
43 
44 
45 
46 void
48  const EventSetup& iSetup) {
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 }
76 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
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)
virtual void produce(edm::Event &, const edm::EventSetup &)
int iEvent
Definition: GenABIO.cc:243
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
virtual void beginRun(edm::Run &, const edm::EventSetup &)
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:33
RecoMuonFromPFProducer(const edm::ParameterSet &)
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
Definition: Run.h:32
Produces a collection of reco::Muons referred to by the PFCandidates of type muons in a collection of...