CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PdgIdSelector.h
Go to the documentation of this file.
1 #ifndef CommonTools_Utils_PdgIdSelector_h
2 #define CommonTools_Utils_PdgIdSelector_h
3 /* \class PdgIdSelector
4  *
5  * \author Luca Lista, INFN
6  *
7  * $Id: PdgIdSelector.h,v 1.4 2007/11/14 10:14:21 llista Exp $
8  */
9 #include <vector>
10 #include <algorithm>
11 
12 struct PdgIdSelector {
13  PdgIdSelector( 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
PdgIdSelector(const PdgIdSelector &o)
Definition: PdgIdSelector.h:19
int i
Definition: DBlmapReader.cc:9
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define end
Definition: vmac.h:37
PdgIdSelector & operator==(const PdgIdSelector &o)
Definition: PdgIdSelector.h:21
bool operator()(const T &t) const
Definition: PdgIdSelector.h:25
PdgIdSelector(const std::vector< int > &pdgId)
Definition: PdgIdSelector.h:13
#define begin
Definition: vmac.h:30
std::vector< int >::const_iterator end_
Definition: PdgIdSelector.h:30
std::vector< int >::const_iterator begin_
Definition: PdgIdSelector.h:30
long double T
std::vector< int > pdgId_
Definition: PdgIdSelector.h:29