diff --git a/PhysicsTools/PatAlgos/python/tools/jetTools.py b/PhysicsTools/PatAlgos/python/tools/jetTools.py index 045cd03b4cece..c217ce6eb9b3c 100644 --- a/PhysicsTools/PatAlgos/python/tools/jetTools.py +++ b/PhysicsTools/PatAlgos/python/tools/jetTools.py @@ -646,6 +646,9 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou process, task) if btagInfo == 'pfDeepDoubleXTagInfos': + # can only run on PAT jets, so the updater needs to be used + if 'updated' not in jetSource.value().lower(): + raise ValueError("Invalid jet collection: %s. pfDeepDoubleXTagInfos only supports running via updateJetCollection." % jetSource.value()) addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix, btag.pfDeepDoubleXTagInfos.clone( jets = jetSource, diff --git a/RecoBTag/FeatureTools/plugins/DeepDoubleXTagInfoProducer.cc b/RecoBTag/FeatureTools/plugins/DeepDoubleXTagInfoProducer.cc index 9b2df7d5f1dc8..afe0819c10857 100644 --- a/RecoBTag/FeatureTools/plugins/DeepDoubleXTagInfoProducer.cc +++ b/RecoBTag/FeatureTools/plugins/DeepDoubleXTagInfoProducer.cc @@ -123,8 +123,9 @@ void DeepDoubleXTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSet // reco jet reference (use as much as possible) const auto& jet = jets->at(jet_n); - const auto* pf_jet = dynamic_cast(&jet); const auto* pat_jet = dynamic_cast(&jet); + if (!pat_jet) + throw edm::Exception(edm::errors::InvalidReference) << "Input is not a pat::Jet."; edm::RefToBase jet_ref(jets, jet_n); if (jet.pt() > min_jet_pt_) { @@ -261,14 +262,6 @@ void DeepDoubleXTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSet auto packed_cand = dynamic_cast(cand); auto reco_cand = dynamic_cast(cand); - // need some edm::Ptr or edm::Ref if reco candidates - reco::PFCandidatePtr reco_ptr; - if (pf_jet) { - reco_ptr = pf_jet->getPFConstituent(i); - } else if (pat_jet && reco_cand) { - reco_ptr = pat_jet->getPFConstituent(i); - } - float puppiw = 1.0; // fallback value float drminpfcandsv = btagbtvdeep::mindrsvpfcand(svs_unsorted, cand, jet_radius_);