]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/MakeHMPIDFullMisAlignment.C
Updated alignment macros and related changes (Raffaele)
[u/mrichter/AliRoot.git] / HMPID / MakeHMPIDFullMisAlignment.C
index dad424ac0e26b963a7ac91a318c87f24c9613897..9b2ff3e16de51418b68efa02059782a00d74305f 100644 (file)
@@ -9,35 +9,49 @@ void MakeHMPIDFullMisAlignment(){
   
   TRandom *pRnd   = new TRandom(4357);
 
-  AliAlignObjMatrix o;
-  Int_t idHMPID =  AliAlignObj::kHMPID;
+  Int_t idHMPID =  AliGeomManager::kHMPID;
   for (Int_t iCh = 0; iCh < 7; iCh++) {
     dX     = (pRnd->Uniform()-0.5)*sigmaTrans;    dY     = (pRnd->Uniform()-0.5)*sigmaTrans;    dZ     = (pRnd->Uniform()-0.5)*sigmaTrans;
     dPsi   = (pRnd->Uniform()-0.5)*sigmaRot;    dTheta = (pRnd->Uniform()-0.5)*sigmaRot;    dPhi   = (pRnd->Uniform()-0.5)*sigmaRot;
-    new((*pCA)[iCh]) AliAlignObjMatrix(AliAlignObj::SymName(idHMPID,iCh),
-       AliAlignObj::LayerToVolUID(idHMPID,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE);
+    new((*pCA)[iCh]) AliAlignObjMatrix(AliGeomManager::SymName(idHMPID,iCh),
+       AliGeomManager::LayerToVolUID(idHMPID,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE);
   }
 
 //   pCA->Print();
-  
-  if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
+
+  const char* macroname = "MakeHMPIDResMisAlignment.C"; 
+  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
     // save on file
-    TFile f("HMPIDfullMisalignment.root","RECREATE");
-    if(!f) cerr<<"cannot open file for output\n";
+    const char* filename = "HMPIDresidualMisalignment.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(pCA,"HMPIDAlignObjs","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 *pMeta= new AliCDBMetaData();  
     pMeta->SetResponsible("HMPID Expert");
     pMeta->SetComment("Full alignment objects for HMPID produced with sigmaTrans=1mm and sigmaRot=1mrad");
     pMeta->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
-    AliCDBId id("HMPID/Align/Data",0,9999999);
+    AliCDBId id("HMPID/Align/Data",0,AliCDBRunRange::Infinity());
     storage->Put(pCA,id,pMeta);
   }