Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for DeepDoubleX #39184

Merged
merged 3 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions PhysicsTools/PatAlgos/python/tools/jetTools.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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