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