Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
histobrowser.C File Reference

Detailed Description

Demonstrates how to use EVE as a histogram browser.

TGFileBrowser *g_hlt_browser = 0;
TCanvas *g_hlt_canvas = 0;
void histobrowser(const char* name="HLT Histos")
{
// --- Create special browser
g_hlt_browser = gEve->GetBrowser()->MakeFileBrowser();
// --- Fill and register some lists/folders/histos
TH1F* h;
TList* l = new TList;
l->SetName("Cilka");
h = new TH1F("Foo", "Bar", 51, 0, 1);
for (Int_t i=0; i<500; ++i)
h->Fill(gRandom->Gaus(.63, .2));
l->Add(h);
g_hlt_browser->Add(l);
TFolder* f = new TFolder("Booboayes", "Statisticos");
h = new TH1F("Fooes", "Baros", 51, 0, 1);
for (Int_t i=0; i<2000; ++i) {
h->Fill(gRandom->Gaus(.7, .1));
h->Fill(gRandom->Gaus(.3, .1));
}
f->Add(h);
g_hlt_browser->Add(f);
h = new TH1F("Fooesoto", "Barosana", 51, 0, 1);
for (Int_t i=0; i<4000; ++i) {
h->Fill(gRandom->Gaus(.25, .02), 0.04);
h->Fill(gRandom->Gaus(.5, .1));
h->Fill(gRandom->Gaus(.75, .02), 0.04);
}
g_hlt_browser->Add(h);
// --- Add some macros.
m = new TMacro;
m->AddLine("{ g_hlt_canvas->Clear();"
" g_hlt_canvas->cd();"
" g_hlt_canvas->Update(); }");
m->SetName("Clear Canvas");
g_hlt_browser->Add(m);
m = new TMacro;
m->AddLine("{ g_hlt_canvas->Clear();"
" g_hlt_canvas->Divide(2,2);"
" g_hlt_canvas->cd(1);"
" g_hlt_canvas->Update(); }");
m->SetName("Split Canvas");
g_hlt_browser->Add(m);
// --- Create an embedded canvas
g_hlt_canvas = new TCanvas;
gEve->GetBrowser()->StopEmbedding("HLT Canvas");
}
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
int Int_t
Definition RtypesCore.h:45
#define gDirectory
Definition TDirectory.h:384
R__EXTERN TEveManager * gEve
char name[80]
Definition TGX11.cxx:110
R__EXTERN TRandom * gRandom
Definition TRandom.h:62
The Canvas class.
Definition TCanvas.h:23
TGFileBrowser * MakeFileBrowser(Bool_t make_default=kFALSE)
Create a file-browser.
TEveBrowser * GetBrowser() const
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
<div class="legacybox"><h2>Legacy Code</h2> TFolder is a legacy interface: there will be no bug fixes...
Definition TFolder.h:30
System file browser, used as TRootBrowser plug-in.
void Add(TObject *obj, const char *name=nullptr, Int_t check=-1) override
Add items to the browser.
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:623
A doubly linked list.
Definition TList.h:38
Class supporting a collection of lines with C++ code.
Definition TMacro.h:31
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
Definition TRandom.cxx:275
void StartEmbedding(Int_t pos=kRight, Int_t subpos=-1) override
Start embedding external frame in the tab "pos" and tab element "subpos".
void StopEmbedding(const char *name=nullptr) override
TMarker m
Definition textangle.C:8
TLine l
Definition textangle.C:4
Author
Matevz Tadel

Definition in file histobrowser.C.