SMEFTNLO reweighting problem. KeyError: (((-3, 4), (-6, 6, 24)), 'V')

Bug #1877161 reported by Reza Goldouzian on 2020-05-06
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Valentin Hirschi

Bug Description

Dear Experts,

I am trying to generate ttW process with EFT vertices at NLO. I am going to include weights for various combination of EFT coupling in my sample. My process card is like

import model SMEFTatNLO_U2_2_U3_3_cG_4F_LO_UFO-NLO
define j = p
define p = 21 2 4 1 3 -2 -4 -1 -3 5 -5
define WW = w+ w-
generate p p > t t~ WW QCD=2 QED=1 NP=2 [QCD]
output ttW_SMEFTNLOQED1_v1 -nojpeg

everything works when I do reweighting at LO. But for NLO reweighting, I see the following error
KeyError : (((-3, 4), (-6, 6, 24)), 'V')

I do not know what is wrong in my NLO reweighting procedure.

Best regards,


reweight /afs/ -from_cards --multicore=create
Traceback (most recent call last):
  File "/afs/", line 1514, in onecmd
    return self.onecmd_orig(line, **opt)
  File "/afs/", line 1463, in onecmd_orig
    return func(arg, **opt)
  File "/afs/", line 2142, in do_reweight
  File "/afs/", line 1660, in import_command_file
    self.exec_cmd(line, precmd=True)
  File "/afs/", line 1543, in exec_cmd
    stop = Cmd.onecmd_orig(current_interface, line, **opt)
  File "/afs/", line 1463, in onecmd_orig
    return func(arg, **opt)
  File "/afs/", line 100, in f_with_no_logger
    out = f(self, *args, **opt)
  File "/afs/", line 546, in do_launch
    weight = self.calculate_weight(event)
  File "/afs/", line 954, in calculate_weight
    return self.calculate_nlo_weight(event)
  File "/afs/", line 1028, in calculate_nlo_weight
    w_origV = self.calculate_matrix_element(cevent, 'V0', scale2=scale2)
  File "/afs/", line 1155, in calculate_matrix_element
    orig_order, Pdir, hel_dict = self.id_to_path[tag]
KeyError: (((-3, 4), (-6, 6, 24)), 'V')

Reza Goldouzian (rgoldouz) wrote :
Reza Goldouzian (rgoldouz) wrote :
Reza Goldouzian (rgoldouz) wrote :
Reza Goldouzian (rgoldouz) wrote :
Reza Goldouzian (rgoldouz) wrote :
Reza Goldouzian (rgoldouz) wrote :


I can reproduce it now and can start to investigate this.


Changed in mg5amcnlo:
status: New → Confirmed


The issue seems related to the standalone output of MadLoop.
Some of the metadata are not correctly written in this case.
If I do
import model SMEFTatNLO_U2_2_U3_3_cG_4F_LO_UFO-NLO
generate p p > t t~ w- QCD=2 QED=1 NP=2 [ virt=QCD]
output standalone PROC_SA_TEST --prefix=int

then looking at PROC_SA_TEST/SubProcess/P0_dux_ttxwm/born_matrix.f

you can see the following comment:
C Process: d u~ > t t~ w- NP<=2 QCD<=2 QED<=1 [ virt = QCD ]
C Process: s c~ > t t~ NP<=2 QCD<=2 QED<=1 [ virt = QCD ]

where the second line is missing the w-
This is only a comment not a real issue but this is also linked to the fortran/python issue:
where you see the following:

      IF (NPDG.EQ.4)THEN
     $ -6.EQ.PDGS(4)) THEN ! 3
     $ -6.EQ.PDGS(4).AND.-24.EQ.PDGS(5)) THEN ! 4

which also indicates that one process does not have a w-.

I will assign this to Valentin to see if he knows what can cause this.



Changed in mg5amcnlo:
assignee: nobody → Valentin Hirschi (valentin-hirschi)

More information,

This has been introduced in 2.6.0
before that two different matrix-element/directory were created but only one was created starting with 2.6.0 (but with this issue in the process definition of the second process)

The issue is related to the function
which has wrong size input for the two permutation element.
Those input are given by:

so the issue is either in the definition of the tag and/or in the get_external_numbers routine ...



I do not think that this is the best patch possible but it should do the trick in this case.
Valention should be able to take a deeper look with the information that I gave above and provide a patch valid in all cases.

Reza Goldouzian (rgoldouz) wrote :

Dear Olivier,

Thanks a lot for the reply.
I see only 5756 line in madgraph/core/ file. Should I add these lines at the end of this file? Sorry I am not sure where should I add these lines.

I look forward to Valention reply.


The patch has been created from the latest development version.
You can try to use the patch program to apply it but no guarantee obviously.

Changed in mg5amcnlo:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers