Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-10 01:50:16

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, /*hwQuality=*/int(kind)),
0006       dxy_(0),
0007       puppiWeight_(puppiWeight),
0008       hwZ0_(0),
0009       hwDxy_(0),
0010       hwTkQuality_(0),
0011       hwPuppiWeight_(0),
0012       hwEmID_(0),
0013       encodedPuppi64_(0) {
0014   setCharge(charge);
0015   setPdgIdFromParticleType(charge, kind);
0016 }
0017 
0018 void l1t::PFCandidate::setPdgIdFromParticleType(int charge, ParticleType kind) {
0019   switch (kind) {
0020     case ChargedHadron:
0021       setPdgId(charge > 0 ? 211 : -211);
0022       break;
0023     case Electron:
0024       setPdgId(charge > 0 ? -11 : +11);
0025       break;
0026     case NeutralHadron:
0027       setPdgId(130);
0028       break;
0029     case Photon:
0030       setPdgId(22);
0031       break;
0032     case Muon:
0033       setPdgId(charge > 0 ? -13 : +13);
0034       break;
0035   };
0036 }