X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EVE%2Fmacros%2Falieve_init.C;h=fac6c54b76f37f619ca9f4d99b197e71d2e62d93;hb=b929d7c3d0b348a948d947a93462bbaa0963f6d1;hp=cb4206dc20e58860be9f9f200358945522a7c64a;hpb=b3b7b8d32f44be3b71d195b6225467a4a5b4fbd8;p=u%2Fmrichter%2FAliRoot.git diff --git a/EVE/macros/alieve_init.C b/EVE/macros/alieve_init.C index cb4206dc20e..fac6c54b76f 100644 --- a/EVE/macros/alieve_init.C +++ b/EVE/macros/alieve_init.C @@ -7,45 +7,76 @@ * full copyright notice. * **************************************************************************/ -#ifndef __CINT_ -#include -#include -#endif +/// \ingroup evemacros +/// \file alieve_init.C -void alieve_init(const Text_t* path = ".", Int_t event=0, +void alieve_init(const TString& cdburi = "", + const TString& path = ".", Int_t event=0,Bool_t showHLTESDTree=kFALSE, const Text_t* esdfile = 0, const Text_t* aodfile = 0, const Text_t* rawfile = 0, - const Text_t* cdburi = 0, Bool_t assert_runloader = kFALSE, Bool_t assert_esd = kFALSE, Bool_t assert_aod = kFALSE, Bool_t assert_raw = kFALSE) { + if (cdburi.IsNull() && ! AliCDBManager::Instance()->IsDefaultStorageSet()) + { + gEnv->SetValue("Root.Stacktrace", "no"); + Fatal("alieve_init.C", "OCDB path MUST be specified as the first argument."); + } + Info("alieve_init", "Adding standard macros."); TString hack = gSystem->pwd(); // Problem with TGFileBrowser cding alieve_init_import_macros(); gSystem->cd(hack); - // Temporarily assert default vizdb TEveUtil::AssertMacro("VizDB_scan.C"); gSystem->ProcessEvents(); - AliEveEventManager::SetESDFileName(esdfile); + AliEveEventManager::SetFilesPath(path); + + if(showHLTESDTree){ + AliEveEventManager::SetESDFileName(esdfile, AliEveEventManager::kHLTTree); + } + else + { + AliEveEventManager::SetESDFileName(esdfile, AliEveEventManager::kOfflineTree); + } + AliEveEventManager::SetRawFileName(rawfile); AliEveEventManager::SetCdbUri(cdburi); AliEveEventManager::SetAssertElements(assert_runloader, assert_esd, assert_aod, assert_raw); // Open event - if (path != 0) + if (path.BeginsWith("alien:") || ! cdburi.BeginsWith("local:")) { - Info("alieve_init", "Opening event %d from '%s' ...", event, path); - TString name("Event"); // CINT has trouble with direct "Event". - new AliEveEventManager(name, path, event); - gEve->AddEvent(AliEveEventManager::GetMaster()); + if (gGrid != 0) + { + Info("alieve_init", "TGrid already initializied. Skiping checks and initialization."); + } + else + { + Info("alieve_init", "AliEn requested - connecting."); + if (gSystem->Getenv("GSHELL_ROOT") == 0) + { + Error("alieve_init", "AliEn environment not initialized. Aborting."); + gSystem->Exit(1); + } + if (TGrid::Connect("alien") == 0) + { + Error("alieve_init", "TGrid::Connect() failed. Aborting."); + gSystem->Exit(1); + } + } } + + Info("alieve_init", "Opening event %d from '%s' ...", event, path.Data()); + TString name("Event"); // CINT has trouble with direct "Event". + new AliEveEventManager(name, event); + gEve->AddEvent(AliEveEventManager::GetMaster()); } void alieve_init_import_macros() @@ -61,30 +92,24 @@ void alieve_init_import_macros() if (dirhandle != 0) { char* filename; - TPRegexp re("\.C$"); - std::list names; + TPMERegexp re("\\.C$"); + TObjArray names; while ((filename = gSystem->GetDirEntry(dirhandle)) != 0) { if (re.Match(filename)) - names.push_back(filename); + names.AddLast(new TObjString(filename)); } - names.sort(); - //PH The line below is replaced waiting for a fix in Root - //PH which permits to use variable siza arguments in CINT - //PH on some platforms (alphalinuxgcc, solariscc5, etc.) - // f->Add(new TEveMacro(Form("%s/%s", macdir.Data(), filename))); - char fullName[1000]; - for (std::list::iterator si=names.begin(); si!=names.end(); ++si) + names.Sort(); + + for (Int_t ii=0; iic_str()); - f->Add(new TEveMacro(fullName)); + TObjString * si = (TObjString*) names.At(ii); + f->Add(new TEveMacro(Form("%s/%s", macdir.Data(), (si->GetString()).Data()))); } } gSystem->FreeDirectory(dirhandle); - gROOT->GetListOfBrowsables()->Add - // (new TSystemDirectory("alice-macros", macdir.Data())); // !!!! this spits blood, but then works - (new TSystemDirectory(macdir.Data(), macdir.Data())); + gROOT->GetListOfBrowsables()->Add(new TSystemDirectory(macdir.Data(), macdir.Data())); { TEveBrowser *br = gEve->GetBrowser();