21 #ifndef MODEL_DATA_H_INCLUDED 22 #define MODEL_DATA_H_INCLUDED 24 #include <type_traits> 115 explicit ModelData(std::unique_ptr<Gauge> &&t_gauge);
134 std::unique_ptr<Gauge> &&t_gauge,
135 std::unique_ptr<Flavor> &&t_flavor
160 std::unique_ptr<Gauge> &&t_gauge,
161 std::unique_ptr<Flavor> &&t_flavor,
162 std::vector<Particle> &t_particles);
203 void init(
bool initGaugeTerms =
true);
223 virtual void saveModel(
228 void saveModelFunction(
229 std::string_view name,
234 void saveModelFunctionWithRef(
235 std::string_view name,
241 std::string_view name,
242 std::string
const &fileName
407 void setGauge(std::unique_ptr<mty::Gauge> &&t_gauge);
431 std::string_view name,
459 std::string_view name,
478 std::string_view name,
480 bool complexFields =
true);
500 void setFlavor(std::unique_ptr<mty::Flavor> &&t_flavor);
519 bool initializeTerms =
true);
536 std::vector<mty::Particle>
const &parts,
537 bool initializeTerms =
true);
539 void addParticlesIn(
csl::Expr const &expr);
650 std::string_view name,
651 std::vector<mty::Particle>
const& fields,
652 std::vector<int>
const& values,
653 bool conserved =
true 685 template<
class FieldType>
687 std::string_view name,
688 std::vector<FieldType>
const& fields,
689 std::vector<int>
const& values,
690 bool conserved =
true 722 template<
class FieldType>
724 std::string_view name,
725 std::initializer_list<FieldType> fields,
726 std::vector<int>
const &values,
727 bool conserved =
true 740 std::vector<mty::QuantumNumber>
const &numbers
927 std::initializer_list<std::string_view>
names 1039 template<
class FieldType>
1053 template<
class GroupType,
class FieldType >
1070 template<
class GroupType,
class FieldType >
1085 template<
class FieldType>
1100 template<
class FlavorType,
class FieldType >
1119 template<
class GroupType,
class FieldType >
1139 template<
class GroupType,
class FieldType >
1157 template<
class GroupType >
1176 template<
class GroupType,
class FieldType >
1195 template<
class GroupType >
1216 template<
class GroupType,
class FieldType >
1218 std::string_view nameIndex,
1237 template<
class GroupType,
class FieldType >
1318 bool addHermitic =
false);
1342 bool addHermitic =
false);
1359 template<
class FieldType>
1362 std::string_view mass
1382 template<
class FieldType>
1410 template<
class FieldType1,
class FieldType2>
1414 std::string_view mass
1438 template<
class FieldType1,
class FieldType2>
1457 template<
class FieldType>
1459 FieldType &&diracFermion,
1460 std::string_view mass
1475 template<
class FieldType>
1477 FieldType &&diracFermion,
1490 template<
class FieldType>
1493 std::string_view newName
1503 std::string_view name,
1504 std::string_view newName
1518 std::vector<std::string>
const &
particles,
1519 std::ostream &out = std::cout
1528 std::initializer_list<std::string> particles,
1529 std::ostream &out = std::cout
1538 std::string
const &particle,
1539 std::ostream &out = std::cout
1583 std::vector<csl::Parent> &defined
1588 std::vector<csl::Parent> &defined
1593 std::vector<csl::Parent> &defined
1595 void writeMassAndWidth(
1598 std::vector<csl::Parent> &defined
1600 void writeParticles(
1603 std::vector<csl::Parent> &defined
1605 void writeDependencies(
1608 std::vector<csl::Parent> &defined,
1609 std::vector<csl::Expr> &kinetic,
1610 std::vector<csl::Expr> &mass,
1611 std::vector<csl::Expr> &interac
1613 void writeLagrangian(
1616 std::vector<csl::Expr>
const &kinetic,
1617 std::vector<csl::Expr>
const &mass,
1618 std::vector<csl::Expr>
const &interac
1770 std::string_view nameIndex,
1801 void doAddBosonicMass(
1803 std::string_view mass
1813 void doAddBosonicMass(
1827 void doAddFermionicMass(
1830 std::string_view mass
1841 void doAddFermionicMass(
1854 void doAddFermionicMass(
1856 std::string_view mass
1866 void doAddFermionicMass(
1881 std::string_view newName
1972 template<
class FieldType>
1974 std::string_view name,
1975 std::vector<FieldType>
const& fields,
1976 std::vector<int>
const& values,
1980 std::vector<mty::Particle> parts;
1981 parts.reserve(fields.size());
1982 for (FieldType
const &f : fields)
1986 template<
class FieldType>
1988 std::string_view name,
1989 std::initializer_list<FieldType> fields,
1990 std::vector<int>
const &values,
1996 std::vector<FieldType>(fields),
2006 template<
class FieldType>
2009 constexpr
bool field_valid =
2010 std::is_convertible<FieldType, mty::Particle const&>::value;
2012 if constexpr(field_valid)
2019 template<
class GroupType,
class FieldType >
2025 constexpr
bool field_valid =
2026 std::is_convertible<
2030 constexpr
bool group_valid =
2031 std::is_convertible<
2035 if constexpr(group_valid) {
2036 if constexpr(field_valid)
2043 else if constexpr (field_valid)
2046 getGroup(std::forward<GroupType>(group)));
2050 getGroup(std::forward<GroupType>(group)));
2053 template<
class GroupType,
class FieldType >
2059 constexpr
bool field_valid =
2060 std::is_convertible<
2064 constexpr
bool group_valid =
2065 std::is_convertible<
2069 if constexpr(group_valid) {
2070 if constexpr(field_valid)
2077 else if constexpr (field_valid)
2080 getGroup(std::forward<GroupType>(group)));
2084 getGroup(std::forward<GroupType>(group)));
2087 template<
class FieldType>
2090 constexpr
bool field_valid =
2091 std::is_convertible<FieldType, mty::Particle const&>::value;
2093 if constexpr(field_valid)
2100 template<
class FlavorType,
class FieldType >
2106 constexpr
bool field_valid =
2107 std::is_convertible<
2111 constexpr
bool flavor_valid =
2112 std::is_convertible<
2116 if constexpr(flavor_valid) {
2117 if constexpr(field_valid)
2124 else if constexpr (field_valid)
2135 template<
class GroupType,
class FieldType >
2141 constexpr
bool group_valid =
2142 std::is_convertible<
2146 constexpr
bool field_valid =
2147 std::is_convertible<
2151 if constexpr(group_valid) {
2152 if constexpr(field_valid)
2158 else if constexpr (field_valid)
2160 getGroup(std::forward<GroupType>(group)),
2164 getGroup(std::forward<GroupType>(group)),
2168 template<
class GroupType,
class FieldType >
2174 constexpr
bool group_valid =
2175 std::is_convertible<
2179 constexpr
bool field_valid =
2180 std::is_convertible<
2184 if constexpr(group_valid) {
2185 if constexpr(field_valid)
2192 else if constexpr (field_valid)
2194 getGroup(std::forward<GroupType>(group)),
2198 getGroup(std::forward<GroupType>(group)),
2202 template<
class GroupType >
2207 constexpr
bool group_valid =
2208 std::is_convertible<
2212 if constexpr(group_valid) {
2217 getGroup(std::forward<GroupType>(group))
2221 template<
class GroupType,
class FieldType >
2228 std::vector<csl::Index> indices(nIndices);
2229 for (
size_t i = 0; i != nIndices; ++i)
2230 indices[i] = generateIndex<GroupType, FieldType>(
2231 std::forward<GroupType>(group),
2232 std::forward<FieldType>(field)
2238 template<
class GroupType >
2244 std::vector<csl::Index> indices(nIndices);
2245 for (
size_t i = 0; i != nIndices; ++i)
2246 indices[i] = generateIndex<GroupType>(
2247 std::forward<GroupType>(group)
2253 template<
class GroupType,
class FieldType >
2255 std::string_view nameIndex,
2260 constexpr
bool group_valid =
2261 std::is_convertible<
2265 constexpr
bool field_valid =
2266 std::is_convertible<
2270 if constexpr(group_valid) {
2271 if constexpr(field_valid)
2279 else if constexpr (field_valid)
2282 getGroup(std::forward<GroupType>(group)),
2287 getGroup(std::forward<GroupType>(group)),
2291 template<
class GroupType,
class FieldType >
2297 constexpr
bool group_valid =
2298 std::is_convertible<
2302 constexpr
bool field_valid =
2303 std::is_convertible<
2307 if constexpr(group_valid) {
2308 if constexpr(field_valid)
2315 else if constexpr (field_valid)
2317 getGroup(std::forward<GroupType>(group)),
2321 getGroup(std::forward<GroupType>(group)),
2325 template<
class FieldType>
2328 std::string_view mass
2331 constexpr
bool field_valid =
2332 std::is_convertible<
2336 if constexpr (field_valid)
2337 doAddBosonicMass(field, mass);
2344 template<
class FieldType>
2350 constexpr
bool field_valid =
2351 std::is_convertible<
2355 if constexpr (field_valid)
2356 doAddBosonicMass(field, mass);
2364 template<
class FieldType1,
class FieldType2>
2368 std::string_view mass
2371 constexpr
bool field1_valid =
2372 std::is_convertible<
2375 constexpr
bool field2_valid =
2376 std::is_convertible<
2380 if constexpr(field1_valid) {
2381 if constexpr(field2_valid)
2382 return doAddFermionicMass(left, right, mass);
2390 else if constexpr (field2_valid)
2403 template<
class FieldType1,
class FieldType2>
2410 constexpr
bool field1_valid =
2411 std::is_convertible<
2414 constexpr
bool field2_valid =
2415 std::is_convertible<
2419 if constexpr(field1_valid) {
2420 if constexpr(field2_valid)
2421 return doAddFermionicMass(left, right, mass);
2429 else if constexpr (field2_valid)
2442 template<
class FieldType>
2444 FieldType &&diracFermion,
2445 std::string_view mass
2448 constexpr
bool field_valid =
2449 std::is_convertible<
2453 if constexpr (field_valid)
2454 doAddFermionicMass(diracFermion, mass);
2457 getParticle(std::forward<FieldType>(diracFermion)),
2461 template<
class FieldType>
2463 FieldType &&diracFermion,
2467 constexpr
bool field_valid =
2468 std::is_convertible<
2472 if constexpr (field_valid)
2473 doAddFermionicMass(diracFermion, mass);
2476 getParticle(std::forward<FieldType>(diracFermion)),
2482 template<
class FieldType>
2485 std::string_view newName
2488 constexpr
bool field_valid =
2489 std::is_convertible<
2493 if constexpr(field_valid)
Interaction lagrangian of a model, allows to get all diagrams for a particular process by expanding i...
Definition: lagrangian.h:50
Definition: gaugedGroup.h:194
csl::Expr doGetCharge(mty::Particle const &particle, mty::Group const *group) const
Actually returns the charge representation of a particle for a U(1) group.
Definition: modelData.cpp:1157
void setGauge(std::unique_ptr< mty::Gauge > &&t_gauge)
Sets the gauge of the model.
Definition: modelData.cpp:658
std::vector< mty::Particle > particles
Particle content (including gauge bosons, ghosts etc) of the model.
Definition: modelData.h:1921
std::vector< mty::Particle > const & getParticles() const
Returns a const reference to the model's particles.
Definition: modelData.cpp:595
std::vector< csl::Tensor > const & getTensorCouplings() const
Returns the tensor couplings (Yukawa coupling typically) of the model.
Definition: modelData.cpp:638
mty::FlavorIrrep doGetFlavorIrrep(mty::Particle const &part) const
Actually returns the flavor representation of a particle.
Definition: modelData.cpp:1165
mty::Irrep getGroupIrrep(FieldType &&field, GroupType &&group) const
Returns the group representation of a field.
Definition: modelData.h:2054
static csl::Space const * defaultSpaceTime
Default space-time for the model's particles. There is actually no support for another space that csl...
Definition: modelData.h:73
mty::Particle getParticle(std::string_view t_name) const
Returns a particle in the model given a name.
Definition: modelData.cpp:1077
void addFermionicMass(FieldType1 &&left, FieldType2 &&right, std::string_view mass)
Adds a fermionic mass to the model.
Definition: modelData.h:2365
std::vector< csl::Index > generateIndices(size_t nIndices, GroupType &&group, FieldType &&field) const
Returns indices coresponding to the representation of a field in a given group.
Definition: modelData.h:2222
ModelData()
Default constructor.
Definition: modelData.cpp:28
void addParticle(mty::Particle const &part, bool initializeTerms=true)
Adds a particle to the model.
Definition: modelData.cpp:720
void checkValidity(mty::Particle const &part) const
Checks the validity of a particle when adding it to the model.
Definition: modelData.cpp:1277
std::unique_ptr< mty::Flavor > flavor
Flavor of the model.
Definition: modelData.h:1913
bool findParticle(std::string_view t_name) const
Searches a particle in the model.
Definition: modelData.cpp:884
void removeParticle(mty::Particle const &part)
Removes a particle from the model.
Definition: modelData.cpp:771
mty::Lagrangian L
Lagrangian of the model.
Definition: modelData.h:1894
bool findScalarCoupling(std::string_view t_name) const
Searches a scalar coupling in the model.
Definition: modelData.cpp:903
mty::Gauge * getGauge() const
Returns a pointer to the model's gauge.
Definition: modelData.cpp:585
This class inherits from std::shared_ptr<QuantumFieldParent> and should be used instead of direct Qua...
Definition: quantumField.h:1409
Namespace of MARTY.
Definition: 2HDM.h:31
static int defaultQuantumNumber
Default quantum number for particles when not given.
Definition: modelData.h:83
mty::QuantumNumber const & getQuantumNumber(std::string_view name) const
Returns a quantum number (const reference) given its name.
Definition: modelData.cpp:1248
mty::Irrep doGetGroupIrrep(mty::Particle const &part, mty::Group const *group) const
Actually returns the group representation of a particle.
Definition: modelData.cpp:1151
void renameCoupling(std::string_view name, std::string_view newName)
Renames a (scalar or tensor) coupling of the model.
Definition: modelData.cpp:1453
ModelData & operator=(ModelData &&other)=default
Defaulted move assignement operator.
void setEnableChecks(bool t_enable)
Sets enableChecks.
Definition: modelData.h:273
void addBosonicMass(FieldType &&field, std::string_view mass)
Adds a bosonic mass term to the model.
Definition: modelData.h:2326
static size_t nMomentums
Number of momenta instantiated for the model (10). With 5 maximum external legs, this is fairly safe...
Definition: modelData.h:68
class mty::AbstractGroup Group
Abstract base class for groups.
constexpr auto names
Names for topologies.
Definition: topology.h:72
std::vector< csl::Tensor > tensorCouplings
List of tensor couplings of the model.
Definition: modelData.h:1945
mty::Group const * getGroup(std::string_view t_name) const
Returns a Group (pointer to const) given its name.
Definition: modelData.cpp:943
csl::Expr getScalarCoupling(std::string_view t_name) const
Returns a scalar coupling given its name.
Definition: modelData.cpp:1117
void checkHermiticity()
Checks the hermiticity of the Lagrangian, i.e. checks if .
Definition: modelData.cpp:82
mty::GaugedGroup const * getGaugedGroup(std::string_view t_name) const
Returns a GaugedGroup (pointer to const) given its name.
Definition: modelData.cpp:992
mty::Generator getGenerator(GroupType &&group, FieldType &&field) const
Returns the generator coresponding to the representation of a field in a given group.
Definition: modelData.h:2292
mty::GaugeIrrep getGaugeIrrep(FieldType &&field) const
Returns the gauge representation of a field.
Definition: modelData.h:2007
void addQuantumNumber(std::string_view name, std::vector< mty::Particle > const &fields, std::vector< int > const &values, bool conserved=true)
Adds a new quantum number to a model, giving eigenvalues for particles also.
Definition: modelData.cpp:852
void addScalarCoupling(std::string_view t_name)
Adds a scalar coupling constant in the model.
Definition: modelData.cpp:820
bool findTensorCoupling(std::string_view t_name) const
Searches a tensor coupling in the model.
Definition: modelData.cpp:920
This class represents quantum numbers of a theory, like for example baryon number B...
Definition: quantumNumber.h:44
void renameParticle(FieldType &&field, std::string_view newName)
Renames a particle of the model.
Definition: modelData.h:2483
std::vector< mty::QuantumNumber > quantumNumbers
List of quantum numbers in the model.
Definition: modelData.h:1931
void addLagrangianTerm(csl::Expr const &term, bool addHermitic=false)
Adds a lagrangian term to the model.
Definition: modelData.cpp:1311
std::unique_ptr< mty::Gauge > gauge
Gauge of the model.
Definition: modelData.h:1908
csl::Index doGenerateIndex(mty::Group const *group, mty::Particle const &fieldRep) const
Actually returns a csl::Index corresponding to a particle's representation.
Definition: modelData.cpp:1205
mty::Flavor * getFlavor() const
Returns a pointer to the model's flavor.
Definition: modelData.cpp:590
void setFlavor(std::unique_ptr< mty::Flavor > &&t_flavor)
Sets the flavor of the model.
Definition: modelData.cpp:709
bool isEnableChecks() const
Definition: modelData.h:264
void addParticles(std::vector< mty::Particle > const &parts, bool initializeTerms=true)
Adds a list of particles to the model.
Definition: modelData.cpp:749
csl::Space const * spaceTime
Space time for the model.
Definition: modelData.h:1903
csl::Expr getCharge(FieldType &&field, GroupType &&group) const
Returns the charge representation of a field in a U(1) group.
Definition: modelData.h:2020
std::vector< csl::Expr > const & getScalarCouplings() const
Returns the scalar couplings (gauge coupling typically) of the model.
Definition: modelData.cpp:633
void initGaugedGroups(bool initGaugeTerms=true)
Initializes gauge terms (gauge bosons, ghosts) and fixes the gauge.
Definition: modelData.cpp:1577
csl::Space const * getSpaceTime() const
Returns a pointer to the space time of the mode (csl::Space).
Definition: modelData.cpp:580
Class deriving from csl::TensorFieldElement, may enter expressions. In contrary to QuantumFieldParent...
Definition: quantumField.h:1614
csl::Space const * getVectorSpace(GroupType &&group, FieldType &&field) const
Returns the vector space coresponding to the representation of a field in a given group...
Definition: modelData.h:2136
bool gaugeLocked
Boolean that tells if the gauge model is initilialized.
Definition: modelData.h:1956
csl::Tensor getTensorCoupling(std::string_view t_name) const
Returns a tensor coupling given its name.
Definition: modelData.cpp:1127
mty::Generator doGetGenerator(mty::Group const *group, mty::Particle const &fieldRep) const
Actually returns a generator corresponding to a particle's representation.
Definition: modelData.cpp:1238
void addFlavorGroup(std::string_view name, int nFlavor, bool complexFields=true)
Adds a flavor group to the model.
Definition: modelData.cpp:692
csl::Space const * doGetVectorSpace(mty::Group const *group, mty::Particle const &irrep) const
Actually returns the vector space corresponding to a particle's representation.
Definition: modelData.cpp:1189
void addGaugedGroup(group::Type type, std::string_view name, int dim, csl::Expr const &coupling=nullptr)
Adds a gauge group to the model.
Definition: modelData.cpp:666
void printSubPart(std::vector< std::string > const &particles, std::ostream &out=std::cout) const
Prints a sub part of the Lagrangian including some particles.
Definition: modelData.cpp:1483
void setQuantumNumbers(std::vector< mty::QuantumNumber > const &numbers)
Sets the quantum numbers of the model.
Definition: modelData.cpp:873
bool enableChecks
Boolean telling if checks must be done with lagrangian terms added to the model (gauge representation...
Definition: modelData.h:1964
void setSpaceTime(csl::Space const *t_spaceTime)
Sets the space time of the model.
Definition: modelData.cpp:647
std::vector< csl::Expr > scalarCouplings
Lists of scalar couplings of the model.
Definition: modelData.h:1938
csl::Index generateIndex(GroupType &&group, FieldType &&field) const
Returns an index coresponding to the representation of a field in a given group.
Definition: modelData.h:2169
mty::FlavorIrrep getFlavorIrrep(FieldType &&field) const
Returns the flavor representation of a field.
Definition: modelData.h:2088
Handles the irreducible representation of a given semi-simple algebra.
Definition: representation.h:42
void doRenameParticle(mty::Particle const &part, std::string_view newName)
Actually renames a particle.
Definition: modelData.cpp:1418
mty::GaugeIrrep doGetGaugeIrrep(mty::Particle const &part) const
Actually returns the gauge representation of a particle.
Definition: modelData.cpp:1147
The class ModelData contains all the necessary features to store and manipulate the content of a mode...
Definition: modelData.h:56
std::vector< mty::Particle > getPhysicalParticles(std::function< bool(mty::Particle)> const &predicate=[](mty::Particle) { return true;}) const
Returns a list of the physical particles in a model.
Definition: modelData.cpp:600
Base class for parents of QuantumField objects.
Definition: quantumField.h:152
void removeParticles(std::vector< mty::Particle > const &parts)
Removes particles from the model.
Definition: modelData.cpp:794
Contains the Lagrangian class, that encapsulates all interaction terms for a model.
Definition: generator.h:107
void init(bool initGaugeTerms=true)
Initializes the gauge once and for all. This function must be called after finishing the gauge...
Definition: modelData.cpp:1572
virtual ~ModelData()
Destructor.
Definition: modelData.cpp:66
std::vector< mty::QuantumNumber > const & getQuantumNumbers() const
Returns the list of quantum numbers.
Definition: modelData.cpp:624
Lagrangian const & getLagrangian() const
Returns a const reference to the Lagrangian.
Definition: modelData.cpp:575
Contains QuantumField and QuantumFieldParent, basic objects handling quantum fields as csl expression...
void addTensorCoupling(csl::Parent const &tensorCoupling)
Adds a tensor coupling constant in the model.
Definition: modelData.cpp:838
mty::FlavorGroup const * getFlavorGroup(std::string_view t_name) const
Returns a FlavorGroup (pointer) given its name.
Definition: modelData.cpp:1015
Type
Enumeration of types of semi simple Lie groups. The names being very small, we use a namespace to avo...
Definition: group.h:44
friend std::ostream & operator<<(std::ostream &out, ModelData const &model)
Prints the model.
Definition: modelData.cpp:1522