This program creates :
- a one dimensional histogram
- a two dimensional histogram
- a profile histogram
- a memory-resident ntuple
These objects are filled with some random numbers and saved on a in-memory file. All objects can be seen in web browser is open url:
void httpserver(
const char* jobname =
"job1",
Long64_t maxcnt = 0)
{
TFile *hfile =
new TMemFile(filename,
"RECREATE",
"Demo ROOT file with histograms");
TH1F *hpx =
new TH1F(
"hpx",
"This is the px distribution",100,-4,4);
TH2F *hpxpy =
new TH2F(
"hpxpy",
"py vs px",40,-4,4,40,-4,4);
TProfile *hprof =
new TProfile(
"hprof",
"Profile of pz versus px",100,-4,4,0,20);
TNtuple *ntuple =
new TNtuple(
"ntuple",
"Demo ntuple",
"px:py:pz:random:i");
TCanvas *c1 =
new TCanvas(
"c1",
"Dynamic Filling Example",200,10,700,500);
const Int_t kUPDATE = 1000;
while (true) {
pz = px*px + py*py;
if (i<25000) ntuple->
Fill(px,py,pz,rnd,i);
if (i && (i%kUPDATE) == 0) {
if (i == kUPDATE) hpx->
Draw();
if (i == kUPDATE) hfile->
Write();
}
i++;
if ((maxcnt>0) && (i>=maxcnt)) break;
}
}
- Author
- Sergey Linev
Definition in file httpserver.C.