Skip to content

Commit

Permalink
Merge pull request #31909 from kdlong/NanoGen_10_6_18_backport
Browse files Browse the repository at this point in the history
Backport of #30306, #31591, and  #31973: NanoGen support in 10_6_X
  • Loading branch information
cmsbuild authored Nov 4, 2020
2 parents 704dd7d + ee389cc commit ff93e45
Show file tree
Hide file tree
Showing 13 changed files with 273 additions and 20 deletions.
14 changes: 14 additions & 0 deletions Configuration/Applications/python/ConfigBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,7 @@ def define_Configs(self):
self.RECOSIMDefaultCFF="Configuration/StandardSequences/RecoSim_cff"
self.PATDefaultCFF="Configuration/StandardSequences/PAT_cff"
self.NANODefaultCFF="PhysicsTools/NanoAOD/nano_cff"
self.NANOGENDefaultCFF="PhysicsTools/NanoAOD/nanogen_cff"
self.EIDefaultCFF=None
self.SKIMDefaultCFF="Configuration/StandardSequences/Skims_cff"
self.POSTRECODefaultCFF="Configuration/StandardSequences/PostRecoGenerator_cff"
Expand Down Expand Up @@ -986,6 +987,8 @@ def define_Configs(self):
self.REPACKDefaultSeq='DigiToRawRepack'
self.PATDefaultSeq='miniAOD'
self.PATGENDefaultSeq='miniGEN'
#TODO: Check based of file input
self.NANOGENDefaultSeq='nanogenSequence'
self.NANODefaultSeq='nanoSequence'

self.EVTCONTDefaultCFF="Configuration/EventContent/EventContent_cff"
Expand Down Expand Up @@ -1689,6 +1692,17 @@ def prepare_NANO(self, sequence = "nanoAOD"):
self._options.customise_commands = self._options.customise_commands + " \n"
self._options.customise_commands = self._options.customise_commands + "process.unpackedPatTrigger.triggerResults= cms.InputTag( 'TriggerResults::"+self._options.hltProcess+"' )\n"

def prepare_NANOGEN(self, sequence = "nanoAOD"):
''' Enrich the schedule with NANOGEN '''
# TODO: Need to modify this based on the input file type
fromGen = any([x in self.stepMap for x in ['LHE', 'GEN', 'AOD']])
self.loadDefaultOrSpecifiedCFF(sequence,self.NANOGENDefaultCFF)
self.scheduleSequence(sequence.split('.')[-1],'nanoAOD_step')
custom = "customizeNanoGEN" if fromGen else "customizeNanoGENFromMini"
if self._options.runUnscheduled:
self._options.customisation_file_unsch.insert(0, '.'.join([self.NANOGENDefaultCFF, custom]))
else:
self._options.customisation_file.insert(0, '.'.join([self.NANOGENDefaultCFF, custom]))

