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