Logo ROOT  
Reference Guide
histfitserver.C File Reference

Detailed Description

This program demonstrates simultaneous update of histogram and fitted function. Every second new random entries add and histogram fitted again. Required at least JSROOT version 5.1.1 to see correct fit function update in browser

#include "THttpServer.h"
#include "TH1F.h"
#include "TCanvas.h"
#include "TF1.h"
#include "TSystem.h"
void histfitserver(void)
{
auto serv = new THttpServer("http:8081");
auto h1 = new TH1F("h1", "histogram 1", 100, -5, 5);
auto c1 = new TCanvas("c1");
auto f1 = new TF1("f1", "gaus", -10, 10);
c1->cd();
h1->Draw();
while (!gSystem->ProcessEvents()) {
h1->FillRandom("gaus", 100);
h1->Fit(f1);
c1->Modified();
c1->Update();
gSystem->Sleep(1000);
}
}
Author
Sergey Linev

Definition in file histfitserver.C.

TH1F.h
TCanvas.h
h1
TH1F * h1
Definition: legend1.C:5
THttpServer
Definition: THttpServer.h:31
TSystem.h
TSystem::Sleep
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition: TSystem.cxx:438
TH1::FillRandom
virtual void FillRandom(const char *fname, Int_t ntimes=5000)
Fill histogram following distribution in function fname.
Definition: TH1.cxx:3444
gSystem
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
THttpServer.h
f1
TF1 * f1
Definition: legend1.C:11
TF1.h
TCanvas
Definition: TCanvas.h:23
TH1F
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:572
TH1::Fit
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
Fit histogram with function fname.
Definition: TH1.cxx:3807
TF1
1-Dim function class
Definition: TF1.h:212
TSystem::ProcessEvents
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition: TSystem.cxx:417
TH1::Draw
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2997
c1
return c1
Definition: legend1.C:41