CMS 3D CMS Logo

NeutralCandidateConverter.h
Go to the documentation of this file.
1 #ifndef RecoBTag_FeatureTools_NeutralCandidateConverter_h
2 #define RecoBTag_FeatureTools_NeutralCandidateConverter_h
3 
6 
11 
12 namespace btagbtvdeep {
13 
15  const pat::Jet& jet,
16  const float drminpfcandsv,
17  const float jetR,
18  NeutralCandidateFeatures& n_pf_features);
19 
21  const reco::Jet& jet,
22  const float drminpfcandsv,
23  const float jetR,
24  const float puppiw,
25  NeutralCandidateFeatures& n_pf_features);
26 
27  template <typename CandidateType>
28  static void commonCandidateToFeatures(const CandidateType* n_pf,
29  const reco::Jet& jet,
30  const float& drminpfcandsv,
31  const float& jetR,
32  NeutralCandidateFeatures& n_pf_features) {
33  std::pair<float, float> drSubjetFeatures = getDRSubjetFeatures(jet, n_pf);
34  n_pf_features.drsubjet1 = drSubjetFeatures.first;
35  n_pf_features.drsubjet2 = drSubjetFeatures.second;
36 
37  // Jet relative vars
38  n_pf_features.ptrel = catch_infs_and_bound(n_pf->pt() / jet.pt(), 0, -1, 0, -1);
39  n_pf_features.ptrel_noclip = n_pf->pt() / jet.pt();
40  n_pf_features.deltaR = catch_infs_and_bound(reco::deltaR(*n_pf, jet), 0, -0.6, 0, -0.6);
41  n_pf_features.deltaR_noclip = reco::deltaR(*n_pf, jet);
42  n_pf_features.erel = n_pf->energy() / jet.energy();
43  n_pf_features.isGamma = 0;
44  if (std::abs(n_pf->pdgId()) == 22)
45  n_pf_features.isGamma = 1;
46 
47  n_pf_features.drminsv = catch_infs_and_bound(drminpfcandsv, 0, -1. * jetR, 0, -1. * jetR);
48  }
49 
50 } // namespace btagbtvdeep
51 
52 #endif //RecoBTag_FeatureTools_NeutralCandidateConverter_h
Base class for all types of Jets.
Definition: Jet.h:20
std::pair< float, float > getDRSubjetFeatures(const reco::Jet &jet, const reco::Candidate *cand)
const float catch_infs_and_bound(const float in, const float replace_value, const float lowerbound, const float upperbound, const float offset=0., const bool use_offsets=true)
Definition: deep_helpers.cc:30
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
void packedCandidateToFeatures(const pat::PackedCandidate *c_pf, const pat::Jet &jet, const TrackInfoBuilder &track_info, const float drminpfcandsv, const float jetR, ChargedCandidateFeatures &c_pf_features, const bool flip=false)
void recoCandidateToFeatures(const reco::PFCandidate *c_pf, const reco::Jet &jet, const TrackInfoBuilder &track_info, const float drminpfcandsv, const float jetR, const float puppiw, const int pv_ass_quality, const reco::VertexRef &pv, ChargedCandidateFeatures &c_pf_features, const bool flip=false)
Analysis-level calorimeter jet class.
Definition: Jet.h:77
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
void commonCandidateToFeatures(const CandidateType *c_pf, const reco::Jet &jet, const TrackInfoBuilder &track_info, const float &drminpfcandsv, const float &jetR, ChargedCandidateFeatures &c_pf_features, const bool flip=false)