Skip to content

Commit 083d509

Browse files
committed
Add standalone mode to MadGraph7
Reimplement the check_sa.cc file with RAMBO momenta generation, create the additional mode keyword `standalone_mg7`, make launch work and activate standalone mode to select the backend and the subdirectory to build and run, create new export class just for standalone, create new makefile, that wraps madmatrix.mk and adds standalone-related recipes.
1 parent d790077 commit 083d509

6 files changed

Lines changed: 568 additions & 1036 deletions

File tree

madgraph/interface/madgraph_interface.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,10 @@ def find_output_type(self, path):
14531453
raise self.InvalidCmd('%s : Not a valid directory' % path)
14541454
if os.path.isfile(pjoin(bin_path,'madevent')):
14551455
return 'madevent'
1456+
elif os.path.isfile(pjoin(subproc_path, 'madmatrix.mk')):
1457+
# standalone_mg7 writes SubProcesses/madmatrix.mk explicitly
1458+
# (the regular mg7 export does not).
1459+
return 'standalone_mg7'
14561460
elif os.path.isfile(pjoin(card_path, 'run_card.toml')):
14571461
return 'mg7'
14581462
elif os.path.isdir(src_path):
@@ -2990,7 +2994,8 @@ class MadGraphCmd(HelpToCmd, CheckValidForCmd, CompleteForCmd, CmdExtended):
29902994
_v4_export_formats = ['madevent', 'standalone', 'standalone_msP','standalone_msF',
29912995
'matrix', 'standalone_rw', 'madweight']
29922996
_export_formats = _v4_export_formats + ['standalone_cpp', 'pythia8', 'aloha',
2993-
'matchbox_cpp', 'matchbox', 'mg7_v5', 'mg7']
2997+
'matchbox_cpp', 'matchbox', 'mg7_v5', 'mg7',
2998+
'standalone_mg7']
29942999
_set_options = ['group_subprocesses',
29953000
'ignore_six_quark_processes',
29963001
'stdout_level',
@@ -3185,7 +3190,7 @@ def setup(self):
31853190

31863191
self._v4_export_formats = ['madevent', 'standalone','standalone_msP','standalone_msF',
31873192
'matrix', 'standalone_rw']
3188-
self._export_formats = self._v4_export_formats + ['standalone_cpp', 'pythia8', 'mg7_v5', 'mg7']
3193+
self._export_formats = self._v4_export_formats + ['standalone_cpp', 'pythia8', 'mg7_v5', 'mg7', 'standalone_mg7']
31893194
self._nlo_modes_for_completion = ['all','virt','real']
31903195

31913196
def do_quit(self, line):
@@ -7598,7 +7603,17 @@ def do_launch(self, line):
75987603
options = options.__dict__
75997604
# args is now MODE PATH
76007605

7601-
if args[0].startswith('standalone'):
7606+
if args[0] == 'standalone_mg7':
7607+
class ext_program:
7608+
@staticmethod
7609+
def run():
7610+
os.chdir(args[1])
7611+
try:
7612+
subprocess.run(os.path.join("bin", "generate_events"))
7613+
except KeyboardInterrupt:
7614+
pass
7615+
7616+
elif args[0].startswith('standalone'):
76027617
if os.path.isfile(os.path.join(os.getcwd(),args[1],'Cards',\
76037618
'MadLoopParams.dat')) and not os.path.isfile(os.path.join(\
76047619
os.getcwd(),args[1],'SubProcesses','check_poles.f')):
@@ -9239,6 +9254,7 @@ def do_output(self, line):
92399254
config['madweight'] = {'check': True, 'exporter': 'v4', 'output':'Template'}
92409255
config['mg7_v5'] = {'check': True, 'exporter': 'cpp', 'output': 'Template'}
92419256
config['mg7'] = {'check': True, 'exporter': 'cpp', 'output': 'Template'}
9257+
config['standalone_mg7'] = {'check': True, 'exporter': 'cpp', 'output': 'Template'}
92429258

92439259
if self._export_format == 'plugin':
92449260
options = {'check': self._export_plugin.check, 'exporter':self._export_plugin.exporter, 'output':self._export_plugin.output}

madgraph/iolibs/export_cpp.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2853,6 +2853,9 @@ def ExportCPPFactory(cmd, group_subprocesses=False, cmd_options={}):
28532853
elif cformat == 'mg7':
28542854
from madmatrix.output import ProcessExporterMadMatrix
28552855
return ProcessExporterMadMatrix(cmd._export_dir, opt)
2856+
elif cformat == 'standalone_mg7':
2857+
from madmatrix.output import ProcessExporterMadMatrixStandalone
2858+
return ProcessExporterMadMatrixStandalone(cmd._export_dir, opt)
28562859
else:
28572860
return cmd._export_plugin(cmd._export_dir, opt)
28582861

0 commit comments

Comments
 (0)