Logo ROOT  
Reference Guide
quarks.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_graphics
3/// \notebook
4/// Example illustrating divided pads and Latex.
5///
6/// \macro_image
7/// \macro_code
8///
9/// \author Rene Brun
10
11void quarks () {
12 TCanvas *c1 = new TCanvas("c1", "c1",10,10,630,760);
13 c1->SetFillColor(kBlack);
14 Int_t quarkColor = 50;
15 Int_t leptonColor = 16;
16 Int_t forceColor = 38;
17 Int_t titleColor = kYellow;
18 Int_t border = 8;
19
20 TLatex *texf = new TLatex(0.90,0.455,"Force Carriers");
21 texf->SetTextColor(forceColor);
22 texf->SetTextAlign(22); texf->SetTextSize(0.07);
23 texf->SetTextAngle(90);
24 texf->Draw();
25
26 TLatex *texl = new TLatex(0.11,0.288,"Leptons");
27 texl->SetTextColor(leptonColor);
28 texl->SetTextAlign(22); texl->SetTextSize(0.07);
29 texl->SetTextAngle(90);
30 texl->Draw();
31
32 TLatex *texq = new TLatex(0.11,0.624,"Quarks");
33 texq->SetTextColor(quarkColor);
34 texq->SetTextAlign(22); texq->SetTextSize(0.07);
35 texq->SetTextAngle(90);
36 texq->Draw();
37
38 TLatex tex(0.5,0.5,"u");
39 tex.SetTextColor(titleColor); tex.SetTextFont(32);
40 tex.SetTextAlign(22);
41 tex.SetTextSize(0.14);
42 tex.DrawLatex(0.5,0.93,"Elementary");
43 tex.SetTextSize(0.12);
44 tex.DrawLatex(0.5,0.84,"Particles");
45 tex.SetTextSize(0.05);
46 tex.DrawLatex(0.5,0.067,"Three Generations of Matter");
47
48 tex.SetTextColor(kBlack); tex.SetTextSize(0.8);
49
50// Create main pad and its subdivisions
51 TPad *pad = new TPad("pad", "pad",0.15,0.11,0.85,0.79);
52 pad->Draw();
53 pad->cd();
54 pad->Divide(4,4,0.0003,0.0003);
55
56 pad->cd(1); gPad->SetFillColor(quarkColor);
57 gPad->SetBorderSize(border);
58 tex.DrawLatex(.5,.5,"u");
59
60 pad->cd(2); gPad->SetFillColor(quarkColor);
61 gPad->SetBorderSize(border);
62 tex.DrawLatex(.5,.5,"c");
63
64 pad->cd(3); gPad->SetFillColor(quarkColor);
65 gPad->SetBorderSize(border);
66 tex.DrawLatex(.5,.5,"t");
67
68 pad->cd(4); gPad->SetFillColor(forceColor);
69 gPad->SetBorderSize(border);
70 tex.DrawLatex(.5,.55,"#gamma");
71
72 pad->cd(5); gPad->SetFillColor(quarkColor);
73 gPad->SetBorderSize(border);
74 tex.DrawLatex(.5,.5,"d");
75
76 pad->cd(6); gPad->SetFillColor(quarkColor);
77 gPad->SetBorderSize(border);
78 tex.DrawLatex(.5,.5,"s");
79
80 pad->cd(7); gPad->SetFillColor(quarkColor);
81 gPad->SetBorderSize(border);
82 tex.DrawLatex(.5,.5,"b");
83
84 pad->cd(8); gPad->SetFillColor(forceColor);
85 gPad->SetBorderSize(border);
86 tex.DrawLatex(.5,.55,"g");
87
88 pad->cd(9); gPad->SetFillColor(leptonColor);
89 gPad->SetBorderSize(border);
90 tex.DrawLatex(.5,.5,"#nu_{e}");
91
92 pad->cd(10); gPad->SetFillColor(leptonColor);
93 gPad->SetBorderSize(border);
94 tex.DrawLatex(.5,.5,"#nu_{#mu}");
95
96 pad->cd(11); gPad->SetFillColor(leptonColor);
97 gPad->SetBorderSize(border);
98 tex.DrawLatex(.5,.5,"#nu_{#tau}");
99
100 pad->cd(12); gPad->SetFillColor(forceColor);
101 gPad->SetBorderSize(border);
102 tex.DrawLatex(.5,.5,"Z");
103
104 pad->cd(13); gPad->SetFillColor(leptonColor);
105 gPad->SetBorderSize(border);
106 tex.DrawLatex(.5,.5,"e");
107
108 pad->cd(14); gPad->SetFillColor(leptonColor);
109 gPad->SetBorderSize(border);
110 tex.DrawLatex(.5,.56,"#mu");
111
112 pad->cd(15); gPad->SetFillColor(leptonColor);
113 gPad->SetBorderSize(border);
114 tex.DrawLatex(.5,.5,"#tau");
115
116 pad->cd(16); gPad->SetFillColor(forceColor);
117 gPad->SetBorderSize(border);
118 tex.DrawLatex(.5,.5,"W");
119
120 c1->cd();
121}
int Int_t
Definition: RtypesCore.h:41
@ kBlack
Definition: Rtypes.h:63
@ kYellow
Definition: Rtypes.h:64
#define gPad
Definition: TVirtualPad.h:286
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition: TAttText.h:41
virtual void SetTextAngle(Float_t tangle=0)
Set the text angle.
Definition: TAttText.h:42
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition: TAttText.h:43
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition: TAttText.h:46
The Canvas class.
Definition: TCanvas.h:31
To draw Mathematical Formula.
Definition: TLatex.h:18
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:195
The most important graphics class in the ROOT system.
Definition: TPad.h:29
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
Definition: TPad.cxx:1163
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
Definition: TPad.cxx:1282
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
Definition: TPad.cxx:591
return c1
Definition: legend1.C:41