Package aloha :: Module aloha_object
[hide private]
[frames] | no frames]

Source Code for Module aloha.aloha_object

  1  ################################################################################ 
  2  # 
  3  # Copyright (c) 2010 The MadGraph Development team and Contributors 
  4  # 
  5  # This file is a part of the MadGraph 5 project, an application which  
  6  # automatically generates Feynman diagrams and matrix elements for arbitrary 
  7  # high-energy processes in the Standard Model and beyond. 
  8  # 
  9  # It is subject to the MadGraph license which should accompany this  
 10  # distribution. 
 11  # 
 12  # For more information, please visit: http://madgraph.phys.ucl.ac.be 
 13  # 
 14  ################################################################################ 
 15  ##   Diagram of Class 
 16  ## 
 17  ##    Variable <--- aloha_lib.ScalarVariable  
 18  ##               | 
 19  ##               +- LorentzObject <--- Gamma 
 20  ##                                  | 
 21  ##                                  +- Sigma 
 22  ##                                  | 
 23  ##                                  +- P 
 24  ## 
 25  ##    list <--- AddVariable    
 26  ##           | 
 27  ##           +- MultVariable  <--- MultLorentz  
 28  ##            
 29  ##    list <--- LorentzObjectRepresentation <-- ConstantObject 
 30  ## 
 31  ################################################################################ 
 32  from __future__ import division 
 33  import aloha.aloha_lib as aloha_lib 
 34   
 35  #=============================================================================== 
 36  # P (Momenta) 
 37  #=============================================================================== 