def prepare_EI(self, sequence = None):
''' Enrich the schedule with event interpretation '''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("Pythia8HadronizerFilter",
maxEventsToPrint = cms.untracked.int32(1),
Expand All @@ -13,6 +14,7 @@
PythiaParameters = cms.PSet(
pythia8CommonSettingsBlock,
pythia8CP5SettingsBlock,
pythia8PSweightsSettingsBlock,
JetMatchingParameters = cms.vstring(
'JetMatching:setMad = off',
'JetMatching:scheme = 1',
Expand All @@ -28,6 +30,7 @@
),
parameterSets = cms.vstring('pythia8CommonSettings',
'pythia8CP5Settings',
'pythia8PSweightsSettings',
'JetMatchingParameters'
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("Pythia8HadronizerFilter",
maxEventsToPrint = cms.untracked.int32(1),
Expand All @@ -12,6 +13,7 @@
PythiaParameters = cms.PSet(
pythia8CommonSettingsBlock,
pythia8CP5SettingsBlock,
pythia8PSweightsSettingsBlock,
pythia8PowhegEmissionVetoSettingsBlock,
processParameters = cms.vstring(
'POWHEG:nFinal = 2', ## Number of final state particles
Expand All @@ -21,6 +23,7 @@
),
parameterSets = cms.vstring('pythia8CommonSettings',
'pythia8CP5Settings',
'pythia8PSweightsSettings',
'pythia8PowhegEmissionVetoSettings',
'processParameters'
)
Expand Down
3 changes: 3 additions & 0 deletions Configuration/PyReleaseValidation/python/relval_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@
workflows[545]=['',['BsToMuMu_forSTEAM_13TeV_TuneCUETP8M1','HARVESTGEN']]

# 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']]
5 changes: 5 additions & 0 deletions Configuration/PyReleaseValidation/python/relval_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2905,11 +2905,16 @@ def gen2018HiMix(fragment,howMuch):
steps['MINIAODMCUP18FS'] =merge([{'--filein':'file:step1.root','--fast':'','--conditions':'auto:phase1_2018_realistic','--era':'Run2_2018_FastSim'},stepMiniAODMC])

stepNanoAODDefaults = { '-s': 'NANO,DQM:@nanoAODDQM', '-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 ])
stepNanoEDMMC = merge([{ '--mc':'' , '--eventcontent' : 'NANOEDMAODSIM,DQM','--datatier': 'NANOAODSIM,DQMIO' }, stepNanoAODDefaults ])
stepNanoEDMMCProd = merge([{ '--mc':'', '-s': 'NANO', '--eventcontent' : 'NANOEDMAODSIM','--datatier': 'NANOAODSIM' }, stepNanoAODDefaults ])
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 ])

steps['NANOAOD2016'] = merge([{'--conditions': 'auto:run2_data_relval', '--era': 'Run2_2016'}, stepNanoAODData ])
steps['NANOAOD2017'] = merge([{'--conditions': 'auto:run2_data_relval', '--era': 'Run2_2017'}, stepNanoAODData ])
Expand Down
3 changes: 3 additions & 0 deletions DQMOffline/Configuration/python/DQMOffline_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@
DQMOfflineNanoAOD = cms.Sequence(nanoDQM)
#PostDQMOfflineNanoAOD = cms.Sequence(nanoDQM)

from PhysicsTools.NanoAOD.nanogenDQM_cff import nanogenDQM
DQMOfflineNanoGen = cms.Sequence(nanogenDQM)

# L1 trigger sequences
DQMOfflineL1TMonitoring = cms.Sequence( l1TriggerDqmOffline ) # L1 emulator is run within this sequence for real data

Expand Down
4 changes: 4 additions & 0 deletions DQMOffline/Configuration/python/autoDQM.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@
'PostDQMOffline',
'DQMHarvestNanoAOD'],

'nanogenDQM': ['DQMOfflineNanoGen',
'PostDQMOffline',
'DQMHarvestNanoAOD'],

'standardDQM': ['DQMOffline',
'PostDQMOffline',
'dqmHarvesting'],
Expand Down
9 changes: 9 additions & 0 deletions PhysicsTools/NanoAOD/python/NanoAODEDMEventContent_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@
compressionLevel = cms.untracked.int32(9),
compressionAlgorithm = cms.untracked.string("LZMA"),
)

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)
)
21 changes: 21 additions & 0 deletions PhysicsTools/NanoAOD/python/genWeightsTable_cfi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import FWCore.ParameterSet.Config as cms

genWeightsTable = cms.EDProducer("GenWeightsTableProducer",
genEvent = cms.InputTag("generator"),
genLumiInfoHeader = cms.InputTag("generator"),
lheInfo = cms.VInputTag(cms.InputTag("externalLHEProducer"), cms.InputTag("source")),
preferredPDFs = cms.VPSet( # see https://lhapdf.hepforge.org/pdfsets.html
cms.PSet( name = cms.string("PDF4LHC15_nnlo_30_pdfas"), lhaid = cms.uint32(91400) ),
cms.PSet( name = cms.string("NNPDF31_nnlo_hessian_pdfas"), lhaid = cms.uint32(306000) ),
cms.PSet( name = cms.string("NNPDF30_nlo_as_0118"), lhaid = cms.uint32(260000) ), # for some 92X samples. Note that the nominal weight, 260000, is not included in the LHE ...
cms.PSet( name = cms.string("NNPDF30_lo_as_0130"), lhaid = cms.uint32(262000) ), # some MLM 80X samples have only this (e.g. /store/mc/RunIISummer16MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6_ext1-v2/120000/02A210D6-F5C3-E611-B570-008CFA197BD4.root )
cms.PSet( name = cms.string("NNPDF30_nlo_nf_4_pdfas"), lhaid = cms.uint32(292000) ), # some FXFX 80X samples have only this (e.g. WWTo1L1Nu2Q, WWTo4Q)
cms.PSet( name = cms.string("NNPDF30_nlo_nf_5_pdfas"), lhaid = cms.uint32(292200) ), # some FXFX 80X samples have only this (e.g. DYJetsToLL_Pt, WJetsToLNu_Pt, DYJetsToNuNu_Pt)
),
namedWeightIDs = cms.vstring(),
namedWeightLabels = cms.vstring(),
lheWeightPrecision = cms.int32(14),
maxPdfWeights = cms.uint32(150),
keepAllPSWeights = cms.bool(False),
debug = cms.untracked.bool(False),
)
25 changes: 25 additions & 0 deletions PhysicsTools/NanoAOD/python/nanoDQM_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,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(
Expand Down
21 changes: 1 addition & 20 deletions PhysicsTools/NanoAOD/python/nano_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from PhysicsTools.NanoAOD.ttbarCategorization_cff import *
from PhysicsTools.NanoAOD.genparticles_cff import *
from PhysicsTools.NanoAOD.particlelevel_cff import *
from PhysicsTools.NanoAOD.genWeightsTable_cfi import *
from PhysicsTools.NanoAOD.vertices_cff import *
from PhysicsTools.NanoAOD.met_cff import *
from PhysicsTools.NanoAOD.triggerObjects_cff import *
Expand Down Expand Up @@ -96,26 +97,6 @@
)


