]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/macros/alieve_init.C
Put black-listed classes out of Alieve namespace.
[u/mrichter/AliRoot.git] / EVE / macros / alieve_init.C
CommitLineData
84aff7a4 1// $Id$
5a5a1232 2
32e219c2 3#ifndef __CINT_
4#include <list>
5#include <string>
6#endif
7
94986496 8void alieve_init(const Text_t* path = ".", Int_t event=0,
9 const Text_t* cdburi = 0,
0513dc59 10 Bool_t assert_runloader=kFALSE, Bool_t assert_esd=kFALSE)
5a5a1232 11{
32e219c2 12 Info("alieve_init", "Adding standard macros.");
84aff7a4 13 TString hack = gSystem->pwd(); // Problem with TGFileBrowser cding
008138bd 14 alieve_init_import_macros();
84aff7a4 15 gSystem->cd(hack);
008138bd 16
84aff7a4 17 // AssertMacro("region_marker.C");
008138bd 18
19 gSystem->ProcessEvents();
20
21 // Open event
22 if(path != 0) {
23 Alieve::Event::SetCdbUri(cdburi);
24 Alieve::Event::SetAssertElements(assert_runloader, assert_esd);
25 printf("Opening event %d from '%s' ...", event, path); fflush(stdout);
26 Alieve::gEvent = new Alieve::Event(path, event);
27 printf(" done.\n");
84aff7a4 28 gEve->AddEvent(Alieve::gEvent);
008138bd 29 }
30}
31
32void alieve_init_import_macros()
33{
34 // Put macros in the list of browsables, add a macro browser to
35 // top-level GUI.
32e219c2 36
5a5a1232 37 TString macdir("$(REVESYS)/alice-macros");
38 gSystem->ExpandPathName(macdir);
39
84aff7a4 40 TFolder* f = gEve->GetMacroFolder();
5a5a1232 41 void* dirhandle = gSystem->OpenDirectory(macdir.Data());
42 if(dirhandle != 0) {
43 char* filename;
44 TPRegexp re("\.C$");
84aff7a4 45 std::list<string> names;
5a5a1232 46 while((filename = gSystem->GetDirEntry(dirhandle)) != 0) {
47 if(re.Match(filename)) {
32e219c2 48 names.push_back(filename);
5a5a1232 49 }
50 }
32e219c2 51 names.sort();
52 //PH The line below is replaced waiting for a fix in Root
53 //PH which permits to use variable siza arguments in CINT
54 //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
84aff7a4 55 // f->Add(new TEveMacro(Form("%s/%s", macdir.Data(), filename)));
32e219c2 56 char fullName[1000];
84aff7a4 57 for (std::list<string>::iterator si=names.begin(); si!=names.end(); ++si)
32e219c2 58 {
59 sprintf(fullName,"%s/%s", macdir.Data(), si->c_str());
84aff7a4 60 f->Add(new TEveMacro(fullName));
32e219c2 61 }
5a5a1232 62 }
63 gSystem->FreeDirectory(dirhandle);
64
5a5a1232 65 gROOT->GetListOfBrowsables()->Add
46a5da3d 66 // (new TSystemDirectory("alice-macros", macdir.Data())); // !!!! this spits blood, but then works
5a5a1232 67 (new TSystemDirectory(macdir.Data(), macdir.Data()));
68
32e219c2 69 {
84aff7a4 70 TEveBrowser *br = gEve->GetBrowser();
71 TGFileBrowser *fb = 0;
32e219c2 72 fb = br->GetFileBrowser();
008138bd 73 fb->GotoDir(macdir);
32e219c2 74 {
75 br->StartEmbedding(0);
76 fb = br->MakeFileBrowser();
77 fb->BrowseObj(f);
78 fb->Show();
79 br->StopEmbedding();
80 br->SetTabTitle("Macros", 0);
81 br->SetTab(0, 0);
82 }
84aff7a4 83 }
5a5a1232 84}