]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/MakeHMPIDFullMisAlignment.C
AliEveTrackCounter, AliEveTrackCounterEditor
[u/mrichter/AliRoot.git] / HMPID / MakeHMPIDFullMisAlignment.C
index 9b2ff3e16de51418b68efa02059782a00d74305f..2d0dca262745916a0383200ac8b53c28eeabfe70 100644 (file)
@@ -1,9 +1,39 @@
 void MakeHMPIDFullMisAlignment(){
   // Create TClonesArray of full misalignment objects for HMPID
   //
+  const char* macroname = "MakeHMPIDFullMisAlignment.C";
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  TString Storage;
+  
+  if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
+    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 = 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
+  }
+  
   Float_t sigmaTrans=0.1; // 1mm
   Float_t sigmaRot=0.001*180/TMath::Pi(); // 1 mrad
-  Float_t dX, dY, dX;          Float_t dPsi, dTheta, dPhi;   //displacements
+  Float_t dX, dY, dZ;          Float_t dPsi, dTheta, dPhi;   //displacements
 
   TClonesArray *pCA = new TClonesArray("AliAlignObjMatrix",10);
   
@@ -19,7 +49,6 @@ void MakeHMPIDFullMisAlignment(){
 
 //   pCA->Print();
 
-  const char* macroname = "MakeHMPIDResMisAlignment.C"; 
   if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
     // save on file
     const char* filename = "HMPIDresidualMisalignment.root";
@@ -34,19 +63,8 @@ void MakeHMPIDFullMisAlignment(){
     f.Close();
   }else{
     // save in CDB storage
-    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;
-    }
     Info(macroname,"Saving alignment objects in CDB storage %s",
         Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData *pMeta= new AliCDBMetaData();  
     pMeta->SetResponsible("HMPID Expert");
     pMeta->SetComment("Full alignment objects for HMPID produced with sigmaTrans=1mm and sigmaRot=1mrad");