This program demonstrates simple application control via THttpServer Two histogram are filled within endless loop.
Via published commands one can enable/disable histograms filling There are also command to clear histograms content
After macro started, open in browser with url
Histograms will be automatically displayed and monitoring with interval 2000 ms started
void httpcontrol()
{
TH1D *hpx =
new TH1D(
"hpx",
"This is the px distribution",100,-4,4);
hpx->SetFillColor(48);
hpx->SetDirectory(nullptr);
TH2D *hpxpy =
new TH2D(
"hpxpy",
"py vs px",40,-4,4,40,-4,4);
serv->
RegisterCommand(
"/Start",
"bFillHist=kTRUE;",
"button;rootsys/icons/ed_execute.png");
serv->
RegisterCommand(
"/Stop",
"bFillHist=kFALSE;",
"button;rootsys/icons/ed_interrupt.png");
serv->
RegisterCommand(
"/ResetHPX",
"/hpx/->Reset()",
"button;rootsys/icons/ed_delete.png");
serv->
RegisterCommand(
"/ResetHPXPY",
"/hpxpy/->Reset()",
"button;rootsys/icons/bld_delete.png");
serv->
SetItemField(
"/Debug",
"value",
"\\(\\displaystyle{x+1\\over y-1}\\)");
if (bFillHist) {
hpx->Fill(px);
cnt++;
} else {
}
if ((cnt %
kUPDATE==0) || !bFillHist) {
if (
gSystem->ProcessEvents())
break;
}
}
}
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
float Float_t
Float 4 bytes (float).
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
1-D histogram with a double per channel (see TH1 documentation)
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
2-D histogram with a double per channel (see TH1 documentation)
Int_t Fill(Double_t) override
Invalid Fill method.
Online http server for arbitrary ROOT application.
Bool_t RegisterCommand(const char *cmdname, const char *method, const char *icon=nullptr)
Register command which can be executed from web interface.
Bool_t CreateItem(const char *fullname, const char *title)
Create item in sniffer.
Bool_t Hide(const char *fullname, Bool_t hide=kTRUE)
Hides folder or element from web gui.
Bool_t Register(const char *subfolder, TObject *obj)
Register object in subfolder.
Bool_t SetItemField(const char *fullname, const char *name, const char *value)
Set item field in sniffer.
Random number generator class based on M.
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
- Author
- Sergey Linev
Definition in file httpcontrol.C.