ROOT logo

From $ROOTSYS/tutorials/io/file.C

{
   //
   // This macro displays the physical ROOT file structure
   //Author: Rene Brun
   
   gROOT->Reset();
   c1 = new TCanvas("c1","ROOT File description",200,10,700,550);

   c1->Range(0,-0.25,21,14);
   TPaveLabel title(5,12,15,13.7,c1->GetTitle());
   title.SetFillColor(16);
   title.Draw();

   // horizonthal file layout
   TPave file(1,8.5,20,11);
   file.SetFillColor(11);
   file.Draw();
   TPave fileh(1,8.5,2.5,11);
   fileh.SetFillColor(44);
   fileh.Draw();
   TPave lrh(2.5,8.5,3.3,11,1);
   lrh.SetFillColor(33);
   lrh.Draw();
   lrh.DrawPave(6.9,8.5,7.7,11,1);
   lrh.DrawPave(10.5,8.5,11.3,11,1);
   lrh.DrawPave(14.5,8.5,15.3,11,1);
   TLine ldot(1,8.5,0.5,6.5);
   ldot.SetLineStyle(2);
   ldot.Draw();
   ldot.DrawLine(2.5, 8.5, 9.4, 6.5);
   ldot.DrawLine(10.5, 8.5, 10, 6.5);
   ldot.DrawLine(11.3, 8.5, 19.5, 6.5);
   TLine line(2.6,11,2.6,11.5);
   line.Draw();
   line.DrawLine(2.6,11.5,7,11.5);
   TArrow arrow(7,11.5,7,11.1,0.01,"|>");
   arrow.SetFillStyle(1001);
   arrow.Draw();
   line.DrawLine( 7, 8.5, 7, 8.0);
   line.DrawLine( 7, 8.0, 10.6, 8);
   arrow.DrawArrow( 10.6,8, 10.6, 8.4,0.01,"|>");
   line.DrawLine( 10.6, 11, 10.6, 11.5);
   line.DrawLine( 10.6, 11.5, 14.6, 11.5);
   arrow.DrawArrow( 14.6,11.5, 14.6,11.1,0.01,"|>");
   line.DrawLine( 14.6, 8.5, 14.6, 8.0);
   line.DrawLine( 14.6, 8.0, 16, 8);
   ldot.DrawLine(16, 8, 19, 8);
   TText vert(1.5,9.75,"File");
   vert.SetTextAlign(21);
   vert.SetTextAngle(90);
   vert.SetTextSize(0.025);
   vert.Draw();
   vert.DrawText(2.0, 9.75,"Header");
   vert.DrawText(2.9, 9.75,"Logical Record");
   vert.DrawText(3.2, 9.75,"Header");
   vert.DrawText(7.3, 9.75,"Logical Record");
   vert.DrawText(7.6, 9.75,"Header");
   vert.DrawText(10.9,9.75,"Logical Record");
   vert.DrawText(11.2,9.75,"Header");
   vert.DrawText(14.9,9.75,"Logical Record");
   vert.DrawText(15.2,9.75,"Header");
   TText hori(4.75,10,"Object");
   hori.SetTextAlign(22);
   hori.SetTextSize(0.035);
   hori.Draw();
   hori.DrawText(4.75, 9.5,"Data");
   hori.DrawText(9.2, 10,"Deleted");
   hori.DrawText(9.2, 9.5,"Object");
   line.DrawLine( 6.9, 8.5, 10.5, 11);
   line.DrawLine( 6.9, 11, 10.5, 8.5);
   TText tbig(17,9.75,"............");
   tbig.SetTextAlign(22);
   tbig.SetTextSize(0.03);
   tbig.Draw();
   tbig.DrawText(2.6, 7, "fBEGIN");
   tbig.DrawText(20., 7, "fEND");
   arrow.DrawArrow( 2.6,7, 2.6,8.4,0.01,"|>");
   arrow.DrawArrow( 20,7, 20,8.4,0.01,"|>");

   //file header
   TPaveText header(0.5,.2,9.4,6.5);
   header.SetFillColor(44);
   header.Draw();
   TText *fh=header.AddText("File Header");
   fh->SetTextAlign(22);
   fh->SetTextSize(0.04);
   header.SetTextSize(0.027);
   header.SetTextAlign(12);
   header.AddText(" ");
   header.AddLine(0,0,0,0);
   header.AddText("\"root\": Root File Identifier");
   header.AddText("fVersion: File version identifier");
   header.AddText("fBEGIN: Pointer to first data record");
   header.AddText("fEND: Pointer to first free word at EOF");
   header.AddText("fSeekFree: Pointer to FREE data record");
   header.AddText("fNbytesFree: Number of bytes in FREE");
   header.AddText("fNfree: Number of free data records");
   header.AddText("fNbytesName: Number of bytes in name/title");
   header.AddText("fUnits: Number of bytes for pointers");
   header.AddText("fCompress: Compression level");

   //logical record header
   TPaveText lrecord(10,0.2,19.5,6.5);
   lrecord.SetFillColor(33);
   lrecord.Draw();
   TText *tlrh=lrecord.AddText("Logical Record Header (TKEY)");
   tlrh->SetTextAlign(22);
   tlrh->SetTextSize(0.04);
   lrecord.SetTextSize(0.027);
   lrecord.SetTextAlign(12);
   lrecord.AddText(" ");
   lrecord.AddLine(0,0,0,0);
   lrecord.AddText("fNbytes: Length of compressed object");
   lrecord.AddText("fVersion: Key version identifier");
   lrecord.AddText("fObjLen: Length of uncompressed object");
   lrecord.AddText("fDatime: Date/Time when written to store");
   lrecord.AddText("fKeylen: Number of bytes for the key");
   lrecord.AddText("fCycle : Cycle number");
   lrecord.AddText("fSeekKey: Pointer to object on file");
   lrecord.AddText("fSeekPdir: Pointer to directory on file");
   lrecord.AddText("fClassName: class name of the object");
   lrecord.AddText("fName: name of the object");
   lrecord.AddText("fTitle: title of the object");

   c1->Update();
}
 file.C:1
 file.C:2
 file.C:3
 file.C:4
 file.C:5
 file.C:6
 file.C:7
 file.C:8
 file.C:9
 file.C:10
 file.C:11
 file.C:12
 file.C:13
 file.C:14
 file.C:15
 file.C:16
 file.C:17
 file.C:18
 file.C:19
 file.C:20
 file.C:21
 file.C:22
 file.C:23
 file.C:24
 file.C:25
 file.C:26
 file.C:27
 file.C:28
 file.C:29
 file.C:30
 file.C:31
 file.C:32
 file.C:33
 file.C:34
 file.C:35
 file.C:36
 file.C:37
 file.C:38
 file.C:39
 file.C:40
 file.C:41
 file.C:42
 file.C:43
 file.C:44
 file.C:45
 file.C:46
 file.C:47
 file.C:48
 file.C:49
 file.C:50
 file.C:51
 file.C:52
 file.C:53
 file.C:54
 file.C:55
 file.C:56
 file.C:57
 file.C:58
 file.C:59
 file.C:60
 file.C:61
 file.C:62
 file.C:63
 file.C:64
 file.C:65
 file.C:66
 file.C:67
 file.C:68
 file.C:69
 file.C:70
 file.C:71
 file.C:72
 file.C:73
 file.C:74
 file.C:75
 file.C:76
 file.C:77
 file.C:78
 file.C:79
 file.C:80
 file.C:81
 file.C:82
 file.C:83
 file.C:84
 file.C:85
 file.C:86
 file.C:87
 file.C:88
 file.C:89
 file.C:90
 file.C:91
 file.C:92
 file.C:93
 file.C:94
 file.C:95
 file.C:96
 file.C:97
 file.C:98
 file.C:99
 file.C:100
 file.C:101
 file.C:102
 file.C:103
 file.C:104
 file.C:105
 file.C:106
 file.C:107
 file.C:108
 file.C:109
 file.C:110
 file.C:111
 file.C:112
 file.C:113
 file.C:114
 file.C:115
 file.C:116
 file.C:117
 file.C:118
 file.C:119
 file.C:120
 file.C:121
 file.C:122
 file.C:123
 file.C:124
 file.C:125
 file.C:126
 file.C:127