]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
First attempt to use systemtically TFolders: the geometry object posts itself to...
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 13 Jun 2001 20:43:56 +0000 (20:43 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 13 Jun 2001 20:43:56 +0000 (20:43 +0000)
13 files changed:
PHOS/AliPHOS.cxx
PHOS/AliPHOS.h
PHOS/AliPHOSDebug.cxx
PHOS/AliPHOSGeometry.cxx
PHOS/AliPHOSv0.cxx
PHOS/AliPHOSv0.h
PHOS/AliPHOSv1.cxx
PHOS/AliPHOSv3.cxx
PHOS/AliPHOSv4.cxx
PHOS/AliPHOSv4.h
PHOS/AliPHOSvFast.cxx
PHOS/AliPHOSvFast.h
PHOS/AliPHOSvImpacts.cxx

index 3cb4fc2e3fd41f6a3b905b61c349ef42b6897dcd..6e09cddf14f8abf0f997a2d102b30c4b54d542c8 100644 (file)
@@ -52,12 +52,14 @@ AliPHOS:: AliPHOS() : AliDetector()
   fName="PHOS";
   CreatePHOSFolders();
 }
+
 //____________________________________________________________________________
-AliPHOS:: AliPHOS(const char* name, const char* title): AliDetector(name, title) 
+AliPHOS::AliPHOS(const char* name, const char* title): AliDetector(name, title) 
 {
   // Create folder and task hierarchy
   CreatePHOSFolders();
 }
+
 //____________________________________________________________________________
 void AliPHOS::CreatePHOSFolders()
 {
@@ -75,6 +77,9 @@ void AliPHOS::CreatePHOSFolders()
   TFolder * aliceF  = alice->AddFolder("folders", "Alice memory Folder") ; 
   //  make it the owner of the objects that it contains
   aliceF->SetOwner() ;
+  // geometry folder 
+  TFolder * geomF = aliceF->AddFolder("Geometry", "Geometry objects") ; 
+  // alarms folder
   TFolder * alarmsF = aliceF->AddFolder("QAAlarms", "Alarms raised by QA check") ; 
   //  make it the owner of the objects that it contains
   alarmsF->SetOwner() ;
@@ -93,22 +98,24 @@ void AliPHOS::CreatePHOSFolders()
 
   char * tempo = new char[80] ; 
 
-  // creates the PHOSQA and adds it to alice main QA task
+  // creates the PHOSQA (QAChecker knows how to add itself in the tasks list)
   sprintf(tempo, "%sCheckers container",GetName() ) ; 
-  fQATask = new AliPHOSQAChecker(GetName(), tempo); 
-  aliceQA->Add(fQATask) ; 
+  fQATask = new AliPHOSQAChecker(GetName(), tempo);  
 
   // creates the PHOS(S)Digitizer and adds it to alice main (S)Digitizer task 
   sprintf(tempo, "%sDigitizers container",GetName() ) ; 
-  fSDTask = new AliPHOSQAChecker(GetName(), tempo);   
+  fSDTask = new TTask(GetName(), tempo);   
   aliceDi->Add(fSDTask) ; 
+
   // creates the PHOS reconstructioner and adds it to alice main Reconstructioner task 
   sprintf(tempo, "%sReconstructioner container",GetName() ) ; 
-  fReTask = new AliPHOSQAChecker(GetName(), tempo); 
+  fReTask = new TTask(GetName(), tempo); 
   aliceRe->Add(fReTask) ; 
 
   delete tempo ;  
 
+  // creates the PHOS geometry  folder
+  geomF->AddFolder("PHOS", "Geometry for PHOS") ; 
   // creates the PHOSQA alarm folder
   alarmsF->AddFolder("PHOS", "QA alarms from PHOS") ; 
 }
@@ -387,6 +394,22 @@ void AliPHOS::CreateMaterials()
   gMC->Gstpar(idtmed[715], "STRA",2.) ;
 
 }
