43void billw(
const char *billname,
Int_t compress)
47 TFile f(billname,
"recreate",
"bill benchmark with keys", compress);
48 TH1F h(
"h",
"h", 1000, -3, 3);
49 h.FillRandom(
"gaus", 50000);
51 for (
Int_t i = 0; i <
N; i++) {
53 sprintf(
name,
"h%d", i);
59 printf(
"billw%d : RT=%7.3f s, Cpu=%7.3f s, File size= %9d bytes, CX= %g\n",
61 f.GetCompressionFactor());
64void billr(
const char *billname,
Int_t compress)
71 TIter next(
f.GetListOfKeys());
76 auto hmean =
new TH1F(
"hmean",
"hist mean from keys", 100, 0, 1);
78 while ((key = (
TKey*)next())) {
80 hmean->Fill(
h->GetMean());
85 printf(
"billr%d : RT=%7.3f s, Cpu=%7.3f s\n", compress, timer.
RealTime(), timer.
CpuTime());
88void billtw(
const char *billtname,
Int_t compress)
92 TFile f(billtname,
"recreate",
"bill benchmark with trees", compress);
93 auto h =
new TH1F(
"h",
"h", 1000, -3, 3);
94 h->FillRandom(
"gaus", 50000);
95 auto T =
new TTree(
"T",
"test bill");
96 T->Branch(
"event",
"TH1F", &
h, 64000, 0);
97 for (
Int_t i = 0; i <
N; i++) {
99 sprintf(
name,
"h%d", i);
107 printf(
"billtw%d : RT=%7.3f s, Cpu=%7.3f s, File size= %9d bytes, CX= %g\n",
109 f.GetCompressionFactor());
112void billtr(
const char *billtname,
Int_t compress)
118 auto T =
f.Get<
TTree>(
"T");
120 auto hmeant =
new TH1F(
"hmeant",
"hist mean from tree", 100, 0, 1);
124 hmeant->Fill(
h->GetMean());
127 printf(
"billtr%d : RT=%7.3f s, Cpu=%7.3f s\n", compress, timer.
RealTime(), timer.
CpuTime());
130void tree202_benchmarks()
133 TString bill = dir +
"/bill.root";
134 TString billt = dir +
"/billt.root";
138 for (
Int_t compress = 0; compress < 2; compress++) {
139 billw(bill, compress);
140 billr(bill, compress);
141 billtw(billt, compress);
142 billtr(billt, compress);
149 printf(
"billtot : RT=%7.3f s, Cpu=%7.3f s\n", realtime, cputime);
151 Float_t rootmarks = 600 * (16.98 + 14.40) / (realtime + cputime);
152 printf(
"******************************************************************\n");
153 printf(
"* ROOTMARKS =%6.1f * Root%-8s %d/%d\n", rootmarks,
154 gROOT->GetVersion(),
gROOT->GetVersionDate(),
gROOT->GetVersionTime());
155 printf(
"******************************************************************\n");
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
float Float_t
Float 4 bytes (float).
TDirectory::TContext keeps track and restore the current directory.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
1-D histogram with a float per channel (see TH1 documentation)
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.
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.
A TTree represents a columnar dataset.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr, bool suppressMissingBranchError)