Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
mty::FeynmanDiagram Class Reference

Class containing a Feynman diagram, symbolic expression and graph included. More...

#include <feynmanDiagram.h>

Public Types

enum  DiagramParticleType {
  External,
  Mediator,
  Loop,
  Any
}
 Possible types of particles in a diagram. More...
 
using diagram_t = std::shared_ptr< mty::wick::Graph >
 Type definition for the type used to store graphs.
 
template<typename T >
using isNotParticle_t = typename std::enable_if_t< !std::is_same_v< mty::Particle, std::decay_t< T > > >
 Helper type definition ensuring that the type T is not a mty::Particle. More...
 

Public Member Functions

 FeynmanDiagram (mty::Model const &t_model)
 
 FeynmanDiagram (mty::Model const &t_model, csl::Expr const &t_expression, diagram_t const &t_diagram)
 
bool isZero () const
 Tells if the diagram vanishes. More...
 
csl::Expr const & getExpression () const
 Returns the diagrams's expression as a const reference. More...
 
csl::ExprgetExpression ()
 Returns the diagrams's expression as a reference. More...
 
diagram_tgetDiagram ()
 Returns the diagram's graph as a reference. More...
 
diagram_t const & getDiagram () const
 Returns the diagram's graph as a const reference. More...
 
std::vector< mty::Particle > const & getParticles (DiagramParticleType type=Any) const
 Returns the set of particles corresponding to a given type. More...
 
bool contains (mty::Particle const &part, DiagramParticleType type=Any) const
 Tells if one particle is contained in the diagram for a given type. More...
 
bool isExternal (mty::Particle const &particle) const
 Tells if a particle is an external particle in the diagram. More...
 
bool isMediator (mty::Particle const &particle) const
 Tells if a particle is a mediator particle in the diagram. More...
 
bool isInLoop (mty::Particle const &particle) const
 Tells if a particle is a looped particle in the diagram. More...
 
bool isInternal (mty::Particle const &particle) const
 Tells if a particle is an internal particle in the diagram. More...
 
bool isTreeLevel () const
 
bool isLoop () const
 
int getNLoops () const
 
bool isTopology (int topology) const
 Tells if the diagram is of a given topology. More...
 
template<typename T , typename = isNotParticle_t<T>>
bool contains (T &&part, DiagramParticleType type=Any) const
 Tells if one particle is contained in the diagram for a given type. More...
 
template<typename T , typename = isNotParticle_t<T>>
bool isExternal (T &&particle) const
 Tells if a particle is an external particle in the diagram. More...
 
template<typename T , typename = isNotParticle_t<T>>
bool isMediator (T &&particle) const
 Tells if a particle is a mediator particle in the diagram. More...
 
template<typename T , typename = isNotParticle_t<T>>
bool isInLoop (T &&particle) const
 Tells if a particle is a looped particle in the diagram. More...
 
template<typename T , typename = isNotParticle_t<T>>
bool isInternal (T &&particle) const
 Tells if a particle is an internal particle in the diagram. More...
 
FeynmanDiagram copy () const
 Returns a copy of the diagram. More...
 

Static Public Member Functions

static FeynmanDiagram combine (FeynmanDiagram const &A, FeynmanDiagram const &B, Particle const &mediator)
 Combines two Feynman diagrams, connecting them by one external leg. More...
 

Private Member Functions

std::vector< mty::Particle > & getParticles (DiagramParticleType type=Any)
 Private non-const overload for getParticles(). More...
 
void addParticle (mty::Particle const &part, DiagramParticleType type)
 Adds a particle to a given range (depending its type). More...
 
template<typename T , typename = isNotParticle_t<T>>
void addParticle (T &&part, DiagramParticleType type)
 Template overload for non-mty::Particle objects. More...
 
void loadParticlesFromVertices (std::vector< mty::wick::Vertex > const &vertices)
 
void updateParticleData ()
 Gathers particles from the graph given in initialization.
 
void updateParticleData (std::vector< mty::wick::Vertex > const &vertices)
 Gathers particles from graph vertices.
 
void mergeParticles ()
 Merges all particles found by updateParticleData() in the member allParticles.
 

Private Attributes

Model const * model
 Pointer to the model in which the calculation has been done.
 
csl::Expr expression
 Expression result of the calculation.
 
