Logo ROOT  
Reference Guide
first.C File Reference

Detailed Description

View in nbviewer Open in SWAN Show some basic primitives.

void first() {
TCanvas *nut = new TCanvas("nut", "FirstSession",100,10,700,900);
nut->Range(0,0,20,24);
nut->SetFillColor(10);
nut->SetBorderSize(2);
TPaveLabel *pl = new TPaveLabel(3,22,17,23.7,
"My first ROOT interactive session","br");
pl->SetFillColor(18);
pl->Draw();
TText t(0,0,"a");
t.SetTextFont(62);
t.SetTextSize(0.025);
t.SetTextAlign(12);
t.DrawText(2,20.3,"ROOT is based on CINT, a powerful C/C++ interpreter.");
t.DrawText(2,19.3,"Blocks of lines can be entered within {...}.");
t.DrawText(2,18.3,"Previous typed lines can be recalled.");
t.SetTextFont(72);
t.SetTextSize(0.026);
t.DrawText(3,17,"Root > float x=5; float y=7;");
t.DrawText(3,16,"Root > x*sqrt(y)");
t.DrawText(3,14,
"Root > for (int i=2;i<7;i++) printf(\"sqrt(%d) = %f\\n\",i,sqrt(i));");
t.DrawText(3,10,"Root > TF1 f1(\"f1\",\"sin(x)/x\",0,10)");
t.DrawText(3, 9,"Root > f1.Draw()");
t.SetTextFont(81);
t.SetTextSize(0.018);
t.DrawText(4,15,"(float) 13.2288f");
t.DrawText(4,13.3,"sqrt(2) = 1.414214");
t.DrawText(4,12.7,"sqrt(3) = 1.732051");
t.DrawText(4,12.1,"sqrt(4) = 2.000000");
t.DrawText(4,11.5,"sqrt(5) = 2.236068");
t.DrawText(4,10.9,"sqrt(6) = 2.449490");
TPad *pad = new TPad("pad","pad",.2,.05,.8,.35);
pad->Draw();
pad->cd();
pad->SetGrid();
TF1 *f1 = new TF1("f1","sin(x)/x",0,10);
f1->Draw();
}
Author
Rene Brun

Definition in file first.C.

TText::DrawText
virtual TText * DrawText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
Definition: TText.cxx:175
first
Definition: first.py:1
TPad::Range
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:5174
TPad
Definition: TPad.h:26
TPaveLabel::Draw
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
Definition: TPaveLabel.cxx:77
TPad::SetBorderSize
virtual void SetBorderSize(Short_t bordersize)
Definition: TPad.h:318
TPaveLabel
Definition: TPaveLabel.h:20
TText
Definition: TText.h:22
f1
TF1 * f1
Definition: legend1.C:11
TCanvas
Definition: TCanvas.h:23
TF1::Draw
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
Definition: TF1.cxx:1338
TPad::cd
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
Definition: TPad.cxx:594
TPad::SetGrid
virtual void SetGrid(Int_t valuex=1, Int_t valuey=1)
Definition: TPad.h:327
TF1
1-Dim function class
Definition: TF1.h:212
TPad::Draw
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
Definition: TPad.cxx:1285