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

Class DiagramDrawer

source code

object --+
         |
        DiagramDrawer
Known Subclasses:

In principle ALL routines representing diagram in ANY format SHOULD derive from this class.

This is a (nearly empty) frameworks to draw a diagram in any type format

This frameworks defines in particular

This framework is base on the idea that we can create the diagram line after line. Indeed all line object (FeynmanLine) contains the full information needed to be drawed independently of the rest of the diagram.

In order to create a class with this framework you should start to write the draw_straight, draw_curly, ... method which are called by the framework.

If you want to write a file, you can store his content in self.text variable the routine conclude will then automatically write the file.

The main routine to draw a diagram is 'draw' which call 1) initialize: setup things for the diagram (usually open a file). 2) convert_diagram : Update the diagram in the correct format if needed. 3) draw_diagram : Build the diagram line after line. 4) conclude : finish the operation.

Nested Classes [hide private]
  DrawDiagramError
Standard error for error occuring to create output of a Diagram.
Instance Methods [hide private]
 
__init__(self, diagram=None, filename=None, model=None, amplitude=None, opt=None)
Define basic variables and store some global information.
source code
 
draw(self, opt=None)
Main routine to draw a single diagram.
source code
 
convert_diagram(self, diagram=None, model=None, amplitude=None, opt=None)
If diagram is a basic diagram (inherit from base_objects.Diagram) convert him to a FeynmanDiagram one.
source code
 
initialize(self)
Initialization of object-file before starting in order to draw the diagram correctly.
source code
 
draw_diagram(self, diagram='', number=0)
Building the diagram Line after Line.
source code
 
conclude(self)
Final operation of the draw method.
source code
 
draw_line(self, line)
Draw the line information.
source code
 
draw_vertex(self, vertex)
default vertex style
source code
 
draw_straight(self, line)
Example of routine for drawing the line 'line' in a specific format.
source code
 
associate_name(self, line, name)
Method to associate a name to a the given line.
source code
 
associate_number(self, line, number)
Method to associate a number to 'line'.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

source code 
Define basic variables and store some global information.
All argument are optional:
diagram : is the object to  'diagram' should inherit from either 
        base_objects.Diagram  or drawing_lib.FeynmanDiagram.
filename: file's name of the file to write.
model: model associate to the diagram. In principle use only if diagram
    inherit from base_objects.Diagram (for conversion).
amplitude: amplitude associates to the diagram. NOT USE for the moment.
    In future you could pass the amplitude associate to the object in 
    order to adjust fermion flow in case of Majorana fermion.
opt: should be a valid DrawOption object.

Overrides: object.__init__

draw(self, opt=None)

source code 

Main routine to draw a single diagram. opt is DrawOption object use for the conversion of the base_objects.Diagram in one of the Diagram object.

convert_diagram(self, diagram=None, model=None, amplitude=None, opt=None)

source code 
If diagram is a basic diagram (inherit from base_objects.Diagram)
convert him to a FeynmanDiagram one. 'opt' keeps track of possible 
option of drawing. 'amplitude' is not use for the moment. But, later,
if defined will authorize to adjust the fermion-flow of Majorana 
particles. opt is a DrawOption object containing all option on the way
to draw the diagram (see this class for more details)


This is the list of recognize options:
    external [True] : authorizes external particles to finish on 
        horizontal limit of the square
    horizontal [True]: if on true use FeynmanDiagramHorizontal to 
        convert the diagram. otherwise use FeynmanDiagram (Horizontal 
        forces S-channel to be horizontal)
    non_propagating [True] : removes the non propagating particles 
        present in the diagram.

initialize(self)

source code 

Initialization of object-file before starting in order to draw the diagram correctly. By default, we just check if we are in writing mode. And open the output file if we are.

draw_diagram(self, diagram='', number=0)

source code 

Building the diagram Line after Line. This is the key routine of 'draw'.

conclude(self)

source code 

Final operation of the draw method. By default, this end to write the

file (if this one exist)

draw_line(self, line)

source code 

Draw the line information. First, call the method associate the line type [draw_XXXXXX] Then finalize line representation by adding his name and, if it's an external particle, the MadGraph number associate to it.

draw_straight(self, line)

source code 

Example of routine for drawing the line 'line' in a specific format. straight is an example and can be replace by other type of line as dashed, wavy, curly, ...

associate_name(self, line, name)

source code 

Method to associate a name to a the given line. The default action of this framework doesn't do anything

associate_number(self, line, number)

source code 

Method to associate a number to 'line'. By default this method is call only for external particles and the number is the MadGraph number associate to the particle. The default routine doesn't do anything