Creates a FwdPtr<PFCandidate> from an input PFCandidate. If the PFCandidate has a valid sourceCandidatePtr, that is used for the FwdPtr's "backPtr". More...
#include <CommonTools/ParticleFlow/interface/PFCandidateFwdPtrFactory.h>
Public Member Functions | |
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 sourceCandidatePtr, that is used for the FwdPtr's "backPtr".
Definition at line 17 of file PFCandidateFwdPtrFactory.h.
edm::FwdPtr<reco::PFCandidate> reco::PFCandidateFwdPtrFactory::operator() | ( | edm::View< reco::PFCandidate > const & | view, |
unsigned int | i | ||
) | const [inline] |
Definition at line 19 of file PFCandidateFwdPtrFactory.h.
References edm::Ptr< T >::isAvailable(), edm::Ptr< T >::isNonnull(), and edm::View< T >::ptrAt().
{ edm::Ptr<reco::PFCandidate> ptr = view.ptrAt(i); edm::Ptr<reco::PFCandidate> backPtr = ptr; if ( ptr.isNonnull() && ptr.isAvailable() && ptr->numberOfSourceCandidatePtrs() > 0 ) { edm::Ptr<reco::Candidate> basePtr = ptr->sourceCandidatePtr(0); if (basePtr.isNonnull() && basePtr.isAvailable()) backPtr = edm::Ptr<reco::PFCandidate>( basePtr );//this cast works only for available stuff } return edm::FwdPtr<reco::PFCandidate>(ptr,backPtr); }