From a096a0500a81ff4236747bc01a9d7cc2b990b901 Mon Sep 17 00:00:00 2001 From: Andrzej Date: Mon, 13 Jul 2020 13:49:45 +0200 Subject: [PATCH 1/2] feat: add DDXV2 --- README.md | 2 ++ python/addBTV.py | 85 +++++++++++++++++++++++++----------------------- 2 files changed, 46 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 016c299..f760f78 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ cmsrel CMSSW_10_6_14 cd CMSSW_10_6_14/src cmsenv git cms-addpkg PhysicsTools/NanoAOD +git cms-merge-topic andrzejnovak:DDXV2_106 +git clone https://github.com/cms-data/RecoBTag-Combined.git RecoBTag/Combined/data git clone https://github.com/cms-jet/NanoAODJMAR.git PhysicsTools/NanoAODJMAR scram b -j 10 cd PhysicsTools/NanoAODJMAR/test diff --git a/python/addBTV.py b/python/addBTV.py index dcc978e..1ec192e 100644 --- a/python/addBTV.py +++ b/python/addBTV.py @@ -10,10 +10,10 @@ def update_jets_AK4(process): # in https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/NanoAOD/python/nano_cff.py _btagDiscriminators = [ 'pfJetProbabilityBJetTags', - 'pfDeepCSVJetTags:probb', + 'pfDeepCSVJetTags:probb', 'pfDeepCSVJetTags:probc', - 'pfDeepCSVJetTags:probbb', - 'pfDeepCSVJetTags:probudsg', + 'pfDeepCSVJetTags:probbb', + 'pfDeepCSVJetTags:probudsg', ] updateJetCollection( process, @@ -36,10 +36,13 @@ def update_jets_AK8(process): # in https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/NanoAOD/python/nano_cff.py _btagDiscriminators = [ 'pfJetProbabilityBJetTags', - 'pfDeepCSVJetTags:probb', + 'pfDeepCSVJetTags:probb', 'pfDeepCSVJetTags:probc', 'pfDeepCSVJetTags:probbb', 'pfDeepCSVJetTags:probudsg', + 'pfMassIndependentDeepDoubleBvLV2JetTags:probHbb', + 'pfMassIndependentDeepDoubleCvLV2JetTags:probHcc', + 'pfMassIndependentDeepDoubleCvBV2JetTags:probHcc', ] updateJetCollection( process, @@ -71,7 +74,7 @@ def update_jets_AK8_subjet(process): # and https://github.com/alefisico/RecoBTag-PerformanceMeasurements/blob/10_2_X_boostedCommissioning/test/runBTagAnalyzer_cfg.py _btagDiscriminators = [ 'pfJetProbabilityBJetTags', - 'pfDeepCSVJetTags:probb', + 'pfDeepCSVJetTags:probb', 'pfDeepCSVJetTags:probc', 'pfDeepCSVJetTags:probbb', 'pfDeepCSVJetTags:probudsg', @@ -92,8 +95,9 @@ def update_jets_AK8_subjet(process): process.subJetTable.src = 'updatedPatJetsTransientCorrectedSoftDropSubjetsPFAK8SubjetsWithDeepInfo' ### VERY LONG NAME!!! :P return process + def get_DDX_vars(): - # retreive 27 jet-level features used in double-b and deep double-x taggers + # retreive 27 jet-level features used in double-b and deep double-x taggers # defiend in arXiv:1712.07158 DDXVars = cms.PSet( @@ -128,6 +132,7 @@ def get_DDX_vars(): return DDXVars + def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): addAK4 = not onlyAK8 addAK8 = not onlyAK4 @@ -152,21 +157,19 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): nCHadrons=Var("jetFlavourInfo().getcHadrons().size()", int, doc="number of c-hadrons"), - #RENAME THEM! - btagDeepB_b=Var("bDiscriminator('pfDeepCSVJetTags:probb')", - float, - doc="DeepCSV b tag discriminator", - precision=10), - btagDeepB_bb=Var("bDiscriminator('pfDeepCSVJetTags:probbb')", - float, - doc="DeepCSV bb tag discriminator", - precision=10), - btagDeepL = Var("bDiscriminator('pfDeepCSVJetTags:probudsg')", - float, - doc="DeepCSV light btag discriminator", - precision=10), - #RENAME THEM! If you can - ) + btagDeepB_b=Var("bDiscriminator('pfDeepCSVJetTags:probb')", + float, + doc="DeepCSV b tag discriminator", + precision=10), + btagDeepB_bb=Var("bDiscriminator('pfDeepCSVJetTags:probbb')", + float, + doc="DeepCSV bb tag discriminator", + precision=10), + btagDeepL=Var("bDiscriminator('pfDeepCSVJetTags:probudsg')", + float, + doc="DeepCSV light btag discriminator", + precision=10), + ) # AK4 process.customJetExtTable = cms.EDProducer( @@ -178,7 +181,7 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): singleton=cms.bool(False), # the number of entries is variable extension=cms.bool(True), # this is the extension table for Jets variables=cms.PSet( - CommonVars, + CommonVars, )) # AK8 @@ -192,10 +195,11 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): extension=cms.bool(True), # this is the extension table for FatJets variables=cms.PSet( CommonVars, - cms.PSet(btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')", - float, - doc="DeepCSV charm btag discriminator", - precision=10)), + cms.PSet( + btagDDBvLV2 = Var("bDiscriminator('pfMassIndependentDeepDoubleBvLV2JetTags:probHbb')",float,doc="DeepDoubleX V2 discriminator for H(Z)->bb vs QCD",precision=10), + btagDDCvLV2 = Var("bDiscriminator('pfMassIndependentDeepDoubleCvLV2JetTags:probHcc')",float,doc="DeepDoubleX V2 discriminator for H(Z)->cc vs QCD",precision=10), + btagDDCvBV2 = Var("bDiscriminator('pfMassIndependentDeepDoubleCvBV2JetTags:probHcc')",float,doc="DeepDoubleX V2 discriminator for H(Z)->cc vs H(Z)->bb",precision=10), + ), get_DDX_vars(), )) @@ -219,21 +223,21 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): doc="DeepCSV charm btag discriminator", precision=10), - )) + )) process.customSubJetMCExtTable = cms.EDProducer( - "SimpleCandidateFlatTableProducer", - src = subJetTable.src, - cut = subJetTable.cut, - name = subJetTable.name, - doc=subJetTable.doc, - singleton = cms.bool(False), - extension = cms.bool(True), - variables = cms.PSet( - subGenJetAK8Idx = Var("?genJetFwdRef().backRef().isNonnull()?genJetFwdRef().backRef().key():-1", - int, - doc="index of matched gen Sub jet"), - ) + "SimpleCandidateFlatTableProducer", + src = subJetTable.src, + cut = subJetTable.cut, + name = subJetTable.name, + doc=subJetTable.doc, + singleton = cms.bool(False), + extension = cms.bool(True), + variables = cms.PSet( + subGenJetAK8Idx = Var("?genJetFwdRef().backRef().isNonnull()?genJetFwdRef().backRef().key():-1", + int, + doc="index of matched gen Sub jet"), + ) ) if addAK4: @@ -242,7 +246,6 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): process.customizeJetTask.add(process.customFatJetExtTable) process.customizeJetTask.add(process.customSubJetExtTable) if runOnMC and addAK8: - process.customizeJetTask.add(process.customSubJetMCExtTable) + process.customizeJetTask.add(process.customSubJetMCExtTable) return process - From d014a30df972e1e2ad37769f23bc1080a5d00178 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Wed, 15 Jul 2020 11:53:18 +0200 Subject: [PATCH 2/2] fix readme --- README.md | 1 + test/submit_all.py | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f760f78..7af3303 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ cmsrel CMSSW_10_6_14 cd CMSSW_10_6_14/src cmsenv git cms-addpkg PhysicsTools/NanoAOD +git cms-addpkg RecoBTag/Combined git cms-merge-topic andrzejnovak:DDXV2_106 git clone https://github.com/cms-data/RecoBTag-Combined.git RecoBTag/Combined/data git clone https://github.com/cms-jet/NanoAODJMAR.git PhysicsTools/NanoAODJMAR diff --git a/test/submit_all.py b/test/submit_all.py index ded7ed1..f3aa545 100644 --- a/test/submit_all.py +++ b/test/submit_all.py @@ -115,11 +115,10 @@ def submit(config): if 'ext' in cond and not 'ext' in requestname: requestname = requestname + '_' + cond.split('_')[-1] print 'requestname = ', requestname - config.General.requestName = requestname.split('AOD')[0]+'AOD_PFNano' + config.General.requestName = requestname config.Data.inputDataset = job - config.Data.outputDatasetTag = 'RunII'+requestname.split('RunII')[1]+'_PFNano' - #config.Data.outLFNDirBase = '/store/group/lpctlbsm/NanoAODJMAR_2019_V1/Production/CRAB/' - config.Data.outLFNDirBase = '/store/user/'+os.environ['USER']+'/PFNano/' + config.Data.outputDatasetTag = cond.replace('MiniAOD','PFNanoAOD') if cond.startswith('RunII') else cond+'_PFNanoAOD' + config.Data.outLFNDirBase = '/store/user/'+os.environ['USER']+'/PFNano/106X_v1/' if datatier == 'MINIAODSIM': config.Data.splitting = 'FileBased' config.Data.unitsPerJob = 10