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
{
TH1D *
hpx =
new TH1D(
"hpx",
"This is the px distribution",100,-4,4);
hpx->SetDirectory(
nullptr);
hpxpy->SetDirectory(
nullptr);
serv->SetItemField(
"/",
"_monitoring",
"5000");
serv->SetItemField(
"/",
"_layout",
"grid2x2");
serv->SetItemField(
"/",
"_drawitem",
"[hpxpy,hpx,Debug]");
serv->SetItemField(
"/",
"_drawopt",
"col");
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->CreateItem(
"/Debug",
"debug output");
serv->SetItemField(
"/Debug",
"_kind",
"Text");
serv->SetItemField(
"/Debug",
"value",
"\\(\\displaystyle{x+1\\over y-1}\\)");
serv->SetItemField(
"/Debug",
"mathjax",
"true");
cnt++;
} else {
}
serv->SetItemField(
"/Debug",
"value",
Form(
"\\(\\displaystyle{x+1\\over y-1}\\) Loop:%ld", cnt/
kUPDATE));
}
}
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
1-D histogram with a double per channel (see TH1 documentation)
2-D histogram with a double per channel (see TH1 documentation)
Online http server for arbitrary ROOT application.
Random number generator class based on M.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
- Author
- Sergey Linev
Definition in file httpcontrol.C.