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 float drminpfcandsv,
9  const float jetR,
10  ChargedCandidateFeatures& c_pf_features,
11  const bool flip) {
12  commonCandidateToFeatures(c_pf, jet, track_info, drminpfcandsv, jetR, c_pf_features, flip);
13 
14  c_pf_features.vtx_ass = c_pf->pvAssociationQuality();
15 
16  c_pf_features.puppiw = c_pf->puppiWeight();
17 
18  // if PackedCandidate does not have TrackDetails this gives an Exception
19  // because unpackCovariance might be called for pseudoTrack/bestTrack
20  if (c_pf->hasTrackDetails()) {
21  const auto& pseudo_track = c_pf->pseudoTrack();
22  c_pf_features.chi2 = catch_infs_and_bound(pseudo_track.normalizedChi2(), 300, -1, 300);
23  // this returns the quality enum not a mask.
24  c_pf_features.quality = pseudo_track.qualityMask();
25  } else {
26  // default negative chi2 and loose track if notTrackDetails
27  c_pf_features.chi2 = catch_infs_and_bound(-1, 300, -1, 300);
28  c_pf_features.quality = (1 << reco::TrackBase::loose);
29  }
30  }
31 
33  const reco::Jet& jet,
34  const TrackInfoBuilder& track_info,
35  const float drminpfcandsv,
36  const float jetR,
37  const float puppiw,
38  const int pv_ass_quality,
39  const reco::VertexRef& pv,
40  ChargedCandidateFeatures& c_pf_features,
41  const bool flip) {
42  commonCandidateToFeatures(c_pf, jet, track_info, drminpfcandsv, jetR, c_pf_features, flip);
43 
44  c_pf_features.vtx_ass = vtx_ass_from_pfcand(*c_pf, pv_ass_quality, pv);
45  c_pf_features.puppiw = puppiw;
46 
47  const auto& pseudo_track = (c_pf->bestTrack()) ? *c_pf->bestTrack() : reco::Track();
48  c_pf_features.chi2 = catch_infs_and_bound(std::floor(pseudo_track.normalizedChi2()), 300, -1, 300);
49  c_pf_features.quality = quality_from_pfcand(*c_pf);
50  }
51 
52 } // namespace btagbtvdeep
btagbtvdeep
Definition: BoostedDoubleSVTagInfoFeatures.h:4
pat::PackedCandidate::hasTrackDetails
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
Definition: PackedCandidate.h:787
btagbtvdeep::recoCandidateToFeatures
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)
Definition: ChargedCandidateConverter.cc:32
reco::Jet
Base class for all types of Jets.
Definition: Jet.h:20
btagbtvdeep::commonCandidateToFeatures
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)
Definition: ChargedCandidateConverter.h:15
reco::TrackBase::loose
Definition: TrackBase.h:152
LHEJetFilter_cfi.jetR
jetR
Definition: LHEJetFilter_cfi.py:5
btagbtvdeep::ChargedCandidateFeatures::vtx_ass
float vtx_ass
Definition: ChargedCandidateFeatures.h:10
btagbtvdeep::TrackInfoBuilder
Definition: TrackInfoBuilder.h:12
btagbtvdeep::packedCandidateToFeatures
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)
Definition: ChargedCandidateConverter.cc:5
pat::PackedCandidate::pvAssociationQuality
const PVAssociationQuality pvAssociationQuality() const
Definition: PackedCandidate.h:729
edm::Ref< VertexCollection >
pat::Jet
Analysis-level calorimeter jet class.
Definition: Jet.h:77
btagbtvdeep::ChargedCandidateFeatures::quality
float quality
Definition: ChargedCandidateFeatures.h:26
pfNegativeDeepFlavourTagInfos_cfi.flip
flip
Definition: pfNegativeDeepFlavourTagInfos_cfi.py:8
btagbtvdeep::ChargedCandidateFeatures::puppiw
float puppiw
Definition: ChargedCandidateFeatures.h:9
reco::Track
Definition: Track.h:27
btagbtvdeep::catch_infs_and_bound
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:32
btagbtvdeep::vtx_ass_from_pfcand
float vtx_ass_from_pfcand(const reco::PFCandidate &pfcand, int pv_ass_quality, const reco::VertexRef &pv)
Definition: deep_helpers.cc:90
pat::PackedCandidate::pseudoTrack
virtual const reco::Track & pseudoTrack() const
Definition: PackedCandidate.h:772
pat::PackedCandidate::puppiWeight
float puppiWeight() const
Definition: PackedCandidate.cc:380
pat::PackedCandidate
Definition: PackedCandidate.h:22
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
btagbtvdeep::ChargedCandidateFeatures::chi2
float chi2
Definition: ChargedCandidateFeatures.h:25
ChargedCandidateConverter.h
btagbtvdeep::ChargedCandidateFeatures
Definition: ChargedCandidateFeatures.h:6
metsig::jet
Definition: SignAlgoResolutions.h:47
btagbtvdeep::quality_from_pfcand
float quality_from_pfcand(const reco::PFCandidate &pfcand)
Definition: deep_helpers.cc:98
reco::PFCandidate::bestTrack
const reco::Track * bestTrack() const override
Definition: PFCandidate.h:149
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40