Fix for FMD DA
[u/mrichter/AliRoot.git] / FMD / MakeFMDZeroMisAlignment.C
index 1cba6e5..e520e48 100644 (file)
@@ -6,47 +6,19 @@ void MakeFMDZeroMisAlignment()
 
   // Activate CDB storage and load geometry from CDB
   AliCDBManager* cdb = AliCDBManager::Instance();
-  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
   cdb->SetRun(0);
 
-  Bool_t  toCdb   = TString(gSystem->Getenv("TOCDB")) == TString("kTRUE");
-  TString storage = gSystem->Getenv("STORAGE");
+  Bool_t    toCdb   = TString(gSystem->Getenv("TOCDB")) == TString("kTRUE");
+  TString   storage = gSystem->Getenv("STORAGE");
+  TString   output  = "FMDfullMisalignment.root";
+  if(toCdb) output  = storage;
   
-  if(toCdb) {
-    if(!storage.BeginsWith("local://") && 
-       !storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE=\"%s\" is not valid. Exiting\n", storage.Data());
-      return;
-    }
-
-    AliCDBStorage* store = cdb->GetStorage(storage.Data());
-    if(!store){
-      Error(macroname,"Unable to open storage %s\n", storage.Data());
-      return;
-    }
-
-    AliCDBPath   path("GRP","Geometry","Data");
-    AliCDBEntry* entry = storage->Get(path.GetPath(),cdb->GetRun());
-    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
-
-    entry->SetOwner(0);
-    TGeoManager* geom = static_cast<TGeoManager*>(entry->GetObject());
-    AliGeomManager::SetGeometry(geom);
-  }else
-    //load geom from default CDB storage
-    AliGeomManager::LoadGeometry(); 
-  
-  gSystem->Load("libFMDutil.so");
-  AliFMDAlignFaker* faker = (toCdb ? 
-                            // save on file
-                            new AliFMDAlignFaker(AliFMDAlignFaker::kAll, 
-                                                 "geometry.root",
-                                                 "FMDfullMisalignment.root") :
-                            // save in CDB storage
-                            new AliFMDAlignFaker(AliFMDAlignFaker::kAll, 
-                                                 "geometry.root", 
-                                                 storage.Data()));
-
+  gSystem->Load("libFMDutil");
+  AliFMDAlignFaker::GetGeometry(toCdb, storage);
+  AliFMDAlignFaker* faker = new AliFMDAlignFaker(AliFMDAlignFaker::kAll, 
+                                                "geometry.root", 
+                                                output.Data());
 
   faker->SetSensorDisplacement(0., 0., 0., 0., 0., 0.);
   faker->SetSensorRotation(0., 0., 0., 0., 0., 0.);