From 71182688b3bf102b40de7c027bbcbc7043602651 Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Tue, 3 Apr 2018 15:24:42 +0200 Subject: [PATCH 01/16] Fix of the DeepCSV Negative Tagger, and introduction of DeepFlavour Negative Tag definition --- .../PatAlgos/python/tools/jetTools.py | 57 +++++++++++++++-- RecoBTag/Combined/python/deepFlavour_cff.py | 4 +- .../plugins/ChargedCandidateConverter.h | 32 +++++++--- .../plugins/DeepFlavourTagInfoProducer.cc | 24 ++++--- RecoBTag/DeepFlavour/plugins/SVConverter.h | 17 +++-- .../pfNegativeDeepFlavourTagInfos_cfi.py | 3 +- .../interface/CombinedSVComputer.h | 22 +++++-- .../TemplatedSecondaryVertexProducer.cc | 3 +- ...condaryVertexFinderNegativeTagInfos_cfi.py | 1 + .../plugins/InclusiveVertexFinder.h | 6 +- .../python/inclusiveNegativeVertexing_cff.py | 62 +++++++++++++++++++ 11 files changed, 190 insertions(+), 41 deletions(-) create mode 100644 RecoVertex/AdaptiveVertexFinder/python/inclusiveNegativeVertexing_cff.py diff --git a/PhysicsTools/PatAlgos/python/tools/jetTools.py b/PhysicsTools/PatAlgos/python/tools/jetTools.py index a60dc5647cd3d..85f3823cb9191 100644 --- a/PhysicsTools/PatAlgos/python/tools/jetTools.py +++ b/PhysicsTools/PatAlgos/python/tools/jetTools.py @@ -322,6 +322,51 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou ## setup all required btagInfos : we give a dedicated treatment for different ## types of tagInfos here. A common treatment is possible but might require a more ## general approach anyway in coordination with the btagging POG. + + runNegativeVertexing = False + runNegativeCvsLVertexing = False + for btagInfo in requiredTagInfos: + if btagInfo == 'pfInclusiveSecondaryVertexFinderNegativeTagInfos' or btagInfo == 'pfNegativeDeepFlavourTagInfos': + runNegativeVertexing = True + if btagInfo == 'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos': + runNegativeCvsLVertexing = True + + if runNegativeVertexing or runNegativeCvsLVertexing: + import RecoVertex.AdaptiveVertexFinder.inclusiveNegativeVertexing_cff as NegVertex + + if runNegativeVertexing: + addToProcessAndTask(btagPrefix+'inclusiveCandidateNegativeVertexFinder'+labelName+postfix, + NegVertex.inclusiveCandidateNegativeVertexFinder.clone(primaryVertices = pvSource,tracks=pfCandidates), + process, task) + addToProcessAndTask(btagPrefix+'candidateNegativeVertexMerger'+labelName+postfix, + NegVertex.candidateNegativeVertexMerger.clone(secondaryVertices = cms.InputTag(btagPrefix+'inclusiveCandidateNegativeVertexFinder'+labelName+postfix)), + process, task) + addToProcessAndTask(btagPrefix+'candidateNegativeVertexArbitrator'+labelName+postfix, + NegVertex.candidateNegativeVertexArbitrator.clone( secondaryVertices = cms.InputTag(btagPrefix+'candidateNegativeVertexMerger'+labelName+postfix) + ,primaryVertices = pvSource + ,tracks=pfCandidates), + process, task) + addToProcessAndTask(btagPrefix+'inclusiveCandidateNegativeSecondaryVertices'+labelName+postfix, + NegVertex.inclusiveCandidateNegativeSecondaryVertices.clone(secondaryVertices = cms.InputTag(btagPrefix+'candidateNegativeVertexArbitrator'+labelName+postfix)), + process, task) + + if runNegativeCvsLVertexing: + addToProcessAndTask(btagPrefix+'inclusiveCandidateNegativeVertexFinderCvsL'+labelName+postfix, + NegVertex.inclusiveCandidateNegativeVertexFinderCvsL.clone(primaryVertices = pvSource,tracks=pfCandidates), + process, task) + addToProcessAndTask(btagPrefix+'candidateNegativeVertexMergerCvsL'+labelName+postfix, + NegVertex.candidateNegativeVertexMergerCvsL.clone(secondaryVertices = cms.InputTag(btagPrefix+'inclusiveCandidateNegativeVertexFinderCvsL'+labelName+postfix)), + process, task) + addToProcessAndTask(btagPrefix+'candidateNegativeVertexArbitratorCvsL'+labelName+postfix, + NegVertex.candidateNegativeVertexArbitratorCvsL.clone( secondaryVertices = cms.InputTag(btagPrefix+'candidateNegativeVertexMergerCvsL'+labelName+postfix) + ,primaryVertices = pvSource + ,tracks=pfCandidates), + process, task) + addToProcessAndTask(btagPrefix+'inclusiveCandidateNegativeSecondaryVerticesCvsL'+labelName+postfix, + NegVertex.inclusiveCandidateNegativeSecondaryVerticesCvsL.clone(secondaryVertices = cms.InputTag(btagPrefix+'candidateNegativeVertexArbitratorCvsL'+labelName+postfix)), + process, task) + + acceptedTagInfos = list() for btagInfo in requiredTagInfos: if hasattr(btag,btagInfo): @@ -464,7 +509,7 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos.clone( trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix), - extSVCollection=svSourceCvsL), + extSVCollection = btagPrefix+'inclusiveCandidateNegativeSecondaryVerticesCvsL'+labelName+postfix), process, task) if svClustering or fatJets != cms.InputTag(''): setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) @@ -486,7 +531,7 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderNegativeTagInfos.clone( trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix), - extSVCollection=svSource), + extSVCollection=cms.InputTag(btagPrefix+'inclusiveCandidateNegativeSecondaryVertices'+labelName+postfix)), process, task) if svClustering or fatJets != cms.InputTag(''): setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) @@ -548,12 +593,14 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou process, task) if 'DeepFlavourTagInfos' in btagInfo: - + svUsed = svSource if btagInfo == 'pfNegativeDeepFlavourTagInfos': - deep_csv_tag_infos = 'pfDeepCSVNegativeTagInfos' + deep_csv_tag_infos = 'pfDeepCSVNegativeTagInfos' + svUsed = cms.InputTag(btagPrefix+'inclusiveCandidateNegativeSecondaryVertices'+labelName+postfix) + flip = True else: deep_csv_tag_infos = 'pfDeepCSVTagInfos' - + flip = False # use right input tags when running with RECO PF candidates, which actually # depens of wether jets were slimmed or not (check for s/S-limmed in name) if not ('limmed' in jetSource.value()): diff --git a/RecoBTag/Combined/python/deepFlavour_cff.py b/RecoBTag/Combined/python/deepFlavour_cff.py index a957e40445d15..684a47ed4d594 100644 --- a/RecoBTag/Combined/python/deepFlavour_cff.py +++ b/RecoBTag/Combined/python/deepFlavour_cff.py @@ -15,8 +15,8 @@ ) pfDeepCSVNegativeTagInfos.computer.vertexFlip = True pfDeepCSVNegativeTagInfos.computer.trackFlip = True -pfDeepCSVNegativeTagInfos.computer.trackSelection.sip3dSigMax = 0 -pfDeepCSVNegativeTagInfos.computer.trackPseudoSelection.sip3dSigMax = 0 +pfDeepCSVNegativeTagInfos.computer.trackSelection.sip3dSigMax = 10.0 +pfDeepCSVNegativeTagInfos.computer.trackPseudoSelection.sip3dSigMax = 10.0 pfDeepCSVNegativeTagInfos.computer.trackPseudoSelection.sip2dSigMin = -99999.9 pfDeepCSVNegativeTagInfos.computer.trackPseudoSelection.sip2dSigMax = -2.0 diff --git a/RecoBTag/DeepFlavour/plugins/ChargedCandidateConverter.h b/RecoBTag/DeepFlavour/plugins/ChargedCandidateConverter.h index 993f372ff0628..b656ec5be2977 100644 --- a/RecoBTag/DeepFlavour/plugins/ChargedCandidateConverter.h +++ b/RecoBTag/DeepFlavour/plugins/ChargedCandidateConverter.h @@ -30,7 +30,19 @@ namespace btagbtvdeep { const reco::Jet & jet, const TrackInfoBuilder & track_info, const float & drminpfcandsv, - ChargedCandidateFeatures & c_pf_features) { + ChargedCandidateFeatures & c_pf_features, + const bool flip) { + + float TrackSip2dVal = track_info.getTrackSip2dVal(); + float TrackSip2dSig = track_info.getTrackSip2dSig(); + float TrackSip3dVal = track_info.getTrackSip3dVal(); + float TrackSip3dSig = track_info.getTrackSip3dSig(); + if(flip == true){ + TrackSip2dVal = -1.0*TrackSip2dVal; + TrackSip2dSig = -1.0*TrackSip2dSig; + TrackSip3dSig = -1.0*TrackSip3dSig; + TrackSip3dVal = -1.0*TrackSip3dVal; + } c_pf_features.ptrel = catch_infs_and_bound(c_pf->pt()/jet.pt(), 0,-1,0,-1); @@ -40,10 +52,10 @@ namespace btagbtvdeep { c_pf_features.btagPf_trackPPar =catch_infs_and_bound(track_info.getTrackPPar(), 0,-1e5,1e5 ); c_pf_features.btagPf_trackDeltaR =catch_infs_and_bound(track_info.getTrackDeltaR(), 0,-5,5 ); c_pf_features.btagPf_trackPParRatio =catch_infs_and_bound(track_info.getTrackPParRatio(),0,-10,100); - c_pf_features.btagPf_trackSip3dVal =catch_infs_and_bound(track_info.getTrackSip3dVal(), 0, -1,1e5 ); - c_pf_features.btagPf_trackSip3dSig =catch_infs_and_bound(track_info.getTrackSip3dSig(), 0, -1,4e4 ); - c_pf_features.btagPf_trackSip2dVal =catch_infs_and_bound(track_info.getTrackSip2dVal(), 0, -1,70 ); - c_pf_features.btagPf_trackSip2dSig =catch_infs_and_bound(track_info.getTrackSip2dSig(), 0, -1,4e4 ); + c_pf_features.btagPf_trackSip3dVal =catch_infs_and_bound(TrackSip3dVal, 0, -1,1e5 ); + c_pf_features.btagPf_trackSip3dSig =catch_infs_and_bound(TrackSip3dSig, 0, -1,4e4 ); + c_pf_features.btagPf_trackSip2dVal =catch_infs_and_bound(TrackSip2dVal, 0, -1,70 ); + c_pf_features.btagPf_trackSip2dSig =catch_infs_and_bound(TrackSip2dSig, 0, -1,4e4 ); c_pf_features.btagPf_trackJetDistVal =catch_infs_and_bound(track_info.getTrackJetDistVal(),0,-20,1 ); @@ -56,9 +68,10 @@ namespace btagbtvdeep { const pat::Jet & jet, const TrackInfoBuilder & track_info, const float drminpfcandsv, - ChargedCandidateFeatures & c_pf_features) { + ChargedCandidateFeatures & c_pf_features, + const bool flip) { - CommonCandidateToFeatures(c_pf, jet, track_info, drminpfcandsv, c_pf_features); + CommonCandidateToFeatures(c_pf, jet, track_info, drminpfcandsv, c_pf_features, flip); c_pf_features.vtx_ass = c_pf->pvAssociationQuality(); @@ -85,9 +98,10 @@ namespace btagbtvdeep { const float drminpfcandsv, const float puppiw, const int pv_ass_quality, const reco::VertexRef & pv, - ChargedCandidateFeatures & c_pf_features) { + ChargedCandidateFeatures & c_pf_features, + const bool flip) { - CommonCandidateToFeatures(c_pf, jet, track_info, drminpfcandsv, c_pf_features); + CommonCandidateToFeatures(c_pf, jet, track_info, drminpfcandsv, c_pf_features, flip); c_pf_features.vtx_ass = (float) pat::PackedCandidate::PVAssociationQuality(qualityMap[pv_ass_quality]); if (c_pf->trackRef().isNonnull() && diff --git a/RecoBTag/DeepFlavour/plugins/DeepFlavourTagInfoProducer.cc b/RecoBTag/DeepFlavour/plugins/DeepFlavourTagInfoProducer.cc index 39e9ef29b54d4..988a5b59849ad 100644 --- a/RecoBTag/DeepFlavour/plugins/DeepFlavourTagInfoProducer.cc +++ b/RecoBTag/DeepFlavour/plugins/DeepFlavourTagInfoProducer.cc @@ -18,6 +18,7 @@ #include "DataFormats/BTauReco/interface/DeepFlavourTagInfo.h" #include "DataFormats/BTauReco/interface/DeepFlavourFeatures.h" +#include "DataFormats/GeometryVector/interface/VectorUtil.h" #include "JetConverter.h" #include "BTagConverter.h" @@ -27,7 +28,7 @@ #include "TrackInfoBuilder.h" #include "sorting_modules.h" - +#include "deep_helpers.h" class DeepFlavourTagInfoProducer : public edm::stream::EDProducer<> { @@ -51,6 +52,7 @@ class DeepFlavourTagInfoProducer : public edm::stream::EDProducer<> { const double jet_radius_; const double min_candidate_pt_; + const bool flip_; edm::EDGetTokenT> jet_token_; edm::EDGetTokenT vtx_token_; @@ -71,6 +73,7 @@ class DeepFlavourTagInfoProducer : public edm::stream::EDProducer<> { DeepFlavourTagInfoProducer::DeepFlavourTagInfoProducer(const edm::ParameterSet& iConfig) : jet_radius_(iConfig.getParameter("jet_radius")), min_candidate_pt_(iConfig.getParameter("min_candidate_pt")), + flip_(iConfig.getParameter("flip")), jet_token_(consumes >(iConfig.getParameter("jets"))), vtx_token_(consumes(iConfig.getParameter("vertices"))), sv_token_(consumes(iConfig.getParameter("secondary_vertices"))), @@ -109,6 +112,7 @@ void DeepFlavourTagInfoProducer::fillDescriptions(edm::ConfigurationDescriptions desc.add("shallow_tag_infos", edm::InputTag("pfDeepCSVTagInfos")); desc.add("jet_radius", 0.4); desc.add("min_candidate_pt", 0.95); + desc.add("flip", false); desc.add("vertices", edm::InputTag("offlinePrimaryVertices")); desc.add("puppi_value_map", edm::InputTag("puppi")); desc.add("secondary_vertices", edm::InputTag("inclusiveCandidateSecondaryVertices")); @@ -192,6 +196,11 @@ void DeepFlavourTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSet // fill number of pv features.npv = vtxs->size(); + math::XYZVector jet_dir = jet.momentum().Unit(); + GlobalVector jet_ref_track_dir(jet.px(), + jet.py(), + jet.pz()); + // fill features from ShallowTagInfo const auto & tag_info_vars = tag_info.taggingVariables(); btagbtvdeep::BTagConverter::BTagToFeatures(tag_info_vars, features.tag_info_features); @@ -204,20 +213,16 @@ 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 (reco::deltaR(sv, jet) > jet_radius_) continue; + if (Geom::deltaR(sv.position() - pv.position(), flip_ ? -jet_dir : jet_dir) > jet_radius_) continue; else { features.sv_features.emplace_back(); // in C++17 could just get from emplace_back output auto & sv_features = features.sv_features.back(); - btagbtvdeep::SVConverter::SVToFeatures(sv, pv, jet, sv_features); + btagbtvdeep::SVConverter::SVToFeatures(sv, pv, jet, sv_features, flip_); } } // stuff required for dealing with pf candidates - math::XYZVector jet_dir = jet.momentum().Unit(); - GlobalVector jet_ref_track_dir(jet.px(), - jet.py(), - jet.pz()); std::vector > c_sorted, n_sorted; @@ -300,12 +305,13 @@ void DeepFlavourTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSet auto entry = c_sortedindices.at(i); // get cached track info auto & trackinfo = trackinfos.at(i); + if(flip_ && (trackinfo.getTrackSip3dSig() > 10.0)){continue;} // get_ref to vector element auto & c_pf_features = features.c_pf_features.at(entry); // fill feature structure if (packed_cand) { btagbtvdeep::ChargedCandidateConverter::PackedCandidateToFeatures(packed_cand, jet, trackinfo, - drminpfcandsv, c_pf_features); + drminpfcandsv, c_pf_features, flip_); } else if (reco_cand) { // get vertex association quality int pv_ass_quality = 0; // fallback value @@ -333,7 +339,7 @@ void DeepFlavourTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSet btagbtvdeep::ChargedCandidateConverter::RecoCandidateToFeatures( reco_cand, jet, trackinfo, drminpfcandsv, puppiw, pv_ass_quality, - PV, c_pf_features); + PV, c_pf_features, flip_); } } else { // is neutral candidate diff --git a/RecoBTag/DeepFlavour/plugins/SVConverter.h b/RecoBTag/DeepFlavour/plugins/SVConverter.h index ef05f6322cbcb..0e10aa0530a0e 100644 --- a/RecoBTag/DeepFlavour/plugins/SVConverter.h +++ b/RecoBTag/DeepFlavour/plugins/SVConverter.h @@ -15,12 +15,13 @@ namespace btagbtvdeep { static void SVToFeatures( const reco::VertexCompositePtrCandidate & sv, const reco::Vertex & pv, const reco::Jet & jet, - SecondaryVertexFeatures & sv_features) { - + SecondaryVertexFeatures & sv_features, + const bool flip) { + + math::XYZVector jet_dir = jet.momentum().Unit(); sv_features.pt = sv.pt(); - sv_features.deltaR = catch_infs_and_bound( - std::fabs(reco::deltaR(sv,jet))-0.5, - 0,-2,0); + sv_features.deltaR = catch_infs_and_bound(std::fabs(Geom::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(); sv_features.chi2 = sv.vertexChi2(); @@ -34,7 +35,11 @@ namespace btagbtvdeep { sv_features.d3d = d3d_meas.value(); sv_features.d3dsig = catch_infs_and_bound(d3d_meas.value()/d3d_meas.error(), 0,-1,800); - sv_features.costhetasvpv = vertexDdotP(sv,pv); + float costhetasvpv = vertexDdotP(sv,pv); + if(flip){ + costhetasvpv = -1.0*costhetasvpv; + } + sv_features.costhetasvpv = costhetasvpv; sv_features.enratio = sv.energy()/jet.energy(); } diff --git a/RecoBTag/DeepFlavour/python/pfNegativeDeepFlavourTagInfos_cfi.py b/RecoBTag/DeepFlavour/python/pfNegativeDeepFlavourTagInfos_cfi.py index 5e726155adbf7..990ee0f8211f6 100644 --- a/RecoBTag/DeepFlavour/python/pfNegativeDeepFlavourTagInfos_cfi.py +++ b/RecoBTag/DeepFlavour/python/pfNegativeDeepFlavourTagInfos_cfi.py @@ -3,5 +3,6 @@ from RecoBTag.DeepFlavour.pfDeepFlavourTagInfos_cfi import pfDeepFlavourTagInfos pfNegativeDeepFlavourTagInfos = pfDeepFlavourTagInfos.clone( - shallow_tag_infos = cms.InputTag('pfDeepCSVNegativeTagInfos') + shallow_tag_infos = cms.InputTag('pfDeepCSVNegativeTagInfos'), + flip = cms.bool(True) ) diff --git a/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h b/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h index f4095e6b7e6cd..3792b691f718c 100644 --- a/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h +++ b/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h @@ -143,7 +143,7 @@ void CombinedSVComputer::fillCommonVariables(reco::TaggingVariableList & vars, r vars.insert(btau::flightDistance2dSig,flipValue(svInfo.flightDistance(vtx, 2).significance(),true),true); vars.insert(btau::flightDistance3dVal,flipValue(svInfo.flightDistance(vtx, 3).value(),true),true); vars.insert(btau::flightDistance3dSig,flipValue(svInfo.flightDistance(vtx, 3).significance(),true),true); - vars.insert(btau::vertexJetDeltaR,Geom::deltaR(svInfo.flightDirection(vtx), jetDir),true); + vars.insert(btau::vertexJetDeltaR,Geom::deltaR(svInfo.flightDirection(vtx), vertexFlip ? -jetDir : jetDir),true); vars.insert(btau::jetNSecondaryVertices, svInfo.nVertices(), true); } @@ -245,10 +245,22 @@ void CombinedSVComputer::fillCommonVariables(reco::TaggingVariableList & vars, r vars.insert(btau::trackSumJetDeltaR,VectorUtil::DeltaR(allKinematics.vectorSum(), jetDir), true); vars.insert(btau::trackSumJetEtRatio,allKinematics.vectorSum().Et() / ipInfo.jet()->et(), true); - vars.insert(btau::trackSip3dSigAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.significance(),false),true); - vars.insert(btau::trackSip3dValAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.value(),false),true); - vars.insert(btau::trackSip2dSigAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.significance(),false),true); - vars.insert(btau::trackSip2dValAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.value(),false),true); + float trackSip3dSigAboveCharm = threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.significance(); + float trackSip3dValAboveCharm = threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.value(); + float trackSip2dSigAboveCharm = threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.significance(); + float trackSip2dValAboveCharm = threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.value(); + + if( (trackSip2dValAboveCharm == -1) && (trackSip3dValAboveCharm == -1) && trackFlip ){ + trackSip3dSigAboveCharm = -trackSip3dSigAboveCharm; + trackSip3dValAboveCharm = -trackSip3dValAboveCharm; + trackSip2dSigAboveCharm = -trackSip2dSigAboveCharm; + trackSip2dValAboveCharm = -trackSip2dValAboveCharm; + } + + vars.insert(btau::trackSip3dSigAboveCharm, flipValue(trackSip3dSigAboveCharm,false),true); + vars.insert(btau::trackSip3dValAboveCharm, flipValue(trackSip3dValAboveCharm,false),true); + vars.insert(btau::trackSip2dSigAboveCharm, flipValue(trackSip2dSigAboveCharm,false),true); + vars.insert(btau::trackSip2dValAboveCharm, flipValue(trackSip2dValAboveCharm,false),true); if (vtxType != btag::Vertices::NoVertex) { math::XYZTLorentzVector allSum = useTrackWeights diff --git a/RecoBTag/SecondaryVertex/plugins/TemplatedSecondaryVertexProducer.cc b/RecoBTag/SecondaryVertex/plugins/TemplatedSecondaryVertexProducer.cc index 4437584fbecb5..8cf31cadc10fc 100644 --- a/RecoBTag/SecondaryVertex/plugins/TemplatedSecondaryVertexProducer.cc +++ b/RecoBTag/SecondaryVertex/plugins/TemplatedSecondaryVertexProducer.cc @@ -860,9 +860,10 @@ void TemplatedSecondaryVertexProducer::produce(edm::Event &event, else { for(size_t iExtSv = 0; iExtSv < extSecVertex->size(); iExtSv++){ const VTX & extVertex = (*extSecVertex)[iExtSv]; - if( Geom::deltaR2( ( position(extVertex) - pv.position() ), jetDir ) > extSVDeltaRToJet*extSVDeltaRToJet || extVertex.p4().M() < 0.3 ) + if( Geom::deltaR2( ( position(extVertex) - pv.position() ), (extSVDeltaRToJet > 0) ? jetDir : -jetDir ) > extSVDeltaRToJet*extSVDeltaRToJet || extVertex.p4().M() < 0.3 ) continue; extAssoCollection.push_back( extVertex ); + } } // build combined SV information and filter diff --git a/RecoBTag/SecondaryVertex/python/pfInclusiveSecondaryVertexFinderNegativeTagInfos_cfi.py b/RecoBTag/SecondaryVertex/python/pfInclusiveSecondaryVertexFinderNegativeTagInfos_cfi.py index 2b01017bcb836..56b95a648919f 100644 --- a/RecoBTag/SecondaryVertex/python/pfInclusiveSecondaryVertexFinderNegativeTagInfos_cfi.py +++ b/RecoBTag/SecondaryVertex/python/pfInclusiveSecondaryVertexFinderNegativeTagInfos_cfi.py @@ -4,6 +4,7 @@ pfInclusiveSecondaryVertexFinderNegativeTagInfos = pfInclusiveSecondaryVertexFinderTagInfos.clone() pfInclusiveSecondaryVertexFinderNegativeTagInfos.extSVDeltaRToJet = cms.double(-0.3) +pfInclusiveSecondaryVertexFinderNegativeTagInfos.extSVCollection = cms.InputTag('inclusiveCandidateNegativeSecondaryVertices') pfInclusiveSecondaryVertexFinderNegativeTagInfos.vertexCuts.distVal2dMin = -2.5 pfInclusiveSecondaryVertexFinderNegativeTagInfos.vertexCuts.distVal2dMax = -0.01 pfInclusiveSecondaryVertexFinderNegativeTagInfos.vertexCuts.distSig2dMin = -99999.9 diff --git a/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h b/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h index 32043c6a2eb46..92148d60d0605 100644 --- a/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h +++ b/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h @@ -211,11 +211,11 @@ void TemplatedInclusiveVertexFinder::produce(edm::Event &eve #endif } GlobalPoint sv((*v).position().x(),(*v).position().y(),(*v).position().z()); - float vscal = dir.unit().dot((sv-ppv).unit()) ; - // std::cout << "Vscal: " << vscal << std::endl; - if(dlen.significance() > vertexMinDLenSig && vscal > vertexMinAngleCosine && v->normalisedChiSquared() < 10 && dlen2.significance() > vertexMinDLen2DSig) + float vscal = dir.unit().dot((sv-ppv).unit()); + if(dlen.significance() > vertexMinDLenSig && ( (vertexMinAngleCosine > 0) ? (vscal > vertexMinAngleCosine) : (vscal < vertexMinAngleCosine) ) && v->normalisedChiSquared() < 10 && dlen2.significance() > vertexMinDLen2DSig) { recoVertices->push_back(*v); + #ifdef VTXDEBUG std::cout << "ADDED" << std::endl; #endif diff --git a/RecoVertex/AdaptiveVertexFinder/python/inclusiveNegativeVertexing_cff.py b/RecoVertex/AdaptiveVertexFinder/python/inclusiveNegativeVertexing_cff.py new file mode 100644 index 0000000000000..9f7d521062d09 --- /dev/null +++ b/RecoVertex/AdaptiveVertexFinder/python/inclusiveNegativeVertexing_cff.py @@ -0,0 +1,62 @@ +import FWCore.ParameterSet.Config as cms + +from RecoVertex.AdaptiveVertexFinder.inclusiveCandidateVertexFinder_cfi import * +from RecoVertex.AdaptiveVertexFinder.candidateVertexMerger_cfi import * +from RecoVertex.AdaptiveVertexFinder.candidateVertexArbitrator_cfi import * + + +inclusiveCandidateNegativeVertexFinder = inclusiveCandidateVertexFinder.clone( + vertexMinAngleCosine = cms.double(-0.95) +) +inclusiveCandidateNegativeVertexFinder.clusterizer.clusterMinAngleCosine = cms.double(-0.5) + +candidateNegativeVertexMerger = candidateVertexMerger.clone() +candidateNegativeVertexMerger.secondaryVertices = cms.InputTag("inclusiveCandidateNegativeVertexFinder") + +candidateNegativeVertexArbitrator = candidateVertexArbitrator.clone() +candidateNegativeVertexArbitrator.secondaryVertices = cms.InputTag("candidateNegativeVertexMerger") +candidateNegativeVertexArbitrator.dRCut = cms.double(-0.4) + +inclusiveCandidateNegativeSecondaryVertices = candidateVertexMerger.clone() +inclusiveCandidateNegativeSecondaryVertices.secondaryVertices = cms.InputTag("candidateNegativeVertexArbitrator") +inclusiveCandidateNegativeSecondaryVertices.maxFraction = 0.2 +inclusiveCandidateNegativeSecondaryVertices.minSignificance = 10. + + + +inclusiveCandidateNegativeVertexingTask = cms.Task(inclusiveCandidateNegativeVertexFinder, + candidateNegativeVertexMerger, + candidateNegativeVertexArbitrator, + inclusiveCandidateNegativeSecondaryVertices) + +inclusiveCandidateNegativeVertexing = cms.Sequence(inclusiveCandidateNegativeVertexingTask) + + +inclusiveCandidateNegativeVertexFinderCvsL = inclusiveCandidateVertexFinder.clone( + vertexMinDLen2DSig = cms.double(1.25), + vertexMinDLenSig = cms.double(0.25), + vertexMinAngleCosine = cms.double(-0.95) +) +inclusiveCandidateNegativeVertexFinderCvsL.clusterizer.clusterMinAngleCosine = cms.double(-0.5) + +candidateNegativeVertexMergerCvsL = candidateVertexMerger.clone( + secondaryVertices = cms.InputTag("inclusiveCandidateNegativeVertexFinderCvsL") +) + +candidateNegativeVertexArbitratorCvsL = candidateVertexArbitrator.clone( + secondaryVertices = cms.InputTag("candidateNegativeVertexMergerCvsL"), + dRCut = cms.double(-0.4) +) + +inclusiveCandidateNegativeSecondaryVerticesCvsL = candidateVertexMerger.clone( + secondaryVertices = cms.InputTag("candidateNegativeVertexArbitratorCvsL"), + maxFraction = cms.double(0.2), + minSignificance = cms.double(10.) +) + + +inclusiveCandidateNegativeVertexingCvsLTask = cms.Task(inclusiveCandidateNegativeVertexFinderCvsL, + candidateNegativeVertexMergerCvsL, + candidateNegativeVertexArbitratorCvsL, + inclusiveCandidateNegativeSecondaryVerticesCvsL) +inclusiveCandidateNegativeVertexingCvsL = cms.Sequence(inclusiveCandidateNegativeVertexingCvsLTask) From d797ff54afacb00dbc77e36d28428df2e34c2c99 Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Tue, 3 Apr 2018 15:36:04 +0200 Subject: [PATCH 02/16] Use correct vertex collection for DeepFlavour negative tagger --- PhysicsTools/PatAlgos/python/tools/jetTools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PhysicsTools/PatAlgos/python/tools/jetTools.py b/PhysicsTools/PatAlgos/python/tools/jetTools.py index 85f3823cb9191..8590306dbebec 100644 --- a/PhysicsTools/PatAlgos/python/tools/jetTools.py +++ b/PhysicsTools/PatAlgos/python/tools/jetTools.py @@ -613,10 +613,11 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou btag.pfDeepFlavourTagInfos.clone( jets = jetSource, vertices=pvSource, - secondary_vertices=svSource, + secondary_vertices=svUsed, shallow_tag_infos = cms.InputTag(btagPrefix+deep_csv_tag_infos+labelName+postfix), puppi_value_map = puppi_value_map, vertex_associator = vertex_associator, + flip = flip ), process, task) From de3096e46a366e7cde9151a5fc889bf6be6f7f3e Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Mon, 9 Apr 2018 16:50:26 +0200 Subject: [PATCH 03/16] Changing vertex cuts for negative tagger vertex reconstruction --- .../interface/TrackVertexArbitratration.h | 9 ++++++--- .../src/TracksClusteringFromDisplacedSeed.cc | 12 ++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/RecoVertex/AdaptiveVertexFinder/interface/TrackVertexArbitratration.h b/RecoVertex/AdaptiveVertexFinder/interface/TrackVertexArbitratration.h index 299c6aba1bb27..2125236becc45 100644 --- a/RecoVertex/AdaptiveVertexFinder/interface/TrackVertexArbitratration.h +++ b/RecoVertex/AdaptiveVertexFinder/interface/TrackVertexArbitratration.h @@ -73,6 +73,7 @@ class TrackVertexArbitration{ int trackMinLayers; double trackMinPt; int trackMinPixels; + double sign; }; #include "DataFormats/GeometryVector/interface/VectorUtil.h" @@ -93,7 +94,9 @@ TrackVertexArbitration::TrackVertexArbitration(const edm::ParameterSet &par trackMinPt (params.getParameter("trackMinPt")), trackMinPixels (params.getParameter("trackMinPixels")) { - dRCut*=dRCut; + sign = 1.0; + if(dRCut < 0){sign = -1.0;} + dRCut*=dRCut; } template bool TrackVertexArbitration::trackFilterArbitrator(const reco::TransientTrack &track) const @@ -186,8 +189,8 @@ std::vector TrackVertexArbitration::trackVertexArbitrator( GlobalError refPointErr = tsos.cartesianError().position(); Measurement1D isv = dist.distance(VertexState(RecoVertex::convertPos(sv->position()),RecoVertex::convertError(sv->error())),VertexState(refPoint, refPointErr)); - float dR = Geom::deltaR2(flightDir,tt.track()); //.eta(), flightDir.phi(), tt.track().eta(), tt.track().phi()); - + float dR = Geom::deltaR2(( (sign > 0) ? flightDir : -flightDir),tt.track()); //.eta(), flightDir.phi(), tt.track().eta(), tt.track().phi()); + if( w > 0 || ( isv.significance() < sigCut && isv.value() < distCut && isv.value() < dlen.value()*dLenFraction ) ) { diff --git a/RecoVertex/AdaptiveVertexFinder/src/TracksClusteringFromDisplacedSeed.cc b/RecoVertex/AdaptiveVertexFinder/src/TracksClusteringFromDisplacedSeed.cc index 8116d47a66869..ec00b0f12ab14 100644 --- a/RecoVertex/AdaptiveVertexFinder/src/TracksClusteringFromDisplacedSeed.cc +++ b/RecoVertex/AdaptiveVertexFinder/src/TracksClusteringFromDisplacedSeed.cc @@ -52,12 +52,12 @@ std::pair,GlobalPoint> TracksClusteringFromDis float w = distanceFromPV*distanceFromPV/(pvDistance*distance); bool selected = (m.significance() < clusterMaxSignificance && - dotprodSeed > clusterMinAngleCosine && //Angles between PV-PCAonSeed vectors and seed directions - dotprodTrack > clusterMinAngleCosine && //Angles between PV-PCAonTrack vectors and track directions -// dotprodTrackSeed2D > clusterMinAngleCosine && //Angle between track and seed - // distance*clusterScale*tracks.size() < (distanceFromPV+pvDistance)*(distanceFromPV+pvDistance)/pvDistance && // cut scaling with track density - distance*distanceRatio < distanceFromPV && // cut scaling with track density - distance < clusterMaxDistance); // absolute distance cut + ((clusterMinAngleCosine > 0) ? (dotprodSeed > clusterMinAngleCosine) : (dotprodSeed < clusterMinAngleCosine)) && //Angles between PV-PCAonSeed vectors and seed directions + ((clusterMinAngleCosine > 0) ? (dotprodTrack > clusterMinAngleCosine) : (dotprodTrack < clusterMinAngleCosine)) && //Angles between PV-PCAonTrack vectors and track directions + //dotprodTrackSeed2D > clusterMinAngleCosine && //Angle between track and seed + //distance*clusterScale*tracks.size() < (distanceFromPV+pvDistance)*(distanceFromPV+pvDistance)/pvDistance && // cut scaling with track density + distance*distanceRatio < distanceFromPV && // cut scaling with track density + distance < clusterMaxDistance); // absolute distance cut #ifdef VTXDEBUG std::cout << tt->trackBaseRef().key() << " : " << (selected?"+":" ")<< " " << m.significance() << " < " << clusterMaxSignificance << " && " << From 03929c4f4522ef9c26cbf69a7845ea4da6e2b588 Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Mon, 9 Apr 2018 16:53:18 +0200 Subject: [PATCH 04/16] Added correct vertex collection to DeepCSV+DeepFlavour --- RecoBTag/DeepFlavour/python/pfNegativeDeepFlavourTagInfos_cfi.py | 1 + 1 file changed, 1 insertion(+) diff --git a/RecoBTag/DeepFlavour/python/pfNegativeDeepFlavourTagInfos_cfi.py b/RecoBTag/DeepFlavour/python/pfNegativeDeepFlavourTagInfos_cfi.py index 990ee0f8211f6..27fe9fdfd51b5 100644 --- a/RecoBTag/DeepFlavour/python/pfNegativeDeepFlavourTagInfos_cfi.py +++ b/RecoBTag/DeepFlavour/python/pfNegativeDeepFlavourTagInfos_cfi.py @@ -4,5 +4,6 @@ pfNegativeDeepFlavourTagInfos = pfDeepFlavourTagInfos.clone( shallow_tag_infos = cms.InputTag('pfDeepCSVNegativeTagInfos'), + secondary_vertices = cms.InputTag('inclusiveCandidateNegativeSecondaryVertices'), flip = cms.bool(True) ) From 708baf858ce0fe5f7494546e7333dfd5e0bc5239 Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Mon, 16 Apr 2018 09:23:47 +0200 Subject: [PATCH 05/16] Flipping mass above charm correctly --- .../interface/CombinedSVComputer.h | 20 ++---- .../SecondaryVertex/src/CombinedSVComputer.cc | 70 +++++++++++++------ 2 files changed, 54 insertions(+), 36 deletions(-) diff --git a/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h b/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h index 3792b691f718c..6b664151783da 100644 --- a/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h +++ b/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h @@ -244,23 +244,11 @@ void CombinedSVComputer::fillCommonVariables(reco::TaggingVariableList & vars, r vars.insert(btau::trackJetPt, trackJetKinematics.vectorSum().Pt(), true); vars.insert(btau::trackSumJetDeltaR,VectorUtil::DeltaR(allKinematics.vectorSum(), jetDir), true); vars.insert(btau::trackSumJetEtRatio,allKinematics.vectorSum().Et() / ipInfo.jet()->et(), true); - - float trackSip3dSigAboveCharm = threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.significance(); - float trackSip3dValAboveCharm = threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.value(); - float trackSip2dSigAboveCharm = threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.significance(); - float trackSip2dValAboveCharm = threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.value(); - - if( (trackSip2dValAboveCharm == -1) && (trackSip3dValAboveCharm == -1) && trackFlip ){ - trackSip3dSigAboveCharm = -trackSip3dSigAboveCharm; - trackSip3dValAboveCharm = -trackSip3dValAboveCharm; - trackSip2dSigAboveCharm = -trackSip2dSigAboveCharm; - trackSip2dValAboveCharm = -trackSip2dValAboveCharm; - } - vars.insert(btau::trackSip3dSigAboveCharm, flipValue(trackSip3dSigAboveCharm,false),true); - vars.insert(btau::trackSip3dValAboveCharm, flipValue(trackSip3dValAboveCharm,false),true); - vars.insert(btau::trackSip2dSigAboveCharm, flipValue(trackSip2dSigAboveCharm,false),true); - vars.insert(btau::trackSip2dValAboveCharm, flipValue(trackSip2dValAboveCharm,false),true); + vars.insert(btau::trackSip3dSigAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.significance(),false),true); + vars.insert(btau::trackSip3dValAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.value(),false),true); + vars.insert(btau::trackSip2dSigAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.significance(),false),true); + vars.insert(btau::trackSip2dValAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.value(),false),true); if (vtxType != btag::Vertices::NoVertex) { math::XYZTLorentzVector allSum = useTrackWeights diff --git a/RecoBTag/SecondaryVertex/src/CombinedSVComputer.cc b/RecoBTag/SecondaryVertex/src/CombinedSVComputer.cc index 7a6f44c6967d5..93c919166042e 100644 --- a/RecoBTag/SecondaryVertex/src/CombinedSVComputer.cc +++ b/RecoBTag/SecondaryVertex/src/CombinedSVComputer.cc @@ -77,17 +77,32 @@ CombinedSVComputer::threshTrack(const CandIPTagInfo &trackIPTagInfo, if (kin.vectorSum().M() > charmCut) return data; } + if(trackFlip){ + static const btag::TrackIPData dummy = { + GlobalPoint(), + GlobalPoint(), + Measurement1D(1.0, 1.0), + Measurement1D(1.0, 1.0), + Measurement1D(1.0, 1.0), + Measurement1D(1.0, 1.0), + 0. + }; + return dummy; + } + else{ + static const btag::TrackIPData dummy = { + GlobalPoint(), + GlobalPoint(), + Measurement1D(-1.0, 1.0), + Measurement1D(-1.0, 1.0), + Measurement1D(-1.0, 1.0), + Measurement1D(-1.0, 1.0), + 0. + }; + return dummy; + } + - static const btag::TrackIPData dummy = { - GlobalPoint(), - GlobalPoint(), - Measurement1D(-1.0, 1.0), - Measurement1D(-1.0, 1.0), - Measurement1D(-1.0, 1.0), - Measurement1D(-1.0, 1.0), - 0. - }; - return dummy; } const btag::TrackIPData & @@ -117,16 +132,31 @@ CombinedSVComputer::threshTrack(const TrackIPTagInfo &trackIPTagInfo, return data; } - static const btag::TrackIPData dummy = { - GlobalPoint(), - GlobalPoint(), - Measurement1D(-1.0, 1.0), - Measurement1D(-1.0, 1.0), - Measurement1D(-1.0, 1.0), - Measurement1D(-1.0, 1.0), - 0. - }; - return dummy; + if(trackFlip){ + static const btag::TrackIPData dummy = { + GlobalPoint(), + GlobalPoint(), + Measurement1D(1.0, 1.0), + Measurement1D(1.0, 1.0), + Measurement1D(1.0, 1.0), + Measurement1D(1.0, 1.0), + 0. + }; + return dummy; + } + else{ + static const btag::TrackIPData dummy = { + GlobalPoint(), + GlobalPoint(), + Measurement1D(-1.0, 1.0), + Measurement1D(-1.0, 1.0), + Measurement1D(-1.0, 1.0), + Measurement1D(-1.0, 1.0), + 0. + }; + return dummy; + } + } From a996f38ad5956b62c0ddad2c3115237b5950f054 Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Mon, 16 Apr 2018 09:32:23 +0200 Subject: [PATCH 06/16] formatting --- RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h b/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h index 6b664151783da..486fbb6c8dc3b 100644 --- a/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h +++ b/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h @@ -248,7 +248,7 @@ void CombinedSVComputer::fillCommonVariables(reco::TaggingVariableList & vars, r vars.insert(btau::trackSip3dSigAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.significance(),false),true); vars.insert(btau::trackSip3dValAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.value(),false),true); vars.insert(btau::trackSip2dSigAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.significance(),false),true); - vars.insert(btau::trackSip2dValAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.value(),false),true); + vars.insert(btau::trackSip2dValAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.value(),false),true); if (vtxType != btag::Vertices::NoVertex) { math::XYZTLorentzVector allSum = useTrackWeights From bf80f71e29fa3c265212adca0a5afceee9cb035a Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Mon, 16 Apr 2018 09:35:38 +0200 Subject: [PATCH 07/16] format --- RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h b/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h index 486fbb6c8dc3b..e9acc3202547e 100644 --- a/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h +++ b/RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h @@ -245,10 +245,10 @@ void CombinedSVComputer::fillCommonVariables(reco::TaggingVariableList & vars, r vars.insert(btau::trackSumJetDeltaR,VectorUtil::DeltaR(allKinematics.vectorSum(), jetDir), true); vars.insert(btau::trackSumJetEtRatio,allKinematics.vectorSum().Et() / ipInfo.jet()->et(), true); - vars.insert(btau::trackSip3dSigAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.significance(),false),true); - vars.insert(btau::trackSip3dValAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.value(),false),true); - vars.insert(btau::trackSip2dSigAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.significance(),false),true); - vars.insert(btau::trackSip2dValAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.value(),false),true); + vars.insert(btau::trackSip3dSigAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.significance(),false),true); + vars.insert(btau::trackSip3dValAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.value(),false),true); + vars.insert(btau::trackSip2dSigAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.significance(),false),true); + vars.insert(btau::trackSip2dValAboveCharm, flipValue(threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.value(),false),true); if (vtxType != btag::Vertices::NoVertex) { math::XYZTLorentzVector allSum = useTrackWeights From 3c967e5dbe2064be94f87427927d7d37aed64ad1 Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Tue, 15 May 2018 10:55:35 +0200 Subject: [PATCH 08/16] Updated the DeepFlavour model to the newest training. --- RecoBTag/DeepFlavour/plugins/DeepFlavourTFJetTagsProducer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoBTag/DeepFlavour/plugins/DeepFlavourTFJetTagsProducer.cc b/RecoBTag/DeepFlavour/plugins/DeepFlavourTFJetTagsProducer.cc index 1c4d837c20af8..1fd3bb98ac99e 100644 --- a/RecoBTag/DeepFlavour/plugins/DeepFlavourTFJetTagsProducer.cc +++ b/RecoBTag/DeepFlavour/plugins/DeepFlavourTFJetTagsProducer.cc @@ -136,9 +136,9 @@ void DeepFlavourTFJetTagsProducer::fillDescriptions(edm::ConfigurationDescriptio desc.add>("input_names", { "input_1", "input_2", "input_3", "input_4", "input_5" }); desc.add("graph_path", - edm::FileInPath("RecoBTag/Combined/data/DeepFlavourV01_GraphDef_PtCut/constant_graph.pb")); + edm::FileInPath("RecoBTag/Combined/data/DeepFlavourV02_realistic_training/constant_graph.pb")); desc.add>("lp_names", - { "globals_input_batchnorm/keras_learning_phase" }); + { "cpf_input_batchnorm/keras_learning_phase" }); desc.add>("output_names", { "ID_pred/Softmax", "regression_pred/BiasAdd" }); { From fb601f1cad9d960fc7896fb08c648ecf90a13248 Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Tue, 15 May 2018 16:29:47 +0200 Subject: [PATCH 09/16] code style --- .../SecondaryVertex/plugins/TemplatedSecondaryVertexProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoBTag/SecondaryVertex/plugins/TemplatedSecondaryVertexProducer.cc b/RecoBTag/SecondaryVertex/plugins/TemplatedSecondaryVertexProducer.cc index 8cf31cadc10fc..e355be46f4661 100644 --- a/RecoBTag/SecondaryVertex/plugins/TemplatedSecondaryVertexProducer.cc +++ b/RecoBTag/SecondaryVertex/plugins/TemplatedSecondaryVertexProducer.cc @@ -1022,7 +1022,7 @@ void TemplatedSecondaryVertexProducer::matchReclusteredJets(const edm: std::vector& matchedIndices, const std::string& jetType) { - std::string type = ( jetType!="" ? jetType + " " : jetType ); + std::string type = ( !jetType.empty() ? jetType + " " : jetType ); std::vector matchedLocks(reclusteredJets.size(),false); From 407eec4d1f5028a0bb222c1e9b124d43f9580fae Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Tue, 29 May 2018 19:55:02 +0200 Subject: [PATCH 10/16] Remove DeepFlavour Negative Tagger --- .../PatAlgos/python/tools/jetTools.py | 1 - .../plugins/ChargedCandidateConverter.h | 32 ++++++------------- .../plugins/DeepFlavourTFJetTagsProducer.cc | 4 +-- .../plugins/DeepFlavourTagInfoProducer.cc | 24 ++++++-------- RecoBTag/DeepFlavour/plugins/SVConverter.h | 17 ++++------ .../pfNegativeDeepFlavourTagInfos_cfi.py | 4 +-- 6 files changed, 27 insertions(+), 55 deletions(-) diff --git a/PhysicsTools/PatAlgos/python/tools/jetTools.py b/PhysicsTools/PatAlgos/python/tools/jetTools.py index 8590306dbebec..b94264c78d6b7 100644 --- a/PhysicsTools/PatAlgos/python/tools/jetTools.py +++ b/PhysicsTools/PatAlgos/python/tools/jetTools.py @@ -617,7 +617,6 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou shallow_tag_infos = cms.InputTag(btagPrefix+deep_csv_tag_infos+labelName+postfix), puppi_value_map = puppi_value_map, vertex_associator = vertex_associator, - flip = flip ), process, task) diff --git a/RecoBTag/DeepFlavour/plugins/ChargedCandidateConverter.h b/RecoBTag/DeepFlavour/plugins/ChargedCandidateConverter.h index b656ec5be2977..993f372ff0628 100644 --- a/RecoBTag/DeepFlavour/plugins/ChargedCandidateConverter.h +++ b/RecoBTag/DeepFlavour/plugins/ChargedCandidateConverter.h @@ -30,19 +30,7 @@ namespace btagbtvdeep { const reco::Jet & jet, const TrackInfoBuilder & track_info, const float & drminpfcandsv, - ChargedCandidateFeatures & c_pf_features, - const bool flip) { - - float TrackSip2dVal = track_info.getTrackSip2dVal(); - float TrackSip2dSig = track_info.getTrackSip2dSig(); - float TrackSip3dVal = track_info.getTrackSip3dVal(); - float TrackSip3dSig = track_info.getTrackSip3dSig(); - if(flip == true){ - TrackSip2dVal = -1.0*TrackSip2dVal; - TrackSip2dSig = -1.0*TrackSip2dSig; - TrackSip3dSig = -1.0*TrackSip3dSig; - TrackSip3dVal = -1.0*TrackSip3dVal; - } + ChargedCandidateFeatures & c_pf_features) { c_pf_features.ptrel = catch_infs_and_bound(c_pf->pt()/jet.pt(), 0,-1,0,-1); @@ -52,10 +40,10 @@ namespace btagbtvdeep { c_pf_features.btagPf_trackPPar =catch_infs_and_bound(track_info.getTrackPPar(), 0,-1e5,1e5 ); c_pf_features.btagPf_trackDeltaR =catch_infs_and_bound(track_info.getTrackDeltaR(), 0,-5,5 ); c_pf_features.btagPf_trackPParRatio =catch_infs_and_bound(track_info.getTrackPParRatio(),0,-10,100); - c_pf_features.btagPf_trackSip3dVal =catch_infs_and_bound(TrackSip3dVal, 0, -1,1e5 ); - c_pf_features.btagPf_trackSip3dSig =catch_infs_and_bound(TrackSip3dSig, 0, -1,4e4 ); - c_pf_features.btagPf_trackSip2dVal =catch_infs_and_bound(TrackSip2dVal, 0, -1,70 ); - c_pf_features.btagPf_trackSip2dSig =catch_infs_and_bound(TrackSip2dSig, 0, -1,4e4 ); + c_pf_features.btagPf_trackSip3dVal =catch_infs_and_bound(track_info.getTrackSip3dVal(), 0, -1,1e5 ); + c_pf_features.btagPf_trackSip3dSig =catch_infs_and_bound(track_info.getTrackSip3dSig(), 0, -1,4e4 ); + c_pf_features.btagPf_trackSip2dVal =catch_infs_and_bound(track_info.getTrackSip2dVal(), 0, -1,70 ); + c_pf_features.btagPf_trackSip2dSig =catch_infs_and_bound(track_info.getTrackSip2dSig(), 0, -1,4e4 ); c_pf_features.btagPf_trackJetDistVal =catch_infs_and_bound(track_info.getTrackJetDistVal(),0,-20,1 ); @@ -68,10 +56,9 @@ namespace btagbtvdeep { const pat::Jet & jet, const TrackInfoBuilder & track_info, const float drminpfcandsv, - ChargedCandidateFeatures & c_pf_features, - const bool flip) { + ChargedCandidateFeatures & c_pf_features) { - CommonCandidateToFeatures(c_pf, jet, track_info, drminpfcandsv, c_pf_features, flip); + CommonCandidateToFeatures(c_pf, jet, track_info, drminpfcandsv, c_pf_features); c_pf_features.vtx_ass = c_pf->pvAssociationQuality(); @@ -98,10 +85,9 @@ namespace btagbtvdeep { const float drminpfcandsv, const float puppiw, const int pv_ass_quality, const reco::VertexRef & pv, - ChargedCandidateFeatures & c_pf_features, - const bool flip) { + ChargedCandidateFeatures & c_pf_features) { - CommonCandidateToFeatures(c_pf, jet, track_info, drminpfcandsv, c_pf_features, flip); + CommonCandidateToFeatures(c_pf, jet, track_info, drminpfcandsv, c_pf_features); c_pf_features.vtx_ass = (float) pat::PackedCandidate::PVAssociationQuality(qualityMap[pv_ass_quality]); if (c_pf->trackRef().isNonnull() && diff --git a/RecoBTag/DeepFlavour/plugins/DeepFlavourTFJetTagsProducer.cc b/RecoBTag/DeepFlavour/plugins/DeepFlavourTFJetTagsProducer.cc index 1fd3bb98ac99e..1c4d837c20af8 100644 --- a/RecoBTag/DeepFlavour/plugins/DeepFlavourTFJetTagsProducer.cc +++ b/RecoBTag/DeepFlavour/plugins/DeepFlavourTFJetTagsProducer.cc @@ -136,9 +136,9 @@ void DeepFlavourTFJetTagsProducer::fillDescriptions(edm::ConfigurationDescriptio desc.add>("input_names", { "input_1", "input_2", "input_3", "input_4", "input_5" }); desc.add("graph_path", - edm::FileInPath("RecoBTag/Combined/data/DeepFlavourV02_realistic_training/constant_graph.pb")); + edm::FileInPath("RecoBTag/Combined/data/DeepFlavourV01_GraphDef_PtCut/constant_graph.pb")); desc.add>("lp_names", - { "cpf_input_batchnorm/keras_learning_phase" }); + { "globals_input_batchnorm/keras_learning_phase" }); desc.add>("output_names", { "ID_pred/Softmax", "regression_pred/BiasAdd" }); { diff --git a/RecoBTag/DeepFlavour/plugins/DeepFlavourTagInfoProducer.cc b/RecoBTag/DeepFlavour/plugins/DeepFlavourTagInfoProducer.cc index 988a5b59849ad..39e9ef29b54d4 100644 --- a/RecoBTag/DeepFlavour/plugins/DeepFlavourTagInfoProducer.cc +++ b/RecoBTag/DeepFlavour/plugins/DeepFlavourTagInfoProducer.cc @@ -18,7 +18,6 @@ #include "DataFormats/BTauReco/interface/DeepFlavourTagInfo.h" #include "DataFormats/BTauReco/interface/DeepFlavourFeatures.h" -#include "DataFormats/GeometryVector/interface/VectorUtil.h" #include "JetConverter.h" #include "BTagConverter.h" @@ -28,7 +27,7 @@ #include "TrackInfoBuilder.h" #include "sorting_modules.h" -#include "deep_helpers.h" + class DeepFlavourTagInfoProducer : public edm::stream::EDProducer<> { @@ -52,7 +51,6 @@ class DeepFlavourTagInfoProducer : public edm::stream::EDProducer<> { const double jet_radius_; const double min_candidate_pt_; - const bool flip_; edm::EDGetTokenT> jet_token_; edm::EDGetTokenT vtx_token_; @@ -73,7 +71,6 @@ class DeepFlavourTagInfoProducer : public edm::stream::EDProducer<> { DeepFlavourTagInfoProducer::DeepFlavourTagInfoProducer(const edm::ParameterSet& iConfig) : jet_radius_(iConfig.getParameter("jet_radius")), min_candidate_pt_(iConfig.getParameter("min_candidate_pt")), - flip_(iConfig.getParameter("flip")), jet_token_(consumes >(iConfig.getParameter("jets"))), vtx_token_(consumes(iConfig.getParameter("vertices"))), sv_token_(consumes(iConfig.getParameter("secondary_vertices"))), @@ -112,7 +109,6 @@ void DeepFlavourTagInfoProducer::fillDescriptions(edm::ConfigurationDescriptions desc.add("shallow_tag_infos", edm::InputTag("pfDeepCSVTagInfos")); desc.add("jet_radius", 0.4); desc.add("min_candidate_pt", 0.95); - desc.add("flip", false); desc.add("vertices", edm::InputTag("offlinePrimaryVertices")); desc.add("puppi_value_map", edm::InputTag("puppi")); desc.add("secondary_vertices", edm::InputTag("inclusiveCandidateSecondaryVertices")); @@ -196,11 +192,6 @@ void DeepFlavourTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSet // fill number of pv features.npv = vtxs->size(); - math::XYZVector jet_dir = jet.momentum().Unit(); - GlobalVector jet_ref_track_dir(jet.px(), - jet.py(), - jet.pz()); - // fill features from ShallowTagInfo const auto & tag_info_vars = tag_info.taggingVariables(); btagbtvdeep::BTagConverter::BTagToFeatures(tag_info_vars, features.tag_info_features); @@ -213,16 +204,20 @@ 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::deltaR(sv, jet) > jet_radius_) continue; else { features.sv_features.emplace_back(); // in C++17 could just get from emplace_back output auto & sv_features = features.sv_features.back(); - btagbtvdeep::SVConverter::SVToFeatures(sv, pv, jet, sv_features, flip_); + btagbtvdeep::SVConverter::SVToFeatures(sv, pv, jet, sv_features); } } // stuff required for dealing with pf candidates + math::XYZVector jet_dir = jet.momentum().Unit(); + GlobalVector jet_ref_track_dir(jet.px(), + jet.py(), + jet.pz()); std::vector > c_sorted, n_sorted; @@ -305,13 +300,12 @@ void DeepFlavourTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSet auto entry = c_sortedindices.at(i); // get cached track info auto & trackinfo = trackinfos.at(i); - if(flip_ && (trackinfo.getTrackSip3dSig() > 10.0)){continue;} // get_ref to vector element auto & c_pf_features = features.c_pf_features.at(entry); // fill feature structure if (packed_cand) { btagbtvdeep::ChargedCandidateConverter::PackedCandidateToFeatures(packed_cand, jet, trackinfo, - drminpfcandsv, c_pf_features, flip_); + drminpfcandsv, c_pf_features); } else if (reco_cand) { // get vertex association quality int pv_ass_quality = 0; // fallback value @@ -339,7 +333,7 @@ void DeepFlavourTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSet btagbtvdeep::ChargedCandidateConverter::RecoCandidateToFeatures( reco_cand, jet, trackinfo, drminpfcandsv, puppiw, pv_ass_quality, - PV, c_pf_features, flip_); + PV, c_pf_features); } } else { // is neutral candidate diff --git a/RecoBTag/DeepFlavour/plugins/SVConverter.h b/RecoBTag/DeepFlavour/plugins/SVConverter.h index 0e10aa0530a0e..ef05f6322cbcb 100644 --- a/RecoBTag/DeepFlavour/plugins/SVConverter.h +++ b/RecoBTag/DeepFlavour/plugins/SVConverter.h @@ -15,13 +15,12 @@ namespace btagbtvdeep { static void SVToFeatures( const reco::VertexCompositePtrCandidate & sv, const reco::Vertex & pv, const reco::Jet & jet, - SecondaryVertexFeatures & sv_features, - const bool flip) { - - math::XYZVector jet_dir = jet.momentum().Unit(); + SecondaryVertexFeatures & sv_features) { + 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, - 0,-2,0); + sv_features.deltaR = catch_infs_and_bound( + std::fabs(reco::deltaR(sv,jet))-0.5, + 0,-2,0); sv_features.mass = sv.mass(); sv_features.ntracks = sv.numberOfDaughters(); sv_features.chi2 = sv.vertexChi2(); @@ -35,11 +34,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 = -1.0*costhetasvpv; - } - sv_features.costhetasvpv = costhetasvpv; + sv_features.costhetasvpv = vertexDdotP(sv,pv); sv_features.enratio = sv.energy()/jet.energy(); } diff --git a/RecoBTag/DeepFlavour/python/pfNegativeDeepFlavourTagInfos_cfi.py b/RecoBTag/DeepFlavour/python/pfNegativeDeepFlavourTagInfos_cfi.py index 27fe9fdfd51b5..5e726155adbf7 100644 --- a/RecoBTag/DeepFlavour/python/pfNegativeDeepFlavourTagInfos_cfi.py +++ b/RecoBTag/DeepFlavour/python/pfNegativeDeepFlavourTagInfos_cfi.py @@ -3,7 +3,5 @@ from RecoBTag.DeepFlavour.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 = cms.InputTag('pfDeepCSVNegativeTagInfos') ) From a7ce5f1546c8b50aea86b43090eb06112380c2e8 Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Wed, 30 May 2018 06:18:17 +0200 Subject: [PATCH 11/16] Add newlines --- .../AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h b/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h index 92148d60d0605..edda018a31ce9 100644 --- a/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h +++ b/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h @@ -212,7 +212,9 @@ void TemplatedInclusiveVertexFinder::produce(edm::Event &eve } GlobalPoint sv((*v).position().x(),(*v).position().y(),(*v).position().z()); float vscal = dir.unit().dot((sv-ppv).unit()); - if(dlen.significance() > vertexMinDLenSig && ( (vertexMinAngleCosine > 0) ? (vscal > vertexMinAngleCosine) : (vscal < vertexMinAngleCosine) ) && v->normalisedChiSquared() < 10 && dlen2.significance() > vertexMinDLen2DSig) + if(dlen.significance() > vertexMinDLenSig && + ( (vertexMinAngleCosine > 0) ? (vscal > vertexMinAngleCosine) : (vscal < vertexMinAngleCosine) ) + && v->normalisedChiSquared() < 10 && dlen2.significance() > vertexMinDLen2DSig) { recoVertices->push_back(*v); From 623da5031b2a4e577171d1321c6317d94e0f9c9b Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Wed, 30 May 2018 06:20:25 +0200 Subject: [PATCH 12/16] move arguments inside .clone --- .../python/inclusiveNegativeVertexing_cff.py | 50 +++++++++++-------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/RecoVertex/AdaptiveVertexFinder/python/inclusiveNegativeVertexing_cff.py b/RecoVertex/AdaptiveVertexFinder/python/inclusiveNegativeVertexing_cff.py index 9f7d521062d09..5058fcf1098c8 100644 --- a/RecoVertex/AdaptiveVertexFinder/python/inclusiveNegativeVertexing_cff.py +++ b/RecoVertex/AdaptiveVertexFinder/python/inclusiveNegativeVertexing_cff.py @@ -6,22 +6,26 @@ inclusiveCandidateNegativeVertexFinder = inclusiveCandidateVertexFinder.clone( - vertexMinAngleCosine = cms.double(-0.95) + vertexMinAngleCosine = -0.95, + clusterizer = inclusiveCandidateVertexFinder.clusterizer.clone( + clusterMinAngleCosine = -0.5 + ) ) -inclusiveCandidateNegativeVertexFinder.clusterizer.clusterMinAngleCosine = cms.double(-0.5) -candidateNegativeVertexMerger = candidateVertexMerger.clone() -candidateNegativeVertexMerger.secondaryVertices = cms.InputTag("inclusiveCandidateNegativeVertexFinder") - -candidateNegativeVertexArbitrator = candidateVertexArbitrator.clone() -candidateNegativeVertexArbitrator.secondaryVertices = cms.InputTag("candidateNegativeVertexMerger") -candidateNegativeVertexArbitrator.dRCut = cms.double(-0.4) +candidateNegativeVertexMerger = candidateVertexMerger.clone( + secondaryVertices = "inclusiveCandidateNegativeVertexFinder" +) -inclusiveCandidateNegativeSecondaryVertices = candidateVertexMerger.clone() -inclusiveCandidateNegativeSecondaryVertices.secondaryVertices = cms.InputTag("candidateNegativeVertexArbitrator") -inclusiveCandidateNegativeSecondaryVertices.maxFraction = 0.2 -inclusiveCandidateNegativeSecondaryVertices.minSignificance = 10. +candidateNegativeVertexArbitrator = candidateVertexArbitrator.clone( + secondaryVertices = "candidateNegativeVertexMerger", + dRCut = -0.4 +) +inclusiveCandidateNegativeSecondaryVertices = candidateVertexMerger.clone( + secondaryVertices = "candidateNegativeVertexArbitrator", + maxFraction = 0.2, + minSignificance = 10. +) inclusiveCandidateNegativeVertexingTask = cms.Task(inclusiveCandidateNegativeVertexFinder, @@ -33,25 +37,27 @@ inclusiveCandidateNegativeVertexFinderCvsL = inclusiveCandidateVertexFinder.clone( - vertexMinDLen2DSig = cms.double(1.25), - vertexMinDLenSig = cms.double(0.25), - vertexMinAngleCosine = cms.double(-0.95) + vertexMinDLen2DSig = 1.25, + vertexMinDLenSig = 0.25, + vertexMinAngleCosine = -0.95, + clusterizer = inclusiveCandidateVertexFinder.clusterizer.clone( + clusterMinAngleCosine = -0.5 + ) ) -inclusiveCandidateNegativeVertexFinderCvsL.clusterizer.clusterMinAngleCosine = cms.double(-0.5) candidateNegativeVertexMergerCvsL = candidateVertexMerger.clone( - secondaryVertices = cms.InputTag("inclusiveCandidateNegativeVertexFinderCvsL") + secondaryVertices = "inclusiveCandidateNegativeVertexFinderCvsL" ) candidateNegativeVertexArbitratorCvsL = candidateVertexArbitrator.clone( - secondaryVertices = cms.InputTag("candidateNegativeVertexMergerCvsL"), - dRCut = cms.double(-0.4) + secondaryVertices = "candidateNegativeVertexMergerCvsL", + dRCut = -0.4 ) inclusiveCandidateNegativeSecondaryVerticesCvsL = candidateVertexMerger.clone( - secondaryVertices = cms.InputTag("candidateNegativeVertexArbitratorCvsL"), - maxFraction = cms.double(0.2), - minSignificance = cms.double(10.) + secondaryVertices = "candidateNegativeVertexArbitratorCvsL", + maxFraction = 0.2, + minSignificance = 10. ) From b91cc82143dc6ac7955a49b53d8a1f31b1c93531 Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Wed, 30 May 2018 06:21:07 +0200 Subject: [PATCH 13/16] more arguments into .clone --- .../python/inclusiveVertexing_cff.py | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/RecoVertex/AdaptiveVertexFinder/python/inclusiveVertexing_cff.py b/RecoVertex/AdaptiveVertexFinder/python/inclusiveVertexing_cff.py index f5233a1279c4f..d84de3d8d0d57 100644 --- a/RecoVertex/AdaptiveVertexFinder/python/inclusiveVertexing_cff.py +++ b/RecoVertex/AdaptiveVertexFinder/python/inclusiveVertexing_cff.py @@ -4,10 +4,11 @@ from RecoVertex.AdaptiveVertexFinder.vertexMerger_cfi import * from RecoVertex.AdaptiveVertexFinder.trackVertexArbitrator_cfi import * -inclusiveSecondaryVertices = vertexMerger.clone() -inclusiveSecondaryVertices.secondaryVertices = cms.InputTag("trackVertexArbitrator") -inclusiveSecondaryVertices.maxFraction = 0.2 -inclusiveSecondaryVertices.minSignificance = 10. +inclusiveSecondaryVertices = vertexMerger.clone( + secondaryVertices = "trackVertexArbitrator", + maxFraction = 0.2, + minSignificance = 10. +) inclusiveVertexingTask = cms.Task(inclusiveVertexFinder, vertexMerger, @@ -19,10 +20,11 @@ from RecoVertex.AdaptiveVertexFinder.candidateVertexMerger_cfi import * from RecoVertex.AdaptiveVertexFinder.candidateVertexArbitrator_cfi import * -inclusiveCandidateSecondaryVertices = candidateVertexMerger.clone() -inclusiveCandidateSecondaryVertices.secondaryVertices = cms.InputTag("candidateVertexArbitrator") -inclusiveCandidateSecondaryVertices.maxFraction = 0.2 -inclusiveCandidateSecondaryVertices.minSignificance = 10. +inclusiveCandidateSecondaryVertices = candidateVertexMerger.clone( + secondaryVertices = "candidateVertexArbitrator", + maxFraction = 0.2, + minSignificance = 10. +) inclusiveCandidateVertexingTask = cms.Task(inclusiveCandidateVertexFinder, candidateVertexMerger, @@ -32,12 +34,12 @@ #relaxed IVF reconstruction cuts for candidate-based ctagging inclusiveCandidateVertexFinderCvsL = inclusiveCandidateVertexFinder.clone( - vertexMinDLen2DSig = cms.double(1.25), - vertexMinDLenSig = cms.double(0.25) + vertexMinDLen2DSig = 1.25, + vertexMinDLenSig = 0.25 ) candidateVertexMergerCvsL = candidateVertexMerger.clone( - secondaryVertices = cms.InputTag("inclusiveCandidateVertexFinderCvsL") + secondaryVertices = "inclusiveCandidateVertexFinderCvsL" ) candidateVertexArbitratorCvsL = candidateVertexArbitrator.clone( @@ -45,9 +47,9 @@ ) inclusiveCandidateSecondaryVerticesCvsL = candidateVertexMerger.clone( - secondaryVertices = cms.InputTag("candidateVertexArbitratorCvsL"), - maxFraction = cms.double(0.2), - minSignificance = cms.double(10.) + secondaryVertices = "candidateVertexArbitratorCvsL", + maxFraction = 0.2, + minSignificance = 10. ) inclusiveCandidateVertexingCvsLTask = cms.Task(inclusiveCandidateVertexFinderCvsL, From 4633ec25c947368f45ee1860f77f480fa99d6a1e Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Wed, 30 May 2018 06:44:34 +0200 Subject: [PATCH 14/16] move inside .clone --- ...condaryVertexFinderNegativeTagInfos_cfi.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/RecoBTag/SecondaryVertex/python/pfInclusiveSecondaryVertexFinderNegativeTagInfos_cfi.py b/RecoBTag/SecondaryVertex/python/pfInclusiveSecondaryVertexFinderNegativeTagInfos_cfi.py index 56b95a648919f..53e229e85d76b 100644 --- a/RecoBTag/SecondaryVertex/python/pfInclusiveSecondaryVertexFinderNegativeTagInfos_cfi.py +++ b/RecoBTag/SecondaryVertex/python/pfInclusiveSecondaryVertexFinderNegativeTagInfos_cfi.py @@ -2,11 +2,14 @@ from RecoBTag.SecondaryVertex.pfInclusiveSecondaryVertexFinderTagInfos_cfi import * -pfInclusiveSecondaryVertexFinderNegativeTagInfos = pfInclusiveSecondaryVertexFinderTagInfos.clone() -pfInclusiveSecondaryVertexFinderNegativeTagInfos.extSVDeltaRToJet = cms.double(-0.3) -pfInclusiveSecondaryVertexFinderNegativeTagInfos.extSVCollection = cms.InputTag('inclusiveCandidateNegativeSecondaryVertices') -pfInclusiveSecondaryVertexFinderNegativeTagInfos.vertexCuts.distVal2dMin = -2.5 -pfInclusiveSecondaryVertexFinderNegativeTagInfos.vertexCuts.distVal2dMax = -0.01 -pfInclusiveSecondaryVertexFinderNegativeTagInfos.vertexCuts.distSig2dMin = -99999.9 -pfInclusiveSecondaryVertexFinderNegativeTagInfos.vertexCuts.distSig2dMax = -2.0 -pfInclusiveSecondaryVertexFinderNegativeTagInfos.vertexCuts.maxDeltaRToJetAxis = -0.5 +pfInclusiveSecondaryVertexFinderNegativeTagInfos = pfInclusiveSecondaryVertexFinderTagInfos.clone( + extSVDeltaRToJet = -0.3, + extSVCollection = 'inclusiveCandidateNegativeSecondaryVertices', + vertexCuts = pfInclusiveSecondaryVertexFinderTagInfos.vertexCuts.clone( + distVal2dMin = -2.5, + distVal2dMax = -0.01, + distSig2dMin = -99999.9, + distSig2dMax = -2.0, + maxDeltaRToJetAxis = -0.5 + ) +) From 711bd137122dfabaaf84831c78e02ac7fce4f895 Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Wed, 30 May 2018 10:21:30 +0200 Subject: [PATCH 15/16] use dict() --- RecoBTag/Combined/python/deepFlavour_cff.py | 37 +++++++++++++------ .../python/inclusiveNegativeVertexing_cff.py | 4 +- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/RecoBTag/Combined/python/deepFlavour_cff.py b/RecoBTag/Combined/python/deepFlavour_cff.py index 684a47ed4d594..7a64cfde01029 100644 --- a/RecoBTag/Combined/python/deepFlavour_cff.py +++ b/RecoBTag/Combined/python/deepFlavour_cff.py @@ -11,22 +11,37 @@ ## pfDeepCSVNegativeTagInfos = pfDeepCSVTagInfos.clone( - svTagInfos=cms.InputTag('pfInclusiveSecondaryVertexFinderNegativeTagInfos') - ) -pfDeepCSVNegativeTagInfos.computer.vertexFlip = True -pfDeepCSVNegativeTagInfos.computer.trackFlip = True -pfDeepCSVNegativeTagInfos.computer.trackSelection.sip3dSigMax = 10.0 -pfDeepCSVNegativeTagInfos.computer.trackPseudoSelection.sip3dSigMax = 10.0 -pfDeepCSVNegativeTagInfos.computer.trackPseudoSelection.sip2dSigMin = -99999.9 -pfDeepCSVNegativeTagInfos.computer.trackPseudoSelection.sip2dSigMax = -2.0 + svTagInfos=cms.InputTag('pfInclusiveSecondaryVertexFinderNegativeTagInfos'), + computer = dict( + vertexFlip = True, + trackFlip = True, + trackSelection = dict( + sip3dSigMax = 10.0 + ), + trackPseudoSelection = dict( + sip3dSigMax = 10.0, + sip2dSigMin = -99999.9, + sip2dSigMax = -2.0 + ) + ) + ) pfNegativeDeepCSVJetTags = pfDeepCSVJetTags.clone( src=cms.InputTag('pfDeepCSVNegativeTagInfos') ) -pfDeepCSVPositiveTagInfos = pfDeepCSVTagInfos.clone() -pfDeepCSVPositiveTagInfos.computer.trackSelection.sip3dSigMin = 0 -pfDeepCSVPositiveTagInfos.computer.trackPseudoSelection.sip3dSigMin = 0 +pfDeepCSVPositiveTagInfos = pfDeepCSVTagInfos.clone( + computer = dict( + trackSelection = dict( + sip3dSigMin = 0 + ), + trackPseudoSelection = dict( + sip3dSigMin = 0 + ) + ) + + ) + pfPositiveDeepCSVJetTags = pfDeepCSVJetTags.clone( src=cms.InputTag('pfDeepCSVPositiveTagInfos') ) diff --git a/RecoVertex/AdaptiveVertexFinder/python/inclusiveNegativeVertexing_cff.py b/RecoVertex/AdaptiveVertexFinder/python/inclusiveNegativeVertexing_cff.py index 5058fcf1098c8..810fc364fbdd7 100644 --- a/RecoVertex/AdaptiveVertexFinder/python/inclusiveNegativeVertexing_cff.py +++ b/RecoVertex/AdaptiveVertexFinder/python/inclusiveNegativeVertexing_cff.py @@ -7,7 +7,7 @@ inclusiveCandidateNegativeVertexFinder = inclusiveCandidateVertexFinder.clone( vertexMinAngleCosine = -0.95, - clusterizer = inclusiveCandidateVertexFinder.clusterizer.clone( + clusterizer = dict( clusterMinAngleCosine = -0.5 ) ) @@ -40,7 +40,7 @@ vertexMinDLen2DSig = 1.25, vertexMinDLenSig = 0.25, vertexMinAngleCosine = -0.95, - clusterizer = inclusiveCandidateVertexFinder.clusterizer.clone( + clusterizer = dict( clusterMinAngleCosine = -0.5 ) ) From c67b7d972a48f7d06729dee842ba59799e0c98cb Mon Sep 17 00:00:00 2001 From: Emil Bols Date: Wed, 30 May 2018 10:26:03 +0200 Subject: [PATCH 16/16] use dict() --- .../pfInclusiveSecondaryVertexFinderNegativeTagInfos_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoBTag/SecondaryVertex/python/pfInclusiveSecondaryVertexFinderNegativeTagInfos_cfi.py b/RecoBTag/SecondaryVertex/python/pfInclusiveSecondaryVertexFinderNegativeTagInfos_cfi.py index 53e229e85d76b..e52505593f595 100644 --- a/RecoBTag/SecondaryVertex/python/pfInclusiveSecondaryVertexFinderNegativeTagInfos_cfi.py +++ b/RecoBTag/SecondaryVertex/python/pfInclusiveSecondaryVertexFinderNegativeTagInfos_cfi.py @@ -5,7 +5,7 @@ pfInclusiveSecondaryVertexFinderNegativeTagInfos = pfInclusiveSecondaryVertexFinderTagInfos.clone( extSVDeltaRToJet = -0.3, extSVCollection = 'inclusiveCandidateNegativeSecondaryVertices', - vertexCuts = pfInclusiveSecondaryVertexFinderTagInfos.vertexCuts.clone( + vertexCuts = dict( distVal2dMin = -2.5, distVal2dMax = -0.01, distSig2dMin = -99999.9,