]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/MakeT0FullMisAlignment.C
fixed for work with new AliQADataMaker
[u/mrichter/AliRoot.git] / T0 / MakeT0FullMisAlignment.C
index 67b08cddeca9245247866838fd64cb170e5f4860..32cb09509609ce4081106a7ccd75bd27443c93f3 100644 (file)
@@ -1,13 +1,9 @@
 void MakeT0FullMisAlignment(){
   // Create TClonesArray of full misalignment objects for T0
   //
-  TClonesArray *array = new TClonesArray("AliAlignObjAngles",30);
+  TClonesArray *array = new TClonesArray("AliAlignObjParams",30);
   TClonesArray &alobj = *array;
 
-  if(!gGeoManager) TGeoManager::Import("geometry.root");
-
-  AliAlignObjAngles a;
-
   Double_t dx, dy, dz, dpsi, dtheta, dphi;
   TRandom *rnd   = new TRandom(4321);
   Double_t sigmatr = 0.05; // sigma for shifts in cm
@@ -16,8 +12,8 @@ void MakeT0FullMisAlignment(){
   TString symName, sn;
 
   Int_t iIndex=0;
-  AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
-  UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
+  AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
+  UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
 
   Int_t j=0;
   for (Int_t imod=0; imod<24; imod++){
@@ -36,26 +32,42 @@ void MakeT0FullMisAlignment(){
     dtheta = rnd->Gaus(0.,sigmarot);
     dphi = rnd->Gaus(0.,sigmarot);
     
-    new(alobj[j++]) AliAlignObjAngles(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
+    new(alobj[j++]) AliAlignObjParams(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
   }
   
-  if(!gSystem->Getenv("$TOCDB")){
+  const char* macroname = "MakeT0FullMisAlignment.C";
+  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
     // save on file
-    TFile f("T0fullMisalignment.root","RECREATE");
-    if(!f) cerr<<"cannot open file for output\n";
+    const char* filename = "T0fullMisalignment.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,"T0FullObjs ","kSingleKey");
-    f.Close();
+    f.WriteObject(array,"T0AlignObjs","kSingleKey");
+    f.Close();    TFile f(filename,"RECREATE");
   }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("Tomasz Malkiewicz");
     md->SetComment("Full misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
     md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
-    AliCDBId id("T0/Align/Data",0,9999999);
+    AliCDBId id("T0/Align/Data",0,AliCDBRunRange::Infinity());
     storage->Put(array,id,md);
   }