Skip to content

Commit

Permalink
Fixing JetTags names to be backcompatible
Browse files Browse the repository at this point in the history
  • Loading branch information
anovak10 committed Nov 29, 2018
1 parent 462aaa7 commit a59c602
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 15 deletions.
4 changes: 2 additions & 2 deletions PhysicsTools/PatAlgos/python/recoLayer0/bTagging_cff.py
Expand Up @@ -189,8 +189,8 @@
, 'pfNegativeDeepFlavourJetTags:probc' : [["pfNegativeDeepFlavourTagInfos"], ['pfDeepCSVNegativeTagInfos', "pfImpactParameterTagInfos", 'pfInclusiveSecondaryVertexFinderNegativeTagInfos']]
, 'pfNegativeDeepFlavourJetTags:probuds' : [["pfNegativeDeepFlavourTagInfos"], ['pfDeepCSVNegativeTagInfos', "pfImpactParameterTagInfos", 'pfInclusiveSecondaryVertexFinderNegativeTagInfos']]
, 'pfNegativeDeepFlavourJetTags:probg' : [["pfNegativeDeepFlavourTagInfos"], ['pfDeepCSVNegativeTagInfos', "pfImpactParameterTagInfos", 'pfInclusiveSecondaryVertexFinderNegativeTagInfos']]
, 'pfDeepDoubleBvLJetTags:probQCD' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleBvLJetTags:probHbb' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleBJetTags:probQ' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleBJetTags:probH' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleCvLJetTags:probQCD' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleCvLJetTags:probHcc' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleCvBJetTags:probHbb' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
Expand Down
75 changes: 75 additions & 0 deletions RecoBTag/MXNet/test/test_deep_boosted_jet_cfg.py
@@ -0,0 +1,75 @@

import FWCore.ParameterSet.Config as cms
from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask

from FWCore.ParameterSet.VarParsing import VarParsing
options = VarParsing('analysis')
options.inputFiles = '/store/mc/RunIIFall17MiniAOD/ZprimeToWWToWlepWhad_narrow_M-3000_TuneCP5_13TeV-madgraph/MINIAODSIM/94X_mc2017_realistic_v10-v1/20000/3E25D208-8205-E811-8858-3417EBE64426.root'
options.maxEvents = -1
options.parseArguments()

process = cms.Process("PATtest")

## MessageLogger
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 100


## Options and Output Report
process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )

## Source
process.source = cms.Source("PoolSource",
fileNames=cms.untracked.vstring(options.inputFiles)
)
## Maximal Number of Events
process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(options.maxEvents))

## Geometry and Detector Conditions (needed for a few patTuple production steps)
process.load("Configuration.Geometry.GeometryRecoDB_cff")
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc')
process.load("Configuration.StandardSequences.MagneticField_cff")

## Output Module Configuration (expects a path 'p')
from PhysicsTools.PatAlgos.patEventContent_cff import patEventContentNoCleaning
process.out = cms.OutputModule("PoolOutputModule",
fileName = cms.untracked.string('patTuple.root'),
## save only events passing the full path
#SelectEvents = cms.untracked.PSet( SelectEvents = cms.vstring('p') ),
## save PAT output; you need a '*' to unpack the list of commands
## 'patEventContent'
outputCommands = cms.untracked.vstring('drop *', *patEventContentNoCleaning )
)

patAlgosToolsTask = getPatAlgosToolsTask(process)
process.outpath = cms.EndPath(process.out, patAlgosToolsTask)

## and add them to the event content
from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection
from RecoBTag.MXNet.pfDeepBoostedJet_cff import _pfDeepBoostedJetTagsAll as pfDeepBoostedJetTagsAll

updateJetCollection(
process,
jetSource = cms.InputTag('slimmedJetsAK8'),
pvSource = cms.InputTag('offlineSlimmedPrimaryVertices'),
svSource = cms.InputTag('slimmedSecondaryVertices'),
rParam = 0.8,
jetCorrections = ('AK8PFPuppi', cms.vstring(['L2Relative', 'L3Absolute']), 'None'),
btagDiscriminators = pfDeepBoostedJetTagsAll
)

from Configuration.EventContent.EventContent_cff import MINIAODSIMEventContent
process.out.outputCommands.append('keep *_slimmedJetsAK8*_*_*')
process.out.outputCommands.append('keep *_offlineSlimmedPrimaryVertices*_*_*')
process.out.outputCommands.append('keep *_slimmedSecondaryVertices*_*_*')
process.out.outputCommands.append('keep *_selectedPatJets*_*_*')
process.out.outputCommands.append('keep *_selectedUpdatedPatJets*_*_*')
process.out.outputCommands.append('keep *_updatedPatJets*_*_*')

process.out.fileName = 'test_deep_boosted_jet_MINIAODSIM.root'

# ##
# process.options.wantSummary = False ## (to suppress the long output at the end of the job)
# process.add_(cms.Service("InitRootHandlers", DebugLevel =cms.untracked.int32(3)))
Expand Up @@ -168,7 +168,7 @@ void DeepDoubleXTFJetTagsProducer::fillDescriptions(edm::ConfigurationDescriptio
};
auto descBvL(desc);
descBvL.ifValue( edm::ParameterDescription<std::string>("flavor", "BvL", true), flavorCases());
descriptions.add("pfDeepDoubleBvLJetTags", descBvL);
descriptions.add("pfDeepDoubleBJetTags", descBvL);