38 -class P(aloha_lib.LorentzObject):
39 """ Helas Object for an Impulsion """ 40 41 contract_first = 1 42
43 - def __init__(self, lorentz1, particle, prefactor=1):
44 45 self.particle = particle 46 aloha_lib.LorentzObject.__init__(self, [lorentz1], [], prefactor,\ 47 ['P%s'%particle])
48 49
50 - def create_representation(self):
51 self.sub0 = aloha_lib.ScalarVariable('P%s_0' % self.particle) 52 self.sub1 = aloha_lib.ScalarVariable('P%s_1' % self.particle) 53 self.sub2 = aloha_lib.ScalarVariable('P%s_2' % self.particle) 54 self.sub3 = aloha_lib.ScalarVariable('P%s_3' % self.particle) 55 56 self.representation= aloha_lib.LorentzObjectRepresentation( 57 {(0,): self.sub0, (1,): self.sub1, \ 58 (2,): self.sub2, (3,): self.sub3}, 59 self.lorentz_ind, [])
60 61 #=============================================================================== 62 # Pslash 63 #===============================================================================
64 -class PSlash(aloha_lib.LorentzObject):
65 """ Gamma Matrices """ 66 67 #gamma0 = [[0, 0, 1, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 1, 0, 0]] 68 #gamma1 = [[0, 0, 0, 1], [0, 0, 1, 0], [0, -1, 0, 0], [-1, 0, 0, 0]] 69 #gamma2 = [[0, 0, 0, -complex(0,1)],[0, 0, complex(0,1), 0], 70 # [0, complex(0,1), 0, 0], [-complex(0,1), 0, 0, 0]] 71 #gamma3 = [[0, 0, 1, 0], [0, 0, 0, -1], [-1, 0, 0, 0], [0, 1, 0, 0]] 72 # 73 #gamma = [gamma0, gamma1, gamma2, gamma3] 74
75 - def __init__(self, spin1, spin2, particle, prefactor=1):
76 77 self.particle = particle 78 aloha_lib.LorentzObject.__init__(self,[], [spin1, spin2], \ 79 prefactor=prefactor)
80
81 - def create_representation(self):
82 """create representation""" 83 p0 = aloha_lib.ScalarVariable('P%s_0' % self.particle) 84 p1 = aloha_lib.ScalarVariable('P%s_1' % self.particle) 85 p2 = aloha_lib.ScalarVariable('P%s_2' % self.particle) 86 p3 = aloha_lib.ScalarVariable('P%s_3' % self.particle) 87 88 89 gamma = { 90 (0, 0): 0, (0, 1): 0, (0, 2): p0-p3, (0, 3): -1*p1+1j*p2, 91 (1, 0): 0, (1, 1): 0, (1, 2): -1*p1-1j*p2, (1, 3): p0+p3, 92 (2, 0): p0+p3, (2, 1): p1-1j*p2, (2, 2): 0, (2, 3): 0, 93 (3, 0): p1+1j*p2, (3, 1): p0-p3, (3, 2): 0, (3, 3): 0} 94 95 96 self.representation = aloha_lib.LorentzObjectRepresentation(gamma, 97 self.lorentz_ind,self.spin_ind)
98 99 #=============================================================================== 100 # Mass 101 #===============================================================================
102 -class Mass(aloha_lib.LorentzObject):
103 """ Helas Object for a Mass""" 104
105 - def __init__(self, particle, prefactor=1):
106 107 self.particle = particle 108 aloha_lib.LorentzObject.__init__(self, [], [], prefactor=prefactor)
109 110
111 - def create_representation(self):
112 mass = aloha_lib.ScalarVariable('M%s' % self.particle) 113 114 self.representation = aloha_lib.LorentzObjectRepresentation( 115 mass, self.lorentz_ind, self.spin_ind)
116 117 #=============================================================================== 118 # OverMass2 119 #===============================================================================
120 -class OverMass2(aloha_lib.LorentzObject):
121 """ Helas Object for 1/M**2 """ 122
123 - def __init__(self, particle, prefactor=1):
124 125 self.particle = particle 126 127 tag= ['OM%s' % particle] 128 aloha_lib.LorentzObject.__init__(self, [], [], prefactor,tag)
129 130
131 - def create_representation(self):
132 mass = aloha_lib.ScalarVariable('OM%s' % self.particle) 133 134 self.representation = aloha_lib.LorentzObjectRepresentation( 135 mass, self.lorentz_ind, self.spin_ind)
136 137 #=============================================================================== 138 # Width 139 #===============================================================================
140 -class Width(aloha_lib.LorentzObject):
141 """ Helas Object for an Impulsion """ 142
143 - def __init__(self, particle, prefactor=1):
144 145 self.particle = particle 146 aloha_lib.LorentzObject.__init__(self, [], [], prefactor=prefactor)
147
148 - def create_representation(self):
149 width = aloha_lib.ScalarVariable('W%s' % self.particle) 150 151 self.representation= aloha_lib.LorentzObjectRepresentation( 152 width, self.lorentz_ind, self.spin_ind)
153 154 #=============================================================================== 155 # Scalar 156 #===============================================================================
157 -class Scalar(aloha_lib.LorentzObject):
158 """ Helas Object for a Spinor""" 159
160 - def __init__(self, particle, prefactor=1):
161 162 self.particle = particle 163 aloha_lib.LorentzObject.__init__(self, [], [], prefactor=prefactor)
164 165
166 - def create_representation(self):
167 rep = aloha_lib.ScalarVariable('S%s_1' % self.particle) 168 self.representation= aloha_lib.LorentzObjectRepresentation( 169 rep, [], [])
170 171 172 #=============================================================================== 173 # Spinor 174 #===============================================================================
175 -class Spinor(aloha_lib.LorentzObject):
176 """ Helas Object for a Spinor""" 177 178 contract_first = 1 179
180 - def __init__(self, spin1, particle, prefactor=1):
181 182 self.particle = particle 183 aloha_lib.LorentzObject.__init__(self, [], [spin1], prefactor=prefactor)
184 185
186 - def create_representation(self):
187 self.sub0 = aloha_lib.ScalarVariable('F%s_1' % self.particle) 188 self.sub1 = aloha_lib.ScalarVariable('F%s_2' % self.particle) 189 self.sub2 = aloha_lib.ScalarVariable('F%s_3' % self.particle) 190 self.sub3 = aloha_lib.ScalarVariable('F%s_4' % self.particle) 191 192 self.representation= aloha_lib.LorentzObjectRepresentation( 193 {(0,): self.sub0, (1,): self.sub1, \ 194 (2,): self.sub2, (3,): self.sub3}, 195 [],self.spin_ind)
196 197 #=============================================================================== 198 # Vector 199 #===============================================================================
200 -class Vector(aloha_lib.LorentzObject):
201 """ Helas Object for a Vector""" 202 203 contract_first = 1 204
205 - def __init__(self, lorentz, particle, prefactor=1):
206 207 self.particle = particle 208 aloha_lib.LorentzObject.__init__(self, [lorentz], [], prefactor=prefactor)
209 210
211 - def create_representation(self):
212 self.sub0 = aloha_lib.ScalarVariable('V%s_1' % self.particle) 213 self.sub1 = aloha_lib.ScalarVariable('V%s_2' % self.particle) 214 self.sub2 = aloha_lib.ScalarVariable('V%s_3' % self.particle) 215 self.sub3 = aloha_lib.ScalarVariable('V%s_4' % self.particle) 216 217 self.representation= aloha_lib.LorentzObjectRepresentation( 218 {(0,): self.sub0, (1,): self.sub1, \ 219 (2,): self.sub2, (3,): self.sub3}, 220 self.lorentz_ind, [])
221 222 #=============================================================================== 223 # Spin3/2 224 #===============================================================================
225 -class Spin2(aloha_lib.LorentzObject):
226 """ Helas Object for a Spin2""" 227
228 - def __init__(self, lorentz, spin, particle, prefactor=1):
229 230 self.particle = particle 231 232 aloha_lib.LorentzObject.__init__(self, [lorentz], [spin], \ 233 prefactor=prefactor)
234
235 - def create_representation(self):
236 237 self.sub00 = aloha_lib.ScalarVariable('R%s_1' % self.particle) 238 self.sub01 = aloha_lib.ScalarVariable('R%s_2' % self.particle) 239 self.sub02 = aloha_lib.ScalarVariable('R%s_3' % self.particle) 240 self.sub03 = aloha_lib.ScalarVariable('R%s_4' % self.particle) 241 242 self.sub10 = aloha_lib.ScalarVariable('R%s_5' % self.particle) 243 self.sub11 = aloha_lib.ScalarVariable('R%s_6' % self.particle) 244 self.sub12 = aloha_lib.ScalarVariable('R%s_7' % self.particle) 245 self.sub13 = aloha_lib.ScalarVariable('R%s_8' % self.particle) 246 247 self.sub20 = aloha_lib.ScalarVariable('R%s_9' % self.particle) 248 self.sub21 = aloha_lib.ScalarVariable('R%s_10' % self.particle) 249 self.sub22 = aloha_lib.ScalarVariable('R%s_11' % self.particle) 250 self.sub23 = aloha_lib.ScalarVariable('R%s_12' % self.particle) 251 252 self.sub30 = aloha_lib.ScalarVariable('R%s_13' % self.particle) 253 self.sub31 = aloha_lib.ScalarVariable('R%s_14' % self.particle) 254 self.sub32 = aloha_lib.ScalarVariable('R%s_15' % self.particle) 255 self.sub33 = aloha_lib.ScalarVariable('R%s_16' % self.particle) 256 257 rep = {(0,0): self.sub00, (0,1): self.sub01, (0,2): self.sub02, (0,3): self.sub03, 258 (1,0): self.sub10, (1,1): self.sub11, (1,2): self.sub12, (1,3): self.sub13, 259 (2,0): self.sub20, (2,1): self.sub21, (2,2): self.sub22, (2,3): self.sub23, 260 (3,0): self.sub30, (3,1): self.sub31, (3,2): self.sub32, (3,3): self.sub33} 261 262 263 self.representation= aloha_lib.LorentzObjectRepresentation( rep, \ 264 self.lorentz_ind, self.spin_ind)
265 266 267 #=============================================================================== 268 # Spin2 269 #===============================================================================
270 -class Spin2(aloha_lib.LorentzObject):
271 """ Helas Object for a Spin2""" 272
273 - def __init__(self, lorentz1, lorentz2, particle, prefactor=1):
274 275 self.particle = particle 276 if lorentz2 < lorentz1: 277 lorentz1, lorentz2 = lorentz2, lorentz1 278 279 aloha_lib.LorentzObject.__init__(self, [lorentz1, lorentz2], [], \ 280 prefactor=prefactor)
281
282 - def create_representation(self):
283 284 self.sub00 = aloha_lib.ScalarVariable('T%s_1' % self.particle) 285 self.sub01 = aloha_lib.ScalarVariable('T%s_2' % self.particle) 286 self.sub02 = aloha_lib.ScalarVariable('T%s_3' % self.particle) 287 self.sub03 = aloha_lib.ScalarVariable('T%s_4' % self.particle) 288 289 self.sub10 = aloha_lib.ScalarVariable('T%s_5' % self.particle) 290 self.sub11 = aloha_lib.ScalarVariable('T%s_6' % self.particle) 291 self.sub12 = aloha_lib.ScalarVariable('T%s_7' % self.particle) 292 self.sub13 = aloha_lib.ScalarVariable('T%s_8' % self.particle) 293 294 self.sub20 = aloha_lib.ScalarVariable('T%s_9' % self.particle) 295 self.sub21 = aloha_lib.ScalarVariable('T%s_10' % self.particle) 296 self.sub22 = aloha_lib.ScalarVariable('T%s_11' % self.particle) 297 self.sub23 = aloha_lib.ScalarVariable('T%s_12' % self.particle) 298 299 self.sub30 = aloha_lib.ScalarVariable('T%s_13' % self.particle) 300 self.sub31 = aloha_lib.ScalarVariable('T%s_14' % self.particle) 301 self.sub32 = aloha_lib.ScalarVariable('T%s_15' % self.particle) 302 self.sub33 = aloha_lib.ScalarVariable('T%s_16' % self.particle) 303 304 rep = {(0,0): self.sub00, (0,1): self.sub01, (0,2): self.sub02, (0,3): self.sub03, 305 (1,0): self.sub10, (1,1): self.sub11, (1,2): self.sub12, (1,3): self.sub13, 306 (2,0): self.sub20, (2,1): self.sub21, (2,2): self.sub22, (2,3): self.sub23, 307 (3,0): self.sub30, (3,1): self.sub31, (3,2): self.sub32, (3,3): self.sub33} 308 309 310 self.representation= aloha_lib.LorentzObjectRepresentation( rep, \ 311 self.lorentz_ind, [])
312 313 #=============================================================================== 314 # Gamma 315 #===============================================================================
316 -class Gamma(aloha_lib.LorentzObject):
317 """ Gamma Matrices """ 318 319 #gamma0 = [[0, 0, 1, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 1, 0, 0]] 320 #gamma1 = [[0, 0, 0, 1], [0, 0, 1, 0], [0, -1, 0, 0], [-1, 0, 0, 0]] 321 #gamma2 = [[0, 0, 0, -complex(0,1)],[0, 0, complex(0,1), 0], 322 # [0, complex(0,1), 0, 0], [-complex(0,1), 0, 0, 0]] 323 #gamma3 = [[0, 0, 1, 0], [0, 0, 0, -1], [-1, 0, 0, 0], [0, 1, 0, 0]] 324 # 325 #gamma = [gamma0, gamma1, gamma2, gamma3] 326 gamma = { #Gamma0 327 (0, 0, 0): 0, (0, 0, 1): 0, (0, 0, 2): 1, (0, 0, 3): 0, 328 (0, 1, 0): 0, (0, 1, 1): 0, (0, 1, 2): 0, (0, 1, 3): 1, 329 (0, 2, 0): 1, (0, 2, 1): 0, (0, 2, 2): 0, (0, 2, 3): 0, 330 (0, 3, 0): 0, (0, 3, 1): 1, (0, 3, 2): 0, (0, 3, 3): 0, 331 #Gamma1 332 (1, 0, 0): 0, (1, 0, 1): 0, (1, 0, 2): 0, (1, 0, 3): 1, 333 (1, 1, 0): 0, (1, 1, 1): 0, (1, 1, 2): 1, (1, 1, 3): 0, 334 (1, 2, 0): 0, (1, 2, 1): -1, (1, 2, 2): 0, (1, 2, 3): 0, 335 (1, 3, 0): -1, (1, 3, 1): 0, (1, 3, 2): 0, (1, 3, 3): 0, 336 #Gamma2 337 (2, 0, 0): 0, (2, 0, 1): 0, (2, 0, 2): 0, (2, 0, 3): -1j, 338 (2, 1, 0): 0, (2, 1, 1): 0, (2, 1, 2): 1j, (2, 1, 3): 0, 339 (2, 2, 0): 0, (2, 2, 1): 1j, (2, 2, 2): 0, (2, 2, 3): 0, 340 (2, 3, 0): -1j, (2, 3, 1): 0, (2, 3, 2): 0, (2, 3, 3): 0, 341 #Gamma3 342 (3, 0, 0): 0, (3, 0, 1): 0, (3, 0, 2): 1, (3, 0, 3): 0, 343 (3, 1, 0): 0, (3, 1, 1): 0, (3, 1, 2): 0, (3, 1, 3): -1, 344 (3, 2, 0): -1, (3, 2, 1): 0, (3, 2, 2): 0, (3, 2, 3): 0, 345 (3, 3, 0): 0, (3, 3, 1): 1, (3, 3, 2): 0, (3, 3, 3): 0 346 } 347 348 349 350 351
352 - def __init__(self, lorentz, spin1, spin2, prefactor=1):
353 aloha_lib.LorentzObject.__init__(self,[lorentz], [spin1, spin2], \ 354 prefactor=prefactor)
355
356 - def create_representation(self):
357 358 self.representation = aloha_lib.LorentzObjectRepresentation(self.gamma, 359 self.lorentz_ind,self.spin_ind)
360 361 #=============================================================================== 362 # Sigma 363 #===============================================================================
364 -class Sigma(aloha_lib.LorentzObject):
365 """ Sigma Matrices """ 366 367 368 369 #zero = [[0,0,0,0]]*4 370 #i = complex(0,1) 371 #sigma01 = [[ 0, -i, 0, 0], [-i, 0, 0, 0], [0, 0, 0, i], [0, 0, i, 0]] 372 #sigma02 = [[ 0, -1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, -1, 0]] 373 #sigma03 = [[-i, 0, 0, 0], [0, i, 0, 0], [0, 0, i, 0], [0, 0, 0, -i]] 374 #sigma12 = [[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, 1, 0], [0, 0, 0, -1]] 375 #sigma13 = [[0, i, 0, 0], [-i, 0, 0, 0], [0, 0, 0, i], [0, 0, -i, 0]] 376 #sigma23 = [[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]] 377 #def inv(matrice): 378 # out=[] 379 # for i in range(4): 380 # out2=[] 381 # out.append(out2) 382 # for j in range(4): 383 # out2.append(-1*matrice[i][j]) 384 # return out 385 # 386 #sigma =[[zero, sigma01, sigma02, sigma03], \ 387 # [inv(sigma01), zero, sigma12, sigma13],\ 388 # [inv(sigma02), inv(sigma12), zero, sigma23],\ 389 # [inv(sigma03), inv(sigma13), inv(sigma23), zero]] 390 391 sigma={(0, 2, 0, 1): -0.5, (3, 1, 2, 0): 0, (3, 2, 3, 1): 0, (1, 3, 1, 3): 0, 392 (2, 3, 3, 2): 0.5, (2, 1, 3, 1): 0, (0, 2, 2, 1): 0, (3, 1, 0, 0): 0, 393 (2, 3, 3, 1): 0, (3, 3, 1, 2): 0, (3, 1, 0, 3): 0, (1, 1, 0, 3): 0, 394 (0, 1, 2, 2): 0, (3, 2, 3, 2): -0.5, (2, 1, 0, 1): 0, (3, 3, 3, 3): 0, 395 (1, 1, 2, 2): 0, (2, 2, 3, 2): 0, (2, 1, 2, 1): 0, (0, 1, 0, 3): 0, 396 (2, 1, 2, 2): -0.5, (1, 2, 2, 1): 0, (2, 2, 1, 3): 0, (0, 3, 1, 3): 0, 397 (3, 0, 3, 2): 0, (1, 2, 0, 1): 0, (3, 0, 3, 1): 0, (0, 0, 2, 2): 0, 398 (1, 2, 0, 2): 0, (2, 0, 0, 3): 0, (0, 0, 2, 1): 0, (0, 3, 3, 2): 0, 399 (3, 0, 1, 1): -0.5j, (3, 2, 0, 1): -0.5, (1, 0, 1, 0): 0.5j, (0, 0, 0, 1): 0, 400 (0, 2, 1, 1): 0, (3, 1, 3, 2): 0.5j, (3, 2, 2, 1): 0, (1, 3, 2, 3): 0.5j, 401 (1, 0, 3, 0): 0, (3, 2, 2, 2): 0, (0, 2, 3, 1): 0, (1, 0, 3, 3): 0, 402 (2, 3, 2, 1): 0, (0, 2, 3, 2): -0.5, (3, 1, 1, 3): 0, (1, 1, 1, 3): 0, 403 (1, 3, 0, 2): 0, (2, 3, 0, 1): 0.5, (1, 1, 1, 0): 0, (2, 3, 0, 2): 0, 404 (3, 3, 0, 3): 0, (1, 1, 3, 0): 0, (0, 1, 3, 3): 0, (2, 2, 0, 1): 0, 405 (2, 1, 1, 0): 0, (3, 3, 2, 2): 0, (2, 3, 1, 0): 0.5, (2, 2, 2, 3): 0, 406 (0, 3, 0, 3): 0, (0, 1, 1, 2): 0, (0, 3, 0, 0): -0.5j, (2, 3, 1, 1): 0, 407 (1, 2, 3, 0): 0, (2, 0, 1, 3): 0, (0, 0, 3, 1): 0, (0, 3, 2, 0): 0, 408 (2, 3, 1, 2): 0, (2, 0, 1, 0): -0.5, (1, 2, 1, 0): 0, (3, 0, 0, 2): 0, 409 (1, 0, 0, 2): 0, (0, 0, 1, 1): 0, (1, 2, 1, 3): 0, (2, 3, 1, 3): 0, 410 (2, 0, 3, 0): 0, (0, 0, 1, 2): 0, (1, 3, 3, 3): 0, (3, 2, 1, 0): -0.5, 411 (1, 3, 3, 0): 0, (1, 0, 2, 3): -0.5j, (0, 2, 0, 0): 0, (3, 1, 2, 3): -0.5j, 412 (3, 2, 3, 0): 0, (1, 3, 1, 0): -0.5j, (3, 2, 3, 3): 0, (0, 2, 2, 0): 0, 413 (2, 3, 3, 0): 0, (3, 3, 1, 3): 0, (0, 2, 2, 3): 0.5, (3, 1, 0, 2): 0, 414 (1, 1, 0, 2): 0, (3, 3, 1, 0): 0, (0, 1, 2, 3): 0.5j, (1, 1, 0, 1): 0, 415 (2, 1, 0, 2): 0, (0, 1, 2, 0): 0, (3, 3, 3, 0): 0, (1, 1, 2, 1): 0, 416 (2, 2, 3, 3): 0, (0, 1, 0, 0): 0, (2, 2, 3, 0): 0, (2, 1, 2, 3): 0, 417 (1, 2, 2, 2): 0.5, (2, 2, 1, 0): 0, (0, 3, 1, 2): 0, (0, 3, 1, 1): 0.5j, 418 (3, 0, 3, 0): 0, (1, 2, 0, 3): 0, (2, 0, 0, 2): 0, (0, 0, 2, 0): 0, 419 (0, 3, 3, 1): 0, (3, 0, 1, 0): 0, (2, 0, 0, 1): 0.5, (3, 2, 0, 2): 0, 420 (3, 0, 1, 3): 0, (1, 0, 1, 3): 0, (0, 0, 0, 0): 0, (0, 2, 1, 2): 0, 421 (3, 1, 3, 3): 0, (0, 0, 0, 3): 0, (1, 3, 2, 2): 0, (3, 1, 3, 0): 0, 422 (3, 2, 2, 3): -0.5, (1, 3, 2, 1): 0, (1, 0, 3, 2): -0.5j, (2, 3, 2, 2): 0, 423 (0, 2, 3, 3): 0, (3, 1, 1, 0): 0.5j, (1, 3, 0, 1): 0.5j, (1, 1, 1, 1): 0, 424 (2, 1, 3, 2): 0, (2, 3, 0, 3): 0, (3, 3, 0, 2): 0, (1, 1, 3, 1): 0, 425 (3, 3, 0, 1): 0, (2, 1, 3, 3): 0.5, (0, 1, 3, 2): 0.5j, (1, 1, 3, 2): 0, 426 (2, 1, 1, 3): 0, (3, 0, 2, 1): 0, (0, 1, 3, 1): 0, (3, 3, 2, 1): 0, 427 (2, 2, 2, 2): 0, (0, 1, 1, 1): 0, (2, 2, 2, 1): 0, (0, 3, 0, 1): 0, 428 (3, 0, 2, 2): -0.5j, (1, 2, 3, 3): -0.5, (0, 0, 3, 2): 0, (0, 3, 2, 1): 0, 429 (2, 0, 1, 1): 0, (2, 2, 0, 0): 0, (0, 3, 2, 2): 0.5j, (3, 0, 0, 3): 0, 430 (1, 0, 0, 3): 0, (1, 2, 1, 2): 0, (2, 0, 3, 1): 0, (1, 0, 0, 0): 0, 431 (0, 0, 1, 3): 0, (2, 0, 3, 2): 0.5, (3, 2, 1, 3): 0, (1, 3, 3, 1): 0, 432 (1, 0, 2, 0): 0, (2, 2, 0, 2): 0, (0, 2, 0, 3): 0, (3, 1, 2, 2): 0, 433 (1, 3, 1, 1): 0, (3, 1, 2, 1): 0, (2, 2, 0, 3): 0, (3, 0, 0, 1): 0, 434 (1, 3, 1, 2): 0, (2, 3, 3, 3): 0, (0, 2, 2, 2): 0, (3, 1, 0, 1): -0.5j, 435 (3, 3, 1, 1): 0, (1, 1, 0, 0): 0, (2, 1, 0, 3): 0, (0, 1, 2, 1): 0, 436 (3, 3, 3, 1): 0, (2, 1, 0, 0): -0.5, (1, 1, 2, 0): 0, (3, 3, 3, 2): 0, 437 (0, 1, 0, 1): -0.5j, (1, 1, 2, 3): 0, (2, 2, 3, 1): 0, (2, 1, 2, 0): 0, 438 (0, 1, 0, 2): 0, (1, 2, 2, 3): 0, (2, 0, 2, 1): 0, (2, 2, 1, 1): 0, 439 (1, 2, 2, 0): 0, (2, 2, 1, 2): 0, (0, 3, 1, 0): 0, (3, 0, 3, 3): 0.5j, 440 (2, 1, 3, 0): 0, (1, 2, 0, 0): 0.5, (0, 0, 2, 3): 0, (0, 3, 3, 0): 0, 441 (2, 0, 0, 0): 0, (3, 2, 0, 3): 0, (0, 3, 3, 3): -0.5j, (3, 0, 1, 2): 0, 442 (1, 0, 1, 2): 0, (3, 2, 0, 0): 0, (0, 2, 1, 3): 0, (1, 0, 1, 1): 0, 443 (0, 0, 0, 2): 0, (0, 2, 1, 0): 0.5, (3, 1, 3, 1): 0, (3, 2, 2, 0): 0, 444 (1, 3, 2, 0): 0, (1, 0, 3, 1): 0, (2, 3, 2, 3): 0.5, (0, 2, 3, 0): 0, 445 (3, 1, 1, 1): 0, (2, 3, 2, 0): 0, (1, 3, 0, 0): 0, (3, 1, 1, 2): 0, 446 (1, 1, 1, 2): 0, (1, 3, 0, 3): 0, (2, 3, 0, 0): 0, (2, 0, 2, 0): 0, 447 (3, 3, 0, 0): 0, (1, 1, 3, 3): 0, (2, 1, 1, 2): 0, (0, 1, 3, 0): 0, 448 (3, 3, 2, 0): 0, (2, 1, 1, 1): 0.5, (2, 0, 2, 2): 0, (3, 3, 2, 3): 0, 449 (0, 1, 1, 0): -0.5j, (2, 2, 2, 0): 0, (0, 3, 0, 2): 0, (3, 0, 2, 3): 0, 450 (0, 1, 1, 3): 0, (2, 0, 2, 3): -0.5, (1, 2, 3, 2): 0, (3, 0, 2, 0): 0, 451 (0, 0, 3, 3): 0, (1, 2, 3, 1): 0, (2, 0, 1, 2): 0, (0, 0, 3, 0): 0, 452 (0, 3, 2, 3): 0, (3, 0, 0, 0): 0.5j, (1, 2, 1, 1): -0.5, (1, 0, 0, 1): 0.5j, 453 (0, 0, 1, 0): 0, (2, 0, 3, 3): 0, (3, 2, 1, 2): 0, (1, 3, 3, 2): -0.5j, 454 (1, 0, 2, 1): 0, (3, 2, 1, 1): 0, (0, 2, 0, 2): 0, (1, 0, 2, 2): 0} 455
456 - def __init__(self, lorentz1, lorentz2, spin1, spin2, prefactor=1):
457 if lorentz1 < lorentz2: 458 aloha_lib.LorentzObject.__init__(self,[lorentz1, lorentz2], \ 459 [spin1, spin2], prefactor=prefactor) 460 else: 461 aloha_lib.LorentzObject.__init__(self,[lorentz2, lorentz1], 462 [spin1, spin2], prefactor=-prefactor)
463
464 - def create_representation(self):
465 466 self.representation = aloha_lib.LorentzObjectRepresentation(self.sigma, 467 self.lorentz_ind,self.spin_ind)
468 469 #=============================================================================== 470 # Gamma5 471 #===============================================================================
472 -class Gamma5(aloha_lib.LorentzObject):
473 474 #gamma5 = [[-1, 0, 0, 0, 0], [0, -1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] 475 gamma5 = {(0,0): -1, (0,1): 0, (0,2): 0, (0,3): 0,\ 476 (1,0): 0, (1,1): -1, (1,2): 0, (1,3): 0,\ 477 (2,0): 0, (2,1): 0, (2,2): 1, (2,3): 0,\ 478 (3,0): 0, (3,1): 0, (3,2): 0, (3,3): 1} 479
480 - def __init__(self, spin1, spin2, prefactor=1):
481 if spin1 > spin2: 482 aloha_lib.LorentzObject.__init__(self,[], [spin1, spin2], prefactor) 483 else: 484 aloha_lib.LorentzObject.__init__(self,[], [spin2, spin1], prefactor)
485
486 - def create_representation(self):
487 488 self.representation = aloha_lib.LorentzObjectRepresentation(self.gamma5, 489 self.lorentz_ind,self.spin_ind)
490 491 #=============================================================================== 492 # Conjugate Matrices 493 #===============================================================================
494 -class C(aloha_lib.LorentzObject):
495 496 #[0, -1, 0, 0] [1,0,0,0] [0,0,0,1],[0,0,-1,0] 497 498 Cmetrix = {(0,0): 0, (0,1): -1, (0,2): 0, (0,3): 0,\ 499 (1,0): 1, (1,1): 0, (1,2): 0, (1,3): 0,\ 500 (2,0): 0, (2,1): 0, (2,2): 0, (2,3): 1,\ 501 (3,0): 0, (3,1): 0, (3,2): -1, (3,3): 0} 502
503 - def __init__(self, spin1, spin2, prefactor=1):
504 #antisymmetric 505 if spin1 < spin2: 506 aloha_lib.LorentzObject.__init__(self,[], [spin1, spin2], prefactor) 507 else: 508 aloha_lib.LorentzObject.__init__(self,[], [spin2, spin1], -1*prefactor)
509
510 - def create_representation(self):
511 self.representation = aloha_lib.LorentzObjectRepresentation(self.Cmetrix, 512 self.lorentz_ind,self.spin_ind)
513 514 515 516 #=============================================================================== 517 # EPSILON 518 #=============================================================================== 519 #Helpfull function
520 -def give_sign_perm(perm0, perm1):
521 """Check if 2 permutations are of equal parity. 522 523 Assume that both permutation lists are of equal length 524 and have the same elements. No need to check for these 525 conditions. 526 """ 527 assert len(perm0) == len(perm1) 528 529 perm1 = list(perm1) ## copy this into a list so we don't mutate the original 530 perm1_map = dict((v, i) for i,v in enumerate(perm1)) 531 532 transCount = 0 533 for loc, p0 in enumerate(perm0): 534 p1 = perm1[loc] 535 if p0 != p1: 536 sloc = perm1_map[p0] # Find position in perm1 537 perm1[loc], perm1[sloc] = p0, p1 # Swap in perm1 538 perm1_map[p0], perm1_map[p1] = loc, sloc # Swap the map 539 transCount += 1 540 541 # Even number of transposition means equal parity 542 return -2 * (transCount % 2) + 1
543 544 # Practical definition of Epsilon
545 -class Epsilon(aloha_lib.LorentzObject):
546 """ The fully anti-symmetric object in Lorentz-Space """ 547
548 - def give_parity(self, perm):
549 """return the parity of the permutation""" 550 assert set(perm) == set([0,1,2,3]) 551 552 i1 , i2, i3, i4 = perm 553 #formula found on wikipedia 554 return -1 * ((i2-i1) * (i3-i1) *(i4-i1) * (i3-i2) * (i4-i2) *(i4-i3))/12
555 556 # DEFINE THE REPRESENTATION OF EPSILON 557
558 - def __init__(self, lorentz1, lorentz2, lorentz3, lorentz4, prefactor=1):
559 560 lorentz_list = [lorentz1 , lorentz2, lorentz3, lorentz4] 561 order_lor = list(lorentz_list) 562 order_lor.sort() 563 564 sign = give_sign_perm(order_lor, lorentz_list) 565 566 aloha_lib.LorentzObject.__init__(self, order_lor, \ 567 [], prefactor=sign * prefactor)
568 569
570 - def create_representation(self):
571 572 if not hasattr(self, 'epsilon'): 573 # init all element to zero 574 epsilon = dict( ((l1, l2, l3, l4), 0) 575 for l1 in range(4) \ 576 for l2 in range(4) \ 577 for l3 in range(4) \ 578 for l4 in range(4)) 579 # update non trivial one 580 epsilon.update(dict( 581 ((l1, l2, l3, l4), self.give_parity((l1,l2,l3,l4))) 582 for l1 in range(4) \ 583 for l2 in range(4) if l2 != l1\ 584 for l3 in range(4) if l3 not in [l1,l2]\ 585 for l4 in range(4) if l4 not in [l1,l2,l3])) 586 587 Epsilon.epsilon = epsilon 588 589 590 591 self.representation = aloha_lib.LorentzObjectRepresentation(self.epsilon, 592 self.lorentz_ind,self.spin_ind)
593 594 595 596 #=============================================================================== 597 # Metric 598 #===============================================================================
599 -class Metric(aloha_lib.LorentzObject):
600 601 metric = {(0,0): 1, (0,1): 0, (0,2): 0, (0,3): 0,\ 602 (1,0): 0, (1,1): -1, (1,2): 0, (1,3): 0,\ 603 (2,0): 0, (2,1): 0, (2,2): -1, (2,3): 0,\ 604 (3,0): 0, (3,1): 0, (3,2): 0, (3,3): -1} 605 606 607 #[[1, 0, 0,0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, -1]] 608
609 - def __init__(self, lorentz1, lorentz2, prefactor=1):
610 if lorentz1 < lorentz2: 611 aloha_lib.LorentzObject.__init__(self,[lorentz1, lorentz2], [], prefactor) 612 else: 613 aloha_lib.LorentzObject.__init__(self,[lorentz2, lorentz1], [], prefactor)
614
615 - def create_representation(self):
616 617 self.representation = aloha_lib.LorentzObjectRepresentation(self.metric, 618 self.lorentz_ind,self.spin_ind)
619
620 - def expand(self):
621 """Expand the content information. We overload the basic rules in order 622 to avoid the computation of Metric(1,2) * Metric(1,2) = 4""" 623 624 if self.power == 2: 625 return aloha_lib.ConstantObject(4) 626 else: 627 try: 628 return self.prefactor * self.representation 629 except: 630 self.create_representation() 631 return self.prefactor * self.representation
632
633 - def simplify(self):
634 """Return the Denominator in a abstract way""" 635 636 if self.power == 2: 637 return aloha_lib.ConstantObject(4) 638 else: 639 return self
640 641 642 643 #=============================================================================== 644 # Identity 645 #===============================================================================
646 -class Identity(aloha_lib.LorentzObject):
647 648 #identity = [[1, 0, 0,0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] 649 identity = {(0,0): 1, (0,1): 0, (0,2): 0, (0,3): 0,\ 650 (1,0): 0, (1,1): 1, (1,2): 0, (1,3): 0,\ 651 (2,0): 0, (2,1): 0, (2,2): 1, (2,3): 0,\ 652 (3,0): 0, (3,1): 0, (3,2): 0, (3,3): 1} 653
654 - def __init__(self, spin1, spin2, prefactor=1):
655 if spin1 < spin2: 656 aloha_lib.LorentzObject.__init__(self,[],[spin1, spin2], prefactor) 657 else: 658 aloha_lib.LorentzObject.__init__(self,[],[spin2, spin1], prefactor)
659
660 - def create_representation(self):
661 662 self.representation = aloha_lib.LorentzObjectRepresentation(self.identity, 663 self.lorentz_ind,self.spin_ind)
664 ##=============================================================================== 665 ## IdentityL (Commented since not use) 666 ##=============================================================================== 667 #class IdentityL(aloha_lib.LorentzObject): 668 # 669 # identity = [[1, 0, 0,0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] 670 # 671 # def __init__(self, lorentz1, lorentz2, prefactor=1): 672 # if lorentz1 < lorentz2: 673 # aloha_lib.LorentzObject.__init__(self,[lorentz1, lorentz2], []) 674 # else: 675 # aloha_lib.LorentzObject.__init__(self,[lorentz1, lorentz2], []) 676 # 677 # def create_representation(self): 678 # 679 # self.representation = aloha_lib.LorentzObjectRepresentation(self.identity, 680 # self.lorentz_ind,self.spin_ind) 681 # 682 #=============================================================================== 683 # ProjM 684 #===============================================================================
685 -class ProjM(aloha_lib.LorentzObject):
686 """ A object for (1-gamma5)/2 """ 687 688 #projm = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] 689 projm= {(0,0): 1, (0,1): 0, (0,2): 0, (0,3): 0,\ 690 (1,0): 0, (1,1): 1, (1,2): 0, (1,3): 0,\ 691 (2,0): 0, (2,1): 0, (2,2): 0, (2,3): 0,\ 692 (3,0): 0, (3,1): 0, (3,2): 0, (3,3): 0} 693
694 - def __init__(self,spin1, spin2, prefactor=1):
695 """Initialize the object""" 696 if spin1 < spin2: 697 aloha_lib.LorentzObject.__init__(self,[], [spin1, spin2], prefactor) 698 else: 699 aloha_lib.LorentzObject.__init__(self,[], [spin2, spin1], prefactor)
700 701
702 - def create_representation(self):
703 704 self.representation = aloha_lib.LorentzObjectRepresentation(self.projm, 705 self.lorentz_ind,self.spin_ind)
706 707 708 #=============================================================================== 709 # ProjP 710 #===============================================================================
711 -class ProjP(aloha_lib.LorentzObject):
712 """A object for (1+gamma5)/2 """ 713 714 #projp = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] 715 projp = {(0,0): 0, (0,1): 0, (0,2): 0, (0,3): 0,\ 716 (1,0): 0, (1,1): 0, (1,2): 0, (1,3): 0,\ 717 (2,0): 0, (2,1): 0, (2,2): 1, (2,3): 0,\ 718 (3,0): 0, (3,1): 0, (3,2): 0, (3,3): 1} 719
720 - def __init__(self,spin1, spin2, prefactor=1):
721 """Initialize the object""" 722 if spin1 < spin2: 723 aloha_lib.LorentzObject.__init__(self,[], [spin1, spin2], prefactor) 724 else: 725 aloha_lib.LorentzObject.__init__(self,[], [spin2, spin1], prefactor)
726 727
728 - def create_representation(self):
729 730 self.representation = aloha_lib.LorentzObjectRepresentation(self.projp, 731 self.lorentz_ind, self.spin_ind)
732 733 #=============================================================================== 734 # Denominator Propagator 735 #===============================================================================
736 -class DenominatorPropagator(aloha_lib.LorentzObject):
737 """The Denominator of the Propagator""" 738
739 - def __init__(self, particle, prefactor=1):
740 """Initialize the object""" 741 742 self.particle = particle 743 tag=['P%s' % particle] 744 aloha_lib.LorentzObject.__init__(self, [], [], prefactor, tag)
745
746 - def simplify(self):
747 """Return the Denominator in a abstract way""" 748 749 mass = Mass(self.particle) 750 width = Width(self.particle) 751 denominator = P('i1', self.particle) * P('i1', self.particle) - \ 752 mass * mass + complex(0,1) * mass* width 753 754 return denominator
755
756 - def create_representation(self):
757 """Create the representation for the Vector propagator""" 758 759 object = self.simplify() 760 self.representation = object.expand()
761 762 763 764 #=============================================================================== 765 # Numerator Propagator 766 #=============================================================================== 767 768 769 SpinorPropagator = lambda spin1, spin2, particle: complex(0,1) * (Gamma('mu', spin1, spin2) * \ 770 P('mu', particle) + Mass(particle) * Identity(spin1, spin2)) 771 772 VectorPropagator = lambda l1, l2, part: complex(0,1) * (-1 * Metric(l1, l2) + OverMass2(part) * \ 773 Metric(l1,'I3')* P('I3', part) * P(l2, part)) 774 775 #Spin3halfPropagator = lambda mu, nu, s1, s2, part: -1*( Gamma(-1,s1,s2)*P(-1,part) + Identity(s1,s2)*Mass(part)) * (Metric(mu,nu)-Metric(mu,'I3')*P('I3',part)*P(nu,part)*OverMass2(part)) \ 776 # - 1/3 * (Gamma(mu,s1,-2) + Identity(s1, -2) * P(mu, part) * Mass(part) * OverMass2(part))* \ 777 # (Gamma('alpha',-2,-3) * P('alpha', part) - Identity(-2,-3) * Mass(part)) \ 778 # * (Gamma(nu, -3, s2) + Identity(-3, s2) * P(nu, part) * Mass(part) * OverMass2(part) ) \ 779 # -1*( Gamma(-1,s1,s2)*P(-1,part) + Identity(s1,s2)*Mass(part)) * (Metric(mu,nu)-Metric(mu,'I3')*P('I3',part)*P(nu,part)*OverMass2(part)) \ 780 781 Spin3halfPropagator = lambda mu, nu, s1, s2, part: - 1/3 * (Gamma(mu,s1,-2) + Identity(s1, -2) * P(mu, part) * Mass(part) * OverMass2(part))* \ 782 (PSlash(-2,-3, part) - Identity(-2,-3) * Mass(part)) * \ 783 ( Gamma(nu, -3, s2)+ Mass(part) * OverMass2(part) * Identity(-3, s2) * P(nu, part) ) 784 785 Spin3halfPropagator = lambda mu, nu, s1, s2, part: - 1/3 * (Gamma(mu,s1,-2) + Identity(s1, -2) * P(mu, part) * Mass(part) * OverMass2(part))* \ 786 (PSlash(-2,-3, part) - Identity(-2,-3) * Mass(part)) * \ 787 ( Gamma(nu, -3, s2)+ Mass(part) * OverMass2(part) * Identity(-3, s2) * P(nu, part) ) 788 789 790 Spin2masslessPropagator = lambda mu, nu, alpha, beta: complex(0,1/2)*( Metric(mu, alpha)* Metric(nu, beta) +\ 791 Metric(mu, beta) * Metric(nu, alpha) - Metric(mu, nu) * Metric(alpha, beta)) 792 793 794 795 Spin2Propagator = lambda mu, nu, alpha, beta, part: Spin2masslessPropagator(mu, nu, alpha, beta) + \ 796 -complex(0, 1/2) * OverMass2(part) * (Metric(mu,alpha)* P(nu, part) * P(beta, part) + \ 797 Metric(nu, beta) * P(mu, part) * P(alpha, part) + \ 798 Metric(mu, beta) * P(nu, part) * P(alpha, part) + \ 799 Metric(nu, alpha) * P(mu, part) * P(beta , part) )+ \ 800 complex(0, 1/6) * (Metric(mu,nu) + 2 * OverMass2(part) * P(mu, part) * P(nu, part)) * \ 801 (Metric(alpha,beta) + 2 * OverMass2(part) * P(alpha, part) * P(beta, part)) 802