CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/CommonTools/ParticleFlow/interface/PtMinPFCandidateSelectorDefinition.h

Go to the documentation of this file.
00001 #ifndef CommonTools_ParticleFlow_PtMinPFCandidateSelectorDefinition
00002 #define CommonTools_ParticleFlow_PtMinPFCandidateSelectorDefinition
00003 
00004 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
00005 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
00006 #include "CommonTools/ParticleFlow/interface/PFCandidateSelectorDefinition.h"
00007 
00008 namespace pf2pat {
00009 
00010   class PtMinPFCandidateSelectorDefinition : public PFCandidateSelectorDefinition {
00011     
00012   public:
00013     PtMinPFCandidateSelectorDefinition ( const edm::ParameterSet & cfg ) :
00014       ptMin_( cfg.getParameter< double >( "ptMin" ) ) { }
00015     
00016     
00017     void select( const HandleToCollection & hc, 
00018                  const edm::EventBase & e,
00019                  const edm::EventSetup& s
00020                  ) {
00021       selected_.clear();
00022     
00023       assert( hc.isValid() );
00024     
00025     
00026       unsigned key=0;
00027       for( collection::const_iterator pfc = hc->begin(); 
00028            pfc != hc->end(); ++pfc, ++key) {
00029 
00030         if( pfc->pt() > ptMin_ ) {
00031           selected_.push_back( reco::PFCandidate(*pfc) );
00032           reco::PFCandidatePtr ptrToMother( hc, key );
00033           selected_.back().setSourceCandidatePtr( ptrToMother );
00034 
00035         }
00036       }
00037     }
00038 
00039 /*     const container& selected() const {return selected_;} */
00040 
00041     private:
00042       double ptMin_;
00043   };
00044 
00045 }
00046 
00047 #endif