CMS 3D CMS Logo

PdgIdExcluder.h
Go to the documentation of this file.
1 #ifndef CommonTools_Utils_PdgIdExcluder_h
2 #define CommonTools_Utils_PdgIdExcluder_h
3 /* \class PdgIdExcluder
4  *
5  * \author Luca Lista, INFN
6  *
7  * $Id: PdgIdExcluder.h,v 1.1 2009/02/24 15:01:17 llista Exp $
8  */
9 #include <vector>
10 #include <algorithm>
11 
12 struct PdgIdExcluder {
13  PdgIdExcluder( const std::vector<int> & pdgId ) {
14  for( std::vector<int>::const_iterator i = pdgId.begin(); i != pdgId.end(); ++ i )
15  pdgId_.push_back( abs( * i ) );
16  begin_ = pdgId_.begin();
17  end_ = pdgId_.end();
18  }
20  pdgId_( o.pdgId_ ), begin_( pdgId_.begin() ), end_( pdgId_.end() ) { }
22  * this = o; return * this;
23  }
24  template<typename T>
25  bool operator()( const T & t ) const {
26  return std::find( begin_, end_, abs( t.pdgId() ) ) == end_;
27  }
28  private:
29  std::vector<int> pdgId_;
30  std::vector<int>::const_iterator begin_, end_;
31 };
32 
33 #endif
bool operator()(const T &t) const
Definition: PdgIdExcluder.h:25
std::vector< int > pdgId_
Definition: PdgIdExcluder.h:29
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
PdgIdExcluder & operator=(const PdgIdExcluder &o)
Definition: PdgIdExcluder.h:21
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define end
Definition: vmac.h:39
PdgIdExcluder(const PdgIdExcluder &o)
Definition: PdgIdExcluder.h:19
#define begin
Definition: vmac.h:32
PdgIdExcluder(const std::vector< int > &pdgId)
Definition: PdgIdExcluder.h:13
std::vector< int >::const_iterator end_
Definition: PdgIdExcluder.h:30
long double T
std::vector< int >::const_iterator begin_
Definition: PdgIdExcluder.h:30