]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSv0.cxx
DP:Misalignment of CPV added
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv0.cxx
index e872b6a7ccdb2d42889c8b46c0a6941d691969af..c302c6947bf46bfa483912495804f3f55c9c83d2 100644 (file)
  **************************************************************************/
 /* $Id$ */
 
+/* History of cvs commits:
+ *
+ * $Log$
+ * Revision 1.85  2007/03/01 11:37:37  kharlov
+ * Strip units changed from 8x1 to 8x2 (T.Pocheptsov)
+ *
+ * Revision 1.84  2006/12/20 16:56:43  kharlov
+ * Optional geometry without CPV
+ *
+ * Revision 1.83  2006/11/14 17:11:15  hristov
+ * Removing inheritances from TAttLine, TAttMarker and AliRndm in AliModule. The copy constructor and assignment operators are moved to the private part of the class and not implemented. The corresponding changes are propagated to the detectors
+ *
+ * Revision 1.82  2006/09/27 19:55:57  kharlov
+ * Alignment object with symbolic volume names are introduced
+ *
+ * Revision 1.81  2006/03/04 20:25:56  kharlov
+ * Set geom parameters from CDB
+ *
+ * Revision 1.80  2005/06/17 07:39:07  hristov
+ * Removing GetDebug and SetDebug from AliRun and AliModule. Using AliLog for the messages
+ *
+ * Revision 1.79  2005/05/28 14:19:05  schutz
+ * Compilation warnings fixed by T.P.
+ *
+ */
+
 //_________________________________________________________________________
 // Implementation version v0 of PHOS Manager class 
 // An object of this class does not produce hits nor digits
@@ -33,6 +59,7 @@
 #include <TTRD1.h>
 #include <TTree.h>
 #include <TVirtualMC.h>
+#include <TGeoManager.h>
 
 // --- Standard library ---
 
@@ -46,6 +73,7 @@
 #include "AliPHOSLoader.h"
 #include "AliPHOSv0.h"
 #include "AliRun.h"
+#include "AliLog.h"
 
 ClassImp(AliPHOSv0)
 
@@ -313,29 +341,32 @@ void AliPHOSv0::CreateGeometry()
   
   this->CreateGeometryforEMC() ; 
 
-  this->CreateGeometryforCPV() ;
+  if (strstr(fTitle.Data(),"noCPV") == 0) 
+    this->CreateGeometryforCPV() ;
   
   this->CreateGeometryforSupport() ; 
   
   // --- Position  PHOS mdules in ALICE setup ---
   
   Int_t idrotm[99] ;
-  Double_t const kRADDEG = 180.0 / TMath::Pi() ;
-  Float_t * phosParams = geom->GetPHOSParams() ;
-
-  Float_t r = geom->GetIPtoOuterCoverDistance() + phosParams[3] - geom->GetCPVBoxSize(1) ;
-  Int_t i;
-  for( i = 1; i <= geom->GetNModules()  ; i++ ) {
+  Int_t iXYZ,iAngle;
+  for (Int_t iModule = 0; iModule < geom->GetNModules(); iModule++ ) {
     
-    Float_t angle = geom->GetPHOSAngle(i) ;
-    AliMatrix(idrotm[i-1], 90.,angle, 0., 0., 90., 270. +angle) ;
-    
-    Float_t xP1 =  r * TMath::Sin( angle / kRADDEG ) ;
-    Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
+    Float_t angle[3][2];
+    for (iXYZ=0; iXYZ<3; iXYZ++)
+      for (iAngle=0; iAngle<2; iAngle++)
+       angle[iXYZ][iAngle] = geom->GetModuleAngle(iModule,iXYZ, iAngle);
+    AliMatrix(idrotm[iModule],
+             angle[0][0],angle[0][1],
+             angle[1][0],angle[1][1],
+             angle[2][0],angle[2][1]) ;
     
-    gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
-    
-  } 
+    Float_t pos[3];
+    for (iXYZ=0; iXYZ<3; iXYZ++)
+      pos[iXYZ] = geom->GetModuleCenter(iModule,iXYZ);
+    gMC->Gspos("PHOS", iModule+1, "ALIC", pos[0], pos[1], pos[2],
+              idrotm[iModule], "ONLY") ;
+  }
 
 }
 
@@ -403,10 +434,12 @@ void AliPHOSv0::CreateGeometryforEMC()
       Float_t* splate = emcg->GetSupportPlateHalfSize();  
       y = -splate[1] ;
       Float_t* acel = emcg->GetAirCellHalfSize() ;
-      Int_t icel ;
-      for(icel = 1; icel <= emcg->GetNCellsInStrip(); icel++){
-       Float_t x = (2*icel - 1 - emcg->GetNCellsInStrip())* acel[0] ;
-       gMC->Gspos("PCEL", icel, "PSTR", x, y, 0.0, 0, "ONLY") ;
+
+      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] ;
+         Float_t z = acel[2];
+         gMC->Gspos("PCEL", icel, "PSTR", x, y, +z, 0, "ONLY") ;
+         gMC->Gspos("PCEL", icel + 1, "PSTR", x, y, -z, 0, "ONLY") ;
       }
 
       // --- define the support plate, hole in it and position it in strip ----
