Comment 14 for bug 1899608

Revision history for this message
Benjamin Fuks (fuks) wrote :

Hi everyone,

After live discussions with Valentin, the following fix (that I shamelessly copy paste from Valentin's e-mail) solves it. Feel free to review it and merge it to the main branch.

Cheers,

Benj

<><><><><><><><><><>

We need to modify helas_objects.py (line 1349 in check_majorana_and_flip_flow) and replace the line

                new_wf = wavefunctions[wavefunctions.index(new_wf)]

by
                if (not new_wf.get('is_loop')) or (new_wf.get('pdg_code')>0):
                    index_wf = wavefunctions.index(new_wf)
                else:
                    for i_wf, wf in enumerate(wavefunctions):
                        if new_wf == wf and wf.get('pdg_code')==new_wf.get('pdg_code'):
                            index_wf = i_wf
                            break
                    else:
                        raise ValueError
                new_wf = wavefunctions[index_wf]

This is needed because for loop wavefunctions the recycling of external legs REQUIRES paying attention to the PDG code and not just the properties/charges of the particle:

            # When on the optimized output mode, the starting loop wavefunction
            # can be recycled if it has the same pdg because whatever its pdg
            # it has the same coefficients and loop momentum zero,
            # so it is in principle not necessary to add it to the
            # diagram_wavefunction. However, this is necessary for the function
            # check_and_fix_fermion_flow to correctly update the dependances of
            # previous diagrams to an external L-cut majorana wavefunction which
            # needs flipping.
            if not self.optimized_output:
                wavefunctionNumber=wavefunctionNumber+1
                external_loop_wf.set('number',wavefunctionNumber)
                diagram_wavefunctions.append(external_loop_wf)
            else:
                try:
                    external_loop_wf=\
                         external_loop_wfs_dict[external_loop_wf.get('pdg_code’)]