Package madgraph :: Package core :: Module helas_objects :: Class HelasMatrixElement
[hide private]
[frames] | no frames]

Class HelasMatrixElement

source code

            object --+        
                     |        
                  dict --+    
                         |    
base_objects.PhysicsObject --+
                             |
                            HelasMatrixElement
Known Subclasses:

HelasMatrixElement: list of processes with identical Helas calls, and the list of HelasDiagrams associated with the processes.

If initiated with an Amplitude, HelasMatrixElement calls generate_helas_diagrams, which goes through the diagrams of the Amplitude and generates the corresponding Helas calls, taking into account possible fermion flow clashes due to Majorana particles. The optional optimization argument determines whether optimization is used (optimization = 1, default), for maximum recycling of wavefunctions, or no optimization (optimization = 0) when each diagram is written independently of all previous diagrams (this is useful for running with restricted memory, e.g. on a GPU). For processes with many diagrams, the total number or wavefunctions after optimization is ~15% of the number of amplitudes (diagrams).

By default, it will also generate the color information (color basis and color matrix) corresponding to the Amplitude.

Nested Classes [hide private]

Inherited from base_objects.PhysicsObject: PhysicsObjectError

Instance Methods [hide private]
 
default_setup(self)
Default values for all properties
source code
 
filter(self, name, value)
Filter for valid diagram property values.
source code
 
get_sorted_keys(self)
Return particle property names as a nicely sorted list.
source code
D[k] if k in D, else d
get(self, name)
Get the value of the property name.
source code
new empty dictionary

__init__(self, amplitude=None, optimization=1, decay_ids=[], gen_color=True)
Constructor for the HelasMatrixElement.
source code
 
__eq__(self, other)
Comparison between different matrix elements, to allow check for identical processes.
source code
 
__ne__(self, other)
Overloading the nonequality operator, to make comparison easy
source code
 
process_color(self)
Perform the simple color processing from a single matrix element (without optimization then).
source code
 
generate_helas_diagrams(self, amplitude, optimization=1, decay_ids=[])
Starting from a list of Diagrams from the diagram generation, generate the corresponding HelasDiagrams, i.e., the wave functions and amplitudes.
source code
 
reuse_outdated_wavefunctions(self, helas_diagrams)
change the wavefunctions id used in the writer to minimize the memory used by the wavefunctions.
source code
 
restore_original_wavefunctions(self)
This restore the original memory print and revert change the wavefunctions id used in the writer to minimize the memory used by the wavefunctions.
source code
 
insert_decay_chains(self, decay_dict)
Iteratively insert decay chains decays into this matrix element.
source code
 
insert_decay(self, old_wfs, decay, numbers, got_majoranas)
Insert a decay chain matrix element into the matrix element.
source code
 
update_later_mothers(self, wf, new_wf, later_wfs, later_wf_arrays)
Update mothers for all later wavefunctions
source code
 
replace_wavefunctions(self, old_wf, new_wfs, diagrams, numbers)
Recursive function to replace old_wf with new_wfs, and multiply all wavefunctions or amplitudes that use old_wf
source code
 
replace_single_wavefunction(self, old_wf, new_wf)
Insert decay chain by simply modifying wavefunction.
source code
 
identical_decay_chain_factor(self, decay_chains)
Calculate the denominator factor from identical decay chains
source code
 
calculate_fermionfactors(self)
Generate the fermion factors for all diagrams in the matrix element
source code
 
calculate_identical_particle_factor(self)
Calculate the denominator factor for identical final state particles
source code
 
get_base_amplitude(self)
Generate a diagram_generation.Amplitude from a HelasMatrixElement.
source code
 
getmothers(self, legs, number_to_wavefunctions, external_wavefunctions, wavefunctions, diagram_wavefunctions)
Generate list of mothers from number_to_wavefunctions and external_wavefunctions
source code
 
get_num_configs(self)
Get number of diagrams, which is always more than number of configs
source code
 
get_number_of_wavefunctions(self)
Gives the total number of wavefunctions for this ME
source code
 
get_all_wavefunctions(self)
Gives a list of all wavefunctions for this ME
source code
 
get_all_mass_widths(self)
Gives a list of all widths used by this ME (from propagator)
source code
 
get_all_amplitudes(self)
Gives a list of all amplitudes for this ME
source code
 
get_external_wavefunctions(self)
Gives the external wavefunctions for this ME
source code
 
get_number_of_amplitudes(self)
Gives the total number of amplitudes for this ME
source code
 
get_nexternal_ninitial(self)
Gives (number or external particles, number of incoming particles)
source code
 
get_external_masses(self)
Gives the list of the strings corresponding to the masses of the external particles.
source code
 
get_helicity_combinations(self)
Gives the number of helicity combinations for external wavefunctions
source code
 
