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  c_pf_features.dxy = catch_infs(c_pf->dxy());
32  c_pf_features.dz = catch_infs(c_pf->dz());
33  c_pf_features.dxysig = c_pf->bestTrack() ? catch_infs(c_pf->dxy() / c_pf->dxyError()) : 0;
34  c_pf_features.dzsig = c_pf->bestTrack() ? catch_infs(c_pf->dz() / c_pf->dzError()) : 0;
35  }
36 
38  const reco::Jet& jet,
39  const TrackInfoBuilder& track_info,
40  const float drminpfcandsv,
41  const float jetR,
42  const float puppiw,
43  const int pv_ass_quality,
44  const reco::VertexRef& pv,
45  ChargedCandidateFeatures& c_pf_features,
46  const bool flip) {
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 } // 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:788
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:37
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
btagbtvdeep::ChargedCandidateFeatures::dz
float dz
Definition: ChargedCandidateFeatures.h:32
btagbtvdeep::ChargedCandidateFeatures::dxy
float dxy
Definition: ChargedCandidateFeatures.h:30
LHEJetFilter_cfi.jetR
jetR
Definition: LHEJetFilter_cfi.py:5
btagbtvdeep::ChargedCandidateFeatures::vtx_ass
float vtx_ass
Definition: ChargedCandidateFeatures.h:13
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:730
pat::PackedCandidate::dzError
float dzError() const override
uncertainty on dz
Definition: PackedCandidate.h:761
edm::Ref< VertexCollection >
pat::Jet
Analysis-level calorimeter jet class.
Definition: Jet.h:77
btagbtvdeep::ChargedCandidateFeatures::quality
float quality
Definition: ChargedCandidateFeatures.h:37
btagbtvdeep::ChargedCandidateFeatures::dzsig
float dzsig
Definition: ChargedCandidateFeatures.h:33
pfNegativeDeepFlavourTagInfos_cfi.flip
flip
Definition: pfNegativeDeepFlavourTagInfos_cfi.py:8
btagbtvdeep::ChargedCandidateFeatures::puppiw
float puppiw
Definition: ChargedCandidateFeatures.h:12
pat::PackedCandidate::bestTrack
const reco::Track * bestTrack() const override
return a pointer to the track if present. otherwise, return a null pointer
Definition: PackedCandidate.h:780
pat::PackedCandidate::dz
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
Definition: PackedCandidate.h:746
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:773
pat::PackedCandidate::puppiWeight
float puppiWeight() const
Definition: PackedCandidate.cc:380
pat::PackedCandidate
Definition: PackedCandidate.h:22
btagbtvdeep::catch_infs
const float catch_infs(const float in, const float replace_value=0.)
Definition: deep_helpers.cc:20
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
btagbtvdeep::ChargedCandidateFeatures::chi2
float chi2
Definition: ChargedCandidateFeatures.h:36
pat::PackedCandidate::dxy
virtual float dxy() const
dxy with respect to the PV ref
Definition: PackedCandidate.h:741
ChargedCandidateConverter.h
btagbtvdeep::ChargedCandidateFeatures
Definition: ChargedCandidateFeatures.h:6
metsig::jet
Definition: SignAlgoResolutions.h:47
pat::PackedCandidate::dxyError
float dxyError() const override
uncertainty on dxy
Definition: PackedCandidate.h:766
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:150
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
btagbtvdeep::ChargedCandidateFeatures::dxysig
float dxysig
Definition: ChargedCandidateFeatures.h:31