Logo ROOT   6.08/07
Reference Guide
feynman.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_graphics
3 /// \notebook
4 /// Draw Feynman diagrams.
5 ///
6 /// \macro_image
7 /// \macro_code
8 ///
9 /// \author Otto Schaile
10 
11 void feynman()
12 {
13  TCanvas *c1 = new TCanvas("c1", "A canvas", 10,10, 600, 300);
14  c1->Range(0, 0, 140, 60);
15  Int_t linsav = gStyle->GetLineWidth();
16  gStyle->SetLineWidth(3);
17  TLatex t;
18  t.SetTextAlign(22);
19  t.SetTextSize(0.1);
20  TLine * l;
21  l = new TLine(10, 10, 30, 30); l->Draw();
22  l = new TLine(10, 50, 30, 30); l->Draw();
23  TCurlyArc *ginit = new TCurlyArc(30, 30, 12.5*sqrt(2), 135, 225);
24  ginit->SetWavy();
25  ginit->Draw();
26  t.DrawLatex(7,6,"e^{-}");
27  t.DrawLatex(7,55,"e^{+}");
28  t.DrawLatex(7,30,"#gamma");
29 
30  TCurlyLine *Gamma = new TCurlyLine(30, 30, 55, 30);
31  Gamma->SetWavy();
32  Gamma->Draw();
33  t.DrawLatex(42.5,37.7,"#gamma");
34 
35  TArc *a = new TArc(70, 30, 15);
36  a->Draw();
37  t.DrawLatex(55, 45,"#bar{q}");
38  t.DrawLatex(85, 15,"q");
39  TCurlyLine *gluon = new TCurlyLine(70, 45, 70, 15);
40  gluon->Draw();
41  t.DrawLatex(77.5,30,"g");
42 
43  TCurlyLine *z0 = new TCurlyLine(85, 30, 110, 30);
44  z0->SetWavy();
45  z0->Draw();
46  t.DrawLatex(100, 37.5,"Z^{0}");
47 
48  l = new TLine(110, 30, 130, 10); l->Draw();
49  l = new TLine(110, 30, 130, 50); l->Draw();
50 
51  TCurlyArc *gluon1 = new TCurlyArc(110, 30, 12.5*sqrt(2), 315, 45);
52  gluon1->Draw();
53 
54  t.DrawLatex(135,6,"#bar{q}");
55  t.DrawLatex(135,55,"q");
56  t.DrawLatex(135,30,"g");
57  c1->Update();
58  gStyle->SetLineWidth(linsav);
59 }
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:49
return c1
Definition: legend1.C:41
R__EXTERN TStyle * gStyle
Definition: TStyle.h:418
int Int_t
Definition: RtypesCore.h:41
TArc * a
Definition: textangle.C:12
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:255
Double_t Gamma(Double_t z)
Computation of gamma(z) for all z.
Definition: TMath.cxx:352
virtual Width_t GetLineWidth() const
Return the line width.
Definition: TAttLine.h:41
double sqrt(double)
Implements curly or wavy polylines used to draw Feynman diagrams.
Definition: TCurlyLine.h:30
To draw Mathematical Formula.
Definition: TLatex.h:25
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
virtual void Draw(Option_t *option="")
Draw this ellipse with its current attributes.
Definition: TEllipse.cxx:167
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition: TAttText.h:47
Create an Arc.
Definition: TArc.h:29
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:4654
A simple line.
Definition: TLine.h:33
TLine * l
Definition: textangle.C:4
The Canvas class.
Definition: TCanvas.h:41
virtual void SetWavy()
Set wavy.
Definition: TCurlyLine.cxx:370
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition: TAttText.h:52
virtual void Update()
Update canvas pad buffers.
Definition: TCanvas.cxx:2183
Implements curly or wavy arcs used to draw Feynman diagrams.
Definition: TCurlyArc.h:22
static int ginit
Definition: rsalib.cxx:256