Package madgraph :: Package core :: Module drawing :: Class FeynmanDiagram
[hide private]
[frames] | no frames]

Class FeynmanDiagram

source code

Known Subclasses:

Object to compute the position of the different Vertex and Line associate
to a diagram object.

This is the standard way to doing it [main]
1) Creates the new structure needed for the diagram generation [load_diagram]
    This defines self.vertexList and self.lineList which are the list of     
    respectively all the vertex and all the line include in the diagram.
    Each line is associated to two vertex, so we have added new vertex
    compare to the diagram object (base_objects.Diagram). The two vertex are 
    named begin/end and represent the line direction. at this stage all line
    are going timelike. T-channel are going from particle 1 to particle 2
2) Associate to each vertex a level. [define_level]
    The level represents the distance between the initial vertex and the 
    current vertex. This distance is define has the number of non T-channel 
    particles needed to connect this particles to a initial state starting
    point.
3) Compute the position of each vertex [find_initial_vertex_position]
    The x-coordinate will proportional to the level. The vertex at level=0.
    will have x=0 coordinate (vertex associate with initial state particle)
    The vertex with the highest level value should be at x=1.
    
    If an external particles cann't be place at the border at the current 
    level. we will try to place it one level later, potentially up to last
    level. A option can force to place all external particles at x=1.
    
    the y-coordinate are chosen such that 
        - external particles try to have (y=0 or y=1) coordinates
            (if not move those vertex to next level)
        - other particles maximizes distances between themselves.
4) Solve Fermion-flow and (anti)particle type [self.solve_line_direction]
    the way to solve the fermion-flow is basic and fail in general for
    majorana fermion. The basic idea is "particles are going timelike".
    This is sufficient in all cases but T-channel particles which are solve 
    separately.

Nested Classes [hide private]
  FeynamDiagramError
Class for internal error.
Instance Methods [hide private]
 
__init__(self, diagram, model, amplitude=False, opt=None)
Store the information concerning this diagram.
source code
 
main(self)
This routine will compute all the vertex position and line orientation needed to draw the diagram.
source code
 
load_diagram(self, contract=True)
Define all the object for the Feynman Diagram Drawing (Vertex and Line) following the data include in 'self.diagram' 'contract' defines if we contract to one point the non propagating line.
source code
 
find_leg_id(self, leg, equal=0, end=0)
Find the position of leg in self._treated_legs
source code
 
find_leg_id2(self, leg, end=0)
Find the position of leg in self._treated_legs.
source code
 
find_leg_id3(self, gen_id)
Find the position of leg in self._treated_legs but only if this b belongs to an available particles
source code
 
load_vertex(self, vertex)
1) Extend the vertex to a VertexPoint.
source code
 
load_leg(self, leg)
Extend the leg to Feynman line.
source code
 
deal_last_line(self, last_line)
The line of the last vertex breaks the rules that line before '>' exist previously and the one after don't.
source code
 
_fuse_non_propa_particule(self)
Fuse all the non propagating line step: 1) find those line 2) fuse the vertex 3) remove one vertex from self.vertexList 4) remove the line/leg from self.lineList/self._treated_leg
source code
 
define_level(self)
Assign to each vertex a level: the level correspond to the number of visible particles and S-channel needed in order to reach the initial particles vertex.
source code
 
def_next_level_from(self, vertex)
Define level for adjacent vertex.
source code
 
find_t_channel_vertex(self)
Returns the vertex (T-vertex authorize) associate to level 1.
source code
 
find_next_t_channel_vertex(self, t_vertex)
Returns the next t_vertex.
source code
 
find_vertex_at_level(self, previous_level)
Returns a list of vertex such that all those vertex are one level after the level of vertexlist and sorted in such way that the list start with vertex connected with the first vertex of 'vertexlist' then those connected to the second and so on.
source code
 
find_initial_vertex_position(self)
Find a position to each vertex.
source code
 
find_vertex_position_tchannel(self)
Finds the vertex position for level one, T channel are authorize
source code
 
find_vertex_position_at_level(self, vertexlist, level, auto=True)
Finds the vertex position for the particle at 'level' given the ordering at previous level given by the vertexlist.
source code
 
assign_pos(self, vertex_at_level, level, min=0, max=1)
Assign the position to each vertex of vertex_at_level.
source code
 
define_vertex_at_border(self, vertex, level, pos_y)
Define the position of the vertex considering the distance required in the Drawing Options.
source code
 
remove_t_channel(self)
Removes all T-channel in a diagram and convert those in S-channel.
source code
 
solve_line_direction(self)
Computes the directions of the lines of the diagrams.
source code
 
adjust_position(self)
Modify the position of some particles in order to improve the final diagram look.
source code
 
_debug_load_diagram(self)
Return a string to check to conversion of format for the diagram.
source code
 
_debug_level(self, text=1)
Returns a string to check the level of each vertex.
source code
 
_debug_position(self)
Returns a string to check the position of each vertex.
source code
 
_debug_has_intersection(self)
Returns if some line cross are crossing each other.
source code
 
__eq__(self, other)
Check if two diagrams are equivalent.
source code
Class Variables [hide private]
  fake_vertex = ...
Method Details [hide private]

__init__(self, diagram, model, amplitude=False, opt=None)
(Constructor)

source code 

Store the information concerning this diagram. This routines didn't perform any action at all. diagram: The diagram object to draw model: The model associate to the diagram amplitude: tell if the diagram has already fixed the I/O state of the fermion opt: A DrawingOpt instance with all options for drawing the diagram.

find_leg_id(self, leg, equal=0, end=0)

source code 

Find the position of leg in self._treated_legs

