Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
mrtInterface.h
Go to the documentation of this file.
1 // This file is part of MARTY.
2 //
3 // MARTY is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // MARTY is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with MARTY. If not, see <https://www.gnu.org/licenses/>.
15 
21 #ifndef HEPINTERFACE_H_INCLUDED
22 #define HEPINTERFACE_H_INCLUDED
23 
24 #include "model.h"
25 #include "insertion.h"
26 
27 namespace mty {
28 
29 template<class Type>
30 struct enable_model {
31  using type = typename std::enable_if<
32  std::is_same<
33  mty::Model,
34  std::remove_reference<std::remove_cv<Type>>>::value
35  >::type;
36 };
37 
38 template<class Type>
39 struct disable_model {
40  using type = typename std::enable_if<
41  not std::is_same<
42  mty::Model,
43  std::remove_reference<std::remove_cv<Type>>>::value
44  >::type;
45 };
46 
47 class Insertion;
48 
49 
51 /*************************************************/
52 // Expression utilities //
53 /*************************************************/
55 
76 csl::Tensor MinkowskiVector(std::string const& name);
77 
93 csl::Index MinkowskiIndex(std::string const& name = "");
94 
108 std::vector<csl::Index> DiracIndices(size_t n, std::string const& name = "");
109 
123 std::vector<csl::Index> MinkowskiIndices(size_t n, std::string const& name = "");
124 
140 csl::Index DiracIndex(std::string const& name = "");
141 
165 template<class GroupType, class FieldType>
166 csl::Index GaugeIndex(std::string const& nameIndex,
167  mty::Model const& model,
168  GroupType && group,
169  FieldType && part)
170 {
171  return model.generateIndex<GroupType, FieldType>(
172  nameIndex,
173  std::forward<GroupType>(group),
174  std::forward<FieldType>(part)
175  );
176 }
177 
191 template<class GroupType>
193  GroupType && group)
194 {
195  return model.generateIndex(
196  std::forward<GroupType>(group)
197  );
198 }
199 
213 template<class GroupType>
214 std::vector<csl::Index> FlavorIndices(
215  size_t nIndices,
216  mty::Model const& model,
217  GroupType && group)
218 {
219  std::vector<csl::Index> indices(nIndices);
220  for (size_t i = 0; i != nIndices; ++i)
221  indices[i] = FlavorIndex<GroupType>(
222  model,
223  std::forward<GroupType>(group)
224  );
225 
226  return indices;
227 }
228 
229 
252 template<class GroupType, class FieldType>
254  GroupType && group,
255  FieldType && part)
256 {
257  return model.generateIndex<GroupType, FieldType>(
258  std::forward<GroupType>(group),
259  std::forward<FieldType>(part)
260  );
261 }
262 
286 template<class GroupType, class FieldType>
287 std::vector<csl::Index> GaugeIndices(
288  size_t nIndices,
289  mty::Model const& model,
290  GroupType && group,
291  FieldType && part)
292 {
293  std::vector<csl::Index> indices(nIndices);
294  for (size_t i = 0; i != nIndices; ++i)
295  indices[i] = GaugeIndex<GroupType, FieldType>(
296  model,
297  std::forward<GroupType>(group),
298  std::forward<FieldType>(part)
299  );
300 
301  return indices;
302 }
303 
321 const csl::Space* VectorSpace(
322  mty::Model const& model,
323  std::string const& nameGroup,
324  Particle const& part
325  );
326 
337  csl::Space const *space,
338  std::string const &name = ""
339  );
340 
357 csl::Tensor Delta(const csl::Space* space);
358 
377 csl::Tensor Metric(const csl::Space* space);
378 
396 csl::Tensor Epsilon(const csl::Space* space);
397 
418 
427 inline
429 {
430  return (chir == Chirality::Left) ? DiracPL() : DiracPR();
431 }
432 
433 csl::Tensor DiracCMatrix();
434 
449 template<class GroupType, class FieldType>
451  mty::Model &model,
452  GroupType &&group,
453  FieldType &&field
454  )
455 {
456  return model.getGenerator(
457  std::forward<GroupType>(group),
458  std::forward<FieldType>(field)
459  );
460 }
461 
476 template<class GroupType, class FieldType>
478  mty::Model &model,
479  GroupType &&group,
480  FieldType &&field
481  )
482 {
483  return model.getVectorSpace(
484  std::forward<GroupType>(group),
485  std::forward<FieldType>(field)
486  );
487 }
488 
490 /*************************************************/
491 // Computation utilities //
492 /*************************************************/
494 
495 Amplitude SelfEnergy(
496  mty::Order order,
497  mty::Particle &particle,
498  mty::Model &model);
499 
500 Amplitude SelfEnergy(
501  mty::Particle &particle,
502  mty::Model &model);
503 
504 csl::Expr ComputeSquaredAmplitude(
505  mty::Model &model,
506  Amplitude const &ampl
507  );
508 
509 std::vector<FeynmanRule> ComputeFeynmanRules(mty::Model& model);
510 
511 void ContractIndices(csl::Expr &init);
512 
513 void ContractIndices(std::vector<csl::Expr> &init);
514 
515 void Display(std::vector<FeynmanRule> const& rules,
516  std::ostream & out = std::cout);
517 
518 
519 void Display(std::vector<csl::Expr> const& amplitudes,
520  std::ostream & out = std::cout,
521  bool simplify = false);
522 void Display(mty::Amplitude const& amplitudes,
523  std::ostream & out = std::cout,
524  bool simplify = false);
525 
526 void Display(WilsonSet const& wilsons,
527  std::ostream & out = std::cout);
528 
529 void Show(std::vector<FeynmanRule> const& rules);
530 void Show(std::vector<std::shared_ptr<wick::Graph>> const& diagrams);
531 void Show(mty::Amplitude const& diagrams);
532 void Show(WilsonSet const &wilsons);
533 
534 void Show(
535  std::vector<FeynmanRule> const& rules,
536  size_t first,
537  size_t last
538  );
539 void Show(
540  std::vector<std::shared_ptr<wick::Graph>> const& diagrams,
541  size_t first,
542  size_t last
543  );
544 void Show(
545  mty::Amplitude const& diagrams,
546  size_t first,
547  size_t last
548  );
549 void Show(
550  WilsonSet const &wilsons,
551  size_t first,
552  size_t last
553  );
554 
555 template<class T>
556 void Display(T const& printable,
557  std::ostream& out = std::cout)
558 {
559  out << printable << std::endl;
560 }
561 
562 void DisplayAbbreviations(std::ostream &out = std::cout);
563 void DisplayAbbreviations(std::string const &name,
564  std::ostream &out = std::cout);
565 
566 void ExportPDF(std::string const& nameFiles,
567  std::vector<std::shared_ptr<wick::Graph>> const& graphs);
568 
569 void ExportPDF(std::string const& nameFiles,
570  std::vector<FeynmanRule> const& rules);
571 
572 void ExportPNG(std::string const& nameFiles,
573  std::vector<std::shared_ptr<wick::Graph>> const& graphs);
574 
575 void ExportPNG(std::string const& nameFiles,
576  std::vector<FeynmanRule> const& rules);
577 
579 /*************************************************/
580 // Model building utilities //
581 /*************************************************/
583 
584 template<class ...Args>
585 void AddGaugedGroup(
586  mty::Model &model,
587  Args &&...args
588  )
589 {
590  model.addGaugedGroup(std::forward<Args>(args)...);
591 }
592 
593 template<class ...Args>
594 void AddFlavorGroup(
595  mty::Model &model,
596  Args &&...args
597  )
598 {
599  model.addFlavorGroup(std::forward<Args>(args)...);
600 }
601 
602 void AddParticle(mty::Model & model,
603  mty::Particle& particle,
604  bool initTerms = true);
605 
606 void AddTerm(mty::Model& model,
607  csl::Expr const& term,
608  bool addCC = false);
609 
610 void AddTerm(mty::Model& model,
611  std::vector<csl::Expr> const& terms,
612  bool addCC = false);
613 
614 mty::Particle GetParticle(mty::Model const& model,
615  std::string const& name);
616 
617 csl::Expr GetMass(mty::Particle const& particle);
618 
619 mty::Particle GenerateSimilarParticle(std::string const& name,
620  mty::Particle const& particle);
621 
622 mty::Particle GetFieldStrength(Particle const& particle);
623 
624 void PromoteGoldstone(mty::Model & model,
625  mty::Particle& goldstone,
626  mty::Particle& gaugeBoson);
627 
628 void PromoteGoldstone(mty::Model & model,
629  char const* goldstone,
630  char const* gaugeBoson);
631 
632 csl::Expr GetCoupling(mty::Model const& model,
633  std::string const& nameCoupling);
634 
635 csl::Tensor GetYukawa(mty::Model const& model,
636  std::string const& nameCoupling);
637 
638 void Rename(mty::Model & model,
639  std::string const& oldName,
640  std::string const& newName);
641 
642 template<class ...Args>
643 void SetMass(Particle & part,
644  Args && ...args)
645 {
646  part->setMass(std::forward<Args>(args)...);
647 }
648 
649 template<class ...Args>
650 void SetWidth(Particle & part,
651  Args && ...args)
652 {
653  part->setWidth(std::forward<Args>(args)...);
654 }
655 
656 void SetSelfConjugate(Particle & part,
657  bool selfConjugate);
658 
659 void SetGroupRep(mty::Particle & part,
660  std::string const& nameGroup,
661  std::vector<int> const& highestWeight);
662 void SetGroupRep(mty::Particle & part,
663  std::string const& nameGroup,
664  int charge);
665 void SetFlavorRep(mty::Particle & part,
666  std::string const& nameGroup);
667 
668 void Init(mty::Model & model);
669 
677 void Replaced(mty::Model& model,
678  csl::Expr const& init,
679  csl::Expr const& target);
680 
690 void Replaced(mty::Model & model,
691  csl::Tensor& init,
692  csl::Expr const& target);
693 
701 void Replaced(mty::Model & model,
702  csl::Tensor& init,
703  csl::Tensor& target);
704 
713 void Replaced(mty::Model & model,
714  Particle const& particle,
715  csl::Expr const& newTerm);
716 
766 void Rotate(mty::Model & model,
767  std::vector<mty::Particle> const& fields,
768  std::vector<mty::Particle> const& newFields,
769  std::vector<std::vector<csl::Expr>> const& rotation,
770  bool diagonalizeMasses = false);
771 
783 void Rotate(mty::Model & model,
784  std::vector<std::string> const& fields,
785  std::vector<std::string> const& newFields,
786  std::vector<std::vector<csl::Expr>> const& rotation,
787  bool diagonalizeMasses = false);
788 
789 void DiagonalizeMassMatrices(mty::Model& model);
790 
791 void BreakGaugeSymmetry(
792  mty::Model & model,
793  std::string const& brokenGroup,
794  std::vector<Particle> const& brokenFields,
795  std::vector<std::vector<std::string>> const& newNames
796  );
797 
798 void BreakGaugeSymmetry(
799  mty::Model & model,
800  std::string const& brokenGroup,
801  std::initializer_list<std::string> const& brokenFields,
802  std::vector<std::vector<std::string>> const& newNames
803  );
804 
805 void BreakFlavorSymmetry(
806  mty::Model & model,
807  std::string const& brokenFlavor,
808  std::initializer_list<std::string> const& brokenFields,
809  std::vector<std::vector<std::string>> const& newNames
810  );
811 
812 void BreakFlavorSymmetry(
813  mty::Model & model,
814  std::string const& brokenFlavor,
815  std::vector<mty::Particle> const& brokenFields,
816  std::vector<std::vector<std::string>> const& newNames
817  );
818 
819 template<class ...Args>
820 void BreakGaugeSymmetry(
821  mty::Model &model,
822  Args &&...args
823  )
824 {
825  model.breakGaugeSymmetry(std::forward<Args>(args)...);
826 }
827 
828 template<class ...Args>
829 void BreakFlavorSymmetry(
830  mty::Model &model,
831  Args &&...args
832  )
833 {
834  model.breakFlavorSymmetry(std::forward<Args>(args)...);
835 }
836 
837 void Refreshed(mty::Model & model);
838 
839 void IntegrateOutParticle(
840  mty::Particle & particle,
841  bool value = true);
842 
844 /*************************************************/
845 // Group theory //
846 /*************************************************/
848 
849 
879 std::unique_ptr<mty::SemiSimpleAlgebra> CreateAlgebra(
880  algebra::Type type,
881  int l = -1);
882 
883 mty::Irrep GetIrrep(mty::SemiSimpleAlgebra const* algebra,
884  std::vector<int> const& labels);
885 
886 mty::Irrep GetIrrep(std::unique_ptr<mty::SemiSimpleAlgebra> const& algebra,
887  std::vector<int> const& labels);
888 
889 mty::Irrep GetConjugateRep(mty::Irrep const& rep);
890 
891 mty::SemiSimpleAlgebra const* GetAlgebraOf(Irrep const& rep);
892 
893 int GetDimension(mty::Irrep const& irrep);
894 
895 bool ContainsIrrep(mty::SumIrrep const& decomposition,
896  mty::Irrep const& irrep);
897 
898 bool ContainsTrivialrep(mty::SumIrrep const& decomposition);
899 
916 void SetGaugeChoice(mty::Model & model,
917  std::string const& nameParticle,
918  mty::gauge::Type choice);
919 
920 
935 void SetGaugeChoice(mty::Particle particle,
936  mty::gauge::Type choice);
937 
938 std::string FindProcessName(
939  std::string const &initName,
940  std::vector<mty::Insertion> const &insertions
941  );
942 
943 }
944 
945 #endif
csl::Space const * GetVectorSpace(mty::Model &model, GroupType &&group, FieldType &&field)
Returns the vector space corresponding the the representation of a given field in a given group...
Definition: mrtInterface.h:477
void Replaced(mty::Model &model, csl::Expr const &init, csl::Expr const &target)
Replaces an expression in all kinetic / mass / interactions terms of a model.
Definition: mrtInterface.cpp:499
csl::Tensor Delta(const csl::Space *space)
Returns the Kronecker delta of a given vector space.
Definition: mrtInterface.cpp:116
csl::Index DiracIndex(std::string const &name="")
Returns a csl::Index in the 4-dimensional Dirac space mty::dirac4.
Definition: mrtInterface.cpp:44
csl::Tensor Epsilon(const csl::Space *space)
Returns the epsilon symbol of a given vector space.
Definition: mrtInterface.cpp:126
mty::Generator GetGenerator(mty::Model &model, GroupType &&group, FieldType &&field)
Returns the generator coresponding to the representation of a field in a given group.
Definition: mrtInterface.h:450
csl::Tensor DiracProjector(Chirality chir)
Returns a projector in Dirac 4-dim space depending on a chirality.
Definition: mrtInterface.h:428
std::vector< csl::Index > MinkowskiIndices(size_t n, std::string const &name="")
Returns indices in csl::Minkowki space.
Definition: mrtInterface.cpp:51
csl::Tensor DiracGamma5()
Definition: mrtInterface.cpp:134
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
Contains the mty::Model class. It contains all objects in the theory. In particular QuantumField obje...
Contains a sum of Irrep (irreducible representation) of a given SemiSimpleAlgebra.
Definition: representation.h:363
std::vector< csl::Index > DiracIndices(size_t n, std::string const &name="")
Returns indices in the 4-dimensional Dirac space mty::dirac4.
Definition: mrtInterface.cpp:62
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
std::vector< csl::Index > FlavorIndices(size_t nIndices, mty::Model const &model, GroupType &&group)
Returns indices for a given flavor group.
Definition: mrtInterface.h:214
csl::Tensor Metric(const csl::Space *space)
Returns the metric of a given vector space.
Definition: mrtInterface.cpp:121
Interface class containing the result of an amplitude calculation.
Definition: amplitude.h:41
Chirality
Chirality for fermions. Either Left or Right for WeylFermion, or None for DiracFermion.
Definition: quantumField.h:40
Definition: wilson.h:121
Type
Different types of semi-simple Lie algebras.
Definition: semiSimpleAlgebra.h:52
csl::Index GenerateIndex(csl::Space const *space, std::string const &name="")
Generates an index in a given space.
Definition: mrtInterface.cpp:106
csl::Index GaugeIndex(std::string const &nameIndex, mty::Model const &model, GroupType &&group, FieldType &&part)
Returns a csl::Index living in the representation of a certain field in a certain group...
Definition: mrtInterface.h:166
Abstract base class for all semi-simple Lie algebras.
Definition: semiSimpleAlgebra.h:96
csl::Tensor DiracPL()
Definition: mrtInterface.cpp:140
Definition: insertion.h:33
csl::Tensor DiracSigma()
Definition: mrtInterface.cpp:137
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
Definition: mrtInterface.h:39
void addFlavorGroup(std::string_view name, int nFlavor, bool complexFields=true)
Adds a flavor group to the model.
Definition: modelData.cpp:692
Expr Refreshed(const Abstract *expr)
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
csl::Index MinkowskiIndex(std::string const &name="")
Returns a csl::Index in csl::Minkowki space.
Definition: mrtInterface.cpp:37
csl::Tensor DiracPR()
Definition: mrtInterface.cpp:143
csl::Tensor DiracGamma()
Definition: mrtInterface.cpp:131
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
csl::Tensor MinkowskiVector(std::string const &name)
Returns a csl::Tensor, vector in csl::Minkowski space.
Definition: mrtInterface.cpp:32
Handles the irreducible representation of a given semi-simple algebra.
Definition: representation.h:42
Type
Different types of gauge ficing parameter for gauge boson propagators.
Definition: gaugedGroup.h:92
void Rotate(mty::Model &model, std::vector< mty::Particle > const &fields, std::vector< mty::Particle > const &newFields, std::vector< std::vector< csl::Expr >> const &rotation, bool diagonalizeMasses=false)
Rotates a bunch of fields to another using a given matrix.
Definition: mrtInterface.cpp:527
csl::Index FlavorIndex(mty::Model const &model, GroupType &&group)
Returns a csl::Index for a given flavor group.
Definition: mrtInterface.h:192
Contains all objects in the theory. In particular QuantumField objects, Gauge, Flavor, Particle...
Definition: model.h:68
void SetGaugeChoice(mty::Model &model, std::string const &nameParticle, mty::gauge::Type choice)
This function changes the gauge fixing parameter for the gauge boson of name nameGroup. Depending on this choice, the propagator of gauge bosons is modified.
Definition: mrtInterface.cpp:705
void simplify(csl::Expr &expr, std::vector< mty::QuantumField > const &insertions, std::vector< csl::Tensor > const &momenta, mty::FeynOptions const &options, Mode mode)
Main simplification routine of MARTY, used for amplitudes, squared amplitude and Wilson coefficients...
Definition: amplitudeSimplification.cpp:1028
std::vector< csl::Index > GaugeIndices(size_t nIndices, mty::Model const &model, GroupType &&group, FieldType &&part)
Returns indices living in the representation of a certain field in a certain group.
Definition: mrtInterface.h:287
std::unique_ptr< mty::SemiSimpleAlgebra > CreateAlgebra(algebra::Type type, int l=-1)
Creates a specilization of SemiSimpleAlgebra of type type.
Definition: mrtInterface.cpp:620
Definition: generator.h:107
Definition: mrtInterface.h:30
const csl::Space * VectorSpace(mty::Model const &model, std::string const &nameGroup, Particle const &part)
Returns the vector space corresponding to the representation of a given particle in a given group...
Definition: mrtInterface.cpp:97