Commit 59f97ade authored by Cyril Becot's avatar Cyril Becot
Browse files

New tag

parent 40f9c54d
2020-08-24 Cyril Becot <cyril.becot@cern.ch>
* tag MC15JobOptions-01-04-02
* add MadGraphControl_SimplifiedModelPostInclude_ForExtensions.py MadGraphControl_SimplifiedModel_WH125_N2N2_ForExtensions.py MadGraphControl_SimplifiedModel_ttH125_N2N2_ForExtensions.py
* add MadGraphControl_SimplifiedModelPreInclude_ForExtensions.py MadGraphControl_SimplifiedModel_ZH125_N2N2_ForExtensions.py
* up 438990-439016
2020-08-24 Joany Manjarres <joany@cern.ch>
* tag MC15JobOptions-01-04-01
* add JO 399550-54
......
# This comes after all Simplified Model setup files
from MadGraphControl.MadGraphUtils import SUSY_SM_Generation
from MadGraphControl.MadGraphUtils import build_param_card
try:
from MadGraphControl.MadGraphUtils import update_lhe_file
except ImportError:
print "Will not be able to update LHE file using this release"
try:
from MadGraphControl.MadGraphUtils import run_madspin
except ImportError:
print "Will not be able to run madspin on existing LHE file using this release"
# Set maximum number of events if the event multiplier has been modified
if evt_multiplier>0:
if runArgs.maxEvents>0:
nevts=runArgs.maxEvents*evt_multiplier
else:
nevts=5000*evt_multiplier
if njets<0:
evgenLog.fatal('njets is not set')
raise RuntimeError('njet is not set')
# systematic variation
if 'scup' in runArgs.jobConfig[0]:
syst_mod=dict_index_syst[0]
elif 'scdw' in runArgs.jobConfig[0]:
syst_mod=dict_index_syst[1]
elif 'alup' in runArgs.jobConfig[0]:
syst_mod=dict_index_syst[2]
elif 'aldw' in runArgs.jobConfig[0]:
syst_mod=dict_index_syst[3]
elif 'qcup' in runArgs.jobConfig[0]:
syst_mod=dict_index_syst[6]
elif 'qcdw' in runArgs.jobConfig[0]:
syst_mod=dict_index_syst[7]
# Set up for grid pack running
gridpackDirName=None
if hasattr(runArgs, "inputGenConfFile"):
gridpackDirName='madevent/'
if 'writeGridpack' not in dir():
writeGridpack=False
# Pass arguments as a dictionary: the "decays" argument is not accepted in older versions of MadGraphControl
argdict = {'runArgs' : runArgs,
'process' : process,
'gentype' : gentype,
'decaytype': decaytype,
'masses' : masses,
'decays' : decays,
'madspin_card' : madspin_card,
}
if not SLHAonly and (not hasattr(runArgs,'inputGeneratorFile') or runArgs.inputGeneratorFile is None):
# If it has not been set explicitly, set it now
if not 'ickkw' in extras: extras['ickkw'] = 0
argdict.update({'nevts' : nevts,
'syst_mod' : syst_mod,
'xqcut' : xqcut,
'writeGridpack' : writeGridpack,
'gridpackDirName': gridpackDirName,
'keepOutput' : keepOutput,
'pdlabel' : "'nn23lo1'",
'lhaid' : 247000,
'extras' : extras,
})
try:
[qcut,outputDS] = SUSY_SM_Generation(**argdict)
except TypeError:
# Older version of MadGraphControl
try:
del argdict['extras']
[qcut,outputDS] = SUSY_SM_Generation(**argdict)
except TypeError:
del argdict['decays']
[qcut,outputDS] = SUSY_SM_Generation(**argdict)
elif not hasattr(runArgs,'inputGeneratorFile') or runArgs.inputGeneratorFile is None:
argdict.update({'nevts' : 10000,
'syst_mod' : None,
'xqcut' : xqcut,
'SLHAonly' : True,
'keepOutput': keepOutput,
'extras' : extras,
})
try:
[qcut,outputDS] = SUSY_SM_Generation(**argdict)
except TypeError:
# Older version of MadGraphControl
try:
del argdict['extras']
[qcut,outputDS] = SUSY_SM_Generation(**argdict)
except TypeError:
del argdict['decays']
[qcut,outputDS] = SUSY_SM_Generation(**argdict)
else:
build_param_card(param_card_old='param_card.SM.%s.%s.dat'%(gentype,decaytype),param_card_new='param_card_updated.dat',decays=decays)
param_card_old = 'param_card_updated.dat'
#param_card_old = 'param_card.SM.%s.%s.dat'%(gentype,decaytype)
qcut = -1
import tarfile
myTarball = tarfile.open(runArgs.inputGeneratorFile)
myEvents = None
for afile in myTarball.getnames():
if afile.endswith('.events'): myEvents = afile
if myEvents is None:
print 'No input events file found!'
else:
events_file = myTarball.extractfile( myEvents )
try:
lhe_file_new_tmp = update_lhe_file(myEvents,param_card_old=param_card_old,lhe_file_new=None,masses=masses)
print lhe_file_new_tmp
except NameError:
print "WARNING: Will not overwrite LHE file - make sure the LHE file you're using is specific to the model you're generating!"
for aline in events_file:
if 'ktdurham' in aline and "=" in aline:
qcut = float(aline.split('=')[0].strip())
break
myTarball.close()
if madspin_card is not None: run_madspin(madspin_card,runArgs,keepOutput)
outputDS = runArgs.inputGeneratorFile
from __main__ import opts
if ((qcut<0 and njets>0) or outputDS is None or ''==outputDS) and not opts.config_only:
evgenLog.warning('Looks like something went wrong with the MadGraph generation - bailing out!')
raise RuntimeError('Error in MadGraph generation')
import os
if 'ATHENA_PROC_NUMBER' in os.environ:
evgenLog.info('Noticed that you have run with an athena MP-like whole-node setup. Will re-configure now to make sure that the remainder of the job runs serially.')
njobs = os.environ.pop('ATHENA_PROC_NUMBER')
# Try to modify the opts underfoot
if not hasattr(opts,'nprocs'): mglog.warning('Did not see option!')
else: opts.nprocs = 0
print opts
runArgs.qcut = qcut
runArgs.inputGeneratorFile = outputDS
if 'syst_mod' in dir():
runArgs.syst_mod = syst_mod
runArgs.decaytype = decaytype
runArgs.gentype = gentype
# Pythia8 setup
genSeq.Pythia8.Commands += ["Init:showAllParticleData = on",
"Next:numberShowLHA = 10",
"Next:numberShowEvent = 10",
]
if njets>0:
genSeq.Pythia8.Commands += ["Merging:mayRemoveDecayProducts = on",
"Merging:nJetMax = "+str(njets),
"Merging:doKTMerging = on",
"Merging:TMS = "+str(qcut),
"Merging:ktType = 1",
"Merging:Dparameter = 0.4",
"Merging:nQuarksMerge = 4"]
# Configuration for EvgenJobTransforms
#--------------------------------------------------------------
evgenConfig.generators += ["EvtGen"]
if not hasattr(runArgs,'inputGeneratorFile'):
print 'ERROR: something wasnt write in file name transfer from the fragment.'
runArgs.inputGeneratorFile='madgraph.*._events.tar.gz'
evgenConfig.keywords += ["SUSY"]
if not opts.config_only:
evgenConfig.inputfilecheck = runArgs.inputGeneratorFile.split('._0')[0]
# Generator transform pre-include
# Gets us ready for on-the-fly SUSY SM generation
# Simple variable setups
njets = -1
masses = {}
decays = {}
# Event multipliers for getting more events out of madgraph to feed through athena (esp. for filters)
evt_multiplier = 2.0
# Useful definitions
squarks = []
squarksl = []
for anum in [1,2,3,4]:
squarks += [str(1000000+anum),str(-1000000-anum),str(2000000+anum),str(-2000000-anum)]
squarksl += [str(1000000+anum),str(-1000000-anum)]
dict_index_syst = {0:'scalefactup',
1:'scalefactdown',
2:'alpsfactup',
3:'alpsfactdown',
4:'moreFSR',
5:'lessFSR',
6:'qup',
7:'qdown'}
# Basic settings for production and filters
SLHAonly = False
syst_mod = None
xqcut = None
madspin_card = None
try:
from MadGraphControl.MadGraphUtils import getMadGraphVersion
version = getMadGraphVersion()
if int(version.split('.')[1])<5 and int(version.split('.')[0])<3:
extras = {}
else:
extras = {'event_norm':'sum', # Fix normalization issues when SysCalc runs
}
except ImportError:
print "WARNING: you are running a really old version of MadGraph now!"
extras={}
if hasattr(runArgs,'EventMultiplier'): evt_multiplier=runArgs.EventMultiplier
if runArgs.maxEvents>0:
nevts=runArgs.maxEvents*evt_multiplier
else:
nevts=5000*evt_multiplier
evt_multiplier=-1
# in case someone needs to be able to keep the output directory for testing
keepOutput = False
if 'py1up' in runArgs.jobConfig[0]:
include("MC15JobOptions/Pythia8_A14_NNPDF23LO_Var1Up_EvtGen_Common.py")
elif 'py1dw' in runArgs.jobConfig[0]:
include("MC15JobOptions/Pythia8_A14_NNPDF23LO_Var1Down_EvtGen_Common.py")
elif 'py2up' in runArgs.jobConfig[0]:
include("MC15JobOptions/Pythia8_A14_NNPDF23LO_Var2Up_EvtGen_Common.py")
elif 'py2dw' in runArgs.jobConfig[0]:
include("MC15JobOptions/Pythia8_A14_NNPDF23LO_Var2Down_EvtGen_Common.py")
elif 'py3aup' in runArgs.jobConfig[0]:
include("MC15JobOptions/Pythia8_A14_NNPDF23LO_Var3aUp_EvtGen_Common.py")
elif 'py3adw' in runArgs.jobConfig[0]:
include("MC15JobOptions/Pythia8_A14_NNPDF23LO_Var3aDown_EvtGen_Common.py")
elif 'py3bup' in runArgs.jobConfig[0]:
include("MC15JobOptions/Pythia8_A14_NNPDF23LO_Var3bUp_EvtGen_Common.py")
elif 'py3bdw' in runArgs.jobConfig[0]:
include("MC15JobOptions/Pythia8_A14_NNPDF23LO_Var3bDown_EvtGen_Common.py")
elif 'py3cup' in runArgs.jobConfig[0]:
include("MC15JobOptions/Pythia8_A14_NNPDF23LO_Var3cUp_EvtGen_Common.py")
elif 'py3cdw' in runArgs.jobConfig[0]:
include("MC15JobOptions/Pythia8_A14_NNPDF23LO_Var3cDown_EvtGen_Common.py")
else:
include("MC15JobOptions/Pythia8_A14_NNPDF23LO_EvtGen_Common.py")
include("MC15JobOptions/Pythia8_MadGraph.py")
include ( 'MC15JobOptions/MadGraphControl_SimplifiedModelPreInclude_ForExtensions.py' )
splitConfig = runArgs.jobConfig[0].rstrip('.py').split('_')
#G/N2 degenerate
masses['1000022'] = float(splitConfig[5]) #--chi_10 LSP
masses['1000023'] = float(splitConfig[4]) #--chi_20 NLSP
if masses['1000022']<0.5:
masses['1000022']=0.5
lft = float(splitConfig[6]) #--chi_20 NLSP lifetime
if lft<1:
lft=0.5
width = 6.58212196173e-16/lft
#will be WH125
gentype = splitConfig[2]
#will be N2N2
decaytype = splitConfig[3]
decays['1000023'] = '''
# PDG Width
DECAY 1000023 ''' +str(width)+ ''' # neutralino2 decays
# BR NDA ID1 ID2
1.00000000E+00 2 1000022 22 # BR(~chi_2 -> gamma ~cHi-_1 )'''
process = '''
generate p p > h01 w+ , (w+ > l+ vl) @1
add process p p > h01 w- , (w- > l- vl~) @1
'''
njets = 0
evgenLog.info('Registered generation of h01 w production, decay via h > n2 n2, w > l vl; grid point '+str(runArgs.runNumber)+' decoded into mass point ' + str(masses['1000023']) + ' ' + str(masses['1000022']) )
evgenConfig.contact = [ "haichen.wang@cern.ch" ]
evgenConfig.keywords += ['W', 'neutralino', 'lepton','longLived']
evgenConfig.description = 'h01 w production, decay via n2, n2 in simplified model, m_N1 = %s GeV, m_N2 = %s GeV, tau = %s ns'%(masses['1000022'],masses['1000023'],lft)
#--------------------------------------------------------------
# add some filter here
#--------------------------------------------------------------
# need more events from MG due to filter - this needs to be set before MadGraphControl_SimplifiedModelPostInclude.py is run (it's set at 2 there)
include ( 'MC15JobOptions/MadGraphControl_SimplifiedModelPostInclude_ForExtensions.py' )
testSeq.TestHepMC.MaxVtxDisp = 10000*10000 #in mm
testSeq.TestHepMC.MaxTransVtxDisp = 10000*10000
include ( 'MC15JobOptions/MadGraphControl_SimplifiedModelPreInclude_ForExtensions.py' )
splitConfig = runArgs.jobConfig[0].rstrip('.py').split('_')
#G/N2 degenerate
masses['1000022'] = float(splitConfig[5]) #--chi_10 LSP
masses['1000023'] = float(splitConfig[4]) #--chi_20 NLSP
lft = float(splitConfig[6]) #--chi_20 NLSP lifetime
if lft<1:
lft=0.5
width = 6.58212196173e-16/lft
if masses['1000022']<0.5:
masses['1000022']=0.5
#will be ZH125
gentype = splitConfig[2]
#will be N2N2
decaytype = splitConfig[3]
decays['1000023'] = '''
# PDG Width
DECAY 1000023 ''' +str(width)+ ''' # neutralino2 decays
# BR NDA ID1 ID2
1.00000000E+00 2 1000022 22 # BR(~chi_2 -> gamma ~cHi-_1 )'''
process = '''
generate p p > h01 z , (z > l+ l-) @1
'''
njets = 0
evgenLog.info('Registered generation of h01 z production, decay via h01 > n2 n2, z > l l; grid point '+str(runArgs.runNumber)+' decoded into mass point ' + str(masses['1000023']) + ' ' + str(masses['1000022']) )
evgenConfig.contact = [ "sai.neha.santpur@cern.ch" ]
evgenConfig.keywords += ['Z', 'neutralino', 'lepton','longLived']
evgenConfig.description = 'h01 z production, decay via n2, n2 in simplified model, m_N1 = %s GeV, m_N2 = %s GeV, tau = %s ns'%(masses['1000022'],masses['1000023'],lft)
#--------------------------------------------------------------
# add some filter here
#--------------------------------------------------------------
# need more events from MG due to filter - this needs to be set before MadGraphControl_SimplifiedModelPostInclude.py is run (it's set at 2 there)
include ( 'MC15JobOptions/MadGraphControl_SimplifiedModelPostInclude_ForExtensions.py' )
testSeq.TestHepMC.MaxVtxDisp = 10000*10000 #in mm
testSeq.TestHepMC.MaxTransVtxDisp = 10000*10000
include ( 'MC15JobOptions/MadGraphControl_SimplifiedModelPreInclude_ForExtensions.py' )
splitConfig = runArgs.jobConfig[0].rstrip('.py').split('_')
#G/N2 degenerate
masses['1000022'] = float(splitConfig[5]) #--chi_10 LSP
masses['1000023'] = float(splitConfig[4]) #--chi_20 NLSP
lft = float(splitConfig[6]) #--chi_20 NLSP lifetime
if lft<1:
lft=0.5
width = 6.58212196173e-16/lft
if masses['1000022']<0.5:
masses['1000022']=0.5
#will be ttH125
gentype = splitConfig[2]
#will be N2N2
decaytype = splitConfig[3]
decays['1000023'] = '''
# PDG Width
DECAY 1000023 ''' +str(width)+ ''' # neutralino2 decays
# BR NDA ID1 ID2
1.00000000E+00 2 1000022 22 # BR(~chi_2 -> gamma ~cHi-_1 )'''
process = '''
define allsm = g u c d s u~ c~ d~ s~ a ve vm vt e- mu- ve~ vm~ vt~ e+ mu+ t b t~ b~ z w+ h01 w- ta- ta+
generate p p > h01 t t~ , ( t > w+ b, w+ > allsm allsm), ( t~ > w- b~, w- > allsm allsm) @1
'''
njets = 0
evgenLog.info('Registered generation of h01 t tbar production, decay via h01 > n2 n2; grid point '+str(runArgs.runNumber)+' decoded into mass point ' + str(masses['1000023']) + ' ' + str(masses['1000022']) )
evgenConfig.contact = [ "sai.neha.santpur@cern.ch" ]
evgenConfig.keywords += ['Z', 'neutralino', 'longLived']
evgenConfig.description = 'h01 t tbar production, decay via n2, n2 in simplified model, m_N1 = %s GeV, m_N2 = %s GeV, tau = %s ns'%(masses['1000022'],masses['1000023'],lft)
#--------------------------------------------------------------
# add some filter here
#--------------------------------------------------------------
include('MC15JobOptions/TTbarWToLeptonFilter.py')
filtSeq.TTbarWToLeptonFilter.NumLeptons = -1 # -1 for non-all had, 0 for all had, 1 for 1lep, 2 for 2lep
filtSeq.TTbarWToLeptonFilter.Ptcut = 0.
# need more events from MG due to filter - this needs to be set before MadGraphControl_SimplifiedModelPostInclude.py is run (it's set at 2 there)
include ( 'MC15JobOptions/MadGraphControl_SimplifiedModelPostInclude_ForExtensions.py' )
testSeq.TestHepMC.MaxVtxDisp = 10000*10000 #in mm
testSeq.TestHepMC.MaxTransVtxDisp = 10000*10000
include('MC15JobOptions/MadGraphControl_SimplifiedModel_WH125_N2N2.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_WH125_N2N2_ForExtensions.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_WH125_N2N2.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_WH125_N2N2_ForExtensions.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_WH125_N2N2.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_WH125_N2N2_ForExtensions.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ZH125_N2N2.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ZH125_N2N2_ForExtensions.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ZH125_N2N2.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ZH125_N2N2_ForExtensions.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ZH125_N2N2.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ZH125_N2N2_ForExtensions.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ttH125_N2N2.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ttH125_N2N2_ForExtensions.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ttH125_N2N2.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ttH125_N2N2_ForExtensions.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ttH125_N2N2.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ttH125_N2N2_ForExtensions.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_WH125_N2N2.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_WH125_N2N2_ForExtensions.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_WH125_N2N2.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_WH125_N2N2_ForExtensions.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_WH125_N2N2.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_WH125_N2N2_ForExtensions.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ZH125_N2N2.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ZH125_N2N2_ForExtensions.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ZH125_N2N2.py')
include('MC15JobOptions/MadGraphControl_SimplifiedModel_ZH125_N2N2_ForExtensions.py')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment