]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/MakePMDZeroMisAlignment.C
Update responsibles for MCH, MTR, HMP
[u/mrichter/AliRoot.git] / PMD / MakePMDZeroMisAlignment.C
index 93d4f0dabded0ee3b1b46fb330e447f778b5ce35..9931cbaa4a0c559d0ce347faebf1e7f33facb193 100644 (file)
@@ -33,45 +33,56 @@ void MakePMDZeroMisAlignment(){
     // As these will be mounted on the same
     // Steel plate 
  */
-  
-  if(!gGeoManager) TGeoManager::Import("geometry.root");
-  // needed for the constructors with local coordinates not to fail
+
+  const char* macroname = "MakePMDZeroMisAlignment.C";
 
   //Create a TClonesArray of Align Object to store displacement Angles
-  TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
+  TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
   
-  AliAlignObjAngles o;
-  
   Int_t iIndex=0; //  let all modules have index=0 in a layer with no LUT
-  AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
-  UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
+  AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
+  UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
   Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
   Int_t i, j=0;
 
   for(i=1; i<=4; i++){
     TString snSector(Form("PMD/Sector%d",i));
-    new(alobj[j++]) AliAlignObjAngles(snSector.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
+    new(alobj[j++]) AliAlignObjParams(snSector.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
   }
 
-  if(!gSystem->Getenv("$TOCDB")){
+  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
     // Create a File to store the alignment data
-    TFile f("PMDzeroMisalignment.root","RECREATE");
-    if(!f) {cerr<<"cannot open file for output\n";}
-    
+    const char* filename = "PMDzeroMisalignment.root";
+    TFile f(filename,"RECREATE");
+    if(!f){
+      Error(macroname,"cannot open file for output\n");
+      return;
+    }
+    Info(macroname,"Saving alignment objects to the file %s", filename);
     f.cd();
-    f.WriteObject(array,"PMDAlignObjs ","kSingleKey");
+    f.WriteObject(array,"PMDAlignObjs","kSingleKey");
     f.Close();
   }else{
   // save in CDB storage
-    const char* Storage = gSystem->Getenv("$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);
+    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
     AliCDBMetaData* md = new AliCDBMetaData();
     md->SetResponsible("");
     md->SetComment("Zero misalignment for PMD");
-    md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
-    AliCDBId id("PMD/Align/Data",0,9999999);
+    md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
+    AliCDBId id("PMD/Align/Data",0,AliCDBRunRange::Infinity());
     storage->Put(array,id,md);
   }
   array->Delete();