@@ -813,7 +846,7 @@ void AliPHOSv0::CreateGeometryforSupport()
   par[4] =  geom->GetCradleWall(4) ;
   gMC->Gsvolu("PCRA", "TUBS", idtmed[716], par, 5) ;
 
-  par[0] -=  geom->GetCradleWallThickness() ;
+  par[0] +=  geom->GetCradleWallThickness() ;
   par[1] -=  geom->GetCradleWallThickness() ;
   par[2] -=  geom->GetCradleWallThickness() ;
   gMC->Gsvolu("PCRE", "TUBS", idtmed[798], par, 5) ;
@@ -845,6 +878,113 @@ void AliPHOSv0::CreateGeometryforSupport()
 
 }
 
+//_____________________________________________________________________________
+void AliPHOSv0::AddAlignableVolumes() const
+{
+  //
+  // Create entries for alignable volumes associating the symbolic volume
+  // name with the corresponding volume path. Needs to be syncronized with
+  // eventual changes in the geometry
+  // Alignable volumes are:
+  // 1) PHOS modules as a whole
+  // 2) Cradle
+  // 3) Cradle wheels
+  // 4) Strip units (group of 2x8 crystals)
+
+  TString volpath, symname;
+
+  // Alignable modules
+  // Volume path /ALIC_1/PHOS_<i> => symbolic name /PHOS/Module<i>, <i>=1,2,3,4,5
+
+  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;
+    symname = symbModuleName;
+    symname += iModule;
+    gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
+  }
+
+  //Aligning of CPV should be done for volume PCPV_1
+  symbModuleName="PHOS/Module";
+  for(Int_t iModule=1; iModule<=nModules; iModule++){
+    volpath = physModulePath;
+    volpath += iModule;
+    volpath += "/PCPV_1";
+    symname = symbModuleName;
+    symname += iModule;
+    symname += "/CPV";
+    gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
+  }
+
+  // Alignable cradle walls
+  // Volume path /ALIC_1/PCRA_<i> => symbolic name /PHOS/Cradle<i>, <i>=0,1
+
+  TString physCradlePath="/ALIC_1/PCRA_";
+  TString symbCradleName="PHOS/Cradle";
+  Int_t nCradles = 2;
+
+  for(Int_t iCradle=0; iCradle<nCradles; iCradle++){
+    volpath = physCradlePath;
+    volpath += iCradle;
+    symname = symbCradleName;
+    symname += iCradle;
+    gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
+  }
+
+  // Alignable wheels
+  // Volume path /ALIC_1/PWHE_<i> => symbolic name /PHOS/Wheel<i>, i=0,1,2,3
+
+  TString physWheelPath="/ALIC_1/PWHE_";
+  TString symbWheelName="PHOS/Wheel";
+  Int_t nWheels = 4;
+
+  for(Int_t iWheel=0; iWheel<nWheels; iWheel++){
+    volpath = physWheelPath;
+    volpath += iWheel;
+    symname = symbWheelName;
+    symname += iWheel;
+    gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
+  }
+
+  //Physical strip path is a combination of: physModulePath + module number + 
+  //physStripPath + strip number == ALIC_1/PHOS_N/..../PSTR_M
+  const Int_t nStripsX = GetGeometry()->GetEMCAGeometry()->GetNStripX();
+  const Int_t nStripsZ = GetGeometry()->GetEMCAGeometry()->GetNStripZ();
+  TString partialPhysStripName(100);
+  TString fullPhysStripName(100);
+  TString partialSymbStripName(100);
+  TString fullSymbStripName(100);
+
+  for(Int_t module = 1; module <= nModules; ++module){
+    partialPhysStripName  = physModulePath;
+    partialPhysStripName += module;
+    partialPhysStripName += "/PEMC_1/PCOL_1/PTIO_1/PCOR_1/PAGA_1/PTII_1/PSTR_";
+
+    partialSymbStripName  = symbModuleName;
+    partialSymbStripName += module;
+    partialSymbStripName += "/Strip_";
+
+    for(Int_t i = 0, ind1D = 1; i < nStripsX; ++i){//ind1D starts from 1 (PSTR_1...PSTR_224...)
+      for(Int_t j = 0; j < nStripsZ; ++j, ++ind1D){
+         fullPhysStripName = partialPhysStripName;
+         fullPhysStripName += ind1D;
+         
+         fullSymbStripName  = partialSymbStripName;
+         fullSymbStripName += i;//ind1D;
+         fullSymbStripName += '_';
+         fullSymbStripName += j;
+
+         gGeoManager->SetAlignableEntry(fullSymbStripName.Data(), fullPhysStripName.Data());
+      }
+    }
+  }
+}
+
 //____________________________________________________________________________
 Float_t AliPHOSv0::ZMin(void) const
 {
@@ -872,7 +1012,7 @@ void AliPHOSv0::Init(void)
   
   Int_t i;
 
-  if(fDebug) {
+  if(AliLog::GetGlobalDebugLevel()>0) {
     TString st ; 
     for(i=0;i<35;i++) 
       st += "*";