Commit 3d697188 authored by Joany Manjarres's avatar Joany Manjarres
Browse files

See Changelog

parent 2f013dd9
2019-10-17 Joany Manjarres <joany@cern.ch>
* tag MC15JobOptions-01-01-72
* add JO's 378114-224 312599-312626 414005-414018 312627-635
* add MadGraphControl_SimplifiedModel_onestepN2_ZN1.py param_card.SM.GG.onestepN2_ZN1.dat param_card.SM.GG.onestepN2_offshellZN1.dat MadGraphControl_HChiChi_mc16.py
2019-10-16 Joany Manjarres <joany@cern.ch>
* tag MC15JobOptions-01-01-71
* update JO 346764-67
......
from MadGraphControl.MadGraphUtils import *
#############################################
### Production of scalar long-lived particles
### though a higgs-like scalar mediator
############################################
# PDF
pdflabel = 'lhapdf'
lhaid = 315000 # NNPDF31_lo_as_0118
process = {
1: 'generate p p > xchi xchi , xchi > ta- ta+ vl , xchi > ta+ ta- vl~',
2: 'generate p p > xchi xchi , xchi > c b s , xchi > c~ b~ s~',
3: 'generate p p > xchi xchi , xchi > vl b b~ , xchi > vl~ b~ b'
}
# parameter mass and average life-time
dictmChi = {
312627 : 10, 312628 : 55, 312629 : 100,
312630 : 10, 312631 : 55, 312632 : 100,
312633 : 10, 312634 : 55, 312635 : 100 }
dictnProcess = {
312627 : 1, 312628 : 1, 312629 : 1,
312630 : 2, 312631 : 2, 312632 : 2,
312633 : 3, 312634 : 3, 312635 : 3 }
dictAvgtau = {
312627 : 920, 312628 : 5550, 312629 : 3500,
312630 : 920, 312631 : 5550, 312632 : 3500,
312633 : 920, 312634 : 5550, 312635 : 3500 }
#---------------------------------------------------------------------------
# MG5 Proc card
#---------------------------------------------------------------------------
try :
modelcode='WIMP_BG_higgsportal_full_loop'
mChi = dictmChi[runArgs.runNumber]
nProcess = dictnProcess[runArgs.runNumber]
avgtau = dictAvgtau[runArgs.runNumber]
except KeyError:
raise RuntimeError('Bad runNumber')
# basename for madgraph LHEF file
rname = 'run_'+str(runArgs.runNumber)
# writing proc card for MG
fcard = open('proc_card_mg5.dat','w')
fcard.write("""
import model """+modelcode+"""
define p = g u c d s u~ c~ d~ s~
define l- = e- mu- ta-
define l+ = e+ mu+ ta+
define vl = ve vm vt
define vl~ = ve~ vm~ vt~
%s
output -f
""" % (process[nProcess]))
fcard.close()
#---------------------------------------------------------------------------
# Energy
#---------------------------------------------------------------------------
beamEnergy = -999.
if hasattr(runArgs,'ecmEnergy'):
beamEnergy = runArgs.ecmEnergy / 2.
else:
raise RuntimeError("No center of mass energy found")
#---------------------------------------------------------------------------
# MG5 Run Card
#---------------------------------------------------------------------------
run_card_extras = {
'lhe_version':'3.0',
'cut_decays':'F',
'event_norm':'sum',
'pdlabel':pdflabel,
'lhaid':lhaid,
'ptj':'0',
'ptb':'0',
'pta':'0',
'ptl':'0',
'etaj':'-1',
'etab':'-1',
'etaa':'-1',
'etal':'-1',
'drjj':'0',
'drbb':'0',
'drll':'0',
'draa':'0',
'drbj':'0',
'draj':'0',
'drjl':'0',
'drab':'0',
'drbl':'0',
'dral':'0' ,
'use_syst':'T',
'sys_scalefact': '1 0.5 2',
'sys_pdf' : "NNPDF31_lo_as_0118"
}
safefactor=1.1 #generate extra 10% events in case any fail showering
if runArgs.maxEvents > 0:
nevents = runArgs.maxEvents*safefactor
else: nevents = 5000*safefactor
process_dir = new_process()
build_run_card(run_card_old=get_default_runcard(process_dir),
run_card_new='run_card.dat',
nevts=nevents,
rand_seed=runArgs.randomSeed,
beamEnergy=beamEnergy,
extras=run_card_extras)
#---------------------------------------------------------------------------
# MG5 param Card
#---------------------------------------------------------------------------
param_card_extras = { "MASS": { 'MxChi': mChi}, # chi mass
}
build_param_card(param_card_old="{}/Cards/param_card.dat".format(process_dir),
param_card_new='param_card.dat',
params=param_card_extras)
print_cards()
#---------------------------------------------------------------------------
# MG5 Generation
#---------------------------------------------------------------------------
generate(run_card_loc='run_card.dat',
param_card_loc='param_card.dat',
mode=0, njobs=1,
run_name=rname,
proc_dir=process_dir)
#---------------------------------------------------------------------------
# Arrange LHE file output
#---------------------------------------------------------------------------
# initialise random number generator/sequence
import random
random.seed(runArgs.randomSeed)
# lifetime function
def lifetime(avgtau = 21):
import math
t = random.random()
return -1.0 * avgtau * math.log(t)
# replacing lifetime of scalar, manually
unzip1 = subprocess.Popen(['gunzip',process_dir+'/Events/'+rname+'/unweighted_events.lhe.gz'])
unzip1.wait()
oldlhe = open(process_dir+'/Events/'+rname+'/unweighted_events.lhe','r')
newlhe = open(process_dir+'/Events/'+rname+'/unweighted_events2.lhe','w')
init = True
for line in oldlhe:
if init==True:
newlhe.write(line)
if '</init>' in line:
init = False
else:
if 'vent' in line or line.startswith("<"):
newlhe.write(line)
continue
newline = line.rstrip('\n')
columns = (' '.join(newline.split())).split()
pdgid = int(columns[0])
if pdgid == 3000001:
part1 = line[:-22]
part2 = "%.11E" % (lifetime(avgtau))
part3 = line[-12:]
newlhe.write(part1+part2+part3)
else:
newlhe.write(line)
oldlhe.close()
newlhe.close()
zip1 = subprocess.Popen(['gzip',process_dir+'/Events/'+rname+'/unweighted_events2.lhe'])
zip1.wait()
shutil.move(process_dir+'/Events/'+rname+'/unweighted_events2.lhe.gz',
process_dir+'/Events/'+rname+'/unweighted_events.lhe.gz')
os.remove(process_dir+'/Events/'+rname+'/unweighted_events.lhe')
arrange_output(run_name=rname, proc_dir=process_dir,
outputDS=rname+'._00001.events.tar.gz',
lhe_version=3,
saveProcDir=True)
#---------------------------------------------------------------------------
# Parton Showering Generation
#---------------------------------------------------------------------------
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')
if not hasattr(opts,'nprocs'): mglog.warning('Did not see option!')
else: opts.nprocs = 0
print opts
include("MC15JobOptions/Pythia8_A14_NNPDF23LO_EvtGen_Common.py")
include("MC15JobOptions/Pythia8_MadGraph.py")
genSeq.Pythia8.Commands += ["Main:timesAllowErrors = 60000",
"15:offIfAny = 11 12 13 14",
"-15:offIfAny = 11 12 13 14"]
#relax the cuts on displaced vertices and non G4 particles
testSeq.TestHepMC.MaxTransVtxDisp = 100000000 #in mm
testSeq.TestHepMC.MaxVtxDisp = 100000000 #in mm
testSeq.TestHepMC.MaxNonG4Energy = 100000000 #in MeV
#--------------------------------------------------------------
# Configuration for EvgenJobTransforms
#--------------------------------------------------------------
evgenConfig.description = "Displaced hadronic jets process WIMP (Higgs portal) with mChi=%sGeV' % (mChi)"
evgenConfig.keywords = ["exotic", "BSM", "BSMHiggs", "longLived"]
evgenConfig.contact = ['simon.berlendis@cern.ch', 'hao.zhou@cern.ch', 'akvam@cern.ch',
'Cristiano.Alpigiani@cern.ch' ]
evgenConfig.process=" --> LLPs"
evgenConfig.inputfilecheck = rname
runArgs.inputGeneratorFile=rname+'._00001.events.tar.gz'
# Generator transform pre-include
# Gets us ready for on-the-fly SUSY SM generation
include ( 'MC15JobOptions/MadGraphControl_SimplifiedModelPreInclude.py' )
gentype=runArgs.jobConfig[0].split('SM')[1].split('_')[1]
if 'SLN1' in runArgs.jobConfig[0]: decaytype='twostepN2_SLN1'
elif 'offshellZN1' in runArgs.jobConfig[0]: decaytype='onestepN2_offshellZN1'
elif 'ZN1' in runArgs.jobConfig[0]: decaytype='onestepN2_ZN1'
# special to handle MadSpin configuration via JO name:
madspindecays=False
if "MadSpin" in runArgs.jobConfig[0]:
madspindecays=True
mass_string = runArgs.jobConfig[0].replace('.py','').split('N1_')[1]
deltaM = 0 # mchi20 - mchi10
#--------------------------------------------------------------
# MadGraph configuration
#--------------------------------------------------------------
if gentype=='SS':
# Direct gluino decay to LSP (0-lepton, grid 1 last year)
masses['1000001'] = float( mass_string.split('_')[0] ) # squark mass
masses['1000002'] = float( mass_string.split('_')[0] ) # squark mass
masses['1000003'] = float( mass_string.split('_')[0] ) # squark mass
masses['1000004'] = float( mass_string.split('_')[0] ) # squark mass
masses['2000001'] = float( mass_string.split('_')[0] ) # squark mass
masses['2000002'] = float( mass_string.split('_')[0] ) # squark mass
masses['2000003'] = float( mass_string.split('_')[0] ) # squark mass
masses['2000004'] = float( mass_string.split('_')[0] ) # squark mass
masses['1000022'] = float( mass_string.split('_')[1] ) #chi10
masses['1000023'] = 0.5*(masses['1000001']+masses['1000022']) #chi20
deltaM = 0.5*(masses['1000001'] - masses['1000022']) # (msquark - mchi10) / 2 = mchi20 - mchi10
if 'SL' in decaytype:
masses['1000011'] = 0.5*(masses['1000022']+masses['1000023']) #slepton
masses['1000012'] = 0.5*(masses['1000022']+masses['1000023']) #slepton
masses['1000013'] = 0.5*(masses['1000022']+masses['1000023']) #slepton
masses['1000014'] = 0.5*(masses['1000022']+masses['1000023']) #slepton
masses['1000015'] = 0.5*(masses['1000022']+masses['1000023']) #slepton
masses['1000016'] = 0.5*(masses['1000022']+masses['1000023']) #slepton
else:
masses['1000011'] = 4.5e5 #slepton
masses['1000012'] = 4.5e5 #slepton
masses['1000013'] = 4.5e5 #slepton
masses['1000014'] = 4.5e5 #slepton
masses['1000015'] = 4.5e5 #slepton
masses['1000016'] = 4.5e5 #slepton
#### MadGraph is used to decay squark, Madspin will be used to decay N2
process = '''
define susylqL = ul dl cl sl
define susylqL~ = ul~ dl~ cl~ sl~
define susylqR = ur dr cr sr
define susylqR~ = ur~ dr~ cr~ sr~
generate p p > susylqL susylqL~, susylqL > jb n2, susylqL~ > jb n2 $ go susyweak susylqR susylqR~ @1
add process p p > susylqL susylqL~ j, susylqL > jb n2, susylqL~ > jb n2 $ go susyweak susylqR susylqR~ @2
add process p p > susylqL susylqL~ j j, susylqL > jb n2, susylqL~ > jb n2 $ go susyweak susylqR susylqR~ @3
'''
if gentype=='GG':
# Direct gluino decay to LSP (0-lepton, grid 1 last year)
masses['1000021'] = float( mass_string.split('_')[0] ) #gluino
masses['1000022'] = float( mass_string.split('_')[1] ) #chi10
masses['1000023'] = 0.5*(masses['1000021']+masses['1000022']) #chi20
deltaM = 0.5*(masses['1000021'] - masses['1000022']) # (mgluino - mchi10) / 2 = mchi20 - mchi10
if 'SL' in decaytype:
masses['1000011'] = 0.5*(masses['1000022']+masses['1000023']) #slepton
masses['1000012'] = 0.5*(masses['1000022']+masses['1000023']) #slepton
masses['1000013'] = 0.5*(masses['1000022']+masses['1000023']) #slepton
masses['1000014'] = 0.5*(masses['1000022']+masses['1000023']) #slepton
masses['1000015'] = 0.5*(masses['1000022']+masses['1000023']) #slepton
masses['1000016'] = 0.5*(masses['1000022']+masses['1000023']) #slepton
else:
masses['1000011'] = 4.5e5 #slepton
masses['1000012'] = 4.5e5 #slepton
masses['1000013'] = 4.5e5 #slepton
masses['1000014'] = 4.5e5 #slepton
masses['1000015'] = 4.5e5 #slepton
masses['1000016'] = 4.5e5 #slepton
#### MadGraph is used to decay gluino, Madspin will be used to decay N2
process = '''
generate p p > go go
add process p p > go go j
add process p p > go go j j
'''
evgenConfig.contact = ["arka.santra@cern.ch" ]
if 'SS' in gentype:
evgenConfig.keywords += ['simplifiedModel','squark','Z']
evgenConfig.description = 'SUSY Simplified Model with squark production and decays via Z with MadGraph/Pythia8, m_squ = %s GeV, m_N2 = %s GeV, m_N1 = %s GeV'%(masses['1000001'],masses['1000023'],masses['1000022'])
if 'GG' in gentype:
evgenConfig.keywords += ['simplifiedModel','gluino', 'Z']
evgenConfig.description = 'SUSY Simplified Model with gluino production and decays via Z with MadGraph/Pythia8, m_glu = %s GeV, m_N2 = %s GeV, m_N1 = %s GeV'%(masses['1000021'],masses['1000023'],masses['1000022'])
#--------------------------------------------------------------
# Madspin configuration
#--------------------------------------------------------------
msdecaystring = ""
if 'SS' in gentype:
msdecaystring="""
define all = e+ e- mu+ mu- ta+ ta- u u~ d d~ c c~ s s~ b b~ ve vm vt ve~ vm~ vt~
decay n2 > all all n1"""
if 'GG' in gentype:
msdecaystring="""
define all = e+ e- mu+ mu- ta+ ta- u u~ d d~ c c~ s s~ b b~ ve vm vt ve~ vm~ vt~
decay go > jb jb n2, n2 > all all n1
"""
if madspindecays==True:
if msdecaystring=="":
raise RuntimeError("Asking for MadSpin decays, but no decay string provided!")
madspin_card='madspin_card.dat'
mscard = open(madspin_card,'w')
mscard.write("""#************************************************************
#* MadSpin *
#* *
#* P. Artoisenet, R. Frederix, R. Rietkerk, O. Mattelaer *
#* *
#* Part of the MadGraph5_aMC@NLO Framework: *
#* The MadGraph5_aMC@NLO Development Team - Find us at *
#* https://server06.fynu.ucl.ac.be/projects/madgraph *
#* *
#************************************************************
#Some options (uncomment to apply)
#
# set Nevents_for_max_weigth 75 # number of events for the estimate of the max. weight
set BW_cut 100 # cut on how far the particle can be off-shell
set max_weight_ps_point 400 # number of PS to estimate the maximum for each event
#
set seed %i
set spinmode none
# specify the decay for the final state particles
%s
# running the actual code
launch"""%(runArgs.randomSeed,msdecaystring))
mscard.close()
#--------------------------------------------------------------
# Pythia configuration
#--------------------------------------------------------------
# This comes after all Simplified Model setup files
evgenLog.info('Will use Pythia8...')
pythia = genSeq.Pythia8
pythia.MaxFailures = 100
#--------------------------------------------------------------
# Algorithms Private Options
#--------------------------------------------------------------
filters=[]
# Two-lepton+Met filter
if '2LMET100' in runArgs.jobConfig[0]:
if deltaM <= 7:
evt_multiplier = 210
elif (deltaM >= 10 and deltaM <= 20):
evt_multiplier = 70
elif (deltaM > 20 and deltaM <= 40):
evt_multiplier = 50
else:
evt_multiplier = 30
include('MC15JobOptions/MultiLeptonFilter.py')
MultiLeptonFilter = filtSeq.MultiLeptonFilter
filtSeq.MultiLeptonFilter.Ptcut = 5000.
filtSeq.MultiLeptonFilter.Etacut = 2.8
filtSeq.MultiLeptonFilter.NLeptons = 2
include("MC15JobOptions/MissingEtFilter.py")
filtSeq.MissingEtFilter.METCut = 100*GeV # MET > 100 GeV
filtSeq.Expression = "(MultiLeptonFilter) and (MissingEtFilter)"
# Two-lepton filter
elif '2L' in runArgs.jobConfig[0]:
evt_multiplier = 20
include('MC15JobOptions/MultiLeptonFilter.py')
MultiLeptonFilter = filtSeq.MultiLeptonFilter
filtSeq.MultiLeptonFilter.Ptcut = 5000.
filtSeq.MultiLeptonFilter.Etacut = 2.8
filtSeq.MultiLeptonFilter.NLeptons = 2
elif 'MET100' in runArgs.jobConfig[0]:
evt_multiplier *= 2
include ( 'MC15JobOptions/MissingEtFilter.py' )
MissingEtFilter = filtSeq.MissingEtFilter
filtSeq.MissingEtFilter.METCut = 100*GeV
#--------------------------------------------------------------
# Z->ll for low deltaM
#--------------------------------------------------------------
# For low deltaM = m(N2) - m(N1) in the ZN1 grid, if there's a Z in the event we need to use madspin for the decays
if "ZN1" in decaytype and deltaM <= 20 and madspindecays==False:
print "Mass difference smaller than 20 GeV, m_N2 - m_N1 = ", deltaM, ", need to decay the Z using madspin for this to work. Exiting..."
sys.exit()
njets = 1
include('MC15JobOptions/MadGraphControl_SimplifiedModelPostInclude.py')
if njets>0:
genSeq.Pythia8.Commands += [ "Merging:Process = guess" ]
### needed to use "guess" option of Pythia.
if "UserHooks" in genSeq.Pythia8.__slots__.keys():
genSeq.Pythia8.UserHooks += ['JetMergingaMCatNLO']
else:
genSeq.Pythia8.UserHook = 'JetMergingaMCatNLO'
This diff is collapsed.
This diff is collapsed.
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.py')
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.py')
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.py')
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.py')
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.py')
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.py')
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.py')
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.py')
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.py')
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.py')
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.py')
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.py')
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.py')
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.py')
include('MC15JobOptions/MadGraphControl_Leptoquarks_Mix_ttbarfilters.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