Remove for merge.
[u/mrichter/AliRoot.git] / EVE / macros / alieve_init.C
CommitLineData
5a5a1232 1// $Header$
2
3void alieve_init(const Text_t* path=".", Int_t event=0,
4 Bool_t use_runloader=true, Bool_t use_esd=true)
5{
6
7 // Set-up environment, load libraries.
8
9 Reve::SetupEnvironment();
10
11 gROOT->SetMacroPath(Form("%s:%s/alice-macros:%s/macros",
12 gROOT->GetMacroPath(),
13 gSystem->Getenv("REVESYS"),
14 gSystem->Getenv("ALICE_ROOT")));
15 gInterpreter->AddIncludePath(Form("%s/macros", gSystem->Getenv("ALICE_ROOT")));
16
17 Reve::AssertMacro("alieve_loadlibs.C");
18 gSystem->Load("libAlieve.so");
19
20
21 // Put macros in the list of browsables, spawn a browser.
22
23 TFolder* f = new TFolder("ALICE EVE", "Visualization macros");
24 TString macdir("$(REVESYS)/alice-macros");
25 gSystem->ExpandPathName(macdir);
26
27 void* dirhandle = gSystem->OpenDirectory(macdir.Data());
28 if(dirhandle != 0) {
29 char* filename;
30 TPRegexp re("\.C$");
31 while((filename = gSystem->GetDirEntry(dirhandle)) != 0) {
32 if(re.Match(filename)) {
33 printf("Adding macro '%s'\n", filename);
34 f->Add(new TMacro(Form("%s/%s", macdir.Data(), filename)));
35 }
36 }
37 }
38 gSystem->FreeDirectory(dirhandle);
39
40 gROOT->GetListOfBrowsables()->Add(f);
41 gROOT->GetListOfBrowsables()->Add
42 (new TSystemDirectory(macdir.Data(), macdir.Data()));
43
44 new TBrowser;
45
46 // Open event
47
48 Alieve::Event::Initialize(use_runloader, use_esd);
49
50 printf("Opening event %d from '%s' ...", event, path); fflush(stdout);
51 Alieve::gEvent = new Alieve::Event(path, event);
52 printf(" done.\n");
53 gReve->AddEvent(Alieve::gEvent);
54}