CMS 3D CMS Logo

LostTracksConverter.cc
Go to the documentation of this file.
2 
3 namespace btagbtvdeep {
4 
6  const pat::Jet& jet,
7  const TrackInfoBuilder& track_info,
8  const bool isWeightedJet,
9  const float drminpfcandsv,
10  const float jetR,
11  const float puppiw,
12  LostTracksFeatures& lt_features,
13  const bool flip,
14  const float distminpfcandsv) {
16  c_pf, jet, track_info, isWeightedJet, drminpfcandsv, jetR, puppiw, lt_features, flip, distminpfcandsv);
17 
18  lt_features.puppiw = puppiw;
19  lt_features.charge = c_pf->charge();
20 
21  lt_features.lostInnerHits = catch_infs(c_pf->lostInnerHits(), 2);
22  lt_features.numberOfPixelHits = catch_infs(c_pf->numberOfPixelHits(), -1);
23  lt_features.numberOfStripHits = catch_infs(c_pf->stripLayersWithMeasurement(), -1);
24 
25  // if PackedCandidate does not have TrackDetails this gives an Exception
26  // because unpackCovariance might be called for pseudoTrack/bestTrack
27  if (c_pf->hasTrackDetails()) {
28  const auto& pseudo_track = c_pf->pseudoTrack();
29  lt_features.chi2 = catch_infs_and_bound(pseudo_track.normalizedChi2(), 300, -1, 300);
30  // this returns the quality enum not a mask.
31  lt_features.quality = pseudo_track.qualityMask();
32  } else {
33  // default negative chi2 and loose track if notTrackDetails
34  lt_features.chi2 = catch_infs_and_bound(-1, 300, -1, 300);
35  lt_features.quality = (1 << reco::TrackBase::loose);
36  }
37  }
39  const reco::Jet& jet,
40  const TrackInfoBuilder& track_info,
41  const bool isWeightedJet,
42  const float drminpfcandsv,
43  const float jetR,
44  const float puppiw,
45  const int pv_ass_quality,
46  const reco::VertexRef& pv,
47  LostTracksFeatures& lt_features,
48  const bool flip,
49  const float distminpfcandsv) {
51  c_pf, jet, track_info, isWeightedJet, drminpfcandsv, jetR, puppiw, lt_features, flip, distminpfcandsv);
52 
53  lt_features.puppiw = puppiw;
54 
55  const auto& pseudo_track = (c_pf->bestTrack()) ? *c_pf->bestTrack() : reco::Track();
56  lt_features.chi2 = catch_infs_and_bound(std::floor(pseudo_track.normalizedChi2()), 300, -1, 300);
57  lt_features.quality = quality_from_pfcand(*c_pf);
58  }
59 
60 } // namespace btagbtvdeep
float quality_from_pfcand(const reco::PFCandidate &pfcand)
int charge() const override
electric charge
const float catch_infs(const float in, const float replace_value=0.)
Definition: deep_helpers.cc:34
int numberOfPixelHits() const
const reco::Track * bestTrack() const override
Definition: PFCandidate.h:150
Base class for all types of Jets.
Definition: Jet.h:20
void packedCandidateToFeatures(const pat::PackedCandidate *c_pf, const pat::Jet &jet, const TrackInfoBuilder &track_info, const bool isWeightedJet, const float drminpfcandsv, const float jetR, const float puppiw, ChargedCandidateFeatures &c_pf_features, const bool flip=false, const float distminpfcandsv=0)
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:43
int stripLayersWithMeasurement() const
void commonCandidateToFeatures(const CandidateType *c_pf, const reco::Jet &jet, const TrackInfoBuilder &track_info, const bool &isWeightedJet, const float &drminpfcandsv, const float &jetR, const float &puppiw, ChargedCandidateFeatures &c_pf_features, const bool flip=false, const float &distminpfcandsv=0)
Analysis-level calorimeter jet class.
Definition: Jet.h:77
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
LostInnerHits lostInnerHits() const
void recoCandidateToFeatures(const reco::PFCandidate *c_pf, const reco::Jet &jet, const TrackInfoBuilder &track_info, const bool isWeightedJet, 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, const float distminpfcandsv=0)
virtual const reco::Track & pseudoTrack() const
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.