]>
Commit | Line | Data |
---|---|---|
5a5a1232 | 1 | // $Header$ |
2 | ||
32e219c2 | 3 | #ifndef __CINT_ |
4 | #include <list> | |
5 | #include <string> | |
6 | #endif | |
7 | ||
94986496 | 8 | void 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 | using namespace std; |
5a5a1232 | 13 | |
14 | // Set-up environment, load libraries. | |
15 | ||
16 | Reve::SetupEnvironment(); | |
5a5a1232 | 17 | |
18 | // Put macros in the list of browsables, spawn a browser. | |
19 | ||
32e219c2 | 20 | Info("alieve_init", "Adding standard macros."); |
21 | ||
5a5a1232 | 22 | TString macdir("$(REVESYS)/alice-macros"); |
23 | gSystem->ExpandPathName(macdir); | |
24 | ||
46a5da3d | 25 | TFolder* f = gReve->GetMacroFolder(); |
5a5a1232 | 26 | void* dirhandle = gSystem->OpenDirectory(macdir.Data()); |
27 | if(dirhandle != 0) { | |
28 | char* filename; | |
29 | TPRegexp re("\.C$"); | |
32e219c2 | 30 | list<string> names; |
5a5a1232 | 31 | while((filename = gSystem->GetDirEntry(dirhandle)) != 0) { |
32 | if(re.Match(filename)) { | |
32e219c2 | 33 | names.push_back(filename); |
5a5a1232 | 34 | } |
35 | } | |
32e219c2 | 36 | names.sort(); |
37 | //PH The line below is replaced waiting for a fix in Root | |
38 | //PH which permits to use variable siza arguments in CINT | |
39 | //PH on some platforms (alphalinuxgcc, solariscc5, etc.) | |
40 | // f->Add(new Reve::RMacro(Form("%s/%s", macdir.Data(), filename))); | |
41 | char fullName[1000]; | |
42 | for (list<string>::iterator si=names.begin(); si!=names.end(); ++si) | |
43 | { | |
44 | sprintf(fullName,"%s/%s", macdir.Data(), si->c_str()); | |
45 | f->Add(new Reve::RMacro(fullName)); | |
46 | } | |
5a5a1232 | 47 | } |
48 | gSystem->FreeDirectory(dirhandle); | |
49 | ||
5a5a1232 | 50 | gROOT->GetListOfBrowsables()->Add |
46a5da3d | 51 | // (new TSystemDirectory("alice-macros", macdir.Data())); // !!!! this spits blood, but then works |
5a5a1232 | 52 | (new TSystemDirectory(macdir.Data(), macdir.Data())); |
53 | ||
32e219c2 | 54 | { |
55 | Reve::RGBrowser *br = gReve->GetBrowser(); | |
56 | TGFileBrowser *fb = 0; | |
57 | fb = br->GetFileBrowser(); | |
58 | fb->GotoDir("/alice-macros"); //macdir); | |
59 | { | |
60 | br->StartEmbedding(0); | |
61 | fb = br->MakeFileBrowser(); | |
62 | fb->BrowseObj(f); | |
63 | fb->Show(); | |
64 | br->StopEmbedding(); | |
65 | br->SetTabTitle("Macros", 0); | |
66 | br->SetTab(0, 0); | |
67 | } | |
68 | } | |
5a5a1232 | 69 | |
32e219c2 | 70 | // Reve::AssertMacro("region_marker.C"); |
71 | ||
72 | gSystem->ProcessEvents(); | |
092578a7 | 73 | |
5a5a1232 | 74 | // Open event |
5ce2e42b | 75 | if(path != 0) { |
94986496 | 76 | Alieve::Event::SetCdbUri(cdburi); |
0513dc59 | 77 | Alieve::Event::SetAssertElements(assert_runloader, assert_esd); |
5ce2e42b | 78 | printf("Opening event %d from '%s' ...", event, path); fflush(stdout); |
79 | Alieve::gEvent = new Alieve::Event(path, event); | |
80 | printf(" done.\n"); | |
81 | gReve->AddEvent(Alieve::gEvent); | |
82 | } | |
5a5a1232 | 83 | } |