CMS 3D CMS Logo

MuonTypeByOrCut.cc
Go to the documentation of this file.
4 
6 {
7 public:
9 
10  result_type operator()(const reco::MuonPtr&) const final;
11  CandidateType candidateType() const final { return MUON; }
12  double value(const reco::CandidatePtr&) const final;
13 
14 private:
15  unsigned int type_;
16 };
18 
19 // Define constructors and initialization routines
22  type_(0)
23 {
24  const auto muonTypes = c.getParameter<std::vector<std::string> >("types");
25  for ( auto x : muonTypes )
26  {
27  std::transform(x.begin(), x.end(), x.begin(), ::tolower);
28  if ( x == "globalmuon" ) type_ |= reco::Muon::GlobalMuon;
29  else if ( x == "trackermuon" ) type_ |= reco::Muon::TrackerMuon;
30  else if ( x == "standalonemuon" ) type_ |= reco::Muon::StandAloneMuon;
31  else if ( x == "calomuon" ) type_ |= reco::Muon::CaloMuon;
32  else if ( x == "pfmuon" ) type_ |= reco::Muon::PFMuon;
33  else if ( x == "rpcmuon" ) type_ |= reco::Muon::RPCMuon;
34  }
35 }
36 
37 // Functors for evaluation
39 {
40  return (muon->type() & type_) != 0;
41 }
42 
44 {
45  const reco::MuonPtr muon(cand);
46  return muon->type() & type_;
47 }
T getParameter(std::string const &) const
static const unsigned int GlobalMuon
Definition: Muon.h:276
result_type operator()(const reco::MuonPtr &) const final
unsigned int type_
double value(const reco::CandidatePtr &) const final
MuonTypeByOrCut(const edm::ParameterSet &c)
CandidateType candidateType() const final
static const unsigned int RPCMuon
Definition: Muon.h:281
static const unsigned int TrackerMuon
Definition: Muon.h:277
static const unsigned int PFMuon
Definition: Muon.h:280
static const unsigned int CaloMuon
Definition: Muon.h:279
unsigned int type() const
Definition: Muon.h:286
#define DEFINE_EDM_PLUGIN(factory, type, name)
static const unsigned int StandAloneMuon
Definition: Muon.h:278