ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
eval.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_graphics
3 /// This macro produces the flowchart of TFormula::Eval.
4 ///
5 /// \macro_image
6 /// \macro_code
7 ///
8 /// \author Rene Brun
9 
10 void eval(){
11 
12  TCanvas *c1 = new TCanvas("c1");
13  c1->Range(0,0,20,10);
14  TPaveLabel *pt1 = new TPaveLabel(0.2,4,3,6,"Eval");
15  pt1->SetTextSize(0.5);
16  pt1->SetFillColor(42);
17  pt1->Draw();
18  TPaveText *pt2 = new TPaveText(4.5,4,7.8,6);
19  pt2->Draw();
20  TText *t1 = pt2->AddText("Read Operator");
21  TText *t2 = pt2->AddText("number i");
22  TPaveText *pt3 = new TPaveText(9,3.5,17.5,6.5);
23  TText *t4 = pt3->AddText("Apply Operator to current stack values");
24  TText *t5 = pt3->AddText("Example: if operator +");
25  TText *t6 = pt3->AddText("value[i] += value[i-1]");
26  t4->SetTextAlign(22);
27  t5->SetTextAlign(22);
28  t6->SetTextAlign(22);
29  t5->SetTextColor(4);
30  t6->SetTextColor(2);
31  pt3->Draw();
32  TPaveLabel *pt4 = new TPaveLabel(4,0.5,12,2.5,"return result = value[i]");
33  pt4->Draw();
34  TArrow *ar1 = new TArrow(6,4,6,2.7,0.02,"|>");
35  ar1->Draw();
36  TText *t7 = new TText(6.56,2.7,"if i = number of stack elements");
37  t7->SetTextSize(0.04);
38  t7->Draw();
39  ar1->DrawArrow(6,8,6,6.2,0.02,"|>");
40  TLine *l1 = new TLine(12,6.6,12,8);
41  l1->Draw();
42  l1->DrawLine(12,8,6,8);
43  ar1->DrawArrow(3,5,4.4,5,0.02,"|>");
44  ar1->DrawArrow(7.8,5,8.9,5,0.02,"|>");
45 }
46 
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
Definition: TPaveText.cxx:211
virtual void DrawArrow(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Float_t arrowsize=0, Option_t *option="")
Draw this arrow with new coordinates.
Definition: TArrow.cxx:138
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
Definition: TPaveText.cxx:160
virtual TLine * DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
Definition: TLine.cxx:93
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:254
virtual void Draw(Option_t *option="")
Draw this arrow with its current attributes.
Definition: TArrow.cxx:121
Base class for several text objects.
Definition: TText.h:42
virtual void SetTextAlign(Short_t align=11)
Definition: TAttText.h:55
A Pave (see TPave) with a text centered in the Pave.
Definition: TPaveLabel.h:32
virtual void SetFillColor(Color_t fcolor)
Definition: TAttFill.h:50
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:4623
A simple line.
Definition: TLine.h:41
The Canvas class.
Definition: TCanvas.h:48
A Pave (see TPave) with text, lines or/and boxes inside.
Definition: TPaveText.h:35
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
Definition: TPaveLabel.cxx:77
virtual void SetTextColor(Color_t tcolor=1)
Definition: TAttText.h:57
virtual void SetTextSize(Float_t tsize=1)
Definition: TAttText.h:60
Draw all kinds of Arrows.
Definition: TArrow.h:35