Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
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"
#include "TSystem.h"
#include <string>
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");
// Detect macro file location to specify full path to the HTML file
std::string fname = __FILE__;
auto pos = fname.find("custom.C");
if (pos > 0)
fname.resize(pos);
else
fname.clear();
fname.append("custom.htm");
// use custom web page as default
serv->SetDefaultPage(fname);
// Fill histograms randomly
Float_t px, py;
// press Ctrl-C to stop macro
while (!gSystem->ProcessEvents()) {
random.Rannor(px,py);
hpx->Fill(px);
hpxpy->Fill(px,py);
}
}
float Float_t
Definition RtypesCore.h:57
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TSystem * gSystem
Definition TSystem.h:572
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:622
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:307
Online http server for arbitrary ROOT application.
Definition THttpServer.h:31
Random number generator class based on M.
Definition TRandom3.h:27
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition TSystem.cxx:416
Author
Sergey Linev

Definition in file custom.C.