]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/MakeITSZeroMisAlignment.C
Fix warnings from Cerello
[u/mrichter/AliRoot.git] / ITS / MakeITSZeroMisAlignment.C
index bf7b66097ee477a3d7a19610a79196ac173d7393..d61b64eef763a93db972bdd6a6823eff25b807e1 100644 (file)
@@ -3,64 +3,66 @@ void MakeITSZeroMisAlignment(){
   //
   TClonesArray *array = new TClonesArray("AliAlignObjParams",4000);
   TClonesArray &alobj = *array;
-   
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  const char* macroname = "MakeITSZeroMisAlignment.C";
 
-  AliAlignObjParams a;
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage = NULL;
 
-  Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0., globalZ=0.;
-  AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; 
+  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 = 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("geometry.root"); //load geom from default CDB storage
+  }    
 
   Int_t j = 0;
 
-  new(alobj[j]) AliAlignObjParams("ITS", 0, dx, dy, globalZ, dpsi, dtheta, dphi, kTRUE);
-  j++;
+  //=****************************************
+  // overall ITS misalignment according to survey as reported by Werner Riegler (18/07/2008) 
+  //=****************************************
+  Float_t its_dx     = -0.12;
+  Float_t its_dy     = -0.07;
+  Float_t its_dz     = 0.29;
+  Float_t its_dpsi   = 0.;  
+  Float_t its_dtheta = 0.03;
+  Float_t its_dphi   = 0.04;
 
-  for ( Int_t l = AliGeomManager::kSPD1; l <= AliGeomManager::kSSD2; l++) {
-    
-    printf("%i modules in layer %i\n", AliGeomManager::LayerSize(l), l);
-    for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(l); iModule++) {
+  new(alobj[j++]) AliAlignObjParams("ITS", 0, its_dx, its_dy, its_dz, its_dpsi, its_dtheta, its_dphi, kTRUE);
 
-      iLayer = AliGeomManager::kInvalidLayer; 
+  Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0., globalZ=0.;
+
+  for ( Int_t iLayer = AliGeomManager::kSPD1; iLayer <= AliGeomManager::kSSD2; iLayer++) {
+    
+    printf("%i modules in layer %i\n", AliGeomManager::LayerSize(iLayer), iLayer);
+    for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(iLayer); iModule++) {
 
-      switch (l) {
-      case 1: {
-       iLayer = AliGeomManager::kSPD1;
-      }; break;
-      case 2: {
-       iLayer = AliGeomManager::kSPD2;
-      }; break;
-      case 3: {
-       iLayer = AliGeomManager::kSDD1;
-      }; break;
-      case 4: {
-       iLayer = AliGeomManager::kSDD2;
-      }; break;
-      case 5: {
-       iLayer = AliGeomManager::kSSD1;
-      }; break;
-      case 6: {
-       iLayer = AliGeomManager::kSSD2;
-      }; break;
-      default: Printf("Wrong layer index in ITS (%d) !",l);
-      };
       UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iModule);
       const char *symname = AliGeomManager::SymName(volid);
 
-      new(alobj[j]) AliAlignObjParams(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
-      j++;
+      new(alobj[j++]) AliAlignObjParams(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
 
     }
   }
 
-  const char* macroname = "MakeITSZeroMisAlignment.C";
-  if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
+  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
     // save on file
     const char* filename = "ITSzeroMisalignment.root";
     TFile f(filename,"RECREATE");
@@ -74,19 +76,7 @@ void MakeITSZeroMisAlignment(){
     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;
-    }
+    Info(macroname,"Saving alignment objects in CDB storage %s", Storage.Data());
     AliCDBMetaData *md= new AliCDBMetaData();
     md->SetResponsible("Ludovic Gaudichet");
     md->SetComment("Alignment objects with zero ITS misalignment");