Logo ROOT  
Reference Guide
custom.C File Reference

Detailed Description

This program creates and fills one and two dimensional histogram Macro used to demonstrate usage of custom HTML page in custom.htm One can use plain JavaScript to assign different actions with HTML buttons

#include <TH1.h>
#include <TH2.h>
#include <THttpServer.h>
#include <TRandom3.h>
void custom()
{
// Create two 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);
// http server with port 8080, use jobname as top-folder name
THttpServer* serv = new THttpServer("http:8080");
// use custom web page as default
serv->SetDefaultPage("custom.htm");
// Fill histograms randomly
TRandom3 random;
Float_t px, py;
// press Ctrl-C to stop macro
while (!gSystem->ProcessEvents()) {
random.Rannor(px,py);
hpx->Fill(px);
hpxpy->Fill(px,py);
}
}
Author
Sergey Linev

Definition in file custom.C.

TH2F
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:251
Float_t
float Float_t
Definition: RtypesCore.h:57
THttpServer::SetDefaultPage
void SetDefaultPage(const std::string &filename="")
Set file name of HTML page, delivered by the server when http address is opened in the browser.
Definition: THttpServer.cxx:308
TRandom::Rannor
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
Definition: TRandom.cxx:489
THttpServer
Definition: THttpServer.h:31
TRandom3
Definition: TRandom3.h:27
TH1::Fill
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Definition: TH1.cxx:3274
TRandom3.h
TH2.h
TH2::Fill
Int_t Fill(Double_t)
Invalid Fill method.
Definition: TH2.cxx:294
gSystem
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
THttpServer.h
TH1F
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:572
TH1.h
TSystem::ProcessEvents
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition: TSystem.cxx:417