]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSv0.cxx
Adding example macro to setup and use comparison tasks
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv0.cxx
index e3ca3deee8bd754db5278d64b145e2f4ea267aeb..2f7a615e6cbdade6754280c4c001a6d4b37dea16 100644 (file)
 /* History of cvs commits:
  *
  * $Log$
+ * Revision 1.94  2007/10/18 08:40:02  kharlov
+ * Misalignment-related bug fixed
+ *
+ * Revision 1.93  2007/10/06 22:24:40  kharlov
+ * Bug in strip unit geometry is corrected
+ *
+ * Revision 1.92  2007/07/04 16:38:19  policheh
+ * Tracking2LocalCS matrices corrected for CPV.
+ *
+ * Revision 1.91  2007/07/02 14:50:49  policheh
+ * Tracking2LocalCS matrices corrected.
+ *
+ * Revision 1.90  2007/05/24 13:04:05  policheh
+ * AddAlignableVolumes: local to tracking CS transformation matrices creates for each
+ * PHOS supermodule
+ *
+ * Revision 1.89  2007/04/24 14:34:39  hristov
+ * Additional protection: do not search for alignable object if the CPV is not in the geometry
+ *
  * Revision 1.88  2007/04/19 15:28:30  kharlov
  * Modify strip unit geometry according to the final drawings (Timur)
  *
@@ -70,6 +89,7 @@
 #include <TVirtualMC.h>
 #include <TGeoPhysicalNode.h>
 #include <TGeoManager.h>
+#include <TGeoMatrix.h>
 #include <TVector3.h>
 
 // --- Standard library ---
@@ -410,10 +430,11 @@ void AliPHOSv0::CreateGeometryforEMC()
 
   // ======= Define the strip ===============
 
-  gMC->Gsvolu("PSTR", "BOX ", idtmed[716], emcg->GetStripHalfSize(), 3) ;  //Made of stell
+  gMC->Gsvolu("PSTR", "BOX ", idtmed[716], emcg->GetStripHalfSize(), 3) ;  //Made of steel
    
       // --- define steel volume (cell of the strip unit)
-      gMC->Gsvolu("PCEL", "BOX ", idtmed[716], emcg->GetSteelCellHalfSize(), 3);
+//       gMC->Gsvolu("PCEL", "BOX ", idtmed[798], emcg->GetSteelCellHalfSize(), 3);
+      gMC->Gsvolu("PCEL", "BOX ", idtmed[798], emcg->GetAirCellHalfSize(), 3);
 
       // --- define wrapped crystal and put it into steel cell
 
@@ -444,7 +465,8 @@ void AliPHOSv0::CreateGeometryforEMC()
 
       Float_t* splate = emcg->GetSupportPlateHalfSize();  
       y = -splate[1] ;
-      Float_t* acel = emcg->GetSteelCellHalfSize() ;
+//       Float_t* acel = emcg->GetSteelCellHalfSize() ;
+      Float_t* acel = emcg->GetAirCellHalfSize() ;
 
       for(Int_t lev = 2, icel = 1; icel <= emcg->GetNCellsXInStrip()*emcg->GetNCellsZInStrip(); icel += 2, lev += 2){
          Float_t x = (2*(lev / 2) - 1 - emcg->GetNCellsXInStrip())* acel[0] ;
@@ -910,18 +932,33 @@ void AliPHOSv0::AddAlignableVolumes() const
   TString physModulePath="/ALIC_1/PHOS_";
   TString symbModuleName="PHOS/Module";
   Int_t nModules = GetGeometry()->GetNModules();
-
+  
   for(Int_t iModule=1; iModule<=nModules; iModule++){
     volpath = physModulePath;
     volpath += iModule;
+    //    volpath += "/PEMC_1/PCOL_1/PTIO_1/PCOR_1/PAGA_1/PTII_1";
+
     symname = symbModuleName;
     symname += iModule;
     gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
+
+    // Creates the Tracking to Local transformation matrix for PHOS modules
+    TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(symname.Data()) ;
+    const char *path = alignableEntry->GetTitle();
+    if (!gGeoManager->cd(path))
+       AliFatal(Form("Volume path %s not valid!",path));
+
+    Float_t angle = GetGeometry()->GetPHOSAngle(iModule);
+    TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
+
+    TGeoHMatrix *matTtoL = new TGeoHMatrix;
+    matTtoL->RotateZ(-90.+angle);
+    matTtoL->MultiplyLeft(&(globMatrix->Inverse()));
+    alignableEntry->SetMatrix(matTtoL);
   }
 
   //Aligning of CPV should be done for volume PCPV_1
   symbModuleName="PHOS/Module";
-  Double_t rotMatrix[9] ;
   for(Int_t iModule=1; iModule<=nModules; iModule++){
     volpath = physModulePath;
     volpath += iModule;
@@ -942,19 +979,15 @@ void AliPHOSv0::AddAlignableVolumes() const
     const char *path = alignableEntry->GetTitle();
     if (!gGeoManager->cd(path))
        AliFatal(Form("Volume path %s not valid!",path));
-    TGeoHMatrix *matLtoT = new TGeoHMatrix;
-    matLtoT->SetDx(0.) ;
-    matLtoT->SetDy(0.) ;
-    matLtoT->SetDz(0.) ;
-    rotMatrix[0]= 1;  rotMatrix[1]= 0;  rotMatrix[2]= 0; // 
-    rotMatrix[3]= 0;  rotMatrix[4]= 0;  rotMatrix[5]= 1; //
-    rotMatrix[6]= 0;  rotMatrix[7]= 1;  rotMatrix[8]= 0;
-    TGeoRotation rot;
-    rot.SetMatrix(rotMatrix);
-    matLtoT->MultiplyLeft(&rot);
-    TGeoHMatrix *matTtoL = new TGeoHMatrix(matLtoT->Inverse());
-    delete matLtoT;
+
+    Float_t angle = GetGeometry()->GetPHOSAngle(iModule);
+    TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
+
+    TGeoHMatrix *matTtoL = new TGeoHMatrix;
+    matTtoL->RotateZ(-90.+angle);
+    matTtoL->MultiplyLeft(&(globMatrix->Inverse()));
     alignableEntry->SetMatrix(matTtoL);
+    
   }