From ee07dfe9ece1e2aa3b5ca1dfa194b3d7715cf4a5 Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Fri, 8 Jun 2018 11:20:53 +0200 Subject: [PATCH] switch to reco::deltaR and remove type specifications --- RecoBTag/TensorFlow/interface/SecondaryVertexConverter.h | 2 +- RecoBTag/TensorFlow/plugins/DeepFlavourTagInfoProducer.cc | 6 ++++-- .../python/pfNegativeDeepFlavourTagInfos_cfi.py | 6 +++--- RecoBTag/TensorFlow/src/SecondaryVertexConverter.cc | 8 ++------ 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/RecoBTag/TensorFlow/interface/SecondaryVertexConverter.h b/RecoBTag/TensorFlow/interface/SecondaryVertexConverter.h index eb12325fe7799..cd5eda1fecd12 100644 --- a/RecoBTag/TensorFlow/interface/SecondaryVertexConverter.h +++ b/RecoBTag/TensorFlow/interface/SecondaryVertexConverter.h @@ -14,7 +14,7 @@ namespace btagbtvdeep { void svToFeatures( const reco::VertexCompositePtrCandidate & sv, const reco::Vertex & pv, const reco::Jet & jet, SecondaryVertexFeatures & sv_features, - const bool flip_ = false) ; + const bool flip = false) ; } diff --git a/RecoBTag/TensorFlow/plugins/DeepFlavourTagInfoProducer.cc b/RecoBTag/TensorFlow/plugins/DeepFlavourTagInfoProducer.cc index 17068364213e0..eee80348b943f 100644 --- a/RecoBTag/TensorFlow/plugins/DeepFlavourTagInfoProducer.cc +++ b/RecoBTag/TensorFlow/plugins/DeepFlavourTagInfoProducer.cc @@ -218,7 +218,7 @@ void DeepFlavourTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSet { return btagbtvdeep::sv_vertex_comparator(sva, svb, pv); }); // fill features from secondary vertices for (const auto & sv : svs_sorted) { - if (Geom::deltaR(sv.position() - pv.position(), flip_ ? -jet_dir : jet_dir) > jet_radius_) continue; + if (reco::deltaR2(sv.position() - pv.position(), flip_ ? -jet_dir : jet_dir) > (jet_radius_*jet_radius_)) continue; else { features.sv_features.emplace_back(); // in C++17 could just get from emplace_back output @@ -276,7 +276,9 @@ void DeepFlavourTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSet const edm::Provenance *prov = shallow_tag_infos.provenance(); const edm::ParameterSet& psetFromProvenance = edm::parameterSet(*prov); - double negative_cut = (( psetFromProvenance.getParameter("computer") ).getParameter("trackSelection")).getParameter("sip3dSigMax"); + double negative_cut = ( ( psetFromProvenance.getParameter("computer") + ).getParameter("trackSelection") + ).getParameter("sip3dSigMax"); for (unsigned int i = 0; i < jet.numberOfDaughters(); i++){ diff --git a/RecoBTag/TensorFlow/python/pfNegativeDeepFlavourTagInfos_cfi.py b/RecoBTag/TensorFlow/python/pfNegativeDeepFlavourTagInfos_cfi.py index 7758126cbf1fb..cdda7a5720050 100644 --- a/RecoBTag/TensorFlow/python/pfNegativeDeepFlavourTagInfos_cfi.py +++ b/RecoBTag/TensorFlow/python/pfNegativeDeepFlavourTagInfos_cfi.py @@ -3,7 +3,7 @@ from RecoBTag.TensorFlow.pfDeepFlavourTagInfos_cfi import pfDeepFlavourTagInfos pfNegativeDeepFlavourTagInfos = pfDeepFlavourTagInfos.clone( - shallow_tag_infos = cms.InputTag('pfDeepCSVNegativeTagInfos'), - secondary_vertices = cms.InputTag('inclusiveCandidateNegativeSecondaryVertices'), - flip = cms.bool(True) + shallow_tag_infos = 'pfDeepCSVNegativeTagInfos', + secondary_vertices = 'inclusiveCandidateNegativeSecondaryVertices', + flip = True ) diff --git a/RecoBTag/TensorFlow/src/SecondaryVertexConverter.cc b/RecoBTag/TensorFlow/src/SecondaryVertexConverter.cc index b4e757b32c819..01bab93f452e9 100644 --- a/RecoBTag/TensorFlow/src/SecondaryVertexConverter.cc +++ b/RecoBTag/TensorFlow/src/SecondaryVertexConverter.cc @@ -17,7 +17,7 @@ namespace btagbtvdeep { math::XYZVector jet_dir = jet.momentum().Unit(); sv_features.pt = sv.pt(); - sv_features.deltaR = catch_infs_and_bound(std::fabs(Geom::deltaR(sv.position() - pv.position(), flip ? -jet_dir : jet_dir))-0.5, + sv_features.deltaR = catch_infs_and_bound(std::fabs(reco::deltaR(sv.position() - pv.position(), flip ? -jet_dir : jet_dir))-0.5, 0,-2,0); sv_features.mass = sv.mass(); sv_features.ntracks = sv.numberOfDaughters(); @@ -32,11 +32,7 @@ namespace btagbtvdeep { sv_features.d3d = d3d_meas.value(); sv_features.d3dsig = catch_infs_and_bound(d3d_meas.value()/d3d_meas.error(), 0,-1,800); - float costhetasvpv = vertexDdotP(sv,pv); - if(flip){ - costhetasvpv = -costhetasvpv; - } - sv_features.costhetasvpv = costhetasvpv; + sv_features.costhetasvpv = (flip ? -1.f : 1.f)* vertexDdotP(sv,pv); sv_features.enratio = sv.energy()/jet.energy(); }