]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - VZERO/MakeVZEROZeroMisAlignment.C
Update of the DA in order to cope with the dense filling scheme of 2011. Necessitates...
[u/mrichter/AliRoot.git] / VZERO / MakeVZEROZeroMisAlignment.C
index c8f537d48dff02a924e665474cb82d3b71d75b62..e41b4e7e7396c08107470405949ee868583ca46f 100644 (file)
@@ -1,42 +1,54 @@
 void MakeVZEROZeroMisAlignment(){
   // Create TClonesArray of zero misalignment objects for VZERO
   //
-  if(!gGeoManager) TGeoManager::Import("geometry.root");
-  // needed for the constructors with local coordinates not to fail
+  const char* macroname = "MakeVZEROZeroMisAlignment.C";
 
-  TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
+  TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
 
-  AliAlignObjAngles a;
-
   Double_t dx, dy, dz, dpsi, dtheta, dphi;
 
   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);
 
   TString V0right("VZERO/V0C");
-  new(alobj[0]) AliAlignObjAngles(V0right.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
+  new(alobj[0]) AliAlignObjParams(V0right.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
   TString V0left("VZERO/V0A");
-  new(alobj[1]) AliAlignObjAngles(V0left.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE);
+  new(alobj[1]) AliAlignObjParams(V0left.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE);
 
-  if(!gSystem->Getenv("$TOCDB")){
+  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
     // save on file
-    TFile f("V0zeroMisalignment.root","RECREATE");
-    if(!f) cerr<<"cannot open file for output\n";
+    const char* filename = "VZEROzeroMisalignment.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,"V0ZeroAlObjs ","kSingleKey");
+    f.WriteObject(array,"VZEROAlignObjs","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("Brigitte Cheynis");
     md->SetComment("Alignment objects for V0 zero-misalignment");
-    md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
-    AliCDBId id("VZERO/Align/Data",0,9999999);
+    md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
+    AliCDBId id("VZERO/Align/Data",0,AliCDBRunRange::Infinity());
     storage->Put(array,id,md);
   }