diagram_t diagram
 Graph to forward to GRAFED to display it on screen.
 
int cycleLength
 Length of the cycle (momentum integral) if the calculation is at one-loop.
 
int nLoops
 Number of loops in the diagram.
 
std::vector< mty::ParticleallParticles
 List of all particles in the process.
 
std::vector< mty::ParticleexternalParticles
 List of external particles in the process.
 
std::vector< mty::ParticlemediatorParticles
 List of mediator particles in the process. More...
 
std::vector< mty::ParticleloopParticles
 List of particles in loops in the process. More...
 

Detailed Description

Class containing a Feynman diagram, symbolic expression and graph included.

The purpose of this class is to provide a container for the result of a diagram calculation, and a simple interface to obtain relevant information about the process. When an amplitude calculation is performed, the result contains a range of Feynman diagrams, each one (an instance of this class) containing as said above the graph that can be displayed in GRAFED, and the fully simplified symbolic expression, main result of MARTY.

Member Typedef Documentation

◆ isNotParticle_t

template<typename T >
using mty::FeynmanDiagram::isNotParticle_t = typename std::enable_if_t< !std::is_same_v<mty::Particle, std::decay_t<T> > >

Helper type definition ensuring that the type T is not a mty::Particle.

Template Parameters
T

Member Enumeration Documentation

◆ DiagramParticleType

Possible types of particles in a diagram.

Enumerator
External 

External particles.

Mediator 

Internal particles outside loops.

Loop 

Internal particles in loops.

Any 

Any type of particle.

Member Function Documentation

◆ addParticle() [1/2]

void mty::FeynmanDiagram::addParticle ( mty::Particle const &  part,
DiagramParticleType  type 
)
private

Adds a particle to a given range (depending its type).

Parameters
partParticle to add to the diagram.
typeType determining the range in which the particle is inserted (externalParticles, loopParticles, mediatorParticles).

◆ addParticle() [2/2]

template<typename T , typename = isNotParticle_t<T>>
void mty::FeynmanDiagram::addParticle ( T &&  part,
DiagramParticleType  type 
)
inlineprivate

Template overload for non-mty::Particle objects.

This function can take any type that can be forwarded to mty::Model::getParticle(). In particular, it may take char arrays as parameter knowing the name of the particle:

addParticle("Z", someType);
// shortcut for the other overload given a model "model":
// addParticle(model.getParticle("Z"), someType);
Template Parameters
TType that can be converted to a particle by a mty::Model.
Constraint: T must not be a mty::Particle.
Parameters
partParticle to add to the diagram.
typeType determining the range in which the particle is

◆ combine()

FeynmanDiagram mty::FeynmanDiagram::combine ( FeynmanDiagram const &  A,
FeynmanDiagram const &  B,
Particle const &  mediator 
)
static

Combines two Feynman diagrams, connecting them by one external leg.

Parameters
AFirst diagram.
BSecond diagram.
mediatorExternal particle in both diagram connecting the two.
Returns
The combined diagram. The expression is invalid and must be determined.

◆ contains() [1/2]

bool mty::FeynmanDiagram::contains ( mty::Particle const &  part,
DiagramParticleType  type = Any 
) const

Tells if one particle is contained in the diagram for a given type.

This function is a general one, that is called by several specialization: isExternal(), isMediator(), isInLoop(), isInternal(). Given a particle and a type (DiagramParticleType), this function returns true if the particle is found is the range of particles of the same type in the diagram. This function can take any type that can be forwarded to mty::Model::getParticle(). In particular, it may take char arrays as parameter knowing the name of the particle:

bool containsZ = diagram.contains("Z");
// shortcut for the other overload given a model "model":
// bool containsZ = diagram.contains(model.getParticle("Z"));
Template Parameters
TType that can be converted to a particle by a mty::Model.
Constraint: T must not be a mty::Particle.
Parameters
partParticle to search in the diagram.
typeType that the particle must be. The default is Any meaning that this function searches in the whole diagram (all particles, external and internal ones).
Returns
True if the particle has been found.
False else.

◆ contains() [2/2]

template<typename T , typename = isNotParticle_t<T>>
bool mty::FeynmanDiagram::contains ( T &&  part,
DiagramParticleType  type = Any 
) const
inline

