Logo ROOT  
Reference Guide
histobrowser.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_eve
3/// Demonstates how to use EVE as a histogram browser.
4///
5/// \image html eve_histobrowser.png
6/// \macro_code
7///
8/// \author Matevz Tadel
9
10TGFileBrowser *g_hlt_browser = 0;
11TCanvas *g_hlt_canvas = 0;
12
13void histobrowser(const char* name="HLT Histos")
14{
16
17 // --- Create special browser
18
20 g_hlt_browser = gEve->GetBrowser()->MakeFileBrowser();
22
23 // --- Fill and register some lists/folders/histos
24
25 gDirectory = 0;
26 TH1F* h;
27
28 TList* l = new TList;
29 l->SetName("Cilka");
30 h = new TH1F("Foo", "Bar", 51, 0, 1);
31 for (Int_t i=0; i<500; ++i)
32 h->Fill(gRandom->Gaus(.63, .2));
33 l->Add(h);
34 g_hlt_browser->Add(l);
35
36 TFolder* f = new TFolder("Booboayes", "Statisticos");
37 h = new TH1F("Fooes", "Baros", 51, 0, 1);
38 for (Int_t i=0; i<2000; ++i) {
39 h->Fill(gRandom->Gaus(.7, .1));
40 h->Fill(gRandom->Gaus(.3, .1));
41 }
42 f->Add(h);
43 g_hlt_browser->Add(f);
44
45 h = new TH1F("Fooesoto", "Barosana", 51, 0, 1);
46 for (Int_t i=0; i<4000; ++i) {
47 h->Fill(gRandom->Gaus(.25, .02), 0.04);
48 h->Fill(gRandom->Gaus(.5, .1));
49 h->Fill(gRandom->Gaus(.75, .02), 0.04);
50 }
51 g_hlt_browser->Add(h);
52
53 // --- Add some macros.
54
55 TMacro* m;
56
57 m = new TMacro;
58 m->AddLine("{ g_hlt_canvas->Clear();"
59 " g_hlt_canvas->cd();"
60 " g_hlt_canvas->Update(); }");
61 m->SetName("Clear Canvas");
62 g_hlt_browser->Add(m);
63
64 m = new TMacro;
65 m->AddLine("{ g_hlt_canvas->Clear();"
66 " g_hlt_canvas->Divide(2,2);"
67 " g_hlt_canvas->cd(1);"
68 " g_hlt_canvas->Update(); }");
69 m->SetName("Split Canvas");
70 g_hlt_browser->Add(m);
71
72 // --- Create an embedded canvas
73
75 g_hlt_canvas = new TCanvas;
76 gEve->GetBrowser()->StopEmbedding("HLT Canvas");
77}
#define f(i)
Definition: RSha256.hxx:104
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:41
#define gDirectory
Definition: TDirectory.h:223
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
char name[80]
Definition: TGX11.cxx:109
R__EXTERN TRandom * gRandom
Definition: TRandom.h:62
The Canvas class.
Definition: TCanvas.h:31
TGFileBrowser * MakeFileBrowser(Bool_t make_default=kFALSE)
Create a file-browser.
TEveBrowser * GetBrowser() const
Definition: TEveManager.h:137
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:571
A doubly linked list.
Definition: TList.h:44
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:263
virtual void StopEmbedding(const char *name=0)
Definition: TRootBrowser.h:152
virtual void StartEmbedding(Int_t pos=kRight, Int_t subpos=-1)
Start embedding external frame in the tab "pos" and tab element "subpos".
auto * m
Definition: textangle.C:8
auto * l
Definition: textangle.C:4