CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/CommonTools/ParticleFlow/interface/PFCandidateSelectorDefinition.h

Go to the documentation of this file.
00001 #ifndef CommonTools_ParticleFlow_PFCandidateSelectorDefinition
00002 #define CommonTools_ParticleFlow_PFCandidateSelectorDefinition
00003 
00004 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
00005 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
00006 #include "boost/iterator/transform_iterator.hpp"
00007 #include <functional>
00008 
00009 namespace pf2pat {
00010 
00011   class PFCandidateSelectorDefinition {
00012 
00013   public:
00014     typedef reco::PFCandidateCollection collection;
00015     typedef edm::Handle< collection > HandleToCollection;
00016     typedef std::vector<reco::PFCandidate>  container;
00017     
00018     struct Pointer : public std::unary_function<reco::PFCandidate,const reco::PFCandidate *> { 
00019       const reco::PFCandidate * operator()(const reco::PFCandidate &c) const { return &c; } 
00020     };
00021     
00022     typedef boost::transform_iterator<Pointer,container::const_iterator> const_iterator;
00023     
00024     PFCandidateSelectorDefinition () {}
00025     
00026     const_iterator begin() const { return const_iterator(selected_.begin()); }
00027     
00028     const_iterator end() const { return const_iterator(selected_.end()); }
00029     
00030     size_t size() const { return selected_.size(); }
00031     
00032     const container& selected() const {return selected_;}
00033     
00034   protected:
00035     container selected_;
00036   };
00037 }
00038 
00039 #endif