~maddevelopers/mg5amcnlo/3.0.1

« back to all changes in this revision

Viewing changes to tests/parallel_tests/test_ML5EW.py

  • Committer: Marco Zaro
  • Date: 2014-01-27 16:54:10 UTC
  • mfrom: (78.124.55 MG5_aMC_2.1)
  • Revision ID: marco.zaro@gmail.com-20140127165410-5lma8c2hzbzm426j
merged with lp:~maddevelopers/madgraph5/MG5_aMC_2.1 r 267

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
import os
5
5
import unittest
6
6
import sys
7
 
 
 
7
import re
8
8
#Look for MG5/MG4 path
9
9
_mg5_path = os.sep.join(os.path.realpath(__file__).split(os.sep)[:-3])
10
10
sys.path.append(_mg5_path)
180
180
            stored_runner = me_comparator.PickleRunner.find_comparisons(
181
181
                              os.path.join(_pickle_path,pickle_file))[0]
182
182
            energy = stored_runner.energy
183
 
            
 
183
 
 
184
        file = open(os.path.join(_mg5_path,'Template','loop_material','StandAlone',
 
185
                                 'Cards','MadLoopParams.dat'), 'r')
 
186
 
 
187
        MLParams = file.read()
 
188
        MLred = re.search(r'#MLReductionLib\n',MLParams)
 
189
        MLredstr=MLParams[MLred.end():MLred.end()+1]
 
190
        if loop_induce and MLredstr!="1":return            
184
191
        # Create a MERunner object for MadLoop 5 optimized
185
192
        # Open Loops is not avaiable for loop induced processes
186
193
        if not loop_induce:
187
194
            ML5_opt = loop_me_comparator.LoopMG5Runner()
188
195
            ML5_opt.setup(_mg5_path, optimized_output=True, temp_dir=filename,\
189
196
                          mu_r=mu_r)
190
 
    
191
 
        # Create a MERunner object for MadLoop 5 default
192
 
        ML5_default = loop_me_comparator.LoopMG5Runner()
193
 
        ML5_default.setup(_mg5_path, optimized_output=False, temp_dir=filename,\
 
197
 
 
198
        if MLredstr=="1":
 
199
            # Create a MERunner object for MadLoop 5 default
 
200
            ML5_default = loop_me_comparator.LoopMG5Runner()
 
201
            ML5_default.setup(_mg5_path, optimized_output=False, temp_dir=filename,\
194
202
                          mu_r=mu_r) 
195
203
 
196
204
        # Create and setup a comparator
197
205
        my_comp = loop_me_comparator.LoopMEComparator()
198
206
        
 
207
        if MLredstr=="1":
199
208
        # Always put the saved run first if you use it, so that the corresponding PS
200
209
        # points will be used.
201
 
        if pickle_file != "" and not loop_induce:
202
 
            my_comp.set_me_runners(stored_runner,ML5_opt,ML5_default)
203
 
        elif pickle_file !="" and loop_induce:
204
 
            my_comp.set_me_runners(stored_runner,ML5_default)
205
 
        elif pickle_file == "" and not loop_induce:
206
 
            my_comp.set_me_runners(ML5_opt,ML5_default)
 
210
            if pickle_file != "" and not loop_induce:
 
211
                my_comp.set_me_runners(stored_runner,ML5_opt,ML5_default)
 
212
            elif pickle_file !="" and loop_induce:
 
213
                my_comp.set_me_runners(stored_runner,ML5_default)
 
214
            elif pickle_file == "" and not loop_induce:
 
215
                my_comp.set_me_runners(ML5_opt,ML5_default)
 
216
            else:
 
217
                raise MadGraph5Error, \
 
218
                    'Cannot find pickle_file for loop induced process.'
207
219
        else:
208
 
            raise MadGraph5Error, 'Cannot find pickle_file for loop induced process.'
 
220
            if pickle_file !="":
 
221
                my_comp.set_me_runners(stored_runner,ML5_opt)
 
222
            else:
 
223
                raise MadGraph5Error,"CANNOT find the stored result with TIR"
209
224
        
210
225
        # Run the actual comparison
211
226
        my_comp.run_comparison(my_proc_list,