3from MadGraphControl.SUSY_Helpers
import SUSY_Generation
4from MCJobOptionUtils.JOsupport
import get_physics_short,check_reset_proc_number
6phys_short = get_physics_short()
8if '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.
20run_settings.update({
'nevents':int(nevts)})
23if ktdurham
is not None:
24 run_settings.update({
'ktdurham':ktdurham})
26if flavourScheme
not in [4,5]:
27 raise RuntimeError(
'flavourScheme must be 4 or 5.')
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')
57if '_msup' in phys_short:
59elif '_msdw' in phys_short:
61if 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')
65if 'mass' in [x.lower()
for x
in param_blocks]:
66 raise RuntimeError(
'Do not provide masses in param_blocks; use the masses variable instead')
67param_blocks[
'MASS']=masses
69if len(decays)>0: param_blocks[
'DECAY']=decays
70argdict = {
'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,
86if not hasattr(runArgs,
'inputGeneratorFile')
or runArgs.inputGeneratorFile
is None:
88 ktdurham = SUSY_Generation(**argdict)
93 from MadGraphControl.SUSY_Helpers
import SUSY_process
94 process_dir = new_process(SUSY_process(
'generate p p > go go'))
95 modify_param_card(process_dir=process_dir,params={
'MASS':masses,
'DECAY':decays})
96 param_card_old = process_dir+
'/Cards/param_card.dat'
99 if tarfile.is_tarfile(runArgs.inputGeneratorFile):
100 myTarball = tarfile.open(runArgs.inputGeneratorFile)
102 for afile
in myTarball.getnames():
103 if afile.endswith(
'.events'): myEvents = afile
105 raise RuntimeError(
'No input events file found!')
107 events_file = myTarball.extractfile( myEvents )
108 update_lhe_file(lhe_file_old=myEvents,param_card_old=param_card_old,masses=masses)
109 for aline
in events_file:
111 if b
'ktdurham' in aline
and b
'=' in aline:
112 ktdurham = float(aline.split(b
'=')[0].
strip())
117 update_lhe_file(lhe_file_old=runArgs.inputGeneratorFile,param_card_old=param_card_old,masses=masses)
118 with open(runArgs.inputGeneratorFile,
'r')
as events_file:
119 for aline
in events_file:
120 if 'ktdurham' in aline
and "=" in aline:
121 ktdurham = float(aline.split(
'=')[0].
strip())
124 if madspin_card
is not None:
126 add_madspin(madspin_card,process_dir=process_dir)
127 arrange_output(process_dir=process_dir,saveProcDir=keepOutput,runArgs=runArgs,fixEventWeightsForBridgeMode=fixEventWeightsForBridgeMode)
130check_reset_proc_number(opts)
133PYTHIA8_nJetMax=
max([l.count(
'j')
for l
in process.split(
'\n')])
134njets_min=
min([l.count(
'j')
for l
in process.split(
'\n')
if 'generate ' in l
or 'add process' in l])
135if PYTHIA8_nJetMax>0
and PYTHIA8_nJetMax!=njets_min
and hasattr(genSeq,
'Pythia8'):
137 PYTHIA8_TMS = ktdurham
138 PYTHIA8_Dparameter = 0.4
140 if 'PYTHIA8_Process' not in dir():
141 for acommand
in genSeq.Pythia8.Commands:
142 if acommand.startswith(
'Merging:Process'):
143 PYTHIA8_Process = acommand.split(
'=')[1].
strip()
147 PYTHIA8_Process =
'guess'
150 include(
'Pythia8_i/Pythia8_CKKWL_kTMerge.py')
152 genSeq.Pythia8.Commands += [
"Merging:mayRemoveDecayProducts = on"]
156evgenConfig.keywords += [
"SUSY"]
std::vector< std::string > split(const std::string &s, const std::string &t=":")