if equal=0 returns the last position of number in the list otherwise check that leg is the item in self._treated_legs

the two methods provides the same result if they provide a result. But some times equal=0 mode provides result when equal=1 doesn't. To my understanding equal=1 is suppose to be sufficient in all cases but gg> 7x( g ) fails with using equal=1 only.

'end' removes the last 'end' element of the list, before looking at the id in the list. (the list is not modify)

find_leg_id2(self, leg, end=0)

source code 

Find the position of leg in self._treated_legs. Use object equality to find the position.

load_vertex(self, vertex)

source code 
1) Extend the vertex to a VertexPoint. 
2) Add this vertex in vertexList of the diagram
3) Update vertex.lines list. (first update the leg into line if needed)
4) assign line.start[end] to this vertex. (in end if start is already
        assigned to another vertex). the start-end will be flip later
        if needed.
5) if the fermion flow is correctly set by the diagram (amplitude=True)
   Then change the particles/anti-particles states accordingly.

load_leg(self, leg)

source code 

Extend the leg to Feynman line. Associate the line to the diagram.

deal_last_line(self, last_line)

source code 

The line of the last vertex breaks the rules that line before '>' exist previously and the one after don't. The last one can also already exist and for the one before the '>' sometimes they arrive with a second object which is equivalent to another one but not the same object. discover those case and treat this properly.

define_level(self)

source code 

Assign to each vertex a level: the level correspond to the number of visible particles and S-channel needed in order to reach the initial particles vertex.

This is computing by search level by level starting at level 0.

def_next_level_from(self, vertex)

source code 

Define level for adjacent vertex. If those vertex is already defined do nothing Otherwise define as level+1 (at level 1 if T-channel)

This routine defines also self.max_level.

This routine is foreseen for an auto-recursive mode. So as soon as a vertex have his level defined. We launch this routine for this vertex.

find_t_channel_vertex(self)

source code 

Returns the vertex (T-vertex authorize) associate to level 1. We start with the vertex associate to first entry of previous_level and then following the T-line.

find_next_t_channel_vertex(self, t_vertex)

source code 

Returns the next t_vertex. i.e. the vertex following t_vertex. t_line indicates the 'wrong' T-direction. This routines returns also the 'good' evolution direction (which will be the wrong one at the next step).

find_initial_vertex_position(self)

source code 

Find a position to each vertex. All the vertex with the same level will have the same x coordinate. All external particles will be on the border of the square.

find_vertex_position_at_level(self, vertexlist, level, auto=True)

source code 

Finds the vertex position for the particle at 'level' given the ordering at previous level given by the vertexlist. if auto equals True then pass in auto-recursive mode.

assign_pos(self, vertex_at_level, level, min=0, max=1)

source code 
Assign the position to each vertex of vertex_at_level.

The x-coordinate will the ratio of the current level with the maximum
level of the diagram.

If the first_vertex of vertex_at_level is an outgoing particle. Put it 
at y=0 if possible (this could be prevented by min>0 or by drawing 
option). if you put it at y=0 delete the vertex of the list to avoid 
duplications.

Do the symmetric case for the last entry of vertex_at_level.

The y-value for the other point is computed such that the distance 
between two vertex of the list are the same. the distance between min 
(resp. max) and the first vertex is also equal but if min=0 (resp.
max=1) then this distance counts half.

the option self.opt.external is used
if    equals 0, the external lines are authorizes to end only 
           at the end of the diagram (in x=1 axis) so this will forbid
           to put any vertex at y=0-1 (except if x=1)
if bigger than 0, minimal distance in before putting a external line
          on the border of the diagram.


The computation of y is done in this way
first compute the distance [dist] between two vertex and assign the point.
begin_gap and end_gap are the ratio of the compute distance to put
between min and first vertex.

define_vertex_at_border(self, vertex, level, pos_y)

source code 

Define the position of the vertex considering the distance required in the Drawing Options. Update the option if needed.

remove_t_channel(self)

source code 

Removes all T-channel in a diagram and convert those in S-channel. This occur for 1>X diagram where T-channel are wrongly define.

solve_line_direction(self)

source code 
Computes the directions of the lines of the diagrams.
first use simple rules as particles move in time directions (to right).
- define_line_orientation -. Then flip T-channel particles to 
correct fermion flow in T-channel. Majorana case not deal correctly 
at this stage.

adjust_position(self)

source code 
Modify the position of some particles in order to improve the final
diagram look. This routines use one option
1) max_size which forbids external particles to be longer than max_size.
    This is in level unit. If a line is too long we contract it to 
    max_size preserving the orientation.
2) external indicating the minimal x-gap for an external line. This 
    constraints is already take into account in previous stage. But that
    stage cann't do non integer gap. So this routines correct this.

_debug_load_diagram(self)

source code 

Return a string to check to conversion of format for the diagram.

This is a debug function.

_debug_level(self, text=1)

source code 

Returns a string to check the level of each vertex.

This is a debug function.

_debug_position(self)

source code 

Returns a string to check the position of each vertex.

This is a debug function.

_debug_has_intersection(self)

source code 

Returns if some line cross are crossing each other.

This is a debug Function and is used for the test routine.

__eq__(self, other)
(Equality operator)

source code 

Check if two diagrams are equivalent. (same structure-same particle)

This function is not used for the moment. The initial purpose was the avoid duplication of identical diagram in the output (these could happen if we contract non propagating line). But the number of such comparaison rise as the number of diagram square such that the total time needed for this feature was consider as too (time-)expansive.


Class Variable Details [hide private]

fake_vertex

Value:
{
    'id': 0,
    'legs': []
}