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