genWeightsTable = cms.EDProducer("GenWeightsTableProducer",
genEvent = cms.InputTag("generator"),
genLumiInfoHeader = cms.InputTag("generator"),
lheInfo = cms.VInputTag(cms.InputTag("externalLHEProducer"), cms.InputTag("source")),
preferredPDFs = cms.VPSet( # see https://lhapdf.hepforge.org/pdfsets.html
cms.PSet( name = cms.string("PDF4LHC15_nnlo_30_pdfas"), lhaid = cms.uint32(91400) ),
cms.PSet( name = cms.string("NNPDF31_nnlo_hessian_pdfas"), lhaid = cms.uint32(306000) ),
cms.PSet( name = cms.string("NNPDF30_nlo_as_0118"), lhaid = cms.uint32(260000) ), # for some 92X samples. Note that the nominal weight, 260000, is not included in the LHE ...
cms.PSet( name = cms.string("NNPDF30_lo_as_0130"), lhaid = cms.uint32(262000) ), # some MLM 80X samples have only this (e.g. /store/mc/RunIISummer16MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6_ext1-v2/120000/02A210D6-F5C3-E611-B570-008CFA197BD4.root )
cms.PSet( name = cms.string("NNPDF30_nlo_nf_4_pdfas"), lhaid = cms.uint32(292000) ), # some FXFX 80X samples have only this (e.g. WWTo1L1Nu2Q, WWTo4Q)
cms.PSet( name = cms.string("NNPDF30_nlo_nf_5_pdfas"), lhaid = cms.uint32(292200) ), # some FXFX 80X samples have only this (e.g. DYJetsToLL_Pt, WJetsToLNu_Pt, DYJetsToNuNu_Pt)
cms.PSet( name = cms.string("NNPDF31_lo_as_0130"), lhaid = cms.uint32(315200) ), # SUSY signal samples use this
),
namedWeightIDs = cms.vstring(),
namedWeightLabels = cms.vstring(),
lheWeightPrecision = cms.int32(14),
keepAllPSWeights = cms.bool(False),
maxPdfWeights = cms.uint32(150),
debug = cms.untracked.bool(False),
)
lheInfoTable = cms.EDProducer("LHETablesProducer",
lheInfo = cms.VInputTag(cms.InputTag("externalLHEProducer"), cms.InputTag("source")),
precision = cms.int32(14),
Expand Down
31 changes: 31 additions & 0 deletions PhysicsTools/NanoAOD/python/nanogenDQM_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import FWCore.ParameterSet.Config as cms
import copy

from PhysicsTools.NanoAOD.nanoDQM_cfi import nanoDQM
from PhysicsTools.NanoAOD.nanoDQM_tools_cff import *
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer

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 = nanoDQM.vplots.LHEPart,
LHEScaleWeight = nanoDQM.vplots.LHEScaleWeight,
LHEPdfWeight = nanoDQM.vplots.LHEPdfWeight,
PSWeight = nanoDQM.vplots.PSWeight,
)
)

nanoDQMQTester = cms.EDAnalyzer("QualityTester",
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 )
Loading

0 comments on commit ff93e45

Please sign in to comment.