Skip to content

Commit

Permalink
switch to reco::deltaR and remove type specifications
Browse files Browse the repository at this point in the history
  • Loading branch information
emilbols committed Jun 8, 2018
1 parent 1cbf72a commit b626752
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion RecoBTag/TensorFlow/interface/SecondaryVertexConverter.h
Expand Up @@ -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) ;


}
Expand Down
6 changes: 4 additions & 2 deletions RecoBTag/TensorFlow/plugins/DeepFlavourTagInfoProducer.cc
Expand Up @@ -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
Expand Down Expand Up @@ -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<edm::ParameterSet>("computer") ).getParameter<edm::ParameterSet>("trackSelection")).getParameter<double>("sip3dSigMax");
double negative_cut = ( ( psetFromProvenance.getParameter<edm::ParameterSet>("computer")
).getParameter<edm::ParameterSet>("trackSelection")
).getParameter<double>("sip3dSigMax");

for (unsigned int i = 0; i < jet.numberOfDaughters(); i++){

Expand Down
Expand Up @@ -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
)
8 changes: 2 additions & 6 deletions RecoBTag/TensorFlow/src/SecondaryVertexConverter.cc
Expand Up @@ -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();
Expand All @@ -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();

}
Expand Down

0 comments on commit b626752

Please sign in to comment.