]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSv0.cxx
overlapp between PUCP and PTCB corrected
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv0.cxx
index 6683a1b7f797dd18777eabb2d44b0bc520116b4d..97af9321530ba954e39e59834801501924d69182 100644 (file)
@@ -18,6 +18,7 @@
 //_________________________________________________________________________
 // Implementation version v0 of PHOS Manager class 
 // Layout EMC + PPSD has name GPS2  
+// Layout EMC + CPV  has name IHEP
 // An object of this class does not produce hits nor digits
 // It is the one to use if you do not want to produce outputs in TREEH or TREED
 //                  
@@ -29,6 +30,7 @@
 #include "TBRIK.h"
 #include "TNode.h"
 #include "TRandom.h"
+#include "TGeometry.h"
 
 
 // --- Standard library ---
@@ -43,6 +45,8 @@
 #include "AliPHOSv0.h"
 #include "AliRun.h"
 #include "AliConst.h"
+#include "AliMC.h"
+#include "AliPHOSGeometry.h"
 
 ClassImp(AliPHOSv0)
 
@@ -51,16 +55,15 @@ AliPHOSv0::AliPHOSv0(const char *name, const char *title):
   AliPHOS(name,title)
 {
   // ctor : title is used to identify the layout
-  //        GPS2 = 5 modules (EMC + PPSD)   
+  //        GPS2 = 5 modules (EMC + PPSD)
+  //        IHEP = 5 modules (EMC + CPV)
+  //        MIXT = 4 modules (EMC + CPV) and 1 module (EMC + PPSD)
  
   // gets an instance of the geometry parameters class  
-   
-  if (strcmp(title,"") != 0 ) 
-    fGeom =  AliPHOSGeometry::GetInstance(title, "") ; 
-  if (fGeom!=0)  
-    cout << "AliPHOS" << Version() << " : PHOS geometry intialized for " << fGeom->GetName() << endl ;
-  else
-    cout << "AliPHOS" << Version() << " : PHOS geometry initialization failed !" << endl ;   
+
+  if (strcmp(GetTitle(),"") != 0 ) 
+    fGeom =  AliPHOSGeometry::GetInstance(GetTitle(), "") ; 
+
 }
 
 //____________________________________________________________________________
@@ -98,10 +101,17 @@ void AliPHOSv0::BuildGeometry()
   //END_HTML  
 
   this->BuildGeometryforPHOS() ; 
-  if ( ( strcmp(fGeom->GetName(), "GPS2" ) == 0 ) ) 
+  if      (strcmp(fGeom->GetName(),"GPS2") == 0)
+    this->BuildGeometryforPPSD() ;
+  else if (strcmp(fGeom->GetName(),"IHEP") == 0)
+    this->BuildGeometryforCPV() ;
+  else if (strcmp(fGeom->GetName(),"MIXT") == 0) {
     this->BuildGeometryforPPSD() ;
+    this->BuildGeometryforCPV() ;
+  }
   else
-    cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed" << endl; 
+    cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed: "
+        << "Geometry name = " << fGeom->GetName() << endl; 
 
 }
 
@@ -239,9 +249,9 @@ void AliPHOSv0:: BuildGeometryforPPSD(void)
 
   // Box for a full PHOS module
 
-  new TBRIK( "PPSDBox", "PPSD box", "void",  fGeom->GetPPSDBoxSize(0)/2, 
-                                             fGeom->GetPPSDBoxSize(1)/2, 
-                                            fGeom->GetPPSDBoxSize(2)/2 );
+  new TBRIK( "PPSDBox", "PPSD box", "void",  fGeom->GetCPVBoxSize(0)/2, 
+                                             fGeom->GetCPVBoxSize(1)/2, 
+                                            fGeom->GetCPVBoxSize(2)/2 );
 
   // Box containing one micromegas module 
 
@@ -284,33 +294,39 @@ void AliPHOSv0:: BuildGeometryforPPSD(void)
                                                      ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ; 
  // Gap between Lead and top micromegas
 
-  new TBRIK ( "LeadToM", "Air Gap top", "void", fGeom->GetPPSDBoxSize(0)/2,
+  new TBRIK ( "LeadToM", "Air Gap top", "void", fGeom->GetCPVBoxSize(0)/2,
                                                 fGeom->GetMicro1ToLeadGap()/2,
-                                                fGeom->GetPPSDBoxSize(2)/2  ) ;  
+                                                fGeom->GetCPVBoxSize(2)/2  ) ;  
  
 // Gap between Lead and bottom micromegas
 
-  new TBRIK ( "MToLead", "Air Gap bottom", "void", fGeom->GetPPSDBoxSize(0)/2,
+  new TBRIK ( "MToLead", "Air Gap bottom", "void", fGeom->GetCPVBoxSize(0)/2,
                                                    fGeom->GetLeadToMicro2Gap()/2,
-                                                   fGeom->GetPPSDBoxSize(2)/2  ) ; 
+                                                   fGeom->GetCPVBoxSize(2)/2  ) ; 
  // Lead converter
    
-  new TBRIK ( "Lead", "Lead converter", "void", fGeom->GetPPSDBoxSize(0)/2,
+  new TBRIK ( "Lead", "Lead converter", "void", fGeom->GetCPVBoxSize(0)/2,
                                                 fGeom->GetLeadConverterThickness()/2,
-                                                fGeom->GetPPSDBoxSize(2)/2  ) ; 
+                                                fGeom->GetCPVBoxSize(2)/2  ) ; 
 
      // position PPSD into ALICE
 
   char * nodename = new char[20] ;  
   char * rotname  = new char[20] ; 
 
-  Float_t r = fGeom->GetIPtoTopLidDistance() + fGeom->GetPPSDBoxSize(1) / 2.0 ;
+  Float_t r = fGeom->GetIPtoTopLidDistance() + fGeom->GetCPVBoxSize(1) / 2.0 ;
   Int_t number = 988 ; 
   TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
  
