Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
fildir.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_io
3/// \notebook
4/// This macro displays the ROOT Directory data structure
5///
6/// \macro_image
7/// \macro_code
8///
9/// \author Rene Brun
10
11void fildir(){
12
13
14 TCanvas *c1 = new TCanvas("c1","ROOT FilDir description",700,900);
15 c1->Range(1,1,19,24.5);
16 TPaveLabel *title = new TPaveLabel(4,23,16,24.2,"ROOT File/Directory/Key description");
17 title->SetFillColor(16);
18 title->Draw();
19
20 Int_t keycolor = 42;
21 Int_t dircolor = 21;
22 Int_t objcolor = 46;
23 TPaveText *file = new TPaveText(2,19,6,22);
24 file->SetFillColor(39);
25 file->Draw();
26 file->SetTextSize(0.04);
27 file->AddText("TFile");
28 file->AddText("Header");
29 TArrow *arrow = new TArrow(6,20.5,17,20.5,0.02,"|>");
30 arrow->SetFillStyle(1001);
31 arrow->SetLineWidth(2);
32 arrow->Draw();
33 TPaveText *free1 = new TPaveText(8,20,11,21);
34 free1->SetFillColor(18);
35 free1->Draw();
36 free1->AddText("First:Last");
37 TPaveText *free2 = new TPaveText(12,20,15,21);
38 free2->SetFillColor(18);
39 free2->Draw();
40 free2->AddText("First:Last");
41 TText *tfree = new TText(6.2,21.2,"fFree = TList of free blocks");
42 tfree->SetTextSize(0.02);
43 tfree->Draw();
44 TText *tkeys = new TText(5.2,18.2,"fKeys = TList of Keys");
45 tkeys->SetTextSize(0.02);
46 tkeys->Draw();
47 TText *tmemory = new TText(3.2,15.2,"fListHead = TList of Objects in memory");
48 tmemory->SetTextSize(0.02);
49 tmemory->Draw();
50
51 arrow->DrawArrow(5,17,17,17,0.02,"|>");
52 TLine *line = new TLine(5,19,5,17);
54 line->Draw();
55 TPaveText *key0 = new TPaveText(7,16,10,18);
56 key0->SetTextSize(0.04);
57 key0->SetFillColor(keycolor);
58 key0->AddText("Key 0");
59 key0->Draw();
60 TPaveText *key1 = new TPaveText(12,16,15,18);
61 key1->SetTextSize(0.04);
62 key1->SetFillColor(keycolor);
63 key1->AddText("Key 1");
64 key1->Draw();
65 line->DrawLine(3,19,3,14);
66 line->DrawLine(3,14,18,14);
67 TPaveText *obj0 = new TPaveText(5,13,8,15);
68 obj0->SetFillColor(objcolor);
69 obj0->AddText("Object");
70 obj0->Draw();
71 TPaveText *dir1 = new TPaveText(10,13,13,15);
72 dir1->SetFillColor(dircolor);
73 dir1->AddText("SubDir");
74 dir1->Draw();
75 TPaveText *obj1 = new TPaveText(15,13,18,15);
76 obj1->SetFillColor(objcolor);
77 obj1->AddText("Object");
78 obj1->Draw();
79 arrow->DrawArrow(12,11,17,11,0.015,"|>");
80 arrow->DrawArrow(11,9,17,9,0.015,"|>");
81 line->DrawLine(12,13,12,11);
82 line->DrawLine(11,13,11,9);
83 TPaveText *key2 = new TPaveText(14,10.5,16,11.5);
84 key2->SetFillColor(keycolor);
85 key2->AddText("Key 0");
86 key2->Draw();
87 TPaveText *obj2 = new TPaveText(14,8.5,16,9.5);
88 obj2->SetFillColor(objcolor);
89 obj2->AddText("Object");
90 obj2->Draw();
91 TLine *ldot = new TLine(10,15,2,11);
92 ldot->SetLineStyle(2);
93 ldot->Draw();
94 ldot->DrawLine(13,15,8,11);
95 ldot->DrawLine(13,13,8,5);
96 TPaveText *dirdata = new TPaveText(2,5,8,11);
97 dirdata->SetTextAlign(12);
98 dirdata->SetFillColor(dircolor);
99 dirdata->Draw();
100 dirdata->SetTextSize(0.015);
101 dirdata->AddText("fModified: True if directory is modified");
102 dirdata->AddText("fWritable: True if directory is writable");
103 dirdata->AddText("fDatimeC: Creation Date/Time");
104 dirdata->AddText("fDatimeM: Last mod Date/Time");
105 dirdata->AddText("fNbytesKeys: Number of bytes of key");
106 dirdata->AddText("fNbytesName : Header length up to title");
107 dirdata->AddText("fSeekDir: Start of Directory on file");
108 dirdata->AddText("fSeekParent: Start of Parent Directory");
109 dirdata->AddText("fSeekKeys: Pointer to Keys record");
110 TPaveText *keydata = new TPaveText(10,2,17,7);
111 keydata->SetTextAlign(12);
112 keydata->SetFillColor(keycolor);
113 keydata->Draw();
114 ldot->DrawLine(14,11.5,10,7);
115 ldot->DrawLine(16,11.5,17,7);
116 keydata->SetTextSize(0.015);
117 keydata->AddText("fNbytes: Size of compressed Object");
118 keydata->AddText("fObjLen: Size of uncompressed Object");
119 keydata->AddText("fDatime: Date/Time when written to store");
120 keydata->AddText("fKeylen: Number of bytes for the key");
121 keydata->AddText("fCycle : Cycle number");
122 keydata->AddText("fSeekKey: Pointer to Object on file");
123 keydata->AddText("fSeekPdir: Pointer to directory on file");
124 keydata->AddText("fClassName: 'TKey'");
125 keydata->AddText("fName: Object name");
126 keydata->AddText("fTitle: Object Title");
127 c1->Print("fildir.png");
128}
int Int_t
Definition RtypesCore.h:45
Draw all kinds of Arrows.
Definition TArrow.h:29
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:37
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition TAttLine.h:42
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:43
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition TAttText.h:42
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:274
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
void Print(Option_t *option="") const override
Dump this text with its attributes.
Definition TText.cxx:788
TLine * line
return c1
Definition legend1.C:41
Definition file.py:1