3 from MadGraphControl.SUSY_Helpers
import SUSY_Generation
4 from MadGraphControl.MadGraphUtilsHelpers
import get_physics_short
8 if 'rpv' in phys_short.lower()
and not 'import ' in process:
9 raise RuntimeError(
'Please import a model when using an RPV decay; these are not handled by the standard MSSM model in MadGraph')
13 if runArgs.maxEvents>0:
14 nevts=runArgs.maxEvents*evt_multiplier
16 nevts=evgenConfig.nEventsPerJob*evt_multiplier
19 nevts=evgenConfig.nEventsPerJob*2.
20 run_settings.update({
'nevents':
int(nevts)})
23 if ktdurham
is not None:
24 run_settings.update({
'ktdurham':ktdurham})
26 if flavourScheme
not in [4,5]:
27 raise RuntimeError(
'flavourScheme must be 4 or 5.')
29 if flavourScheme == 4:
31 'pdgs_for_merging_cut':
'1, 2, 3, 4, 21'
33 PYTHIA8_nQuarksMerge = 5
if finalStateB
else 4
36 'pdgs_for_merging_cut':
'1, 2, 3, 4, 5, 21',
40 PYTHIA8_nQuarksMerge = 5
43 process =
"define p = g u c d s b u~ c~ d~ s~ b~\ndefine j = g u c d s b u~ c~ d~ s~ b~\n" + process
45 for l
in process.split(
'\n'):
46 l_nocomment = l.split(
'#')[0]
47 if (
"define p" in l_nocomment
or "define j" in l_nocomment)
and l_nocomment.count(
"=") == 1:
48 l_equals = (l_nocomment.split(
"=")[-1]).
split(
" ")
49 if not set([
'g',
'u',
'c',
'd',
's',
'b',
'u~',
'c~',
'd~',
's~',
'b~']) <=
set(l_equals):
50 raise RuntimeError(
'Invalid definition found for p or j in process string while using 5FS')
52 if masses.get(
'5',0.0) != 0.0:
53 raise RuntimeError(
'Non-zero mass found for b while using 5FS')
57 if '_msup' in phys_short:
59 elif '_msdw' in phys_short:
61 if syst_mod
not in [
'msup',
'msdw',
None]:
62 raise RuntimeError(f
'Systematic variation {syst_mod=} unknown; allowed values are "msup" or "msdw" for matching scale up/down variations')
65 if 'mass' in [x.lower()
for x
in param_blocks]:
66 raise RuntimeError(
'Do not provide masses in param_blocks; use the masses variable instead')
67 param_blocks[
'MASS']=masses
69 if len(decays)>0: param_blocks[
'DECAY']=decays
70 argdict = {
'runArgs' : runArgs,
72 'params' : param_blocks,
73 'fixEventWeightsForBridgeMode': fixEventWeightsForBridgeMode,
74 'madspin_card' : madspin_card,
75 'keepOutput' : keepOutput,
76 'run_settings' : run_settings,
77 'writeGridpack' : writeGridpack,
78 'syst_mod' : syst_mod,
79 'param_card' : param_card,
80 'add_lifetimes_lhe' : add_lifetimes_lhe,
81 'usePMGSettings' : usePMGSettings,
86 if not hasattr(runArgs,
'inputGeneratorFile')
or runArgs.inputGeneratorFile
is None:
95 param_card_old = process_dir+
'/Cards/param_card.dat'
98 if tarfile.is_tarfile(runArgs.inputGeneratorFile):
99 myTarball = tarfile.open(runArgs.inputGeneratorFile)
101 for afile
in myTarball.getnames():
102 if afile.endswith(
'.events'): myEvents = afile
104 raise RuntimeError(
'No input events file found!')
106 events_file = myTarball.extractfile( myEvents )
107 update_lhe_file(lhe_file_old=myEvents,param_card_old=param_card_old,masses=masses)
108 for aline
in events_file:
110 if b
'ktdurham' in aline
and b
'=' in aline:
111 ktdurham =
float(aline.split(b
'=')[0].strip())
116 update_lhe_file(lhe_file_old=runArgs.inputGeneratorFile,param_card_old=param_card_old,masses=masses)
117 with open(runArgs.inputGeneratorFile,
'r')
as events_file:
118 for aline
in events_file:
119 if 'ktdurham' in aline
and "=" in aline:
120 ktdurham =
float(aline.split(
'=')[0].strip())
123 if madspin_card
is not None:
126 arrange_output(process_dir=process_dir,saveProcDir=keepOutput,runArgs=runArgs,fixEventWeightsForBridgeMode=fixEventWeightsForBridgeMode)
132 PYTHIA8_nJetMax=
max([l.count(
'j')
for l
in process.split(
'\n')])
133 njets_min=
min([l.count(
'j')
for l
in process.split(
'\n')
if 'generate ' in l
or 'add process' in l])
134 if PYTHIA8_nJetMax>0
and PYTHIA8_nJetMax!=njets_min
and hasattr(genSeq,
'Pythia8'):
136 PYTHIA8_TMS = ktdurham
137 PYTHIA8_Dparameter = 0.4
139 if 'PYTHIA8_Process' not in dir():
140 for acommand
in genSeq.Pythia8.Commands:
141 if acommand.startswith(
'Merging:Process'):
142 PYTHIA8_Process = acommand.split(
'=')[1].strip()
146 PYTHIA8_Process =
'guess'
149 include(
'Pythia8_i/Pythia8_CKKWL_kTMerge.py')
151 genSeq.Pythia8.Commands += [
"Merging:mayRemoveDecayProducts = on"]
155 evgenConfig.keywords += [
"SUSY"]