CMS 3D CMS Logo

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"

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

◆ operator()()

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

Definition at line 18 of file PFCandidateFwdPtrFactory.h.

18  {
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  }

References mps_fire::i, edm::Ptr< T >::isAvailable(), edm::Ptr< T >::isNonnull(), reco::PFCandidate::numberOfSourceCandidatePtrs(), edm::View< T >::ptrAt(), and reco::PFCandidate::sourceCandidatePtr().

mps_fire.i
i
Definition: mps_fire.py:428
reco::PFCandidate::sourceCandidatePtr
CandidatePtr sourceCandidatePtr(size_type i) const override
Definition: PFCandidate.h:124
edm::FwdPtr
Definition: FwdPtr.h:40
edm::Ptr
Definition: AssociationVector.h:31
reco::PFCandidate::numberOfSourceCandidatePtrs
size_t numberOfSourceCandidatePtrs() const override
Definition: PFCandidate.h:122
edm::Ptr::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
edm::Ptr::isAvailable
bool isAvailable() const
Definition: Ptr.h:230
edm::View::ptrAt
Ptr< value_type > ptrAt(size_type i) const