CMS 3D CMS Logo

PFCandidateFwdPtrFactory.h
Go to the documentation of this file.
1 #ifndef CommonTools_ParticleFlow_PFCandidateFwdPtrFactory_h
2 #define CommonTools_ParticleFlow_PFCandidateFwdPtrFactory_h
3 
15 
16 namespace reco {
19  edm::Ptr<reco::PFCandidate> ptr = view.ptrAt(i);
20  edm::Ptr<reco::PFCandidate> backPtr = ptr;
21  if (ptr.isNonnull() && ptr.isAvailable() && ptr->numberOfSourceCandidatePtrs() > 0) {
23  if (basePtr.isNonnull() && basePtr.isAvailable())
24  backPtr = edm::Ptr<reco::PFCandidate>(basePtr); //this cast works only for available stuff
25  }
26  return edm::FwdPtr<reco::PFCandidate>(ptr, backPtr);
27  }
28  };
29 } // namespace reco
30 
31 #endif
bool isAvailable() const
Definition: Ptr.h:232
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
fixed size matrix
edm::FwdPtr< reco::PFCandidate > operator()(edm::View< reco::PFCandidate > const &view, unsigned int i) const
Creates a FwdPtr<PFCandidate> from an input PFCandidate. If the PFCandidate has a valid sourceCandida...
CandidatePtr sourceCandidatePtr(size_type i) const override
Definition: PFCandidate.h:124
size_t numberOfSourceCandidatePtrs() const override
Definition: PFCandidate.h:122