32
32
import madgraph.iolibs.export_fks_born as export_fks_born
33
33
import madgraph.loop.loop_base_objects as loop_base_objects
34
34
import madgraph.core.diagram_generation as diagram_generation
35
import madgraph.core.helas_objects as helas_objects
37
38
pjoin = os.path.join
134
135
class FKSInterface(CheckFKS, CompleteFKS, HelpFKS, mg_interface.MadGraphCmd):
135
136
_fks_display_opts = ['real_diagrams', 'born_diagrams', 'virt_diagrams',
136
137
'real_processes', 'born_processes', 'virt_processes']
139
def __init__(self, mgme_dir = '', *completekey, **stdin):
140
""" Special init tasks for the Loop Interface """
142
mg_interface.MadGraphCmd.__init__(self, mgme_dir = '', *completekey, **stdin)
146
""" Special tasks when switching to this interface """
148
# Refresh all the interface stored value as things like generated
149
# processes and amplitudes are not to be reused in between different
151
# Clear history, amplitudes and matrix elements when a model is imported
152
# Remove previous imports, generations and outputs from history
153
self.clean_history(remove_bef_lb1='import')
154
# Reset amplitudes and matrix elements
155
self._done_export=False
156
self._curr_amps = diagram_generation.AmplitudeList()
157
self._curr_matrix_elements = helas_objects.HelasMultiProcess()
159
# Set where to look for CutTools installation.
160
# In further versions, it will be set in the same manner as _mgme_dir so that
161
# the user can chose its own CutTools distribution.
162
self._cuttools_dir=str(os.path.join(self._mgme_dir,'vendor','CutTools'))
163
if not os.path.isdir(os.path.join(self._cuttools_dir, 'src','cts')):
164
logger.warning(('Warning: Directory %s is not a valid CutTools directory.'+\
165
'Using default CutTools instead.') % \
167
self._cuttools_dir=str(os.path.join(self._mgme_dir,'vendor','CutTools'))
138
169
def do_display(self, line, output=sys.stdout):
139
170
# if we arrive here it means that a _fks_display_opts has been chosen
185
216
args = self.split_arg(line)
186
217
# Check the validity of the arguments
187
218
self.check_add(args)
188
proc_type=self.extract_process_type(line)
189
self.validate_model(proc_type[1])
191
220
if args[0] != 'process':
192
221
raise self.InvalidCmd("The add command can only be used with a process")
194
223
line = ' '.join(args[1:])
225
proc_type=self.extract_process_type(line)
226
self.validate_model(proc_type[1])
196
if proc_type[2]!=['QCD']:
197
raise MadGraph5Error, 'FKS for reals only available in QCD for now, you asked %s' \
200
228
#now generate the amplitudes as usual
201
229
self.options['group_subprocesses'] = 'False'
202
230
collect_mirror_procs = False
210
238
myprocdef = mg_interface.MadGraphCmd.extract_process(self,line)
212
myprocdef['perturbation_couplings'] = ['QCD']
240
if myprocdef['perturbation_couplings']!=['QCD']:
241
raise self.InvalidCmd("FKS for reals only available in QCD for now, you asked %s" \
242
% ', '.join(myprocdef['perturbation_couplings']))
214
244
if self.options['fks_mode'] == 'born':
215
245
self._fks_multi_proc = fks_born.FKSMultiProcessFromBorn(myprocdef,