Commit d9d9f7f8 authored by Cyril Pascal Becot's avatar Cyril Pascal Becot
Browse files

See ChangeLog


git-svn-id: svn+ssh://svn.cern.ch/reps/atlasoff/Generators/MC15JobOptions/trunk@816242 4525493e-7705-40b1-a816-d608a930855b
parent 5e2c04ed
2018-12-14 Cyril Becot <cyril.becot@cern.ch>
* tag MC15JobOptions-00-12-06
* add 310920-310922
* up 448380,448381
* add 448550-448587
* up 370924,370930
* add 346076-34686
* add 450479-450497
* add 311005-311008
* add MGCtrl_Py8EG_NNPDF30nlo_Leptophilic_2muZp_4mu.py
* add MadGraph_param_card_Leptophilic_muOnly.dat
* up 346394
* add 425202-425209
* up 448390-448449, 448499
* up 345919-3459123, 345928
* up share/evgeninputfiles.csv
* up 450185-450189
* up 450112-450115
* add MadGraphControl_tchan_ictW_c1p75_Pythia8_A14.py MadGraphControl_tchan_ictW_c-1p75_ctW_c2_Pythia8_A14.py MadGraphControl_tchan_ctW-c2_Pythia8_A14.py MadGraphControl_tchan_ctW_c-2_C4f-c-0p4_Pythia8_A14.py MadGraphControl_tchan_SM_Pythia8_A14.py MadGraphControl_tchan_C4f-c-0p4_Pythia8_A14.py
* add 412075-412080
* up MadGraphControl_LQ_TB_S1Tilde_LO.py MadGraph_param_card_TBS1Tilde_LO.dat
2018-12-13 Cyril Becot <cyril.becot@cern.ch>
* tag MC15JobOptions-00-12-05
* add 450190,450200,450210,450247
......
from MadGraphControl.MadGraphUtils import *
#
## 2 inputs parameters, mass of Zp (zpm), 1 coupling gzpmul
##
## Example 1: 15.0GeV Zp with coupling to muon only pp --> 2mu+Zp --> 4mu
##
## zpm=15.0
## gzpmul=3.000000e-01
##
gzpel=0.000000e+00
gzper=0.000000e+00
gzpmur=gzpmul
gzptal=0.000000e+00
gzptar=0.000000e+00
maxjetflavor=5
## safe factor applied to nevents, to account for the filter efficiency
safefactor=1.1
fcard = open('proc_card_mg5.dat', 'w')
fcard.write("""
import model Leptophilic_UFO
define p = g u c d s b u~ c~ d~ s~ b~
define j = g u c d s b u~ c~ d~ s~ b~
set group_subprocesses Auto
set ignore_six_quark_processes False
set gauge unitary
set complex_mass_scheme False
generate p p > mu+ mu- Zp, Zp > mu+ mu-
output -f
""")
fcard.close()
beamEnergy=-999
if hasattr(runArgs,'ecmEnergy'):
beamEnergy = runArgs.ecmEnergy / 2.
else:
raise RuntimeError("No center of mass energy found.")
#---------------------------------------------------------------------------
# MG5 run Card
#---------------------------------------------------------------------------
#
# ptj default value 20GeV, using ktdurham just in case its lower than 20GeV
#
extras = {
'pdlabel' : "'lhapdf'",
'lhaid' : '260000',
'lhe_version' : '3.0',
'maxjetflavor' : maxjetflavor,
'asrwgtflavor' : maxjetflavor,
'cut_decays' : 'F',
'use_syst' : 'T',
'sys_scalefact' :'1 0.5 2',
'sys_alpsfact' : 'None',
'sys_matchscale' : 'None',
'sys_pdf' : 'None',#NNPDF23_lo_as_0130_qed'
}
process_dir = new_process()
build_run_card(run_card_old=get_default_runcard(process_dir),run_card_new='run_card.dat',
nevts=int(runArgs.maxEvents*safefactor),rand_seed=runArgs.randomSeed,beamEnergy=beamEnergy, extras=extras)
#---------------------------------------------------------------------------
# MG5 param Card
#---------------------------------------------------------------------------
paramcard = subprocess.Popen(['get_files','-data','MadGraph_param_card_Leptophilic_muOnly.dat'])
paramcard.wait()
if not os.access('MadGraph_param_card_Leptophilic_muOnly.dat',os.R_OK):
print 'ERROR: Could not get param card'
## params is a dictionary of dictionaries (each dictionary is a
## separate block)
## parameters for newcoup
params={}
ncoups={}
ncoups['GZpeL']=gzpel
ncoups['GZpeR']=gzper
ncoups['GZpmuL']=gzpmul
ncoups['GZpmuR']=gzpmur
ncoups['GZptaL']=gzptal
ncoups['GZptaR']=gzptar
params['ZPINPUTS']=ncoups
## mass parameters
masses={}
masses['999888']=zpm
str_param_card='param_card.dat'
build_param_card(param_card_old='MadGraph_param_card_Leptophilic_muOnly.dat',
param_card_new=str_param_card,
masses=masses,
params=params)
print_cards()
runName='run_01'
generate(run_card_loc='run_card.dat',param_card_loc=str_param_card,mode=2,njobs=1,run_name=runName,proc_dir=process_dir)
outputDS=arrange_output(run_name=runName,proc_dir=process_dir,outputDS=runName+'._00001.events.tar.gz', saveProcDir=True)
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
#### Shower
evgenConfig.description = "Leptophilic Zprime, https://arxiv.org/pdf/1411.7394.pdf"
evgenConfig.keywords = ["BSM","Zprime","4muon"]
evgenConfig.process = "pp --> 2mu+Zp --> 4mu around Z peak"
evgenConfig.contact = ["Tiesheng Dai <tiesheng.dai@cern.ch>"]
runArgs.inputGeneratorFile=outputDS
include("MC15JobOptions/Pythia8_A14_NNPDF23LO_EvtGen_Common.py")
include("MC15JobOptions/Pythia8_MadGraph.py")
genSeq.Pythia8.Commands += [
'23:onMode = off'
]
import re
import os
import math
import shutil
import subprocess
from MadGraphControl.MadGraphUtils import *
nevents = 10000
mode = 0
job_option_name = runArgs.jobConfig[0]
generation = 0
quark_flavour = job_option_name.split('S1T')[-1][0]
quark_flavours = ['d', 's', 'b']
quark_flavour_index = quark_flavours.index(quark_flavour) + 1
if quark_flavour not in quark_flavours:
raise RuntimeError("Cannot determine quark flavour from job option name: {:s}.".format(job_option_name))
if "LQe" in job_option_name:
generation = 1
elif "LQmu" in job_option_name:
generation = 2
elif "LQtau" in job_option_name:
generation = 3
else:
raise RuntimeError("Cannot determine LQ generation from job option name: {:s}.".format(job_option_name))
matches = re.search("M([0-9]+).*\.py", job_option_name)
if matches is None:
raise RuntimeError("Cannot find mass string in job option name: {:s}.".format(job_option_name))
else:
lqmass = float(matches.group(1))
matches = re.search("l([0-9]_[0-9]+)\.py", job_option_name)
if matches is None:
raise RuntimeError("Cannot find coupling string in job option name: {:s}.".format(job_option_name))
else:
coupling = float(matches.group(1).replace("_", "."))
fcard = open('proc_card_mg5.dat', 'w')
fcard.write("""
set group_subprocesses Auto
set ignore_six_quark_processes False
set loop_color_flows False
set gauge unitary
set complex_mass_scheme False
set max_npoint_for_channel 0
import model sm
define p = g u c d s b u~ c~ d~ s~ b~
define j = g u c d s b u~ c~ d~ s~ b~
define l+ = e+ mu+
define l- = e- mu-
define vl = ve vm vt
define vl~ = ve~ vm~ vt~\n""")
if generation == 1:
fcard.write("""import model ./LO_LQ_S1~\n""")
fcard.write("""generate p p > e+ e- {:s} \n""".format(quark_flavour))
fcard.write("""output -f\n""")
fcard.close()
elif generation == 2:
fcard.write("""import model ./LO_LQ_S1~\n""")
fcard.write("""generate p p > mu+ mu- {:s} \n""".format(quark_flavour))
fcard.write("""output -f\n""")
fcard.close()
elif generation == 3:
fcard.write("""import model ./LO_LQ_S1~\n""")
fcard.write("""define p = g u c d s b u~ c~ d~ s~ b~\n""")
fcard.write("""generate p p > ta+ ta- {:s} \n""".format(quark_flavour))
fcard.write("""output -f""")
fcard.close()
beamEnergy = -999
if hasattr(runArgs, 'ecmEnergy'):
beamEnergy = runArgs.ecmEnergy / 2.
else:
raise RuntimeError("No center of mass energy found.")
process_dir = new_process()
extras = {'pdlabel': "'lhapdf'",
'lhaid': 260000,
'ktdurham': lqmass * 0.25}
try:
os.remove('run_card.dat')
except OSError:
pass
build_run_card(run_card_old=get_default_runcard(proc_dir=process_dir), run_card_new='run_card.dat',
nevts=nevents, rand_seed=runArgs.randomSeed, beamEnergy=beamEnergy, extras=extras)
if os.path.exists("param_card.dat"):
os.remove("param_card.dat")
param_card_name = 'MadGraph_param_card_TBS1Tilde_LO.dat'
#param_card = subprocess.Popen(['get_files', '-data', param_card_name])
#param_card.wait()
#try:
# shutil.copy(os.path.join("/afs/cern.ch/user/m/morgens/afs_work/devarea/rel21/Multilepton/source/ELMultiLep/macros/misc/LQJO", param_card_name),
# param_card_name)
#except:
# try:
# shutil.copy(os.path.join( "/user/mmorgens/devarea/rel21/Multilepton/source/ELMultiLep/macros/misc/LQJO",
# param_card_name),
# param_card_name)
# except:
# exit(0)
if not os.access(param_card_name, os.R_OK):
print 'ERROR: Could not get param card'
elif os.access('param_card.dat',os.R_OK):
print 'ERROR: Old param card in the current directory. Dont want to clobber it. Please move it first.'
else:
oldcard = open(param_card_name, 'r')
newcard = open('param_card.dat', 'w')
width = (lqmass*abs(coupling)**2)/(16.*math.pi)
# for line in oldcard:
# newcard.write(line)
for line in oldcard:
if '# yRR{:d}x{:d}'.format(quark_flavour_index, generation) in line:
newcard.write(' {:d} {:d} {:e} # yRR{:d}x{:d}\n'.format(quark_flavour_index,
generation,
coupling,
quark_flavour_index,
generation))
elif '# yRR' in line:
indices = map(int, re.findall('\dx\d', line)[0].split('x'))
newcard.write(' {:d} {:d} 0.000000e+00 # yRR{:d}x{:d}\n'.format(indices[0],
indices[1],
indices[0],
indices[1]))
elif '# MS1t' in line:
newcard.write(' 1 {:e} # MS1t \n'.format(lqmass))
elif '# S1tm43 : MS1t' in line:
newcard.write(' 9000005 {:e} # S1tm43 : MS1t \n'.format(lqmass))
else:
newcard.write(line)
oldcard.close()
newcard.close()
print_cards()
runName = 'run_01'
process_dir = new_process()
generate(run_card_loc='run_card.dat',
param_card_loc='param_card.dat',
mode=mode,
proc_dir=process_dir,
run_name=runName)
arrange_output(run_name=runName, proc_dir=process_dir, outputDS=runName + '._00001.events.tar.gz', lhe_version=3,
saveProcDir=True)
include("MC15JobOptions/Pythia8_A14_NNPDF23LO_EvtGen_Common.py")
include("MC15JobOptions/Pythia8_MadGraph.py")
evgenConfig.description = 'Toolbox scalar LO single production of S1~, generation: {0:d}, mLQ={1:d}'.format(
int(generation), int(lqmass))
evgenConfig.keywords += ['BSM', 'exotic', 'leptoquark', 'scalar']
evgenConfig.generators += ["MadGraph", "Pythia8", "EvtGen"]
evgenConfig.process = 'pp -> S1~ l'
evgenConfig.contact = ["Marcus Matthias Morgenstern <marcus.matthias.morgenstern@cern.ch>"]
evgenConfig.inputfilecheck = runName
runArgs.inputGeneratorFile = runName + '._00001.events.tar.gz'
from MadGraphControl.MadGraphUtils import *
import fileinput
import shutil
import subprocess
import os
# General settings
nevents=5500
runName='C4f_c-0p4'
runMode=2 # 0 = single machine, 1 = cluster, 2 = multicore
cluster_type="lsf"
cluster_queue='2nd' #8nm 1nh 8nh 1nd 2nd 1nw 2nw (m = minute, d = day, w = week)
required_accuracy=0.001
mass_window = [ 100 , 250 ]
### PROCESS
mgproc="""define l+ = l+ ta+
define l- = l- ta-
generate p p > w+ b j $$ wp+ wp- w+ w- z a g QED=3 QCD=0 EFT=2 [QCD]
add process p p > w- b~ j $$ wp+ wp- w+ w- z a g QED=3 QCD=0 EFT=2 [QCD]"""
name='t-channel'
process="p p > w+ b j"
model='TEFT_EW_bR_Wp-c4f'
##necessary gridpack settings
gridpack_mode=True
gridpack_dir='madevent/'
stringy = 'madgraph.'+str(runArgs.runNumber)+'.MadGraph_'+str(runName)
fcard = open('proc_card_mg5.dat','w')
fcard.write("""
import model """+model+"""
set complex_mass_scheme True
"""+mgproc+"""
output -f
""")
fcard.close()
beamEnergy=-999
if hasattr(runArgs,'ecmEnergy'):
beamEnergy = runArgs.ecmEnergy / 2.
else:
raise RuntimeError("No center of mass energy found.")
# --------------------------------------------------------------
# Start building the cards
# --------------------------------------------------------------
process_dir = new_process(grid_pack=gridpack_dir)
#run_card.dat and set parameters
#run_cardloc=process_dir+'/Cards/run_card.dat'
run_card_extras = {
'pdlabel' : 'lhapdf',
'lhaid' : 260000,
'reweight_scale' : 'False',
'reweight_PDF' : 'False',
'store_rwgt_info' : 'False',
'parton_shower' :'PYTHIA8',
'jetalgo' : '-1',
'jetradius' : '0.4',
'ptj' : '5.0',
'etaj' : '5.0',
'dynamical_scale_choice' : '0',
'fixed_ren_scale' : 'True',
'fixed_fac_scale' : 'True',
'muR_ref_fixed' : '172.5',
'muF_ref_fixed' : '172.5',
'bwcutoff' : '50'}
runArgs.inputGeneratorFile=runName+'._00001.events.tar.gz'
build_run_card(run_card_old=get_default_runcard(proc_dir=process_dir),
run_card_new='run_card.dat',
nevts=nevents,
rand_seed=runArgs.randomSeed,
beamEnergy=beamEnergy,
xqcut=0.,
extras=run_card_extras)
#param_card.dat
param_cardloc=process_dir+'/Cards/param_card.dat'
param_card_blocks = {
'dim6': {
'Lambda' : '1.000000e+03',
'ccc' : '1.000000e+00',
'ctG' : '0',
'cft' : '0',
'cfb' : '0',
'cfQ1' : '0',
'cfQ3' : '0',
'ctW' : '0',
'ctB' : '0',
'cff' : '0',
'cbW' : '0',
'muprime' : '1.725000e+02'},
'eft' : {
'C4f' : '-0.4'}
}
param_card_decays = """#
#*************************
# Decay widths *
#*************************
#
# PDG Width
DECAY 1 0.000000e+00
#
# PDG Width
DECAY 2 0.000000e+00
#
# PDG Width
DECAY 3 0.000000e+00
#
# PDG Width
DECAY 4 0.000000e+00
#
# PDG Width
DECAY 5 0.000000e+00
#
# PDG Width
DECAY 6 1.360000e+00
# BR NDA ID1 ID2 ...
1.000000e+00 2 5 24 # 1.32
DECAY -6 1.360000e+00
# BR NDA ID1 ID2 ...
1.000000e+00 2 -5 -24 # 1.32
#
# PDG Width
DECAY 11 0.000000e+00
#
# PDG Width
DECAY 12 0.000000e+00
#
# PDG Width
DECAY 13 0.000000e+00
#
# PDG Width
DECAY 14 0.000000e+00
#
# PDG Width
DECAY 15 0.000000e+00
#
# PDG Width
DECAY 16 0.000000e+00
#
# PDG Width
DECAY 21 0.000000e+00
#
# PDG Width
DECAY 22 0.000000e+00
#
# PDG Width
DECAY 23 2.495200e+00
#
# PDG Width
DECAY -24 2.085000e+00
# BR NDA ID1 ID2 ...
3.3370000e-01 2 1 -2
3.337000e-01 2 3 -4
1.082000e-01 2 11 -12
1.082000e-01 2 13 -14
1.082000e-01 2 15 -16
DECAY 24 2.085000e+00
# BR NDA ID1 ID2 ...
3.337000e-01 2 -1 2
3.337000e-01 2 -3 4
1.082000e-01 2 -11 12
1.082000e-01 2 -13 14
1.082000e-01 2 -15 16
#
# PDG Width
DECAY 25 4.070000e-03
#
# PDG Width
DECAY 34 0.000000e+00
#
# PDG Width
DECAY 9000002 2.495200e+00
#
# PDG Width
DECAY 9000003 2.085000e+00
#
# PDG Width
DECAY 9000004 2.085000e+00
"""
#create param card
oldcard = open(param_cardloc,'r')
newcard = open('param_card.dat','w')
inBlock = False
theBlock = ''
toKeep = True
mark_rm = '## INFORMATION FOR DECAY'
mark_keep = '#==========================================================='
for line in oldcard:
if line.startswith(mark_rm):
toKeep = False
if line.startswith(mark_keep):
toKeep = True
new_line = line
for block in param_card_blocks:
if """Block """+block in line:
#print(block)
inBlock = True
theBlock = block
if "###################################" in line:
inBlock = False
if inBlock == True:
for key in param_card_blocks[theBlock]:
if key in line:
if key == line.split('#')[1].lstrip(' ').split(' ')[0]:
value = line.lstrip(' ').split(' ')[1]
new_line = line.replace(str(value),str(param_card_blocks[theBlock][key]),1)
if toKeep == True:
newcard.write(new_line)
if """Block mass""" in line:
newcard.write(""" -6 1.725000e+02 # MTbar
-24 7.982436e+01 # MWmin
""")
newcard.write(param_card_decays)
oldcard.close()
newcard.close()
#madspin card
madspin_card_loc='madspin_card.dat'
if not hasattr(runArgs, 'inputGenConfFile'):
fMadSpinCard = open('madspin_card.dat','w')
fMadSpinCard.write('import Events/'+runName+'/events.lhe.gz\n')
fMadSpinCard.write('set ms_dir MadSpin\n')
else:
os.unlink(gridpack_dir+'Cards/madspin_card.dat')
fMadSpinCard = open(gridpack_dir+'Cards/madspin_card.dat','w')
fMadSpinCard.write('import '+gridpack_dir+'Events/'+runName+'/events.lhe.gz\n')
fMadSpinCard.write('set ms_dir '+gridpack_dir+'MadSpin\n')
fMadSpinCard.write('set seed '+str(10000000+int(runArgs.randomSeed))+'\n')
fMadSpinCard.write('''set Nevents_for_max_weigth 250 # number of events for the estimate of the max. weight (default: 75)
set max_weight_ps_point 1000 # number of PS to estimate the maximum for each event (default: 400)
decay t > w+ b, w+ > l+ vl
decay t~ > w- b~, w- > l- vl~
decay w+ > l+ vl
decay w- > l- vl~
launch''')
fMadSpinCard.close()
print_cards() #prints the cards in the output (terminal)
cluster_size=100
# cuts file: to define a invariant mass cut around the top mass
fileN = process_dir+'/SubProcesses/cuts.f'
markdecl = ' passcuts_user=.true. ! event is okay; otherwise it is changed'
markcuts = 'C PUT HERE YOUR USER-DEFINED CUTS'
markfunc = 'C NO NEED TO CHANGE ANY OF THE FUNCTIONS BELOW'
for line in fileinput.input(fileN, inplace=1):
if line.startswith(markdecl):
print """
! -------------------------------- !