CMS 3D CMS Logo

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