45void billw(
const char *billname,
Int_t compress) {
48 TFile f(billname,
"recreate",
"bill benchmark with keys",compress);
49 TH1F h(
"h",
"h",1000,-3,3);
50 h.FillRandom(
"gaus",50000);
54 sprintf(
name,
"h%d",i);
60 printf(
"billw%d : RT=%7.3f s, Cpu=%7.3f s, File size= %9d bytes, CX= %g\n",compress,timer.
RealTime(),timer.
CpuTime(),
61 (
Int_t)
f.GetBytesWritten(),
f.GetCompressionFactor());
64void billr(
const char *billname,
Int_t compress) {
68 TIter next(
f.GetListOfKeys());
73 TH1F *hmean =
new TH1F(
"hmean",
"hist mean from keys",100,0,1);
75 while ((key=(
TKey*)next())) {
77 hmean->
Fill(
h->GetMean());
82 printf(
"billr%d : RT=%7.3f s, Cpu=%7.3f s\n",compress,timer.
RealTime(),timer.
CpuTime());
85void billtw(
const char *billtname,
Int_t compress) {
88 TFile f(billtname,
"recreate",
"bill benchmark with trees",compress);
90 h->FillRandom(
"gaus",50000);
92 T->Branch(
"event",
"TH1F",&
h,64000,0);
95 sprintf(
name,
"h%d",i);
103 printf(
"billtw%d : RT=%7.3f s, Cpu=%7.3f s, File size= %9d bytes, CX= %g\n",compress,timer.
RealTime(),timer.
CpuTime(),
104 (
Int_t)
f.GetBytesWritten(),
f.GetCompressionFactor());
107void billtr(
const char *billtname,
Int_t compress) {
113 T->SetBranchAddress(
"event",&
h);
114 TH1F *hmeant =
new TH1F(
"hmeant",
"hist mean from tree",100,0,1);
118 hmeant->
Fill(
h->GetMean());
121 printf(
"billtr%d : RT=%7.3f s, Cpu=%7.3f s\n",compress,timer.
RealTime(),timer.
CpuTime());
127 TString bill = dir +
"/bill.root";
128 TString billt = dir +
"/billt.root";
132 for (
Int_t compress=0;compress<2;compress++) {
133 billw(bill,compress);
134 billr(bill,compress);
135 billtw(billt,compress);
136 billtr(billt,compress);
143 printf(
"billtot : RT=%7.3f s, Cpu=%7.3f s\n",realtime,cputime);
146 printf(
"******************************************************************\n");
147 printf(
"* ROOTMARKS =%6.1f * Root%-8s %d/%d\n",
rootmarks,
gROOT->GetVersion(),
gROOT->GetVersionDate(),
gROOT->GetVersionTime());
148 printf(
"******************************************************************\n");
R__EXTERN TRandom * gRandom
R__EXTERN TSystem * gSystem
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
1-D histogram with a float per channel (see TH1 documentation)}
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual TObject * ReadObj()
To read a TObject* from the file.
virtual Double_t Rndm()
Machine independent random number generator.
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
void Stop()
Stop the stopwatch.
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
virtual int Unlink(const char *name)
Unlink, i.e.
A TTree represents a columnar dataset.