1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """Classes, methods and functions required to write QCD color information
17 for a loop diagram and build a color basis, and to square a QCD color string for
18 squared diagrams and interference terms."""
19
20 import copy
21 import fractions
22 import operator
23 import re
24 import madgraph.various.misc as misc
25
26 import madgraph.core.color_amp as color_amp
27 import madgraph.core.color_algebra as color_algebra
28 import madgraph.core.diagram_generation as diagram_generation
29 import madgraph.loop.loop_diagram_generation as loop_diagram_generation
30 import madgraph.core.base_objects as base_objects
31
32
33
34
35
37 """ Same class as its mother ColorBasis except that it can also handle
38 LoopAmplitudes."""
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
48 """ Add a color delta in the right representation (depending on the
49 color charge carried by the L-cut particle whose number are given in
50 the loop_numbers argument) to close the loop color trace."""
51
52
53
54 if lcut_charge<0:
55 lcut_numbers.reverse()
56 if abs(lcut_charge)==1:
57
58 return
59 elif abs(lcut_charge)==3:
60 closingCS=color_algebra.ColorString(\
61 [color_algebra.T(lcut_numbers[1],lcut_numbers[0])])
62 elif abs(lcut_charge)==6:
63 closingCS=color_algebra.ColorString(\
64 [color_algebra.T6(lcut_numbers[1],lcut_numbers[0])])
65 elif abs(lcut_charge)==8:
66 closingCS=color_algebra.ColorString(\
67 [color_algebra.Tr(lcut_numbers[1],lcut_numbers[0])],
68 fractions.Fraction(2, 1))
69 else:
70 raise color_amp.ColorBasis.ColorBasisError, \
71 "L-cut particle has an unsupported color representation %s" % lcut_charge
72
73
74 for CS in colorize_dict.values():
75
76
77 if self.compute_loop_nc:
78
79
80 max_CS_lcut_diag_Nc_power = max(cs.Nc_power \
81 for cs in color_algebra.ColorFactor([CS]).full_simplify())
82
83 CS.product(closingCS)
84 if self.compute_loop_nc:
85
86
87
88 simplified_cs = color_algebra.ColorFactor([CS]).full_simplify()
89 if not simplified_cs:
90
91 CS.loop_Nc_power = 0
92 continue
93
94 max_CS_loop_diag_Nc_power = max(cs.Nc_power \
95 for cs in simplified_cs)
96
97
98 CS.loop_Nc_power = max_CS_loop_diag_Nc_power - \
99 max_CS_lcut_diag_Nc_power
100 else:
101
102
103
104 CS.loop_Nc_power = None
105
142
144 """Returns a list of colorize dict for all born diagrams in amplitude.
145 Also update the _list_color_dict object accordingly """
146
147 list_color_dict = []
148
149 if not isinstance(amplitude,loop_diagram_generation.LoopAmplitude):
150 raise color_amp.ColorBasis.ColorBasisError, \
151 'LoopColorBasis is used with an amplitude which is not a LoopAmplitude'
152
153 for diagram in amplitude.get('born_diagrams'):
154 colorize_dict = self.colorize(diagram,
155 amplitude.get('process').get('model'))
156 list_color_dict.append(colorize_dict)
157
158 self._list_color_dict = list_color_dict
159
160 return list_color_dict
161
163 """Build the a color basis object using information contained in
164 amplitude (otherwise use info from _list_color_dict).
165 Returns a list of color """
166
167 self.create_born_color_dict_list(amplitude)
168 for index, color_dict in enumerate(self._list_color_dict):
169 self.update_color_basis(color_dict, index)
170
172 """Build the loop color basis object using information contained in
173 amplitude (otherwise use info from _list_color_dict).
174 Returns a list of color."""
175
176 self.create_loop_color_dict_list(amplitude)
177 for index, color_dict in enumerate(self._list_color_dict):
178 self.update_color_basis(color_dict, index)
179