+ // Activate CDB storage to load geometry from CDB
+ AliCDBManager* cdb = AliCDBManager::Instance();
+ if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+ cdb->SetRun(0);
+
+ AliCDBStorage* storage;
+
+ if ( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ) {
+ TString Storage = gSystem->Getenv("STORAGE");
+ if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+ Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+ return;
+ }
+ storage = cdb->GetStorage(Storage.Data());
+ if (!storage) {
+ Error(macroname,"Unable to open storage %s\n",Storage.Data());
+ return;
+ }
+ AliCDBPath path("GRP","Geometry","Data");
+ AliCDBEntry *entry = (AliCDBEntry*)storage->Get(path.GetPath(),cdb->GetRun());
+ if (!entry)
+ Fatal(macroname,"Could not get the specified CDB entry!");
+
+ entry->SetOwner(0);
+ TGeoManager* geom = (TGeoManager*) entry->GetObject();
+ AliGeomManager::SetGeometry(geom);
+ } else
+ AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+
+
+ Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;