CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CommonTools/Utils/interface/PdgIdExcluder.h

Go to the documentation of this file.
00001 #ifndef CommonTools_Utils_PdgIdExcluder_h
00002 #define CommonTools_Utils_PdgIdExcluder_h
00003 /* \class PdgIdExcluder
00004  *
00005  * \author Luca Lista, INFN
00006  *
00007  * $Id: PdgIdExcluder.h,v 1.2 2009/09/04 12:37:20 hegner Exp $
00008  */
00009 #include <vector>
00010 #include <algorithm>
00011 
00012 struct PdgIdExcluder {
00013   PdgIdExcluder( const std::vector<int> & pdgId ) { 
00014     for( std::vector<int>::const_iterator i = pdgId.begin(); i != pdgId.end(); ++ i )
00015       pdgId_.push_back( abs( * i ) );
00016     begin_ = pdgId_.begin();
00017     end_ = pdgId_.end();
00018   }
00019   PdgIdExcluder( const PdgIdExcluder & o ) :
00020     pdgId_( o.pdgId_ ), begin_( pdgId_.begin() ), end_( pdgId_.end() ) { }
00021   PdgIdExcluder & operator=( const PdgIdExcluder & o ) {
00022     * this = o; return * this;
00023   }
00024   template<typename T>
00025   bool operator()( const T & t ) const { 
00026     return std::find( begin_, end_, abs( t.pdgId() ) ) == end_;
00027   }
00028   private:
00029   std::vector<int> pdgId_;
00030   std::vector<int>::const_iterator begin_, end_;
00031 };
00032 
00033 #endif