Skip to content

Commit

Permalink
Merge pull request #39200 from kpedro88/FixDeepDoubleX_124X
Browse files Browse the repository at this point in the history
Fixes for DeepDoubleX [12_4_X]
  • Loading branch information
cmsbuild committed Sep 7, 2022
2 parents b31b65b + fb46098 commit 6631217
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
3 changes: 3 additions & 0 deletions PhysicsTools/PatAlgos/python/tools/jetTools.py
Expand Up @@ -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,
Expand Down
11 changes: 2 additions & 9 deletions RecoBTag/FeatureTools/plugins/DeepDoubleXTagInfoProducer.cc
Expand Up @@ -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<const reco::PFJet*>(&jet);
const auto* pat_jet = dynamic_cast<const pat::Jet*>(&jet);
if (!pat_jet)
throw edm::Exception(edm::errors::InvalidReference) << "Input is not a pat::Jet.";

edm::RefToBase<reco::Jet> jet_ref(jets, jet_n);
if (jet.pt() > min_jet_pt_) {
Expand Down Expand Up @@ -261,14 +262,6 @@ void DeepDoubleXTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSet
auto packed_cand = dynamic_cast<const pat::PackedCandidate*>(cand);
auto reco_cand = dynamic_cast<const reco::PFCandidate*>(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_);
Expand Down

0 comments on commit 6631217

Please sign in to comment.