Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
file.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_io
3/// \notebook
4/// This macro displays the physical ROOT file structure
5///
6/// \macro_image
7/// \macro_code
8///
9/// \author Rene Brun
10
11void file(){
12
13 TCanvas *c1 = new TCanvas("c1","ROOT File description",200,10,700,550);
14
15 c1->Range(0,-0.25,21,14);
16 TPaveLabel *title = new TPaveLabel(5,12,15,13.7,c1->GetTitle());
17 title->SetFillColor(16);
18 title->Draw();
19
20 // horizontal file layout
21 TPave *file = new TPave(1,8.5,20,11);
22 file->SetFillColor(11);
23 file->Draw();
24 TPave *fileh = new TPave(1,8.5,2.5,11);
25 fileh->SetFillColor(44);
26 fileh->Draw();
27 TPave *lrh = new TPave(2.5,8.5,3.3,11,1);
28 lrh->SetFillColor(33);
29 lrh->Draw();
30 lrh->DrawPave(6.9,8.5,7.7,11,1);
31 lrh->DrawPave(10.5,8.5,11.3,11,1);
32 lrh->DrawPave(14.5,8.5,15.3,11,1);
33 TLine *ldot = new TLine(1,8.5,0.5,6.5);
34 ldot->SetLineStyle(2);
35 ldot->Draw();
36 ldot->DrawLine(2.5, 8.5, 9.4, 6.5);
37 ldot->DrawLine(10.5, 8.5, 10, 6.5);
38 ldot->DrawLine(11.3, 8.5, 19.5, 6.5);
39 TLine *line = new TLine(2.6,11,2.6,11.5);
40 line->Draw();
41 line->DrawLine(2.6,11.5,7,11.5);
42 TArrow *arrow = new TArrow(7,11.5,7,11.1,0.01,"|>");
43 arrow->SetFillStyle(1001);
44 arrow->Draw();
45 line->DrawLine( 7, 8.5, 7, 8.0);
46 line->DrawLine( 7, 8.0, 10.6, 8);
47 arrow->DrawArrow( 10.6,8, 10.6, 8.4,0.01,"|>");
48 line->DrawLine( 10.6, 11, 10.6, 11.5);
49 line->DrawLine( 10.6, 11.5, 14.6, 11.5);
50 arrow->DrawArrow( 14.6,11.5, 14.6,11.1,0.01,"|>");
51 line->DrawLine( 14.6, 8.5, 14.6, 8.0);
52 line->DrawLine( 14.6, 8.0, 16, 8);
53 ldot->DrawLine(16, 8, 19, 8);
54 TText *vert = new TText(1.5,9.75,"File");
55 vert->SetTextAlign(21);
56 vert->SetTextAngle(90);
57 vert->SetTextSize(0.025);
58 vert->Draw();
59 vert->DrawText(2.0, 9.75,"Header");
60 vert->DrawText(2.9, 9.75,"Logical Record");
61 vert->DrawText(3.2, 9.75,"Header");
62 vert->DrawText(7.3, 9.75,"Logical Record");
63 vert->DrawText(7.6, 9.75,"Header");
64 vert->DrawText(10.9,9.75,"Logical Record");
65 vert->DrawText(11.2,9.75,"Header");
66 vert->DrawText(14.9,9.75,"Logical Record");
67 vert->DrawText(15.2,9.75,"Header");
68 TText *hori = new TText(4.75,10,"Object");
69 hori->SetTextAlign(22);
70 hori->SetTextSize(0.035);
71 hori->Draw();
72 hori->DrawText(4.75, 9.5,"Data");
73 hori->DrawText(9.2, 10,"Deleted");
74 hori->DrawText(9.2, 9.5,"Object");
75 line->DrawLine( 6.9, 8.5, 10.5, 11);
76 line->DrawLine( 6.9, 11, 10.5, 8.5);
77 TText *tbig = new TText(17,9.75,"............");
78 tbig->SetTextAlign(22);
79 tbig->SetTextSize(0.03);
80 tbig->Draw();
81 tbig->DrawText(2.6, 7, "fBEGIN");
82 tbig->DrawText(20., 7, "fEND");
83 arrow->DrawArrow( 2.6,7, 2.6,8.4,0.01,"|>");
84 arrow->DrawArrow( 20,7, 20,8.4,0.01,"|>");
85
86 //file header
87 TPaveText *header = new TPaveText(0.5,.2,9.4,6.5);
88 header->SetFillColor(44);
89 header->Draw();
90 TText *fh=header->AddText("File Header");
91 fh->SetTextAlign(22);
92 fh->SetTextSize(0.04);
93 header->SetTextSize(0.027);
94 header->SetTextAlign(12);
95 header->AddText(" ");
96 header->AddLine(0,0,0,0);
97 header->AddText("\"root\": Root File Identifier");
98 header->AddText("fVersion: File version identifier");
99 header->AddText("fBEGIN: Pointer to first data record");
100 header->AddText("fEND: Pointer to first free word at EOF");
101 header->AddText("fSeekFree: Pointer to FREE data record");
102 header->AddText("fNbytesFree: Number of bytes in FREE");
103 header->AddText("fNfree: Number of free data records");
104 header->AddText("fNbytesName: Number of bytes in name/title");
105 header->AddText("fUnits: Number of bytes for pointers");
106 header->AddText("fCompress: Compression level");
107
108 //logical record header
109 TPaveText *lrecord = new TPaveText(10,0.2,19.5,6.5);
110 lrecord->SetFillColor(33);
111 lrecord->Draw();
112 TText *tlrh = lrecord->AddText("Logical Record Header (TKEY)");
113 tlrh->SetTextAlign(22);
114 tlrh->SetTextSize(0.04);
115 lrecord->SetTextSize(0.027);
116 lrecord->SetTextAlign(12);
117 lrecord->AddText(" ");
118 lrecord->AddLine(0,0,0,0);
119 lrecord->AddText("fNbytes: Length of compressed object");
120 lrecord->AddText("fVersion: Key version identifier");
121 lrecord->AddText("fObjLen: Length of uncompressed object");
122 lrecord->AddText("fDatime: Date/Time when written to store");
123 lrecord->AddText("fKeylen: Number of bytes for the key");
124 lrecord->AddText("fCycle : Cycle number");
125 lrecord->AddText("fSeekKey: Pointer to object on file");
126 lrecord->AddText("fSeekPdir: Pointer to directory on file");
127 lrecord->AddText("fClassName: class name of the object");
128 lrecord->AddText("fName: name of the object");
129 lrecord->AddText("fTitle: title of the object");
130
131 c1->Update();
132 c1->Print("file.png");
133}
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 SetTextAlign(Short_t align=11)
Set the text alignment.
Definition TAttText.h:42
virtual void SetTextAngle(Float_t tangle=0)
Set the text angle.
Definition TAttText.h:43
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:102
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.
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.
void Draw(Option_t *option="") override
Draw this pavetext with its current attributes.
A TBox with a bordersize and a shadow option.
Definition TPave.h:19
void Draw(Option_t *option="") override
Draw this pave with its current attributes.
Definition TPave.cxx:228
virtual TPave * 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:240
Base class for several text objects.
Definition TText.h:22
virtual TText * DrawText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
Definition TText.cxx:175
void Print(Option_t *option="") const override
Dump this text with its attributes.
Definition TText.cxx:780
TLine * line
return c1
Definition legend1.C:41
Definition file.py:1