]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/MakeHMPIDZeroMisAlignment.C
Typo fixed. Cut changed in ESD QA (A. Dainese)
[u/mrichter/AliRoot.git] / HMPID / MakeHMPIDZeroMisAlignment.C
index 4a10b0b9c975da320fddf75b3c31b3a08297b70f..cbc1c22c513e7d3c13b8bcec854231f02bdf1f81 100644 (file)
@@ -3,34 +3,47 @@ void MakeHMPIDZeroMisAlignment(){
   //
   TClonesArray *pCA = new TClonesArray("AliAlignObjMatrix",10);
   
-  AliAlignObjMatrix o;
-
   Double_t dX=0.,dY=0.,dZ=0.,dPsi=0.,dTheta=0.,dPhi=0.;
  
-  Int_t idHMPID =  AliAlignObj::kHMPID;
+  Int_t idHMPID =  AliGeomManager::kHMPID;
   for (Int_t iCh = 0; iCh < 7; iCh++) {
-    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 = "MakeHMPIDZeroMisAlignment.C";  
+  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
     // save on file
-    TFile f("HMPIDzeroMisalignment.root","RECREATE");
-    if(!f) cerr<<"cannot open file for output\n";
+    const char* filename = "HMPIDzeroMisalignment.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("Zero alignment objects for HMPID");
     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);
   }