44
44
import madgraph.core.drawing as draw
45
45
import madgraph.core.base_objects as base_objects
46
46
import madgraph.loop.loop_base_objects as loop_objects
49
logger = logging.getLogger('madgraph.drawing_eps')
48
51
_file_path = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] + '/'
203
#add the code in the correct format
204
self.text += self.line_format(line.begin.pos_x, line.begin.pos_y,
206
is_tadpole = line.begin.pos_x==line.end.pos_x and \
207
line.begin.pos_y==line.end.pos_y
210
# Obtain the direction of the propagator supporting the tadpole
212
for l in line.begin.lines:
213
new_direction = (l.end.pos_x-l.begin.pos_x, l.end.pos_y-l.begin.pos_y)
214
if new_direction==(0.0,0.0):
216
norm = math.sqrt(new_direction[0]**2+new_direction[1]**2)
217
new_direction = (new_direction[0]/norm, new_direction[1]/norm)
220
direction = new_direction
222
if direction not in \
223
[new_direction, (-new_direction[0],-new_direction[1])]:
225
# logger.debug('The case of a five-point vertex'+
226
# 'yielding a tadpole is not supported')
229
#add the code in the correct format
230
self.text += self.line_format(line.begin.pos_x, line.begin.pos_y,
231
line.end.pos_x+0.01*direction[0], line.end.pos_y+0.01*direction[1],
232
'%s Ffermionl' % (curvature*7))
234
#add the code in the correct format
235
self.text += self.line_format(line.begin.pos_x, line.begin.pos_y,
205
236
line.end.pos_x+0.01, line.end.pos_y+0.01, '%s Ffermionl' %\
207
238
def draw_dashed(self, line):
222
#add the code in the correct format
223
self.text += self.line_format(line.begin.pos_x, line.begin.pos_y,
253
is_tadpole = line.begin.pos_x==line.end.pos_x and \
254
line.begin.pos_y==line.end.pos_y
257
# Obtain the direction of the propagator supporting the tadpole
259
for l in line.begin.lines:
260
new_direction = (l.end.pos_x-l.begin.pos_x, l.end.pos_y-l.begin.pos_y)
261
if new_direction==(0.0,0.0):
263
norm = math.sqrt(new_direction[0]**2+new_direction[1]**2)
264
new_direction = (new_direction[0]/norm, new_direction[1]/norm)
267
direction = new_direction
269
if direction not in \
270
[new_direction, (-new_direction[0],-new_direction[1])]:
271
# logger.error('The case of a five-point vertex'+
272
# 'yielding a tadpole is not supported')
275
#add the code in the correct format
276
x, y = self.rescale(line.begin.pos_x, line.begin.pos_y)
277
self.text += '%s %s moveto'%(x, y)
278
self.text += self.line_format(line.begin.pos_x, line.begin.pos_y,
279
line.end.pos_x+0.01*direction[0], line.end.pos_y+0.01*direction[1],
280
'%s Fhiggsl' % (curvature*7))
282
#add the code in the correct format
283
self.text += self.line_format(line.begin.pos_x, line.begin.pos_y,
224
284
line.end.pos_x+0.01, line.end.pos_y+0.01, '%s Fhiggsl'% curvature)
226
286
def draw_dotted(self,line):
253
#add the code in the correct format
254
self.text += self.line_format(line.begin.pos_x, line.begin.pos_y,\
313
is_tadpole = line.begin.pos_x==line.end.pos_x and \
314
line.begin.pos_y==line.end.pos_y
317
# Obtain the direction of the propagator supporting the tadpole
319
for l in line.begin.lines:
320
new_direction = (l.end.pos_x-l.begin.pos_x, l.end.pos_y-l.begin.pos_y)
321
if new_direction==(0.0,0.0):
323
norm = math.sqrt(new_direction[0]**2+new_direction[1]**2)
324
new_direction = (new_direction[0]/norm, new_direction[1]/norm)
327
direction = new_direction
329
if direction not in \
330
[new_direction, (-new_direction[0],-new_direction[1])]:
331
# logger.error('The case of a five-point vertex'+
332
# 'yielding a tadpole is not supported')
335
#add the code in the correct format
336
self.text += self.line_format(line.begin.pos_x, line.begin.pos_y,
337
line.end.pos_x+0.01*direction[0], line.end.pos_y+0.01*direction[1],
338
'%s Fghostl' % (curvature*7))
340
#add the code in the correct format
341
self.text += self.line_format(line.begin.pos_x, line.begin.pos_y,\
255
342
line.end.pos_x+0.01, line.end.pos_y+0.01, '%s Fghostl'% curvature)
257
344
def draw_wavy(self, line, opt=0, type=''):
276
363
def draw_circled_wavy(self, line, cercle, opt=0, type=''):
277
364
"""ADD the EPS code for this photon line."""
371
is_tadpole = line.begin.pos_x==line.end.pos_x and \
372
line.begin.pos_y==line.end.pos_y
375
# Obtain the direction of the propagator supporting the tadpole
377
for l in line.begin.lines:
378
new_direction = (l.end.pos_x-l.begin.pos_x, l.end.pos_y-l.begin.pos_y)
379
if new_direction==(0.0,0.0):
381
norm = math.sqrt(new_direction[0]**2+new_direction[1]**2)
382
new_direction = (new_direction[0]/norm, new_direction[1]/norm)
283
#add the code in the correct format
284
self.text += self.line_format(line.begin.pos_x, line.begin.pos_y,
285
line.end.pos_x+0.01, line.end.pos_y+0.01, '%d %s Fphotonl%s' % (opt,curvature,type))
385
direction = new_direction
387
if direction not in \
388
[new_direction, (-new_direction[0],-new_direction[1])]:
389
# logger.error('The case of a five-point vertex'+
390
# 'yielding a tadpole is not supported')
393
#add the code in the correct format
394
self.text += self.line_format(line.begin.pos_x, line.begin.pos_y,
395
line.end.pos_x+0.01*direction[0], line.end.pos_y+0.01*direction[1],
396
'%d %s Fphotonl%s' % (opt,curvature*7,type))
398
#add the code in the correct format
399
self.text += self.line_format(line.begin.pos_x, line.begin.pos_y,
400
line.end.pos_x+0.01, line.end.pos_y+0.01,
401
'%d %s Fphotonl%s' % (opt,curvature,type))
287
403
def draw_curly(self, line, type=''):
288
404
"""ADD the EPS code for this gluon line."""
423
539
to the center of the line.
542
is_tadpole = line.begin.pos_x==line.end.pos_x and \
543
line.begin.pos_y==line.end.pos_y
545
# Obtain the direction of the propagator supporting the tadpole
547
for l in line.begin.lines:
548
new_direction = (l.end.pos_x-l.begin.pos_x, l.end.pos_y-l.begin.pos_y)
549
if new_direction==(0.0,0.0):
551
norm = math.sqrt(new_direction[0]**2+new_direction[1]**2)
552
new_direction = (new_direction[0]/norm, new_direction[1]/norm)
555
direction = new_direction
557
if direction not in \
558
[new_direction, (-new_direction[0],-new_direction[1])]:
559
# logger.error('The case of a five-point vertex'+
560
# 'yielding a tadpole is not supported')
563
# Compute the orthogonal the
564
orthogonal = (-direction[1],direction[0])
426
566
# Put alias for vertex positions
427
567
x1, y1 = line.begin.pos_x, line.begin.pos_y
428
568
x2, y2 = line.end.pos_x, line.end.pos_y
430
570
d = line.get_length()
573
dx, dy = scale*orthogonal[0], scale*orthogonal[1]
432
574
# compute gap from middle point
433
if abs(x1 - x2) < 1e-3:
575
elif abs(x1 - x2) < 1e-3:
436
578
elif abs(y1 - y2) < 1e-3:
646
788
self.text += ' 525 770 moveto\n'
647
789
self.text += ' (page %s/%s) show\n' % (self.curr_page + 1, self.npage)
648
790
self.text += ' 260 40 moveto\n'
649
self.text += ' (Diagrams made by MadGraph5) show\n'
791
self.text += ' (Diagrams made by MadGraph5_aMC@NLO) show\n'