get_helicity_matrix(self, allow_reverse=True)
Gives the helicity matrix for external wavefunctions
source code
 
get_hel_avg_factor(self)
Calculate the denominator factor due to the average over initial state spin only
source code
 
get_beams_hel_avg_factor(self)
Calculate the denominator factor due to the average over initial state spin only.
source code
 
get_denominator_factor(self)
Calculate the denominator factor due to: Averaging initial state color and spin, and identical final state particles
source code
 
generate_color_amplitudes(self, color_basis, diagrams)
Return a list of (coefficient, amplitude number) lists, corresponding to the JAMPs for the HelasDiagrams and color basis passed in argument.
source code
 
get_color_amplitudes(self)
Return a list of (coefficient, amplitude number) lists, corresponding to the JAMPs for this matrix element.
source code
 
sort_split_orders(self, split_orders)
Sort the 'split_orders' list given in argument so that the orders of smaller weights appear first.
source code
 
get_split_orders_mapping_for_diagram_list(self, diag_list, split_orders, get_amp_number_function=<function <lambda> at 0x10dd4f320>, get_amplitudes_function=<function <lambda> at 0x10dd4f398>)
This a helper function for get_split_orders_mapping to return, for the HelasDiagram list given in argument, the list amp_orders detailed in the description of the 'get_split_orders_mapping' function.
source code
 
get_split_orders_mapping(self)
This function returns two lists, squared_orders, amp_orders.
source code
 
get_used_lorentz(self)
Return a list of (lorentz_name, conjugate_tag, outgoing) with all lorentz structures used by this HelasMatrixElement.
source code
 
get_used_couplings(self)
Return a list with all couplings used by this HelasMatrixElement.
source code
 
get_mirror_processes(self)
Return a list of processes with initial states interchanged if has mirror processes
source code

Inherited from base_objects.PhysicsObject: __getitem__, __repr__, __str__, is_valid_prop, set

Inherited from dict: __cmp__, __contains__, __delitem__, __ge__, __getattribute__, __gt__, __iter__, __le__, __len__, __lt__, __new__, __setitem__, __sizeof__, clear, copy, fromkeys, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values, viewitems, viewkeys, viewvalues

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

Static Methods [hide private]
 
check_equal_decay_processes(decay1, decay2)
Check if two single-sided decay processes (HelasMatrixElements) are equal.
source code
 
check_equal_wavefunctions(wf1, wf2)
Recursive function to check if two wavefunctions are equal.
source code
 
sorted_mothers(arg)
Gives a list of mother wavefunctions sorted according to
source code
Class Variables [hide private]

Inherited from dict: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

default_setup(self)

source code 

Default values for all properties

Overrides: base_objects.PhysicsObject.default_setup

filter(self, name, value)

source code 

Filter for valid diagram property values.

Overrides: base_objects.PhysicsObject.filter

get_sorted_keys(self)

source code 

Return particle property names as a nicely sorted list.

Overrides: base_objects.PhysicsObject.get_sorted_keys

get(self, name)

source code 

Get the value of the property name.

Returns: D[k] if k in D, else d
Overrides: dict.get

__init__(self, amplitude=None, optimization=1, decay_ids=[], gen_color=True)
(Constructor)

source code 

Constructor for the HelasMatrixElement. In particular allows generating a HelasMatrixElement from an Amplitude, with automatic generation of the necessary wavefunctions

Returns:
new empty dictionary

Overrides: object.__init__

__eq__(self, other)
(Equality operator)

source code 

Comparison between different matrix elements, to allow check for identical processes.

Overrides: dict.__eq__

__ne__(self, other)

source code 

Overloading the nonequality operator, to make comparison easy

Overrides: dict.__ne__

process_color(self)

source code 

Perform the simple color processing from a single matrix element (without optimization then). This is called from the initialization and pulled out here in order to have the correct treatment in daughter classes.

generate_helas_diagrams(self, amplitude, optimization=1, decay_ids=[])

source code 

Starting from a list of Diagrams from the diagram generation, generate the corresponding HelasDiagrams, i.e., the wave functions and amplitudes. Choose between default optimization (= 1, maximum recycling of wavefunctions) or no optimization (= 0, no recycling of wavefunctions, useful for GPU calculations with very restricted memory).

Note that we need special treatment for decay chains, since the end product then is a wavefunction, not an amplitude.

insert_decay_chains(self, decay_dict)

source code 
Iteratively insert decay chains decays into this matrix
element.        
* decay_dict: a dictionary from external leg number
  to decay matrix element.

insert_decay(self, old_wfs, decay, numbers, got_majoranas)

source code 
Insert a decay chain matrix element into the matrix element.
* old_wfs: the wavefunctions to be replaced.
  They all correspond to the same external particle, but might
  have different fermion flow directions
