MSSM SLHA2 Model with UnboundLocalError

Asked by Joel Jones on 2021-01-30

Hi,

I just installed the later version of MadGraph (2.9.0) and am finding an error when testing the MSSM_SLHA2 model. This did not happen on the previous version.

> import model MSSM_SLHA2 --modelname
> generate p p > sl2+ sl2-
> output TestSlepton
> launch

I get the following output:

INFO: Update the dependent parameter of the param_card.dat
WARNING: Unknow type of information in the card: snumix,upmns,vckm
Generating 10000 events with run name run_01
survey run_01
INFO: compile directory
compile Source Directory
Using random number seed offset = 21
INFO: Running Survey
Creating Jobs
Working on SubProcesses
INFO: Compiling for process 1/1.
INFO: P1_qq_sl2psl2m
Command "generate_events run_01" interrupted with error:
UnboundLocalError : local variable 'ext_num' referenced before assignment

I get this from the logfile:

Traceback (most recent call last):
  File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/extended_cmd.py", line 1541, in onecmd
    return self.onecmd_orig(line, **opt)
  File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/extended_cmd.py", line 1490, in onecmd_orig
    return func(arg, **opt)
  File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/madevent_interface.py", line 2471, in do_generate_events
    self.run_generate_events(switch_mode, args)
  File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/common_run_interface.py", line 7098, in new_fct
    original_fct(obj, *args, **opts)
  File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/madevent_interface.py", line 2510, in run_generate_events
    self.exec_cmd('survey %s %s' % (self.run_name,' '.join(args)),
  File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/extended_cmd.py", line 1570, in exec_cmd
    stop = Cmd.onecmd_orig(current_interface, line, **opt)
  File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/extended_cmd.py", line 1490, in onecmd_orig
    return func(arg, **opt)
  File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/madevent_interface.py", line 3364, in do_survey
    jobs, P_zero_result = ajobcreator.get_helicity()
  File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/madevent/gen_ximprove.py", line 288, in get_helicity
    recycler.generate_output_file()
  File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/madevent/hel_recycle.py", line 730, in generate_output_file
    self.read_orig()
  File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/madevent/hel_recycle.py", line 681, in read_orig
    self.template_dict['helas_calls'] += self.unfold_helicities(
  File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/madevent/hel_recycle.py", line 552, in unfold_helicities
    new_objs = External.generate_wavfuncs(line, self.dag)
  File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/madevent/hel_recycle.py", line 241, in generate_wavfuncs
    cls.wavs_same_leg[ext_num] = new_wavfuncs
UnboundLocalError: local variable 'ext_num' referenced before assignment

I tried with another model, and did not find this error.

Question information

Language:
English Edit question
Status:
Solved
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Solved by:
Olivier Mattelaer
Solved:
2021-02-02
Last query:
2021-02-02
Last reply:
2021-02-02

Thanks,

will need to investigate that.
One easy work-around is to do

>> import model MSSM_SLHA2 --modelname
>> generate p p > sl2+ sl2-
>> output TestSlepton --hel_recycling=False
>> launch

The flag "--hel_recycling=False" deactivates one of the new optimization of 2.9.0 and it seems that that one is problematic in your case.

Cheers,

Olivier

> On 30 Jan 2021, at 17:50, Joel Jones <email address hidden> wrote:
>
> New question #695271 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/695271
>
> Hi,
>
> I just installed the later version of MadGraph (2.9.0) and am finding an error when testing the MSSM_SLHA2 model. This did not happen on the previous version.
>
>> import model MSSM_SLHA2 --modelname
>> generate p p > sl2+ sl2-
>> output TestSlepton
>> launch
>
> I get the following output:
>
> INFO: Update the dependent parameter of the param_card.dat
> WARNING: Unknow type of information in the card: snumix,upmns,vckm
> Generating 10000 events with run name run_01
> survey run_01
> INFO: compile directory
> compile Source Directory
> Using random number seed offset = 21
> INFO: Running Survey
> Creating Jobs
> Working on SubProcesses
> INFO: Compiling for process 1/1.
> INFO: P1_qq_sl2psl2m
> Command "generate_events run_01" interrupted with error:
> UnboundLocalError : local variable 'ext_num' referenced before assignment
>
> I get this from the logfile:
>
> Traceback (most recent call last):
> File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/extended_cmd.py", line 1541, in onecmd
> return self.onecmd_orig(line, **opt)
> File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/extended_cmd.py", line 1490, in onecmd_orig
> return func(arg, **opt)
> File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/madevent_interface.py", line 2471, in do_generate_events
> self.run_generate_events(switch_mode, args)
> File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/common_run_interface.py", line 7098, in new_fct
> original_fct(obj, *args, **opts)
> File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/madevent_interface.py", line 2510, in run_generate_events
> self.exec_cmd('survey %s %s' % (self.run_name,' '.join(args)),
> File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/extended_cmd.py", line 1570, in exec_cmd
> stop = Cmd.onecmd_orig(current_interface, line, **opt)
> File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/extended_cmd.py", line 1490, in onecmd_orig
> return func(arg, **opt)
> File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/interface/madevent_interface.py", line 3364, in do_survey
> jobs, P_zero_result = ajobcreator.get_helicity()
> File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/madevent/gen_ximprove.py", line 288, in get_helicity
> recycler.generate_output_file()
> File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/madevent/hel_recycle.py", line 730, in generate_output_file
> self.read_orig()
> File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/madevent/hel_recycle.py", line 681, in read_orig
> self.template_dict['helas_calls'] += self.unfold_helicities(
> File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/madevent/hel_recycle.py", line 552, in unfold_helicities
> new_objs = External.generate_wavfuncs(line, self.dag)
> File "/home/jjones/Programs/MG5_aMC_v2_9_0/madgraph/madevent/hel_recycle.py", line 241, in generate_wavfuncs
> cls.wavs_same_leg[ext_num] = new_wavfuncs
> UnboundLocalError: local variable 'ext_num' referenced before assignment
>
> I tried with another model, and did not find this error.
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

here is a patch:
=== modified file 'madgraph/madevent/hel_recycle.py'
--- madgraph/madevent/hel_recycle.py 2021-01-29 17:19:54 +0000
+++ madgraph/madevent/hel_recycle.py 2021-01-30 22:32:36 +0000
@@ -224,6 +224,7 @@
             new_hels = [int_to_string(i) for i in new_hels]
         else:
             # Spinor must be a scalar so give it hel = 0
+ ext_num = int(re.search(r'\(0,(\d+)\)', old_args[0]).group(1)) -1
             new_hels = [' 0']

         new_wavfuncs = []

But I'm still worry for some other processes in the MSSM (with majorana actually)

2.9.1 is released with that patch and the patch associated to majorana handling.

Thanks,

Olivier

Joel Jones (n-jones-j) said : #4

Thanks Olivier Mattelaer, that solved my question.