Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:49:58

0001 #ifndef CommonTools_ParticleFlow_PFCandidateSelectorDefinition
0002 #define CommonTools_ParticleFlow_PFCandidateSelectorDefinition
0003 
0004 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
0005 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0006 #include "boost/iterator/transform_iterator.hpp"
0007 
0008 namespace pf2pat {
0009 
0010   class PFCandidateSelectorDefinition {
0011   public:
0012     typedef reco::PFCandidateCollection collection;
0013     typedef edm::Handle<collection> HandleToCollection;
0014     typedef std::vector<reco::PFCandidate> container;
0015 
0016     struct Pointer {
0017       const reco::PFCandidate* operator()(const reco::PFCandidate& c) const { return &c; }
0018     };
0019 
0020     typedef boost::transform_iterator<Pointer, container::const_iterator> const_iterator;
0021 
0022     PFCandidateSelectorDefinition() {}
0023 
0024     const_iterator begin() const { return const_iterator(selected_.begin()); }
0025 
0026     const_iterator end() const { return const_iterator(selected_.end()); }
0027 
0028     size_t size() const { return selected_.size(); }
0029 
0030     const container& selected() const { return selected_; }
0031 
0032   protected:
0033     container selected_;
0034   };
0035 }  // namespace pf2pat
0036 
0037 #endif