Logo ROOT  
Reference Guide
feynman.C File Reference

Detailed Description

View in nbviewer Open in SWAN Draw Feynman diagrams.

void feynman()
{
TCanvas *c1 = new TCanvas("c1", "A canvas", 10,10, 600, 300);
c1->Range(0, 0, 140, 60);
Int_t linsav = gStyle->GetLineWidth();
TLatex t;
t.SetTextAlign(22);
t.SetTextSize(0.1);
TLine * l;
l = new TLine(10, 10, 30, 30); l->Draw();
l = new TLine(10, 50, 30, 30); l->Draw();
TCurlyArc *ginit = new TCurlyArc(30, 30, 12.5*sqrt(2), 135, 225);
ginit->SetWavy();
ginit->Draw();
t.DrawLatex(7,6,"e^{-}");
t.DrawLatex(7,55,"e^{+}");
t.DrawLatex(7,30,"#gamma");
TCurlyLine *Gamma = new TCurlyLine(30, 30, 55, 30);
Gamma->SetWavy();
Gamma->Draw();
t.DrawLatex(42.5,37.7,"#gamma");
TArc *a = new TArc(70, 30, 15);
a->Draw();
t.DrawLatex(55, 45,"#bar{q}");
t.DrawLatex(85, 15,"q");
TCurlyLine *gluon = new TCurlyLine(70, 45, 70, 15);
gluon->Draw();
t.DrawLatex(77.5,30,"g");
TCurlyLine *z0 = new TCurlyLine(85, 30, 110, 30);
z0->SetWavy();
z0->Draw();
t.DrawLatex(100, 37.5,"Z^{0}");
l = new TLine(110, 30, 130, 10); l->Draw();
l = new TLine(110, 30, 130, 50); l->Draw();
TCurlyArc *gluon1 = new TCurlyArc(110, 30, 12.5*sqrt(2), 315, 45);
gluon1->Draw();
t.DrawLatex(135,6,"#bar{q}");
t.DrawLatex(135,55,"q");
t.DrawLatex(135,30,"g");
c1->Update();
gStyle->SetLineWidth(linsav);
}
int Int_t
Definition: RtypesCore.h:41
double sqrt(double)
R__EXTERN TStyle * gStyle
Definition: TStyle.h:407
Create an Arc.
Definition: TArc.h:28
virtual Width_t GetLineWidth() const
Return the line width.
Definition: TAttLine.h:35
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:43
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition: TAttText.h:41
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition: TAttText.h:46
The Canvas class.
Definition: TCanvas.h:31
Implements curly or wavy arcs used to draw Feynman diagrams.
Definition: TCurlyArc.h:20
Implements curly or wavy polylines used to draw Feynman diagrams.
Definition: TCurlyLine.h:21
virtual void SetWavy()
Set wavy.
Definition: TCurlyLine.cxx:369
To draw Mathematical Formula.
Definition: TLatex.h:18
TLatex * DrawLatex(Double_t x, Double_t y, const char *text)
Make a copy of this object with the new parameters And copy object attributes.
Definition: TLatex.cxx:1914
A simple line.
Definition: TLine.h:23
virtual void Draw(Option_t *option="")
Draw this polyline with its current attributes.
Definition: TPolyLine.cxx:232
return c1
Definition: legend1.C:41
Double_t Gamma(Double_t z)
Computation of gamma(z) for all z.
Definition: TMath.cxx:348
static int ginit
Definition: rsalib.cxx:256
auto * l
Definition: textangle.C:4
auto * a
Definition: textangle.C:12
Author
Otto Schaile

Definition in file feynman.C.