Logo ROOT   6.14/05
Reference Guide
fildir.py
Go to the documentation of this file.
1 ## \file
2 ## \ingroup tutorial_pyroot
3 ## \notebook
4 ## This macro displays the ROOT Directory data structure
5 ##
6 ## \macro_image
7 ## \macro_code
8 ##
9 ## \author Wim Lavrijsen
10 
11 from ROOT import TCanvas, TPaveLabel, TPaveText, TText, TArrow, TLine
12 from ROOT import gROOT
13 
14 c1 = TCanvas( 'c1', 'ROOT FilDir description', 700, 900 )
15 c1.Range( 1, 1, 19, 24.5 )
16 
17 title = TPaveLabel( 4, 23, 16, 24.2, 'ROOT File/Directory/Key description' )
18 title.SetFillColor( 16 )
19 title.Draw()
20 
21 keycolor = 42
22 dircolor = 21
23 objcolor = 46
24 file = TPaveText( 2, 19, 6, 22 )
25 file.SetFillColor( 39 )
26 file.Draw()
27 file.SetTextSize( 0.04 )
28 file.AddText( 'TFile' )
29 file.AddText( 'Header' )
30 arrow = TArrow( 6, 20.5, 17, 20.5, 0.02, '|>' )
31 arrow.SetFillStyle( 1001 )
32 arrow.SetLineWidth( 2 )
33 arrow.Draw()
34 free = TPaveText( 8, 20, 11, 21 )
35 free.SetFillColor( 18 )
36 free.Draw()
37 free.AddText( 'First:Last' )
38 free2 = TPaveText( 12, 20, 15, 21 )
39 free2.SetFillColor( 18 )
40 free2.Draw()
41 free2.AddText( 'First:Last' )
42 tfree = TText( 6.2, 21.2, 'fFree = TList of free blocks' )
43 tfree.SetTextSize( 0.02 )
44 tfree.Draw()
45 tkeys = TText( 5.2, 18.2, 'fKeys = TList of Keys' )
46 tkeys.SetTextSize( 0.02 )
47 tkeys.Draw()
48 tmemory = TText( 3.2, 15.2, 'fListHead = TList of Objects in memory' )
49 tmemory.SetTextSize( 0.02 )
50 tmemory.Draw()
51 
52 arrow.DrawArrow( 5, 17, 17, 17, 0.02, '|>' )
53 line = TLine( 5, 19, 5, 17 )
54 line.SetLineWidth( 2 )
55 line.Draw()
56 key0 = TPaveText( 7, 16, 10, 18 )
57 key0.SetTextSize( 0.04 )
58 key0.SetFillColor( keycolor )
59 key0.AddText( 'Key 0' )
60 key0.Draw()
61 key1 = TPaveText( 12, 16, 15, 18 )
62 key1.SetTextSize( 0.04 )
63 key1.SetFillColor( keycolor )
64 key1.AddText( 'Key 1' )
65 key1.Draw()
66 line.DrawLine( 3, 19, 3, 14 )
67 line.DrawLine( 3, 14, 18, 14 )
68 obj0 = TPaveText( 5, 13, 8, 15 )
69 obj0.SetFillColor( objcolor )
70 obj0.AddText( 'Object' )
71 obj0.Draw()
72 dir1 = TPaveText( 10, 13, 13, 15 )
73 dir1.SetFillColor( dircolor )
74 dir1.AddText( 'SubDir' )
75 dir1.Draw()
76 obj1 = TPaveText( 15, 13, 18, 15 )
77 obj1.SetFillColor( objcolor )
78 obj1.AddText( 'Object' )
79 obj1.Draw()
80 arrow.DrawArrow( 12, 11, 17, 11, 0.015, '|>' )
81 arrow.DrawArrow( 11, 9, 17, 9, 0.015, '|>' )
82 line.DrawLine( 12, 13, 12, 11 )
83 line.DrawLine( 11, 13, 11, 9 )
84 key2 = TPaveText( 14, 10.5, 16, 11.5 )
85 key2.SetFillColor( keycolor )
86 key2.AddText( 'Key 0' )
87 key2.Draw()
88 obj2 = TPaveText( 14, 8.5, 16, 9.5 )
89 obj2.SetFillColor( objcolor )
90 obj2.AddText( 'Object' )
91 obj2.Draw()
92 ldot = TLine( 10, 15, 2, 11 )
93 ldot.SetLineStyle( 2 )
94 ldot.Draw()
95 ldot.DrawLine( 13, 15, 8, 11 )
96 ldot.DrawLine( 13, 13, 8, 5 )
97 dirdata = TPaveText( 2, 5, 8, 11 )
98 dirdata.SetTextAlign( 12 )
99 dirdata.SetFillColor( dircolor )
100 dirdata.Draw()
101 dirdata.SetTextSize( 0.015 )
102 dirdata.AddText( 'fModified: True if directory is modified' )
103 dirdata.AddText( 'fWritable: True if directory is writable' )
104 dirdata.AddText( 'fDatimeC: Creation Date/Time' )
105 dirdata.AddText( 'fDatimeM: Last mod Date/Time' )
106 dirdata.AddText( 'fNbytesKeys: Number of bytes of key' )
107 dirdata.AddText( 'fNbytesName : Header length up to title' )
108 dirdata.AddText( 'fSeekDir: Start of Directory on file' )
109 dirdata.AddText( 'fSeekParent: Start of Parent Directory' )
110 dirdata.AddText( 'fSeekKeys: Pointer to Keys record' )
111 keydata = TPaveText( 10, 2, 17, 7 )
112 keydata.SetTextAlign( 12 )
113 keydata.SetFillColor( keycolor )
114 keydata.Draw()
115 ldot.DrawLine( 14, 11.5, 10, 7 )
116 ldot.DrawLine( 16, 11.5, 17, 7 )
117 keydata.SetTextSize( 0.015 )
118 keydata.AddText( 'fNbytes: Size of compressed Object' )
119 keydata.AddText( 'fObjLen: Size of uncompressed Object' )
120 keydata.AddText( 'fDatime: Date/Time when written to store' )
121 keydata.AddText( 'fKeylen: Number of bytes for the key' )
122 keydata.AddText( 'fCycle : Cycle number' )
123 keydata.AddText( 'fSeekKey: Pointer to Object on file' )
124 keydata.AddText( 'fSeekPdir: Pointer to directory on file' )
125 keydata.AddText( 'fClassName: "TKey"' )
126 keydata.AddText( 'fName: Object name' )
127 keydata.AddText( 'fTitle: Object Title' )
128 
129 c1.Update()
Base class for several text objects.
Definition: TText.h:23
A Pave (see TPave) with a text centered in the Pave.
Definition: TPaveLabel.h:20
A simple line.
Definition: TLine.h:23
The Canvas class.
Definition: TCanvas.h:31
A Pave (see TPave) with text, lines or/and boxes inside.
Definition: TPaveText.h:21
Draw all kinds of Arrows.
Definition: TArrow.h:29