test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
reco::PFCandidateFwdPtrFactory Class Reference

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"

Inheritance diagram for reco::PFCandidateFwdPtrFactory:

Public Member Functions

edm::FwdPtr< reco::PFCandidateoperator() (edm::View< reco::PFCandidate > const &view, unsigned int i) const
 

Detailed Description

Creates a FwdPtr<PFCandidate> from an input PFCandidate. If the PFCandidate has a valid sourceCandidatePtr, that is used for the FwdPtr's "backPtr".

Author
Salvatore Rappoccio

Definition at line 17 of file PFCandidateFwdPtrFactory.h.

Member Function Documentation

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

19  {
21  edm::Ptr<reco::PFCandidate> backPtr = ptr;
22  if ( ptr.isNonnull() && ptr.isAvailable() && ptr->numberOfSourceCandidatePtrs() > 0 ) {
23  edm::Ptr<reco::Candidate> basePtr = ptr->sourceCandidatePtr(0);
24  if (basePtr.isNonnull() && basePtr.isAvailable())
25  backPtr = edm::Ptr<reco::PFCandidate>( basePtr );//this cast works only for available stuff
26  }
27  return edm::FwdPtr<reco::PFCandidate>(ptr,backPtr);
28  }
int i
Definition: DBlmapReader.cc:9
Ptr< value_type > ptrAt(size_type i) const
bool isAvailable() const
Definition: Ptr.h:259
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:169