~madteam/mg5amcnlo/series2.0

« back to all changes in this revision

Viewing changes to madgraph/loop/loop_color_amp.py

  • Committer: olivier Mattelaer
  • Date: 2015-03-05 00:14:16 UTC
  • mfrom: (258.1.9 2.3)
  • mto: (258.8.1 2.3)
  • mto: This revision was merged to the branch mainline in revision 259.
  • Revision ID: olivier.mattelaer@uclouvain.be-20150305001416-y9mzeykfzwnl9t0j
partial merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import fractions
22
22
import operator
23
23
import re
 
24
import madgraph.various.misc as misc
24
25
 
25
26
import madgraph.core.color_amp as color_amp
26
27
import madgraph.core.color_algebra as color_algebra
36
37
    """ Same class as its mother ColorBasis except that it can also handle
37
38
        LoopAmplitudes."""
38
39
 
 
40
    def __init__(self, compute_loop_nc = False):
 
41
        """ Defines the instance attribute compute_loop_nc.
 
42
        The compute_loop_nc sets wheter independent tracking of Nc power coming
 
43
        from the color loop trace is necessary or not (it is time consuming)."""
 
44
        
 
45
        self.compute_loop_nc = compute_loop_nc
 
46
 
39
47
    def closeColorLoop(self, colorize_dict, lcut_charge, lcut_numbers):
40
48
        """ Add a color delta in the right representation (depending on the 
41
49
        color charge carried by the L-cut particle whose number are given in
42
 
        the loop_numbers argument) to close the loop color trace """
43
 
                
 
50
        the loop_numbers argument) to close the loop color trace."""
 
51
        
44
52
        # But for T3 and T6 for example, we must make sure to add a delta with 
45
53
        # the first index in the fundamental representation.
46
54
        if lcut_charge<0:
61
69
        else:
62
70
            raise color_amp.ColorBasis.ColorBasisError, \
63
71
        "L-cut particle has an unsupported color representation %s" % lcut_charge
64
 
                
 
72
 
65
73
        # Append it to all color strings for this diagram.
66
74
        for CS in colorize_dict.values():
 
75
            # The double full_simplify() below brings significantly slowdown
 
76
            # so that it should be used only when loop_Nc_power is actuall used.
 
77
            if self.compute_loop_nc:
 
78
                # We first compute the NcPower of this ColorString before
 
79
                # *before* the loop color flow is sewed together.
 
80
                max_CS_lcut_diag_Nc_power = max(cs.Nc_power \
 
81
                      for cs in color_algebra.ColorFactor([CS]).full_simplify())
 
82
            # We add here the closing color structure.
67
83
            CS.product(closingCS)
68
 
        
 
84
            if self.compute_loop_nc:
 
85
                # Now compute the Nc power *after* the loop color flow is sewed 
 
86
                # together and again compute the overall maximum power of Nc 
 
87
                # appearing in this simplified sewed structure.
 
88
                max_CS_loop_diag_Nc_power = max(cs.Nc_power \
 
89
                      for cs in color_algebra.ColorFactor([CS]).full_simplify())
 
90
                # We can now set the power of Nc brought by the potential loop
 
91
                # color trace to the corresponding attribute of this ColorStructure
 
92
                CS.loop_Nc_power =  max_CS_loop_diag_Nc_power - \
 
93
                                                       max_CS_lcut_diag_Nc_power
 
94
            else:
 
95
                # When not computing loop_nc (whcih is typically used for now
 
96
                # only when doing LoopInduced + Madevent, we set the
 
97
                # CS.loop_Nc_power None so that it will cause problems if used.
 
98
                CS.loop_Nc_power = None
 
99
 
69
100
    def create_loop_color_dict_list(self, amplitude):
70
101
        """Returns a list of colorize dict for all loop diagrams in amplitude.
71
 
        Also update the _list_color_dict object accordingly """
 
102
        Also update the _list_color_dict object accordingly."""
72
103
 
73
104
        list_color_dict = []
74
105
        
134
165
    def build_loop(self, amplitude):
135
166
        """Build the loop color basis object using information contained in
136
167
        amplitude (otherwise use info from _list_color_dict). 
137
 
        Returns a list of color """
 
168
        Returns a list of color."""
138
169
 
139
170
        self.create_loop_color_dict_list(amplitude)
140
171
        for index, color_dict in enumerate(self._list_color_dict):