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  explicit PdgIdExcluder(const std::vector<int>& pdgId) {
14  pdgId_.reserve(pdgId.size());
15  for (int i : pdgId) {
16  pdgId_.push_back(abs(i));
17  }
18  }
19  template <typename T>
20  bool operator()(const T& t) const {
21  return std::find(pdgId_.begin(), pdgId_.end(), abs(t.pdgId())) == pdgId_.end();
22  }
23 
24 private:
25  std::vector<int> pdgId_;
26 };
27 
28 #endif
std::vector< int > pdgId_
Definition: PdgIdExcluder.h:25
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool operator()(const T &t) const
Definition: PdgIdExcluder.h:20
PdgIdExcluder(const std::vector< int > &pdgId)
Definition: PdgIdExcluder.h:13
long double T