Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches

Detailed Description

View in nbviewer Open in SWAN
This macro produces the flowchart of TFormula::Eval.

void eval()
{
TCanvas *c1 = new TCanvas("c1");
c1->Range(0, 0, 20, 10);
TPaveLabel *pt1 = new TPaveLabel(0.2, 4, 3, 6, "Eval");
pt1->SetTextSize(0.5);
pt1->SetFillColor(42);
pt1->Draw();
TPaveText *pt2 = new TPaveText(4.5, 4, 7.8, 6);
pt2->Draw();
TText *t1 = pt2->AddText("Read Operator");
TText *t2 = pt2->AddText("number i");
TPaveText *pt3 = new TPaveText(9, 3.5, 17.5, 6.5);
TText *t4 = pt3->AddText("Apply Operator to current stack values");
TText *t5 = pt3->AddText("Example: if operator +");
TText *t6 = pt3->AddText("value[i] += value[i-1]");
t4->SetTextAlign(22);
t5->SetTextAlign(22);
t6->SetTextAlign(22);
t5->SetTextColor(4);
t6->SetTextColor(2);
pt3->Draw();
TPaveLabel *pt4 = new TPaveLabel(4, 0.5, 12, 2.5, "return result = value[i]");
pt4->Draw();
TArrow *ar1 = new TArrow(6, 4, 6, 2.7, 0.02, "|>");
ar1->Draw();
TText *t7 = new TText(6.56, 2.7, "if i = number of stack elements");
t7->SetTextSize(0.04);
t7->Draw();
ar1->DrawArrow(6, 8, 6, 6.2, 0.02, "|>");
TLine *l1 = new TLine(12, 6.6, 12, 8);
l1->Draw();
l1->DrawLine(12, 8, 6, 8);
ar1->DrawArrow(3, 5, 4.4, 5, 0.02, "|>");
ar1->DrawArrow(7.8, 5, 8.9, 5, 0.02, "|>");
}
Draw all kinds of Arrows.
Definition TArrow.h:29
virtual TArrow * 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:135
void Draw(Option_t *option="") override
Draw this arrow with its current attributes.
Definition TArrow.cxx:120
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 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
Use the TLine constructor to create a simple line.
Definition TLine.h:22
virtual TLine * DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
Definition TLine.cxx:103
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:292
A Pave (see TPave) with a text centered in the Pave.
Definition TPaveLabel.h:20
void Draw(Option_t *option="") override
Draw this pavelabel with its current attributes.
A Pave (see TPave) with text, lines or/and boxes inside.
Definition TPaveText.h:21
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
void Draw(Option_t *option="") override
Draw this pavetext with its current attributes.
Base class for several text objects.
Definition TText.h:22
return c1
Definition legend1.C:41
auto * t1
Definition textangle.C:20
Author
Rene Brun

Definition in file eval.C.