]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/MakePHOSFullMisAlignment.C
Coverity 18290 solved by non-implemented private copy constructor and assignment...
[u/mrichter/AliRoot.git] / PHOS / MakePHOSFullMisAlignment.C
index 6819ea40b903f72fa9a5e6546ff2ba45d72b2db4..00f2d7e5e9977772af83ff5964b5ba205c331989 100644 (file)
@@ -1,11 +1,12 @@
 void MakePHOSFullMisAlignment()
 {
-  // Create misalignment object for PHOS module 2 
-  // from the survey measurements on P2 in May 2008.
+  // Create misalignment object for PHOS module 2,3,3
+  // from the survey measurements on P2 in August 2009.
   // To store alignment in OCDB, define the evnironment variables:
   // TOCDB=kTRUE
-  // STORAGE="local://$ALICE_ROOT"
+  // STORAGE="local://$ALICE_ROOT/OCDB"
   // Author: Timur Pocheptsov, 19.06.2008
+  // Modified: Yuri Kharlov, 11.03.2010
 
   const char * macroName = "MakePHOS2Alignment";
   
@@ -15,45 +16,10 @@ void MakePHOSFullMisAlignment()
     return;
   }
 
-  //Activate CDB storage and load geometry from CDB
-  //I need valid gGeoManager to create local transformations.
-  
-  //[Part of code, taken from ITS version of MakexxxFullMisalignment
-  AliCDBManager * cdb = AliCDBManager::Instance();
-  if (!cdb->IsDefaultStorageSet())
-    cdb->SetDefaultStorage("local://$ALICE_ROOT");
-  cdb->SetRun(0);
-
-  if (TString(gSystem->Getenv("TOCDB")) == TString("kTRUE")) {
-    const TString storageENV(gSystem->Getenv("STORAGE"));
-    if (!storageENV.BeginsWith("local://") && !storageENV.BeginsWith("alien://")) {
-      Error(macroName, "STORAGE variable set to %s is not valid.\n", storageENV.Data());
-      return;
-    }
-    
-    AliCDBStorage * storage = cdb->GetStorage(storageENV.Data());
-    if (!storage) {
-      Error(macroName, "Unable to open storage %s.\n", storageENV.Data());
-      return;
-    }
-    
-    AliCDBPath path("GRP","Geometry","Data");
-    AliCDBEntry * entry = storage->Get(path.GetPath(), cdb->GetRun());
-    if (!entry) {
-      Error(macroName,"Could not get the specified CDB entry!");
-      return;  
-    }
-    
-    entry->SetOwner(0);
-    AliGeomManager::SetGeometry((TGeoManager*) entry->GetObject());
-  }else{
-    AliGeomManager::LoadGeometry("geometry.root"); //load geom from default CDB storage
-  }    
-  //end of code taken from ITS version of MakexxxFullMisalignment]
-
   AliPHOSEMCAGeometry * emca = phosGeom->GetEMCAGeometry();
-  TClonesArray alobj("AliAlignObjParams", 16);// + phosGeom->GetNModules() * emca->GetNStripX() * emca->GetNStripZ());
-   
+  TClonesArray alobj("AliAlignObjParams", 16);// + phosGeom->GetNModules() * emca->GetNStripX() *
+                                              //   emca->GetNStripZ());
+  
   const Double_t dpsi = 0., dtheta = 0., dphi = 0.;
   const Double_t displacement = 10.;
   Int_t iIndex = 0; //let all modules have index=0 in a layer with no LUT
@@ -63,25 +29,40 @@ void MakePHOSFullMisAlignment()
 
   // Alignment for 5 PHOS modules
 
-  new(alobj[i++]) AliAlignObjParams("PHOS/Module1",
-         volid, 0., 0., 0., 0., 0., 0., kTRUE);
-  new(alobj[i++]) AliAlignObjParams("PHOS/Module2",
-         volid, 0., 0., 0., 0., 0., 0., kTRUE);
-
-  Double_t rotMatrix[9] = {0.999992695, -0.00295322, -0.0024267, 
-                          0.002955489, 0.999995199, 0.00093165, 
-                          0.002423942, -0.000938811, 0.99999662};
-  TGeoRotation rotation;
-  rotation.SetMatrix(rotMatrix);
-  Double_t dX=1.25474126, dY=-1.4088643, dZ=-12.856;
-  AliAlignObjParams * mod3 = 
-    new(alobj[i++]) AliAlignObjParams("PHOS/Module3", volid, dX, dY, dZ, 0., 0., 0., kFALSE);
-  mod3->SetRotation(rotation);
+  TString surveyFileName;
   
-  new(alobj[i++]) AliAlignObjParams("PHOS/Module4",
-         volid, 0.,  0., 0., 0., 0., 0., kTRUE);
-  new(alobj[i++]) AliAlignObjParams("PHOS/Module5",
-         volid, 0., 0., 0., 0., 0., 0., kTRUE);
+  const Char_t * szEnv = gSystem->Getenv("ALICE_ROOT");
+  if (szEnv && szEnv[0]) {
+    surveyFileName += szEnv;
+    if (surveyFileName[surveyFileName.Length() - 1] != '/')
+      surveyFileName += '/';
+  } else {
+    Warning(macroName, "cannot find ALICE_ROOT environment variable\n"
+                      "probably, I wan't be able to find survey file");
+  }
+    
+  surveyFileName += "PHOS/data/Survey_1053236_PHOS.txt";
+
+  AliSurveyObj survey;
+  survey.FillFromLocalFile(surveyFileName.Data());
+  TGeoHMatrix module3Delta, module2Delta, module1Delta;
+  AliPHOSModuleMisalignment delta(*phosGeom);
+
+  delta.DeltaTransformation(0, survey.GetData(), "410000", "410027", "424000", 
+                           &module1Delta);
+  new(alobj[i++]) AliAlignObjParams("PHOS/Module1", volid, module1Delta, kTRUE);
+
+  delta.DeltaTransformation(1, survey.GetData(), "310000", "310027", "324000", 
+                           &module2Delta);
+  new(alobj[i++]) AliAlignObjParams("PHOS/Module2", volid, module2Delta, kTRUE);
+
+  delta.DeltaTransformation(2, survey.GetData(), "210000", "210027", "224000", 
+                           &module3Delta);
+  new(alobj[i++]) AliAlignObjParams("PHOS/Module3", volid, module3Delta, kTRUE);
+
+  new(alobj[i++]) AliAlignObjParams("PHOS/Module4", volid, 0., 0., 0., 0., 0., 0., kTRUE);
+
+  new(alobj[i++]) AliAlignObjParams("PHOS/Module5", volid, 0., 0., 0., 0., 0., 0., kTRUE);
 
   const Double_t dx = 0., dy = 0., dz = 0. ;
   // Alignment of CPV modules
@@ -143,8 +124,8 @@ void MakePHOSFullMisAlignment()
     }
     
     AliCDBMetaData md;
-    md.SetResponsible("Timur Pocheptsov");
-    md.SetComment("Alignment objects for PHOS module 2; survey in May 2008");
+    md.SetResponsible("Yuri Kharlov");
+    md.SetComment("Alignment objects for PHOS modules 2,3,4; survey in August 2009");
     md.SetAliRootVersion(gSystem->Getenv("ARVERSION"));
     AliCDBId id("PHOS/Align/Data",0,AliCDBRunRange::Infinity());
     storage->Put(&alobj, id, &md);