* decay: the matrix element for the decay chain
* numbers: the present wavefunction and amplitude number,
  to allow for unique numbering
  
Note that:
1) All amplitudes and all wavefunctions using the decaying wf
   must be copied as many times as there are amplitudes in the
   decay matrix element
2) In the presence of Majorana particles, we must make sure
   to flip fermion flow for the decay process if needed.

The algorithm is the following:
1) Multiply the diagrams with the number of diagrams Ndiag in
   the decay element
2) For each diagram in the decay element, work on the diagrams
   which corresponds to it
3) Flip fermion flow for the decay wavefunctions if needed
4) Insert all auxiliary wavefunctions into the diagram (i.e., all 
   except the final wavefunctions, which directly replace the
   original final state wavefunctions)
4) Replace the wavefunctions recursively, so that we always replace
   each old wavefunctions with Namp new ones, where Namp is
   the number of amplitudes in this decay element
   diagram. Do recursion for wavefunctions which have this
   wavefunction as mother. Simultaneously replace any
   amplitudes which have this wavefunction as mother.

replace_wavefunctions(self, old_wf, new_wfs, diagrams, numbers)

source code 
Recursive function to replace old_wf with new_wfs, and
multiply all wavefunctions or amplitudes that use old_wf

* old_wf: The wavefunction to be replaced
* new_wfs: The replacing wavefunction
* diagrams - the diagrams that are relevant for these new
  wavefunctions.
* numbers: the present wavefunction and amplitude number,
  to allow for unique numbering

replace_single_wavefunction(self, old_wf, new_wf)

source code 

Insert decay chain by simply modifying wavefunction. This is possible only if there is only one diagram in the decay.

get_base_amplitude(self)

source code 

Generate a diagram_generation.Amplitude from a HelasMatrixElement. This is used to generate both color amplitudes and diagram drawing.

get_beams_hel_avg_factor(self)

source code 

Calculate the denominator factor due to the average over initial state spin only. Returns the result for beam one and two separately so that the averaging can be done correctly for partial polarization.

generate_color_amplitudes(self, color_basis, diagrams)

source code 

Return a list of (coefficient, amplitude number) lists, corresponding to the JAMPs for the HelasDiagrams and color basis passed in argument. The coefficients are given in the format (fermion factor, colorcoeff (frac), imaginary, Nc power).

get_color_amplitudes(self)

source code 

Return a list of (coefficient, amplitude number) lists, corresponding to the JAMPs for this matrix element. The coefficients are given in the format (fermion factor, color coeff (frac), imaginary, Nc power).

sort_split_orders(self, split_orders)

source code 

Sort the 'split_orders' list given in argument so that the orders of smaller weights appear first. Do nothing if not all split orders have a hierarchy defined.

get_split_orders_mapping(self)

source code 
This function returns two lists, squared_orders, amp_orders.
If process['split_orders'] is empty, the function returns two empty lists.

squared_orders : All possible contributing squared orders among those
    specified in the process['split_orders'] argument. The elements of
    the list are tuples of the format format (OrderValue1,OrderValue2,...) 
    with OrderValue<i> correspond to the value of the <i>th order in
    process['split_orders'] (the others are summed over and therefore 
    left unspecified).
    Ex for dijet with process['split_orders']=['QCD','QED']: 
        => [(4,0),(2,2),(0,4)]

amp_orders : Exactly as for squared order except that this list specifies
    the contributing order values for the amplitude (i.e. not 'squared').
    Also, the tuple describing the amplitude order is nested with a 
    second one listing all amplitude numbers contributing to this order.
    Ex for dijet with process['split_orders']=['QCD','QED']: 
        => [((2, 0), (2,)), ((0, 2), (1, 3, 4))]

Keep in mind that the orders of the element of the list is important as
it dicatates the order of the corresponding "order indices" in the
code output by the exporters.

check_equal_decay_processes(decay1, decay2)
Static Method

source code 

Check if two single-sided decay processes (HelasMatrixElements) are equal.

Note that this has to be called before any combination of processes has occured.

Since a decay processes for a decay chain is always generated such that all final state legs are completely contracted before the initial state leg is included, all the diagrams will have identical wave function, independently of the order of final state particles.

Note that we assume that the process definitions have all external particles, corresponding to the external wavefunctions.

check_equal_wavefunctions(wf1, wf2)
Static Method

source code 

Recursive function to check if two wavefunctions are equal. First check that mothers have identical pdg codes, then repeat for all mothers with identical pdg codes.

sorted_mothers(arg)
Static Method

source code 

Gives a list of mother wavefunctions sorted according to

  1. The order of the particles in the interaction
  2. Cyclic reordering of particles in same spin group
  3. Fermions ordered IOIOIO... according to the pairs in the interaction.