Main Page
Namespaces
Classes
Package Documentation
CommonTools
ParticleFlow
interface
PFCandidateFwdPtrFactory.h
Go to the documentation of this file.
1
#ifndef CommonTools_ParticleFlow_PFCandidateFwdPtrFactory_h
2
#define CommonTools_ParticleFlow_PFCandidateFwdPtrFactory_h
3
13
#include "
DataFormats/ParticleFlowCandidate/interface/PFCandidate.h
"
14
#include "
DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h
"
15
16
namespace
reco
{
17
class
PFCandidateFwdPtrFactory
:
public
std::binary_function<edm::FwdPtr<reco::PFCandidate>, edm::View<reco::PFCandidate>, unsigned int > {
18
public
:
19
edm::FwdPtr<reco::PFCandidate>
operator()
(
edm::View<reco::PFCandidate>
const
& view,
unsigned
int
i
)
const
{
20
edm::Ptr<reco::PFCandidate>
ptr = view.
ptrAt
(i);
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
}
29
30
};
31
}
32
33
#endif
mps_fire.i
i
Definition:
mps_fire.py:156
edm::View::ptrAt
Ptr< value_type > ptrAt(size_type i) const
edm::Ptr::isAvailable
bool isAvailable() const
Definition:
Ptr.h:258
reco::PFCandidate::numberOfSourceCandidatePtrs
size_t numberOfSourceCandidatePtrs() const
Definition:
PFCandidate.h:127
reco::PFCandidateFwdPtrFactory
Creates a FwdPtr<PFCandidate> from an input PFCandidate. If the PFCandidate has a valid sourceCandida...
Definition:
PFCandidateFwdPtrFactory.h:17
reco::PFCandidate::sourceCandidatePtr
CandidatePtr sourceCandidatePtr(size_type i) const
Definition:
PFCandidate.h:131
edm::View< reco::PFCandidate >
PFCandidate.h
edm::Ptr
Definition:
AssociationVector.h:30
edm::Ptr::isNonnull
bool isNonnull() const
Checks for non-null.
Definition:
Ptr.h:168
reco::PFCandidateFwdPtrFactory::operator()
edm::FwdPtr< reco::PFCandidate > operator()(edm::View< reco::PFCandidate > const &view, unsigned int i) const
Definition:
PFCandidateFwdPtrFactory.h:19
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:43
PFCandidateFwd.h
edm::FwdPtr
Definition:
FwdPtr.h:40
Generated for CMSSW Reference Manual by
1.8.11