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  }
33 
35  const reco::Jet & jet,
36  const TrackInfoBuilder & track_info,
37  const float drminpfcandsv, const float jetR, const float puppiw,
38  const int pv_ass_quality,
39  const reco::VertexRef & pv,
40  ChargedCandidateFeatures & c_pf_features,
41  const bool flip) {
42 
43  commonCandidateToFeatures(c_pf, jet, track_info, drminpfcandsv, jetR, c_pf_features, flip);
44 
45  c_pf_features.vtx_ass = vtx_ass_from_pfcand(*c_pf, pv_ass_quality, pv);
46  c_pf_features.puppiw = puppiw;
47 
48  const auto & pseudo_track = (c_pf->bestTrack()) ? *c_pf->bestTrack() : reco::Track();
49  c_pf_features.chi2 = catch_infs_and_bound(std::floor(pseudo_track.normalizedChi2()),300,-1,300);
50  c_pf_features.quality = quality_from_pfcand(*c_pf);
51 
52  }
53 
54 }
55 
float puppiWeight() const
Set both weights at once (with option for only full PUPPI)
float quality_from_pfcand(const reco::PFCandidate &pfcand)
Base class for all types of Jets.
Definition: Jet.h:20
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:6
virtual const reco::Track & pseudoTrack() const
Return reference to a pseudo track made with candidate kinematics, parameterized error for eta...
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
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