File indexing completed on 2024-04-06 12:04:36
0001 #include "DataFormats/L1TParticleFlow/interface/PFCandidate.h"
0002
0003 l1t::PFCandidate::PFCandidate(
0004 ParticleType kind, int charge, const PolarLorentzVector& p, float puppiWeight, int hwpt, int hweta, int hwphi)
0005 : L1Candidate(p, hwpt, hweta, hwphi, int(kind)),
0006 dxy_(0),
0007 puppiWeight_(puppiWeight),
0008 caloEta_(0),
0009 caloPhi_(0),
0010 hwZ0_(0),
0011 hwDxy_(0),
0012 hwTkQuality_(0),
0013 hwPuppiWeight_(0),
0014 hwEmID_(0),
0015 encodedPuppi64_(0) {
0016 setCharge(charge);
0017 setPdgIdFromParticleType(charge, kind);
0018 }
0019
0020 void l1t::PFCandidate::setPdgIdFromParticleType(int charge, ParticleType kind) {
0021 switch (kind) {
0022 case ChargedHadron:
0023 setPdgId(charge > 0 ? 211 : -211);
0024 break;
0025 case Electron:
0026 setPdgId(charge > 0 ? -11 : +11);
0027 break;
0028 case NeutralHadron:
0029 setPdgId(130);
0030 break;
0031 case Photon:
0032 setPdgId(22);
0033 break;
0034 case Muon:
0035 setPdgId(charge > 0 ? -13 : +13);
0036 break;
0037 };
0038 }