Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
Public Member Functions | Private Member Functions | Private Attributes | Friends
mty::Amplitude Class Reference

Interface class containing the result of an amplitude calculation. More...

#include <amplitude.h>

Public Member Functions

 Amplitude (FeynOptions const &t_options, Kinematics const &t_kinematics)
 Initializes an amplitude with no diagram (to be added later using Amplitude::add()). More...
 
 Amplitude (FeynOptions const &t_options, std::vector< mty::FeynmanDiagram > const &t_diagrams, mty::Kinematics const &t_kinematics)
 Initializes the amplitude completely. More...
 
 Amplitude (FeynOptions const &t_options, std::vector< mty::FeynmanDiagram > &&t_diagrams, mty::Kinematics const &t_kinematics)
 Initializes the amplitude completely. More...
 
bool empty () const
 
size_t size () const
 
csl::Exprexpression (size_t pos)
 Returns a reference to expression of the diagram at a given position. More...
 
csl::Expr const & expression (size_t pos) const
 Returns the const expression of the diagram at a given pos. More...
 
FeynmanDiagram::diagram_tdiagram (size_t pos)
 Returns a reference to the graph layout of the diagram at a given position. More...
 
FeynmanDiagram::diagram_t const & diagram (size_t pos) const
 Returns a const reference to the graph layout of the diagram at a given position. More...
 
std::vector< csl::ExprobtainExpressions () const
 Creates and return a range containing the expressions of all diagrams. More...
 
std::vector< std::shared_ptr< mty::wick::Graph > > obtainGraphs () const
 Creates and return a range containing the graph layouts of all diagrams. More...
 
void add (std::vector< mty::FeynmanDiagram > const &t_diagrams)
 Adds diagrams to the amplitude. More...
 
void add (std::vector< mty::FeynmanDiagram > &&t_diagrams)
 Adds diagrams to the amplitude. More...
 
Amplitude filterOut (std::function< bool(mty::FeynmanDiagram const &)> filter) const
 Applies a diagram filter (mty::FeynOptions::DiagramFilter requirement) to the amplitude and returns the result. More...
 
