CMS 3D CMS Logo

ChargedCandidateConverter.h
Go to the documentation of this file.
1 #ifndef RecoBTag_FeatureTools_ChargedCandidateConverter_h
2 #define RecoBTag_FeatureTools_ChargedCandidateConverter_h
3 
7 
11 
12 namespace btagbtvdeep {
13 
14  template <typename CandidateType>
15  void commonCandidateToFeatures(const CandidateType* c_pf,
16  const reco::Jet& jet,
17  const TrackInfoBuilder& track_info,
18  const float& drminpfcandsv,
19  const float& jetR,
20  ChargedCandidateFeatures& c_pf_features,
21  const bool flip = false) {
22  float trackSip2dVal = track_info.getTrackSip2dVal();
23  float trackSip2dSig = track_info.getTrackSip2dSig();
24  float trackSip3dVal = track_info.getTrackSip3dVal();
25  float trackSip3dSig = track_info.getTrackSip3dSig();
26  if (flip == true) {
31  }
32 
33  c_pf_features.deltaR = reco::deltaR(*c_pf, jet);
34  c_pf_features.ptrel = catch_infs_and_bound(c_pf->pt() / jet.pt(), 0, -1, 0, -1);
35  c_pf_features.ptrel_noclip = c_pf->pt() / jet.pt();
36  c_pf_features.erel = c_pf->energy() / jet.energy();
37  const float etasign = jet.eta() > 0 ? 1 : -1;
38  c_pf_features.etarel = etasign * (c_pf->eta() - jet.eta());
39 
40  c_pf_features.btagPf_trackEtaRel = catch_infs_and_bound(track_info.getTrackEtaRel(), 0, -5, 15);
41  c_pf_features.btagPf_trackPtRel = catch_infs_and_bound(track_info.getTrackPtRel(), 0, -1, 4);
42  c_pf_features.btagPf_trackPPar = catch_infs_and_bound(track_info.getTrackPPar(), 0, -1e5, 1e5);
43  c_pf_features.btagPf_trackDeltaR = catch_infs_and_bound(track_info.getTrackDeltaR(), 0, -5, 5);
44  c_pf_features.btagPf_trackPtRatio = catch_infs_and_bound(track_info.getTrackPtRatio(), 0, -1, 10);
45  c_pf_features.btagPf_trackPParRatio = catch_infs_and_bound(track_info.getTrackPParRatio(), 0, -10, 100);
48  c_pf_features.btagPf_trackSip2dVal = catch_infs_and_bound(trackSip2dVal, 0, -1, 70);
50  c_pf_features.btagPf_trackJetDistVal = catch_infs_and_bound(track_info.getTrackJetDistVal(), 0, -20, 1);
51 
52  c_pf_features.drminsv = catch_infs_and_bound(drminpfcandsv, 0, -1. * jetR, 0, -1. * jetR);
53 
54  std::pair<float, float> drSubjetFeatures = getDRSubjetFeatures(jet, c_pf);
55  c_pf_features.drsubjet1 = drSubjetFeatures.first;
56  c_pf_features.drsubjet2 = drSubjetFeatures.second;
57  }
58 
60  const pat::Jet& jet,
61  const TrackInfoBuilder& track_info,
62  const float drminpfcandsv,
63  const float jetR,
64  ChargedCandidateFeatures& c_pf_features,
65  const bool flip = false);
66 
68  const reco::Jet& jet,
69  const TrackInfoBuilder& track_info,
70  const float drminpfcandsv,
71  const float jetR,
72  const float puppiw,
73  const int pv_ass_quality,
74  const reco::VertexRef& pv,
75  ChargedCandidateFeatures& c_pf_features,
76  const bool flip = false);
77 
78 } // namespace btagbtvdeep
79 
80 #endif //RecoBTag_FeatureTools_ChargedCandidateConverter_h
const float getTrackJetDistVal() const
const float getTrackSip3dVal() const
Base class for all types of Jets.
Definition: Jet.h:20
const float getTrackDeltaR() const
std::pair< float, float > getDRSubjetFeatures(const reco::Jet &jet, const reco::Candidate *cand)
const float getTrackPParRatio() const
const float getTrackPtRatio() const
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
const float getTrackSip2dVal() const
const float getTrackPtRel() const
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)
const float getTrackSip3dSig() const
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
const float getTrackSip2dSig() const
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
const float getTrackPPar() const
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)
const float getTrackEtaRel() const