2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
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 **************************************************************************/
10 void alieve_init(const TString& cdburi = "",
11 const TString& path = ".", Int_t event=0,
12 const Text_t* esdfile = 0,
13 const Text_t* aodfile = 0,
14 const Text_t* rawfile = 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)
20 if (cdburi.IsNull() && ! AliCDBManager::Instance()->IsDefaultStorageSet())
22 gEnv->SetValue("Root.Stacktrace", "no");
23 Fatal("alieve_init.C", "OCDB path MUST be specified as the first argument.");
26 Info("alieve_init", "Adding standard macros.");
27 TString hack = gSystem->pwd(); // Problem with TGFileBrowser cding
28 alieve_init_import_macros();
31 alieve_init_basic_vizdb();
32 // Temporarily assert also default vizdb.
33 TEveUtil::AssertMacro("VizDB_scan.C");
35 gSystem->ProcessEvents();
37 AliEveEventManager::SetESDFileName(esdfile);
38 AliEveEventManager::SetRawFileName(rawfile);
39 AliEveEventManager::SetCdbUri(cdburi);
40 AliEveEventManager::SetAssertElements(assert_runloader, assert_esd,
41 assert_aod, assert_raw);
44 if (path.BeginsWith("alien:") || ! cdburi.BeginsWith("local:"))
48 Info("alieve_init", "TGrid already initializied. Skiping checks and initialization.");
52 Info("alieve_init", "AliEn requested - connecting.");
53 if (gSystem->Getenv("alien_API_VO") == 0)
55 Error("alieve_init", "AliEn environment not initialized. Aborting.");
58 if (TGrid::Connect("alien") == 0)
60 Error("alieve_init", "TGrid::Connect() failed. Aborting.");
66 Info("alieve_init", "Opening event %d from '%s' ...", event, path.Data());
67 TString name("Event"); // CINT has trouble with direct "Event".
68 new AliEveEventManager(name, path, event);
69 gEve->AddEvent(AliEveEventManager::GetMaster());
72 void alieve_init_import_macros()
74 // Put macros in the list of browsables, add a macro browser to
77 TString macdir("$(ALICE_ROOT)/EVE/alice-macros");
78 gSystem->ExpandPathName(macdir);
80 TFolder* f = gEve->GetMacroFolder();
81 void* dirhandle = gSystem->OpenDirectory(macdir.Data());
85 TPMERegexp re("\\.C$");
86 std::list<string> names; // This form understood by cint (fails with std::string).
87 while ((filename = gSystem->GetDirEntry(dirhandle)) != 0)
89 if (re.Match(filename))
90 names.push_back(filename);
93 //PH The line below is replaced waiting for a fix in Root
94 //PH which permits to use variable siza arguments in CINT
95 //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
96 // f->Add(new TEveMacro(Form("%s/%s", macdir.Data(), filename)));
98 for (std::list<string>::iterator si=names.begin(); si!=names.end(); ++si)
100 sprintf(fullName,"%s/%s", macdir.Data(), si->c_str());
101 f->Add(new TEveMacro(fullName));
104 gSystem->FreeDirectory(dirhandle);
106 gROOT->GetListOfBrowsables()->Add
107 // (new TSystemDirectory("alice-macros", macdir.Data())); // !!!! this spits blood, but then works
108 (new TSystemDirectory(macdir.Data(), macdir.Data()));
111 TEveBrowser *br = gEve->GetBrowser();
112 TGFileBrowser *fb = 0;
113 fb = br->GetFileBrowser();
116 br->StartEmbedding(0);
117 fb = br->MakeFileBrowser();
121 br->SetTabTitle("Macros", 0);
127 void alieve_init_basic_vizdb()
131 ps = new TEvePointSet();
132 ps->SetMarkerColor(4);
133 ps->SetMarkerSize(0.2);
134 ps->SetMarkerStyle(2);
135 gEve->InsertVizDBEntry("Clusters", ps);