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

Detailed Description

Demonstates 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:290
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
void SetName(const char *name)
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.
A TFolder object is a collection of objects and folders.
Definition TFolder.h:30
virtual void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add items to the browser.
1-D histogram with a float per channel (see TH1 documentation)}
Definition TH1.h:575
A doubly linked list.
Definition TList.h:44
Class supporting a collection of lines with C++ code.
Definition TMacro.h:31
virtual TObjString * AddLine(const char *text)
Add line with text in the list of lines of this macro.
Definition TMacro.cxx:141
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:274
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
auto * m
Definition textangle.C:8
auto * l
Definition textangle.C:4
Author
Matevz Tadel

Definition in file histobrowser.C.