CMS 3D CMS Logo

pdgIdUtils.h
Go to the documentation of this file.
1 #ifndef CommonTools_CandUtils_pdgIdUtils_h
2 #define CommonTools_CandUtils_pdgIdUtils_h
4 
5 namespace reco {
6 
7  inline bool isElectron(const Candidate & part) {
8  return abs(part.pdgId())==11;
9  }
10 
11  inline bool isMuon(const Candidate & part) {
12  return abs(part.pdgId())==13;
13  }
14 
15  inline bool isTau(const Candidate & part) {
16  return abs(part.pdgId())==15;
17  }
18 
19  inline bool isLepton(const Candidate & part) {
20  return abs(part.pdgId())==11 ||
21  abs(part.pdgId())==13 ||
22  abs(part.pdgId())==15;
23  }
24 
25  inline bool isNeutrino(const Candidate & part) {
26  return abs(part.pdgId())==12 ||
27  abs(part.pdgId())==14 ||
28  abs(part.pdgId())==16;
29  }
30 
31  inline int flavour(const Candidate & part) {
32  int id = part.pdgId();
33  return id/abs(id);
34  }
35 
36 }
37 
38 #endif
bool isMuon(const Candidate &part)
Definition: pdgIdUtils.h:11
bool isLepton(const Candidate &part)
Definition: pdgIdUtils.h:19
bool isNeutrino(const Candidate &part)
Definition: pdgIdUtils.h:25
bool isElectron(const Candidate &part)
Definition: pdgIdUtils.h:7
virtual int pdgId() const =0
PDG identifier.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
part
Definition: HCALResponse.h:20
fixed size matrix
int flavour(const Candidate &part)
Definition: pdgIdUtils.h:31
bool isTau(const Candidate &part)
Definition: pdgIdUtils.h:15