ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
feynman.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_graphics
3 /// Draw Feynman diagrams.
4 ///
5 /// \macro_image
6 /// \macro_code
7 ///
8 /// \author Otto Schaile
9 
10 void feynman()
11 {
12  TCanvas *c1 = new TCanvas("c1", "A canvas", 10,10, 600, 300);
13  c1->Range(0, 0, 140, 60);
14  Int_t linsav = gStyle->GetLineWidth();
15  gStyle->SetLineWidth(3);
16  TLatex t;
17  t.SetTextAlign(22);
18  t.SetTextSize(0.1);
19  TLine * l;
20  l = new TLine(10, 10, 30, 30); l->Draw();
21  l = new TLine(10, 50, 30, 30); l->Draw();
22  TCurlyArc *ginit = new TCurlyArc(30, 30, 12.5*sqrt(2), 135, 225);
23  ginit->SetWavy();
24  ginit->Draw();
25  t.DrawLatex(7,6,"e^{-}");
26  t.DrawLatex(7,55,"e^{+}");
27  t.DrawLatex(7,30,"#gamma");
28 
29  TCurlyLine *gamma = new TCurlyLine(30, 30, 55, 30);
30  gamma->SetWavy();
31  gamma->Draw();
32  t.DrawLatex(42.5,37.7,"#gamma");
33 
34  TArc *a = new TArc(70, 30, 15);
35  a->Draw();
36  t.DrawLatex(55, 45,"#bar{q}");
37  t.DrawLatex(85, 15,"q");
38  TCurlyLine *gluon = new TCurlyLine(70, 45, 70, 15);
39  gluon->Draw();
40  t.DrawLatex(77.5,30,"g");
41 
42  TCurlyLine *z0 = new TCurlyLine(85, 30, 110, 30);
43  z0->SetWavy();
44  z0->Draw();
45  t.DrawLatex(100, 37.5,"Z^{0}");
46 
47  l = new TLine(110, 30, 130, 10); l->Draw();
48  l = new TLine(110, 30, 130, 50); l->Draw();
49 
50  TCurlyArc *gluon1 = new TCurlyArc(110, 30, 12.5*sqrt(2), 315, 45);
51  gluon1->Draw();
52 
53  t.DrawLatex(135,6,"#bar{q}");
54  t.DrawLatex(135,55,"q");
55  t.DrawLatex(135,30,"g");
56  c1->Update();
57  gStyle->SetLineWidth(linsav);
58 }
virtual void SetLineWidth(Width_t lwidth)
Definition: TAttLine.h:57
R__EXTERN TStyle * gStyle
Definition: TStyle.h:423
int Int_t
Definition: RtypesCore.h:41
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:254
double sqrt(double)
Implements curly or wavy polylines used to draw Feynman diagrams.
Definition: TCurlyLine.h:32
To draw Mathematical Formula.
Definition: TLatex.h:33
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:1901
virtual void Draw(Option_t *option="")
Draw this ellipse with its current attributes.
Definition: TEllipse.cxx:167
virtual void SetTextAlign(Short_t align=11)
Definition: TAttText.h:55
Create an Arc.
Definition: TArc.h:29
TThread * t[5]
Definition: threadsh1.C:13
virtual void Draw(Option_t *option="")
Draw this polyline with its current attributes.
Definition: TPolyLine.cxx:232
virtual void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Set world coordinate system for the pad.
Definition: TPad.cxx:4623
A simple line.
Definition: TLine.h:41
TLine * l
Definition: textangle.C:4
The Canvas class.
Definition: TCanvas.h:48
virtual void SetWavy()
Set wavy.
Definition: TCurlyLine.cxx:370
virtual void SetTextSize(Float_t tsize=1)
Definition: TAttText.h:60
virtual void Update()
Update canvas pad buffers.
Definition: TCanvas.cxx:2179
virtual Width_t GetLineWidth() const
Definition: TAttLine.h:49
Implements curly or wavy arcs used to draw Feynman diagrams.
Definition: TCurlyArc.h:25