Remove default OCDB location and exit with fatal error if OCDB URI is
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Sep 2009 13:26:37 +0000 (13:26 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Sep 2009 13:26:37 +0000 (13:26 +0000)
not passed (or OCDB default-storage is already set).

The OCDB URI is now the first argument of alieve_init.C and
visscan_init.C.

To simplify standard usage, several wrapper macros have been added:
  visscan_raw.C         - SetDefaultStorage("raw://");
  visscan_mcideal.C     - SetDefaultStorage("MC, "Ideal");
  visscan_mcresidual.C  - SetDefaultStorage("MC, "Residual");
  visscan_mcfull.C      - SetDefaultStorage("MC, "Full");
  visscan_local.C       - SetDefaultStorage("local://$ALICE_ROOT/OCDB");

EVE/EveBase/AliEveEventManager.cxx
EVE/macros/alieve_init.C
EVE/macros/visscan_init.C
EVE/macros/visscan_local.C [new file with mode: 0644]
EVE/macros/visscan_mc.C [new file with mode: 0644]
EVE/macros/visscan_mcfull.C [new file with mode: 0644]
EVE/macros/visscan_mcideal.C [new file with mode: 0644]
EVE/macros/visscan_mcresidual.C [new file with mode: 0644]
EVE/macros/visscan_raw.C [new file with mode: 0644]

index 33b92ec..bdf73c7 100644 (file)
@@ -83,7 +83,7 @@ Bool_t AliEveEventManager::fgAssertRaw       = kFALSE;
 TString  AliEveEventManager::fgESDFileName("AliESDs.root");
 TString  AliEveEventManager::fgAODFileName("AliAOD.root");
 TString  AliEveEventManager::fgRawFileName("raw.root");
-TString  AliEveEventManager::fgCdbUri("local://$ALICE_ROOT/OCDB");
+TString  AliEveEventManager::fgCdbUri;
 
 TList*   AliEveEventManager::fgAODfriends = 0;
 
@@ -234,7 +234,7 @@ void AliEveEventManager::SetRawFileName(const TString& raw)
 
 void AliEveEventManager::SetCdbUri(const TString& cdb)
 {
-  // Set path to CDB, default "local://$ALICE_ROOT/OCDB".
+  // Set path to CDB, there is no default.
 
   if ( ! cdb.IsNull()) fgCdbUri = cdb;
 }
@@ -522,14 +522,29 @@ void AliEveEventManager::Open()
     }
     else
     {
-      cdb->SetDefaultStorage(fgCdbUri);
+      if (fgCdbUri.IsNull())
+      {
+       gEnv->SetValue("Root.Stacktrace", "no");
+       Fatal("Open()", "OCDB path was not specified.");
+      }
+
+      // Handle some special cases for MC (should be in OCDBManager).
+      if (fgCdbUri == "mcideal://")
+       cdb->SetDefaultStorage("MC", "Ideal");
+      else if (fgCdbUri == "mcresidual://")
+       cdb->SetDefaultStorage("MC", "Residual");
+      else if (fgCdbUri == "mcfull://")
+       cdb->SetDefaultStorage("MC", "Full");
+      else if (fgCdbUri == "local://") {
+       fgCdbUri = "local://$ALICE_ROOT/OCDB";
+       cdb->SetDefaultStorage(fgCdbUri);
+      } else
+       cdb->SetDefaultStorage(fgCdbUri);
       if (cdb->IsDefaultStorageSet() == kFALSE)
-       throw (kEH + "CDB initialization failed.");
+       throw kEH + "CDB initialization failed.";
     }
     
-    TString expCDB(fgCdbUri);
-    gSystem->ExpandPathName(expCDB);
-    if (cdb->GetDefaultStorage()->GetURI() == expCDB)
+    if (fgCdbUri.BeginsWith("local://"))
     {
       TString grp     = "GRP/GRP/Data";
       TString grppath = fPath + "/" + grp;
index e495569..aa7a34a 100644 (file)
@@ -7,16 +7,22 @@
  * full copyright notice.                                                 *
  **************************************************************************/
 
-void alieve_init(const TString& path   = ".", Int_t event=0,
+void alieve_init(const TString& cdburi = "",
+                const TString& path   = ".", Int_t event=0,
                  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();
@@ -35,7 +41,7 @@ void alieve_init(const TString& path   = ".", Int_t event=0,
                                        assert_aod, assert_raw);
 
   // Open event
-  if (path.BeginsWith("alien:"))
+  if (path.BeginsWith("alien:") || ! cdburi.BeginsWith("local:"))
   {
     if (gGrid != 0)
     {
index 6d266d2..19917ea 100644 (file)
@@ -38,8 +38,16 @@ Bool_t gShowMUONRhoZ = kTRUE;
 
 Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE;
 
-void visscan_init(const TString& path=".", Bool_t show_extra_geo=kFALSE)
+
+void visscan_init(const TString& cdburi = "",
+                 const TString& path   = ".", Bool_t show_extra_geo = kFALSE)
 {
+  if (cdburi.IsNull() && ! AliCDBManager::Instance()->IsDefaultStorageSet())
+  {
+    gEnv->SetValue("Root.Stacktrace", "no");
+    Fatal("visscan_init.C", "OCDB path MUST be specified as the first argument.");
+  }
+
   if (!show_extra_geo)
   {
     gShowTRD = gShowMUON = gShowMUONRPhi = gShowMUONRhoZ = kFALSE;
@@ -48,7 +56,7 @@ void visscan_init(const TString& path=".", Bool_t show_extra_geo=kFALSE)
   AliEveEventManager::AddAODfriend("AliAOD.VertexingHF.root");
 
   TEveUtil::LoadMacro("alieve_init.C");
-  alieve_init(path, -1);
+  alieve_init(cdburi, path, -1);
 
   // TEveLine::SetDefaultSmooth(1);
 
diff --git a/EVE/macros/visscan_local.C b/EVE/macros/visscan_local.C
new file mode 100644 (file)
index 0000000..06976be
--- /dev/null
@@ -0,0 +1,5 @@
+void visscan_local(const TString& path = ".", Bool_t show_extra_geo = kFALSE)
+{
+  gROOT->ProcessLine(TString::Format(".x visscan_init.C(\"local://$ALICE_ROOT/OCDB\", \"%s\", %d)",
+                                    path.Data(), show_extra_geo));
+}
diff --git a/EVE/macros/visscan_mc.C b/EVE/macros/visscan_mc.C
new file mode 100644 (file)
index 0000000..c55b19a
--- /dev/null
@@ -0,0 +1,5 @@
+void visscan_mc(const TString& path = ".", Bool_t show_extra_geo = kFALSE)
+{
+  gROOT->ProcessLine(TString::Format(".x visscan_init.C(\"mcideal://\", \"%s\", %d)",
+                                    path.Data(), show_extra_geo));
+}
diff --git a/EVE/macros/visscan_mcfull.C b/EVE/macros/visscan_mcfull.C
new file mode 100644 (file)
index 0000000..841a44b
--- /dev/null
@@ -0,0 +1,5 @@
+void visscan_mcfull(const TString& path = ".", Bool_t show_extra_geo = kFALSE)
+{
+  gROOT->ProcessLine(TString::Format(".x visscan_init.C(\"mcfull://\", \"%s\", %d)",
+                                    path.Data(), show_extra_geo));
+}
diff --git a/EVE/macros/visscan_mcideal.C b/EVE/macros/visscan_mcideal.C
new file mode 100644 (file)
index 0000000..26edab6
--- /dev/null
@@ -0,0 +1,5 @@
+void visscan_mcideal(const TString& path = ".", Bool_t show_extra_geo = kFALSE)
+{
+  gROOT->ProcessLine(TString::Format(".x visscan_init.C(\"mcideal://\", \"%s\", %d)",
+                                    path.Data(), show_extra_geo));
+}
diff --git a/EVE/macros/visscan_mcresidual.C b/EVE/macros/visscan_mcresidual.C
new file mode 100644 (file)
index 0000000..d24c0b1
--- /dev/null
@@ -0,0 +1,5 @@
+void visscan_mcresidual(const TString& path = ".", Bool_t show_extra_geo = kFALSE)
+{
+  gROOT->ProcessLine(TString::Format(".x visscan_init.C(\"mcresidual://\", \"%s\", %d)",
+                                    path.Data(), show_extra_geo));
+}
diff --git a/EVE/macros/visscan_raw.C b/EVE/macros/visscan_raw.C
new file mode 100644 (file)
index 0000000..f2fa1e0
--- /dev/null
@@ -0,0 +1,5 @@
+void visscan_raw(const TString& path = ".", Bool_t show_extra_geo = kFALSE)
+{
+  gROOT->ProcessLine(TString::Format(".x visscan_init.C(\"raw://\", \"%s\", %d)",
+                                    path.Data(), show_extra_geo));
+}