CMS 3D CMS Logo

ChargedCandidateConverter.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  ChargedCandidateFeatures& c_pf_features,
13  const bool flip,
14  const float distminpfcandsv) {
16  c_pf, jet, track_info, isWeightedJet, drminpfcandsv, jetR, puppiw, c_pf_features, flip, distminpfcandsv);
17 
18  c_pf_features.vtx_ass = c_pf->pvAssociationQuality();
19 
20  c_pf_features.puppiw = puppiw;
21 
22  // if PackedCandidate does not have TrackDetails this gives an Exception
23  // because unpackCovariance might be called for pseudoTrack/bestTrack
24  if (c_pf->hasTrackDetails()) {
25  const auto& pseudo_track = c_pf->pseudoTrack();
26  c_pf_features.chi2 = catch_infs_and_bound(pseudo_track.normalizedChi2(), 300, -1, 300);
27  // this returns the quality enum not a mask.
28  c_pf_features.quality = pseudo_track.qualityMask();
29  } else {
30  // default negative chi2 and loose track if notTrackDetails
31  c_pf_features.chi2 = catch_infs_and_bound(-1, 300, -1, 300);
32  c_pf_features.quality = (1 << reco::TrackBase::loose);
33  }
34 
35  c_pf_features.dxy = catch_infs(c_pf->dxy());
36  c_pf_features.dz = catch_infs(c_pf->dz());
37  c_pf_features.dxysig = c_pf->bestTrack() ? catch_infs(c_pf->dxy() / c_pf->dxyError()) : 0;
38  c_pf_features.dzsig = c_pf->bestTrack() ? catch_infs(c_pf->dz() / c_pf->dzError()) : 0;
39  }
40 
42  const reco::Jet& jet,
43  const TrackInfoBuilder& track_info,
44  const bool isWeightedJet,
45  const float drminpfcandsv,
46  const float jetR,
47  const float puppiw,
48  const int pv_ass_quality,
49  const reco::VertexRef& pv,
50  ChargedCandidateFeatures& c_pf_features,
51  const bool flip,
52  const float distminpfcandsv) {
54  c_pf, jet, track_info, isWeightedJet, drminpfcandsv, jetR, puppiw, c_pf_features, flip, distminpfcandsv);
55 
56  c_pf_features.vtx_ass = vtx_ass_from_pfcand(*c_pf, pv_ass_quality, pv);
57  c_pf_features.puppiw = puppiw;
58 
59  const auto& pseudo_track = (c_pf->bestTrack()) ? *c_pf->bestTrack() : reco::Track();
60  c_pf_features.chi2 = catch_infs_and_bound(std::floor(pseudo_track.normalizedChi2()), 300, -1, 300);
61  c_pf_features.quality = quality_from_pfcand(*c_pf);
62 
63  // To be implemented if FatJet tag becomes RECO compatible
64  // const auto *trk =
65  // float dz =
66  // float dxy =
67 
68  // c_pf_features.dxy =
69  // c_pf_features.dz =
70  // c_pf_features.dxysig =
71  // c_pf_features.dzsig =
72  }
73 
74 } // namespace btagbtvdeep
float quality_from_pfcand(const reco::PFCandidate &pfcand)
const float catch_infs(const float in, const float replace_value=0.)
Definition: deep_helpers.cc:35
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:44
const PVAssociationQuality pvAssociationQuality() const
float dzError() const override
uncertainty on dz
float vtx_ass_from_pfcand(const reco::PFCandidate &pfcand, int pv_ass_quality, const reco::VertexRef &pv)
float dxyError() const override
uncertainty on dxy
const reco::Track * bestTrack() const override
return a pointer to the track if present. otherwise, return a null pointer
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
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 float dxy() const
dxy with respect to the PV ref
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
virtual const reco::Track & pseudoTrack() const
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.