Tells if one particle is contained in the diagram for a given type.

This function is a general one, that is called by several specialization: isExternal(), isMediator(), isInLoop(), isInternal(). Given a particle and a type (DiagramParticleType), this function returns true if the particle is found is the range of particles of the same type in the diagram.

Parameters
partParticle to search in the diagram.
typeType that the particle must be. The default is Any meaning that this function searches in the whole diagram (all particles).
Returns
True if the particle has been found.
False else.

◆ copy()

FeynmanDiagram mty::FeynmanDiagram::copy ( ) const

Returns a copy of the diagram.

This method deep copies the expression and the graph to create a new diagram with no shared object with the initial one.

Returns
The diagram copy.

◆ getDiagram() [1/2]

diagram_t& mty::FeynmanDiagram::getDiagram ( )
inline

Returns the diagram's graph as a reference.

Returns
diagram

◆ getDiagram() [2/2]

diagram_t const& mty::FeynmanDiagram::getDiagram ( ) const
inline

Returns the diagram's graph as a const reference.

Returns
diagram

◆ getExpression() [1/2]

csl::Expr const& mty::FeynmanDiagram::getExpression ( ) const
inline

Returns the diagrams's expression as a const reference.

Returns
expression

◆ getExpression() [2/2]

csl::Expr& mty::FeynmanDiagram::getExpression ( )
inline

Returns the diagrams's expression as a reference.

Returns
expression

◆ getNLoops()

int mty::FeynmanDiagram::getNLoops ( ) const
Returns
The number of loops of the diagram.

◆ getParticles() [1/2]

std::vector< mty::Particle > const & mty::FeynmanDiagram::getParticles ( DiagramParticleType  type = Any) const

Returns the set of particles corresponding to a given type.

Parameters
typeType of the particle range to return. The default value is Any, meaning all the particles in the diagram.
Returns
externalParticles if type is External.
mediatorParticles if type is Mediator.
loopParticles if type is Loop.
allParticles if type is Any.

◆ getParticles() [2/2]

std::vector< mty::Particle > & mty::FeynmanDiagram::getParticles ( DiagramParticleType  type = Any)
private

Private non-const overload for getParticles().

Parameters
typeType of the particles from which the range must be returned.
Returns
The range of particles of type type.

◆ isExternal() [1/2]

bool mty::FeynmanDiagram::isExternal ( mty::Particle const &  particle) const
inline

Tells if a particle is an external particle in the diagram.

Parameters
particleParticle to test.
Returns
True if one external leg corresponds to particle.
False else.
See also
contains(), DiagramParticleType

◆ isExternal() [2/2]

template<typename T , typename = isNotParticle_t<T>>
bool mty::FeynmanDiagram::isExternal ( T &&  particle) const
inline

Tells if a particle is an external particle in the diagram.

This function can take any type that can be forwarded to mty::Model::getParticle(). In particular, it may take char arrays as parameter knowing the name of the particle:

bool containsZ = diagram.isExternal("Z");
// shortcut for the other overload given a model "model":
// bool containsZ = diagram.isExternal(model.getParticle("Z"));
Template Parameters
TType that can be converted to a particle by a mty::Model.
Constraint: T must not be a mty::Particle.
Parameters
particleParticle to search for.
Returns
True if particle represents an external particle (mediator or looped particle) in the diagram.
False else.
See also
contains(), DiagramParticleType

◆ isInLoop() [1/2]

bool mty::FeynmanDiagram::isInLoop ( mty::Particle const &  particle) const
inline

Tells if a particle is a looped particle in the diagram.

Parameters
particleParticle to test.
Returns
True if one loop particle corresponds to particle.
False else.
See also
contains(), DiagramParticleType

◆ isInLoop() [2/2]

template<typename T , typename = isNotParticle_t<T>>
bool mty::FeynmanDiagram::isInLoop ( T &&  particle) const
inline

Tells if a particle is a looped particle in the diagram.

This function can take any type that can be forwarded to mty::Model::getParticle(). In particular, it may take char arrays as parameter knowing the name of the particle:

