File indexing completed on 2024-04-06 12:01:05
0001 #ifndef CommonTools_ParticleFlow_PFCandidateWithSrcPtrFactor_h
0002 #define CommonTools_ParticleFlow_PFCandidateWithSrcPtrFactor_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0013 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
0014
0015 namespace reco {
0016 class PFCandidateWithSrcPtrFactory {
0017 public:
0018 reco::PFCandidate operator()(edm::FwdPtr<reco::PFCandidate> const& input) const {
0019 reco::PFCandidate output(*input);
0020
0021 if (input.backPtr().isAvailable())
0022 output.setSourceCandidatePtr(input.backPtr());
0023 else
0024 output.setSourceCandidatePtr(input.ptr());
0025 return output;
0026 }
0027 };
0028 }
0029
0030 #endif