Logo ROOT   6.07/09
Reference Guide
analyze.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_graphics
3 /// \notebook -js
4 /// This macro produces the flowchart of TFormula::Analyze.
5 ///
6 /// \macro_image
7 /// \macro_code
8 ///
9 /// \author Rene Brun
10 
11 
12 void analyze() {
13  TCanvas *c1 = new TCanvas("c1","Analyze.mac",620,790);
14  c1->Range(-1,0,19,30);
15  TPaveLabel *pl1 = new TPaveLabel(0,27,3.5,29,"Analyze");
16  pl1->SetFillColor(42);
17  pl1->Draw();
18  TPaveText *pt1 = new TPaveText(0,22.8,4,25.2);
19  TText *t1 = pt1->AddText("Parenthesis matching");
20  TText *t2 = pt1->AddText("Remove unnecessary");
21  TText *t2a = pt1->AddText("parenthesis");
22  pt1->Draw();
23  TPaveText *pt2 = new TPaveText(6,23,10,25);
24  TText *t3 = pt2->AddText("break of");
25  TText *t4 = pt2->AddText("Analyze");
26  pt2->Draw();
27  TPaveText *pt3 = new TPaveText(0,19,4,21);
28  t4=pt3->AddText("look for simple");
29  TText *t5 = pt3->AddText("operators");
30  pt3->Draw();
31  TPaveText *pt4 = new TPaveText(0,15,4,17);
32  TText *t6 = pt4->AddText("look for an already");
33  TText *t7 = pt4->AddText("defined expression");
34  pt4->Draw();
35  TPaveText *pt5 = new TPaveText(0,11,4,13);
36  TText *t8 = pt5->AddText("look for usual");
37  TText *t9 = pt5->AddText("functions :cos sin ..");
38  pt5->Draw();
39  TPaveText *pt6 = new TPaveText(0,7,4,9);
40  TText *t10 = pt6->AddText("look for a");
41  TText *t11 = pt6->AddText("numeric value");
42  pt6->Draw();
43  TPaveText *pt7 = new TPaveText(6,18.5,10,21.5);
44  TText *t12 = pt7->AddText("Analyze left and");
45  TText *t13 = pt7->AddText("right part of");
46  TText *t14 = pt7->AddText("the expression");
47  pt7->Draw();
48  TPaveText *pt8 = new TPaveText(6,15,10,17);
49  TText *t15 = pt8->AddText("Replace expression");
50  pt8->Draw();
51  TPaveText *pt9 = new TPaveText(6,11,10,13);
52  TText *t16 = pt9->AddText("Analyze");
53  pt9->SetFillColor(42);
54  pt9->Draw();
55  TPaveText *pt10 = new TPaveText(6,7,10,9);
56  TText *t17 = pt10->AddText("Error");
57  TText *t18 = pt10->AddText("Break of Analyze");
58  pt10->Draw();
59  TPaveText *pt11 = new TPaveText(14,22,17,24);
60  pt11->SetFillColor(42);
61  TText *t19 = pt11->AddText("Analyze");
62  TText *t19a = pt11->AddText("Left");
63  pt11->Draw();
64  TPaveText *pt12 = new TPaveText(14,19,17,21);
65  pt12->SetFillColor(42);
66  TText *t20 = pt12->AddText("Analyze");
67  TText *t20a = pt12->AddText("Right");
68  pt12->Draw();
69  TPaveText *pt13 = new TPaveText(14,15,18,18);
70  TText *t21 = pt13->AddText("StackNumber++");
71  TText *t22 = pt13->AddText("operator[StackNumber]");
72  TText *t23 = pt13->AddText("= operator found");
73  pt13->Draw();
74  TPaveText *pt14 = new TPaveText(12,10.8,17,13.2);
75  TText *t24 = pt14->AddText("StackNumber++");
76  TText *t25 = pt14->AddText("operator[StackNumber]");
77  TText *t26 = pt14->AddText("= function found");
78  pt14->Draw();
79  TPaveText *pt15 = new TPaveText(6,7,10,9);
80  TText *t27 = pt15->AddText("Error");
81  TText *t28 = pt15->AddText("break of Analyze");
82  pt15->Draw();
83  TPaveText *pt16 = new TPaveText(0,2,7,5);
84  TText *t29 = pt16->AddText("StackNumber++");
85  TText *t30 = pt16->AddText("operator[StackNumber] = 0");
86  TText *t31 = pt16->AddText("value[StackNumber] = value found");
87  pt16->Draw();
88  TArrow *ar = new TArrow(2,27,2,25.4,0.012,"|>");
89  ar->SetFillColor(1);
90  ar->Draw();
91  ar->DrawArrow(2,22.8,2,21.2,0.012,"|>");
92  ar->DrawArrow(2,19,2,17.2,0.012,"|>");
93  ar->DrawArrow(2,15,2,13.2,0.012,"|>");
94  ar->DrawArrow(2,11,2, 9.2,0.012,"|>");
95  ar->DrawArrow(2, 7,2, 5.2,0.012,"|>");
96  ar->DrawArrow(4,24,6,24,0.012,"|>");
97  ar->DrawArrow(4,20,6,20,0.012,"|>");
98  ar->DrawArrow(4,16,6,16,0.012,"|>");
99  ar->DrawArrow(4,12,6,12,0.012,"|>");
100  ar->DrawArrow(4, 8,6, 8,0.012,"|>");
101  ar->DrawArrow(10,20,14,20,0.012,"|>");
102  ar->DrawArrow(12,23,14,23,0.012,"|>");
103  ar->DrawArrow(12,16.5,14,16.5,0.012,"|>");
104  ar->DrawArrow(10,12,12,12,0.012,"|>");
105  TText *ta = new TText(2.2,22.2,"err = 0");
106  ta->SetTextFont(71);
107  ta->SetTextSize(0.015);
108  ta->SetTextColor(4);
109  ta->SetTextAlign(12);
110  ta->Draw();
111  ta->DrawText(2.2,18.2,"not found");
112  ta->DrawText(2.2,6.2,"found");
113  TText *tb = new TText(4.2,24.1,"err != 0");
114  tb->SetTextFont(71);
115  tb->SetTextSize(0.015);
116  tb->SetTextColor(4);
117  tb->SetTextAlign(11);
118  tb->Draw();
119  tb->DrawText(4.2,20.1,"found");
120  tb->DrawText(4.2,16.1,"found");
121  tb->DrawText(4.2,12.1,"found");
122  tb->DrawText(4.2, 8.1,"not found");
123  TLine *l1 = new TLine(12,16.5,12,23);
124  l1->Draw();
125 }
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
Definition: TPaveText.cxx:211
return c1
Definition: legend1.C:41
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:139
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 void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:255
TLatex * t1
Definition: textangle.C:20
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Definition: TAttText.h:51
virtual void Draw(Option_t *option="")
Draw this arrow with its current attributes.
Definition: TArrow.cxx:122
Base class for several text objects.
Definition: TText.h:33
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition: TAttText.h:47
A Pave (see TPave) with a text centered in the Pave.
Definition: TPaveLabel.h:24
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:42
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:4654
A simple line.
Definition: TLine.h:33
The Canvas class.
Definition: TCanvas.h:41
A Pave (see TPave) with text, lines or/and boxes inside.
Definition: TPaveText.h:27
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
Definition: TPaveLabel.cxx:77
virtual TText * DrawText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
Definition: TText.cxx:175
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition: TAttText.h:49
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition: TAttText.h:52
Draw all kinds of Arrows.
Definition: TArrow.h:35