Use GRP from event-directory if:
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 26 Jun 2009 16:45:21 +0000 (16:45 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 26 Jun 2009 16:45:21 +0000 (16:45 +0000)
- default-storage is local://$ALICE_ROOT/OCDB;
- GRP/GRP/Data directory exist;
- the corresponding specific-storage was not previously set.

This also solves savannah#50609 - megnetic field is now properly read
from the GRP entry created during simulation.

EVE/EveBase/AliEveEventManager.cxx

index e3c0f17..cba8c52 100644 (file)
@@ -525,6 +525,28 @@ void AliEveEventManager::Open()
       if (cdb->IsDefaultStorageSet() == kFALSE)
        throw (kEH + "CDB initialization failed.");
     }
+    
+    TString expCDB(fgCdbUri);
+    gSystem->ExpandPathName(expCDB);
+    if (cdb->GetDefaultStorage()->GetURI() == expCDB)
+    {
+      TString grp     = "GRP/GRP/Data";
+      TString grppath = fPath + "/" + grp;
+      if (gSystem->AccessPathName(grppath, kReadPermission) == kFALSE)
+      {
+       if (cdb->GetSpecificStorage(grp))
+       {
+         Warning(kEH, "Local GRP exists, but the specific storage is already set.");
+       }
+       else
+       {
+         Info(kEH, "Setting CDB specific-storage for GRP from event directory.");
+         TString lpath("local://");
+         lpath += fPath;
+         cdb->SetSpecificStorage(grp, lpath);
+       }
+      }
+    }
     cdb->SetRun(runNo);
   }
 
@@ -989,7 +1011,7 @@ AliMagF* AliEveEventManager::AssertMagField()
     InitGRP();
   }
 
-  if (TGeoGlobalMagField::Instance())
+  if (TGeoGlobalMagField::Instance()->GetField())
   {
     fgMagField = dynamic_cast<AliMagF*>(TGeoGlobalMagField::Instance()->GetField());
     if (fgMagField == 0)