+//____________________________________________________________________________
+AliPHOSGeometry * AliPHOS::GetGeometry() const 
+{  
+  // gets the pointer to the AliPHOSGeometry unique instance from the folder
+  
+  AliPHOSGeometry * rv ; 
+  
+  TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
+  TString path("folders/Geometry/PHOS/") ; 
+  path += GetTitle() ; 
+  rv = (AliPHOSGeometry*)alice->FindObject(path) ; 
+  if ( !rv )
+    rv = fGeom ; 
+  return rv ; 
+}
+
 //____________________________________________________________________________
 void AliPHOS::SetTreeAddress()
 { 
index bd92cb58fa7d87abe74070930d93c90c1c9e986a..d8a92485c447fcf919ec1a75ab29d3e5306c95ff 100644 (file)
@@ -15,6 +15,7 @@
 
 class TString ; 
 class TTask ;
+class TFolder ;
 
 // --- AliRoot header files ---
 
@@ -41,8 +42,8 @@ class AliPHOS : public AliDetector {
   virtual void   AddHit( Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits ) = 0 ;   
   virtual void   CreateMaterials() ;                     
   void CreatePHOSFolders();
-  virtual  AliPHOSGeometry * GetGeometry() const = 0 ;
-  Int_t   IsVersion(void) const { return -1 ; } 
+  virtual  AliPHOSGeometry * GetGeometry() const ;
+  virtual Int_t   IsVersion(void) const = 0 ;  
   AliPHOSQAChecker * QAChecker() {return fQATask;}  
   virtual void    SetTreeAddress();                
   virtual TString Version() {return TString(" ") ; } 
@@ -56,9 +57,11 @@ class AliPHOS : public AliDetector {
  
 protected:
   
-  AliPHOSQAChecker * fQATask ; // PHOS checkers container
-  TTask * fSDTask ; // PHOS (S)Digitizer container
-  TTask * fReTask ; // PHOS Reconstructioner container
+  TFolder * fFGeom ;        //! Folder that holds the Geometry definition
+  AliPHOSGeometry * fGeom ; // Geometry definition
+  AliPHOSQAChecker * fQATask ; //! PHOS checkers container
+  TTask * fSDTask ; //! PHOS (S)Digitizer container
+  TTask * fReTask ; //! PHOS Reconstructioner container
 
   ClassDef(AliPHOS,2) // Photon Spectrometer Detector (base class)
 
index a2019ae54410f604c706bedbe4cb2ed4d9371e46..8f7ac77b6b8875b2cfdb34f37946b1b982ddae31 100644 (file)
@@ -124,10 +124,10 @@ AliPHOSv1::AliPHOSv1(AliPHOSReconstructioner * Reconstructioner, const char *nam
   fIshunt     =  1 ; // All hits are associated with primary particles
  
   // gets an instance of the geometry parameters class  
-  fGeom =  AliPHOSGeometry::GetInstance(title, "") ; 
+  AliPHOSGeometry::GetInstance(title, "") ; 
 
-  if (fGeom->IsInitialized() ) 
-    cout << "AliPHOS" << Version() << " : PHOS geometry intialized for " << fGeom->GetName() << endl ;
+  if (GetGeometry()->IsInitialized() ) 
+    cout << "AliPHOS" << Version() << " : PHOS geometry intialized for " << GetGeometry()->GetName() << endl ;
   else
     cout << "AliPHOS" << Version() << " : PHOS geometry initialization failed !" << endl ;   
 
@@ -296,7 +296,7 @@ void AliPHOSv1::SDigits2Digits()
   Int_t idCurSDigit = ((AliPHOSDigit *)fSDigits->At(0))->GetId() ;
 
   Int_t absID ;
-  for(absID = 1; absID < fGeom->GetNModules()*fGeom->GetNPhi()*fGeom->GetNZ(); absID++){
+  for(absID = 1; absID < GetGeometry()->GetNModules()*GetGeometry()->GetNPhi()*GetGeometry()->GetNZ(); absID++){
     Float_t noise = gRandom->Gaus(0., fPinElectronicNoise) ; 
     if(absID < idCurSDigit ){ 
       if(noise >fDigitThreshold ){
@@ -331,8 +331,8 @@ void AliPHOSv1::SDigits2Digits()
     Float_t ene = Calibrate(digit->GetAmp()) ;
     
     Int_t relid[4] ; 
-    fGeom->AbsToRelNumbering(digit->GetId(), relid) ; 
-    if ( relid[0] > fGeom->GetNCPVModules() ){ //ppsd
+    GetGeometry()->AbsToRelNumbering(digit->GetId(), relid) ; 
+    if ( relid[0] > GetGeometry()->GetNCPVModules() ){ //ppsd
       if ( ( (relid[1] > 0) && (ene > fPpsdEnergyThreshold)) ||    //PPSD digit
           ( (relid[1] < 0) && (ene > fCpvEnergyThreshold ) ) )    //CPV digit 
        new((*fDigits)[fNdigits]) AliPHOSDigit( *digit ) ;
@@ -514,7 +514,7 @@ void AliPHOSv1::StepManager(void)
 
   Int_t tracknumber =  gAlice->CurrentTrack() ; 
   Int_t primary     =  gAlice->GetPrimary( gAlice->CurrentTrack() ); 
-  TString name      =  fGeom->GetName() ; 
+  TString name      =  GetGeometry()->GetName() ; 
   Int_t trackpid    =  0  ; 
 
   if( gMC->IsTrackEntering() ){ // create hit with position and momentum of new particle, 
@@ -559,17 +559,17 @@ void AliPHOSv1::StepManager(void)
       if ( (xyze[3] != 0) || entered ) { // there is deposited energy or new particle entering  PPSD
                gMC->CurrentVolOffID(5, relid[0]) ;  // get the PHOS Module number
        if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(5),"PHO1") == 0 ){
-         relid[0] += fGeom->GetNModules() - fGeom->GetNPPSDModules();
+         relid[0] += GetGeometry()->GetNModules() - GetGeometry()->GetNPPSDModules();
        }
                gMC->CurrentVolOffID(3, relid[1]) ;  // get the Micromegas Module number 
-      // 1-> fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper
-      //   > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower
+      // 1-> GetGeometry()->GetNumberOfModulesPhi() * GetGeometry()->GetNumberOfModulesZ() upper
+      //   > GetGeometry()->GetNumberOfModulesPhi() * GetGeometry()->GetNumberOfModulesZ() lower
                gMC->CurrentVolOffID(1, relid[2]) ;  // get the row number of the cell
         gMC->CurrentVolID(relid[3]) ;        // get the column number 
 
        // get the absolute Id number
 
-               fGeom->RelToAbsNumbering(relid, absid) ; 
+               GetGeometry()->RelToAbsNumbering(relid, absid) ; 
 
        // add current hit to the hit list      
          AddHit(fIshunt, primary, tracknumber, absid, xyze, trackpid, pmom, xyd);
@@ -635,7 +635,7 @@ void AliPHOSv1::StepManager(void)
        relid[3] = cpvDigit->GetYpad() ;                          // row    number of a pad
        
        // get the absolute Id number
-       fGeom->RelToAbsNumbering(relid, absid) ; 
+       GetGeometry()->RelToAbsNumbering(relid, absid) ; 
 
        // add current digit to the temporary hit list
        xyze[0] = 0. ;
@@ -669,14 +669,14 @@ void AliPHOSv1::StepManager(void)
       gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
 
       if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(10),"PHO1") == 0 )
-       relid[0] += fGeom->GetNModules() - fGeom->GetNPPSDModules();      
+       relid[0] += GetGeometry()->GetNModules() - GetGeometry()->GetNPPSDModules();      
 
       relid[1] = 0   ;                    // means PBW04
       gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
       gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
       
       // get the absolute Id number
-      fGeom->RelToAbsNumbering(relid, absid) ; 
+      GetGeometry()->RelToAbsNumbering(relid, absid) ; 
 
       // add current hit to the hit list
        AddHit(fIshunt, primary,tracknumber, absid, xyze, trackpid,pmom, xyd);
@@ -701,7 +701,7 @@ void AliPHOSv1::CPVDigitize (TLorentzVector p, Float_t *zxhit, Int_t moduleNumbe
   // 2 October 2000
   // ------------------------------------------------------------------------
 
-  const Float_t kCelWr  = fGeom->GetPadSizePhi()/2;  // Distance between wires (2 wires above 1 pad)
+  const Float_t kCelWr  = GetGeometry()->GetPadSizePhi()/2;  // Distance between wires (2 wires above 1 pad)
   const Float_t kDetR   = 0.1;     // Relative energy fluctuation in track for 100 e-
   const Float_t kdEdx   = 4.0;     // Average energy loss in CPV;
   const Int_t   kNgamz  = 5;       // Ionization size in Z
@@ -724,13 +724,13 @@ void AliPHOSv1::CPVDigitize (TLorentzVector p, Float_t *zxhit, Int_t moduleNumbe
 
 //    cout << "CPVDigitize: YVK : "<<hitX<<" "<<hitZ<<" | "<<pX<<" "<<pZ<<" "<<pNorm<<endl;
 
-  Float_t dZY   = pZ/pNorm * fGeom->GetCPVGasThickness();
-  Float_t dXY   = pX/pNorm * fGeom->GetCPVGasThickness();
+  Float_t dZY   = pZ/pNorm * GetGeometry()->GetCPVGasThickness();
+  Float_t dXY   = pX/pNorm * GetGeometry()->GetCPVGasThickness();
   gRandom->Rannor(rnor1,rnor2);
   eloss *= (1 + kDetR*rnor1) *
-           TMath::Sqrt((1 + ( pow(dZY,2) + pow(dXY,2) ) / pow(fGeom->GetCPVGasThickness(),2)));
-  Float_t zhit1 = hitZ + fGeom->GetCPVActiveSize(1)/2 - dZY/2;
-  Float_t xhit1 = hitX + fGeom->GetCPVActiveSize(0)/2 - dXY/2;
+           TMath::Sqrt((1 + ( pow(dZY,2) + pow(dXY,2) ) / pow(GetGeometry()->GetCPVGasThickness(),2)));
+  Float_t zhit1 = hitZ + GetGeometry()->GetCPVActiveSize(1)/2 - dZY/2;
+  Float_t xhit1 = hitX + GetGeometry()->GetCPVActiveSize(0)/2 - dXY/2;
   Float_t zhit2 = zhit1 + dZY;
   Float_t xhit2 = xhit1 + dXY;
 
@@ -790,8 +790,8 @@ void AliPHOSv1::CPVDigitize (TLorentzVector p, Float_t *zxhit, Int_t moduleNumbe
 
   // Finite size of ionization region
 
-  Int_t nCellZ  = fGeom->GetNumberOfCPVPadsZ();
-  Int_t nCellX  = fGeom->GetNumberOfCPVPadsPhi();
+  Int_t nCellZ  = GetGeometry()->GetNumberOfCPVPadsZ();
+  Int_t nCellX  = GetGeometry()->GetNumberOfCPVPadsPhi();
   Int_t nz3     = (kNgamz+1)/2;
   Int_t nx3     = (kNgamx+1)/2;
   cpvDigits->Expand(nIter*kNgamx*kNgamz);
@@ -802,8 +802,8 @@ void AliPHOSv1::CPVDigitize (TLorentzVector p, Float_t *zxhit, Int_t moduleNumbe
     Float_t zhit = zxe[0][iter];
     Float_t xhit = zxe[1][iter];
     Float_t qhit = zxe[2][iter];
-    Float_t zcell = zhit / fGeom->GetPadSizeZ();
-    Float_t xcell = xhit / fGeom->GetPadSizePhi();
+    Float_t zcell = zhit / GetGeometry()->GetPadSizeZ();
+    Float_t xcell = xhit / GetGeometry()->GetPadSizePhi();
     if ( zcell<=0      || xcell<=0 ||
         zcell>=nCellZ || xcell>=nCellX) return;
     Int_t izcell = (Int_t) zcell;
@@ -840,10 +840,10 @@ Float_t AliPHOSv1::CPVPadResponseFunction(Float_t qhit, Float_t zhit, Float_t xh
   // 3 October 2000
   // ------------------------------------------------------------------------
 
-  Double_t dz = fGeom->GetPadSizeZ()   / 2;
-  Double_t dx = fGeom->GetPadSizePhi() / 2;
-  Double_t z  = zhit * fGeom->GetPadSizeZ();
-  Double_t x  = xhit * fGeom->GetPadSizePhi();
+  Double_t dz = GetGeometry()->GetPadSizeZ()   / 2;
+  Double_t dx = GetGeometry()->GetPadSizePhi() / 2;
+  Double_t z  = zhit * GetGeometry()->GetPadSizeZ();
+  Double_t x  = xhit * GetGeometry()->GetPadSizePhi();
   Double_t amplitude = qhit *
     (CPVCumulPadResponse(z+dz,x+dx) - CPVCumulPadResponse(z+dz,x-dx) -
      CPVCumulPadResponse(z-dz,x+dx) + CPVCumulPadResponse(z-dz,x-dx));
index ff4fb6f3eae35df23c5dbac56205102995bf8424..35fd78b18338f836f2aca6d68da03ea69cb4a89f 100644 (file)
@@ -30,6 +30,8 @@
 
 #include "TVector3.h"
 #include "TRotation.h" 
+#include "TFolder.h" 
+#include "TROOT.h" 
 
 // --- Standard library ---
 
@@ -101,6 +103,14 @@ void AliPHOSGeometry::Init(void)
 
     this->SetPHOSAngles() ; 
     fRotMatrixArray = new TObjArray(fNModules) ; 
+
+    // post the geometry into the appropriate folder
+    //  get the alice folder
+    TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
+    //  the folder that contains the alarms for PHOS   
+    TFolder * folder = (TFolder*)alice->FindObject("folders/Geometry/PHOS");   
+    folder->SetOwner() ;
+    folder->Add(this) ; 
   }
   else {
     fgInit = kFALSE ; 
index 51f86b5cf142eafe1bf4f71fb74d9e03675b5bca..efd9dd5a3a2fbfd83d8d8ea0a56c1f5cbc4f5b17 100644 (file)
@@ -31,6 +31,8 @@
 #include "TNode.h"
 #include "TRandom.h"
 #include "TGeometry.h"
+#include "TFolder.h"
+#include "TROOT.h"
 
 
 // --- Standard library ---
@@ -59,10 +61,11 @@ AliPHOSv0::AliPHOSv0(const char *name, const char *title):
   //        IHEP = 5 modules (EMC + CPV)
   //        MIXT = 4 modules (EMC + CPV) and 1 module (EMC + PPSD)
  
-  // gets an instance of the geometry parameters class  
+  // create the geometry parameters object  
+  // it will posted to a folder
 
   if (strcmp(GetTitle(),"") != 0 ) 
-    fGeom =  AliPHOSGeometry::GetInstance(GetTitle(), "") ; 
+    fGeom = AliPHOSGeometry::GetInstance(GetTitle(), "") ; 
 
 }
 
@@ -99,19 +102,21 @@ void AliPHOSv0::BuildGeometry()
     </UL>
   */
   //END_HTML  
+  
+  AliPHOSGeometry * geom = GetGeometry() ; 
 
   this->BuildGeometryforPHOS() ; 
-  if      (strcmp(fGeom->GetName(),"GPS2") == 0)
+  if      (strcmp(geom->GetName(),"GPS2") == 0)
     this->BuildGeometryforPPSD() ;
-  else if (strcmp(fGeom->GetName(),"IHEP") == 0)
+  else if (strcmp(geom->GetName(),"IHEP") == 0)
     this->BuildGeometryforCPV() ;
-  else if (strcmp(fGeom->GetName(),"MIXT") == 0) {
+  else if (strcmp(geom->GetName(),"MIXT") == 0) {
     this->BuildGeometryforPPSD() ;
     this->BuildGeometryforCPV() ;
   }
   else
     cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed: "
-        << "Geometry name = " << fGeom->GetName() << endl; 
+        << "Geometry name = " << geom->GetName() << endl; 
 
 }
 
@@ -124,55 +129,57 @@ void AliPHOSv0:: BuildGeometryforPHOS(void)
   const Int_t kColorXTAL = kBlue ;
 
   Double_t const kRADDEG = 180.0 / kPI ;
-  new TBRIK( "OuterBox", "PHOS box", "void", fGeom->GetOuterBoxSize(0)/2, 
-                                             fGeom->GetOuterBoxSize(1)/2, 
-                                             fGeom->GetOuterBoxSize(2)/2 );
+
+  AliPHOSGeometry * geom = GetGeometry() ; 
+
+  new TBRIK( "OuterBox", "PHOS box", "void", geom->GetOuterBoxSize(0)/2, 
+                                             geom->GetOuterBoxSize(1)/2, 
+                                             geom->GetOuterBoxSize(2)/2 );
 
   // Textolit Wall box, position inside PHOS 
   
-  new TBRIK( "TextolitBox", "PHOS Textolit box ", "void", fGeom->GetTextolitBoxSize(0)/2, 
-                                                          fGeom->GetTextolitBoxSize(1)/2, 
-                                                          fGeom->GetTextolitBoxSize(2)/2);
+  new TBRIK( "TextolitBox", "PHOS Textolit box ", "void", geom->GetTextolitBoxSize(0)/2, 
+                                                          geom->GetTextolitBoxSize(1)/2, 
+                                                          geom->GetTextolitBoxSize(2)/2);
 
   // Polystyrene Foam Plate
 
-  new TBRIK( "UpperFoamPlate", "PHOS Upper foam plate", "void", fGeom->GetTextolitBoxSize(0)/2, 
-                                                                fGeom->GetSecondUpperPlateThickness()/2, 
-                                                                fGeom->GetTextolitBoxSize(2)/2 ) ; 
+  new TBRIK( "UpperFoamPlate", "PHOS Upper foam plate", "void", geom->GetTextolitBoxSize(0)/2, 
+                                                                geom->GetSecondUpperPlateThickness()/2, 
+                                                                geom->GetTextolitBoxSize(2)/2 ) ; 
 
   // Air Filled Box
  
-  new TBRIK( "AirFilledBox", "PHOS air filled box", "void", fGeom->GetAirFilledBoxSize(0)/2, 
-                                                            fGeom->GetAirFilledBoxSize(1)/2, 
-                                                            fGeom->GetAirFilledBoxSize(2)/2 );
+  new TBRIK( "AirFilledBox", "PHOS air filled box", "void", geom->GetAirFilledBoxSize(0)/2, 
+                                                            geom->GetAirFilledBoxSize(1)/2, 
+                                                            geom->GetAirFilledBoxSize(2)/2 );
 
   // Crystals Box
 
-  Float_t xtlX = fGeom->GetCrystalSize(0) ; 
-  Float_t xtlY = fGeom->GetCrystalSize(1) ; 
-  Float_t xtlZ = fGeom->GetCrystalSize(2) ; 
+  Float_t xtlX = geom->GetCrystalSize(0) ; 
+  Float_t xtlY = geom->GetCrystalSize(1) ; 
+  Float_t xtlZ = geom->GetCrystalSize(2) ; 
 
-  Float_t xl =  fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
-  Float_t yl =  ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 
-             + fGeom->GetModuleBoxThickness() / 2.0 ;
-  Float_t zl =  fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 +  fGeom->GetModuleBoxThickness() ;
+  Float_t xl =  geom->GetNPhi() * ( xtlX + 2 * geom->GetGapBetweenCrystals() ) / 2.0 + geom->GetModuleBoxThickness() ;
+  Float_t yl =  ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() + geom->GetCrystalHolderThickness() ) / 2.0 
+             + geom->GetModuleBoxThickness() / 2.0 ;
+  Float_t zl =  geom->GetNZ() * ( xtlZ + 2 * geom->GetGapBetweenCrystals() ) / 2.0 +  geom->GetModuleBoxThickness() ;
   
   new TBRIK( "CrystalsBox", "PHOS crystals box", "void", xl, yl, zl ) ;
 
 // position PHOS into ALICE
 
-  Float_t r = fGeom->GetIPtoOuterCoverDistance() + fGeom->GetOuterBoxSize(1) / 2.0 ;
+  Float_t r = geom->GetIPtoOuterCoverDistance() + geom->GetOuterBoxSize(1) / 2.0 ;
   Int_t number = 988 ; 
-  Float_t pphi =  TMath::ATan( fGeom->GetOuterBoxSize(0)  / ( 2.0 * fGeom->GetIPtoOuterCoverDistance() ) ) ;
+  Float_t pphi =  TMath::ATan( geom->GetOuterBoxSize(0)  / ( 2.0 * geom->GetIPtoOuterCoverDistance() ) ) ;
   pphi *= kRADDEG ;
   TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
  
   char * nodename = new char[20] ;  
   char * rotname  = new char[20] ; 
 
-  for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { 
-   Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ;
+  for( Int_t i = 1; i <= geom->GetNModules(); i++ ) { 
+   Float_t angle = pphi * 2 * ( i - geom->GetNModules() / 2.0 - 0.5 ) ;
    sprintf(rotname, "%s%d", "rot", number++) ;
    new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
    top->cd();
@@ -184,7 +191,7 @@ void AliPHOSv0:: BuildGeometryforPHOS(void)
    fNodes->Add(outerboxnode) ;
    outerboxnode->cd() ; 
    // now inside the outer box the textolit box
-   y = ( fGeom->GetOuterBoxThickness(1) -  fGeom->GetUpperPlateThickness() ) / 2.  ;
+   y = ( geom->GetOuterBoxThickness(1) -  geom->GetUpperPlateThickness() ) / 2.  ;
    sprintf(nodename,"%s%d", "TexBox", i) ;  
    TNode * textolitboxnode = new TNode(nodename, nodename, "TextolitBox", 0, y, 0) ; 
    textolitboxnode->SetLineColor(kColorPHOS) ;
@@ -192,21 +199,21 @@ void AliPHOSv0:: BuildGeometryforPHOS(void)
    // upper foam plate inside outre box
    outerboxnode->cd() ; 
    sprintf(nodename, "%s%d", "UFPlate", i) ;
-   y =  ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
+   y =  ( geom->GetTextolitBoxSize(1) - geom->GetSecondUpperPlateThickness() ) / 2.0 ;
    TNode * upperfoamplatenode = new TNode(nodename, nodename, "UpperFoamPlate", 0, y, 0) ; 
    upperfoamplatenode->SetLineColor(kColorPHOS) ;
    fNodes->Add(upperfoamplatenode) ;  
    // air filled box inside textolit box (not drawn)
    textolitboxnode->cd();
-   y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 -  fGeom->GetSecondUpperPlateThickness() ;
+   y = ( geom->GetTextolitBoxSize(1) - geom->GetAirFilledBoxSize(1) ) / 2.0 -  geom->GetSecondUpperPlateThickness() ;
    sprintf(nodename, "%s%d", "AFBox", i) ;
    TNode * airfilledboxnode = new TNode(nodename, nodename, "AirFilledBox", 0, y, 0) ; 
    fNodes->Add(airfilledboxnode) ; 
    // crystals box inside air filled box
    airfilledboxnode->cd() ; 
-   y = fGeom->GetAirFilledBoxSize(1) / 2.0 - yl 
-       - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness() 
-       -  fGeom->GetUpperPlateThickness() -  fGeom->GetSecondUpperPlateThickness() ) ; 
+   y = geom->GetAirFilledBoxSize(1) / 2.0 - yl 
+       - ( geom->GetIPtoCrystalSurface() - geom->GetIPtoOuterCoverDistance() - geom->GetModuleBoxThickness() 
+       -  geom->GetUpperPlateThickness() -  geom->GetSecondUpperPlateThickness() ) ; 
    sprintf(nodename, "%s%d", "XTBox", i) ; 
    TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, y, 0) ;    
    crystalsboxnode->SetLineColor(kColorXTAL) ; 
@@ -247,85 +254,87 @@ void AliPHOSv0:: BuildGeometryforPPSD(void)
   const Int_t kColorGas  = kBlue ;  
   const Int_t kColorAir  = kYellow ; 
 
+  AliPHOSGeometry * geom = GetGeometry() ; 
+
   // Box for a full PHOS module
 
-  new TBRIK( "PPSDBox", "PPSD box", "void",  fGeom->GetCPVBoxSize(0)/2, 
-                                             fGeom->GetCPVBoxSize(1)/2, 
-                                            fGeom->GetCPVBoxSize(2)/2 );
+  new TBRIK( "PPSDBox", "PPSD box", "void",  geom->GetCPVBoxSize(0)/2, 
+                                             geom->GetCPVBoxSize(1)/2, 
+                                            geom->GetCPVBoxSize(2)/2 );
 
   // Box containing one micromegas module 
 
-  new TBRIK( "PPSDModule", "PPSD module", "void",  fGeom->GetPPSDModuleSize(0)/2, 
-                                                   fGeom->GetPPSDModuleSize(1)/2, 
-                                                  fGeom->GetPPSDModuleSize(2)/2 );
+  new TBRIK( "PPSDModule", "PPSD module", "void",  geom->GetPPSDModuleSize(0)/2, 
+                                                   geom->GetPPSDModuleSize(1)/2, 
+                                                  geom->GetPPSDModuleSize(2)/2 );
  // top lid
 
-  new TBRIK ( "TopLid", "Micromegas top lid", "void",  fGeom->GetPPSDModuleSize(0)/2,
-                                                       fGeom->GetLidThickness()/2,
-                                                       fGeom->GetPPSDModuleSize(2)/2 ) ; 
+  new TBRIK ( "TopLid", "Micromegas top lid", "void",  geom->GetPPSDModuleSize(0)/2,
+                                                       geom->GetLidThickness()/2,
+                                                       geom->GetPPSDModuleSize(2)/2 ) ; 
  // composite panel (top and bottom)
 
-  new TBRIK ( "TopPanel", "Composite top panel", "void",  ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
-                                                            fGeom->GetCompositeThickness()/2,
-                                                          ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;  
+  new TBRIK ( "TopPanel", "Composite top panel", "void",  ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() )/2,
+                                                            geom->GetCompositeThickness()/2,
+                                                          ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() )/2 ) ;  
   
-  new TBRIK ( "BottomPanel", "Composite bottom panel", "void",  ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
-                                                                  fGeom->GetCompositeThickness()/2,
-                                                                ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ; 
+  new TBRIK ( "BottomPanel", "Composite bottom panel", "void",  ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() )/2,
+                                                                  geom->GetCompositeThickness()/2,
+                                                                ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() )/2 ) ; 
  // gas gap (conversion and avalanche)
 
-  new TBRIK ( "GasGap", "gas gap", "void",  ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
-                                           ( fGeom->GetConversionGap() +  fGeom->GetAvalancheGap() )/2,
-                                            ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ; 
+  new TBRIK ( "GasGap", "gas gap", "void",  ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() )/2,
+                                           ( geom->GetConversionGap() +  geom->GetAvalancheGap() )/2,
+                                            ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() )/2 ) ; 
 
  // anode and cathode 
 
-  new TBRIK ( "Anode", "Anode", "void",  ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
-                                           fGeom->GetAnodeThickness()/2,
-                                         ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ; 
+  new TBRIK ( "Anode", "Anode", "void",  ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() )/2,
+                                           geom->GetAnodeThickness()/2,
+                                         ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() )/2 ) ; 
 
-  new TBRIK ( "Cathode", "Cathode", "void",  ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
-                                               fGeom->GetCathodeThickness()/2,
-                                             ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ; 
+  new TBRIK ( "Cathode", "Cathode", "void",  ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() )/2,
+                                               geom->GetCathodeThickness()/2,
+                                             ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() )/2 ) ; 
  // PC  
 
-  new TBRIK ( "PCBoard", "Printed Circuit", "void",  ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
-                                                       fGeom->GetPCThickness()/2,
-                                                     ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ; 
+  new TBRIK ( "PCBoard", "Printed Circuit", "void",  ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() )/2,
+                                                       geom->GetPCThickness()/2,
+                                                     ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() )/2 ) ; 
  // Gap between Lead and top micromegas
 
-  new TBRIK ( "LeadToM", "Air Gap top", "void", fGeom->GetCPVBoxSize(0)/2,
-                                                fGeom->GetMicro1ToLeadGap()/2,
-                                                fGeom->GetCPVBoxSize(2)/2  ) ;  
+  new TBRIK ( "LeadToM", "Air Gap top", "void", geom->GetCPVBoxSize(0)/2,
+                                                geom->GetMicro1ToLeadGap()/2,
+                                                geom->GetCPVBoxSize(2)/2  ) ;  
  
 // Gap between Lead and bottom micromegas
 
-  new TBRIK ( "MToLead", "Air Gap bottom", "void", fGeom->GetCPVBoxSize(0)/2,
-                                                   fGeom->GetLeadToMicro2Gap()/2,
-                                                   fGeom->GetCPVBoxSize(2)/2  ) ; 
+  new TBRIK ( "MToLead", "Air Gap bottom", "void", geom->GetCPVBoxSize(0)/2,
+                                                   geom->GetLeadToMicro2Gap()/2,
+                                                   geom->GetCPVBoxSize(2)/2  ) ; 
  // Lead converter
    
-  new TBRIK ( "Lead", "Lead converter", "void", fGeom->GetCPVBoxSize(0)/2,
-                                                fGeom->GetLeadConverterThickness()/2,
-                                                fGeom->GetCPVBoxSize(2)/2  ) ; 
+  new TBRIK ( "Lead", "Lead converter", "void", geom->GetCPVBoxSize(0)/2,
+                                                geom->GetLeadConverterThickness()/2,
+                                                geom->GetCPVBoxSize(2)/2  ) ; 
 
      // position PPSD into ALICE
 
   char * nodename = new char[20] ;  
   char * rotname  = new char[20] ; 
 
-  Float_t r = fGeom->GetIPtoTopLidDistance() + fGeom->GetCPVBoxSize(1) / 2.0 ;
+  Float_t r = geom->GetIPtoTopLidDistance() + geom->GetCPVBoxSize(1) / 2.0 ;
   Int_t number = 988 ; 
   TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
  
   Int_t firstModule = 0 ; 
-  if      (strcmp(fGeom->GetName(),"GPS2") == 0) 
+  if      (strcmp(geom->GetName(),"GPS2") == 0) 
     firstModule = 1;
-  else if (strcmp(fGeom->GetName(),"MIXT") == 0) 
-    firstModule = fGeom->GetNModules() - fGeom->GetNPPSDModules() + 1;
+  else if (strcmp(geom->GetName(),"MIXT") == 0) 
+    firstModule = geom->GetNModules() - geom->GetNPPSDModules() + 1;
   
-  for( Int_t i = firstModule; i <= fGeom->GetNModules(); i++ ) { // the number of PHOS modules
-    Float_t angle = fGeom->GetPHOSAngle(i) ;
+  for( Int_t i = firstModule; i <= geom->GetNModules(); i++ ) { // the number of PHOS modules
+    Float_t angle = geom->GetPHOSAngle(i) ;
     sprintf(rotname, "%s%d", "rotg", number+i) ;
     new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
     top->cd();
@@ -338,13 +347,13 @@ void AliPHOSv0:: BuildGeometryforPPSD(void)
     ppsdboxnode->cd() ;
     // inside the PPSD box: 
     //   1.   fNumberOfModulesPhi x fNumberOfModulesZ top micromegas
-    x = ( fGeom->GetCPVBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;  
+    x = ( geom->GetCPVBoxSize(0) - geom->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->GetCPVBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
+      for ( Int_t iphi = 1; iphi <= geom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
+       Float_t z = ( geom->GetCPVBoxSize(2) - geom->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->GetCPVBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ; 
+       for ( Int_t iz = 1; iz <= geom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
+         y = ( geom->GetCPVBoxSize(1) - geom->GetMicromegas1Thickness() ) / 2. ; 
          sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ;
          micro1node  = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
          micro1node->SetLineColor(kColorPPSD) ;  
@@ -352,81 +361,81 @@ void AliPHOSv0:: BuildGeometryforPPSD(void)
          // inside top micromegas
          micro1node->cd() ; 
          //      a. top lid
-         y = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ; 
+         y = ( geom->GetMicromegas1Thickness() - geom->GetLidThickness() ) / 2. ; 
          sprintf(nodename, "%s%d%d%d", "Lid", i, iphi, iz) ;
          TNode * toplidnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
          toplidnode->SetLineColor(kColorPPSD) ;  
          fNodes->Add(toplidnode) ; 
          //      b. composite panel
-         y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ; 
+         y = y - geom->GetLidThickness() / 2. - geom->GetCompositeThickness() / 2. ; 
          sprintf(nodename, "%s%d%d%d", "CompU", i, iphi, iz) ;
          TNode * compupnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
          compupnode->SetLineColor(kColorPPSD) ;  
          fNodes->Add(compupnode) ; 
          //      c. anode
-         y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness()  / 2. ; 
+         y = y - geom->GetCompositeThickness() / 2. - geom->GetAnodeThickness()  / 2. ; 
          sprintf(nodename, "%s%d%d%d", "Ano", i, iphi, iz) ;
          TNode * anodenode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
          anodenode->SetLineColor(kColorPHOS) ;  
          fNodes->Add(anodenode) ; 
          //      d.  gas 
-         y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() +  fGeom->GetAvalancheGap() ) / 2. ; 
+         y = y - geom->GetAnodeThickness() / 2. - ( geom->GetConversionGap() +  geom->GetAvalancheGap() ) / 2. ; 
          sprintf(nodename, "%s%d%d%d", "GGap", i, iphi, iz) ;
          TNode * ggapnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
          ggapnode->SetLineColor(kColorGas) ;  
          fNodes->Add(ggapnode) ;          
          //      f. cathode
-         y = y - ( fGeom->GetConversionGap() +  fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness()  / 2. ; 
+         y = y - ( geom->GetConversionGap() +  geom->GetAvalancheGap() ) / 2. - geom->GetCathodeThickness()  / 2. ; 
          sprintf(nodename, "%s%d%d%d", "Cathode", i, iphi, iz) ;
          TNode * cathodenode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
          cathodenode->SetLineColor(kColorPHOS) ;  
          fNodes->Add(cathodenode) ;        
          //      g. printed circuit
-         y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness()  / 2. ; 
+         y = y - geom->GetCathodeThickness() / 2. - geom->GetPCThickness()  / 2. ; 
          sprintf(nodename, "%s%d%d%d", "PC", i, iphi, iz) ;
          TNode * pcnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
          pcnode->SetLineColor(kColorPPSD) ;  
          fNodes->Add(pcnode) ;        
          //      h. composite panel
-         y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness()  / 2. ; 
+         y = y - geom->GetPCThickness() / 2. - geom->GetCompositeThickness()  / 2. ; 
          sprintf(nodename, "%s%d%d%d", "CompDown", i, iphi, iz) ;
          TNode * compdownnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
          compdownnode->SetLineColor(kColorPPSD) ;  
          fNodes->Add(compdownnode) ;   
-         z = z - fGeom->GetPPSDModuleSize(2) ;
+         z = z - geom->GetPPSDModuleSize(2) ;
          ppsdboxnode->cd() ;
        } // end of Z module loop     
-       x = x -  fGeom->GetPPSDModuleSize(0) ; 
+       x = x -  geom->GetPPSDModuleSize(0) ; 
        ppsdboxnode->cd() ;
       } // end of phi module loop
     }
     //   2. air gap      
     ppsdboxnode->cd() ;
-    y = ( fGeom->GetCPVBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ; 
+    y = ( geom->GetCPVBoxSize(1) - 2 * geom->GetMicromegas1Thickness() - geom->GetMicro1ToLeadGap() ) / 2. ; 
     sprintf(nodename, "%s%d", "GapUp", i) ;
     TNode * gapupnode = new TNode(nodename, nodename, "LeadToM", 0, y, 0) ;
     gapupnode->SetLineColor(kColorAir) ;  
     fNodes->Add(gapupnode) ;        
     //   3. lead converter
-    y = y - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ; 
+    y = y - geom->GetMicro1ToLeadGap() / 2. - geom->GetLeadConverterThickness() / 2. ; 
     sprintf(nodename, "%s%d", "LeadC", i) ;
     TNode * leadcnode = new TNode(nodename, nodename, "Lead", 0, y, 0) ;
     leadcnode->SetLineColor(kColorPPSD) ;  
     fNodes->Add(leadcnode) ;        
     //   4. air gap
-    y = y - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap()  / 2. ; 
+    y = y - geom->GetLeadConverterThickness() / 2. - geom->GetLeadToMicro2Gap()  / 2. ; 
     sprintf(nodename, "%s%d", "GapDown", i) ;
     TNode * gapdownnode = new TNode(nodename, nodename, "MToLead", 0, y, 0) ;
     gapdownnode->SetLineColor(kColorAir) ;  
     fNodes->Add(gapdownnode) ;        
     //    5.  fNumberOfModulesPhi x fNumberOfModulesZ bottom micromegas
-    x = ( fGeom->GetCPVBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. - fGeom->GetPhiDisplacement() ;  
+    x = ( geom->GetCPVBoxSize(0) - geom->GetPPSDModuleSize(0) ) / 2. - geom->GetPhiDisplacement() ;  
     {
-      for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { 
-       Float_t z = ( fGeom->GetCPVBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2.  - fGeom->GetZDisplacement() ;;
+      for ( Int_t iphi = 1; iphi <= geom->GetNumberOfModulesPhi(); iphi++ ) { 
+       Float_t z = ( geom->GetCPVBoxSize(2) - geom->GetPPSDModuleSize(2) ) / 2.  - geom->GetZDisplacement() ;;
        TNode * micro2node ; 
-       for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { 
-         y = - ( fGeom->GetCPVBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ; 
+       for ( Int_t iz = 1; iz <= geom->GetNumberOfModulesZ(); iz++ ) { 
+         y = - ( geom->GetCPVBoxSize(1) - geom->GetMicromegas2Thickness() ) / 2. ; 
          sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ;
          micro2node  = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
          micro2node->SetLineColor(kColorPPSD) ;  
@@ -434,51 +443,51 @@ void AliPHOSv0:: BuildGeometryforPPSD(void)
          // inside bottom micromegas
          micro2node->cd() ; 
          //      a. top lid
-         y = ( fGeom->GetMicromegas2Thickness() - fGeom->GetLidThickness() ) / 2. ; 
+         y = ( geom->GetMicromegas2Thickness() - geom->GetLidThickness() ) / 2. ; 
          sprintf(nodename, "%s%d", "Lidb", i) ;
          TNode * toplidbnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
          toplidbnode->SetLineColor(kColorPPSD) ;  
          fNodes->Add(toplidbnode) ; 
          //      b. composite panel
-         y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ; 
+         y = y - geom->GetLidThickness() / 2. - geom->GetCompositeThickness() / 2. ; 
          sprintf(nodename, "%s%d", "CompUb", i) ;
          TNode * compupbnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
          compupbnode->SetLineColor(kColorPPSD) ;  
          fNodes->Add(compupbnode) ; 
          //      c. anode
-         y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness()  / 2. ; 
+         y = y - geom->GetCompositeThickness() / 2. - geom->GetAnodeThickness()  / 2. ; 
          sprintf(nodename, "%s%d", "Anob", i) ;
          TNode * anodebnode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
          anodebnode->SetLineColor(kColorPPSD) ;  
          fNodes->Add(anodebnode) ; 
          //      d. conversion gas
-         y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() +  fGeom->GetAvalancheGap() )  / 2. ; 
+         y = y - geom->GetAnodeThickness() / 2. - ( geom->GetConversionGap() +  geom->GetAvalancheGap() )  / 2. ; 
          sprintf(nodename, "%s%d", "GGapb", i) ;
          TNode * ggapbnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
          ggapbnode->SetLineColor(kColorGas) ;  
          fNodes->Add(ggapbnode) ;           
          //      f. cathode
-         y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness()  / 2. ; 
+         y = y - ( geom->GetConversionGap() + geom->GetAvalancheGap() ) / 2. - geom->GetCathodeThickness()  / 2. ; 
          sprintf(nodename, "%s%d", "Cathodeb", i) ;
          TNode * cathodebnode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
          cathodebnode->SetLineColor(kColorPPSD) ;  
          fNodes->Add(cathodebnode) ;        
          //      g. printed circuit
-         y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness()  / 2. ; 
+         y = y - geom->GetCathodeThickness() / 2. - geom->GetPCThickness()  / 2. ; 
          sprintf(nodename, "%s%d", "PCb", i) ;
          TNode * pcbnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
          pcbnode->SetLineColor(kColorPPSD) ;  
          fNodes->Add(pcbnode) ;        
          //      h. composite pane
-         y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness()  / 2. ; 
+         y = y - geom->GetPCThickness() / 2. - geom->GetCompositeThickness()  / 2. ; 
          sprintf(nodename, "%s%d", "CompDownb", i) ;
          TNode * compdownbnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
          compdownbnode->SetLineColor(kColorPPSD) ;  
          fNodes->Add(compdownbnode) ;        
-                 z = z - fGeom->GetPPSDModuleSize(2) ;
+                 z = z - geom->GetPPSDModuleSize(2) ;
          ppsdboxnode->cd() ;
        } // end of Z module loop     
-       x = x -  fGeom->GetPPSDModuleSize(0) ; 
+       x = x -  geom->GetPPSDModuleSize(0) ; 
        ppsdboxnode->cd() ;
       } // end of phi module loop
     }
@@ -523,44 +532,46 @@ void AliPHOSv0:: BuildGeometryforCPV(void)
   const Int_t    kColorGassiplex = kRed;
   const Int_t    kColorPCB       = kCyan;
 
+  AliPHOSGeometry * geom = GetGeometry() ; 
+
   // 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);
+  new TBRIK ("CPVBox", "CPV box", "void",                   geom->GetCPVBoxSize(0)/2,
+                                                            geom->GetCPVBoxSize(1)/2,
+                                                           geom->GetCPVBoxSize(2)/2 );
+  new TBRIK ("CPVFrameLR", "CPV frame Left-Right", "void",  geom->GetCPVFrameSize(0)/2,
+                                                            geom->GetCPVFrameSize(1)/2,
+                                                           geom->GetCPVBoxSize(2)/2 );
+  new TBRIK ("CPVFrameUD", "CPV frame Up-Down",    "void",  geom->GetCPVBoxSize(0)/2 - geom->GetCPVFrameSize(0),
+                                                            geom->GetCPVFrameSize(1)/2,
+                                                           geom->GetCPVFrameSize(2)/2);
+  new TBRIK ("CPVPCB",    "CPV PCB",               "void",  geom->GetCPVActiveSize(0)/2,
+                                                            geom->GetCPVTextoliteThickness()/2,
+                                                           geom->GetCPVActiveSize(1)/2);
+  new TBRIK ("CPVGassiplex", "CPV Gassiplex PCB",  "void",  geom->GetGassiplexChipSize(0)/2,
+                                                            geom->GetGassiplexChipSize(1)/2,
+                                                           geom->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 ;
+  Float_t r = geom->GetIPtoCPVDistance() + geom->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();
+  if      (strcmp(geom->GetName(),"IHEP") == 0) 
+    lastModule = geom->GetNModules();
+  else if (strcmp(geom->GetName(),"MIXT") == 0) 
+    lastModule = geom->GetNModules() - geom->GetNPPSDModules();
   
   for( Int_t i = 1; i <= lastModule; i++ ) { // the number of PHOS modules
 
     // One CPV module
 
-    Float_t angle = fGeom->GetPHOSAngle(i) ;
+    Float_t angle = geom->GetPHOSAngle(i) ;
     sprintf(rotname, "%s%d", "rotg", number+i) ;
     new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
     top->cd();
@@ -579,13 +590,13 @@ void AliPHOSv0:: BuildGeometryforCPV(void)
     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;
+      x = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(0) - geom->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;
+      z = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(2) - geom->GetCPVFrameSize(2)) / 2;
       cpvFrameNode = new TNode(nodename , nodename ,"CPVFrameUD", 0, 0, z) ;
       cpvFrameNode->SetLineColor(kColorFrame) ;
       fNodes->Add(cpvFrameNode) ;
@@ -594,21 +605,21 @@ void AliPHOSv0:: BuildGeometryforCPV(void)
     // 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;
+      y = geom->GetCPVFrameSize(1) / 2 - geom->GetFTPosition(j) + geom->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;
+    Float_t xStep = geom->GetCPVActiveSize(0) / (geom->GetNumberOfCPVChipsPhi() + 1);
+    Float_t zStep = geom->GetCPVActiveSize(1) / (geom->GetNumberOfCPVChipsZ()   + 1);
+    y = geom->GetCPVFrameSize(1)/2           - geom->GetFTPosition(0) +
+        geom->GetCPVTextoliteThickness() / 2 + geom->GetGassiplexChipSize(1) / 2 + 0.1;
+    for (Int_t ix=0; ix<geom->GetNumberOfCPVChipsPhi(); ix++) {
+      x = xStep * (ix+1) - geom->GetCPVActiveSize(0)/2;
+      for (Int_t iz=0; iz<geom->GetNumberOfCPVChipsZ(); iz++) {
+       z = zStep * (iz+1) - geom->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) ;
@@ -635,6 +646,9 @@ void AliPHOSv0::CreateGeometry()
     return;
     
   }
+
+  AliPHOSGeometry * geom = GetGeometry() ; 
+
   // Get pointer to the array containing media indeces
   Int_t *idtmed = fIdtmed->GetArray() - 699 ;
 
@@ -642,21 +656,21 @@ void AliPHOSv0::CreateGeometry()
   // 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->GetCPVBoxSize(1) ) / 2.0 ;
-  bigbox[2] =   fGeom->GetOuterBoxSize(2) / 2.0 ;
+  bigbox[0] =   geom->GetOuterBoxSize(0) / 2.0 ;
+  bigbox[1] = ( geom->GetOuterBoxSize(1) + geom->GetCPVBoxSize(1) ) / 2.0 ;
+  bigbox[2] =   geom->GetOuterBoxSize(2) / 2.0 ;
   
     gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ;
 
-  if ( strcmp( fGeom->GetName(),"MIXT") == 0 && fGeom->GetNPPSDModules() > 0) 
+  if ( strcmp( geom->GetName(),"MIXT") == 0 && geom->GetNPPSDModules() > 0) 
     gMC->Gsvolu("PHO1", "BOX ", idtmed[798], bigbox, 3) ;
   
     this->CreateGeometryforPHOS() ; 
-  if      ( strcmp( fGeom->GetName(), "GPS2") == 0  ) 
+  if      ( strcmp( geom->GetName(), "GPS2") == 0  ) 
     this->CreateGeometryforPPSD() ;
-  else if ( strcmp( fGeom->GetName(), "IHEP") == 0  ) 
+  else if ( strcmp( geom->GetName(), "IHEP") == 0  ) 
     this->CreateGeometryforCPV() ;
-  else if ( strcmp( fGeom->GetName(), "MIXT") == 0  ) {
+  else if ( strcmp( geom->GetName(), "MIXT") == 0  ) {
     this->CreateGeometryforPPSD() ;
     this->CreateGeometryforCPV() ;
   }
@@ -671,18 +685,18 @@ void AliPHOSv0::CreateGeometry()
   Double_t const kRADDEG = 180.0 / kPI ;
   
   Int_t lastModule;
-  if (strcmp(fGeom->GetName(),"MIXT") == 0) 
-    lastModule = fGeom->GetNModules() - fGeom->GetNPPSDModules();
+  if (strcmp(geom->GetName(),"MIXT") == 0) 
+    lastModule = geom->GetNModules() - geom->GetNPPSDModules();
   else
-    lastModule = fGeom->GetNModules();
+    lastModule = geom->GetNModules();
 
   Int_t i;
   for( i = 1; i <= lastModule ; i++ ) {
     
-    Float_t angle = fGeom->GetPHOSAngle(i) ;
+    Float_t angle = geom->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 r = geom->GetIPtoOuterCoverDistance() + ( geom->GetOuterBoxSize(1) + geom->GetCPVBoxSize(1) ) / 2.0 ;
 
     Float_t xP1 =  r * TMath::Sin( angle / kRADDEG ) ;
     Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
@@ -691,12 +705,12 @@ void AliPHOSv0::CreateGeometry()
  
   } // for GetNModules
 
-  for( i = lastModule+1; i <= fGeom->GetNModules(); i++ ) {
+  for( i = lastModule+1; i <= geom->GetNModules(); i++ ) {
     
-    Float_t angle = fGeom->GetPHOSAngle(i) ;
+    Float_t angle = geom->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 r = geom->GetIPtoOuterCoverDistance() + ( geom->GetOuterBoxSize(1) + geom->GetCPVBoxSize(1) ) / 2.0 ;
 
     Float_t xP1 =  r * TMath::Sin( angle / kRADDEG ) ;
     Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
@@ -725,22 +739,24 @@ void AliPHOSv0::CreateGeometryforPHOS()
   // Get pointer to the array containing media indexes
   Int_t *idtmed = fIdtmed->GetArray() - 699 ;
 
+  AliPHOSGeometry * geom = GetGeometry() ; 
+
   // ---
   // --- Define PHOS box volume, fPUFPill with thermo insulating foam ---
   // --- Foam Thermo Insulating outer cover dimensions ---
   // --- Put it in bigbox = PHOS
 
   Float_t dphos[3] ; 
-  dphos[0] =  fGeom->GetOuterBoxSize(0) / 2.0 ;
-  dphos[1] =  fGeom->GetOuterBoxSize(1) / 2.0 ;
-  dphos[2] =  fGeom->GetOuterBoxSize(2) / 2.0 ;
+  dphos[0] =  geom->GetOuterBoxSize(0) / 2.0 ;
+  dphos[1] =  geom->GetOuterBoxSize(1) / 2.0 ;
+  dphos[2] =  geom->GetOuterBoxSize(2) / 2.0 ;
 
   gMC->Gsvolu("PEMC", "BOX ", idtmed[706], dphos, 3) ;
 
-  Float_t yO =  - fGeom->GetCPVBoxSize(1)  / 2.0 ;
+  Float_t yO =  - geom->GetCPVBoxSize(1)  / 2.0 ;
 
     gMC->Gspos("PEMC", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ; 
-  if ( strcmp( fGeom->GetName(),"MIXT") == 0 && fGeom->GetNPPSDModules() > 0) 
+  if ( strcmp( geom->GetName(),"MIXT") == 0 && geom->GetNPPSDModules() > 0) 
     gMC->Gspos("PEMC", 1, "PHO1", 0.0, yO, 0.0, 0, "ONLY") ; 
 
   // ---
@@ -749,13 +765,13 @@ void AliPHOSv0::CreateGeometryforPHOS()
  
  
   Float_t dptxw[3];
-  dptxw[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
-  dptxw[1] = fGeom->GetTextolitBoxSize(1) / 2.0 ;
-  dptxw[2] = fGeom->GetTextolitBoxSize(2) / 2.0 ;
+  dptxw[0] = geom->GetTextolitBoxSize(0) / 2.0 ;
+  dptxw[1] = geom->GetTextolitBoxSize(1) / 2.0 ;
+  dptxw[2] = geom->GetTextolitBoxSize(2) / 2.0 ;
 
   gMC->Gsvolu("PTXW", "BOX ", idtmed[707], dptxw, 3);
 
-  yO =   (  fGeom->GetOuterBoxThickness(1) -   fGeom->GetUpperPlateThickness() ) / 2.  ;
+  yO =   (  geom->GetOuterBoxThickness(1) -   geom->GetUpperPlateThickness() ) / 2.  ;
    
   gMC->Gspos("PTXW", 1, "PEMC", 0.0, yO, 0.0, 0, "ONLY") ;
 
@@ -766,13 +782,13 @@ void AliPHOSv0::CreateGeometryforPHOS()
   // --- Upper Polystyrene Foam plate thickness ---
  
   Float_t  dpufp[3] ;
-  dpufp[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ; 
-  dpufp[1] = fGeom->GetSecondUpperPlateThickness() / 2. ;
-  dpufp[2] = fGeom->GetTextolitBoxSize(2) /2.0 ; 
+  dpufp[0] = geom->GetTextolitBoxSize(0) / 2.0 ; 
+  dpufp[1] = geom->GetSecondUpperPlateThickness() / 2. ;
+  dpufp[2] = geom->GetTextolitBoxSize(2) /2.0 ; 
 
   gMC->Gsvolu("PUFP", "BOX ", idtmed[703], dpufp, 3) ;
   
-  yO = ( fGeom->GetTextolitBoxSize(1) -  fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
+  yO = ( geom->GetTextolitBoxSize(1) -  geom->GetSecondUpperPlateThickness() ) / 2.0 ;
   
   gMC->Gspos("PUFP", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
   
@@ -782,33 +798,33 @@ void AliPHOSv0::CreateGeometryforPHOS()
  
 
   Float_t  dpair[3] ;
-  dpair[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
-  dpair[1] = fGeom->GetAirFilledBoxSize(1) / 2.0 ;
-  dpair[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
+  dpair[0] = geom->GetAirFilledBoxSize(0) / 2.0 ;
+  dpair[1] = geom->GetAirFilledBoxSize(1) / 2.0 ;
+  dpair[2] = geom->GetAirFilledBoxSize(2) / 2.0 ;
 
   gMC->Gsvolu("PAIR", "BOX ", idtmed[798], dpair, 3) ;
   
-  yO = ( fGeom->GetTextolitBoxSize(1) -  fGeom->GetAirFilledBoxSize(1) ) / 2.0 -   fGeom->GetSecondUpperPlateThickness() ;
+  yO = ( geom->GetTextolitBoxSize(1) -  geom->GetAirFilledBoxSize(1) ) / 2.0 -   geom->GetSecondUpperPlateThickness() ;
   
   gMC->Gspos("PAIR", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
 
 // --- Dimensions of PbWO4 crystal ---
 
-  Float_t xtlX =  fGeom->GetCrystalSize(0) ; 
-  Float_t xtlY =  fGeom->GetCrystalSize(1) ; 
-  Float_t xtlZ =  fGeom->GetCrystalSize(2) ; 
+  Float_t xtlX =  geom->GetCrystalSize(0) ; 
+  Float_t xtlY =  geom->GetCrystalSize(1) ; 
+  Float_t xtlZ =  geom->GetCrystalSize(2) ; 
 
   Float_t dptcb[3] ;  
-  dptcb[0] =  fGeom->GetNPhi() * ( xtlX + 2 *  fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
-  dptcb[1] = ( xtlY +  fGeom->GetCrystalSupportHeight() +  fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 
-             + fGeom->GetModuleBoxThickness() / 2.0 ;
-  dptcb[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 +  fGeom->GetModuleBoxThickness() ;
+  dptcb[0] =  geom->GetNPhi() * ( xtlX + 2 *  geom->GetGapBetweenCrystals() ) / 2.0 + geom->GetModuleBoxThickness() ;
+  dptcb[1] = ( xtlY +  geom->GetCrystalSupportHeight() +  geom->GetCrystalWrapThickness() + geom->GetCrystalHolderThickness() ) / 2.0 
+             + geom->GetModuleBoxThickness() / 2.0 ;
+  dptcb[2] = geom->GetNZ() * ( xtlZ + 2 * geom->GetGapBetweenCrystals() ) / 2.0 +  geom->GetModuleBoxThickness() ;
   
   gMC->Gsvolu("PTCB", "BOX ", idtmed[706], dptcb, 3) ;
 
-  yO =  fGeom->GetAirFilledBoxSize(1) / 2.0 - dptcb[1] 
-       - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness() 
-       -  fGeom->GetUpperPlateThickness() -  fGeom->GetSecondUpperPlateThickness() ) ;
+  yO =  geom->GetAirFilledBoxSize(1) / 2.0 - dptcb[1] 
+       - ( geom->GetIPtoCrystalSurface() - geom->GetIPtoOuterCoverDistance() - geom->GetModuleBoxThickness() 
+       -  geom->GetUpperPlateThickness() -  geom->GetSecondUpperPlateThickness() ) ;
   
   gMC->Gspos("PTCB", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
 
@@ -816,17 +832,17 @@ void AliPHOSv0::CreateGeometryforPHOS()
   // --- Define Crystal BLock filled with air, position it inside PTCB ---
   Float_t dpcbl[3] ; 
   
-  dpcbl[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
-  dpcbl[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
-  dpcbl[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
+  dpcbl[0] = geom->GetNPhi() * ( xtlX + 2 * geom->GetGapBetweenCrystals() ) / 2.0 ;
+  dpcbl[1] = ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() + geom->GetCrystalHolderThickness() ) / 2.0 ;
+  dpcbl[2] = geom->GetNZ() * ( xtlZ + 2 * geom->GetGapBetweenCrystals() ) / 2.0 ;
   
   gMC->Gsvolu("PCBL", "BOX ", idtmed[798], dpcbl, 3) ;
   
   // --- Divide PCBL in X (phi) and Z directions --
-  gMC->Gsdvn("PROW", "PCBL", Int_t (fGeom->GetNPhi()), 1) ;
-  gMC->Gsdvn("PCEL", "PROW", Int_t (fGeom->GetNZ()), 3) ;
+  gMC->Gsdvn("PROW", "PCBL", Int_t (geom->GetNPhi()), 1) ;
+  gMC->Gsdvn("PCEL", "PROW", Int_t (geom->GetNZ()), 3) ;
 
-  yO = -fGeom->GetModuleBoxThickness() / 2.0 ;
+  yO = -geom->GetModuleBoxThickness() / 2.0 ;
   
   gMC->Gspos("PCBL", 1, "PTCB", 0.0, yO, 0.0, 0, "ONLY") ;
 
@@ -834,9 +850,9 @@ void AliPHOSv0::CreateGeometryforPHOS()
   // --- Define STeel (actually, it's titanium) Cover volume, place inside PCEL
   Float_t  dpstc[3] ; 
   
-  dpstc[0] = ( xtlX + 2 * fGeom->GetCrystalWrapThickness() ) / 2.0 ;
-  dpstc[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
-  dpstc[2] = ( xtlZ + 2 * fGeom->GetCrystalWrapThickness()  + 2 *  fGeom->GetCrystalHolderThickness() ) / 2.0 ;
+  dpstc[0] = ( xtlX + 2 * geom->GetCrystalWrapThickness() ) / 2.0 ;
+  dpstc[1] = ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() + geom->GetCrystalHolderThickness() ) / 2.0 ;
+  dpstc[2] = ( xtlZ + 2 * geom->GetCrystalWrapThickness()  + 2 *  geom->GetCrystalHolderThickness() ) / 2.0 ;
   
   gMC->Gsvolu("PSTC", "BOX ", idtmed[704], dpstc, 3) ;
 
@@ -846,14 +862,14 @@ void AliPHOSv0::CreateGeometryforPHOS()
   // --- Define Tyvek volume, place inside PSTC ---
   Float_t  dppap[3] ;
 
-  dppap[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
-  dppap[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
-  dppap[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
+  dppap[0] = xtlX / 2.0 + geom->GetCrystalWrapThickness() ;
+  dppap[1] = ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() ) / 2.0 ;
+  dppap[2] = xtlZ / 2.0 + geom->GetCrystalWrapThickness() ;
   
   gMC->Gsvolu("PPAP", "BOX ", idtmed[702], dppap, 3) ;
   
-  yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 
-              - ( xtlY +  fGeom->GetCrystalSupportHeight() +  fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
+  yO = ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() ) / 2.0 
+              - ( xtlY +  geom->GetCrystalSupportHeight() +  geom->GetCrystalWrapThickness() + geom->GetCrystalHolderThickness() ) / 2.0 ;
    
   gMC->Gspos("PPAP", 1, "PSTC", 0.0, yO, 0.0, 0, "ONLY") ;
 
@@ -867,7 +883,7 @@ void AliPHOSv0::CreateGeometryforPHOS()
   
   gMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3) ;
 
-  yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 - xtlY / 2.0 - fGeom->GetCrystalWrapThickness() ;
+  yO = ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() ) / 2.0 - xtlY / 2.0 - geom->GetCrystalWrapThickness() ;
   
   gMC->Gspos("PXTL", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
 
@@ -875,13 +891,13 @@ void AliPHOSv0::CreateGeometryforPHOS()
   // --- Define crystal support volume, place inside PPAP ---
   Float_t dpsup[3] ; 
 
-  dpsup[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness()  ;
-  dpsup[1] = fGeom->GetCrystalSupportHeight() / 2.0 ;
-  dpsup[2] = xtlZ / 2.0 +  fGeom->GetCrystalWrapThickness() ;
+  dpsup[0] = xtlX / 2.0 + geom->GetCrystalWrapThickness()  ;
+  dpsup[1] = geom->GetCrystalSupportHeight() / 2.0 ;
+  dpsup[2] = xtlZ / 2.0 +  geom->GetCrystalWrapThickness() ;
 
   gMC->Gsvolu("PSUP", "BOX ", idtmed[798], dpsup, 3) ;
 
-  yO =  fGeom->GetCrystalSupportHeight() / 2.0 - ( xtlY +  fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
+  yO =  geom->GetCrystalSupportHeight() / 2.0 - ( xtlY +  geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() ) / 2.0 ;
 
   gMC->Gspos("PSUP", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
 
@@ -893,13 +909,13 @@ void AliPHOSv0::CreateGeometryforPHOS()
 
  
   Float_t dppin[3] ;
-  dppin[0] = fGeom->GetPinDiodeSize(0) / 2.0 ;
-  dppin[1] = fGeom->GetPinDiodeSize(1) / 2.0 ;
-  dppin[2] = fGeom->GetPinDiodeSize(2) / 2.0 ;
+  dppin[0] = geom->GetPinDiodeSize(0) / 2.0 ;
+  dppin[1] = geom->GetPinDiodeSize(1) / 2.0 ;
+  dppin[2] = geom->GetPinDiodeSize(2) / 2.0 ;
  
   gMC->Gsvolu("PPIN", "BOX ", idtmed[705], dppin, 3) ;
  
-  yO = fGeom->GetCrystalSupportHeight() / 2.0 - fGeom->GetPinDiodeSize(1) / 2.0 ;
+  yO = geom->GetCrystalSupportHeight() / 2.0 - geom->GetPinDiodeSize(1) / 2.0 ;
  
   gMC->Gspos("PPIN", 1, "PSUP", 0.0, yO, 0.0, 0, "ONLY") ;
 
@@ -909,14 +925,14 @@ void AliPHOSv0::CreateGeometryforPHOS()
  // --- Upper Cooling Plate thickness ---
  
   dpucp[0] = dptcb[0] ;
-  dpucp[1] = fGeom->GetUpperCoolingPlateThickness() ;
+  dpucp[1] = geom->GetUpperCoolingPlateThickness() ;
   dpucp[2] = dptcb[2] ;
   
   gMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp,3) ;
   
-  yO = fGeom->GetAirFilledBoxSize(1) / 2. 
-    -( fGeom->GetIPtoCrystalSurface()  - fGeom->GetIPtoOuterCoverDistance()    - fGeom->GetModuleBoxThickness()
-      -fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() - fGeom->GetUpperCoolingPlateThickness() ) ; 
+  yO = geom->GetAirFilledBoxSize(1) / 2. 
+    -( geom->GetIPtoCrystalSurface()  - geom->GetIPtoOuterCoverDistance()    - geom->GetModuleBoxThickness()
+      -geom->GetUpperPlateThickness() - geom->GetSecondUpperPlateThickness() - geom->GetUpperCoolingPlateThickness() ) ; 
   
   gMC->Gspos("PUCP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
 
@@ -926,15 +942,15 @@ void AliPHOSv0::CreateGeometryforPHOS()
  // --- Al Support Plate thickness ---
  
   Float_t dpasp[3] ;
-  dpasp[0] =  fGeom->GetAirFilledBoxSize(0) / 2.0 ;
-  dpasp[1] = fGeom->GetSupportPlateThickness() / 2.0 ;
-  dpasp[2] =  fGeom->GetAirFilledBoxSize(2) / 2.0 ;
+  dpasp[0] =  geom->GetAirFilledBoxSize(0) / 2.0 ;
+  dpasp[1] = geom->GetSupportPlateThickness() / 2.0 ;
+  dpasp[2] =  geom->GetAirFilledBoxSize(2) / 2.0 ;
   
   gMC->Gsvolu("PASP", "BOX ", idtmed[701], dpasp, 3) ;
   
-  yO = (  fGeom->GetAirFilledBoxSize(1) - fGeom->GetSupportPlateThickness() ) / 2. 
-       -  ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance()
-           - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 ) ;
+  yO = (  geom->GetAirFilledBoxSize(1) - geom->GetSupportPlateThickness() ) / 2. 
+       -  ( geom->GetIPtoCrystalSurface() - geom->GetIPtoOuterCoverDistance()
+           - geom->GetUpperPlateThickness() - geom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 ) ;
   
   gMC->Gspos("PASP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
 
@@ -944,15 +960,15 @@ void AliPHOSv0::CreateGeometryforPHOS()
   // --- Lower Thermo Insulating Plate thickness ---
   
   Float_t dptip[3] ;
-  dptip[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
-  dptip[1] = fGeom->GetLowerThermoPlateThickness() / 2.0 ;
-  dptip[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
+  dptip[0] = geom->GetAirFilledBoxSize(0) / 2.0 ;
+  dptip[1] = geom->GetLowerThermoPlateThickness() / 2.0 ;
+  dptip[2] = geom->GetAirFilledBoxSize(2) / 2.0 ;
 
   gMC->Gsvolu("PTIP", "BOX ", idtmed[706], dptip, 3) ;
 
-  yO =  ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerThermoPlateThickness() ) / 2. 
-       -  ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness() 
-            - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness() ) ;
+  yO =  ( geom->GetAirFilledBoxSize(1) - geom->GetLowerThermoPlateThickness() ) / 2. 
+       -  ( geom->GetIPtoCrystalSurface() - geom->GetIPtoOuterCoverDistance() - geom->GetUpperPlateThickness() 
+            - geom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + geom->GetSupportPlateThickness() ) ;
 
   gMC->Gspos("PTIP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
 
@@ -962,16 +978,16 @@ void AliPHOSv0::CreateGeometryforPHOS()
   // --- Lower Textolit Plate thickness ---
  
   Float_t dptxp[3] ;
-  dptxp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
-  dptxp[1] = fGeom->GetLowerTextolitPlateThickness() / 2.0 ;
-  dptxp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
+  dptxp[0] = geom->GetAirFilledBoxSize(0) / 2.0 ;
+  dptxp[1] = geom->GetLowerTextolitPlateThickness() / 2.0 ;
+  dptxp[2] = geom->GetAirFilledBoxSize(2) / 2.0 ;
 
   gMC->Gsvolu("PTXP", "BOX ", idtmed[707], dptxp, 3) ;
 
-  yO =  ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerTextolitPlateThickness() ) / 2. 
-       -  ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness() 
-            - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness() 
-            +  fGeom->GetLowerThermoPlateThickness() ) ;
+  yO =  ( geom->GetAirFilledBoxSize(1) - geom->GetLowerTextolitPlateThickness() ) / 2. 
+       -  ( geom->GetIPtoCrystalSurface() - geom->GetIPtoOuterCoverDistance() - geom->GetUpperPlateThickness() 
+            - geom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + geom->GetSupportPlateThickness() 
+            +  geom->GetLowerThermoPlateThickness() ) ;
 
   gMC->Gspos("PTXP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
 
@@ -994,18 +1010,20 @@ void AliPHOSv0::CreateGeometryforPPSD()
 
   // Get pointer to the array containing media indexes
   Int_t *idtmed = fIdtmed->GetArray() - 699 ;
-  
+
+  AliPHOSGeometry * geom = GetGeometry() ; 
+
   // The box containing all ppsd's for one PHOS module filled with air 
   Float_t ppsd[3] ; 
-  ppsd[0] = fGeom->GetCPVBoxSize(0) / 2.0 ;  
-  ppsd[1] = fGeom->GetCPVBoxSize(1) / 2.0 ; 
-  ppsd[2] = fGeom->GetCPVBoxSize(2) / 2.0 ;
+  ppsd[0] = geom->GetCPVBoxSize(0) / 2.0 ;  
+  ppsd[1] = geom->GetCPVBoxSize(1) / 2.0 ; 
+  ppsd[2] = geom->GetCPVBoxSize(2) / 2.0 ;
 
   gMC->Gsvolu("PPSD", "BOX ", idtmed[798], ppsd, 3) ;
 
-  Float_t yO =  fGeom->GetOuterBoxSize(1) / 2.0 ;
+  Float_t yO =  geom->GetOuterBoxSize(1) / 2.0 ;
 
-  if ( strcmp( fGeom->GetName(),"MIXT") == 0 && fGeom->GetNPPSDModules() > 0) 
+  if ( strcmp( geom->GetName(),"MIXT") == 0 && geom->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") ; 
@@ -1014,9 +1032,9 @@ void AliPHOSv0::CreateGeometryforPPSD()
   // The box containing the whole module filled with epoxy (FR4)
 
   Float_t mppsd[3] ;  
-  mppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;  
-  mppsd[1] = fGeom->GetPPSDModuleSize(1) / 2.0 ;  
-  mppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
+  mppsd[0] = geom->GetPPSDModuleSize(0) / 2.0 ;  
+  mppsd[1] = geom->GetPPSDModuleSize(1) / 2.0 ;  
+  mppsd[2] = geom->GetPPSDModuleSize(2) / 2.0 ;
 
   gMC->Gsvolu("PMPP", "BOX ", idtmed[708], mppsd, 3) ;  
  
@@ -1024,56 +1042,56 @@ void AliPHOSv0::CreateGeometryforPPSD()
   // 1. The Top Lid made of epoxy (FR4) 
 
   Float_t tlppsd[3] ; 
-  tlppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ; 
-  tlppsd[1] = fGeom->GetLidThickness() / 2.0 ;
-  tlppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
+  tlppsd[0] = geom->GetPPSDModuleSize(0) / 2.0 ; 
+  tlppsd[1] = geom->GetLidThickness() / 2.0 ;
+  tlppsd[2] = geom->GetPPSDModuleSize(2) / 2.0 ;
 
   gMC->Gsvolu("PTLP", "BOX ", idtmed[708], tlppsd, 3) ; 
 
-  Float_t  y0 = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ; 
+  Float_t  y0 = ( geom->GetMicromegas1Thickness() - geom->GetLidThickness() ) / 2. ; 
 
   gMC->Gspos("PTLP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ; 
  
   // 2. the upper panel made of composite material
 
   Float_t upppsd[3] ; 
-  upppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
-  upppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
-  upppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
+  upppsd[0] = ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() ) / 2.0 ;
+  upppsd[1] = geom->GetCompositeThickness() / 2.0 ;
+  upppsd[2] = ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() ) / 2.0 ;
  
   gMC->Gsvolu("PUPP", "BOX ", idtmed[709], upppsd, 3) ; 
   
-  y0 = y0 - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ; 
+  y0 = y0 - geom->GetLidThickness() / 2. - geom->GetCompositeThickness() / 2. ; 
 
   gMC->Gspos("PUPP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ; 
 
   // 3. the anode made of Copper
   
   Float_t anppsd[3] ; 
-  anppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ; 
-  anppsd[1] = fGeom->GetAnodeThickness() / 2.0 ; 
-  anppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0  ; 
+  anppsd[0] = ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() ) / 2.0 ; 
+  anppsd[1] = geom->GetAnodeThickness() / 2.0 ; 
+  anppsd[2] = ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() ) / 2.0  ; 
 
   gMC->Gsvolu("PANP", "BOX ", idtmed[710], anppsd, 3) ; 
   
-  y0 = y0 - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness()  / 2. ; 
+  y0 = y0 - geom->GetCompositeThickness() / 2. - geom->GetAnodeThickness()  / 2. ; 
   
   gMC->Gspos("PANP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ; 
 
   // 4. the conversion gap + avalanche gap filled with gas
 
   Float_t ggppsd[3] ; 
-  ggppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
-  ggppsd[1] = ( fGeom->GetConversionGap() +  fGeom->GetAvalancheGap() ) / 2.0 ; 
-  ggppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
+  ggppsd[0] = ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() ) / 2.0 ;
+  ggppsd[1] = ( geom->GetConversionGap() +  geom->GetAvalancheGap() ) / 2.0 ; 
+  ggppsd[2] = ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() ) / 2.0 ;
 
   gMC->Gsvolu("PGGP", "BOX ", idtmed[715], ggppsd, 3) ; 
   
   // --- Divide GGPP in X (phi) and Z directions --
-  gMC->Gsdvn("PPRO", "PGGP", fGeom->GetNumberOfPadsPhi(), 1) ;
-  gMC->Gsdvn("PPCE", "PPRO", fGeom->GetNumberOfPadsZ() ,  3) ;
+  gMC->Gsdvn("PPRO", "PGGP", geom->GetNumberOfPadsPhi(), 1) ;
+  gMC->Gsdvn("PPCE", "PPRO", geom->GetNumberOfPadsZ() ,  3) ;
 
-  y0 = y0 - fGeom->GetAnodeThickness() / 2.  - ( fGeom->GetConversionGap() +  fGeom->GetAvalancheGap() ) / 2. ; 
+  y0 = y0 - geom->GetAnodeThickness() / 2.  - ( geom->GetConversionGap() +  geom->GetAvalancheGap() ) / 2. ; 
 
   gMC->Gspos("PGGP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ; 
 
@@ -1081,101 +1099,101 @@ void AliPHOSv0::CreateGeometryforPPSD()
   // 6. the cathode made of Copper
 
   Float_t cappsd[3] ;
-  cappsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
-  cappsd[1] = fGeom->GetCathodeThickness() / 2.0 ; 
-  cappsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0  ;
+  cappsd[0] = ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() ) / 2.0 ;
+  cappsd[1] = geom->GetCathodeThickness() / 2.0 ; 
+  cappsd[2] = ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() ) / 2.0  ;
 
   gMC->Gsvolu("PCAP", "BOX ", idtmed[710], cappsd, 3) ; 
 
-  y0 = y0 - ( fGeom->GetConversionGap() +  fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness()  / 2. ; 
+  y0 = y0 - ( geom->GetConversionGap() +  geom->GetAvalancheGap() ) / 2. - geom->GetCathodeThickness()  / 2. ; 
 
   gMC->Gspos("PCAP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ; 
 
   // 7. the printed circuit made of G10       
 
   Float_t pcppsd[3] ; 
-  pcppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2,.0 ; 
-  pcppsd[1] = fGeom->GetPCThickness() / 2.0 ; 
-  pcppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
+  pcppsd[0] = ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() ) / 2,.0 ; 
+  pcppsd[1] = geom->GetPCThickness() / 2.0 ; 
+  pcppsd[2] = ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() ) / 2.0 ;
 
   gMC->Gsvolu("PCPS", "BOX ", idtmed[711], cappsd, 3) ; 
 
-  y0 = y0 - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness()  / 2. ; 
+  y0 = y0 - geom->GetCathodeThickness() / 2. - geom->GetPCThickness()  / 2. ; 
 
   gMC->Gspos("PCPS", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ; 
 
   // 8. the lower panel made of composite material
                                                    
   Float_t lpppsd[3] ; 
-  lpppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ; 
-  lpppsd[1] = fGeom->GetCompositeThickness() / 2.0 ; 
-  lpppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
+  lpppsd[0] = ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() ) / 2.0 ; 
+  lpppsd[1] = geom->GetCompositeThickness() / 2.0 ; 
+  lpppsd[2] = ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() ) / 2.0 ;
 
   gMC->Gsvolu("PLPP", "BOX ", idtmed[709], lpppsd, 3) ; 
  
-  y0 = y0 - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness()  / 2. ; 
+  y0 = y0 - geom->GetPCThickness() / 2. - geom->GetCompositeThickness()  / 2. ; 
 
   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->GetCPVBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ; 
-   Float_t yb = - ( fGeom->GetCPVBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ; 
+   Float_t yt = ( geom->GetCPVBoxSize(1) - geom->GetMicromegas1Thickness() ) / 2. ; 
+   Float_t yb = - ( geom->GetCPVBoxSize(1) - geom->GetMicromegas2Thickness() ) / 2. ; 
 
    Int_t copyNumbertop = 0 ; 
-   Int_t copyNumberbot = fGeom->GetNumberOfModulesPhi() *  fGeom->GetNumberOfModulesZ() ; 
+   Int_t copyNumberbot = geom->GetNumberOfModulesPhi() *  geom->GetNumberOfModulesZ() ; 
 
-   Float_t x  = ( fGeom->GetCPVBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;  
+   Float_t x  = ( geom->GetCPVBoxSize(0) - geom->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->GetCPVBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
+   for ( Int_t iphi = 1; iphi <= geom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
+      Float_t z = ( geom->GetCPVBoxSize(2) - geom->GetPPSDModuleSize(2) ) / 2. ;
 
-      for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
+      for ( Int_t iz = 1; iz <= geom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
        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) ;
+       z = z - geom->GetPPSDModuleSize(2) ;
       } // end of Z module loop   
-      x = x -  fGeom->GetPPSDModuleSize(0) ; 
+      x = x -  geom->GetPPSDModuleSize(0) ; 
     } // end of phi module loop
 
    // The Lead converter between two air gaps
    // 1. Upper air gap
 
    Float_t uappsd[3] ;
-   uappsd[0] = fGeom->GetCPVBoxSize(0) / 2.0 ;
-   uappsd[1] = fGeom->GetMicro1ToLeadGap() / 2.0 ; 
-   uappsd[2] = fGeom->GetCPVBoxSize(2) / 2.0 ;
+   uappsd[0] = geom->GetCPVBoxSize(0) / 2.0 ;
+   uappsd[1] = geom->GetMicro1ToLeadGap() / 2.0 ; 
+   uappsd[2] = geom->GetCPVBoxSize(2) / 2.0 ;
 
   gMC->Gsvolu("PUAPPS", "BOX ", idtmed[798], uappsd, 3) ; 
 
-  y0 = ( fGeom->GetCPVBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ; 
+  y0 = ( geom->GetCPVBoxSize(1) - 2 * geom->GetMicromegas1Thickness() - geom->GetMicro1ToLeadGap() ) / 2. ; 
 
   gMC->Gspos("PUAPPS", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; 
 
    // 2. Lead converter
  
   Float_t lcppsd[3] ; 
-  lcppsd[0] = fGeom->GetCPVBoxSize(0) / 2.0 ;
-  lcppsd[1] = fGeom->GetLeadConverterThickness() / 2.0 ; 
-  lcppsd[2] = fGeom->GetCPVBoxSize(2) / 2.0 ;
+  lcppsd[0] = geom->GetCPVBoxSize(0) / 2.0 ;
+  lcppsd[1] = geom->GetLeadConverterThickness() / 2.0 ; 
+  lcppsd[2] = geom->GetCPVBoxSize(2) / 2.0 ;
  
   gMC->Gsvolu("PLCPPS", "BOX ", idtmed[712], lcppsd, 3) ; 
   
-  y0 = y0 - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ; 
+  y0 = y0 - geom->GetMicro1ToLeadGap() / 2. - geom->GetLeadConverterThickness() / 2. ; 
 
   gMC->Gspos("PLCPPS", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; 
 
   // 3. Lower air gap
 
   Float_t lappsd[3] ; 
-  lappsd[0] = fGeom->GetCPVBoxSize(0) / 2.0 ; 
-  lappsd[1] = fGeom->GetLeadToMicro2Gap() / 2.0 ; 
-  lappsd[2] = fGeom->GetCPVBoxSize(2) / 2.0 ;
+  lappsd[0] = geom->GetCPVBoxSize(0) / 2.0 ; 
+  lappsd[1] = geom->GetLeadToMicro2Gap() / 2.0 ; 
+  lappsd[2] = geom->GetCPVBoxSize(2) / 2.0 ;
 
   gMC->Gsvolu("PLAPPS", "BOX ", idtmed[798], lappsd, 3) ; 
     
-  y0 = y0 - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap()  / 2. ; 
+  y0 = y0 - geom->GetLeadConverterThickness() / 2. - geom->GetLeadToMicro2Gap()  / 2. ; 
   
   gMC->Gspos("PLAPPS", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; 
    
@@ -1229,63 +1247,65 @@ void AliPHOSv0::CreateGeometryforCPV()
 
   // Get pointer to the array containing media indexes
   Int_t *idtmed = fIdtmed->GetArray() - 699 ;
-  
+
+  AliPHOSGeometry * geom = GetGeometry() ; 
+
   // 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 ;
+  par[0] = geom->GetCPVBoxSize(0) / 2.0 ;  
+  par[1] = geom->GetCPVBoxSize(1) / 2.0 ; 
+  par[2] = geom->GetCPVBoxSize(2) / 2.0 ;
   gMC->Gsvolu("PCPV", "BOX ", idtmed[798], par, 3) ;
   
-  y = fGeom->GetOuterBoxSize(1) / 2.0 ;
+  y = geom->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.;
+  par[0] = geom->GetGassiplexChipSize(0)/2.;
+  par[1] = geom->GetGassiplexChipSize(1)/2.;
+  par[2] = geom->GetGassiplexChipSize(2)/2.;
   gMC->Gsvolu("PCPC","BOX ",idtmed[707],par,3);
   
   // Cu+Ni foil covers Gassiplex board
 
-  par[1] = fGeom->GetCPVCuNiFoilThickness()/2;
+  par[1] = geom->GetCPVCuNiFoilThickness()/2;
   gMC->Gsvolu("PCPD","BOX ",idtmed[710],par,3);
-  y      = -(fGeom->GetGassiplexChipSize(1)/2 - par[1]);
+  y      = -(geom->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);
+  Float_t xStep = geom->GetCPVActiveSize(0) / (geom->GetNumberOfCPVChipsPhi() + 1);
+  Float_t zStep = geom->GetCPVActiveSize(1) / (geom->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++) {
+  y = geom->GetCPVFrameSize(1)/2           - geom->GetFTPosition(0) +
+    geom->GetCPVTextoliteThickness() / 2 + geom->GetGassiplexChipSize(1) / 2 + 0.1;
+  for (Int_t ix=0; ix<geom->GetNumberOfCPVChipsPhi(); ix++) {
+    x = xStep * (ix+1) - geom->GetCPVActiveSize(0)/2;
+    for (Int_t iz=0; iz<geom->GetNumberOfCPVChipsZ(); iz++) {
       copy++;
-      z = zStep * (iz+1) - fGeom->GetCPVActiveSize(1)/2;
+      z = zStep * (iz+1) - geom->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;
+  par[0] = geom->GetCPVActiveSize(0)        / 2;
+  par[1] = geom->GetCPVTextoliteThickness() / 2;
+  par[2] = geom->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;
+  par[1] = (geom->GetFTPosition(2) - geom->GetFTPosition(1) - geom->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;
+    y = geom->GetCPVFrameSize(1) / 2 - geom->GetFTPosition(i) + geom->GetCPVTextoliteThickness()/2;
     gMC->Gspos("PCPF",i+1,"PCPV",0,y,0,0,"ONLY");
     if(i==1){
-      y-= (fGeom->GetFTPosition(2) - fGeom->GetFTPosition(1)) / 2;
+      y-= (geom->GetFTPosition(2) - geom->GetFTPosition(1)) / 2;
       gMC->Gspos("PCPG",1,"PCPV ",0,y,0,0,"ONLY");
     }
   }
@@ -1298,27 +1318,27 @@ void AliPHOSv0::CreateGeometryforCPV()
 
   // Cu+Ni foil covers textolite
 
-  par[1] = fGeom->GetCPVCuNiFoilThickness() / 2;
+  par[1] = geom->GetCPVCuNiFoilThickness() / 2;
   gMC->Gsvolu("PCP1","BOX ",idtmed[710],par,3);
-  y = fGeom->GetCPVTextoliteThickness()/2 - par[1];
+  y = geom->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;
+  par[0] = geom->GetCPVFrameSize(0)/2;
+  par[1] = geom->GetCPVFrameSize(1)/2;
+  par[2] = geom->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;
+  par[0] = geom->GetCPVBoxSize(0)/2 - geom->GetCPVFrameSize(0);
+  par[1] = geom->GetCPVFrameSize(1)/2;
+  par[2] = geom->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;
+    x = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(0) - geom->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;
+    z = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(2) - geom->GetCPVFrameSize(2)) / 2;
     gMC->Gspos("PCF2",j+1,"PCPV",0, 0,z,0,"ONLY");
   }
 
@@ -1346,99 +1366,101 @@ void AliPHOSv0::CreateGeometryforSupport()
   // Get pointer to the array containing media indexes
   Int_t *idtmed = fIdtmed->GetArray() - 699 ;
 
+  AliPHOSGeometry * geom = GetGeometry() ; 
+
   // --- 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 ;
+  par[0] =  geom->GetRailRoadSize(0) / 2.0 ;
+  par[1] =  geom->GetRailRoadSize(1) / 2.0 ;
+  par[2] =  geom->GetRailRoadSize(2) / 2.0 ;
   gMC->Gsvolu("PRRD", "BOX ", idtmed[798], par, 3) ;
 
-  y0     = -(fGeom->GetRailsDistanceFromIP() - fGeom->GetRailRoadSize(1) / 2.0) ;
+  y0     = -(geom->GetRailsDistanceFromIP() - geom->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 ;
+  par[0] =  geom->GetRailOuterSize(0) / 2.0 ;
+  par[1] =  geom->GetRailOuterSize(1) / 2.0 ;
+  par[2] =  geom->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 ;
+    x0     = (2*i-1) * geom->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 ;
+  par[0] =  geom->GetRailPart1(0) / 2.0 ;
+  par[1] =  geom->GetRailPart1(1) / 2.0 ;
+  par[2] =  geom->GetRailPart1(2) / 2.0 ;
   gMC->Gsvolu("PRP1", "BOX ", idtmed[716], par, 3) ;
 
-  y0     = - (fGeom->GetRailOuterSize(1) - fGeom->GetRailPart1(1))  / 2.0 ;
+  y0     = - (geom->GetRailOuterSize(1) - geom->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);
+  y0     =   (geom->GetRailOuterSize(1) - geom->GetRailPart1(1))  / 2.0 - geom->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 ;
+  par[0] =  geom->GetRailPart2(0) / 2.0 ;
+  par[1] =  geom->GetRailPart2(1) / 2.0 ;
+  par[2] =  geom->GetRailPart2(2) / 2.0 ;
   gMC->Gsvolu("PRP2", "BOX ", idtmed[716], par, 3) ;
 
-  y0     =   - fGeom->GetRailPart3(1) / 2.0 ;
+  y0     =   - geom->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 ;
+  par[0] =  geom->GetRailPart3(0) / 2.0 ;
+  par[1] =  geom->GetRailPart3(1) / 2.0 ;
+  par[2] =  geom->GetRailPart3(2) / 2.0 ;
   gMC->Gsvolu("PRP3", "BOX ", idtmed[716], par, 3) ;
 
-  y0     =   (fGeom->GetRailOuterSize(1) - fGeom->GetRailPart3(1))  / 2.0 ;
+  y0     =   (geom->GetRailOuterSize(1) - geom->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) ;
+                       TMath::Power((geom->GetIPtoOuterCoverDistance() + geom->GetOuterBoxSize(1)),2) +
+                       TMath::Power((geom->GetOuterBoxSize(0)/2),2)) + 10.;
+  par[0] =  par[1] - geom->GetCradleWall(1) ;
+  par[2] =  geom->GetCradleWall(2) / 2.0 ;
+  par[3] =  geom->GetCradleWall(3) ;
+  par[4] =  geom->GetCradleWall(4) ;
   gMC->Gsvolu("PCRA", "TUBS", idtmed[716], par, 5) ;
 
-  par[0] -=  fGeom->GetCradleWallThickness() ;
-  par[1] -=  fGeom->GetCradleWallThickness() ;
-  par[2] -=  fGeom->GetCradleWallThickness() ;
+  par[0] -=  geom->GetCradleWallThickness() ;
+  par[1] -=  geom->GetCradleWallThickness() ;
+  par[2] -=  geom->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 ;
+    z0 = (2*i-1) * (geom->GetOuterBoxSize(2) + geom->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;
+  par[0] = geom->GetCradleWheel(0) / 2;
+  par[1] = geom->GetCradleWheel(1) / 2;
+  par[2] = geom->GetCradleWheel(2) / 2;
   gMC->Gsvolu("PWHE", "BOX ", idtmed[716], par, 3) ;
 
-  y0 = -(fGeom->GetRailsDistanceFromIP() - fGeom->GetRailRoadSize(1) -
-        fGeom->GetCradleWheel(1)/2) ;
+  y0 = -(geom->GetRailsDistanceFromIP() - geom->GetRailRoadSize(1) -
+        geom->GetCradleWheel(1)/2) ;
   for (i=0; i<2; i++) {
-    z0 = (2*i-1) * ((fGeom->GetOuterBoxSize(2) + fGeom->GetCradleWheel(2)) / 2.0 +
-                    fGeom->GetCradleWall(2));
+    z0 = (2*i-1) * ((geom->GetOuterBoxSize(2) + geom->GetCradleWheel(2)) / 2.0 +
+                    geom->GetCradleWall(2));
     for (j=0; j<2; j++) {
       copy = 2*i + j;
-      x0 = (2*j-1) * fGeom->GetDistanceBetwRails()  / 2.0 ;
+      x0 = (2*j-1) * geom->GetDistanceBetwRails()  / 2.0 ;
       gMC->Gspos("PWHE", copy, "ALIC", x0, y0, z0, 0, "ONLY") ; 
     }
   }
@@ -1450,7 +1472,10 @@ 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);
+
+  AliPHOSGeometry * geom = GetGeometry() ; 
+
+  return -geom->GetOuterBoxSize(2);
 }
 
 //____________________________________________________________________________
@@ -1458,7 +1483,10 @@ 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);
+
+  AliPHOSGeometry * geom = GetGeometry() ; 
+
+  return  geom->GetOuterBoxSize(2);
 }
 
 //____________________________________________________________________________
@@ -1477,9 +1505,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 ;
+
+    AliPHOSGeometry * geom = GetGeometry() ; 
+
+    if (geom!=0)  
+      cout << "AliPHOS" << Version() << " : PHOS geometry intialized for " << geom->GetName() << endl ;
     else
       cout << "AliPHOS" << Version() << " : PHOS geometry initialization failed !" << endl ;   
     
index 6d861c6fd27a0d3493f354a735ed40126aef39ca..a0d0e7f9040714013099645c37a121ddb6b72204 100644 (file)
@@ -13,6 +13,7 @@
 // --- ROOT system ---
 
 class TFile;
+class TFolder;
 
 // --- AliRoot header files ---
 #include "AliPHOS.h"
@@ -21,10 +22,7 @@ class AliPHOSv0 : public AliPHOS {
 
  public:
 
-  AliPHOSv0() {
-    //ctor
-    fGeom=0;
-  }
+  AliPHOSv0() {}
   AliPHOSv0(const char *name, const char *title="") ;
   AliPHOSv0(const AliPHOSv0 & phos) {
     // cpy ctor: no implementation yet
@@ -51,11 +49,7 @@ class AliPHOSv0 : public AliPHOS {
   virtual Float_t ZMin() const;                    // overall dimension of the module (min)
   virtual Float_t ZMax() const;                    // overall dimension of the module (max)
 
-  virtual AliPHOSGeometry * GetGeometry() const {
-    // gets the pointer to the AliPHOSGeometry unique instance  
-    return fGeom ; 
-  }  
-  virtual void   Init(void) ;                                       // does nothing
+  virtual void   Init(void) ;                      // does nothing
   virtual Int_t  IsVersion(void) const { 
     // Gives the version number 
     return 0 ; 
@@ -73,8 +67,7 @@ class AliPHOSv0 : public AliPHOS {
   
  protected:
   
-  AliPHOSGeometry * fGeom ;                       // Geometry definition
-  
+
   ClassDef(AliPHOSv0,1)  // Implementation of PHOS manager class for layout EMC+PPSD
     
     };
index bbe53bef6b1fc9892fe4dce98ccfe01c9ba86514..582d834f6f62cf0a7216f89031244904b08a336c 100644 (file)
@@ -96,7 +96,7 @@ AliPHOSv1::AliPHOSv1(const char *name, const char *title):
 
   fIshunt     =  1 ; // All hits are associated with primary particles
 
-  Int_t nb   = fGeom->GetNModules() ; 
+  Int_t nb   = GetGeometry()->GetNModules() ; 
   
   // create checkables 
   fQAHitsMul   = new AliPHOSQAIntCheckable("HitsM") ; 
@@ -112,14 +112,6 @@ AliPHOSv1::AliPHOSv1(const char *name, const char *title):
     new( (*fQATotEnerB)[i] ) AliPHOSQAFloatCheckable(tempo) ;
   }
 
-  // create checkers 
-  // the container (QAChecker()) owns and deletes this local checker (see Hara-Kiri)
-  // the local checker can be accessed by 
-  // AliPHOSQAChecker * phos = 
-  //  (AliPHOSQAChecker*)(gROOT->GetListOfBrowsables()->FindObject("YSALICE")->FindObject("tasks/QA/PHOS"))
-  // AliPHOSQAMeanChecker * ch = (AliPHOSQAMeanChecker*)(phos->FindObject("QAHitsMul"))
-  // or directly from the root/Tasks folder 
-
   AliPHOSQAMeanChecker * hmc  = new AliPHOSQAMeanChecker("HitsMul", 100. ,25.) ; 
   AliPHOSQAMeanChecker * emc  = new AliPHOSQAMeanChecker("TotEner", 10. ,5.) ; 
   AliPHOSQAMeanChecker * bhmc = new AliPHOSQAMeanChecker("HitsMulB", 100. ,5.) ; 
@@ -157,6 +149,7 @@ void AliPHOSv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t Id,
   AliPHOSHit *newHit ;
   AliPHOSHit *curHit ;
   Bool_t deja = kFALSE ;
+  AliPHOSGeometry * geom = GetGeometry() ; 
 
   newHit = new AliPHOSHit(shunt, primary, tracknumber, Id, hits) ;
 
@@ -172,8 +165,8 @@ void AliPHOSv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t Id,
   if ( !deja ) {
     new((*fHits)[fNhits]) AliPHOSHit(*newHit) ;
     // get the block Id number
-    Int_t * relid = new Int_t[fGeom->GetNModules()] ; 
-    fGeom->AbsToRelNumbering(Id, relid) ;
+    Int_t * relid = new Int_t[geom->GetNModules()] ; 
+    geom->AbsToRelNumbering(Id, relid) ;
     // and fill the relevant QA checkable (only if in PbW04)
     if ( relid[1] == 0 ) {
       fQAHitsMul->Update(1) ; 
@@ -213,7 +206,7 @@ void AliPHOSv1::FinishEvent()
   
   Int_t i ; 
   if ( fQAHitsMulB && fQATotEnerB ) {
-    for (i = 0 ; i <  fGeom->GetNModules() ; i++) {
+    for (i = 0 ; i < GetGeometry()->GetNModules() ; i++) {
       AliPHOSQAIntCheckable * ci = (AliPHOSQAIntCheckable*)(*fQAHitsMulB)[i] ;  
       AliPHOSQAFloatCheckable* cf = (AliPHOSQAFloatCheckable*)(*fQATotEnerB)[i] ; 
       if ( ci->HasChanged() ) { 
@@ -250,7 +243,7 @@ void AliPHOSv1::StepManager(void)
 
   Int_t tracknumber =  gAlice->CurrentTrack() ; 
   Int_t primary     =  gAlice->GetPrimary( gAlice->CurrentTrack() ); 
-  TString name      =  fGeom->GetName() ; 
+  TString name      =  GetGeometry()->GetName() ; 
 
 
   if ( name == "GPS2" || name == "MIXT" ) {            // ======> CPV is a GPS' PPSD
@@ -266,17 +259,17 @@ void AliPHOSv1::StepManager(void)
       if ( xyze[3] != 0 ) { // there is deposited energy 
                gMC->CurrentVolOffID(5, relid[0]) ;  // get the PHOS Module number
        if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(5),"PHO1") == 0 ){
-         relid[0] += fGeom->GetNModules() - fGeom->GetNPPSDModules();
+         relid[0] += GetGeometry()->GetNModules() - GetGeometry()->GetNPPSDModules();
        }
                gMC->CurrentVolOffID(3, relid[1]) ;  // get the Micromegas Module number 
-      // 1-> fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper
-      //   > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower
+      // 1-> GetGeometry()->GetNumberOfModulesPhi() * GetGeometry()->GetNumberOfModulesZ() upper
+      //   > GetGeometry()->GetNumberOfModulesPhi() * GetGeometry()->GetNumberOfModulesZ() lower
                gMC->CurrentVolOffID(1, relid[2]) ;  // get the row number of the cell
         gMC->CurrentVolID(relid[3]) ;        // get the column number 
 
        // get the absolute Id number
 
-               fGeom->RelToAbsNumbering(relid, absid) ; 
+               GetGeometry()->RelToAbsNumbering(relid, absid) ; 
 
        // add current hit to the hit list      
          AddHit(fIshunt, primary, tracknumber, absid, xyze);
@@ -364,7 +357,7 @@ void AliPHOSv1::StepManager(void)
        relid[3] = cpvDigit->GetYpad() ;                          // row    number of a pad
        
        // get the absolute Id number
-       fGeom->RelToAbsNumbering(relid, absid) ; 
+       GetGeometry()->RelToAbsNumbering(relid, absid) ; 
 
        // add current digit to the temporary hit list
        xyze[0] = 0. ;
@@ -402,14 +395,14 @@ void AliPHOSv1::StepManager(void)
       ((AliPHOSQAFloatCheckable*)(*fQATotEnerB)[relid[0]-1])->Update( xyze[3] ) ; // energy in this block  
 
       if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(10),"PHO1") == 0 )
-       relid[0] += fGeom->GetNModules() - fGeom->GetNPPSDModules();      
+       relid[0] += GetGeometry()->GetNModules() - GetGeometry()->GetNPPSDModules();      
 
       relid[1] = 0   ;                    // means PBW04
       gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
       gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
       
       // get the absolute Id number
-      fGeom->RelToAbsNumbering(relid, absid) ; 
+      GetGeometry()->RelToAbsNumbering(relid, absid) ; 
 
       // add current hit to the hit list
        AddHit(fIshunt, primary,tracknumber, absid, xyze);
@@ -432,7 +425,7 @@ void AliPHOSv1::CPVDigitize (TLorentzVector p, Float_t *zxhit, Int_t moduleNumbe
   // 2 October 2000
   // ------------------------------------------------------------------------
 
-  const Float_t kCelWr  = fGeom->GetPadSizePhi()/2;  // Distance between wires (2 wires above 1 pad)
+  const Float_t kCelWr  = GetGeometry()->GetPadSizePhi()/2;  // Distance between wires (2 wires above 1 pad)
   const Float_t kDetR   = 0.1;     // Relative energy fluctuation in track for 100 e-
   const Float_t kdEdx   = 4.0;     // Average energy loss in CPV;
   const Int_t   kNgamz  = 5;       // Ionization size in Z
@@ -455,13 +448,13 @@ void AliPHOSv1::CPVDigitize (TLorentzVector p, Float_t *zxhit, Int_t moduleNumbe
 
 //    cout << "CPVDigitize: YVK : "<<hitX<<" "<<hitZ<<" | "<<pX<<" "<<pZ<<" "<<pNorm<<endl;
 
-  Float_t dZY   = pZ/pNorm * fGeom->GetCPVGasThickness();
-  Float_t dXY   = pX/pNorm * fGeom->GetCPVGasThickness();
+  Float_t dZY   = pZ/pNorm * GetGeometry()->GetCPVGasThickness();
+  Float_t dXY   = pX/pNorm * GetGeometry()->GetCPVGasThickness();
   gRandom->Rannor(rnor1,rnor2);
   eloss *= (1 + kDetR*rnor1) *
-           TMath::Sqrt((1 + ( pow(dZY,2) + pow(dXY,2) ) / pow(fGeom->GetCPVGasThickness(),2)));
-  Float_t zhit1 = hitZ + fGeom->GetCPVActiveSize(1)/2 - dZY/2;
-  Float_t xhit1 = hitX + fGeom->GetCPVActiveSize(0)/2 - dXY/2;
+           TMath::Sqrt((1 + ( pow(dZY,2) + pow(dXY,2) ) / pow(GetGeometry()->GetCPVGasThickness(),2)));
+  Float_t zhit1 = hitZ + GetGeometry()->GetCPVActiveSize(1)/2 - dZY/2;
+  Float_t xhit1 = hitX + GetGeometry()->GetCPVActiveSize(0)/2 - dXY/2;
   Float_t zhit2 = zhit1 + dZY;
   Float_t xhit2 = xhit1 + dXY;
 
@@ -521,8 +514,8 @@ void AliPHOSv1::CPVDigitize (TLorentzVector p, Float_t *zxhit, Int_t moduleNumbe
 
   // Finite size of ionization region
 
-  Int_t nCellZ  = fGeom->GetNumberOfCPVPadsZ();
-  Int_t nCellX  = fGeom->GetNumberOfCPVPadsPhi();
+  Int_t nCellZ  = GetGeometry()->GetNumberOfCPVPadsZ();
+  Int_t nCellX  = GetGeometry()->GetNumberOfCPVPadsPhi();
   Int_t nz3     = (kNgamz+1)/2;
   Int_t nx3     = (kNgamx+1)/2;
   cpvDigits->Expand(nIter*kNgamx*kNgamz);
@@ -533,8 +526,8 @@ void AliPHOSv1::CPVDigitize (TLorentzVector p, Float_t *zxhit, Int_t moduleNumbe
     Float_t zhit = zxe[0][iter];
     Float_t xhit = zxe[1][iter];
     Float_t qhit = zxe[2][iter];
-    Float_t zcell = zhit / fGeom->GetPadSizeZ();
-    Float_t xcell = xhit / fGeom->GetPadSizePhi();
+    Float_t zcell = zhit / GetGeometry()->GetPadSizeZ();
+    Float_t xcell = xhit / GetGeometry()->GetPadSizePhi();
     if ( zcell<=0      || xcell<=0 ||
         zcell>=nCellZ || xcell>=nCellX) return;
     Int_t izcell = (Int_t) zcell;
@@ -571,10 +564,10 @@ Float_t AliPHOSv1::CPVPadResponseFunction(Float_t qhit, Float_t zhit, Float_t xh
   // 3 October 2000
   // ------------------------------------------------------------------------
 
-  Double_t dz = fGeom->GetPadSizeZ()   / 2;
-  Double_t dx = fGeom->GetPadSizePhi() / 2;
-  Double_t z  = zhit * fGeom->GetPadSizeZ();
-  Double_t x  = xhit * fGeom->GetPadSizePhi();
+  Double_t dz = GetGeometry()->GetPadSizeZ()   / 2;
+  Double_t dx = GetGeometry()->GetPadSizePhi() / 2;
+  Double_t z  = zhit * GetGeometry()->GetPadSizeZ();
+  Double_t x  = xhit * GetGeometry()->GetPadSizePhi();
   Double_t amplitude = qhit *
     (CPVCumulPadResponse(z+dz,x+dx) - CPVCumulPadResponse(z+dz,x-dx) -
      CPVCumulPadResponse(z-dz,x+dx) + CPVCumulPadResponse(z-dz,x-dx));
index fd0596cad079ab520add0743250697b6589dfb01..caf5cc82decaa24be50e5742673b447d2ffcbf0f 100644 (file)
@@ -121,7 +121,7 @@ void AliPHOSv3::StepManager(void)
   
   Int_t tracknumber =  gAlice->CurrentTrack() ; 
   Int_t primary     =  gAlice->GetPrimary( gAlice->CurrentTrack() ); 
-  TString name      =  fGeom->GetName() ; 
+  TString name      =  GetGeometry()->GetName() ; 
   Float_t        lostenergy ;
   //Double_t       lostenergy ;
   Float_t        global[3] ;
@@ -141,17 +141,17 @@ void AliPHOSv3::StepManager(void)
       if ( xyze[3] != 0) { // there is deposited energy 
                gMC->CurrentVolOffID(5, relid[0]) ;  // get the PHOS Module number
        if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(5),"PHO1") == 0 ){
-         relid[0] += fGeom->GetNModules() - fGeom->GetNPPSDModules();
+         relid[0] += GetGeometry()->GetNModules() - GetGeometry()->GetNPPSDModules();
        }
                gMC->CurrentVolOffID(3, relid[1]) ;  // get the Micromegas Module number 
-      // 1-> fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper
-      //   > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower
+      // 1-> GetGeometry()->GetNumberOfModulesPhi() * GetGeometry()->GetNumberOfModulesZ() upper
+      //   > GetGeometry()->GetNumberOfModulesPhi() * GetGeometry()->GetNumberOfModulesZ() lower
                gMC->CurrentVolOffID(1, relid[2]) ;  // get the row number of the cell
         gMC->CurrentVolID(relid[3]) ;        // get the column number 
 
        // get the absolute Id number
 
-               fGeom->RelToAbsNumbering(relid, absid) ; 
+               GetGeometry()->RelToAbsNumbering(relid, absid) ; 
 
        // add current hit to the hit list      
          AddHit(fIshunt, primary, tracknumber, absid, xyze);
@@ -239,7 +239,7 @@ void AliPHOSv3::StepManager(void)
        relid[3] = cpvDigit->GetYpad() ;                          // row    number of a pad
        
        // get the absolute Id number
-       fGeom->RelToAbsNumbering(relid, absid) ; 
+       GetGeometry()->RelToAbsNumbering(relid, absid) ; 
 
        // add current digit to the temporary hit list
        xyze[0] = 0. ;
@@ -277,7 +277,7 @@ if(gMC->CurrentVolID(copy)==gMC->VolId("PXTL")){// We are inside a PBWO4 crystal
       gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
 
       if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(10),"PHO1") == 0 )
-       relid[0] += fGeom->GetNModules() - fGeom->GetNPPSDModules();      
+       relid[0] += GetGeometry()->GetNModules() - GetGeometry()->GetNPPSDModules();      
 
       relid[1] = 0   ;                    // means PBW04
    gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
@@ -285,7 +285,7 @@ if(gMC->CurrentVolID(copy)==gMC->VolId("PXTL")){// We are inside a PBWO4 crystal
       
       // get the absolute Id number
 
-      fGeom->RelToAbsNumbering(relid, absid) ; 
+      GetGeometry()->RelToAbsNumbering(relid, absid) ; 
 
       gMC->Gmtod(global, local, 1) ;
 
@@ -296,14 +296,14 @@ if(gMC->CurrentVolID(copy)==gMC->VolId("PXTL")){// We are inside a PBWO4 crystal
 
  //calculate the number of electrons produced in the PIN due to this energy
 
- //nElectrons = apdgain * lostenergy * lightyield * fIntrinsicPINEfficiency *exp(-fLightYieldAttenuation * (local[1]+fGeom->GetCrystalSize(1)/2.0 ) ) ;
+ //nElectrons = apdgain * lostenergy * lightyield * fIntrinsicPINEfficiency *exp(-fLightYieldAttenuation * (local[1]+GetGeometry()->GetCrystalSize(1)/2.0 ) ) ;
 
-  xyze[3] = (fRecalibrationFactor/100.) * apdgain * lostenergy * lightyield * fIntrinsicPINEfficiency *exp(-fLightYieldAttenuation * (local[1]+fGeom->GetCrystalSize(1)/2.0 ) ) ;
+  xyze[3] = (fRecalibrationFactor/100.) * apdgain * lostenergy * lightyield * fIntrinsicPINEfficiency *exp(-fLightYieldAttenuation * (local[1]+GetGeometry()->GetCrystalSize(1)/2.0 ) ) ;
     
    //cout<<"xyze[3]:    "<<xyze[3]<<   endl;
    //cout<<"lostenergy: "<<lostenergy<<endl; 
 
- //nElectrons = lostenergy * lightyield * fIntrinsicPINEfficiency *exp(-fLightYieldAttenuation * (local[1]+fGeom->GetCrystalSize(1)/2.0 ) ) ;
+ //nElectrons = lostenergy * lightyield * fIntrinsicPINEfficiency *exp(-fLightYieldAttenuation * (local[1]+GetGeometry()->GetCrystalSize(1)/2.0 ) ) ;
 
         //xyze[3] = nElectrons * fRecalibrationFactor/10000. ;
 
@@ -336,7 +336,7 @@ if(gMC->CurrentVolID(copy)==gMC->VolId("PXTL")){// We are inside a PBWO4 crystal
        // get the absolute Id number
        
        Int_t absid ; 
-       fGeom->RelToAbsNumbering(relid,absid) ;
+       GetGeometry()->RelToAbsNumbering(relid,absid) ;
        gMC->Gmtod(global, local, 1) ;
 
 // calculating number of electrons in the PIN diode asociated to this hit
index c932cef923bb42bd7ea2ab906814f245bbf5f02e..af2c438f29cf81e615088b1e3ae90dd56d5f52e7 100644 (file)
@@ -55,12 +55,12 @@ AliPHOSv4::AliPHOSv4(const char *name, const char *title):
 
   // gets an instance of the geometry parameters class  
   if (strcmp(GetTitle(),"") != 0 ) 
-    fGeom =  AliPHOSGeometry::GetInstance(GetTitle(), "") ; 
+    fGeom = AliPHOSGeometry::GetInstance(GetTitle(), "") ; 
      
     
-    SetBigBox(0, fGeom->GetOuterBoxSize(0) ) ;
-    SetBigBox(1, fGeom->GetOuterBoxSize(1) + fGeom->GetCPVBoxSize(1) ) ; 
-    SetBigBox(2, fGeom->GetOuterBoxSize(0) ); 
+    SetBigBox(0, GetGeometry()->GetOuterBoxSize(0) ) ;
+    SetBigBox(1, GetGeometry()->GetOuterBoxSize(1) + GetGeometry()->GetCPVBoxSize(1) ) ; 
+    SetBigBox(2, GetGeometry()->GetOuterBoxSize(0) ); 
     
     fNRecParticles = 0 ; 
     fFastRecParticles = new AliPHOSFastRecParticle::FastRecParticlesList("AliPHOSFastRecParticle", 100) ;
@@ -128,17 +128,17 @@ void AliPHOSv4::BuildGeometry()
   
   // position PHOS into ALICE
 
-  Float_t r = fGeom->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ;
+  Float_t r = GetGeometry()->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ;
   Int_t number = 988 ; 
-  Float_t pphi =  TMath::ATan( GetBigBox(0)  / ( 2.0 * fGeom->GetIPtoCrystalSurface() ) ) ;
+  Float_t pphi =  TMath::ATan( GetBigBox(0)  / ( 2.0 * GetGeometry()->GetIPtoCrystalSurface() ) ) ;
   pphi *= kRADDEG ;
   TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
  
   char * nodename = new char[20] ;  
   char * rotname  = new char[20] ; 
 
-  for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { 
-   Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ;
+  for( Int_t i = 1; i <= GetGeometry()->GetNModules(); i++ ) { 
+   Float_t angle = pphi * 2 * ( i - GetGeometry()->GetNModules() / 2.0 - 0.5 ) ;
    sprintf(rotname, "%s%d", "rot", number++) ;
    new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
    top->cd();
@@ -182,12 +182,12 @@ void AliPHOSv4::CreateGeometry()
   Int_t idrotm[99] ;
   Double_t const kRADDEG = 180.0 / kPI ;
   
-  for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
+  for( Int_t i = 1; i <= GetGeometry()->GetNModules(); i++ ) {
     
-    Float_t angle = fGeom->GetPHOSAngle(i) ;
+    Float_t angle = GetGeometry()->GetPHOSAngle(i) ;
     AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
  
-    Float_t r = fGeom->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ;
+    Float_t r = GetGeometry()->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ;
 
     Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
     Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
@@ -309,7 +309,7 @@ void AliPHOSv4::MakeRecParticle(const Int_t modid, const TVector3 pos, AliPHOSFa
   // get the angle of incidence 
   
   Double_t incidencetheta = 90. * TMath::Pi() /180 - rp.Theta() ; 
-  Double_t incidencephi   = ( 270 + fGeom->GetPHOSAngle(modid) ) * TMath::Pi() / 180. - rp.Phi() ;   
+  Double_t incidencephi   = ( 270 + GetGeometry()->GetPHOSAngle(modid) ) * TMath::Pi() / 180. - rp.Phi() ;   
 
   // get the detected direction
   
index 8ba06b91444ad204b5c01ac1b92b1dfccda9f38e..79c1deb89c53f7df93e05a303af6ff00d8fa65b9 100644 (file)
@@ -50,10 +50,6 @@ public:
   virtual void   BuildGeometry(void) ;                               // creates the geometry for the ROOT display
   virtual void   CreateGeometry(void) ;                              // creates the geometry for GEANT
   Float_t        GetBigBox(Int_t index) const;                             
-  virtual AliPHOSGeometry * GetGeometry() const {
-    // gets the pointer to the AliPHOSGeometry unique instance  
-    return fGeom ; 
-  }  
   virtual void   Init(void) ;                                        // does nothing
   virtual Int_t  IsVersion(void) const {
     // Gives the version number 
@@ -91,7 +87,6 @@ private:
   Float_t fBigBoxY ;                         // main box containing all PHOS (EMC+PPSD)
   Float_t fBigBoxZ ;                         // main box containing all PHOS (EMC+PPSD)
   TClonesArray * fFastRecParticles ;         // list of particles modified by the response function 
-  AliPHOSGeometry * fGeom ;                  // geometry definition
   Int_t fNRecParticles ;                     // number of detected particles
   TRandom fRan ;                             // random number generator
   Double_t fResPara1 ;                       // parameter for the energy resolution dependence  
index 2e3202476acf8da7ce7a61467e75f10f9edb0d7b..1e0a0ea8936a395462c93986aafc7b46a4d21d03 100644 (file)
@@ -59,16 +59,16 @@ AliPHOSvFast::AliPHOSvFast(const char *name, const char *title):
 
   // gets an instance of the geometry parameters class  
    
-  fGeom =  AliPHOSGeometry::GetInstance(title, "") ; 
+  fGeom = AliPHOSGeometry::GetInstance(title, "") ; 
 
-  if (fGeom->IsInitialized() ) 
-    cout << "AliPHOSvFast : PHOS geometry intialized for " << fGeom->GetName() << endl ;
+  if (GetGeometry()->IsInitialized() ) 
+    cout << "AliPHOSvFast : PHOS geometry intialized for " << GetGeometry()->GetName() << endl ;
   else
     cout << "AliPHOSvFast : PHOS geometry initialization failed !" << endl ;   
   
-  SetBigBox(0, fGeom->GetOuterBoxSize(0) ) ;
-  SetBigBox(1, fGeom->GetOuterBoxSize(1) + fGeom->GetCPVBoxSize(1) ) ; 
-  SetBigBox(2, fGeom->GetOuterBoxSize(0) ); 
+  SetBigBox(0, GetGeometry()->GetOuterBoxSize(0) ) ;
+  SetBigBox(1, GetGeometry()->GetOuterBoxSize(1) + GetGeometry()->GetCPVBoxSize(1) ) ; 
+  SetBigBox(2, GetGeometry()->GetOuterBoxSize(0) ); 
 
   fNRecParticles = 0 ; 
   fFastRecParticles = new AliPHOSFastRecParticle::FastRecParticlesList("AliPHOSFastRecParticle", 100) ;
@@ -136,17 +136,17 @@ void AliPHOSvFast::BuildGeometry()
   
   // position PHOS into ALICE
 
-  Float_t r = fGeom->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ;
+  Float_t r = GetGeometry()->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ;
   Int_t number = 988 ; 
-  Float_t pphi =  TMath::ATan( GetBigBox(0)  / ( 2.0 * fGeom->GetIPtoCrystalSurface() ) ) ;
+  Float_t pphi =  TMath::ATan( GetBigBox(0)  / ( 2.0 * GetGeometry()->GetIPtoCrystalSurface() ) ) ;
   pphi *= kRADDEG ;
   TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
  
   char * nodename = new char[20] ;  
   char * rotname  = new char[20] ; 
 
-  for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { 
-   Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ;
+  for( Int_t i = 1; i <= GetGeometry()->GetNModules(); i++ ) { 
+   Float_t angle = pphi * 2 * ( i - GetGeometry()->GetNModules() / 2.0 - 0.5 ) ;
    sprintf(rotname, "%s%d", "rot", number++) ;
    new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
    top->cd();
@@ -190,12 +190,12 @@ void AliPHOSvFast::CreateGeometry()
   Int_t idrotm[99] ;
   Double_t const kRADDEG = 180.0 / kPI ;
   
-  for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
+  for( Int_t i = 1; i <= GetGeometry()->GetNModules(); i++ ) {
     
-    Float_t angle = fGeom->GetPHOSAngle(i) ;
+    Float_t angle = GetGeometry()->GetPHOSAngle(i) ;
     AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
  
-    Float_t r = fGeom->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ;
+    Float_t r = GetGeometry()->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ;
 
     Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
     Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
@@ -317,7 +317,7 @@ void AliPHOSvFast::MakeRecParticle(const Int_t modid, const TVector3 pos, AliPHO
   // get the angle of incidence 
   
   Double_t incidencetheta = 90. * TMath::Pi() /180 - rp.Theta() ; 
-  Double_t incidencephi   = ( 270 + fGeom->GetPHOSAngle(modid) ) * TMath::Pi() / 180. - rp.Phi() ;   
+  Double_t incidencephi   = ( 270 + GetGeometry()->GetPHOSAngle(modid) ) * TMath::Pi() / 180. - rp.Phi() ;   
 
   // get the detected direction
   
index 144cd1471ebdd264d065cec7b4cd969f8daf908b..d1232d798ba7928f304af8b9f49d2396687d9129 100644 (file)
@@ -41,7 +41,6 @@ public:
   virtual void   BuildGeometry(void) ;                               // creates the geometry for the ROOT display
   virtual void   CreateGeometry(void) ;                              // creates the geometry for GEANT
   Float_t        GetBigBox(Int_t index) ;                             
-  virtual AliPHOSGeometry * GetGeometry() { return fGeom ; }  
   virtual void   Init(void) ;                                        // does nothing
   Int_t   IsVersion(void) const { return -1 ; }
   void    MakeBranch(Option_t* opt, const char *file=0) ;
@@ -72,7 +71,6 @@ private:
   Float_t fBigBoxY ;                         // main box containing all PHOS (EMC+PPSD)
   Float_t fBigBoxZ ;                         // main box containing all PHOS (EMC+PPSD)
   TClonesArray * fFastRecParticles ;         // list of particles modified by the response function 
-  AliPHOSGeometry * fGeom ;                  // geometry definition
   Int_t fNRecParticles ;                     // number of detected particles
   TRandom fRan ;                             // random number generator
   Double_t fResPara1 ;                       // parameter for the energy resolution dependence  
index bbdcddca7069bd41c592b19ddfefcad955bc21ac..8d888eda690638ac94e741c7936796a458b83344 100644 (file)
@@ -72,9 +72,9 @@ AliPHOSv1(name,title)
   fCPVImpacts  = new TList();
   fPPSDImpacts = new TList();
 
-  Int_t nPHOSModules = fGeom->GetNModules();
-  Int_t nCPVModules  = fGeom->GetNCPVModules();
-  Int_t nPPSDModules = fGeom->GetNPPSDModules();
+  Int_t nPHOSModules = GetGeometry()->GetNModules();
+  Int_t nCPVModules  = GetGeometry()->GetNCPVModules();
+  Int_t nPPSDModules = GetGeometry()->GetNPPSDModules();
 
   Int_t iPHOSModule;
   TClonesArray * impacts;
@@ -183,20 +183,20 @@ void AliPHOSvImpacts::ResetHits()
   AliDetector::ResetHits();
 
   Int_t i;
-  for (i=0; i<fGeom->GetNModules(); i++) {
+  for (i=0; i<GetGeometry()->GetNModules(); i++) {
     ((TClonesArray*)fEMCImpacts->At(i)) -> Clear();
     fNEMCImpacts[i] = 0 ;
   }
 
-  if ( strcmp(fGeom->GetName(),"IHEP") == 0 || strcmp(fGeom->GetName(),"MIXT") == 0 ) {
-    for (i=0; i<fGeom->GetNCPVModules(); i++) {
+  if ( strcmp(GetGeometry()->GetName(),"IHEP") == 0 || strcmp(GetGeometry()->GetName(),"MIXT") == 0 ) {
+    for (i=0; i<GetGeometry()->GetNCPVModules(); i++) {
       ((TClonesArray*)fCPVImpacts->At(i)) -> Clear();
       fNCPVImpacts[i] = 0 ;
     }
   }
 
-  if ( strcmp(fGeom->GetName(),"GPS2") == 0 || strcmp(fGeom->GetName(),"MIXT") == 0 ) {
-    for (i=0; i<fGeom->GetNPPSDModules(); i++) {
+  if ( strcmp(GetGeometry()->GetName(),"GPS2") == 0 || strcmp(GetGeometry()->GetName(),"MIXT") == 0 ) {
+    for (i=0; i<GetGeometry()->GetNPPSDModules(); i++) {
       ((TClonesArray*)fPPSDImpacts->At(i)) -> Clear();
       fNPPSDImpacts[i] = 0 ;
     }
@@ -219,7 +219,7 @@ void AliPHOSvImpacts::StepManager(void)
 
   Int_t tracknumber =  gAlice->CurrentTrack() ; 
   Int_t primary     =  gAlice->GetPrimary( gAlice->CurrentTrack() ); 
-  TString name      =  fGeom->GetName() ; 
+  TString name      =  GetGeometry()->GetName() ; 
 
   // Add impact to EMC
 
@@ -239,13 +239,13 @@ void AliPHOSvImpacts::StepManager(void)
     gMC -> Gmtod (pm,   pd,   2);    // transform 3-momentum from master to daughter system
 
     // Select tracks coming to the crystal from up or down sides
-    if (pd[1]<0 && xyzd[1] >  fGeom->GetCrystalSize(1)/2-0.001 ||
-       pd[1]>0 && xyzd[1] < -fGeom->GetCrystalSize(1)/2+0.001) {
+    if (pd[1]<0 && xyzd[1] >  GetGeometry()->GetCrystalSize(1)/2-0.001 ||
+       pd[1]>0 && xyzd[1] < -GetGeometry()->GetCrystalSize(1)/2+0.001) {
       Int_t pid = gMC->TrackPid();
       Int_t module;
       gMC->CurrentVolOffID(10,module);
       if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(10),"PHO1") == 0 )
-       module += fGeom->GetNModules() - fGeom->GetNPPSDModules();
+       module += GetGeometry()->GetNModules() - GetGeometry()->GetNPPSDModules();
       module--;
       AddImpact("EMC ",fIshunt, primary,tracknumber, module, pid, pmom, xyzm);
     }
@@ -292,8 +292,8 @@ void AliPHOSvImpacts::StepManager(void)
     gMC -> Gmtod (pm,   pd,   2);    // transform 3-momentum from master to daughter system
 
     // Select tracks coming to the crystal from up or down sides
-    if (pd[1]<0 && xyzd[1] >  (fGeom->GetConversionGap() +  fGeom->GetAvalancheGap())/2-0.001 ||
-       pd[1]>0 && xyzd[1] < -(fGeom->GetConversionGap() +  fGeom->GetAvalancheGap())/2+0.001) {
+    if (pd[1]<0 && xyzd[1] >  (GetGeometry()->GetConversionGap() +  GetGeometry()->GetAvalancheGap())/2-0.001 ||
+       pd[1]>0 && xyzd[1] < -(GetGeometry()->GetConversionGap() +  GetGeometry()->GetAvalancheGap())/2+0.001) {
       Int_t pid = gMC->TrackPid();
       Int_t module;
       gMC->CurrentVolOffID(5,module);