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 /// \ingroup evemacros
11 /// \file alieve_init.C
13 void alieve_init(const TString& cdburi = "",
14 const TString& path = ".", Int_t event=0,Bool_t showHLTESDTree=kFALSE,
15 const Text_t* esdfile = 0,
16 const Text_t* aodfile = 0,
17 const Text_t* rawfile = 0,
18 Bool_t assert_runloader = kFALSE,
19 Bool_t assert_esd = kFALSE,
20 Bool_t assert_aod = kFALSE,
21 Bool_t assert_raw = kFALSE)
23 if (cdburi.IsNull() && ! AliCDBManager::Instance()->IsDefaultStorageSet())
25 gEnv->SetValue("Root.Stacktrace", "no");
26 Fatal("alieve_init.C", "OCDB path MUST be specified as the first argument.");
29 Info("alieve_init", "Adding standard macros.");
30 TString hack = gSystem->pwd(); // Problem with TGFileBrowser cding
31 alieve_init_import_macros();
34 TEveUtil::AssertMacro("VizDB_scan.C");
36 gSystem->ProcessEvents();
38 AliEveEventManager::SetFilesPath(path);
41 AliEveEventManager::SetESDFileName(esdfile, AliEveEventManager::kHLTTree);
45 AliEveEventManager::SetESDFileName(esdfile, AliEveEventManager::kOfflineTree);
48 AliEveEventManager::SetRawFileName(rawfile);
49 AliEveEventManager::SetCdbUri(cdburi);
50 AliEveEventManager::SetAssertElements(assert_runloader, assert_esd,
51 assert_aod, assert_raw);
54 if (path.BeginsWith("alien:") || ! cdburi.BeginsWith("local:"))
58 Info("alieve_init", "TGrid already initializied. Skiping checks and initialization.");
62 Info("alieve_init", "AliEn requested - connecting.");
63 if (gSystem->Getenv("GSHELL_ROOT") == 0)
65 Error("alieve_init", "AliEn environment not initialized. Aborting.");
68 if (TGrid::Connect("alien") == 0)
70 Error("alieve_init", "TGrid::Connect() failed. Aborting.");
76 Info("alieve_init", "Opening event %d from '%s' ...", event, path.Data());
77 TString name("Event"); // CINT has trouble with direct "Event".
78 new AliEveEventManager(name, event);
79 gEve->AddEvent(AliEveEventManager::GetMaster());
82 void alieve_init_import_macros()
84 // Put macros in the list of browsables, add a macro browser to
87 TString macdir("$(ALICE_ROOT)/EVE/alice-macros");
88 gSystem->ExpandPathName(macdir);
90 TFolder* f = gEve->GetMacroFolder();
91 void* dirhandle = gSystem->OpenDirectory(macdir.Data());
95 TPMERegexp re("\\.C$");
97 while ((filename = gSystem->GetDirEntry(dirhandle)) != 0)
99 if (re.Match(filename))
100 names.AddLast(new TObjString(filename));
104 for (Int_t ii=0; ii<names.GetEntries(); ++ii)
106 TObjString * si = (TObjString*) names.At(ii);
107 f->Add(new TEveMacro(Form("%s/%s", macdir.Data(), (si->GetString()).Data())));
110 gSystem->FreeDirectory(dirhandle);
112 gROOT->GetListOfBrowsables()->Add(new TSystemDirectory(macdir.Data(), macdir.Data()));
115 TEveBrowser *br = gEve->GetBrowser();
116 TGFileBrowser *fb = 0;
117 fb = br->GetFileBrowser();
120 br->StartEmbedding(0);
121 fb = br->MakeFileBrowser();
125 br->SetTabTitle("Macros", 0);