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) { return abs(part.pdgId()) == 11; }
8 
9  inline bool isMuon(const Candidate& part) { return abs(part.pdgId()) == 13; }
10 
11  inline bool isTau(const Candidate& part) { return abs(part.pdgId()) == 15; }
12 
13  inline bool isLepton(const Candidate& part) {
14  return abs(part.pdgId()) == 11 || abs(part.pdgId()) == 13 || abs(part.pdgId()) == 15;
15  }
16 
17  inline bool isNeutrino(const Candidate& part) {
18  return abs(part.pdgId()) == 12 || abs(part.pdgId()) == 14 || abs(part.pdgId()) == 16;
19  }
20 
21  inline int flavour(const Candidate& part) {
22  int id = part.pdgId();
23  return id / abs(id);
24  }
25 
26 } // namespace reco
27 
28 #endif
bool isMuon(const Candidate &part)
Definition: pdgIdUtils.h:9
bool isLepton(const Candidate &part)
Definition: pdgIdUtils.h:13
bool isNeutrino(const Candidate &part)
Definition: pdgIdUtils.h:17
bool isElectron(const Candidate &part)
Definition: pdgIdUtils.h:7
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:21
bool isTau(const Candidate &part)
Definition: pdgIdUtils.h:11