-  for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { // the number of PHOS modules
+  Int_t firstModule = 0 ; 
+  if      (strcmp(fGeom->GetName(),"GPS2") == 0) 
+    firstModule = 1;
+  else if (strcmp(fGeom->GetName(),"MIXT") == 0) 
+    firstModule = fGeom->GetNModules() - fGeom->GetNPPSDModules() + 1;
+  
+  for( Int_t i = firstModule; i <= fGeom->GetNModules(); i++ ) { // the number of PHOS modules
     Float_t angle = fGeom->GetPHOSAngle(i) ;
-    sprintf(rotname, "%s%d", "rotg", number++) ;
+    sprintf(rotname, "%s%d", "rotg", number+i) ;
     new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
     top->cd();
     sprintf(nodename, "%s%d", "Moduleg", i) ;    
@@ -322,13 +338,13 @@ void AliPHOSv0:: BuildGeometryforPPSD(void)
     ppsdboxnode->cd() ;
     // inside the PPSD box: 
     //   1.   fNumberOfModulesPhi x fNumberOfModulesZ top micromegas
-    x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;  
+    x = ( fGeom->GetCPVBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;  
     {
       for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
-       Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
+       Float_t z = ( fGeom->GetCPVBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
        TNode * micro1node ; 
        for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
-         y = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ; 
+         y = ( fGeom->GetCPVBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ; 
          sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ;
          micro1node  = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
          micro1node->SetLineColor(kColorPPSD) ;  
@@ -386,7 +402,7 @@ void AliPHOSv0:: BuildGeometryforPPSD(void)
     }
     //   2. air gap      
     ppsdboxnode->cd() ;
-    y = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ; 
+    y = ( fGeom->GetCPVBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ; 
     sprintf(nodename, "%s%d", "GapUp", i) ;
     TNode * gapupnode = new TNode(nodename, nodename, "LeadToM", 0, y, 0) ;
     gapupnode->SetLineColor(kColorAir) ;  
@@ -404,13 +420,13 @@ void AliPHOSv0:: BuildGeometryforPPSD(void)
     gapdownnode->SetLineColor(kColorAir) ;  
     fNodes->Add(gapdownnode) ;        
     //    5.  fNumberOfModulesPhi x fNumberOfModulesZ bottom micromegas
-    x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. - fGeom->GetPhiDisplacement() ;  
+    x = ( fGeom->GetCPVBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. - fGeom->GetPhiDisplacement() ;  
     {
       for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { 
-       Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2.  - fGeom->GetZDisplacement() ;;
+       Float_t z = ( fGeom->GetCPVBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2.  - fGeom->GetZDisplacement() ;;
        TNode * micro2node ; 
        for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { 
-         y = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ; 
+         y = - ( fGeom->GetCPVBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ; 
          sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ;
          micro2node  = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
          micro2node->SetLineColor(kColorPPSD) ;  
@@ -473,6 +489,139 @@ void AliPHOSv0:: BuildGeometryforPPSD(void)
 
 }
 
+//____________________________________________________________________________
+void AliPHOSv0:: BuildGeometryforCPV(void)
+{
+  //  Build the PHOS-CPV geometry for the ROOT display
+  //  Author: Yuri Kharlov 11 September 2000
+  //
+  //BEGIN_HTML
+  /*
+    <H2>
+    CPV displayed by root
+    </H2>
+    <table width=700>
+
+    <tr>
+         <td>CPV perspective view</td>
+         <td>CPV front view      </td>
+    </tr>
+
+    <tr>
+         <td> <img height=300 width=290 src="../images/CPVRootPersp.gif"> </td>
+         <td> <img height=300 width=290 src="../images/CPVRootFront.gif"> </td>
+    </tr>
+
+    </table>
+
+  */
+  //END_HTML  
+
+  const Double_t kRADDEG         = 180.0 / kPI ;
+  const Int_t    kColorCPV       = kGreen ;
+  const Int_t    kColorFrame     = kYellow ;
+  const Int_t    kColorGassiplex = kRed;
+  const Int_t    kColorPCB       = kCyan;
+
+  // Box for a full PHOS module
+
+  new TBRIK ("CPVBox", "CPV box", "void",                   fGeom->GetCPVBoxSize(0)/2,
+                                                            fGeom->GetCPVBoxSize(1)/2,
+                                                           fGeom->GetCPVBoxSize(2)/2 );
+  new TBRIK ("CPVFrameLR", "CPV frame Left-Right", "void",  fGeom->GetCPVFrameSize(0)/2,
+                                                            fGeom->GetCPVFrameSize(1)/2,
+                                                           fGeom->GetCPVBoxSize(2)/2 );
+  new TBRIK ("CPVFrameUD", "CPV frame Up-Down",    "void",  fGeom->GetCPVBoxSize(0)/2 - fGeom->GetCPVFrameSize(0),
+                                                            fGeom->GetCPVFrameSize(1)/2,
+                                                           fGeom->GetCPVFrameSize(2)/2);
+  new TBRIK ("CPVPCB",    "CPV PCB",               "void",  fGeom->GetCPVActiveSize(0)/2,
+                                                            fGeom->GetCPVTextoliteThickness()/2,
+                                                           fGeom->GetCPVActiveSize(1)/2);
+  new TBRIK ("CPVGassiplex", "CPV Gassiplex PCB",  "void",  fGeom->GetGassiplexChipSize(0)/2,
+                                                            fGeom->GetGassiplexChipSize(1)/2,
+                                                           fGeom->GetGassiplexChipSize(2)/2);
+
+  // position CPV into ALICE
+
+  char * nodename = new char[25] ;
+  char * rotname  = new char[25] ;
+  
+  Float_t r = fGeom->GetIPtoCPVDistance() + fGeom->GetCPVBoxSize(1) / 2.0 ;
+  Int_t number = 988 ; 
+  TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
+
+  Int_t lastModule = 0 ;
+  if      (strcmp(fGeom->GetName(),"IHEP") == 0) 
+    lastModule = fGeom->GetNModules();
+  else if (strcmp(fGeom->GetName(),"MIXT") == 0) 
+    lastModule = fGeom->GetNModules() - fGeom->GetNPPSDModules();
+  
+  for( Int_t i = 1; i <= lastModule; i++ ) { // the number of PHOS modules
+
+    // One CPV module
+
+    Float_t angle = fGeom->GetPHOSAngle(i) ;
+    sprintf(rotname, "%s%d", "rotg", number+i) ;
+    new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
+    top->cd();
+    sprintf(nodename, "%s%d", "CPVModule", i) ;    
+    Float_t x =  r * TMath::Sin( angle / kRADDEG ) ;
+    Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
+    Float_t z;
+    TNode * cpvBoxNode = new TNode(nodename , nodename ,"CPVBox", x, y, 0, rotname ) ;
+    cpvBoxNode->SetLineColor(kColorCPV) ;
+    fNodes->Add(cpvBoxNode) ;
+    cpvBoxNode->cd() ;
+
+    // inside each CPV box:
+
+    // Frame around CPV
+    Int_t j;
+    for (j=0; j<=1; j++) {
+      sprintf(nodename, "CPVModule%d Frame%d", i, j+1) ;
+      x = TMath::Sign(1,2*j-1) * (fGeom->GetCPVBoxSize(0) - fGeom->GetCPVFrameSize(0)) / 2;
+      TNode * cpvFrameNode = new TNode(nodename , nodename ,"CPVFrameLR", x, 0, 0) ;
+      cpvFrameNode->SetLineColor(kColorFrame) ;
+      fNodes->Add(cpvFrameNode) ;
+
+      sprintf(nodename, "CPVModule%d Frame%d", i, j+3) ;
+      z = TMath::Sign(1,2*j-1) * (fGeom->GetCPVBoxSize(2) - fGeom->GetCPVFrameSize(2)) / 2;
+      cpvFrameNode = new TNode(nodename , nodename ,"CPVFrameUD", 0, 0, z) ;
+      cpvFrameNode->SetLineColor(kColorFrame) ;
+      fNodes->Add(cpvFrameNode) ;
+    }
+
+    // 4 printed circuit boards
+    for (j=0; j<4; j++) {
+      sprintf(nodename, "CPVModule%d PCB%d", i, j+1) ;
+      y = fGeom->GetCPVFrameSize(1) / 2 - fGeom->GetFTPosition(j) + fGeom->GetCPVTextoliteThickness()/2;
+      TNode * cpvPCBNode = new TNode(nodename , nodename ,"CPVPCB", 0, y, 0) ;
+      cpvPCBNode->SetLineColor(kColorPCB) ;
+      fNodes->Add(cpvPCBNode) ;
+    }
+
+    // Gassiplex chips
+    Float_t xStep = fGeom->GetCPVActiveSize(0) / (fGeom->GetNumberOfCPVChipsPhi() + 1);
+    Float_t zStep = fGeom->GetCPVActiveSize(1) / (fGeom->GetNumberOfCPVChipsZ()   + 1);
+    y = fGeom->GetCPVFrameSize(1)/2           - fGeom->GetFTPosition(0) +
+        fGeom->GetCPVTextoliteThickness() / 2 + fGeom->GetGassiplexChipSize(1) / 2 + 0.1;
+    for (Int_t ix=0; ix<fGeom->GetNumberOfCPVChipsPhi(); ix++) {
+      x = xStep * (ix+1) - fGeom->GetCPVActiveSize(0)/2;
+      for (Int_t iz=0; iz<fGeom->GetNumberOfCPVChipsZ(); iz++) {
+       z = zStep * (iz+1) - fGeom->GetCPVActiveSize(1)/2;
+       sprintf(nodename, "CPVModule%d Chip(%dx%d)", i, ix+1,iz+1) ;
+       TNode * cpvGassiplexNode = new TNode(nodename , nodename ,"CPVGassiplex", x, y, z) ;
+       cpvGassiplexNode->SetLineColor(kColorGassiplex) ;
+       fNodes->Add(cpvGassiplexNode) ;
+      }
+    }
+
+  } // PHOS modules
+  delete[] rotname ;  
+  delete[] nodename ; 
+}
+
 //____________________________________________________________________________
 void AliPHOSv0::CreateGeometry()
 {
@@ -489,38 +638,73 @@ void AliPHOSv0::CreateGeometry()
   // Get pointer to the array containing media indeces
   Int_t *idtmed = fIdtmed->GetArray() - 699 ;
 
+  // Create a box a PHOS module.
+  // In case of MIXT geometry 2 different boxes are needed
+
   Float_t bigbox[3] ; 
   bigbox[0] =   fGeom->GetOuterBoxSize(0) / 2.0 ;
-  bigbox[1] = ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
+  bigbox[1] = ( fGeom->GetOuterBoxSize(1) + fGeom->GetCPVBoxSize(1) ) / 2.0 ;
   bigbox[2] =   fGeom->GetOuterBoxSize(2) / 2.0 ;
   
-  gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ;
+    gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ;
+
+  if ( strcmp( fGeom->GetName(),"MIXT") == 0 && fGeom->GetNPPSDModules() > 0) 
+    gMC->Gsvolu("PHO1", "BOX ", idtmed[798], bigbox, 3) ;
   
-  this->CreateGeometryforPHOS() ; 
-  if ( strcmp( fGeom->GetName(), "GPS2") == 0  ) 
+    this->CreateGeometryforPHOS() ; 
+  if      ( strcmp( fGeom->GetName(), "GPS2") == 0  ) 
     this->CreateGeometryforPPSD() ;
+  else if ( strcmp( fGeom->GetName(), "IHEP") == 0  ) 
+    this->CreateGeometryforCPV() ;
+  else if ( strcmp( fGeom->GetName(), "MIXT") == 0  ) {
+    this->CreateGeometryforPPSD() ;
+    this->CreateGeometryforCPV() ;
+  }
   else
     cout << "AliPHOSv0::CreateGeometry : no charged particle identification system installed" << endl; 
+
+  this->CreateGeometryforSupport() ; 
   
   // --- Position  PHOS mdules in ALICE setup ---
   
   Int_t idrotm[99] ;
   Double_t const kRADDEG = 180.0 / kPI ;
   
-  for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
+  Int_t lastModule;
+  if (strcmp(fGeom->GetName(),"MIXT") == 0) 
+    lastModule = fGeom->GetNModules() - fGeom->GetNPPSDModules();
+  else
+    lastModule = fGeom->GetNModules();
+
+  Int_t i;
+  for( i = 1; i <= lastModule ; i++ ) {
     
     Float_t angle = fGeom->GetPHOSAngle(i) ;
     AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
  
-    Float_t r = fGeom->GetIPtoOuterCoverDistance() + ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
+    Float_t r = fGeom->GetIPtoOuterCoverDistance() + ( fGeom->GetOuterBoxSize(1) + fGeom->GetCPVBoxSize(1) ) / 2.0 ;
 
-    Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
+    Float_t xP1 =  r * TMath::Sin( angle / kRADDEG ) ;
     Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
 
     gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
  
   } // for GetNModules
 
+  for( i = lastModule+1; i <= fGeom->GetNModules(); i++ ) {
+    
+    Float_t angle = fGeom->GetPHOSAngle(i) ;
+    AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
+    Float_t r = fGeom->GetIPtoOuterCoverDistance() + ( fGeom->GetOuterBoxSize(1) + fGeom->GetCPVBoxSize(1) ) / 2.0 ;
+
+    Float_t xP1 =  r * TMath::Sin( angle / kRADDEG ) ;
+    Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
+
+    gMC->Gspos("PHO1", i-lastModule, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
+  } // for GetNModules
+
 }
 
 //____________________________________________________________________________
@@ -551,14 +735,16 @@ void AliPHOSv0::CreateGeometryforPHOS()
   dphos[1] =  fGeom->GetOuterBoxSize(1) / 2.0 ;
   dphos[2] =  fGeom->GetOuterBoxSize(2) / 2.0 ;
 
-  gMC->Gsvolu("EMCA", "BOX ", idtmed[706], dphos, 3) ;
+  gMC->Gsvolu("PEMC", "BOX ", idtmed[706], dphos, 3) ;
 
-  Float_t yO =  - fGeom->GetPPSDBoxSize(1)  / 2.0 ;
+  Float_t yO =  - fGeom->GetCPVBoxSize(1)  / 2.0 ;
 
-  gMC->Gspos("EMCA", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ; 
+    gMC->Gspos("PEMC", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ; 
+  if ( strcmp( fGeom->GetName(),"MIXT") == 0 && fGeom->GetNPPSDModules() > 0) 
+    gMC->Gspos("PEMC", 1, "PHO1", 0.0, yO, 0.0, 0, "ONLY") ; 
 
   // ---
-  // --- Define Textolit Wall box, position inside EMCA ---
+  // --- Define Textolit Wall box, position inside PEMC ---
   // --- Textolit Wall box dimentions ---
  
  
@@ -571,7 +757,7 @@ void AliPHOSv0::CreateGeometryforPHOS()
 
   yO =   (  fGeom->GetOuterBoxThickness(1) -   fGeom->GetUpperPlateThickness() ) / 2.  ;
    
-  gMC->Gspos("PTXW", 1, "EMCA", 0.0, yO, 0.0, 0, "ONLY") ;
+  gMC->Gspos("PTXW", 1, "PEMC", 0.0, yO, 0.0, 0, "ONLY") ;
 
   // --- 
   // --- Define Upper Polystyrene Foam Plate, place inside PTXW ---
@@ -728,9 +914,9 @@ void AliPHOSv0::CreateGeometryforPHOS()
   
   gMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp,3) ;
   
-  yO = (  fGeom->GetAirFilledBoxSize(1) -  fGeom->GetUpperCoolingPlateThickness() ) / 2. 
-       - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
-           - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() - fGeom->GetUpperCoolingPlateThickness() ) ; 
+  yO = fGeom->GetAirFilledBoxSize(1) / 2. 
+    -( fGeom->GetIPtoCrystalSurface()  - fGeom->GetIPtoOuterCoverDistance()    - fGeom->GetModuleBoxThickness()
+      -fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() - fGeom->GetUpperCoolingPlateThickness() ) ; 
   
   gMC->Gspos("PUCP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
 
@@ -795,7 +981,6 @@ void AliPHOSv0::CreateGeometryforPHOS()
 void AliPHOSv0::CreateGeometryforPPSD()
 {
   // Create the PHOS-PPSD geometry for GEANT
-
   //BEGIN_HTML
   /*
     <H2>
@@ -812,15 +997,18 @@ void AliPHOSv0::CreateGeometryforPPSD()
   
   // The box containing all ppsd's for one PHOS module filled with air 
   Float_t ppsd[3] ; 
-  ppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;  
-  ppsd[1] = fGeom->GetPPSDBoxSize(1) / 2.0 ; 
-  ppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
+  ppsd[0] = fGeom->GetCPVBoxSize(0) / 2.0 ;  
+  ppsd[1] = fGeom->GetCPVBoxSize(1) / 2.0 ; 
+  ppsd[2] = fGeom->GetCPVBoxSize(2) / 2.0 ;
 
   gMC->Gsvolu("PPSD", "BOX ", idtmed[798], ppsd, 3) ;
 
   Float_t yO =  fGeom->GetOuterBoxSize(1) / 2.0 ;
 
-  gMC->Gspos("PPSD", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ; 
+  if ( strcmp( fGeom->GetName(),"MIXT") == 0 && fGeom->GetNPPSDModules() > 0) 
+    gMC->Gspos("PPSD", 1, "PHO1", 0.0, yO, 0.0, 0, "ONLY") ; 
+  else
+    gMC->Gspos("PPSD", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ; 
 
   // Now we build a micromegas module
   // The box containing the whole module filled with epoxy (FR4)
@@ -830,7 +1018,7 @@ void AliPHOSv0::CreateGeometryforPPSD()
   mppsd[1] = fGeom->GetPPSDModuleSize(1) / 2.0 ;  
   mppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
 
-  gMC->Gsvolu("MPPS", "BOX ", idtmed[708], mppsd, 3) ;  
+  gMC->Gsvolu("PMPP", "BOX ", idtmed[708], mppsd, 3) ;  
  
   // Inside mppsd :
   // 1. The Top Lid made of epoxy (FR4) 
@@ -840,11 +1028,11 @@ void AliPHOSv0::CreateGeometryforPPSD()
   tlppsd[1] = fGeom->GetLidThickness() / 2.0 ;
   tlppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
 
-  gMC->Gsvolu("TLPS", "BOX ", idtmed[708], tlppsd, 3) ; 
+  gMC->Gsvolu("PTLP", "BOX ", idtmed[708], tlppsd, 3) ; 
 
   Float_t  y0 = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ; 
 
-  gMC->Gspos("TLPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; 
+  gMC->Gspos("PTLP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ; 
  
   // 2. the upper panel made of composite material
 
@@ -853,11 +1041,11 @@ void AliPHOSv0::CreateGeometryforPPSD()
   upppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
   upppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
  
-  gMC->Gsvolu("UPPS", "BOX ", idtmed[709], upppsd, 3) ; 
+  gMC->Gsvolu("PUPP", "BOX ", idtmed[709], upppsd, 3) ; 
   
   y0 = y0 - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ; 
 
-  gMC->Gspos("UPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; 
+  gMC->Gspos("PUPP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ; 
 
   // 3. the anode made of Copper
   
@@ -866,11 +1054,11 @@ void AliPHOSv0::CreateGeometryforPPSD()
   anppsd[1] = fGeom->GetAnodeThickness() / 2.0 ; 
   anppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0  ; 
 
-  gMC->Gsvolu("ANPS", "BOX ", idtmed[710], anppsd, 3) ; 
+  gMC->Gsvolu("PANP", "BOX ", idtmed[710], anppsd, 3) ; 
   
   y0 = y0 - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness()  / 2. ; 
   
-  gMC->Gspos("ANPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; 
+  gMC->Gspos("PANP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ; 
 
   // 4. the conversion gap + avalanche gap filled with gas
 
@@ -879,15 +1067,15 @@ void AliPHOSv0::CreateGeometryforPPSD()
   ggppsd[1] = ( fGeom->GetConversionGap() +  fGeom->GetAvalancheGap() ) / 2.0 ; 
   ggppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
 
-  gMC->Gsvolu("GGPS", "BOX ", idtmed[715], ggppsd, 3) ; 
+  gMC->Gsvolu("PGGP", "BOX ", idtmed[715], ggppsd, 3) ; 
   
   // --- Divide GGPP in X (phi) and Z directions --
-  gMC->Gsdvn("GROW", "GGPS", fGeom->GetNumberOfPadsPhi(), 1) ;
-  gMC->Gsdvn("GCEL", "GROW", fGeom->GetNumberOfPadsZ() , 3) ;
+  gMC->Gsdvn("PPRO", "PGGP", fGeom->GetNumberOfPadsPhi(), 1) ;
+  gMC->Gsdvn("PPCE", "PPRO", fGeom->GetNumberOfPadsZ() ,  3) ;
 
   y0 = y0 - fGeom->GetAnodeThickness() / 2.  - ( fGeom->GetConversionGap() +  fGeom->GetAvalancheGap() ) / 2. ; 
 
-  gMC->Gspos("GGPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; 
+  gMC->Gspos("PGGP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ; 
 
 
   // 6. the cathode made of Copper
@@ -897,11 +1085,11 @@ void AliPHOSv0::CreateGeometryforPPSD()
   cappsd[1] = fGeom->GetCathodeThickness() / 2.0 ; 
   cappsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0  ;
 
-  gMC->Gsvolu("CAPS", "BOX ", idtmed[710], cappsd, 3) ; 
+  gMC->Gsvolu("PCAP", "BOX ", idtmed[710], cappsd, 3) ; 
 
-  y0 = y0 - ( fGeom->GetAvalancheGap() +  fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness()  / 2. ; 
+  y0 = y0 - ( fGeom->GetConversionGap() +  fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness()  / 2. ; 
 
-  gMC->Gspos("CAPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; 
+  gMC->Gspos("PCAP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ; 
 
   // 7. the printed circuit made of G10       
 
@@ -914,7 +1102,7 @@ void AliPHOSv0::CreateGeometryforPPSD()
 
   y0 = y0 - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness()  / 2. ; 
 
-  gMC->Gspos("PCPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; 
+  gMC->Gspos("PCPS", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ; 
 
   // 8. the lower panel made of composite material
                                                    
@@ -923,29 +1111,29 @@ void AliPHOSv0::CreateGeometryforPPSD()
   lpppsd[1] = fGeom->GetCompositeThickness() / 2.0 ; 
   lpppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
 
-  gMC->Gsvolu("LPPS", "BOX ", idtmed[709], lpppsd, 3) ; 
+  gMC->Gsvolu("PLPP", "BOX ", idtmed[709], lpppsd, 3) ; 
  
   y0 = y0 - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness()  / 2. ; 
 
-  gMC->Gspos("LPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; 
+  gMC->Gspos("PLPP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ; 
 
   // Position the  fNumberOfModulesPhi x fNumberOfModulesZ modules (mppsd) inside PPSD to cover a PHOS module
   // the top and bottom one's (which are assumed identical) :
 
-   Float_t yt = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ; 
-   Float_t yb = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ; 
+   Float_t yt = ( fGeom->GetCPVBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ; 
+   Float_t yb = - ( fGeom->GetCPVBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ; 
 
    Int_t copyNumbertop = 0 ; 
    Int_t copyNumberbot = fGeom->GetNumberOfModulesPhi() *  fGeom->GetNumberOfModulesZ() ; 
 
-   Float_t x  = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;  
+   Float_t x  = ( fGeom->GetCPVBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;  
 
    for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
-      Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
+      Float_t z = ( fGeom->GetCPVBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
 
       for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
-       gMC->Gspos("MPPS", ++copyNumbertop, "PPSD", x, yt, z, 0, "ONLY") ;
-       gMC->Gspos("MPPS", ++copyNumberbot, "PPSD", x, yb, z, 0, "ONLY") ; 
+       gMC->Gspos("PMPP", ++copyNumbertop, "PPSD", x, yt, z, 0, "ONLY") ;
+       gMC->Gspos("PMPP", ++copyNumberbot, "PPSD", x, yb, z, 0, "ONLY") ; 
        z = z - fGeom->GetPPSDModuleSize(2) ;
       } // end of Z module loop   
       x = x -  fGeom->GetPPSDModuleSize(0) ; 
@@ -955,45 +1143,324 @@ void AliPHOSv0::CreateGeometryforPPSD()
    // 1. Upper air gap
 
    Float_t uappsd[3] ;
-   uappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
+   uappsd[0] = fGeom->GetCPVBoxSize(0) / 2.0 ;
    uappsd[1] = fGeom->GetMicro1ToLeadGap() / 2.0 ; 
-   uappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
+   uappsd[2] = fGeom->GetCPVBoxSize(2) / 2.0 ;
 
-  gMC->Gsvolu("UAPPSD", "BOX ", idtmed[798], uappsd, 3) ; 
+  gMC->Gsvolu("PUAPPS", "BOX ", idtmed[798], uappsd, 3) ; 
 
-  y0 = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ; 
+  y0 = ( fGeom->GetCPVBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ; 
 
-  gMC->Gspos("UAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; 
+  gMC->Gspos("PUAPPS", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; 
 
    // 2. Lead converter
  
   Float_t lcppsd[3] ; 
-  lcppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
+  lcppsd[0] = fGeom->GetCPVBoxSize(0) / 2.0 ;
   lcppsd[1] = fGeom->GetLeadConverterThickness() / 2.0 ; 
-  lcppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
+  lcppsd[2] = fGeom->GetCPVBoxSize(2) / 2.0 ;
  
-  gMC->Gsvolu("LCPPSD", "BOX ", idtmed[712], lcppsd, 3) ; 
+  gMC->Gsvolu("PLCPPS", "BOX ", idtmed[712], lcppsd, 3) ; 
   
   y0 = y0 - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ; 
 
-  gMC->Gspos("LCPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; 
+  gMC->Gspos("PLCPPS", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; 
 
   // 3. Lower air gap
 
   Float_t lappsd[3] ; 
-  lappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ; 
+  lappsd[0] = fGeom->GetCPVBoxSize(0) / 2.0 ; 
   lappsd[1] = fGeom->GetLeadToMicro2Gap() / 2.0 ; 
-  lappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
+  lappsd[2] = fGeom->GetCPVBoxSize(2) / 2.0 ;
 
-  gMC->Gsvolu("LAPPSD", "BOX ", idtmed[798], lappsd, 3) ; 
+  gMC->Gsvolu("PLAPPS", "BOX ", idtmed[798], lappsd, 3) ; 
     
   y0 = y0 - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap()  / 2. ; 
   
-  gMC->Gspos("LAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; 
+  gMC->Gspos("PLAPPS", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; 
    
 }
 
 
+//____________________________________________________________________________
+void AliPHOSv0::CreateGeometryforCPV()
+{
+  // Create the PHOS-CPV geometry for GEANT
+  // Author: Yuri Kharlov 11 September 2000
+  //BEGIN_HTML
+  /*
+    <H2>
+    Geant3 geometry of PHOS-CPV in ALICE
+    </H2>
+    <table width=700>
+
+    <tr>
+         <td>CPV perspective view</td>
+         <td>CPV front view      </td>
+    </tr>
+
+    <tr>
+         <td> <img height=300 width=290 src="../images/CPVallPersp.gif"> </td>
+         <td> <img height=300 width=290 src="../images/CPVallFront.gif"> </td>
+    </tr>
+
+    <tr>
+         <td>One CPV module, perspective view                            </td>
+         <td>One CPV module, front view (extended in vertical direction) </td>
+    </tr>
+
+    <tr>
+         <td><img height=300 width=290 src="../images/CPVmodulePers.gif"></td>
+         <td><img height=300 width=290 src="../images/CPVmoduleSide.gif"></td>
+    </tr>
+
+    </table>
+
+    <H2>
+    Geant3 geometry tree of PHOS-CPV in ALICE
+    </H2>
+    <center>
+    <img height=300 width=290 src="../images/CPVtree.gif">
+    </center>
+  */
+  //END_HTML  
+
+  Float_t par[3], x,y,z;
+
+  // Get pointer to the array containing media indexes
+  Int_t *idtmed = fIdtmed->GetArray() - 699 ;
+  
+  // The box containing all CPV for one PHOS module filled with air 
+  par[0] = fGeom->GetCPVBoxSize(0) / 2.0 ;  
+  par[1] = fGeom->GetCPVBoxSize(1) / 2.0 ; 
+  par[2] = fGeom->GetCPVBoxSize(2) / 2.0 ;
+  gMC->Gsvolu("PCPV", "BOX ", idtmed[798], par, 3) ;
+  
+  y = fGeom->GetOuterBoxSize(1) / 2.0 ;
+  gMC->Gspos("PCPV", 1, "PHOS", 0.0, y, 0.0, 0, "ONLY") ; 
+  
+  // Gassiplex board
+  
+  par[0] = fGeom->GetGassiplexChipSize(0)/2.;
+  par[1] = fGeom->GetGassiplexChipSize(1)/2.;
+  par[2] = fGeom->GetGassiplexChipSize(2)/2.;
+  gMC->Gsvolu("PCPC","BOX ",idtmed[707],par,3);
+  
+  // Cu+Ni foil covers Gassiplex board
+
+  par[1] = fGeom->GetCPVCuNiFoilThickness()/2;
+  gMC->Gsvolu("PCPD","BOX ",idtmed[710],par,3);
+  y      = -(fGeom->GetGassiplexChipSize(1)/2 - par[1]);
+  gMC->Gspos("PCPD",1,"PCPC",0,y,0,0,"ONLY");
+
+  // Position of the chip inside CPV
+
+  Float_t xStep = fGeom->GetCPVActiveSize(0) / (fGeom->GetNumberOfCPVChipsPhi() + 1);
+  Float_t zStep = fGeom->GetCPVActiveSize(1) / (fGeom->GetNumberOfCPVChipsZ()   + 1);
+  Int_t   copy  = 0;
+  y = fGeom->GetCPVFrameSize(1)/2           - fGeom->GetFTPosition(0) +
+    fGeom->GetCPVTextoliteThickness() / 2 + fGeom->GetGassiplexChipSize(1) / 2 + 0.1;
+  for (Int_t ix=0; ix<fGeom->GetNumberOfCPVChipsPhi(); ix++) {
+    x = xStep * (ix+1) - fGeom->GetCPVActiveSize(0)/2;
+    for (Int_t iz=0; iz<fGeom->GetNumberOfCPVChipsZ(); iz++) {
+      copy++;
+      z = zStep * (iz+1) - fGeom->GetCPVActiveSize(1)/2;
+      gMC->Gspos("PCPC",copy,"PCPV",x,y,z,0,"ONLY");
+    }
+  }
+
+  // Foiled textolite (1 mm of textolite + 50 mkm of Cu + 6 mkm of Ni)
+  
+  par[0] = fGeom->GetCPVActiveSize(0)        / 2;
+  par[1] = fGeom->GetCPVTextoliteThickness() / 2;
+  par[2] = fGeom->GetCPVActiveSize(1)        / 2;
+  gMC->Gsvolu("PCPF","BOX ",idtmed[707],par,3);
+
+  // Argon gas volume
+
+  par[1] = (fGeom->GetFTPosition(2) - fGeom->GetFTPosition(1) - fGeom->GetCPVTextoliteThickness()) / 2;
+  gMC->Gsvolu("PCPG","BOX ",idtmed[715],par,3);
+
+  for (Int_t i=0; i<4; i++) {
+    y = fGeom->GetCPVFrameSize(1) / 2 - fGeom->GetFTPosition(i) + fGeom->GetCPVTextoliteThickness()/2;
+    gMC->Gspos("PCPF",i+1,"PCPV",0,y,0,0,"ONLY");
+    if(i==1){
+      y-= (fGeom->GetFTPosition(2) - fGeom->GetFTPosition(1)) / 2;
+      gMC->Gspos("PCPG",1,"PCPV ",0,y,0,0,"ONLY");
+    }
+  }
+
+  // Dummy sensitive plane in the middle of argone gas volume
+
+  par[1]=0.001;
+  gMC->Gsvolu("PCPQ","BOX ",idtmed[715],par,3);
+  gMC->Gspos ("PCPQ",1,"PCPG",0,0,0,0,"ONLY");
+
+  // Cu+Ni foil covers textolite
+
+  par[1] = fGeom->GetCPVCuNiFoilThickness() / 2;
+  gMC->Gsvolu("PCP1","BOX ",idtmed[710],par,3);
+  y = fGeom->GetCPVTextoliteThickness()/2 - par[1];
+  gMC->Gspos ("PCP1",1,"PCPF",0,y,0,0,"ONLY");
+
+  // Aluminum frame around CPV
+
+  par[0] = fGeom->GetCPVFrameSize(0)/2;
+  par[1] = fGeom->GetCPVFrameSize(1)/2;
+  par[2] = fGeom->GetCPVBoxSize(2)  /2;
+  gMC->Gsvolu("PCF1","BOX ",idtmed[701],par,3);
+
+  par[0] = fGeom->GetCPVBoxSize(0)/2 - fGeom->GetCPVFrameSize(0);
+  par[1] = fGeom->GetCPVFrameSize(1)/2;
+  par[2] = fGeom->GetCPVFrameSize(2)/2;
+  gMC->Gsvolu("PCF2","BOX ",idtmed[701],par,3);
+
+  for (Int_t j=0; j<=1; j++) {
+    x = TMath::Sign(1,2*j-1) * (fGeom->GetCPVBoxSize(0) - fGeom->GetCPVFrameSize(0)) / 2;
+    gMC->Gspos("PCF1",j+1,"PCPV", x,0,0,0,"ONLY");
+    z = TMath::Sign(1,2*j-1) * (fGeom->GetCPVBoxSize(2) - fGeom->GetCPVFrameSize(2)) / 2;
+    gMC->Gspos("PCF2",j+1,"PCPV",0, 0,z,0,"ONLY");
+  }
+
+}
+
+
+//____________________________________________________________________________
+void AliPHOSv0::CreateGeometryforSupport()
+{
+  // Create the PHOS' support geometry for GEANT
+    //BEGIN_HTML
+  /*
+    <H2>
+    Geant3 geometry of the PHOS's support
+    </H2>
+    <P><CENTER>
+    <IMG Align=BOTTOM ALT="EMC geant tree" SRC="../images/PHOS_support.gif"> 
+    </CENTER><P>
+  */
+  //END_HTML  
+  
+  Float_t par[5], x0,y0,z0 ; 
+  Int_t   i,j,copy;
+
+  // Get pointer to the array containing media indexes
+  Int_t *idtmed = fIdtmed->GetArray() - 699 ;
+
+  // --- Dummy box containing two rails on which PHOS support moves
+  // --- Put these rails to the bottom of the L3 magnet
+
+  par[0] =  fGeom->GetRailRoadSize(0) / 2.0 ;
+  par[1] =  fGeom->GetRailRoadSize(1) / 2.0 ;
+  par[2] =  fGeom->GetRailRoadSize(2) / 2.0 ;
+  gMC->Gsvolu("PRRD", "BOX ", idtmed[798], par, 3) ;
+
+  y0     = -(fGeom->GetRailsDistanceFromIP() - fGeom->GetRailRoadSize(1) / 2.0) ;
+  gMC->Gspos("PRRD", 1, "ALIC", 0.0, y0, 0.0, 0, "ONLY") ; 
+
+  // --- Dummy box containing one rail
+
+  par[0] =  fGeom->GetRailOuterSize(0) / 2.0 ;
+  par[1] =  fGeom->GetRailOuterSize(1) / 2.0 ;
+  par[2] =  fGeom->GetRailOuterSize(2) / 2.0 ;
+  gMC->Gsvolu("PRAI", "BOX ", idtmed[798], par, 3) ;
+
+  for (i=0; i<2; i++) {
+    x0     = (2*i-1) * fGeom->GetDistanceBetwRails()  / 2.0 ;
+    gMC->Gspos("PRAI", i, "PRRD", x0, 0.0, 0.0, 0, "ONLY") ; 
+  }
+
+  // --- Upper and bottom steel parts of the rail
+
+  par[0] =  fGeom->GetRailPart1(0) / 2.0 ;
+  par[1] =  fGeom->GetRailPart1(1) / 2.0 ;
+  par[2] =  fGeom->GetRailPart1(2) / 2.0 ;
+  gMC->Gsvolu("PRP1", "BOX ", idtmed[716], par, 3) ;
+
+  y0     = - (fGeom->GetRailOuterSize(1) - fGeom->GetRailPart1(1))  / 2.0 ;
+  gMC->Gspos("PRP1", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ;
+  y0     =   (fGeom->GetRailOuterSize(1) - fGeom->GetRailPart1(1))  / 2.0 - fGeom->GetRailPart3(1);
+  gMC->Gspos("PRP1", 2, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ;
+
+  // --- The middle vertical steel parts of the rail
+
+  par[0] =  fGeom->GetRailPart2(0) / 2.0 ;
+  par[1] =  fGeom->GetRailPart2(1) / 2.0 ;
+  par[2] =  fGeom->GetRailPart2(2) / 2.0 ;
+  gMC->Gsvolu("PRP2", "BOX ", idtmed[716], par, 3) ;
+
+  y0     =   - fGeom->GetRailPart3(1) / 2.0 ;
+  gMC->Gspos("PRP2", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ; 
+
+  // --- The most upper steel parts of the rail
+
+  par[0] =  fGeom->GetRailPart3(0) / 2.0 ;
+  par[1] =  fGeom->GetRailPart3(1) / 2.0 ;
+  par[2] =  fGeom->GetRailPart3(2) / 2.0 ;
+  gMC->Gsvolu("PRP3", "BOX ", idtmed[716], par, 3) ;
+
+  y0     =   (fGeom->GetRailOuterSize(1) - fGeom->GetRailPart3(1))  / 2.0 ;
+  gMC->Gspos("PRP3", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ; 
+
+  // --- The wall of the cradle
+  // --- The wall is empty: steel thin walls and air inside
+
+  par[1] =  TMath::Sqrt(
+                       TMath::Power((fGeom->GetIPtoOuterCoverDistance() + fGeom->GetOuterBoxSize(1)),2) +
+                       TMath::Power((fGeom->GetOuterBoxSize(0)/2),2)) + 10.;
+  par[0] =  par[1] - fGeom->GetCradleWall(1) ;
+  par[2] =  fGeom->GetCradleWall(2) / 2.0 ;
+  par[3] =  fGeom->GetCradleWall(3) ;
+  par[4] =  fGeom->GetCradleWall(4) ;
+  gMC->Gsvolu("PCRA", "TUBS", idtmed[716], par, 5) ;
+
+  par[0] -=  fGeom->GetCradleWallThickness() ;
+  par[1] -=  fGeom->GetCradleWallThickness() ;
+  par[2] -=  fGeom->GetCradleWallThickness() ;
+  gMC->Gsvolu("PCRE", "TUBS", idtmed[798], par, 5) ;
+  gMC->Gspos ("PCRE", 1, "PCRA", 0.0, 0.0, 0.0, 0, "ONLY") ; 
+
+  for (i=0; i<2; i++) {
+    z0 = (2*i-1) * (fGeom->GetOuterBoxSize(2) + fGeom->GetCradleWall(2)) / 2.0 ;
+    gMC->Gspos("PCRA", i, "ALIC", 0.0, 0.0, z0, 0, "ONLY") ; 
+  }
+
+  // --- The "wheels" of the cradle
+  
+  par[0] = fGeom->GetCradleWheel(0) / 2;
+  par[1] = fGeom->GetCradleWheel(1) / 2;
+  par[2] = fGeom->GetCradleWheel(2) / 2;
+  gMC->Gsvolu("PWHE", "BOX ", idtmed[716], par, 3) ;
+
+  y0 = -(fGeom->GetRailsDistanceFromIP() - fGeom->GetRailRoadSize(1) -
+        fGeom->GetCradleWheel(1)/2) ;
+  for (i=0; i<2; i++) {
+    z0 = (2*i-1) * ((fGeom->GetOuterBoxSize(2) + fGeom->GetCradleWheel(2)) / 2.0 +
+                    fGeom->GetCradleWall(2));
+    for (j=0; j<2; j++) {
+      copy = 2*i + j;
+      x0 = (2*j-1) * fGeom->GetDistanceBetwRails()  / 2.0 ;
+      gMC->Gspos("PWHE", copy, "ALIC", x0, y0, z0, 0, "ONLY") ; 
+    }
+  }
+
+}
+
+//____________________________________________________________________________
+Float_t AliPHOSv0::ZMin(void) const
+{
+  // Overall dimension of the PHOS (min)
+  // Take it twice more than the PHOS module size
+  return -fGeom->GetOuterBoxSize(2);
+}
+
+//____________________________________________________________________________
+Float_t AliPHOSv0::ZMax(void) const
+{
+  // Overall dimension of the PHOS (max)
+  // Take it twice more than the PHOS module size
+  return  fGeom->GetOuterBoxSize(2);
+}
+
 //____________________________________________________________________________
 void AliPHOSv0::Init(void)
 {
@@ -1009,6 +1476,11 @@ void AliPHOSv0::Init(void)
 
   // Here the PHOS initialisation code (if any!)
 
+  if (fGeom!=0)  
+    cout << "AliPHOS" << Version() << " : PHOS geometry intialized for " << fGeom->GetName() << endl ;
+  else
+    cout << "AliPHOS" << Version() << " : PHOS geometry initialization failed !" << endl ;   
+  
   for(i=0;i<80;i++) printf("*");
   printf("\n");