Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:49:56

0001 #ifndef CommonTools_CandUtils_pdgIdUtils_h
0002 #define CommonTools_CandUtils_pdgIdUtils_h
0003 #include "DataFormats/Candidate/interface/Candidate.h"
0004 
0005 namespace reco {
0006 
0007   inline bool isElectron(const Candidate& part) { return abs(part.pdgId()) == 11; }
0008 
0009   inline bool isMuon(const Candidate& part) { return abs(part.pdgId()) == 13; }
0010 
0011   inline bool isTau(const Candidate& part) { return abs(part.pdgId()) == 15; }
0012 
0013   inline bool isLepton(const Candidate& part) {
0014     return abs(part.pdgId()) == 11 || abs(part.pdgId()) == 13 || abs(part.pdgId()) == 15;
0015   }
0016 
0017   inline bool isNeutrino(const Candidate& part) {
0018     return abs(part.pdgId()) == 12 || abs(part.pdgId()) == 14 || abs(part.pdgId()) == 16;
0019   }
0020 
0021   inline int flavour(const Candidate& part) {
0022     int id = part.pdgId();
0023     return id / abs(id);
0024   }
0025 
0026 }  // namespace reco
0027 
0028 #endif