ROOT logo
// @(#)root/eve:$Id: text_test.C 26717 2008-12-07 22:07:55Z matevz $
// Author: Matevz Tadel

// Demonstates how to use EVE as a histogram browser.

TGFileBrowser *g_hlt_browser = 0;
TCanvas       *g_hlt_canvas  = 0;

void test_histobrowser(const char* name="HLT Histos")
{
   TEveManager::Create();

   // --- Create special browser

   gEve->GetBrowser()->StartEmbedding(0);
   g_hlt_browser = gEve->GetBrowser()->MakeFileBrowser();
   gEve->GetBrowser()->StopEmbedding(name);

   // --- Fill and register some lists/folders/histos

   gDirectory = 0;
   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.

   TMacro* m;

   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

   gEve->GetBrowser()->StartEmbedding(1);
   gROOT->ProcessLineFast("new TCanvas");
   g_hlt_canvas = (TCanvas*) gPad;
   gEve->GetBrowser()->StopEmbedding("HLT Canvas");
}
 test_histobrowser.C:1
 test_histobrowser.C:2
 test_histobrowser.C:3
 test_histobrowser.C:4
 test_histobrowser.C:5
 test_histobrowser.C:6
 test_histobrowser.C:7
 test_histobrowser.C:8
 test_histobrowser.C:9
 test_histobrowser.C:10
 test_histobrowser.C:11
 test_histobrowser.C:12
 test_histobrowser.C:13
 test_histobrowser.C:14
 test_histobrowser.C:15
 test_histobrowser.C:16
 test_histobrowser.C:17
 test_histobrowser.C:18
 test_histobrowser.C:19
 test_histobrowser.C:20
 test_histobrowser.C:21
 test_histobrowser.C:22
 test_histobrowser.C:23
 test_histobrowser.C:24
 test_histobrowser.C:25
 test_histobrowser.C:26
 test_histobrowser.C:27
 test_histobrowser.C:28
 test_histobrowser.C:29
 test_histobrowser.C:30
 test_histobrowser.C:31
 test_histobrowser.C:32
 test_histobrowser.C:33
 test_histobrowser.C:34
 test_histobrowser.C:35
 test_histobrowser.C:36
 test_histobrowser.C:37
 test_histobrowser.C:38
 test_histobrowser.C:39
 test_histobrowser.C:40
 test_histobrowser.C:41
 test_histobrowser.C:42
 test_histobrowser.C:43
 test_histobrowser.C:44
 test_histobrowser.C:45
 test_histobrowser.C:46
 test_histobrowser.C:47
 test_histobrowser.C:48
 test_histobrowser.C:49
 test_histobrowser.C:50
 test_histobrowser.C:51
 test_histobrowser.C:52
 test_histobrowser.C:53
 test_histobrowser.C:54
 test_histobrowser.C:55
 test_histobrowser.C:56
 test_histobrowser.C:57
 test_histobrowser.C:58
 test_histobrowser.C:59
 test_histobrowser.C:60
 test_histobrowser.C:61
 test_histobrowser.C:62
 test_histobrowser.C:63
 test_histobrowser.C:64
 test_histobrowser.C:65
 test_histobrowser.C:66
 test_histobrowser.C:67
 test_histobrowser.C:68
 test_histobrowser.C:69
 test_histobrowser.C:70
 test_histobrowser.C:71
 test_histobrowser.C:72
 test_histobrowser.C:73
 test_histobrowser.C:74
 test_histobrowser.C:75
thumb