auto descCvL(desc);
descCvL.ifValue( edm::ParameterDescription<std::string>("flavor", "CvL", true), flavorCases());
Expand Down
2 changes: 1 addition & 1 deletion RecoBTag/TensorFlow/python/pfDeepDoubleX_cff.py
@@ -1,4 +1,4 @@
from RecoBTag.TensorFlow.pfDeepDoubleBvLJetTags_cfi import pfDeepDoubleBvLJetTags
from RecoBTag.TensorFlow.pfDeepDoubleBJetTags_cfi import pfDeepDoubleBJetTags
from RecoBTag.TensorFlow.pfDeepDoubleCvBJetTags_cfi import pfDeepDoubleCvBJetTags
from RecoBTag.TensorFlow.pfDeepDoubleCvLJetTags_cfi import pfDeepDoubleCvLJetTags

Expand Down
@@ -1,9 +1,9 @@
import FWCore.ParameterSet.Config as cms
from pfDeepDoubleBvLJetTags_cfi import pfDeepDoubleBvLJetTags
from pfDeepDoubleBJetTags_cfi import pfDeepDoubleBJetTags
from pfDeepDoubleCvLJetTags_cfi import pfDeepDoubleCvLJetTags
from pfDeepDoubleCvBJetTags_cfi import pfDeepDoubleCvBJetTags

pfMassIndependentDeepDoubleBvLJetTags = pfDeepDoubleBvLJetTags.clone(
pfMassIndependentDeepDoubleBvLJetTags = pfDeepDoubleBJetTags.clone(
graph_path = 'RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDB_mass_independent.pb')
pfMassIndependentDeepDoubleCvLJetTags = pfDeepDoubleCvLJetTags.clone(
graph_path = 'RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDC_mass_independent.pb')
Expand Down
10 changes: 5 additions & 5 deletions RecoBTag/TensorFlow/test/plotDDX.py
Expand Up @@ -17,18 +17,18 @@
event.getByLabel (labelJ, handleJ)
jets = handleJ.product()
for jet in jets :
if jet.pt() < 300 or jet.pt() > 2000: continue
if jet.mass() < 40 or jet.mass() > 200: continue
#if jet.pt() < 300 or jet.pt() > 2000: continue
#if jet.mass() < 40 or jet.mass() > 200: continue

print(jet.pt(), jet.mass())
print("DDB", jet.bDiscriminator("pfDeepDoubleBvLJetTags:probQCD"), jet.bDiscriminator("pfDeepDoubleBvLJetTags:probHbb"))
print("DDB", jet.bDiscriminator("pfDeepDoubleBJetTags:probQCD"), jet.bDiscriminator("pfDeepDoubleBJetTags:probHbb"))
print("DDB", jet.bDiscriminator("pfMassIndependentDeepDoubleBvLJetTags:probQCD"), jet.bDiscriminator("pfMassIndependentDeepDoubleBvLJetTags:probHbb"))
print("DDCvL", jet.bDiscriminator("pfDeepDoubleCvLJetTags:probQCD"), jet.bDiscriminator("pfDeepDoubleCvLJetTags:probHcc"))
print("DDCvL", jet.bDiscriminator("pfMassIndependentDeepDoubleCvLJetTags:probQCD"), jet.bDiscriminator("pfMassIndependentDeepDoubleCvLJetTags:probHcc"))
print("DDCvB", jet.bDiscriminator("pfDeepDoubleCvBJetTags:probHbb"), jet.bDiscriminator("pfDeepDoubleCvBJetTags:probHcc") )
print("DDCvB", jet.bDiscriminator("pfMassIndependentDeepDoubleCvBJetTags:probHbb"), jet.bDiscriminator("pfMassIndependentDeepDoubleCvBJetTags:probHcc"))
h_probQ_ddb.Fill(jet.bDiscriminator("pfDeepDoubleBvLJetTags:probQCD"))
h_probH_ddb.Fill(jet.bDiscriminator("pfDeepDoubleBvLJetTags:probHbb"))
h_probQ_ddb.Fill(jet.bDiscriminator("pfDeepDoubleBJetTags:probQ"))
h_probH_ddb.Fill(jet.bDiscriminator("pfDeepDoubleBJetTags:probH"))
h_probQ_ddc.Fill(jet.bDiscriminator("pfDeepDoubleCvLJetTags:probQCD"))
h_probH_ddc.Fill(jet.bDiscriminator("pfDeepDoubleCvLJetTags:probHcc"))

Expand Down
4 changes: 2 additions & 2 deletions RecoBTag/TensorFlow/test/test_deep_doubleb_cfg_AOD.py
Expand Up @@ -70,8 +70,8 @@
jetCorrections = ('AK8PFPuppi', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'Type-2'),
btagDiscriminators = [
'pfBoostedDoubleSecondaryVertexAK8BJetTags',
'pfDeepDoubleBvLJetTags:probQCD',
'pfDeepDoubleBvLJetTags:probHbb',
'pfDeepDoubleBJetTags:probQ',
'pfDeepDoubleBJetTags:probH',
]
)

Expand Down
4 changes: 2 additions & 2 deletions RecoBTag/TensorFlow/test/test_deep_doublex_cfg.py
Expand Up @@ -52,8 +52,8 @@
jetCorrections = ('AK8PFchs', cms.vstring(['L2Relative', 'L3Absolute']), 'None'),
btagDiscriminators = [
'pfBoostedDoubleSecondaryVertexAK8BJetTags',
'pfDeepDoubleBvLJetTags:probQCD',
'pfDeepDoubleBvLJetTags:probHbb',
'pfDeepDoubleBJetTags:probQ',
'pfDeepDoubleBJetTags:probH',
'pfDeepDoubleCvLJetTags:probQCD',
'pfDeepDoubleCvLJetTags:probHcc',
'pfDeepDoubleCvBJetTags:probHbb',
Expand Down

0 comments on commit a59c602

Please sign in to comment.