ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
file.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_io
3 /// This macro displays the physical ROOT file structure
4 ///
5 /// \macro_image
6 /// \macro_code
7 ///
8 /// \author Rene Brun
9 
10 void file(){
11 
12  TCanvas *c1 = new TCanvas("c1","ROOT File description",200,10,700,550);
13 
14  c1->Range(0,-0.25,21,14);
15  TPaveLabel *title = new TPaveLabel(5,12,15,13.7,c1->GetTitle());
16  title->SetFillColor(16);
17  title->Draw();
18 
19  // horizonthal file layout
20  TPave *file = new TPave(1,8.5,20,11);
21  file->SetFillColor(11);
22  file->Draw();
23  TPave *fileh = new TPave(1,8.5,2.5,11);
24  fileh->SetFillColor(44);
25  fileh->Draw();
26  TPave *lrh = new TPave(2.5,8.5,3.3,11,1);
27  lrh->SetFillColor(33);
28  lrh->Draw();
29  lrh->DrawPave(6.9,8.5,7.7,11,1);
30  lrh->DrawPave(10.5,8.5,11.3,11,1);
31  lrh->DrawPave(14.5,8.5,15.3,11,1);
32  TLine *ldot = new TLine(1,8.5,0.5,6.5);
33  ldot->SetLineStyle(2);
34  ldot->Draw();
35  ldot->DrawLine(2.5, 8.5, 9.4, 6.5);
36  ldot->DrawLine(10.5, 8.5, 10, 6.5);
37  ldot->DrawLine(11.3, 8.5, 19.5, 6.5);
38  TLine *line = new TLine(2.6,11,2.6,11.5);
39  line->Draw();
40  line->DrawLine(2.6,11.5,7,11.5);
41  TArrow *arrow = new TArrow(7,11.5,7,11.1,0.01,"|>");
42  arrow->SetFillStyle(1001);
43  arrow->Draw();
44  line->DrawLine( 7, 8.5, 7, 8.0);
45  line->DrawLine( 7, 8.0, 10.6, 8);
46  arrow->DrawArrow( 10.6,8, 10.6, 8.4,0.01,"|>");
47  line->DrawLine( 10.6, 11, 10.6, 11.5);
48  line->DrawLine( 10.6, 11.5, 14.6, 11.5);
49  arrow->DrawArrow( 14.6,11.5, 14.6,11.1,0.01,"|>");
50  line->DrawLine( 14.6, 8.5, 14.6, 8.0);
51  line->DrawLine( 14.6, 8.0, 16, 8);
52  ldot->DrawLine(16, 8, 19, 8);
53  TText *vert = new TText(1.5,9.75,"File");
54  vert->SetTextAlign(21);
55  vert->SetTextAngle(90);
56  vert->SetTextSize(0.025);
57  vert->Draw();
58  vert->DrawText(2.0, 9.75,"Header");
59  vert->DrawText(2.9, 9.75,"Logical Record");
60  vert->DrawText(3.2, 9.75,"Header");
61  vert->DrawText(7.3, 9.75,"Logical Record");
62  vert->DrawText(7.6, 9.75,"Header");
63  vert->DrawText(10.9,9.75,"Logical Record");
64  vert->DrawText(11.2,9.75,"Header");
65  vert->DrawText(14.9,9.75,"Logical Record");
66  vert->DrawText(15.2,9.75,"Header");
67  TText *hori = new TText(4.75,10,"Object");
68  hori->SetTextAlign(22);
69  hori->SetTextSize(0.035);
70  hori->Draw();
71  hori->DrawText(4.75, 9.5,"Data");
72  hori->DrawText(9.2, 10,"Deleted");
73  hori->DrawText(9.2, 9.5,"Object");
74  line->DrawLine( 6.9, 8.5, 10.5, 11);
75  line->DrawLine( 6.9, 11, 10.5, 8.5);
76  TText *tbig = new TText(17,9.75,"............");
77  tbig->SetTextAlign(22);
78  tbig->SetTextSize(0.03);
79  tbig->Draw();
80  tbig->DrawText(2.6, 7, "fBEGIN");
81  tbig->DrawText(20., 7, "fEND");
82  arrow->DrawArrow( 2.6,7, 2.6,8.4,0.01,"|>");
83  arrow->DrawArrow( 20,7, 20,8.4,0.01,"|>");
84 
85  //file header
86  TPaveText *header = new TPaveText(0.5,.2,9.4,6.5);
87  header->SetFillColor(44);
88  header->Draw();
89  TText *fh=header->AddText("File Header");
90  fh->SetTextAlign(22);
91  fh->SetTextSize(0.04);
92  header->SetTextSize(0.027);
93  header->SetTextAlign(12);
94  header->AddText(" ");
95  header->AddLine(0,0,0,0);
96  header->AddText("\"root\": Root File Identifier");
97  header->AddText("fVersion: File version identifier");
98  header->AddText("fBEGIN: Pointer to first data record");
99  header->AddText("fEND: Pointer to first free word at EOF");
100  header->AddText("fSeekFree: Pointer to FREE data record");
101  header->AddText("fNbytesFree: Number of bytes in FREE");
102  header->AddText("fNfree: Number of free data records");
103  header->AddText("fNbytesName: Number of bytes in name/title");
104  header->AddText("fUnits: Number of bytes for pointers");
105  header->AddText("fCompress: Compression level");
106 
107  //logical record header
108  TPaveText *lrecord = new TPaveText(10,0.2,19.5,6.5);
109  lrecord->SetFillColor(33);
110  lrecord->Draw();
111  TText *tlrh=lrecord->AddText("Logical Record Header (TKEY)");
112  tlrh->SetTextAlign(22);
113  tlrh->SetTextSize(0.04);
114  lrecord->SetTextSize(0.027);
115  lrecord->SetTextAlign(12);
116  lrecord->AddText(" ");
117  lrecord->AddLine(0,0,0,0);
118  lrecord->AddText("fNbytes: Length of compressed object");
119  lrecord->AddText("fVersion: Key version identifier");
120  lrecord->AddText("fObjLen: Length of uncompressed object");
121  lrecord->AddText("fDatime: Date/Time when written to store");
122  lrecord->AddText("fKeylen: Number of bytes for the key");
123  lrecord->AddText("fCycle : Cycle number");
124  lrecord->AddText("fSeekKey: Pointer to object on file");
125  lrecord->AddText("fSeekPdir: Pointer to directory on file");
126  lrecord->AddText("fClassName: class name of the object");
127  lrecord->AddText("fName: name of the object");
128  lrecord->AddText("fTitle: title of the object");
129 
130  c1->Update();
131  c1->Print("file.png");
132 }
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
Definition: TPaveText.cxx:211
virtual TLine * AddLine(Double_t x1=0, Double_t y1=0, Double_t x2=0, Double_t y2=0)
Add a new graphics line to this pavetext.
Definition: TPaveText.cxx:147
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:138
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 TLine * DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
Definition: TLine.cxx:93
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:254
virtual void SetFillStyle(Style_t fstyle)
Definition: TAttFill.h:52
virtual void Print(const char *filename="") const
Save Pad contents in a file in one of various formats.
Definition: TPad.cxx:4134
A TBox with a bordersize and a shadow option.
Definition: TPave.h:31
virtual void Draw(Option_t *option="")
Draw this arrow with its current attributes.
Definition: TArrow.cxx:121
Base class for several text objects.
Definition: TText.h:42
virtual void SetTextAlign(Short_t align=11)
Definition: TAttText.h:55
A Pave (see TPave) with a text centered in the Pave.
Definition: TPaveLabel.h:32
virtual void SetFillColor(Color_t fcolor)
Definition: TAttFill.h:50
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:4623
virtual void SetTextAngle(Float_t tangle=0)
Definition: TAttText.h:56
A simple line.
Definition: TLine.h:41
const char * GetTitle() const
Returns title of object.
Definition: TPad.h:256
virtual void Draw(Option_t *option="")
Draw this pave with its current attributes.
Definition: TPave.cxx:209
The Canvas class.
Definition: TCanvas.h:48
A Pave (see TPave) with text, lines or/and boxes inside.
Definition: TPaveText.h:35
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
Definition: TPaveLabel.cxx:77
tuple file
Definition: fildir.py:20
virtual void SetLineStyle(Style_t lstyle)
Definition: TAttLine.h:56
virtual void DrawPave(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t bordersize=4, Option_t *option="br")
Draw this pave with new coordinates.
Definition: TPave.cxx:221
virtual TText * DrawText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
Definition: TText.cxx:171
virtual void SetTextSize(Float_t tsize=1)
Definition: TAttText.h:60
virtual void Update()
Update canvas pad buffers.
Definition: TCanvas.cxx:2179
Draw all kinds of Arrows.
Definition: TArrow.h:35