9e78371d |
1 | // $Id: alieve_init.C 30728 2009-01-22 18:14:34Z mtadel $ |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 |
3 | |
4 | /************************************************************************** |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * |
7 | * full copyright notice. * |
8 | **************************************************************************/ |
9 | |
10 | void hlt_alieve_init(const Text_t* path = ".", Int_t event=0, |
11 | const Text_t* esdfile = 0, |
12 | const Text_t* aodfile = 0, |
13 | const Text_t* rawfile = 0, |
14 | const Text_t* cdburi = 0, |
15 | Bool_t assert_runloader = kFALSE, |
16 | Bool_t assert_esd = kFALSE, |
17 | Bool_t assert_aod = kFALSE, |
18 | Bool_t assert_raw = kFALSE) |
19 | { |
20 | Info("alieve_init", "Adding standard macros."); |
21 | TString hack = gSystem->pwd(); // Problem with TGFileBrowser cding |
22 | alieve_init_import_macros(); |
23 | gSystem->cd(hack); |
24 | |
25 | alieve_init_basic_vizdb(); |
26 | // Temporarily assert also default vizdb. |
27 | TEveUtil::AssertMacro("VizDB_scan.C"); |
28 | |
29 | gSystem->ProcessEvents(); |
30 | } |
31 | |
32 | void alieve_init_import_macros() |
33 | { |
34 | // Put macros in the list of browsables, add a macro browser to |
35 | // top-level GUI. |
36 | |
37 | TString macdir("$(ALICE_ROOT)/EVE/alice-macros"); |
38 | gSystem->ExpandPathName(macdir); |
39 | |
40 | TFolder* f = gEve->GetMacroFolder(); |
41 | void* dirhandle = gSystem->OpenDirectory(macdir.Data()); |
42 | if (dirhandle != 0) |
43 | { |
44 | char* filename; |
45 | TPMERegexp re("\\.C$"); |
46 | std::list<string> names; // This form understood by cint (fails with std::string). |
47 | while ((filename = gSystem->GetDirEntry(dirhandle)) != 0) |
48 | { |
49 | if (re.Match(filename)) |
50 | names.push_back(filename); |
51 | } |
52 | names.sort(); |
53 | //PH The line below is replaced waiting for a fix in Root |
54 | //PH which permits to use variable siza arguments in CINT |
55 | //PH on some platforms (alphalinuxgcc, solariscc5, etc.) |
56 | // f->Add(new TEveMacro(Form("%s/%s", macdir.Data(), filename))); |
57 | char fullName[1000]; |
58 | for (std::list<string>::iterator si=names.begin(); si!=names.end(); ++si) |
59 | { |
60 | sprintf(fullName,"%s/%s", macdir.Data(), si->c_str()); |
61 | f->Add(new TEveMacro(fullName)); |
62 | } |
63 | } |
64 | gSystem->FreeDirectory(dirhandle); |
65 | |
66 | gROOT->GetListOfBrowsables()->Add |
67 | // (new TSystemDirectory("alice-macros", macdir.Data())); // !!!! this spits blood, but then works |
68 | (new TSystemDirectory(macdir.Data(), macdir.Data())); |
69 | |
70 | { |
71 | TEveBrowser *br = gEve->GetBrowser(); |
72 | TGFileBrowser *fb = 0; |
73 | fb = br->GetFileBrowser(); |
74 | fb->GotoDir(macdir); |
75 | { |
76 | br->StartEmbedding(0); |
77 | fb = br->MakeFileBrowser(); |
78 | fb->BrowseObj(f); |
79 | fb->Show(); |
80 | br->StopEmbedding(); |
81 | br->SetTabTitle("Macros", 0); |
82 | br->SetTab(0, 0); |
83 | } |
84 | } |
85 | } |
86 | |
87 | void alieve_init_basic_vizdb() |
88 | { |
89 | TEvePointSet* ps; |
90 | |
91 | ps = new TEvePointSet(); |
92 | ps->SetMarkerColor(4); |
93 | ps->SetMarkerSize(0.2); |
94 | ps->SetMarkerStyle(2); |
95 | gEve->InsertVizDBEntry("Clusters", ps); |
96 | } |