template<class First , class ... Next, typename = std::enable_if_t<(sizeof...(Next) > 1>
Amplitude filterOut (First &&first, Next &&...next) const
 Applies an arbitrary number of filters on an amplitude. More...
 
FeynOptions const & getOptions () const
 Returns the options used to calculate the amplitude;. More...
 
std::vector< mty::FeynmanDiagram > const & getDiagrams () const
 Returns all the mty::FeynmanDiagram objects as a const reference to a range. More...
 
std::vector< mty::FeynmanDiagram > & getDiagrams ()
 Returns all the mty::FeynmanDiagram objects as a reference to a range. More...
 
mty::Kinematics const & getKinematics () const
 Returns the kinematics of the process. More...
 
mty::KinematicsgetKinematics ()
 Returns the kinematics of the process. More...
 
csl::Expr getSum () const
 Computes and returns the sum of all diagrams i.e. the total amplitude. More...
 
Amplitude copy () const
 Returns a copy of the amplitude. More...
 
void setKinematics (Kinematics const &t_kinematics, bool replace=true)
 Replaces one kinematic context by another, replacing the relevant momenta in expressions. More...
 

Private Member Functions

template<class Iterator >
void add (Iterator first, Iterator last)
 Template utility to add multiple diagrams at once. More...
 

Private Attributes

FeynOptions options
 Set of options that have been used for the calculation.
 
std::vector< mty::FeynmanDiagramdiagrams
 Range of mty::FeynmanDiagram of the process. Each diagram contains a mathematical expression and the corresponding graph (that can be displayed using GRAFED).
 
mty::Kinematics kinematics
 Kinematics of the process.
 

Friends

class AmplitudeInitializer
 

Detailed Description

Interface class containing the result of an amplitude calculation.

This is the return type of the mty::Model::computeAmplitude() member. It contains the mty::FeynmanDiagram objects corresponding to the amplitude, the options that have been used during the calculation and the mty::Kinematics objects corresponding to the external particles layout.

Constructor & Destructor Documentation

◆ Amplitude() [1/3]

mty::Amplitude::Amplitude ( FeynOptions const &  t_options,
Kinematics const &  t_kinematics 
)

Initializes an amplitude with no diagram (to be added later using Amplitude::add()).

Parameters
t_optionsOptions used to calculate the amplitude.
t_diagramsRange of diagrams.
t_kinematicsKinematics of the process.

◆ Amplitude() [2/3]

mty::Amplitude::Amplitude ( FeynOptions const &  t_options,
std::vector< mty::FeynmanDiagram > const &  t_diagrams,
mty::Kinematics const &  t_kinematics 
)

Initializes the amplitude completely.

Parameters
t_optionsOptions used to calculate the amplitude.
t_diagramsRange of diagrams.
t_kinematicsKinematics of the process.

◆ Amplitude() [3/3]

mty::Amplitude::Amplitude ( FeynOptions const &  t_options,
std::vector< mty::FeynmanDiagram > &&  t_diagrams,
mty::Kinematics const &  t_kinematics 
)

Initializes the amplitude completely.

Parameters
t_optionsOptions used to calculate the amplitude.
t_diagramsSet of diagrams, moved range that is invalidated after the call of this constructor (at call site).
t_kinematicsKinematics of the process.

Member Function Documentation

◆ add() [1/3]

void mty::Amplitude::add ( std::vector< mty::FeynmanDiagram > const &  t_diagrams)

Adds diagrams to the amplitude.

Parameters
t_diagramsRange of diagrams to be added.

◆ add() [2/3]

void mty::Amplitude::add ( std::vector< mty::FeynmanDiagram > &&  t_diagrams)

Adds diagrams to the amplitude.

Parameters
t_diagramsMoved range of diagrams to be added. The parameter passed to the function is invalid after the call.

◆ add() [3/3]

template<class Iterator >
void mty::Amplitude::add ( Iterator  first,
Iterator  last 
)
inlineprivate

Template utility to add multiple diagrams at once.

Template Parameters
IteratorIterator type for the range that must be inserted. This type must point to mty::FeynmanDiagram objects.
Parameters
firstBegin iterator.
lastEnd iterator.

◆ copy()

Amplitude mty::Amplitude::copy ( ) const

Returns a copy of the amplitude.

This function creates a deep copy ensuring that no object, symbolic expressions included, is shared between the copy and the initial object. Building blocks are still shared as e.g. momenta and squared momenta.

Returns
The copy of the amplitude.

◆ diagram() [1/2]

FeynmanDiagram::diagram_t & mty::Amplitude::diagram ( size_t  pos)

Returns a reference to the graph layout of the diagram at a given position.

Parameters
posPosition of the diagram.
Returns
The graph layout of the diagram at pos.

◆ diagram() [2/2]

FeynmanDiagram::diagram_t const & mty::Amplitude::diagram ( size_t  pos) const

Returns a const reference to the graph layout of the diagram at a given position.

Parameters
posPosition of the diagram.
Returns
The graph layout of the diagram at pos.

◆ empty()

bool mty::Amplitude::empty ( ) const
inline
Returns
True if the amplitude is empty (equal to zero).
False else.

◆ expression() [1/2]

csl::Expr & mty::Amplitude::expression ( size_t  pos)

Returns a reference to expression of the diagram at a given position.

This function returns a reference allowing the caller to modify directly in place the expression. For example swapping the sign of the second diagram:

amplitude.expression(1) *= -1;

This function can then be used to apply any necessary modifications to the amplitude before going further, calculating Wilson coefficients or squaring the amplitude for example.

Parameters
posPosition of the diagram.
Returns
The expression of the diagram number pos (starts at 0).

◆ expression() [2/2]

csl::Expr const & mty::Amplitude::expression ( size_t  pos) const

Returns the const expression of the diagram at a given pos.

Parameters
posPosition of the diagram.
Returns
The expression of the diagram number pos (starts at 0).

◆ filterOut() [1/2]

Amplitude mty::Amplitude::filterOut ( std::function< bool(mty::FeynmanDiagram const &)>  filter) const

Applies a diagram filter (mty::FeynOptions::DiagramFilter requirement) to the amplitude and returns the result.

This function can be used with built-in filters (see file filters.h) or custom filters. For example, selecting only the contribution where the combination c and b quark appears if one wants to test \( V_{cb} \):

auto ampl_Vcb = amplitude.filter_out(
);

The other overload allows one to call this function with an arbitrary number of filters.

Note
This function is meant to separate contributions from a result that must be used entirely elsewhere. If one wants only one specific contribution at all, consider using filters, through the mty::FeynOptions object passed as a parameter to the amplitude calculation, as this saves unnecessary calculations.
Parameters
filterFilter that should return true if the diagram must be selected and copied in the new Amplitude.
Returns
A copy of the amplitude containing only the selected diagrams.

◆ filterOut() [2/2]

template<class First , class ... Next, typename = std::enable_if_t<(sizeof...(Next) > 1>
Amplitude mty::Amplitude::filterOut ( First &&  first,
Next &&...  next 
) const
inline

Applies an arbitrary number of filters on an amplitude.

Template Parameters
FirstFirst filter type.
...NextNext filter types.
typenameConstraining that there is at least 2 filters.
Parameters
firstFirst filter.
...nextNext filters.
Returns
The filtered amplitude containing only the diagrams that pass all filters.

◆ getDiagrams() [1/2]

std::vector<mty::FeynmanDiagram> const& mty::Amplitude::getDiagrams ( ) const
inline

Returns all the mty::FeynmanDiagram objects as a const reference to a range.

Returns
diagrams.

◆ getDiagrams() [2/2]

std::vector<mty::FeynmanDiagram>& mty::Amplitude::getDiagrams ( )
inline

Returns all the mty::FeynmanDiagram objects as a reference to a range.

Returns
diagrams.

◆ getKinematics() [1/2]

mty::Kinematics const& mty::Amplitude::getKinematics ( ) const
inline

Returns the kinematics of the process.

Returns
kinematics.

◆ getKinematics() [2/2]

mty::Kinematics& mty::Amplitude::getKinematics ( )
inline

Returns the kinematics of the process.

Returns
kinematics.

◆ getOptions()

FeynOptions const& mty::Amplitude::getOptions ( ) const
inline

Returns the options used to calculate the amplitude;.

Returns
options.

◆ getSum()

csl::Expr mty::Amplitude::getSum ( ) const

Computes and returns the sum of all diagrams i.e. the total amplitude.

Returns
The sum of all the diagrams' expressions.

◆ obtainExpressions()

std::vector< csl::Expr > mty::Amplitude::obtainExpressions ( ) const

Creates and return a range containing the expressions of all diagrams.

Returns
A std::vector containing all diagrams' expressions.

◆ obtainGraphs()

std::vector< std::shared_ptr< mty::wick::Graph > > mty::Amplitude::obtainGraphs ( ) const

Creates and return a range containing the graph layouts of all diagrams.

Returns
A std::vector containing all diagrams' graph layouts.

◆ setKinematics()

void mty::Amplitude::setKinematics ( Kinematics const &  t_kinematics,
bool  replace = true 
)

Replaces one kinematic context by another, replacing the relevant momenta in expressions.

Parameters
t_kinematicsNew kinematic context for the process.

◆ size()

size_t mty::Amplitude::size ( ) const
inline
Returns
The size of the amplitude i.e. the number of diagrams / expressions.

The documentation for this class was generated from the following files: