From $ROOTSYS/tutorials/tree/tree.C

void tree() {
   //
   // This macro displays the Tree data structures
   //Author: Rene Brun
   TCanvas* c1 = new TCanvas("c1","Tree Data Structure",200,10,750,940);
   c1->Range(0,-0.1,1,1.15);

   gBenchmark->Start("tree");

   Int_t branchcolor = 26;
   Int_t leafcolor   = 30;
   Int_t basketcolor = 42;
   Int_t offsetcolor = 43;
   TPaveLabel* title = new TPaveLabel(.3,1.05,.8,1.13,c1->GetTitle());
   title->SetFillColor(16);
   title->Draw();
   TPaveText* treePave = new TPaveText(.01,.75,.15,1.00);
   treePave->SetFillColor(18);
   treePave->SetTextAlign(12);
   TText *tnt = treePave->AddText("TreePave");
   tnt->SetTextAlign(22);
   tnt->SetTextSize(0.030);
   treePave->AddText("fScanField");
   treePave->AddText("fMaxEventLoop");
   treePave->AddText("fMaxVirtualSize");
   treePave->AddText("fEntries");
   treePave->AddText("fDimension");
   treePave->AddText("fSelectedRows");
   treePave->Draw();
   TPavesText* farm = new TPavesText(.01,1.02,.15,1.1,9,"tr");
   TText *tfarm = farm->AddText("CHAIN");
   tfarm->SetTextSize(0.024);
   farm->AddText("Collection");
   farm->AddText("of Trees");
   farm->Draw();
   TLine* llink = new TLine(.15,.92,.80,.92);
   llink->SetLineWidth(2);
   llink->SetLineColor(1);
   llink->Draw();
   llink->DrawLine(.21,.87,.21,.275);
   llink->DrawLine(.23,.87,.23,.375);
   llink->DrawLine(.25,.87,.25,.775);
   llink->DrawLine(.41,.25,.41,-.025);
   llink->DrawLine(.43,.25,.43,.075);
   llink->DrawLine(.45,.25,.45,.175);
   TPaveLabel* branch0 = new TPaveLabel(.20,.87,.35,.97,"Branch 0");
   branch0->SetTextSize(0.35);
   branch0->SetFillColor(branchcolor);
   branch0->Draw();
   TPaveLabel* branch1 = new TPaveLabel(.40,.87,.55,.97,"Branch 1");
   branch1->SetTextSize(0.35);
   branch1->SetFillColor(branchcolor);
   branch1->Draw();
   TPaveLabel* branch2 = new TPaveLabel(.60,.87,.75,.97,"Branch 2");
   branch2->SetTextSize(0.35);
   branch2->SetFillColor(branchcolor);
   branch2->Draw();
   TPaveLabel* branch3 = new TPaveLabel(.80,.87,.95,.97,"Branch 3");
   branch3->SetTextSize(0.35);
   branch3->SetFillColor(branchcolor);
   branch3->Draw();
   TPaveLabel* leaf0 = new TPaveLabel(.4,.75,.5,.8,"Leaf 0");
   leaf0->SetFillColor(leafcolor);
   leaf0->Draw();
   TPaveLabel* leaf1 = new TPaveLabel(.6,.75,.7,.8,"Leaf 1");
   leaf1->SetFillColor(leafcolor);
   leaf1->Draw();
   TPaveLabel* leaf2 = new TPaveLabel(.8,.75,.9,.8,"Leaf 2");
   leaf2->SetFillColor(leafcolor);
   leaf2->Draw();
   TPaveText* firstevent = new TPaveText(.4,.35,.9,.4);
   firstevent->AddText("First event of each basket");
   firstevent->AddText("Array of fMaxBaskets Integers");
   firstevent->SetFillColor(basketcolor);
   firstevent->Draw();
   TPaveLabel* basket0 = new TPaveLabel(.4,.25,.5,.3,"Basket 0");
   basket0->SetFillColor(basketcolor);
   basket0->Draw();
   TPaveLabel* basket1 = new TPaveLabel(.6,.25,.7,.3,"Basket 1");
   basket1->SetFillColor(basketcolor);
   basket1->Draw();
   TPaveLabel* basket2 = new TPaveLabel(.8,.25,.9,.3,"Basket 2");
   basket2->SetFillColor(basketcolor);
   basket2->Draw();

   TPaveText* offset = new TPaveText(.55,.15,.9,.2);
   offset->AddText("Offset of events in fBuffer");
   offset->AddText("Array of fEventOffsetLen Integers");
   offset->AddText("(if variable length structure)");
   offset->SetFillColor(offsetcolor);
   offset->Draw();
   TPaveText* buffer = new TPaveText(.55,.05,.9,.1);
   buffer->AddText("Basket buffer");
   buffer->AddText("Array of fBasketSize chars");
   buffer->SetFillColor(offsetcolor);
   buffer->Draw();
   TPaveText* zipbuffer = new TPaveText(.55,-.05,.75,.0);
   zipbuffer->AddText("Basket compressed buffer");
   zipbuffer->AddText("(if compression)");
   zipbuffer->SetFillColor(offsetcolor);
   zipbuffer->Draw();
   TArrow* ar1 = new TArrow();
   ar1->SetLineWidth(2);
   ar1->SetLineColor(1);
   ar1->SetFillStyle(1001);
   ar1->SetFillColor(1);
   ar1->DrawArrow(.21,.275,.39,.275,0.015,"|>");
   ar1->DrawArrow(.23,.375,.39,.375,0.015,"|>");
   ar1->DrawArrow(.25,.775,.39,.775,0.015,"|>");
   ar1->DrawArrow(.50,.775,.59,.775,0.015,"|>");
   ar1->DrawArrow(.70,.775,.79,.775,0.015,"|>");
   ar1->DrawArrow(.50,.275,.59,.275,0.015,"|>");
   ar1->DrawArrow(.70,.275,.79,.275,0.015,"|>");
   ar1->DrawArrow(.45,.175,.54,.175,0.015,"|>");
   ar1->DrawArrow(.43,.075,.54,.075,0.015,"|>");
   ar1->DrawArrow(.41,-.025,.54,-.025,0.015,"|>");
   TLine* ldot = new TLine(.95,.92,.99,.92);
   ldot->SetLineStyle(3);
   ldot->Draw();
   ldot->DrawLine(.9,.775,.99,.775);
   ldot->DrawLine(.9,.275,.99,.275);
   ldot->DrawLine(.55,.05,.55,0);
   ldot->DrawLine(.9,.05,.75,0);
   TText* pname = new TText(.46,.21,"fEventOffset");
   pname->SetTextFont(72);
   pname->SetTextSize(0.018);
   pname->Draw();
   pname->DrawText(.44,.11,"fBuffer");
   pname->DrawText(.42,.01,"fZipBuffer");
   pname->DrawText(.26,.81,"fLeaves = TObjArray of TLeaf");
   pname->DrawText(.24,.40,"fBasketEvent");
   pname->DrawText(.22,.31,"fBaskets = TObjArray of TBasket");
   pname->DrawText(.20,1.0,"fBranches = TObjArray of TBranch");
   TPaveText* ntleaf = new TPaveText(0.30,.42,.62,.7);
   ntleaf->SetTextSize(0.014);
   ntleaf->SetFillColor(leafcolor);
   ntleaf->SetTextAlign(12);
   ntleaf->AddText("fLen: number of fixed elements");
   ntleaf->AddText("fLenType: number of bytes of data type");
   ntleaf->AddText("fOffset: relative to Leaf0-fAddress");
   ntleaf->AddText("fNbytesIO: number of bytes used for I/O");
   ntleaf->AddText("fIsPointer: True if pointer");
   ntleaf->AddText("fIsRange: True if leaf has a range");
   ntleaf->AddText("fIsUnsigned: True if unsigned");
   ntleaf->AddText("*fLeafCount: points to Leaf counter");
   ntleaf->AddText(" ");
   ntleaf->AddLine(0,0,0,0);
   ntleaf->AddText("fName = Leaf name");
   ntleaf->AddText("fTitle = Leaf type (see Type codes)");
   ntleaf->Draw();
   TPaveText* type = new TPaveText(.65,.42,.95,.7);
   type->SetTextAlign(12);
   type->SetFillColor(leafcolor);
   type->AddText(" ");
   type->AddText("C : a character string");
   type->AddText("B : an 8 bit signed integer");
   type->AddText("b : an 8 bit unsigned integer");
   type->AddText("S : a 16 bit signed short integer");
   type->AddText("s : a 16 bit unsigned short integer");
   type->AddText("I : a 32 bit signed integer");
   type->AddText("i : a 32 bit unsigned integer");
   type->AddText("F : a 32 bit floating point");
   type->AddText("D : a 64 bit floating point");
   type->AddText("TXXXX : a class name TXXXX");
   type->Draw();
   TPaveLabel* typecode = new TPaveLabel(.7,.68,.9,.72,"fType codes");
   typecode->SetFillColor(leafcolor);
   typecode->Draw();
   ldot->DrawLine(.4,.75,.30,.7);
   ldot->DrawLine(.5,.75,.62,.7);
   TPaveText* ntbasket = new TPaveText(0.02,-0.07,0.35,.25);
   ntbasket->SetFillColor(basketcolor);
   ntbasket->SetTextSize(0.014);
   ntbasket->SetTextAlign(12);
   ntbasket->AddText("fNbytes: Size of compressed Basket");
   ntbasket->AddText("fObjLen: Size of uncompressed Basket");
   ntbasket->AddText("fDatime: Date/Time when written to store");
   ntbasket->AddText("fKeylen: Number of bytes for the key");
   ntbasket->AddText("fCycle : Cycle number");
   ntbasket->AddText("fSeekKey: Pointer to Basket on file");
   ntbasket->AddText("fSeekPdir: Pointer to directory on file");
   ntbasket->AddText("fClassName: 'TBasket'");
   ntbasket->AddText("fName: Branch name");
   ntbasket->AddText("fTitle: TreePave name");
   ntbasket->AddText(" ");
   ntbasket->AddLine(0,0,0,0);
   ntbasket->AddText("fNevBuf: Number of events in Basket");
   ntbasket->AddText("fLast: pointer to last used byte in Basket");
   ntbasket->Draw();
   ldot->DrawLine(.4,.3,0.02,0.25);
   ldot->DrawLine(.5,.25,0.35,-.07);
   ldot->DrawLine(.5,.3,0.35,0.25);
   TPaveText* ntbranch = new TPaveText(0.02,0.40,0.18,0.68);
   ntbranch->SetFillColor(branchcolor);
   ntbranch->SetTextSize(0.015);
   ntbranch->SetTextAlign(12);
   ntbranch->AddText("fBasketSize");
   ntbranch->AddText("fEventOffsetLen");
   ntbranch->AddText("fMaxBaskets");
   ntbranch->AddText("fEntries");
   ntbranch->AddText("fAddress of Leaf0");
   ntbranch->AddText(" ");
   ntbranch->AddLine(0,0,0,0);
   ntbranch->AddText("fName: Branchname");
   ntbranch->AddText("fTitle: leaflist");
   ntbranch->Draw();
   ldot->DrawLine(.2,.97,.02,.68);
   ldot->DrawLine(.35,.97,.18,.68);
   ldot->DrawLine(.35,.87,.18,.40);
   TPavesText* basketstore = new TPavesText(.8,-0.088,0.952,-0.0035,7,"tr");
   basketstore->SetFillColor(28);
   basketstore->AddText("Baskets");
   basketstore->AddText("Stores");
   basketstore->Draw();
   c1->Update();

   gBenchmark->Show("treePave");
}
 tree.C:1
 tree.C:2
 tree.C:3
 tree.C:4
 tree.C:5
 tree.C:6
 tree.C:7
 tree.C:8
 tree.C:9
 tree.C:10
 tree.C:11
 tree.C:12
 tree.C:13
 tree.C:14
 tree.C:15
 tree.C:16
 tree.C:17
 tree.C:18
 tree.C:19
 tree.C:20
 tree.C:21
 tree.C:22
 tree.C:23
 tree.C:24
 tree.C:25
 tree.C:26
 tree.C:27
 tree.C:28
 tree.C:29
 tree.C:30
 tree.C:31
 tree.C:32
 tree.C:33
 tree.C:34
 tree.C:35
 tree.C:36
 tree.C:37
 tree.C:38
 tree.C:39
 tree.C:40
 tree.C:41
 tree.C:42
 tree.C:43
 tree.C:44
 tree.C:45
 tree.C:46
 tree.C:47
 tree.C:48
 tree.C:49
 tree.C:50
 tree.C:51
 tree.C:52
 tree.C:53
 tree.C:54
 tree.C:55
 tree.C:56
 tree.C:57
 tree.C:58
 tree.C:59
 tree.C:60
 tree.C:61
 tree.C:62
 tree.C:63
 tree.C:64
 tree.C:65
 tree.C:66
 tree.C:67
 tree.C:68
 tree.C:69
 tree.C:70
 tree.C:71
 tree.C:72
 tree.C:73
 tree.C:74
 tree.C:75
 tree.C:76
 tree.C:77
 tree.C:78
 tree.C:79
 tree.C:80
 tree.C:81
 tree.C:82
 tree.C:83
 tree.C:84
 tree.C:85
 tree.C:86
 tree.C:87
 tree.C:88
 tree.C:89
 tree.C:90
 tree.C:91
 tree.C:92
 tree.C:93
 tree.C:94
 tree.C:95
 tree.C:96
 tree.C:97
 tree.C:98
 tree.C:99
 tree.C:100
 tree.C:101
 tree.C:102
 tree.C:103
 tree.C:104
 tree.C:105
 tree.C:106
 tree.C:107
 tree.C:108
 tree.C:109
 tree.C:110
 tree.C:111
 tree.C:112
 tree.C:113
 tree.C:114
 tree.C:115
 tree.C:116
 tree.C:117
 tree.C:118
 tree.C:119
 tree.C:120
 tree.C:121
 tree.C:122
 tree.C:123
 tree.C:124
 tree.C:125
 tree.C:126
 tree.C:127
 tree.C:128
 tree.C:129
 tree.C:130
 tree.C:131
 tree.C:132
 tree.C:133
 tree.C:134
 tree.C:135
 tree.C:136
 tree.C:137
 tree.C:138
 tree.C:139
 tree.C:140
 tree.C:141
 tree.C:142
 tree.C:143
 tree.C:144
 tree.C:145
 tree.C:146
 tree.C:147
 tree.C:148
 tree.C:149
 tree.C:150
 tree.C:151
 tree.C:152
 tree.C:153
 tree.C:154
 tree.C:155
 tree.C:156
 tree.C:157
 tree.C:158
 tree.C:159
 tree.C:160
 tree.C:161
 tree.C:162
 tree.C:163
 tree.C:164
 tree.C:165
 tree.C:166
 tree.C:167
 tree.C:168
 tree.C:169
 tree.C:170
 tree.C:171
 tree.C:172
 tree.C:173
 tree.C:174
 tree.C:175
 tree.C:176
 tree.C:177
 tree.C:178
 tree.C:179
 tree.C:180
 tree.C:181
 tree.C:182
 tree.C:183
 tree.C:184
 tree.C:185
 tree.C:186
 tree.C:187
 tree.C:188
 tree.C:189
 tree.C:190
 tree.C:191
 tree.C:192
 tree.C:193
 tree.C:194
 tree.C:195
 tree.C:196
 tree.C:197
 tree.C:198
 tree.C:199
 tree.C:200
 tree.C:201
 tree.C:202
 tree.C:203
 tree.C:204
 tree.C:205
 tree.C:206
 tree.C:207
 tree.C:208
 tree.C:209
 tree.C:210
 tree.C:211
 tree.C:212
 tree.C:213
 tree.C:214
 tree.C:215
 tree.C:216
 tree.C:217
 tree.C:218
 tree.C:219