From e2b3faba69733235d9ee5e79d1596a8a6c6de0da Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Fri, 25 Sep 2020 21:03:32 +0200 Subject: [PATCH 1/8] Run NanoGen from runTheMatrix.py --- .../PyReleaseValidation/python/relval_generator.py | 1 + Configuration/PyReleaseValidation/python/relval_steps.py | 7 ++++++- PhysicsTools/NanoAOD/python/nanogen_cff.py | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Configuration/PyReleaseValidation/python/relval_generator.py b/Configuration/PyReleaseValidation/python/relval_generator.py index 2ff02c90f5e43..4a129b652bcbc 100644 --- a/Configuration/PyReleaseValidation/python/relval_generator.py +++ b/Configuration/PyReleaseValidation/python/relval_generator.py @@ -40,3 +40,4 @@ workflows[545]=['',['BsToMuMu_forSTEAM_13TeV','HARVESTGEN']] # Miscellaneous +workflows[595]=['',['DYToLL_M-50_13TeV_pythia8','NANOGENFromGen']] diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 177a00c628ab7..7d91f6f22792c 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -3059,11 +3059,16 @@ def gen2021HiMix(fragment,howMuch): steps['MINIAODMCUP18ml'] =merge([concurrentLumis,steps['MINIAODMCUP18']]) stepNanoAODDefaults = { '-s': 'NANO,DQM:@nanoAODDQM', '-n': 1000 } +stepNanoGenDefaults = { '-s': 'NANOGEN', '-n': 1000 } stepNanoAODData = merge([{ '--data':'', '--eventcontent' : 'NANOAOD,DQM' ,'--datatier': 'NANOAOD,DQMIO' }, stepNanoAODDefaults ]) stepNanoAODMC = merge([{ '--mc':'' , '--eventcontent' : 'NANOAODSIM,DQM','--datatier': 'NANOAODSIM,DQMIO' }, stepNanoAODDefaults ]) stepNanoEDMData = merge([{ '--data':'', '--eventcontent' : 'NANOEDMAOD,DQM' ,'--datatier': 'NANOAOD,DQMIO' }, stepNanoAODDefaults ]) stepNanoEDMMC = merge([{ '--mc':'' , '--eventcontent' : 'NANOEDMAODSIM,DQM','--datatier': 'NANOAODSIM,DQMIO' }, stepNanoAODDefaults ]) stepNanoEDMMCProd = merge([{ '--mc':'', '-s': 'NANO', '--eventcontent' : 'NANOEDMAODSIM','--datatier': 'NANOAODSIM' }, stepNanoAODDefaults ]) +stepNanoGen = merge([{ '--mc':'' , '--eventcontent' : 'NANOAODSIM,DQM','--datatier': 'NANOAODSIM,DQMIO' }, stepNanoGenDefaults ]) + +steps['NANOGENFromGen'] = merge([{'--conditions': 'auto:run2_mc', '--customise' : 'PhysicsTools/NanoAOD/nanogen_cff.customizeNanoGEN'}, stepNanoGen ]) +steps['NANOGENFromMini'] = merge([{'--conditions': 'auto:run2_mc'}, stepNanoGen ]) steps['NANOAOD2016'] = merge([{'--conditions': 'auto:run2_data_relval', '--era': 'Run2_2016'}, stepNanoAODData ]) steps['NANOAOD2017'] = merge([{'--conditions': 'auto:run2_data_relval', '--era': 'Run2_2017'}, stepNanoAODData ]) @@ -3087,7 +3092,7 @@ def gen2021HiMix(fragment,howMuch): steps['NANOUP15'] = merge([{ '--conditions':'auto:run2_mc', '--era':'Run2_2016','-n':'10', '--filein':'file:step3_inMINIAODSIM.root','--nThreads':'2'}, stepNanoEDMMCProd ]) steps['NANOUP15_PU25']=steps['NANOUP15'] steps['NANOUP17'] = merge([{'--conditions':'auto:phase1_2017_realistic','--era': 'Run2_2017','-n':'10' ,'--filein':'file:step3_inMINIAODSIM.root', '--geometry':'DB:Extended', '--nThreads':'2'}, stepNanoEDMMCProd]) -steps['NANOUP15Had']=merge([{'--filein':'file:step4_inMINIAODSIM.root'},steps['NANOUP15']]) +steps['NANOUP15Had']=merge([{'--filein':'file:step4_inSIM.root'},steps['NANOUP15']]) steps['NANOUP15MC_PU25_JME']=merge([{'--customise':'PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD_MC'},steps['NANOUP15']]) steps['NANOUP15Data_PU25_JME']=merge([{'--customise':'PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD_Data','--data':''},steps['NANOUP15']]) steps['NANOUP17Had']=merge([{'--filein':'file:step4_inMINIAODSIM.root'},steps['NANOUP17']]) diff --git a/PhysicsTools/NanoAOD/python/nanogen_cff.py b/PhysicsTools/NanoAOD/python/nanogen_cff.py index 6c13502ea8f2d..33d88ce081c5a 100644 --- a/PhysicsTools/NanoAOD/python/nanogen_cff.py +++ b/PhysicsTools/NanoAOD/python/nanogen_cff.py @@ -105,6 +105,11 @@ def customizeNanoGEN(process): process.genJetAK8Table.src = "ak8GenJets" process.tauGenJets.GenParticles = "genParticles" process.genVisTaus.srcGenParticles = "genParticles" + + # In case customizeNanoGENFromMini has already been called + process.nanoAOD_step.remove(process.genParticles2HepMCHiggsVtx) + process.nanoAOD_step.remove(process.genParticles2HepMC) + process.nanoAOD_step.remove(process.mergedGenParticles) nanoGenCommonCustomize(process) return process From 230a45533cfb259aec2900c35333757a48a31547 Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Sat, 26 Sep 2020 14:23:36 +0200 Subject: [PATCH 2/8] Add DQM support, improve nanogen configs --- .../python/relval_steps.py | 2 +- .../Configuration/python/DQMOffline_cff.py | 2 ++ DQMOffline/Configuration/python/autoDQM.py | 4 +++ PhysicsTools/NanoAOD/python/nanogen_cff.py | 28 +++++++++---------- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 7d91f6f22792c..7bfb85d5bdf88 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -3059,7 +3059,7 @@ def gen2021HiMix(fragment,howMuch): steps['MINIAODMCUP18ml'] =merge([concurrentLumis,steps['MINIAODMCUP18']]) stepNanoAODDefaults = { '-s': 'NANO,DQM:@nanoAODDQM', '-n': 1000 } -stepNanoGenDefaults = { '-s': 'NANOGEN', '-n': 1000 } +stepNanoGenDefaults = { '-s': 'NANOGEN,DQM:@nanogenDQM', '-n': 1000 } stepNanoAODData = merge([{ '--data':'', '--eventcontent' : 'NANOAOD,DQM' ,'--datatier': 'NANOAOD,DQMIO' }, stepNanoAODDefaults ]) stepNanoAODMC = merge([{ '--mc':'' , '--eventcontent' : 'NANOAODSIM,DQM','--datatier': 'NANOAODSIM,DQMIO' }, stepNanoAODDefaults ]) stepNanoEDMData = merge([{ '--data':'', '--eventcontent' : 'NANOEDMAOD,DQM' ,'--datatier': 'NANOAOD,DQMIO' }, stepNanoAODDefaults ]) diff --git a/DQMOffline/Configuration/python/DQMOffline_cff.py b/DQMOffline/Configuration/python/DQMOffline_cff.py index b00a5b93181b7..f91223247653a 100644 --- a/DQMOffline/Configuration/python/DQMOffline_cff.py +++ b/DQMOffline/Configuration/python/DQMOffline_cff.py @@ -244,3 +244,5 @@ from PhysicsTools.NanoAOD.nanoDQM_cff import nanoDQM DQMOfflineNanoAOD = cms.Sequence(nanoDQM) #PostDQMOfflineNanoAOD = cms.Sequence(nanoDQM) +from PhysicsTools.NanoAOD.nanogenDQM_cff import nanogenDQM +DQMOfflineNanoGen = cms.Sequence(nanogenDQM) diff --git a/DQMOffline/Configuration/python/autoDQM.py b/DQMOffline/Configuration/python/autoDQM.py index 600e825af3493..85387999b37a6 100644 --- a/DQMOffline/Configuration/python/autoDQM.py +++ b/DQMOffline/Configuration/python/autoDQM.py @@ -181,6 +181,10 @@ 'PostDQMOffline', 'DQMHarvestNanoAOD'], + 'nanogenDQM': ['DQMOfflineNanoGen', + 'PostDQMOffline', + 'DQMHarvestNanoAOD'], + 'pfDQM': ['DQMOfflinePF+DQMOfflinePFExtended', 'PostDQMOffline', 'DQMHarvestPF'], diff --git a/PhysicsTools/NanoAOD/python/nanogen_cff.py b/PhysicsTools/NanoAOD/python/nanogen_cff.py index 33d88ce081c5a..ec6806d5270bb 100644 --- a/PhysicsTools/NanoAOD/python/nanogen_cff.py +++ b/PhysicsTools/NanoAOD/python/nanogen_cff.py @@ -1,6 +1,7 @@ from PhysicsTools.NanoAOD.taus_cff import * from PhysicsTools.NanoAOD.jets_cff import * from PhysicsTools.NanoAOD.globals_cff import * +from PhysicsTools.NanoAOD.met_cff import metMCTable from PhysicsTools.NanoAOD.genparticles_cff import * from PhysicsTools.NanoAOD.particlelevel_cff import * from PhysicsTools.NanoAOD.lheInfoTable_cfi import * @@ -12,18 +13,6 @@ ) ) -metGenTable = cms.EDProducer("SimpleCandidateFlatTableProducer", - src = cms.InputTag("genMetTrue"), - name = cms.string("GenMET"), - doc = cms.string("Gen MET"), - singleton = cms.bool(True), - extension = cms.bool(False), - variables = cms.PSet( - pt = Var("pt", float, doc="pt", precision=10), - phi = Var("phi", float, doc="phi", precision=10), - ), -) - nanogenSequence = cms.Sequence( nanoMetadata+ particleLevel+ @@ -43,7 +32,7 @@ tautagger+ rivetProducerHTXS+ particleLevelTables+ - metGenTable+ + metMCTable+ genWeightsTable+ lheInfoTable ) @@ -66,6 +55,7 @@ ) def nanoGenCommonCustomize(process): + process.rivetMetTable.extension = False process.lheInfoTable.storeLHEParticles = True process.lheInfoTable.precision = 14 process.genJetFlavourAssociation.jets = process.genJetTable.src @@ -82,6 +72,10 @@ def customizeNanoGENFromMini(process): process.nanoAOD_step.insert(0, process.genParticles2HepMC) process.nanoAOD_step.insert(0, process.mergedGenParticles) + process.metMCTable.src = "slimmedMETs" + process.metMCTable.variables.pt = Var("genMET.pt", float, doc="pt", precision=10) + process.metMCTable.variables.phi = Var("genMET.phi", float, doc="phi", precision=10) + process.rivetProducerHTXS.HepMCCollection = "genParticles2HepMCHiggsVtx:unsmeared" process.genParticleTable.src = "prunedGenParticles" process.patJetPartons.particles = "prunedGenParticles" @@ -96,6 +90,10 @@ def customizeNanoGENFromMini(process): return process def customizeNanoGEN(process): + process.metMCTable.src = "genMetTrue" + process.metMCTable.variables.pt = Var("pt", float, doc="pt", precision=10) + process.metMCTable.variables.phi = Var("phi", float, doc="phi", precision=10) + process.rivetProducerHTXS.HepMCCollection = "generatorSmeared" process.genParticleTable.src = "genParticles" process.patJetPartons.particles = "genParticles" @@ -140,8 +138,8 @@ def setGenFullPrecision(process): process.genJetTable.variables.pt.precision = 23 process.genJetTable.variables.eta.precision = 23 process.genJetTable.variables.phi.precision = 23 - process.metGenTable.variables.pt.precision = 23 - process.metGenTable.variables.phi.precision = 23 + process.metMCTable.variables.pt.precision = 23 + process.metMCTable.variables.phi.precision = 23 return process def setLHEFullPrecision(process): From 7718b883e26e314d4f7940b78e65b3adc8ab410f Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Sat, 26 Sep 2020 15:28:57 +0200 Subject: [PATCH 3/8] Clean up output, remove trigger branches --- .../python/relval_steps.py | 2 +- .../python/NanoAODEDMEventContent_cff.py | 7 ++++++- PhysicsTools/NanoAOD/python/nanogen_cff.py | 19 +------------------ 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 7bfb85d5bdf88..c7eab8de47a6a 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -3065,7 +3065,7 @@ def gen2021HiMix(fragment,howMuch): stepNanoEDMData = merge([{ '--data':'', '--eventcontent' : 'NANOEDMAOD,DQM' ,'--datatier': 'NANOAOD,DQMIO' }, stepNanoAODDefaults ]) stepNanoEDMMC = merge([{ '--mc':'' , '--eventcontent' : 'NANOEDMAODSIM,DQM','--datatier': 'NANOAODSIM,DQMIO' }, stepNanoAODDefaults ]) stepNanoEDMMCProd = merge([{ '--mc':'', '-s': 'NANO', '--eventcontent' : 'NANOEDMAODSIM','--datatier': 'NANOAODSIM' }, stepNanoAODDefaults ]) -stepNanoGen = merge([{ '--mc':'' , '--eventcontent' : 'NANOAODSIM,DQM','--datatier': 'NANOAODSIM,DQMIO' }, stepNanoGenDefaults ]) +stepNanoGen = merge([{ '--mc':'' , '--eventcontent' : 'NANOAODGEN,DQM','--datatier': 'NANOAODSIM,DQMIO' }, stepNanoGenDefaults ]) steps['NANOGENFromGen'] = merge([{'--conditions': 'auto:run2_mc', '--customise' : 'PhysicsTools/NanoAOD/nanogen_cff.customizeNanoGEN'}, stepNanoGen ]) steps['NANOGENFromMini'] = merge([{'--conditions': 'auto:run2_mc'}, stepNanoGen ]) diff --git a/PhysicsTools/NanoAOD/python/NanoAODEDMEventContent_cff.py b/PhysicsTools/NanoAOD/python/NanoAODEDMEventContent_cff.py index fa1144ac41330..d2e1f939d795e 100644 --- a/PhysicsTools/NanoAOD/python/NanoAODEDMEventContent_cff.py +++ b/PhysicsTools/NanoAOD/python/NanoAODEDMEventContent_cff.py @@ -19,7 +19,12 @@ compressionLevel = cms.untracked.int32(9), compressionAlgorithm = cms.untracked.string("LZMA"), ) -NANOAODGENEventContent = NanoAODEDMEventContent.clone( + +NanoGenOutput = NanoAODEDMEventContent.outputCommands[:] +NanoGenOutput.remove("keep edmTriggerResults_*_*_*") + +NANOAODGENEventContent = cms.PSet( compressionLevel = cms.untracked.int32(9), compressionAlgorithm = cms.untracked.string("LZMA"), + outputCommands = cms.untracked.vstring(NanoGenOutput) ) diff --git a/PhysicsTools/NanoAOD/python/nanogen_cff.py b/PhysicsTools/NanoAOD/python/nanogen_cff.py index ec6806d5270bb..0eeddd06b1bcb 100644 --- a/PhysicsTools/NanoAOD/python/nanogen_cff.py +++ b/PhysicsTools/NanoAOD/python/nanogen_cff.py @@ -1,6 +1,6 @@ from PhysicsTools.NanoAOD.taus_cff import * from PhysicsTools.NanoAOD.jets_cff import * -from PhysicsTools.NanoAOD.globals_cff import * +from PhysicsTools.NanoAOD.globals_cff import genTable from PhysicsTools.NanoAOD.met_cff import metMCTable from PhysicsTools.NanoAOD.genparticles_cff import * from PhysicsTools.NanoAOD.particlelevel_cff import * @@ -37,23 +37,6 @@ lheInfoTable ) -NANOAODGENoutput = cms.OutputModule("NanoAODOutputModule", - compressionAlgorithm = cms.untracked.string('LZMA'), - compressionLevel = cms.untracked.int32(9), - dataset = cms.untracked.PSet( - dataTier = cms.untracked.string('NANOAODSIM'), - filterName = cms.untracked.string('') - ), - fileName = cms.untracked.string('nanogen.root'), - outputCommands = cms.untracked.vstring( - 'drop *', - "keep nanoaodFlatTable_*Table_*_*", # event data - "keep String_*_genModel_*", # generator model data - "keep nanoaodMergeableCounterTable_*Table_*_*", # accumulated per/run or per/lumi data - "keep nanoaodUniqueString_nanoMetadata_*_*", # basic metadata - ) -) - def nanoGenCommonCustomize(process): process.rivetMetTable.extension = False process.lheInfoTable.storeLHEParticles = True From ee6a465490cf240f248484aa80aaab61cc4c874f Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Sat, 26 Sep 2020 15:56:41 +0200 Subject: [PATCH 4/8] Revert accidental change --- Configuration/PyReleaseValidation/python/relval_steps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index c7eab8de47a6a..90f316fbb5b69 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -3092,7 +3092,7 @@ def gen2021HiMix(fragment,howMuch): steps['NANOUP15'] = merge([{ '--conditions':'auto:run2_mc', '--era':'Run2_2016','-n':'10', '--filein':'file:step3_inMINIAODSIM.root','--nThreads':'2'}, stepNanoEDMMCProd ]) steps['NANOUP15_PU25']=steps['NANOUP15'] steps['NANOUP17'] = merge([{'--conditions':'auto:phase1_2017_realistic','--era': 'Run2_2017','-n':'10' ,'--filein':'file:step3_inMINIAODSIM.root', '--geometry':'DB:Extended', '--nThreads':'2'}, stepNanoEDMMCProd]) -steps['NANOUP15Had']=merge([{'--filein':'file:step4_inSIM.root'},steps['NANOUP15']]) +steps['NANOUP15Had']=merge([{'--filein':'file:step4_inMINIAODSIM.root'},steps['NANOUP15']]) steps['NANOUP15MC_PU25_JME']=merge([{'--customise':'PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD_MC'},steps['NANOUP15']]) steps['NANOUP15Data_PU25_JME']=merge([{'--customise':'PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD_Data','--data':''},steps['NANOUP15']]) steps['NANOUP17Had']=merge([{'--filein':'file:step4_inMINIAODSIM.root'},steps['NANOUP17']]) From 5ddf006519e6185b4c4ffc0f1f6f223ff837dd43 Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Sat, 26 Sep 2020 17:29:42 +0200 Subject: [PATCH 5/8] Add nanogenDQM file --- PhysicsTools/NanoAOD/python/nanogenDQM_cff.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 PhysicsTools/NanoAOD/python/nanogenDQM_cff.py diff --git a/PhysicsTools/NanoAOD/python/nanogenDQM_cff.py b/PhysicsTools/NanoAOD/python/nanogenDQM_cff.py new file mode 100644 index 0000000000000..45cc01da8950e --- /dev/null +++ b/PhysicsTools/NanoAOD/python/nanogenDQM_cff.py @@ -0,0 +1,28 @@ +import FWCore.ParameterSet.Config as cms +import copy + +from PhysicsTools.NanoAOD.nanoDQM_cfi import nanoDQM +from PhysicsTools.NanoAOD.nanoDQM_tools_cff import * + + +nanogenDQM = nanoDQM.clone() + +nanogenDQM.vplots = [nanoDQM.vplots.GenDressedLepton, + nanoDQM.vplots.GenIsolatedPhoton, + nanoDQM.vplots.GenJet, + nanoDQM.vplots.GenJetAK8, + nanoDQM.vplots.GenMET, + nanoDQM.vplots.GenPart, + nanoDQM.vplots.GenVisTau, + ] + +from DQMServices.Core.DQMQualityTester import DQMQualityTester +nanoDQMQTester = DQMQualityTester( + qtList = cms.untracked.FileInPath('PhysicsTools/NanoAOD/test/dqmQualityTests.xml'), + prescaleFactor = cms.untracked.int32(1), + testInEventloop = cms.untracked.bool(False), + qtestOnEndLumi = cms.untracked.bool(False), + verboseQT = cms.untracked.bool(True) +) + +nanogenHarvest = cms.Sequence( nanoDQMQTester ) From 48f14426e7a9f15aaba7ba91fa7a724b451dd0f4 Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Wed, 7 Oct 2020 17:17:30 +0200 Subject: [PATCH 6/8] A few more NanoGen DQM plots, update default precision --- .../python/relval_generator.py | 3 +- PhysicsTools/NanoAOD/python/nanogenDQM_cff.py | 53 +++++++++++++++---- PhysicsTools/NanoAOD/python/nanogen_cff.py | 33 +++++++++--- 3 files changed, 69 insertions(+), 20 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/relval_generator.py b/Configuration/PyReleaseValidation/python/relval_generator.py index 4a129b652bcbc..d9b4681d7b083 100644 --- a/Configuration/PyReleaseValidation/python/relval_generator.py +++ b/Configuration/PyReleaseValidation/python/relval_generator.py @@ -40,4 +40,5 @@ workflows[545]=['',['BsToMuMu_forSTEAM_13TeV','HARVESTGEN']] # Miscellaneous -workflows[595]=['',['DYToLL_M-50_13TeV_pythia8','NANOGENFromGen']] +workflows[546]=['',['DYToLL_M-50_13TeV_pythia8','NANOGENFromGen']] +workflows[547]=['',['DYToll01234Jets_5f_LO_MLM_Madgraph_LHE_13TeV','Hadronizer_TuneCP5_13TeV_MLM_5f_max4j_LHE_pythia8','NANOGENFromGen']] diff --git a/PhysicsTools/NanoAOD/python/nanogenDQM_cff.py b/PhysicsTools/NanoAOD/python/nanogenDQM_cff.py index 45cc01da8950e..ace11206e4426 100644 --- a/PhysicsTools/NanoAOD/python/nanogenDQM_cff.py +++ b/PhysicsTools/NanoAOD/python/nanogenDQM_cff.py @@ -3,18 +3,49 @@ from PhysicsTools.NanoAOD.nanoDQM_cfi import nanoDQM from PhysicsTools.NanoAOD.nanoDQM_tools_cff import * +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer - -nanogenDQM = nanoDQM.clone() - -nanogenDQM.vplots = [nanoDQM.vplots.GenDressedLepton, - nanoDQM.vplots.GenIsolatedPhoton, - nanoDQM.vplots.GenJet, - nanoDQM.vplots.GenJetAK8, - nanoDQM.vplots.GenMET, - nanoDQM.vplots.GenPart, - nanoDQM.vplots.GenVisTau, - ] +nanogenDQM = DQMEDAnalyzer("NanoAODDQM", + vplots = cms.PSet(GenDressedLepton = nanoDQM.vplots.GenDressedLepton, + GenIsolatedPhoton = nanoDQM.vplots.GenIsolatedPhoton, + GenJet = nanoDQM.vplots.GenJet, + GenJetAK8 = nanoDQM.vplots.GenJetAK8, + GenMET = nanoDQM.vplots.GenMET, + GenPart = nanoDQM.vplots.GenPart, + GenVisTau = nanoDQM.vplots.GenVisTau, + LHEPart = cms.PSet( + sels = cms.PSet(), + plots = cms.VPSet( + Count1D('_size', 20, 0, 20, 'LHE particles'), + Plot1D('eta', 'eta', 20, -30000, 30000, 'eta'), + Plot1D('pdgId', 'pdgId', 20, -6000, 6000, 'PDG id'), + Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'), + Plot1D('pt', 'pt', 20, 0, 200, 'pt'), + ) + ), + LHEScaleWeight = cms.PSet( + sels = cms.PSet(), + plots = cms.VPSet( + Count1D('_size', 20, 0, 20, 'LHE scale weights'), + Plot1D('', '', 100, 0, 2, 'all weights'), + ) + ), + LHEPdfWeight = cms.PSet( + sels = cms.PSet(), + plots = cms.VPSet( + Count1D('_size', 1000, 0, 2000, 'LHE PDF weights'), + Plot1D('', '', 100, 0, 2, 'all weights'), + ) + ), + PSWeight = cms.PSet( + sels = cms.PSet(), + plots = cms.VPSet( + Count1D('_size', 50, 0, 50, 'LHE PDF weights'), + Plot1D('', '', 100, 0, 2, 'all weights'), + ) + ), + ) +) from DQMServices.Core.DQMQualityTester import DQMQualityTester nanoDQMQTester = DQMQualityTester( diff --git a/PhysicsTools/NanoAOD/python/nanogen_cff.py b/PhysicsTools/NanoAOD/python/nanogen_cff.py index 0eeddd06b1bcb..201d6eb95eff7 100644 --- a/PhysicsTools/NanoAOD/python/nanogen_cff.py +++ b/PhysicsTools/NanoAOD/python/nanogen_cff.py @@ -6,6 +6,7 @@ from PhysicsTools.NanoAOD.particlelevel_cff import * from PhysicsTools.NanoAOD.lheInfoTable_cfi import * from PhysicsTools.NanoAOD.genWeightsTable_cfi import * +from PhysicsTools.NanoAOD.common_cff import CandVars nanoMetadata = cms.EDProducer("UniqueStringProducer", strings = cms.PSet( @@ -49,6 +50,10 @@ def nanoGenCommonCustomize(process): process.particleLevel.lepMinPt = 0. process.particleLevel.lepMaxEta = 999. process.genJetFlavourTable.jetFlavourInfos = "genJetFlavourAssociation" + # Same as default RECO + setGenPhiPrecision(process, CandVars.pt.precision) + setGenPtPrecision(process, CandVars.eta.precision) + setGenPhiPrecision(process, CandVars.phi.precision) def customizeNanoGENFromMini(process): process.nanoAOD_step.insert(0, process.genParticles2HepMCHiggsVtx) @@ -115,14 +120,26 @@ def pruneGenParticlesMini(process): return process def setGenFullPrecision(process): - process.genParticleTable.variables.pt.precision = 23 - process.genParticleTable.variables.eta.precision = 23 - process.genParticleTable.variables.phi.precision = 23 - process.genJetTable.variables.pt.precision = 23 - process.genJetTable.variables.eta.precision = 23 - process.genJetTable.variables.phi.precision = 23 - process.metMCTable.variables.pt.precision = 23 - process.metMCTable.variables.phi.precision = 23 + setGenPtPrecision(process, 23) + setGenEtaPrecision(process, 23) + setGenPhiPrecision(process, 23) + +def setGenPtPrecision(process, precision): + process.genParticleTable.variables.pt.precision = precision + process.genJetTable.variables.pt.precision = precision + process.metMCTable.variables.pt.precision = precision + return process + +def setGenEtaPrecision(process, precision): + process.genParticleTable.variables.eta.precision = precision + process.genJetTable.variables.eta.precision = precision + process.metMCTable.variables.eta.precision = precision + return process + +def setGenPhiPrecision(process, precision): + process.genParticleTable.variables.phi.precision = precision + process.genJetTable.variables.phi.precision = precision + process.metMCTable.variables.phi.precision = precision return process def setLHEFullPrecision(process): From 51563cd380ba2cfdd9c5696a90652094f627c695 Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Tue, 13 Oct 2020 21:37:25 +0200 Subject: [PATCH 7/8] Add lhe and weights plots to main nano dqm Update generator configs --- ...eCP5_13TeV_MLM_5f_max4j_LHE_pythia8_cff.py | 3 ++ ..._13TeV_powhegEmissionVeto2p_pythia8_cff.py | 3 ++ .../python/relval_generator.py | 1 + PhysicsTools/NanoAOD/python/nanoDQM_cfi.py | 31 ++++++++++++++++ PhysicsTools/NanoAOD/python/nanogenDQM_cff.py | 35 +++---------------- 5 files changed, 42 insertions(+), 31 deletions(-) diff --git a/Configuration/Generator/python/Hadronizer_TuneCP5_13TeV_MLM_5f_max4j_LHE_pythia8_cff.py b/Configuration/Generator/python/Hadronizer_TuneCP5_13TeV_MLM_5f_max4j_LHE_pythia8_cff.py index 3c71590a6d19d..c14b48312c6e1 100644 --- a/Configuration/Generator/python/Hadronizer_TuneCP5_13TeV_MLM_5f_max4j_LHE_pythia8_cff.py +++ b/Configuration/Generator/python/Hadronizer_TuneCP5_13TeV_MLM_5f_max4j_LHE_pythia8_cff.py @@ -3,6 +3,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * +from Configuration.Generator.PSweightsPythia.PythiaPSweightsSettings_cfi import * generator = cms.EDFilter("Pythia8ConcurrentHadronizerFilter", maxEventsToPrint = cms.untracked.int32(1), @@ -13,6 +14,7 @@ PythiaParameters = cms.PSet( pythia8CommonSettingsBlock, pythia8CP5SettingsBlock, + pythia8PSweightsSettingsBlock, JetMatchingParameters = cms.vstring( 'JetMatching:setMad = off', 'JetMatching:scheme = 1', @@ -28,6 +30,7 @@ ), parameterSets = cms.vstring('pythia8CommonSettings', 'pythia8CP5Settings', + 'pythia8PSweightsSettings', 'JetMatchingParameters' ) diff --git a/Configuration/Generator/python/Hadronizer_TuneCP5_13TeV_powhegEmissionVeto2p_pythia8_cff.py b/Configuration/Generator/python/Hadronizer_TuneCP5_13TeV_powhegEmissionVeto2p_pythia8_cff.py index 36492389bbf99..020c25e857e2a 100644 --- a/Configuration/Generator/python/Hadronizer_TuneCP5_13TeV_powhegEmissionVeto2p_pythia8_cff.py +++ b/Configuration/Generator/python/Hadronizer_TuneCP5_13TeV_powhegEmissionVeto2p_pythia8_cff.py @@ -2,6 +2,7 @@ from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * from Configuration.Generator.Pythia8PowhegEmissionVetoSettings_cfi import * +from Configuration.Generator.PSweightsPythia.PythiaPSweightsSettings_cfi import * generator = cms.EDFilter("Pythia8ConcurrentHadronizerFilter", maxEventsToPrint = cms.untracked.int32(1), @@ -12,6 +13,7 @@ PythiaParameters = cms.PSet( pythia8CommonSettingsBlock, pythia8CP5SettingsBlock, + pythia8PSweightsSettingsBlock, pythia8PowhegEmissionVetoSettingsBlock, processParameters = cms.vstring( 'POWHEG:nFinal = 2', ## Number of final state particles @@ -21,6 +23,7 @@ ), parameterSets = cms.vstring('pythia8CommonSettings', 'pythia8CP5Settings', + 'pythia8PSweightsSettings', 'pythia8PowhegEmissionVetoSettings', 'processParameters' ) diff --git a/Configuration/PyReleaseValidation/python/relval_generator.py b/Configuration/PyReleaseValidation/python/relval_generator.py index d9b4681d7b083..27c92c690d119 100644 --- a/Configuration/PyReleaseValidation/python/relval_generator.py +++ b/Configuration/PyReleaseValidation/python/relval_generator.py @@ -42,3 +42,4 @@ # Miscellaneous workflows[546]=['',['DYToLL_M-50_13TeV_pythia8','NANOGENFromGen']] workflows[547]=['',['DYToll01234Jets_5f_LO_MLM_Madgraph_LHE_13TeV','Hadronizer_TuneCP5_13TeV_MLM_5f_max4j_LHE_pythia8','NANOGENFromGen']] +workflows[548]=['',['TTbar_Pow_LHE_13TeV','Hadronizer_TuneCP5_13TeV_powhegEmissionVeto2p_pythia8','NANOGENFromGen']] diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py index 33a6b8ea6633c..03e183c151efd 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py @@ -661,5 +661,36 @@ Plot1D('pt', 'pt', 40, 0, 400, 'pt'), ) ), + LHEPart = cms.PSet( + sels = cms.PSet(), + plots = cms.VPSet( + Count1D('_size', 20, 0, 20, 'LHE particles'), + Plot1D('eta', 'eta', 20, -30000, 30000, 'eta'), + Plot1D('pdgId', 'pdgId', 20, -6000, 6000, 'PDG id'), + Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'), + Plot1D('pt', 'pt', 20, 0, 200, 'pt'), + ) + ), + LHEScaleWeight = cms.PSet( + sels = cms.PSet(), + plots = cms.VPSet( + Count1D('_size', 20, 0, 20, 'LHE scale weights'), + Plot1D('', '', 100, 0, 2, 'all weights'), + ) + ), + LHEPdfWeight = cms.PSet( + sels = cms.PSet(), + plots = cms.VPSet( + Count1D('_size', 1000, 0, 2000, 'LHE PDF weights'), + Plot1D('', '', 100, 0, 2, 'all weights'), + ) + ), + PSWeight = cms.PSet( + sels = cms.PSet(), + plots = cms.VPSet( + Count1D('_size', 50, 0, 50, 'LHE PDF weights'), + Plot1D('', '', 100, 0, 2, 'all weights'), + ) + ), ) ) diff --git a/PhysicsTools/NanoAOD/python/nanogenDQM_cff.py b/PhysicsTools/NanoAOD/python/nanogenDQM_cff.py index ace11206e4426..b7f8b408df4c2 100644 --- a/PhysicsTools/NanoAOD/python/nanogenDQM_cff.py +++ b/PhysicsTools/NanoAOD/python/nanogenDQM_cff.py @@ -13,37 +13,10 @@ GenMET = nanoDQM.vplots.GenMET, GenPart = nanoDQM.vplots.GenPart, GenVisTau = nanoDQM.vplots.GenVisTau, - LHEPart = cms.PSet( - sels = cms.PSet(), - plots = cms.VPSet( - Count1D('_size', 20, 0, 20, 'LHE particles'), - Plot1D('eta', 'eta', 20, -30000, 30000, 'eta'), - Plot1D('pdgId', 'pdgId', 20, -6000, 6000, 'PDG id'), - Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'), - Plot1D('pt', 'pt', 20, 0, 200, 'pt'), - ) - ), - LHEScaleWeight = cms.PSet( - sels = cms.PSet(), - plots = cms.VPSet( - Count1D('_size', 20, 0, 20, 'LHE scale weights'), - Plot1D('', '', 100, 0, 2, 'all weights'), - ) - ), - LHEPdfWeight = cms.PSet( - sels = cms.PSet(), - plots = cms.VPSet( - Count1D('_size', 1000, 0, 2000, 'LHE PDF weights'), - Plot1D('', '', 100, 0, 2, 'all weights'), - ) - ), - PSWeight = cms.PSet( - sels = cms.PSet(), - plots = cms.VPSet( - Count1D('_size', 50, 0, 50, 'LHE PDF weights'), - Plot1D('', '', 100, 0, 2, 'all weights'), - ) - ), + LHEPart = nanoDQM.vplots.LHEPart, + LHEScaleWeight = nanoDQM.vplots.LHEScaleWeight, + LHEPdfWeight = nanoDQM.vplots.LHEPdfWeight, + PSWeight = nanoDQM.vplots.PSWeight, ) ) From fa3e79a433b08c5d82f0b01102991dd62ccd9a6b Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Wed, 14 Oct 2020 00:23:06 +0200 Subject: [PATCH 8/8] Minimize changes to nanoDQM fix duplicates --- PhysicsTools/NanoAOD/python/nanoDQM_cfi.py | 56 ++++++++++------------ 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py index 03e183c151efd..85dc60079f0a0 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py @@ -351,6 +351,31 @@ Plot1D('rawFactor', 'rawFactor', 20, -0.5, 0.5, '1 - Factor to get back to raw pT'), ) ), + LHEPart = cms.PSet( + sels = cms.PSet(), + plots = cms.VPSet( + Count1D('_size', 20, 0, 20, 'LHE particles'), + Plot1D('eta', 'eta', 20, -30000, 30000, 'eta'), + Plot1D('pdgId', 'pdgId', 20, -6000, 6000, 'PDG id'), + Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'), + Plot1D('pt', 'pt', 20, 0, 200, 'pt'), + ) + ), + LHEPdfWeight = cms.PSet( + sels = cms.PSet(), + plots = cms.VPSet( + Count1D('_size', 1000, 0, 2000, 'LHE PDF weights'), + Plot1D('', '', 100, 0, 2, 'all weights'), + ) + ), + LHEScaleWeight = cms.PSet( + sels = cms.PSet(), + plots = cms.VPSet( + Count1D('_size', 20, 0, 20, 'LHE scale weights'), + Plot1D('', '', 100, 0, 2, 'all weights'), + ) + ), + MET = cms.PSet( sels = cms.PSet(), plots = cms.VPSet( @@ -661,36 +686,5 @@ Plot1D('pt', 'pt', 40, 0, 400, 'pt'), ) ), - LHEPart = cms.PSet( - sels = cms.PSet(), - plots = cms.VPSet( - Count1D('_size', 20, 0, 20, 'LHE particles'), - Plot1D('eta', 'eta', 20, -30000, 30000, 'eta'), - Plot1D('pdgId', 'pdgId', 20, -6000, 6000, 'PDG id'), - Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'), - Plot1D('pt', 'pt', 20, 0, 200, 'pt'), - ) - ), - LHEScaleWeight = cms.PSet( - sels = cms.PSet(), - plots = cms.VPSet( - Count1D('_size', 20, 0, 20, 'LHE scale weights'), - Plot1D('', '', 100, 0, 2, 'all weights'), - ) - ), - LHEPdfWeight = cms.PSet( - sels = cms.PSet(), - plots = cms.VPSet( - Count1D('_size', 1000, 0, 2000, 'LHE PDF weights'), - Plot1D('', '', 100, 0, 2, 'all weights'), - ) - ), - PSWeight = cms.PSet( - sels = cms.PSet(), - plots = cms.VPSet( - Count1D('_size', 50, 0, 50, 'LHE PDF weights'), - Plot1D('', '', 100, 0, 2, 'all weights'), - ) - ), ) )