ROOT
6.30.04
Reference Guide
All
Namespaces
Files
Pages
first.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_graphics
3
/// \notebook -js
4
/// Show some basic primitives.
5
///
6
/// \macro_image
7
/// \macro_code
8
///
9
/// \author Rene Brun
10
11
void
first() {
12
13
TCanvas *nut =
new
TCanvas(
"nut"
,
"FirstSession"
,100,10,700,900);
14
nut->Range(0,0,20,24);
15
nut->SetFillColor(10);
16
nut->SetBorderSize(2);
17
18
TPaveLabel *pl =
new
TPaveLabel(3,22,17,23.7,
19
"My first ROOT interactive session"
,
"br"
);
20
pl->SetFillColor(18);
21
pl->Draw();
22
23
TText t(0,0,
"a"
);
24
t.SetTextFont(62);
25
t.SetTextSize(0.025);
26
t.SetTextAlign(12);
27
t.DrawText(2,20.3,
"ROOT is based on CINT, a powerful C/C++ interpreter."
);
28
t.DrawText(2,19.3,
"Blocks of lines can be entered within {...}."
);
29
t.DrawText(2,18.3,
"Previous typed lines can be recalled."
);
30
31
t.SetTextFont(72);
32
t.SetTextSize(0.026);
33
t.DrawText(3,17,
"Root > float x=5; float y=7;"
);
34
t.DrawText(3,16,
"Root > x*sqrt(y)"
);
35
t.DrawText(3,14,
36
"Root > for (int i=2;i<7;i++) printf(\"sqrt(%d) = %f\\n\",i,sqrt(i));"
);
37
t.DrawText(3,10,
"Root > TF1 f1(\"f1\",\"sin(x)/x\",0,10)"
);
38
t.DrawText(3, 9,
"Root > f1.Draw()"
);
39
t.SetTextFont(81);
40
t.SetTextSize(0.018);
41
t.DrawText(4,15,
"(float) 13.2288f"
);
42
t.DrawText(4,13.3,
"sqrt(2) = 1.414214"
);
43
t.DrawText(4,12.7,
"sqrt(3) = 1.732051"
);
44
t.DrawText(4,12.1,
"sqrt(4) = 2.000000"
);
45
t.DrawText(4,11.5,
"sqrt(5) = 2.236068"
);
46
t.DrawText(4,10.9,
"sqrt(6) = 2.449490"
);
47
48
TPad *pad =
new
TPad(
"pad"
,
"pad"
,.2,.05,.8,.35);
49
pad->Draw();
50
pad->cd();
51
pad->SetGrid();
52
TF1 *f1 =
new
TF1(
"f1"
,
"sin(x)/x"
,0,10);
53
f1->Draw();
54
}
tutorials
graphics
first.C
Generated on Tue May 5 2020 14:03:45 for ROOT by
1.8.5