Temporary replacement of Form by sprintf to avoid problems on some platforms (alpahli...
[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,
9658c93c 4 Bool_t use_runloader=kTRUE, Bool_t use_esd=kTRUE,
5 Bool_t avoid_exceptions_on_open=kTRUE)
5a5a1232 6{
7
8 // Set-up environment, load libraries.
9
10 Reve::SetupEnvironment();
5987168b 11 // alieve executable linked against ALICE nad EVE shared libraries.
12 // Reve::AssertMacro("alieve_loadlibs.C");
5a5a1232 13
14
15 // Put macros in the list of browsables, spawn a browser.
16
5a5a1232 17 TString macdir("$(REVESYS)/alice-macros");
18 gSystem->ExpandPathName(macdir);
19
46a5da3d 20 TFolder* f = gReve->GetMacroFolder();
5a5a1232 21 void* dirhandle = gSystem->OpenDirectory(macdir.Data());
22 if(dirhandle != 0) {
23 char* filename;
24 TPRegexp re("\.C$");
25 while((filename = gSystem->GetDirEntry(dirhandle)) != 0) {
26 if(re.Match(filename)) {
27 printf("Adding macro '%s'\n", filename);
46a5da3d 28 f->Add(new Reve::RMacro(Form("%s/%s", macdir.Data(), filename)));
5a5a1232 29 }
30 }
31 }
32 gSystem->FreeDirectory(dirhandle);
33
5a5a1232 34 gROOT->GetListOfBrowsables()->Add
46a5da3d 35 // (new TSystemDirectory("alice-macros", macdir.Data())); // !!!! this spits blood, but then works
5a5a1232 36 (new TSystemDirectory(macdir.Data(), macdir.Data()));
37
38 new TBrowser;
39
092578a7 40 Reve::AssertMacro("region_marker.C");
41
5a5a1232 42 // Open event
5ce2e42b 43 if(path != 0) {
9658c93c 44 Alieve::Event::Initialize(use_runloader, use_esd, avoid_exceptions_on_open);
5a5a1232 45
5ce2e42b 46 printf("Opening event %d from '%s' ...", event, path); fflush(stdout);
47 Alieve::gEvent = new Alieve::Event(path, event);
48 printf(" done.\n");
49 gReve->AddEvent(Alieve::gEvent);
50 }
5a5a1232 51}