CMS 3D CMS Logo

SecondaryVertexConverter.cc
Go to the documentation of this file.
3 
7 
9 
10 namespace btagbtvdeep {
11 
13  const reco::Vertex& pv,
14  const reco::Jet& jet,
15  SecondaryVertexFeatures& sv_features,
16  const bool flip) {
17  math::XYZVector jet_dir = jet.momentum().Unit();
18  sv_features.pt = sv.pt();
19  sv_features.ptrel = sv.pt() / jet.pt();
20  sv_features.etarel = catch_infs_and_bound(std::fabs(sv.eta() - jet.eta()) - 0.5, 0, -2, 0);
21  sv_features.phirel = catch_infs_and_bound(std::fabs(reco::deltaPhi(sv.phi(), jet.phi())) - 0.5, 0, -2, 0);
22  sv_features.eta = sv.eta();
23  sv_features.phi = sv.phi();
24  sv_features.e = sv.energy();
25  sv_features.px = sv.px();
26  sv_features.py = sv.py();
27  sv_features.pz = sv.pz();
28  sv_features.deltaR = catch_infs_and_bound(std::fabs(reco::deltaR(sv, jet_dir)) - 0.5, 0, -2, 0);
29  sv_features.mass = sv.mass();
30  sv_features.ntracks = sv.numberOfDaughters();
31  sv_features.chi2 = sv.vertexChi2();
32  sv_features.normchi2 = catch_infs_and_bound(sv_features.chi2 / sv.vertexNdof(), 1000, -1000, 1000);
33  const auto& dxy_meas = vertexDxy(sv, pv);
34  sv_features.dxy = dxy_meas.value();
35  sv_features.dxysig = catch_infs_and_bound(dxy_meas.value() / dxy_meas.error(), 0, -1, 800);
36  const auto& d3d_meas = vertexD3d(sv, pv);
37  sv_features.d3d = d3d_meas.value();
38  sv_features.d3dsig = catch_infs_and_bound(d3d_meas.value() / d3d_meas.error(), 0, -1, 800);
39  sv_features.costhetasvpv = (flip ? -1.f : 1.f) * vertexDdotP(sv, pv);
40  sv_features.enratio = sv.energy() / jet.energy();
41  }
42 
43 } // namespace btagbtvdeep
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
float vertexDdotP(const reco::VertexCompositePtrCandidate &sv, const reco::Vertex &pv)
Definition: deep_helpers.cc:78
Measurement1D vertexD3d(const reco::VertexCompositePtrCandidate &svcand, const reco::Vertex &pv)
Definition: deep_helpers.cc:69
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:43
Measurement1D vertexDxy(const reco::VertexCompositePtrCandidate &svcand, const reco::Vertex &pv)
Definition: deep_helpers.cc:60
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
void svToFeatures(const reco::VertexCompositePtrCandidate &sv, const reco::Vertex &pv, const reco::Jet &jet, SecondaryVertexFeatures &sv_features, const bool flip=false)