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);
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) {
cnt++;
} else {
}
if ((cnt % kUPDATE==0) || !bFillHist) {
serv->
SetItemField(
"/Debug",
"value",
Form(
"\\(\\displaystyle{x+1\\over y-1}\\) Loop:%d", cnt/kUPDATE));
}
}
}
- Author
Definition in file httpcontrol.C.