Temporary replacement of Form by sprintf to avoid problems on some platforms (alpahli...
[u/mrichter/AliRoot.git] / EVE / macros / alieve_init.C
... / ...
CommitLineData
1// $Header$
2
3void alieve_init(const Text_t* path=".", Int_t event=0,
4 Bool_t use_runloader=kTRUE, Bool_t use_esd=kTRUE,
5 Bool_t avoid_exceptions_on_open=kTRUE)
6{
7
8 // Set-up environment, load libraries.
9
10 Reve::SetupEnvironment();
11 // alieve executable linked against ALICE nad EVE shared libraries.
12 // Reve::AssertMacro("alieve_loadlibs.C");
13
14
15 // Put macros in the list of browsables, spawn a browser.
16
17 TString macdir("$(REVESYS)/alice-macros");
18 gSystem->ExpandPathName(macdir);
19
20 TFolder* f = gReve->GetMacroFolder();
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);
28 //PH The line below is replaced waiting for a fix in Root
29 //PH which permits to use variable siza arguments in CINT
30 //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
31 // f->Add(new Reve::RMacro(Form("%s/%s", macdir.Data(), filename)));
32 char fullName[1000];
33 sprintf(fullName,"%s/%s", macdir.Data(), filename);
34 f->Add(new Reve::RMacro(fullName));
35 }
36 }
37 }
38 gSystem->FreeDirectory(dirhandle);
39
40 gROOT->GetListOfBrowsables()->Add
41 // (new TSystemDirectory("alice-macros", macdir.Data())); // !!!! this spits blood, but then works
42 (new TSystemDirectory(macdir.Data(), macdir.Data()));
43
44 new TBrowser;
45
46 Reve::AssertMacro("region_marker.C");
47
48 // Open event
49 if(path != 0) {
50 Alieve::Event::Initialize(use_runloader, use_esd, avoid_exceptions_on_open);
51
52 printf("Opening event %d from '%s' ...", event, path); fflush(stdout);
53 Alieve::gEvent = new Alieve::Event(path, event);
54 printf(" done.\n");
55 gReve->AddEvent(Alieve::gEvent);
56 }
57}