Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:24:26

0001 #include "RecoBTag/FeatureTools/interface/NeutralCandidateConverter.h"
0002 
0003 namespace btagbtvdeep {
0004 
0005   void packedCandidateToFeatures(const pat::PackedCandidate* n_pf,
0006                                  const pat::Jet& jet,
0007                                  const bool isWeightedJet,
0008                                  const float drminpfcandsv,
0009                                  const float jetR,
0010                                  const float puppiw,
0011                                  NeutralCandidateFeatures& n_pf_features) {
0012     commonCandidateToFeatures(n_pf, jet, isWeightedJet, drminpfcandsv, jetR, puppiw, n_pf_features);
0013 
0014     n_pf_features.hadFrac = n_pf->hcalFraction();
0015     n_pf_features.puppiw = puppiw;
0016   }
0017 
0018   void recoCandidateToFeatures(const reco::PFCandidate* n_pf,
0019                                const reco::Jet& jet,
0020                                const bool isWeightedJet,
0021                                const float drminpfcandsv,
0022                                const float jetR,
0023                                const float puppiw,
0024                                NeutralCandidateFeatures& n_pf_features) {
0025     commonCandidateToFeatures(n_pf, jet, isWeightedJet, drminpfcandsv, jetR, puppiw, n_pf_features);
0026     n_pf_features.puppiw = puppiw;
0027 
0028     // need to get a value map and more stuff to do properly
0029     // otherwise will be different than for PackedCandidates
0030     // https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/PatAlgos/python/slimming/packedPFCandidates_cfi.py
0031     if (abs(n_pf->pdgId()) == 1 || abs(n_pf->pdgId()) == 130) {
0032       n_pf_features.hadFrac = n_pf->hcalEnergy() / (n_pf->ecalEnergy() + n_pf->hcalEnergy());
0033     } else {
0034       n_pf_features.hadFrac = 0;
0035     }
0036   }
0037 
0038 }  // namespace btagbtvdeep