Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#ifndef CommonTools_CandUtils_pdgIdUtils_h
#define CommonTools_CandUtils_pdgIdUtils_h
#include "DataFormats/Candidate/interface/Candidate.h"

namespace reco {

  inline bool isElectron(const Candidate& part) { return abs(part.pdgId()) == 11; }

  inline bool isMuon(const Candidate& part) { return abs(part.pdgId()) == 13; }

  inline bool isTau(const Candidate& part) { return abs(part.pdgId()) == 15; }

  inline bool isLepton(const Candidate& part) {
    return abs(part.pdgId()) == 11 || abs(part.pdgId()) == 13 || abs(part.pdgId()) == 15;
  }

  inline bool isNeutrino(const Candidate& part) {
    return abs(part.pdgId()) == 12 || abs(part.pdgId()) == 14 || abs(part.pdgId()) == 16;
  }

  inline int flavour(const Candidate& part) {
    int id = part.pdgId();
    return id / abs(id);
  }

}  // namespace reco

#endif