bool containsZ = diagram.isInLoop("Z");
// shortcut for the other overload given a model "model":
// bool containsZ = diagram.isInLoop(model.getParticle("Z"));
Template Parameters
TType that can be converted to a particle by a mty::Model.
Constraint: T must not be a mty::Particle.
Parameters
particleParticle to search for.
Returns
True if particle represents a looped particle (mediator or looped particle) in the diagram.
False else.
See also
contains(), DiagramParticleType

◆ isInternal() [1/2]

bool mty::FeynmanDiagram::isInternal ( mty::Particle const &  particle) const
inline

Tells if a particle is an internal particle in the diagram.

Parameters
particleParticle to test.
Returns
True if one mediator or looped particle corresponds to particle.
False else.
See also
contains(), DiagramParticleType

◆ isInternal() [2/2]

template<typename T , typename = isNotParticle_t<T>>
bool mty::FeynmanDiagram::isInternal ( T &&  particle) const
inline

Tells if a particle is an internal particle in the diagram.

This function can take any type that can be forwarded to mty::Model::getParticle(). In particular, it may take char arrays as parameter knowing the name of the particle:

bool containsZ = diagram.isInternal("Z");
// shortcut for the other overload given a model "model":
// bool containsZ = diagram.isInternal(model.getParticle("Z"));
Template Parameters
TType that can be converted to a particle by a mty::Model.
Constraint: T must not be a mty::Particle.
Parameters
particleParticle to search for.
Returns
True if particle represents an internal particle (mediator or looped particle) in the diagram.
False else.
See also
contains(), DiagramParticleType

◆ isLoop()

bool mty::FeynmanDiagram::isLoop ( ) const
inline
Returns
True if the diagram has at least one loop.
False else.

◆ isMediator() [1/2]

bool mty::FeynmanDiagram::isMediator ( mty::Particle const &  particle) const
inline

Tells if a particle is a mediator particle in the diagram.

Parameters
particleParticle to test.
Returns
True if one mediator corresponds to particle.
False else.
See also
contains(), DiagramParticleType

◆ isMediator() [2/2]

template<typename T , typename = isNotParticle_t<T>>
bool mty::FeynmanDiagram::isMediator ( T &&  particle) const
inline

Tells if a particle is a mediator particle in the diagram.

This function can take any type that can be forwarded to mty::Model::getParticle(). In particular, it may take char arrays as parameter knowing the name of the particle:

bool containsZ = diagram.isMediator("Z");
// shortcut for the other overload given a model "model":
// bool containsZ = diagram.isMediator(model.getParticle("Z"));
Template Parameters
TType that can be converted to a particle by a mty::Model.
Constraint: T must not be a mty::Particle.
Parameters
particleParticle to search for.
Returns
True if particle represents a mediator particle (mediator or looped particle) in the diagram.
False else.
See also
contains(), DiagramParticleType

◆ isTopology()

bool mty::FeynmanDiagram::isTopology ( int  topology) const

Tells if the diagram is of a given topology.

This function takes as a parameter an integer, not a mty::Topology::Type object to allow combinations of topologies. A single mty::Topology::Type can also be given as it is implicitly convertible into an int. This interface allows then the following uses:

bool isTadpole = diagram.isTopology(mty::Topology::Tadpole);
bool isTriangleOrBox = diagram.isTopology(mty::Topology::Triangle | mty::Topology::Box);
// Finally, in the limit of at most 5 external legs :
bool alwaysTrue = diagram.isTopology(mty::Topology::Any);
Parameters
topologyInteger representing one or several topologies.
Returns
True if the diagram's topology is included in topology.
False else.

◆ isTreeLevel()

bool mty::FeynmanDiagram::isTreeLevel ( ) const
inline
Returns
True if the diagram is at the tree level.
False else.

◆ isZero()

bool mty::FeynmanDiagram::isZero ( ) const
inline

Tells if the diagram vanishes.

Note
A bare output of MARTY should in principle not contain null diagrams.
Returns
True if the diagram's expression is equal to zero.
False else.

Field Documentation

◆ loopParticles

std::vector<mty::Particle> mty::FeynmanDiagram::loopParticles
private

List of particles in loops in the process.

See also
mediatorParticles

◆ mediatorParticles

std::vector<mty::Particle> mty::FeynmanDiagram::mediatorParticles
private

List of mediator particles in the process.

Mediator particles are defined here as internal particles that do not appear in loops. An internal particle is then either a mediator or a looped particle.

See also
loopParticles

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