]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSv11.cxx
fix compilation
[u/mrichter/AliRoot.git] / ITS / AliITSv11.cxx
index b61f366fdc8a5903f0254307464cb3a2a9232980..a4a841dfae72c2df844d887b4db49ab515cba0b1 100644 (file)
@@ -1,5 +1,5 @@
 /**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
  * Author: The ALICE Off-line Project.                                    *
  * Contributors are mentioned in the code where appropriate.              *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.3  2003/01/28 17:59:54  nilsen
-Work continuing.
-
-Revision 1.2  2003/01/26 14:35:15  nilsen
-Some more geometry interface functions added and a start at the SSD support
-cone geometry. Committed to allow easy updates of partical work between authors.
-
-Revision 1.1  2003/01/20 23:32:49  nilsen
-New ITS geometry. Only a Skeleton for now.
-
-$Id$
-*/
-
-//////////////////////////////////////////////////////////////////////////////
-//                                                                          //
-//  Inner Traking System version 11                                         //
-//  This class contains the base procedures for the Inner Tracking System   //
-//                                                                          //
-// Authors: R. Barbera                                                      //
-// version 6.                                                               //
-// Created  2000.                                                           //
-//                                                                          //
-//  NOTE: THIS IS THE  SYMMETRIC PPR geometry of the ITS.                   //
-// THIS WILL NOT WORK                                                       //
-// with the geometry or module classes or any analysis classes. You are     //
-// strongly encouraged to uses AliITSv5.                                    //
-//                                                                          //
-//////////////////////////////////////////////////////////////////////////////
-// See AliITSv11::StepManager().
-#include <Riostream.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <TMath.h>
-#include <TGeometry.h>
-#include <TNode.h>
-#include <TTUBE.h>
-#include <TTUBS.h>
-#include <TPCON.h>
-#include <TFile.h>    // only required for Tracking function?
-#include <TCanvas.h>
-#include <TObjArray.h>
-#include <TLorentzVector.h>
-#include <TObjString.h>
-#include <TClonesArray.h>
-#include <TBRIK.h>
-#include <TSystem.h>
 
+/* $Id: */
+
+
+//========================================================================
+//
+//            Geometry of the Inner Tracking System
+//           ---------------------------------------
+//  This geometry is fully described in TGeo geometry (v11)
+// 
+// Ludovic Gaudichet  (gaudichet@to.infn.it)
+// Mario Sitta (sitta@to.infn.it)
+//
+//========================================================================
+
+
+// $Log$
+// Revision 1.1  2011/06/10 14:48:24  masera
+// First version from v11Hybrid to v11 (M. Sitta)
+//
+
+
+#include <TClonesArray.h>
+#include <TGeoGlobalMagField.h>
+#include <TGeoManager.h>
+#include <TGeoMatrix.h>
+#include <TGeoPhysicalNode.h>
+#include <TGeoVolume.h>
+#include <TGeoXtru.h>
+#include <TLorentzVector.h>
+#include <TString.h>
+#include <TVirtualMC.h>
 
-#include "AliRun.h"
-#include "AliMagF.h"
-#include "AliConst.h"
-#include "AliITSGeant3Geometry.h"
-#include "AliITShit.h"
 #include "AliITS.h"
-#include "AliITSv11.h"
-#include "AliITSgeom.h"
-#include "AliITSgeomSPD.h"
-#include "AliITSgeomSDD.h"
-#include "AliITSgeomSSD.h"
-#include "AliITSDetType.h"
-#include "AliITSresponseSPD.h"
-#include "AliITSresponseSDD.h"
-#include "AliITSresponseSSD.h"
-#include "AliITSsegmentationSPD.h"
+#include "AliITSDetTypeSim.h"
+#include "AliITShit.h"
+#include "AliITSCalibrationSDD.h"
 #include "AliITSsegmentationSDD.h"
+#include "AliITSsegmentationSPD.h"
 #include "AliITSsegmentationSSD.h"
-#include "AliITSsimulationSPD.h"
-#include "AliITSsimulationSDD.h"
-#include "AliITSsimulationSSD.h"
-#include "AliITSClusterFinderSPD.h"
-#include "AliITSClusterFinderSDD.h"
-#include "AliITSClusterFinderSSD.h"
+#include "AliITSv11.h"
+#include "AliLog.h"
+#include "AliMC.h"
+#include "AliMagF.h"
+#include "AliRun.h"
+#include "AliTrackReference.h"
+#include "AliITSv11GeometrySPD.h"
+#include "AliITSv11GeometrySDD.h"
+#include "AliITSv11GeometrySSD.h"
+#include "AliITSv11GeometrySupport.h"
+#include "AliGeomManager.h"
 
 
 ClassImp(AliITSv11)
 
 //______________________________________________________________________
-AliITSv11::AliITSv11() : AliITS() {
-    ////////////////////////////////////////////////////////////////////////
-    //    Standard default constructor for the ITS version 11.
-    ////////////////////////////////////////////////////////////////////////
-}
-//______________________________________________________________________
-AliITSv11::AliITSv11(const char *title) : AliITS("ITS", title){
-    ////////////////////////////////////////////////////////////////////////
-    //    Standard constructor for the ITS version 11.
-    ////////////////////////////////////////////////////////////////////////
-}
-//______________________________________________________________________
-AliITSv11::~AliITSv11() {
-    ////////////////////////////////////////////////////////////////////////
-    //    Standard destructor for the ITS version 11.
-    ////////////////////////////////////////////////////////////////////////
-}
-//______________________________________________________________________
-void AliITSv11::Box(const char gnam[3],const TString &dis,
-                   Double_t dx,Double_t dy,Double_t dz,Int_t med){
-    // Interface to TMC->Gsvolu() for ITS bos geometries. Box with faces
-    // perpendicular to the axes. It has 3 paramters. See SetScale() for
-    // units. Default units are geant 3 [cm].
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t dx         half-length of box in x-axis
-    //    Double_t dy         half-length of box in y-axis
-    //    Double_t dz         half-length of box in z-axis
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t param[3];
-
-    param[0] = fScale*dx;
-    param[1] = fScale*dy;
-    param[2] = fScale*dz;
-    name[0] = 'I';
-    for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"BOX ",fidmed[med],param,3);
-}
-//______________________________________________________________________
-void AliITSv11::Trapezoid1(const char gnam[3],const TString &dis,
-                          Double_t dxn,Double_t dxp,Double_t dy,Double_t dz,
-                          Int_t med){
-    // Interface to TMC->Gsvolu() for ITS TRD1 geometries. Trapezoid with the 
-    // x dimension varing along z. It has 4 parameters. See SetScale() for
-    // units. Default units are geant 3 [cm].
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t dxn        half-length along x at the z surface positioned 
-    //                        at -DZ
-    //    Double_t dxp        half-length along x at the z surface positioned 
-    //                        at +DZ
-    //    Double_t dy         half-length along the y-axis
-    //    Double_t dz         half-length along the z-axis
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t param[4];
-
-    param[0] = fScale*dxn;
-    param[1] = fScale*dxp;
-    param[2] = fScale*dy;
-    param[3] = fScale*dz;
-    name[0] = 'I';
-    for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"TRD1",fidmed[med],param,4);
-}
-//______________________________________________________________________
-void AliITSv11::Trapezoid2(const char gnam[3],const TString &dis,Double_t dxn,
-                          Double_t dxp,Double_t dyn,Double_t dyp,Double_t dz,
-                          Int_t med){
-    // Interface to TMC->Gsvolu() for ITS TRD2 geometries. Trapezoid with the 
-    // x and y dimension varing along z. It has 5 parameters. See SetScale() 
-    // for units. Default units are geant 3 [cm].
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t dxn        half-length along x at the z surface positioned 
-    //                        at -DZ
-    //    Double_t dxp        half-length along x at the z surface positioned 
-    //                        at +DZ
-    //    Double_t dyn        half-length along x at the z surface positioned 
-    //                        at -DZ
-    //    Double_t dyp        half-length along x at the z surface positioned 
-    //                        at +DZ
-    //    Double_t dz         half-length along the z-axis
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t param[5];
-
-    param[0] = fScale*dxn;
-    param[1] = fScale*dxp;
-    param[2] = fScale*dyn;
-    param[3] = fScale*dyp;
-    param[4] = fScale*dz;
-    name[0] = 'I';
-    for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"TRD2",fidmed[med],param,5);
-}
-//______________________________________________________________________
-void AliITSv11::Trapezoid(const char gnam[3],const TString &dis,Double_t dz,
-                         Double_t thet,Double_t phi,Double_t h1,Double_t bl1,
-                         Double_t tl1,Double_t alp1,Double_t h2,Double_t bl2,
-                         Double_t tl2,Double_t alp2,Int_t med){
-    // Interface to TMC->Gsvolu() for ITS TRAP geometries. General Trapezoid, 
-    // The faces perpendicular to z are trapezia and their centers are not 
-    // necessarily on a line parallel to the z axis. This shape has 11 
-    // parameters, but only cosidering that the faces should be planar, only 9 
-    // are really independent. A check is performed on the user parameters and 
-    // a message is printed in case of non-planar faces. Ignoring this warning 
-    // may cause unpredictable effects at tracking time. See SetScale() 
-    // for units. Default units are geant 3 [cm].
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t dz         Half-length along the z-asix
-    //    Double_t thet       Polar angle of the line joing the center of the 
-    //                        face at -dz to the center of the one at dz 
-    //                        [degree].
-    //    Double_t phi        aximuthal angle of the line joing the center of 
-    //                        the face at -dz to the center of the one at +dz 
-    //                        [degree].
-    //    Double_t h1         half-length along y of the face at -dz.
-    //    Double_t bl1        half-length along x of the side at -h1 in y of 
-    //                        the face at -dz in z.
-    //    Double_t tl1        half-length along x of teh side at +h1 in y of 
-    //                        the face at -dz in z.
-    //    Double_t alp1       angle with respect to the y axis from the center 
-    //                        of the side at -h1 in y to the cetner of the 
-    //                        side at +h1 in y of the face at -dz in z 
-    //                        [degree].
-    //    Double_t h2         half-length along y of the face at +dz
-    //    Double_t bl2        half-length along x of the side at -h2 in y of
-    //                        the face at +dz in z.
-    //    Double_t tl2        half-length along x of the side at _h2 in y of 
-    //                        the face at +dz in z.
-    //    Double_t alp2       angle with respect to the y axis from the center 
-    //                        of the side at -h2 in y to the center of the 
-    //                        side at +h2 in y of the face at +dz in z 
-    //                        [degree].
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t param[11];
-
-    param[0] = fScale*dz;
-    param[1] = thet;
-    param[2] = phi;
-    param[3] = fScale*h1;
-    param[4] = fScale*bl1;
-    param[5] = fScale*tl1;
-    param[6] = alp1;
-    param[7] = fScale*h2;
-    param[8] = fScale*bl2;
-    param[9] = fScale*tl2;
-    param[10] = alp2;
-    name[0] = 'I';
-    for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"TRAP",fidmed[med],param,11);
-}
-//______________________________________________________________________
-void AliITSv11::Tube(const char gnam[3],const TString &dis,Double_t rmin,
-                    Double_t rmax,Double_t dz,Int_t med){
-    // Interface to TMC->Gsvolu() for ITS TUBE geometries. Simple Tube. It has
-    // 3 parameters. See SetScale() 
-    // for units. Default units are geant 3 [cm].
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t rmin       Inside Radius.
-    //    Double_t rmax       Outside Radius.
-    //    Double_t dz         half-length along the z-axis
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t param[3];
-
-    param[0] = fScale*rmin;
-    param[1] = fScale*rmax;
-    param[2] = fScale*dz;
-    name[0] = 'I';
-    for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"TUBE",fidmed[med],param,3);
-}
-//______________________________________________________________________
-void AliITSv11::TubeSegment(const char gnam[3],const TString &dis,
-                           Double_t rmin,Double_t rmax,Double_t dz,
-                           Double_t phi1,Double_t phi2,Int_t med){
-    // Interface to TMC->Gsvolu() for ITS TUBE geometries. Phi segment of a 
-    // tube. It has 5  parameters. Phi1 should be smaller than phi2. If this is
-    // not the case, the system adds 360 degrees to phi2. See SetScale() 
-    // for units. Default units are geant 3 [cm].
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t rmin       Inside Radius.
-    //    Double_t rmax       Outside Radius.
-    //    Double_t dz         half-length along the z-axis
-    //    Double_t phi1       Starting angle of the segment [degree].
-    //    Double_t phi2       Ending angle of the segment [degree].
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t param[5];
-
-    param[0] = fScale*rmin;
-    param[1] = fScale*rmax;
-    param[2] = fScale*dz;
-    param[3] = phi1;
-    param[4] = phi2;
-    name[0] = 'I';
-    for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"TUBS",fidmed[med],param,5);
-}
-//______________________________________________________________________
-void AliITSv11::Cone(const char gnam[3],const TString &dis,Double_t dz,
-                    Double_t rmin1,Double_t rmax1,Double_t rmin2,
-                    Double_t rmax2,Int_t med){
-    // Interface to TMC->Gsvolu() for ITS Cone geometries. Conical tube. It 
-    // has 5 parameters. See SetScale() 
-    // for units. Default units are geant 3 [cm].
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t dz         half-length along the z-axis
-    //    Double_t rmin1      Inside Radius at -dz.
-    //    Double_t rmax1      Outside Radius at -dz.
-    //    Double_t rmin2      inside radius at +dz.
-    //    Double_t rmax2      outside radius at +dz.
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t param[5];
-
-    param[0] = fScale*dz;
-    param[1] = fScale*rmin1;
-    param[2] = fScale*rmax1;
-    param[3] = fScale*rmin2;
-    param[4] = fScale*rmax2;
-    name[0] = 'I';
-    for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"CONS",fidmed[med],param,5);
-}
-//______________________________________________________________________
-void AliITSv11::ConeSegment(const char gnam[3],const TString &dis,Double_t dz,
-                           Double_t rmin1,Double_t rmax1,Double_t rmin2,
-                           Double_t rmax2,Double_t phi1,Double_t phi2,
-                           Int_t med){
-    // Interface to TMC->Gsvolu() for ITS ConS geometries. One segment of a 
-    // conical tube. It has 7 parameters. Phi1 should be smaller than phi2. If 
-    // this is not the case, the system adds 360 degrees to phi2. See 
-    // SetScale() for units. Default units are geant 3 [cm].
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t dz         half-length along the z-axis
-    //    Double_t rmin1      Inside Radius at -dz.
-    //    Double_t rmax1      Outside Radius at -dz.
-    //    Double_t rmin2      inside radius at +dz.
-    //    Double_t rmax2      outside radius at +dz.
-    //    Double_t phi1       Starting angle of the segment [degree].
-    //    Double_t phi2       Ending angle of the segment [degree].
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t param[7];
-
-    param[0] = fScale*dz;
-    param[1] = fScale*rmin1;
-    param[2] = fScale*rmax1;
-    param[3] = fScale*rmin2;
-    param[4] = fScale*rmax2;
-    param[5] = phi1;
-    param[6] = phi2;
-    name[0] = 'I';
-    for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"CONS",fidmed[med],param,7);
-}
-//______________________________________________________________________
-void AliITSv11::Sphere(const char gnam[3],const TString &dis,Double_t rmin,
-                      Double_t rmax,Double_t the1,Double_t the2,Double_t phi1,
-                      Double_t phi2,Int_t med){
-    // Interface to TMC->Gsvolu() for ITS SPHE geometries. Segment of a 
-    // sphereical shell. It has 6 parameters. See SetScale() 
-    // for units. Default units are geant 3 [cm].
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t rmin       Inside Radius.
-    //    Double_t rmax       Outside Radius.
-    //    Double_t the1       staring polar angle of the shell [degree].
-    //    Double_t the2       ending polar angle of the shell [degree].
-    //    Double_t phui       staring asimuthal angle of the shell [degree].
-    //    Double_t phi2       ending asimuthal angle of the shell [degree].
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t param[6];
-
-    param[0] = fScale*rmin;
-    param[1] = fScale*rmax;
-    param[2] = the1;
-    param[3] = the2;
-    param[4] = phi1;
-    param[5] = phi2;
-    name[0] = 'I';
-    for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"SPHE",fidmed[med],param,6);
-}
-//______________________________________________________________________
-void AliITSv11::Parallelepiped(const char gnam[3],const TString &dis,
-                              Double_t dx,Double_t dy,Double_t dz,
-                              Double_t alph,Double_t thet,Double_t phi,
-                              Int_t med){
-    // Interface to TMC->Gsvolu() for ITS PARA geometries. Parallelepiped. It 
-    // has 6 parameters. See SetScale() for units. Default units are geant 3 
-    // [cm].
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t dx         half-length allong x-axis
-    //    Double_t dy         half-length allong y-axis
-    //    Double_t dz         half-length allong z-axis
-    //    Double_t alpha      angle formed by the y axis and by the plane 
-    //                        joining the center of teh faces parallel to the 
-    //                        z-x plane at -dY and +dy [degree].
-    //    Double_t thet       polar angle of the line joining the centers of 
-    //                        the faces at -dz and +dz in z [degree].
-    //    Double_t phi        azimuthal angle of teh line joing the centers of 
-    //                        the faaces at -dz and +dz in z [degree].
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t param[6];
-
-    param[0] = fScale*dx;
-    param[1] = fScale*dy;
-    param[2] = fScale*dz;
-    param[3] = alpha;
-    param[4] = thet;
-    param[5] = phi;
-    name[0] = 'I';
-    for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"PARA",fidmed[med],param,6);
-}
-//______________________________________________________________________
-void AliITSv11::Polygon(const char gnam[3],const TString &dis,Double_t phi1,
-                       Double_t dphi,Int_t npdv,Int_t nz,Double_t *z,
-                       Double_t *rmin,Double_t *rmax,Double_t ,Int_t med){
-    // Interface to TMC->Gsvolu() for ITS PGON geometry. Polygon It has 10 
-    // parameters or more. See SetScale() for units. Default units are geant 3 
-    // [cm].
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t phi1       the azimuthal angle at which the volume begins 
-    //                        (angles are counted clouterclockwise) [degrees].
-    //    Double_t dphi       opening angle of the volume, which extends from 
-    //                        phi1 to phi1+dphi [degree].
-    //    Int_t npdv          the number of sides of teh cross section between 
-    //                        the given phi limits.
-    //    Int_t nz            number of planes perpendicular to the z axis 
-    //                        where the dimension of the section is given - 
-    //                        this number should be at least 2 and NP triples 
-    //                        of number must follow.
-    //    Double_t *z         array [nz] of z coordiates of the sections..
-    //    Double_t *rmin      array [nz] of radius of teh circle tangent to 
-    //                        the sides of the inner polygon in teh 
-    //                        cross-section.
-    //    Double_t *rmax      array [nz] of radius of the circle tangent to 
-    //                        the sides of the outer polygon in the 
-    //                       cross-section.
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t *param;
-    Int_t n,i;
-
-    n = 4+3*nz;
-    param = new Float_t[n]
-    param[0] = phi1;
-    param[1] = dphi;
-    param[2] = (Float_t)npdv;
-    param[3] = (Float_t)nz;
-    for(i=0;i<nz;i++){
-       param[4+3*i] = z[i];
-       param[5+3*i] = rmin[i];
-       param[6+3*i] = rmax[i];
-    } // end for i
-    name[0] = 'I';
-    for(i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"PGON",fidmed[med],param,n);
-
-    delete[] param;
-}
-//______________________________________________________________________
-void AliITSv11::PolyCone(const char gnam[3],const TString &dis,Double_t phi1,
-                        Double_t dphi,Int_t nz,Double_t *z,Double_t *rmin,
-                        Double_t *rmax,Int_t med){
-    // Interface to TMC->Gsvolu() for ITS PCON geometry. Poly-cone It has 9 
-    // parameters or more. See SetScale() for units. Default units are geant 3 
-    // [cm].
+AliITSv11::AliITSv11():
+  fByThick(kTRUE),
+  fMajorVersion(IsVersion()),
+  fMinorVersion(-1),
+  fIDMother(0),
+  fInitGeom((AliITSVersion_t)fMajorVersion,fMinorVersion),
+  fSPDgeom(0),
+  fSDDgeom(0),
+  fSSDgeom(0),
+  fSupgeom(0)
+ {
+    //    Standard default constructor
     // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t phi1       the azimuthal angle at which the volume begins 
-    //                        (angles are counted clouterclockwise) [degrees].
-    //    Double_t dphi       opening angle of the volume, which extends from 
-    //                        phi1 to phi1+dphi [degree].
-    //    Int_t nz            number of planes perpendicular to the z axis 
-    //                        where the dimension of the section is given - 
-    //                        this number should be at least 2 and NP triples 
-    //                        of number must follow.
-    //    Double_t *z         Array [nz] of z coordinate of the section.
-    //    Double_t *rmin      Array [nz] of radius of teh inner circle in the 
-    //                        cross-section.
-    //    Double_t *rmax      Array [nz] of radius of the outer circle in the 
-    //                        cross-section.
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t *param;
-    Int_t n,i;
-
-    n = 3+3*nz;
-    param = new Float_t[n];
-    param[0] = phi1;
-    param[1] = dphi;
-    param[2] = (Float_t) nz;
-    for(i=0;i<nz;i++){
-       param[3+3*i] = z[i];
-       param[4+3*i] = rmin[i];
-       param[5+3*i] = rmax[i];
-    } // end for i
-    name[0] = 'I';
-    for(i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"PCON",fidmed[med],param,n);
-
-    delete[] param;
-}
-//______________________________________________________________________
-void AliITSv11::TubeElliptical(const char gnam[3],const TString &dis,
-                              Double_t p1,Double_t p2,Double_t dz,Int_t med){
-    // Interface to TMC->Gsvolu() for ITS ELTU geometries. Elliptical 
-    // cross-section Tube. It has 3 parameters. See SetScale() 
-    // for units. Default units are geant 3 [cm]. The equation of the surface 
-    // is x^2 * p1^-2 + y^2 * p2^-2 = 1.
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t p1         semi-axis of the elipse along x.
-    //    Double_t p2         semi-axis of the elipse along y.
-    //    Double_t dz         half-length along the z-axis
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t param[3];
-
-    param[0] = fScale*p1;
-    param[1] = fScale*p2;
-    param[2] = fScale*dz;
-    name[0] = 'I';
-    for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"ELTU",fidmed[med],param,3);
-}
-//______________________________________________________________________
-void AliITSv11::HyperbolicTube(const char gnam[3],const TString &dis,
-                              Double_t rmin,Double_t rmax,Double_t dz,
-                              Double_t thet,Int_t med){
-    // Interface to TMC->Gsvolu() for ITS HYPE geometries. Hyperbolic tube. 
-    // Fore example the inner and outer surfaces are hyperboloids, as would be 
-    // foumed by a system of cylinderical wires which were then rotated 
-    // tangentially about their centers. It has 4 parameters. See SetScale() 
-    // for units. Default units are geant 3 [cm]. The hyperbolic surfaces are 
-    // given by r^2 = (ztan(thet)^2 + r(z=0)^2.
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t rmin       Inner radius at z=0 where tube is narrowest.
-    //    Double_t rmax       Outer radius at z=0 where tube is narrowest.
-    //    Double_t dz         half-length along the z-axis
-    //    Double_t thet       stero angel of rotation of the two faces 
-    //                       [degrees].
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t param[4];
-
-    param[0] = fScale*rmin;
-    param[1] = fScale*rmax;
-    param[2] = fScale*dz;
-    param[3] = thet;
-    name[0] = 'I';
-    for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"HYPE",fidmed[med],param,4);
-}
-//______________________________________________________________________
-void AliITSv11::TwistedTrapezoid(const char gnam[3],const TString &dis,
-                                Double_t dz,Double_t thet,Double_t phi,
-                                Double_t twist,Double_t h1,Double_t bl1,
-                                Double_t tl1,Double_t apl1,Double_t h2,
-                                Double_t bl2,Double_t tl2,Double_t apl2,
-                                Int_t med){
-    // Interface to TMC->Gsvolu() for ITS GTRA geometries. General twisted 
-    // trapazoid. The faces perpendicular to z are trapazia and their centers 
-    // are not necessarily on a line parallel to the z axis as the TRAP. 
-    // Additionally, the faces may be twisted so that none of their edges are 
-    // parallel. It is a TRAP shape, exept that it is twisted in the x-y plane 
-    // as a function of z. The parallel sides perpendicular to the x axis are 
-    // rotated with respect to the x axis by an angle TWIST, which is one of 
-    // the parameters. The shape is defined by the eight corners and is assumed
-    // to be constructed of straight lines joingin points on the boundry of the
-    // trapezoidal face at Z=-dz to the coresponding points on the face at 
-    // z=+dz. Divisions are not allowed. It has 12 parameters. See SetScale() 
-    // for units. Default units are geant 3 [cm]. Note: This shape suffers from
-    // the same limitations than the TRAP. The tracking routines assume that 
-    // the faces are planar, but htis constraint is not easily expressed in 
-    // terms of the 12 parameters. Additionally, no check on th efaces is 
-    // performed in this case. Users should avoid to use this shape as much as 
-    // possible, and if they have to do so, they should make sure that the 
-    // faces are really planes. If this is not the case, the result of the 
-    // trasport is unpredictable. To accelerat ethe computations necessary for 
-    // trasport, 18 additioanl parameters are calculated for this shape are
-    // 1 DXODZ dx/dz of the line joing the centers of the faces at z=+_dz.
-    // 2 DYODZ dy/dz of the line joing the centers of the faces at z=+_dz.
-    // 3 XO1    x at z=0 for line joing the + on parallel side, perpendicular 
-    //          corners at z=+_dz.
-    // 4 YO1    y at z=0 for line joing the + on parallel side, + on 
-    //          perpendicular corners at z=+-dz.
-    // 5 DXDZ1  dx/dz for line joing the + on parallel side, + on 
-    //          perpendicular corners at z=+-dz.
-    // 6 DYDZ1  dy/dz for line joing the + on parallel side, + on 
-    //          perpendicular corners at z=+-dz.
-    // 7 X02    x at z=0 for line joing the - on parallel side, + on 
-    //          perpendicular corners at z=+-dz.
-    // 8 YO2    y at z=0 for line joing the - on parallel side, + on 
-    //          perpendicular corners at z=+-dz.
-    // 9 DXDZ2  dx/dz for line joing the - on parallel side, + on 
-    //          perpendicular corners at z=+-dz.
-    // 10 DYDZ2dy/dz for line joing the - on parallel side, + on 
-    //          perpendicular corners at z=+-dz.
-    // 11 XO3   x at z=0 for line joing the - on parallel side, - on 
-    //          perpendicular corners at z=+-dz.
-    // 12 YO3   y at z=0 for line joing the - on parallel side, - on 
-    //          perpendicular corners at z=+-dz.
-    // 13 DXDZ3 dx/dzfor line joing the - on parallel side, - on 
-    //          perpendicular corners at z=+-dz.
-    // 14 DYDZ3 dydz for line joing the - on parallel side, - on 
-    //          perpendicular corners at z=+-dz.
-    // 15 XO4   x at z=0 for line joing the + on parallel side, - on 
-    //          perpendicular corners at z=+-dz.
-    // 16 YO4   y at z=0 for line joing the + on parallel side, - on 
-    //          perpendicular corners at z=+-dz.
-    // 17 DXDZ4 dx/dz for line joing the + on parallel side, - on 
-    //          perpendicular corners at z=+-dz.
-    // 18 DYDZ4 dydz for line joing the + on parallel side, - on 
-    //          perpendicular corners at z=+-dz.
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t dz         half-length along the z axis.
-    //    Double_t thet       polar angle of the line joing the center of the 
-    //                        face at -dz to the center of the one at +dz 
-    //                        [degrees].
-    //    Double_t phi        Azymuthal angle of teh line joing the centre of 
-    //                        the face at -dz to the center of the one at +dz 
-    //                        [degrees].
-    //    Double_t twist      Twist angle of the faces parallel to the x-y 
-    //                        plane at z=+-dz around an axis parallel to z 
-    //                        passing through their centre [degrees].
-    //    Double_t h1         Half-length along y of the face at -dz.
-    //    Double_t bl1        half-length along x of the side -h1 in y of the 
-    //                        face at -dz in z.
-    //    Double_t tl1        half-length along x of the side at +h1 in y of 
-    //                        the face at -dz in z.
-    //    Double_t apl1       Angle with respect to the y ais from the center 
-    //                        of the side at -h1 in y to the centere of the 
-    //                        side at +h1 in y of the face at -dz in z 
-    //                        [degrees].
-    //    Double_t h2         half-length along the face at +dz.
-    //    Double_t bl2        half-length along x of the side at -h2 in y of 
-    //                        the face at -dz in z.
-    //    Double_t tl2        half-length along x of the side at +h2 in y of 
-    //                        the face at +dz in z.
-    //    Double_t apl2       angle with respect to the y axis from the center 
-    //                        of the side at -h2 in y to the center of the side
-    //                        at +h2 in y of the face at +dz in z [degrees].
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t param[12];
-
-    param[0] = fScale*dz;
-    param[1] = thet;
-    param[2] = phi;
-    param[3] = twist;
-    param[4] = fScale*h1;
-    param[5] = fScale*bl1;
-    param[6] = fScale*tl1;
-    param[7] = alp1;
-    param[8] = fScale*h2;
-    param[9] = fScale*bl2;
-    param[10] = fScale*tl2;
-    param[11] = alp2;
-    name[0] = 'I';
-    for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"GTRA",fidmed[med],param,12);
-}
-//______________________________________________________________________
-void AliITSv11::CutTube(const char gnam[3],const TString &dis,Double_t rmin,
-                       Double_t rmax,Double_t dz,Double_t phi1,Double_t phi2,
-                       Double_t lx,Double_t ly,Double_t lz,Double_t hx,
-                       Double_t hy,Double_t hz,Int_t med){
-    // Interface to TMC->Gsvolu() for ITS CTUB geometries. Cut tube. A tube cut
-    // at the extremities with planes not necessarily perpendicular tot he z 
-    // axis. It has 11 parameters. See SetScale() for units. Default units are 
-    // geant 3 [cm]. phi1 should be smaller than phi2. If this is not the case,
-    // the system adds 360 degrees to phi2.
-    // Inputs:
-    //    const char gnam[3]  3 character geant volume name. The letter "I"
-    //                        is appended to the front to indecate that this
-    //                        is an ITS volume.
-    //    TString &dis        String containging part discription.
-    //    Double_t rmin       Inner radius at z=0 where tube is narrowest.
-    //    Double_t rmax       Outer radius at z=0 where tube is narrowest.
-    //    Double_t dz         half-length along the z-axis
-    //    Double_t dz         half-length along the z-axis
-    //    Double_t phi1       Starting angle of the segment [degree].
-    //    Double_t phi2       Ending angle of the segment [degree].
-    //    Double_t lx         x component of a unit vector perpendicular to 
-    //                        the face at -dz.
-    //    Double_t ly         y component of a unit vector perpendicular to 
-    //                        the face at -dz.
-    //    Double_t lz         z component of a unit vector perpendicular to 
-    //                        the face at -dz.
-    //    Double_t hx         x component of a unit vector perpendicular to 
-    //                        the face at +dz.
-    //    Double_t hy         y component of a unit vector perpendicular to 
-    //                        the face at +dz.
-    //    Double_t hz         z component of a unit vector perpendicular to 
-    //                        the face at +dz.
-    //    Int_t    med        media index number.
-    // Output:
-    //    none.
-    // Return.
-    //    none.
-    char name[4];
-    Float_t param[11];
-
-    param[0] = fScale*rmin;
-    param[1] = fScale*rmax;
-    param[2] = fScale*dz;
-    param[3] = phi1;
-    param[4] = phi2;
-    param[5] = lx;
-    param[6] = ly;
-    param[7] = lz;
-    param[8] = hx;
-    param[9] = hy;
-    param[10] = hz;
-    name[0] = 'I';
-    for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
-    gMC->Gsvolu(name,"CTUB",fidmed[med],param,11);
-}
-//______________________________________________________________________
-void AliITSv11::Pos(const char vol[3],Int_t cn,const char moth[3],Double_t x,
-                   Double_t y,Double_t z,Int_t irot){
-    // Place a copy of a volume previously defined by a call to GSVOLU inside 
-    // its mother volulme moth.
-    // Inputs:
-    //   const char vol[3]  3 character geant volume name. The letter "I"
-    //                      is appended to the front to indecate that this
-    //                      is an ITS volume.
-    //   const char moth[3] 3 character geant volume name of the mother volume 
-    //                      in which vol will be placed. The letter "I" is 
-    //                      appended to the front to indecate that this is an 
-    //                      ITS volume.
-    //   Double_t x         The x positon of the volume in the mother's 
-    //                      reference system
-    //   Double_t y         The y positon of the volume in the mother's 
-    //                      reference system
-    //   Double_t z         The z positon of the volume in the mother's 
-    //                      reference system
-    //   Int_t irot         the index for the rotation matrix to be used.
-    //                      irot=-1 => unit rotation.
+    //   none.
     // Outputs:
-    //    none.
+    //   none.
     // Return:
-    //    none.
-    char name[4],mother[4];
-    Float_t param[3];
-    Int_t r=0,i;
-
-    param[0] = x;
-    param[1] = y;
-    param[2] = z;
-    name[0] = 'I';
-    for(i=0;i<3;i++) name[i+1] = vol[i];
-    mother[0] = 'I';
-    for(i=0;i<3;i++) mother[i+1] = moth[i];
-    if(irot>=0) r=fidrot[irot];
-    fMC->Gspos(name,mother,param[0],param[1],param[2],r,"ONLY");
+    //   none.
 }
-//______________________________________________________________________
-void AliITSv11::Matrix(Int_t irot,Double_t thet1,Double_t phi1,
-                      Double_t thet2,Double_t phi2,
-                      Double_t thet3,Double_t phi3){
-    // Defines a Geant rotation matrix. checks to see if it is the unit
-    // matrix. If so, then no additonal matrix is defined. Stores rotation 
-    // matrix irot in the data structure JROTM. If the matrix is not 
-    // orthonormal, it will be corrected by setting y' perpendicular to x' 
-    // and z' = x' X y'. A warning message is printed in this case.
-    // Inputs:
-    //   Int_t irot     Intex specifing which rotation matrix.
-    //   Double_t thet1 Polar angle for axisw x [degrees].
-    //   Double_t phi1  azimuthal angle for axis x [degrees].
-    //   Double_t thet12Polar angle for axisw y [degrees].
-    //   Double_t phi2  azimuthal angle for axis y [degrees].
-    //   Double_t thet3 Polar angle for axisw z [degrees].
-    //   Double_t phi3  azimuthal angle for axis z [degrees].
-    // Outputs:
-    //    none.
-    // Return:
-    //    none.
-    Float_t t1,p1,t2,p2,t3,p3;
 
-    if(thet1==90.0&&phi1==0.0&&thet2==90.0&&phi2==90.0&&thet3==0.0&&phi3==0.0){
-       fidrot[irot] = 0; // Unit matrix
-    }else{
-       t1 = thet1;
-       p1 = phi1;
-       t2 = thet2;
-       p2 = phi2;
-       t3 = thet3;
-       p3 = phi3
-       AliMatrix(fidrot[irot],t1,p1,t2,p2,t3,p3);
-    } // end if
-}
 //______________________________________________________________________
-void AliITSv11::Matrix(Int_t irot,Int_t axis,Double_t thet){
-    // Defines a Geant rotation matrix. checks to see if it is the unit
-    // matrix. If so, then no additonal matrix is defined. Stores rotation 
-    // matrix irot in the data structure JROTM. If the matrix is not 
-    // orthonormal, it will be corrected by setting y' perpendicular to x' 
-    // and z' = x' X y'. A warning message is printed in this case.
+AliITSv11::AliITSv11(const char *title) 
+  : AliITS("ITS", title),
+    fByThick(kTRUE),
+    fMajorVersion(IsVersion()),
+    fMinorVersion(1),
+    fIDMother(0),
+    fInitGeom((AliITSVersion_t)fMajorVersion,fMinorVersion),
+    fSPDgeom(0),
+    fSDDgeom(0),
+    fSSDgeom(0),
+    fSupgeom(0)
+{
+    //    Standard constructor for the v11 geometry.
     // Inputs:
-    //   Int_t irot         Intex specifing which rotation matrix.
-    //   Int_t axis         Axis about which rotation is to be done.
-    //   Double_t thet      Angle to rotate by [degrees].
+    //   const char * title  Arbitrary title
     // Outputs:
-    //    none.
+    //   none.
     // Return:
-    //    none.
+    //   none.
+  Int_t i;
+  
+  fSPDgeom = new AliITSv11GeometrySPD();
+  fSDDgeom = new AliITSv11GeometrySDD(0);
+  fSSDgeom = new AliITSv11GeometrySSD();
+  fSupgeom = new AliITSv11GeometrySupport();
 
-    if(thet==0.0){
-       fidrot[irot] = 0; // Unit matrix
-    }else{
-       switch (irot) {
-       case 0: //Rotate about x-axis, x-axis does not change.
-           AliMatrix(fidrot[irot],90.0,0.0,90.0+thet,90.0,thet,90.0);
-           break;
-       case 1: //Rotate about y-axis, y-axis does not change.
-           AliMatrix(fidrot[irot],-90.0-thet,0.0,90.0,90.0,thet,90.0);
-           break;
-       case 2: //Rotate about z-axis, z-axis does not change.
-           AliMatrix(fidrot[irot],90.0,thet,90.0,-thet-90.0,0.0,0.0);
-           break;
-       default:
-           Error("Matrix","axis must be either 0, 1, or 2. for matrix=%d",
-                 irot);
-           break;
-       } // end switch
-    } // end if
+  fIdN = 6;
+  fIdName = new TString[fIdN];
+
+  fIdName[0] = fSPDgeom->GetSenstiveVolumeName1();
+  fIdName[1] = fSPDgeom->GetSenstiveVolumeName2();
+
+  fIdName[2] = fSDDgeom->GetSenstiveVolumeName3();
+  fIdName[3] = fSDDgeom->GetSenstiveVolumeName4();
+  
+  fIdName[4] = fSSDgeom->GetSenstiveVolumeName5();
+  fIdName[5] = fSSDgeom->GetSenstiveVolumeName6();
+
+  fIdSens    = new Int_t[fIdN];
+  for(i=0;i<fIdN;i++) fIdSens[i] = 0;
+
+  SetDensityServicesByThickness();
+  
 }
+
 //______________________________________________________________________
-void AliITSv11::Matrix(Int_t irot,Double_t rot[3][3]){
-    // Defines a Geant rotation matrix. checks to see if it is the unit
-    // matrix. If so, then no additonal matrix is defined. Stores rotation 
-    // matrix irot in the data structure JROTM. If the matrix is not 
-    // orthonormal, it will be corrected by setting y' perpendicular to x' 
-    // and z' = x' X y'. A warning message is printed in this case.
+AliITSv11::AliITSv11(const char *name, const char *title) 
+  : AliITS("ITS", title),
+    fByThick(kTRUE),
+    fMajorVersion(IsVersion()),
+    fMinorVersion(1),
+    fIDMother(0),
+    fInitGeom((AliITSVersion_t)fMajorVersion,fMinorVersion),
+    fSPDgeom(0),
+    fSDDgeom(0),
+    fSSDgeom(0),
+    fSupgeom(0)
+{
+    //    Standard constructor for the v11 geometry.
     // Inputs:
-    //   Int_t irot         Intex specifing which rotation matrix.
-    //   Double_t rot[3][3] The 3 by 3 rotation matrix.
+    //   const char * name   Ignored, set to "ITS"
+    //   const char * title  Arbitrary title
     // Outputs:
-    //    none.
+    //   none.
     // Return:
-    //    none.
+    //   none.
+  Int_t i;
+  
+  fSPDgeom = new AliITSv11GeometrySPD();
+  fSDDgeom = new AliITSv11GeometrySDD(0);
+  fSSDgeom = new AliITSv11GeometrySSD();
+  fSupgeom = new AliITSv11GeometrySupport();
 
-    if(rot[0][0]==1.0&&rot[1][1]==1.0&&rot[2][2]==1.0&&
-       rot[0][1]==0.0&&rot[0][2]==0.0&&rot[1][0]==0.0&&
-       rot[1][2]==0.0&&rot[2][0]==0.0&&rot[2][1]==0.0){
-       fidrot[irot] = 0; // Unit matrix
-    }else{
-       Double_t si,c=180./TMath::Pi();
-       Double_t ang[6];
-
-       ang[1] = TMath::ATan2(rot[0][1],rot[0][0]);
-       if(TMath::Cos(ang[1])!=0.0) si = rot[0][0]/TMath::Cos(ang[1]);
-       else si = rot[0][1]/TMath::Sin(ang[1]);
-       ang[0] = TMath::ATan2(si,rot[0][2]);
-
-       ang[3] = TMath::ATan2(rot[1][1],rot[1][0]);
-       if(TMath::Cos(ang[3])!=0.0) si = rot[1][0]/TMath::Cos(ang[3]);
-       else si = rot[1][1]/TMath::Sin(ang[3]);
-       ang[2] = TMath::ATan2(si,rot[1][2]);
-
-       ang[5] = TMath::ATan2(rot[2][1],rot[2][0]);
-       if(TMath::Cos(ang[5])!=0.0) si = rot[2][0]/TMath::Cos(ang[5]);
-       else si = rot[2][1]/TMath::Sin(ang[5]);
-       ang[4] = TMath::ATan2(si,rot[2][2]);
-
-       for(Int_t i=0;i<6;i++) {ang[i] *= c; if(ang[i]<0.0) ang[i] += 360.;}
-       AliMatrix(fidrot[irot],ang[0],ang[1],ang[2],ang[3],ang[4],ang[5]);
-    } // end if
+  fIdN = 6;
+  fIdName = new TString[fIdN];
+
+  (void) name; // removes warning message
+
+  fIdName[0] = fSPDgeom->GetSenstiveVolumeName1();
+  fIdName[1] = fSPDgeom->GetSenstiveVolumeName2();
+
+  fIdName[2] = fSDDgeom->GetSenstiveVolumeName3();
+  fIdName[3] = fSDDgeom->GetSenstiveVolumeName4();
+
+  fIdName[4] = fSSDgeom->GetSenstiveVolumeName5();
+  fIdName[5] = fSSDgeom->GetSenstiveVolumeName6();
+
+  fIdSens    = new Int_t[fIdN];
+  for(i=0;i<fIdN;i++) fIdSens[i] = 0;
+
+  SetDensityServicesByThickness();
+  
 }
+
 //______________________________________________________________________
-Float_t AliITSv11::GetA(Int_t z){
-    // Returns the isotopicaly averaged atomic number.
+AliITSv11::~AliITSv11() {
+    //    Standard destructor
     // Inputs:
-    //    Int_t z  Elemental number
+    //   none.
     // Outputs:
-    //    none.
+    //   none.
     // Return:
-    //    The atomic mass number.
-    const Float_t A[]={ 1.00794 ,  4.0026902,  6.941   ,  9.012182 , 10.811   ,
-                       12.01007 , 14.00674  , 15.9994  , 18.9984032, 20.1797  ,
-                       22.98970 , 24.3050   , 26.981538, 28.0855   , 30.973761,
-                       32.066   , 35.4527   , 39.948   , 39.0983   , 40.078   ,
-                       44.95591 , 47.867    , 50.9415  , 51.9961   , 54.938049,
-                       55.845   , 58.933200 , 58.6934  , 63.546    , 65.39    ,
-                       69.723   , 72.61     , 74.92160 , 78.96     , 79.904   ,
-                       83.80    , 85.4678   , 87.62    , 88.9085   , 91.224   ,
-                       92.90638 , 95.94     , 97.907215, 101.07    ,102.90550 ,
-                      106.42    ,107.8682   ,112.411   ,114.818    ,118.710   ,
-                      121.760   ,127.60     ,126.90447 ,131.29     ,132.90545 ,
-                      137.327   ,138.9055   ,140.116   ,140.90765  ,144.24    ,
-                      144.912746,150.36     ,151.964   ,157.25     ,158.92534 ,
-                      162.50     ,164.93032 ,167.26    ,168.93421  ,173.04    ,
-                      174.967    ,178.49    ,180.9479 ,183.84      ,186.207   ,
-                      190.23     ,192.217   ,195.078  ,196.96655   ,200.59    ,
-                      204.3833   ,207.2     ,208.98038,208.982415  ,209.987131,
-                      222.017570 ,223.019731,226.025402,227.027747 ,232.0381  ,
-                      231.03588  238.0289};
-
-    if(z<1||z>92){
-       Error("GetA","z must be 0<z<93. z=%d",z);
-       return 0.0;
-    } // end if
-    return A[z-1];
+    //   none.
+  delete fSPDgeom;
+  delete fSDDgeom;
+  delete fSSDgeom;
+  delete fSupgeom;
 }
+
 //______________________________________________________________________
-Float_t AliITSv11::GetStandardMaxStepSize(Int_t istd){
-    // Returns one of a set of standard Maximum Step Size values.
-    // Inputs:
-    //   Int_t istd  Index to indecate which standard.
-    // Outputs:
-    //    none.
-    // Return:
-    //    The appropreate standard Maximum Step Size value [cm].
-    Float_t t[]={1.0, // default
-                0.0075, // Silicon detectors...
-                1.0, // Air in central detectors region
-                1.0  // Material in non-centeral region
-    };
-    return t[istd];
+void AliITSv11::SetT2Lmatrix(Int_t uid, Double_t yShift, 
+                            Bool_t yFlip, Bool_t yRot180) const
+{
+
+  //
+  // Creates the TGeo Local to Tracking transformation matrix
+  // and sends it to the corresponding TGeoPNEntry 
+  //
+  // This function is used in AddAlignableVolumes()
+
+  TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(uid);
+  TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
+
+  Double_t *gtrans = globMatrix->GetTranslation(), rotMatrix[9];
+  memcpy(&rotMatrix[0], globMatrix->GetRotationMatrix(), 9*sizeof(Double_t));
+  Double_t al = TMath::ATan2(rotMatrix[1],rotMatrix[0]);
+  if (yRot180) {
+    al = TMath::ATan2(rotMatrix[1],-rotMatrix[0]);
+  }
+  Double_t xShift = gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al);
+  Double_t zShift = -gtrans[2];
+
+  TGeoHMatrix *matLtoT = new TGeoHMatrix;
+  matLtoT->SetDx( xShift ); // translation
+  matLtoT->SetDy( yShift );
+  matLtoT->SetDz( zShift );
+  rotMatrix[0]= 0;  rotMatrix[1]= 1;  rotMatrix[2]= 0; // + rotation
+  rotMatrix[3]= 1;  rotMatrix[4]= 0;  rotMatrix[5]= 0;
+  rotMatrix[6]= 0;  rotMatrix[7]= 0;  rotMatrix[8]=-1;
+  if (yFlip) rotMatrix[3] = -1;  // flipping in y  (for SPD1)
+  if (yFlip) rotMatrix[1] = -1;  // flipping in y  (for SPD1)
+
+  if (yRot180) { // rotation of pi around the axis perpendicular to the wafer
+    if (yFlip) matLtoT->SetDx( -xShift ); // flipping in y  (for SPD1)
+    matLtoT->SetDy( -yShift );
+    matLtoT->SetDz( -zShift );
+    rotMatrix[8]=1;
+    rotMatrix[3] = -1;
+    if (yFlip) rotMatrix[3] = 1;  // flipping in y  (for SPD1)
+  }
+
+  TGeoRotation rot;
+  rot.SetMatrix(rotMatrix);
+  matLtoT->MultiplyLeft(&rot);
+  TGeoHMatrix *matTtoL = new TGeoHMatrix(matLtoT->Inverse());
+  delete matLtoT;
+  alignableEntry->SetMatrix(matTtoL);
 }
+
 //______________________________________________________________________
-Float_t AliITSv11::GetStandardThetaMax(Int_t istd){
-    // Returns one of a set of standard Theata Max values.
-    // Inputs:
-    //   Int_t istd  Index to indecate which standard.
-    // Outputs:
-    //    none.
-    // Return:
-    //    The appropreate standard Theta max value [degrees].
-    Float_t t[]={0.1, // default
-                0.1, // Silicon detectors...
-                0.1, // Air in central detectors region
-                1.0  // Material in non-centeral region
-    };
-    return t[istd];
+void AliITSv11::AddAlignableVolumes() const
+{
+  // Creates entries for alignable volumes associating the symbolic volume
+  // name with the corresponding volume path.
+  // 
+  // Records in the alignable entries the transformation matrices converting
+  // TGeo local coordinates (in the RS of alignable volumes) to the tracking
+  // system
+  // For this, this function has to run before the misalignment because we
+  // are using the ideal positions in the AliITSgeom object.
+  // Inputs:
+  //   none.
+  // Outputs:
+  //   none.
+  // Return:
+  //   none.
+
+  AliInfo("Add ITS alignable volumes");
+
+  if (!gGeoManager) {
+    AliFatal("TGeoManager doesn't exist !");
+    return;
+  }
+
+  AliGeomManager::ELayerID layerId;
+  Int_t modUID, modnum;
+
+  if( !gGeoManager->SetAlignableEntry("ITS","ALIC_1/ITSV_1") )
+    AliFatal(Form("Unable to set alignable entry ! %s :: %s",
+                  "ITS","ALIC_1/ITSV_1"));    
+
+  TString strSPD = "ITS/SPD";
+  TString strSDD = "ITS/SDD";
+  TString strSSD = "ITS/SSD";
+  TString strStave = "/Stave";
+  TString strHalfStave = "/HalfStave";
+  TString strLadder = "/Ladder";
+  TString strSector = "/Sector";
+  TString strSensor = "/Sensor";
+  TString strEntryName1;
+  TString strEntryName2;
+  TString strEntryName3;
+  TString strEntryName4;
+
+  TString str0;
+  TString str1;
+  TString str2;
+
+  TString ladder;
+
+  //===== SPD layers =====
+  
+  str0 = "ALIC_1/ITSV_1/ITSSPD_1/ITSSPDCarbonFiberSectorV_";
+  str1 = "/ITSSPDSensitiveVirtualvolumeM0_1/ITSSPDlay1-Stave_";
+
+  TString str1Bis = "/ITSSPDhalf-Stave";
+  TString str1Tierce = "_1";
+
+  str2 = "/ITSSPDlay1-Ladder_";
+  
+  TString sector;
+  TString stave;
+  TString halfStave;
+  TString module;
+
+  layerId = AliGeomManager::kSPD1;
+  modnum = 0;
+    
+  for(Int_t cSect = 0; cSect<10; cSect++) {
+
+    sector = str0;
+    sector += cSect+1; // this is one full sector
+    strEntryName1 = strSPD;
+    strEntryName1 += 0;
+    strEntryName1 += strSector;
+    strEntryName1 += cSect;
+    if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),sector.Data()))
+      AliFatal(Form("New lay 1: Unable to set alignable entry 1! %s::%s",
+               strEntryName1.Data(),sector.Data()));
+
+    for(Int_t cStave=0; cStave<2; cStave++) {
+       
+      stave = sector;
+      stave += str1;
+      stave += cStave+1;
+      strEntryName2 = strEntryName1;
+      strEntryName2 += strStave;
+      strEntryName2 += cStave;
+
+      for(Int_t cHS=0; cHS<2; cHS++) {
+
+       halfStave = stave;
+       halfStave += str1Bis;
+       halfStave += cHS;
+       halfStave += str1Tierce;
+       strEntryName3 = strEntryName2;
+       strEntryName3 += strHalfStave;
+       strEntryName3 += cHS;
+
+       if(!gGeoManager->SetAlignableEntry(strEntryName3.Data(),
+                                          halfStave.Data()))
+         AliFatal(Form("New lay 1: Unable to set alignable entry 3! %s::%s",
+                       strEntryName3.Data(),halfStave.Data()));    
+
+       for(Int_t cLad=0; cLad<2; cLad++) {
+         
+         modUID = AliGeomManager::LayerToVolUID(layerId,modnum++);
+         module = halfStave;
+         module += str2;
+         module += cLad+cHS*2+1;
+         strEntryName4 = strEntryName3;
+         strEntryName4 += strLadder;
+         strEntryName4 += cLad+cHS*2;
+         if(!gGeoManager->SetAlignableEntry(strEntryName4.Data(),module.Data(),modUID))
+           AliFatal(Form("New lay 1: Unable to set alignable entry 4! %s::%s",
+                         strEntryName4.Data(),module.Data()));
+
+         SetT2Lmatrix(modUID, 0.0081, kTRUE, kTRUE);
+         // 0.0081 is the shift between the centers of alignable 
+         // and sensitive volumes. It is directly extracted from 
+         // the new SPD geometry
+       } // end for cLad
+      } // end for cHS
+    } // end for cStave
+  } // end for cSect
+
+  layerId = AliGeomManager::kSPD2;
+  modnum = 0;
+  str1 = "/ITSSPDSensitiveVirtualvolumeM0_1/ITSSPDlay2-Stave_";
+  str2 = "/ITSSPDlay2-Ladder_";
+
+  for(Int_t cSect = 0; cSect<10; cSect++) {
+
+    sector = str0;
+    sector += cSect+1; // this is one full sector
+    strEntryName1 = strSPD;
+    strEntryName1 += 1;
+    strEntryName1 += strSector;
+    strEntryName1 += cSect;
+      
+    for(Int_t cStave=0; cStave<4; cStave++) {
+       
+      stave = sector;
+      stave += str1;
+      stave += cStave+1;
+      strEntryName2 = strEntryName1;
+      strEntryName2 += strStave;
+      strEntryName2 += cStave;
+
+      for(Int_t cHS=0; cHS<2; cHS++) {
+
+       halfStave = stave;
+       halfStave += str1Bis;
+       halfStave += cHS;
+       halfStave += str1Tierce;
+       strEntryName3 = strEntryName2;
+       strEntryName3 += strHalfStave;
+       strEntryName3 += cHS;
+
+       if(!gGeoManager->SetAlignableEntry(strEntryName3.Data(),
+                                          halfStave.Data()))
+         AliFatal(Form("New lay 2: Unable to set alignable entry 3! %s::%s",
+                       strEntryName3.Data(),halfStave.Data()));    
+
+       for(Int_t cLad=0; cLad<2; cLad++) {
+
+         modUID = AliGeomManager::LayerToVolUID(layerId,modnum++);
+         module = halfStave;
+         module += str2;
+         module += cLad+cHS*2 +1;
+         strEntryName4 = strEntryName3;
+         strEntryName4 += strLadder;
+         strEntryName4 += cLad+cHS*2;
+         if(!gGeoManager->SetAlignableEntry(strEntryName4.Data(),module.Data(),modUID))
+           AliFatal(Form("New lay 2: Unable to set alignable entry 4! %s::%s",
+                         strEntryName4.Data(),module.Data()));
+
+         SetT2Lmatrix(modUID, -0.0081, kFALSE);
+       } // end for cLad
+      } // end for cHS
+    } // end for cStave
+  } // cSect
+
+  //===== SDD layers =====
+
+  layerId = AliGeomManager::kSDD1;
+  modnum = 0;
+
+  str0 = "/ALIC_1/ITSV_1/ITSsddLayer3_1/ITSsddLadd_"; // SDD layer1
+  str1 = "/ITSsddSensor3_";
+
+  TString sensor;
+
+  for(Int_t c1 = 0; c1<14; c1++) {
+
+    ladder = str0;
+    ladder += c1; // the set of wafers from one ladder
+    strEntryName1 = strSDD;
+    strEntryName1 += 2;
+    strEntryName1 +=strLadder;
+    strEntryName1 += c1;
+    //printf("%s    ==    %s\n",strEntryName1.Data(),ladder.Data());
+    if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),ladder.Data()))
+      AliFatal(Form("Unable to set alignable entry 1! %s :: %s",
+                   strEntryName1.Data(),ladder.Data()));
+
+    for(Int_t c2 =0; c2<6; c2++) {
+
+      modUID = AliGeomManager::LayerToVolUID(layerId,modnum++);
+      sensor = ladder;
+      sensor += str1;
+      sensor += c2;
+      strEntryName2 = strEntryName1;
+      strEntryName2 += strSensor;
+      strEntryName2 += c2;
+      //printf("%s    ==    %s\n",strEntryName2.Data(),wafer.Data());
+      if(!gGeoManager->SetAlignableEntry(strEntryName2.Data(),sensor.Data(),modUID))
+       AliFatal(Form("Unable to set alignable entry 2! %s :: %s",
+                     strEntryName2.Data(),sensor.Data()));
+
+      SetT2Lmatrix(modUID, 0, kFALSE, c2>=3);
+    }
+  }
+
+  layerId = AliGeomManager::kSDD2;
+  modnum = 0;
+  str0 = "/ALIC_1/ITSV_1/ITSsddLayer4_1/ITSsddLadd_"; // SDD layer2
+  str1 = "/ITSsddSensor4_";
+    
+  for(Int_t c1 = 0; c1<22; c1++) {
+
+    ladder = str0;
+    ladder += c1; // the set of wafers from one ladder
+    strEntryName1 = strSDD;
+    strEntryName1 += 3;
+    strEntryName1 += strLadder;
+    strEntryName1 += c1;
+    //printf("%s    ==    %s\n",strEntryName1.Data(),ladder.Data());
+    if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),ladder.Data()))
+      AliFatal(Form("Unable to set alignable entry 1! %s :: %s",
+                   strEntryName1.Data(),ladder.Data()));
+
+    for(Int_t c2 =0; c2<8; c2++) {
+
+      modUID = AliGeomManager::LayerToVolUID(layerId,modnum++);
+      sensor = ladder;
+      sensor += str1;
+      sensor += c2;
+      strEntryName2 = strEntryName1;
+      strEntryName2 += strSensor;
+      strEntryName2 += c2;
+      //printf("%s    ==    %s\n",strEntryName2.Data(),wafer.Data());
+      if(!gGeoManager->SetAlignableEntry(strEntryName2.Data(),sensor.Data(),modUID))
+       AliFatal(Form("Unable to set alignable entry 2! %s :: %s",
+                     strEntryName2.Data(),sensor.Data()));
+
+      SetT2Lmatrix(modUID, 0, kFALSE, c2>=4);
+    }
+  }
+
+  //===== SSD layers =====
+
+  layerId = AliGeomManager::kSSD1;
+  modnum = 0;
+
+  str0 = "/ALIC_1/ITSV_1/ITSssdLayer5_1/ITSssdLay5Ladd_";//SSD layer1
+  str1 = "/ITSssdSensor5_";
+  str2 = "";
+
+  TString wafer;
+
+  for(Int_t c1 = 0; c1<34; c1++) {
+
+    ladder = str0;
+    ladder += c1; // the set of wafers from one ladder
+    strEntryName1 = strSSD;
+    strEntryName1 += 4;
+    strEntryName1 += strLadder;
+    strEntryName1 += c1;
+    //printf("%s    ==    %s\n",strEntryName1.Data(),ladder.Data());
+    if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),ladder.Data()))
+      AliFatal(Form("Unable to set alignable entry 1! %s :: %s",
+                   strEntryName1.Data(),ladder.Data()));
+
+    for(Int_t c2 =0; c2<22; c2++) {
+
+      modUID = AliGeomManager::LayerToVolUID(layerId,modnum++);
+      wafer = ladder;
+      wafer += str1;
+      wafer += c2;
+      //wafer += str2;    // one wafer
+      strEntryName2 = strEntryName1;
+      strEntryName2 += strSensor;
+      strEntryName2 += c2;
+      //printf("%s    ==    %s\n",strEntryName2.Data(),wafer.Data());
+      if(!gGeoManager->SetAlignableEntry(strEntryName2.Data(),wafer.Data(),modUID))
+       AliFatal(Form("Unable to set alignable entry 2! %s :: %s",
+                     strEntryName2.Data(),wafer.Data()));
+
+      SetT2Lmatrix(modUID, 0, kFALSE, kFALSE);
+    }
+  }
+
+  layerId = AliGeomManager::kSSD2;
+  modnum = 0;
+  str0 = "/ALIC_1/ITSV_1/ITSssdLayer6_1/ITSssdLay6Ladd_"; // SSD layer2
+  str1 = "/ITSssdSensor6_";
+  str2 = "";
+  
+  for(Int_t c1 = 0; c1<38; c1++) {
+
+    ladder = str0;
+    ladder += c1; // the set of wafers from one ladder
+    strEntryName1 = strSSD;
+    strEntryName1 += 5;
+    strEntryName1 += strLadder;
+    strEntryName1 += c1;
+    //printf("%s    ==    %s\n",strEntryName1.Data(),ladder.Data());
+    if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),ladder.Data()))
+      AliFatal(Form("Unable to set alignable entry 1! %s :: %s",
+                   strEntryName1.Data(),ladder.Data()));
+
+    for(Int_t c2 =0; c2<25; c2++) {
+
+      modUID = AliGeomManager::LayerToVolUID(layerId,modnum++);
+      wafer = ladder;
+      wafer += str1;
+      wafer += c2;
+      //wafer += str2;    // one wafer
+      strEntryName2 = strEntryName1;
+      strEntryName2 += strSensor;
+      strEntryName2 += c2;
+      //printf("%s    ==    %s\n",strEntryName2.Data(),wafer.Data());
+      if(!gGeoManager->SetAlignableEntry(strEntryName2.Data(),wafer.Data(),modUID))
+       AliFatal(Form("Unable to set alignable entry 2! %s :: %s",
+                     strEntryName2.Data(),wafer.Data()));
+
+      SetT2Lmatrix(modUID, 0, kFALSE, kFALSE);
+    }
+  }
+    
 }
+
 //______________________________________________________________________
-Float_t AliITSv11::GetStandardEfraction(Int_t istd){
-    // Returns one of a set of standard E fraction values.
-    // Inputs:
-    //   Int_t istd  Index to indecate which standard.
-    // Outputs:
-    //    none.
-    // Return:
-    //    The appropreate standard E fraction value [#].
-    Float_t t[]={0.1, // default
-                0.1, // Silicon detectors...
-                0.1, // Air in central detectors region
-                1.0  // Material in non-centeral region
-    };
-    return t[istd];
+void AliITSv11::CreateGeometry()
+{
+  // Create the geometry and insert it in ALIC
+
+  TGeoManager *geoManager = gGeoManager;
+
+  TGeoVolume *vALIC = geoManager->GetVolume("ALIC");
+
+  // This part is really ugly, needs to be redone
+  new TGeoVolumeAssembly("ITSV");
+  new TGeoVolumeAssembly("ITSS");
+
+  TGeoVolume *vITSV = geoManager->GetVolume("ITSV");
+  TGeoVolume *vITSS = geoManager->GetVolume("ITSS");
+
+  vALIC->AddNode(vITSV, 1, 0);
+  vALIC->AddNode(vITSS, 1, 0);
+
+  //
+  const Char_t *cvsDate="$Date$";
+  const Char_t *cvsRevision="$Revision$";
+  const Int_t kLength=100;
+  Char_t vstrng[kLength];
+  if(fInitGeom.WriteVersionString(vstrng,kLength,(AliITSVersion_t)IsVersion(),
+                            fMinorVersion,cvsDate,cvsRevision)) {
+    vITSV->SetTitle(vstrng);
+    vITSS->SetTitle(vstrng);
+  }
+
+  fSPDgeom->SPDSector(vITSV);
+
+  fSDDgeom->Layer3(vITSV);
+  fSDDgeom->Layer4(vITSV);
+  fSDDgeom->ForwardLayer3(vITSV);
+  fSDDgeom->ForwardLayer4(vITSV);
+
+  fSSDgeom->Layer5(vITSV);
+  fSSDgeom->Layer6(vITSV);
+  fSSDgeom->LadderSupportLayer5(vITSV);
+  fSSDgeom->LadderSupportLayer6(vITSV);
+  fSSDgeom->EndCapSupportSystemLayer6(vITSV);
+  fSSDgeom->EndCapSupportSystemLayer5(vITSV);
+
+  fSupgeom->SPDCone(vITSV);
+  fSupgeom->SDDCone(vITSV);
+  fSupgeom->SSDCone(vITSV);
+
+  fSDDgeom->SDDCables(vITSV);
+  fSSDgeom->SSDCables(vITSV);
+  fSupgeom->ServicesCableSupport(vITSS);
+
+  fSupgeom->ITSTPCSupports(vITSS);
+
 }
+
 //______________________________________________________________________
-void AliITSv11::Element(Int_t imat,const char* name,Int_t z,Double_t dens,
-                       Int_t istd){
-    // Defines a Geant single element material and sets its Geant medium
-    // proporties. The average atomic A is assumed to be given by their
-    // natural abundances. Things like the radiation length are calculated
-    // for you.
+void AliITSv11::CreateMaterials()
+{
+    // Create ITS materials
+    //     This function defines the default materials used in the Geant
+    // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
+    // AliITSv11.
+    // In general it is automatically replaced by
+    // the CreateMaterials routine defined in AliITSv?. Should the function
+    // CreateMaterials not exist for the geometry version you are using this
+    // one is used. See the definition found in AliITSv5 or the other routine
+    // for a complete definition.
     // Inputs:
-    //    Int_t imat       Material number.
-    //    const char* name Material name. No need to add a $ at the end.
-    //    Int_t z          The elemental number.
-    //    Double_t dens    The density of the material [g/cm^3].
-    //    Int_t istd       Defines which standard set of transport parameters
-    //                     which should be used.
-    // Output:
-    //     none.
+    //   none.
+    // Outputs:
+    //   none.
     // Return:
-    //     none.
-    Float_t rad,Z,A=GetA(z),tmax,stemax,deemax,epsilon;
-    char *name2;
-    Int_t len;
-
-    len = strlng(name)+1;
-    name2 = new char[len];
-    strncpy(name2,name,len-1);
-    name2[len-1] = '\0';
-    name2[len-2] = '$';
-    Z = (Float_t)z;
-    rad = GetRadLength(z)/dens;
-    AliMaterial(imat,name2,A,Z,dens,rad,0.0,0,0);
-    tmax    = GetStandardTheataMax(istd);    // degree
-    stemax  = GetStandardMaxStepSize(istd);  // cm
-    deemax  = GetStandardEfraction(istd);     // #
-    epsilon = GetStandardEpsilon(istd);
-    AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
-             gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
-    delete[] name2;
+    //   none.
+
+    Int_t   ifield = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
+    Float_t fieldm = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
+
+    Float_t tmaxfd = 0.1; // 1.0; // Degree
+    Float_t stemax = 1.0; // cm
+    Float_t deemax = 0.1; // 30.0; // Fraction of particle's energy 0<deemax<=1
+    Float_t epsil  = 1.0E-4; // 1.0; // cm
+    Float_t stmin  = 0.0; // cm "Default value used"
+
+    Float_t tmaxfdSi = 0.1; // .10000E+01; // Degree
+    Float_t stemaxSi = 0.0075; //  .10000E+01; // cm
+    Float_t deemaxSi = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
+    Float_t epsilSi  = 1.0E-4;// .10000E+01;
+    Float_t stminSi  = 0.0; // cm "Default value used"
+
+    Float_t tmaxfdAir = 0.1; // .10000E+01; // Degree
+    Float_t stemaxAir = .10000E+01; // cm
+    Float_t deemaxAir = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
+    Float_t epsilAir  = 1.0E-4;// .10000E+01;
+    Float_t stminAir  = 0.0; // cm "Default value used"
+
+    Float_t tmaxfdServ = 1.0; // 10.0; // Degree
+    Float_t stemaxServ = 1.0; // 0.01; // cm
+    Float_t deemaxServ = 0.5; // 0.1; // Fraction of particle's energy 0<deemax<=1
+    Float_t epsilServ  = 1.0E-3; // 0.003; // cm
+    Float_t stminServ  = 0.0; //0.003; // cm "Default value used"
+
+    // Freon PerFluorobuthane C4F10 see 
+    // http://st-support-cooling-electronics.web.cern.ch/
+    //        st-support-cooling-electronics/default.htm
+    Float_t afre[2]  = { 12.011,18.9984032 };
+    Float_t zfre[2]  = { 6., 9. };
+    Float_t wfre[2]  = { 4.,10. };
+    Float_t densfre  = 1.52;
+
+
+    //CM55J
+
+    Float_t aCM55J[4]={12.0107,14.0067,15.9994,1.00794};
+    Float_t zCM55J[4]={6.,7.,8.,1.};
+    Float_t wCM55J[4]={0.908508078,0.010387573,0.055957585,0.025146765};
+    Float_t dCM55J = 1.8;
+
+    //ALCM55J
+
+    Float_t aALCM55J[5]={12.0107,14.0067,15.9994,1.00794,26.981538};
+    Float_t zALCM55J[5]={6.,7.,8.,1.,13.};
+    Float_t wALCM55J[5]={0.817657902,0.0093488157,0.0503618265,0.0226320885,0.1};
+    Float_t dALCM55J = 1.9866;
+
+    //Si Chips
+
+    Float_t aSICHIP[6]={12.0107,14.0067,15.9994,1.00794,28.0855,107.8682};
+    Float_t zSICHIP[6]={6.,7.,8.,1.,14., 47.};
+    Float_t wSICHIP[6]={0.039730642,0.001396798,0.01169634,0.004367771,0.844665,0.09814344903};
+    Float_t dSICHIP = 2.36436;
+
+    //Inox
+    
+    Float_t aINOX[9]={12.0107,54.9380, 28.0855,30.9738,32.066,58.6928,51.9961,95.94,55.845};
+    Float_t zINOX[9]={6.,25.,14.,15.,16., 28.,24.,42.,26.};
+    Float_t wINOX[9]={0.0003,0.02,0.01,0.00045,0.0003,0.12,0.17,0.025,0.654};
+    Float_t dINOX = 8.03;
+
+    //AISI 304 L (from F.Tosello's web page - M.S. 18 Oct 10)
+    
+    Float_t a304L[8]={12.0107,54.9380, 28.0855,30.9738,32.066,58.6928,51.9961,55.845};
+    Float_t z304L[8]={6.,25.,14.,15.,16., 28.,24.,26.};
+    Float_t w304L[8]={0.0003,0.02,0.01,0.00045,0.003,0.0925,0.19,0.6865};
+    Float_t d304L = 8.03;
+
+    //SDD HV microcable
+
+    Float_t aHVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
+    Float_t zHVm[5]={6.,1.,7.,8.,13.};
+    Float_t wHVm[5]={0.520088819984,0.01983871336,0.0551367996,0.157399667056, 0.247536};
+    Float_t dHVm = 1.6087;
+
+    //SDD LV+signal cable
+
+    Float_t aLVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
+    Float_t zLVm[5]={6.,1.,7.,8.,13.};
+    Float_t wLVm[5]={0.21722436468,0.0082859922,0.023028867,0.06574077612, 0.68572};
+    Float_t dLVm = 2.1035;
+
+    //SDD hybrid microcab
+
+    Float_t aHLVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
+    Float_t zHLVm[5]={6.,1.,7.,8.,13.};
+    Float_t wHLVm[5]={0.24281879711,0.00926228815,0.02574224025,0.07348667449, 0.64869};
+    Float_t dHLVm = 2.0502;
+
+    //SDD anode microcab
+
+    Float_t aALVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
+    Float_t zALVm[5]={6.,1.,7.,8.,13.};
+    Float_t wALVm[5]={0.392653705471,0.0128595919215,0.041626868025,0.118832707289, 0.431909};
+    Float_t dALVm = 2.0502;
+
+    //X7R capacitors - updated from F.Tosello's web page - M.S. 18 Oct 10
+
+    Float_t aX7R[6]={137.327,47.867,15.9994,58.6928,63.5460,118.710};
+    Float_t zX7R[6]={56.,22.,8.,28.,29.,50.};
+    Float_t wX7R[6]={0.524732,0.176736,0.179282,0.079750,0.019750,0.019750};
+    Float_t dX7R = 6.07914;
+
+    //X7R weld, i.e. Sn 60% Pb 40% (from F.Tosello's web page - M.S. 15 Oct 10)
+
+    Float_t aX7Rweld[2]={118.71 , 207.20};
+    Float_t zX7Rweld[2]={ 50.   ,  82.  };
+    Float_t wX7Rweld[2]={  0.60 ,   0.40};
+    Float_t dX7Rweld   = 8.52358;
+
+    // AIR
+
+    Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
+    Float_t zAir[4]={6.,7.,8.,18.};
+    Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
+    Float_t dAir = 1.20479E-3;
+
+    // Water
+
+    Float_t aWater[2]={1.00794,15.9994};
+    Float_t zWater[2]={1.,8.};
+    Float_t wWater[2]={0.111894,0.888106};
+    Float_t dWater   = 1.0;
+
+    // CERAMICS
+  //     94.4% Al2O3 , 2.8% SiO2 , 2.3% MnO , 0.5% Cr2O3
+    Float_t acer[5]  = { 26.981539,15.9994,28.0855,54.93805,51.9961 };
+    Float_t zcer[5]  = {       13.,     8.,    14.,     25.,    24. };
+    Float_t wcer[5]  = {.4443408,.5213375,.0130872,.0178135,.003421};
+    Float_t denscer  = 3.6;
+
+    //G10FR4
+
+    Float_t zG10FR4[14] = {14.00,      20.00,  13.00,  12.00,  5.00,   22.00,  11.00,  19.00,  26.00,  9.00,   8.00,   6.00,   7.00,   1.00};
+    Float_t aG10FR4[14] = {28.0855000,40.0780000,26.9815380,24.3050000,10.8110000,47.8670000,22.9897700,39.0983000,55.8450000,18.9984000,15.9994000,12.0107000,14.0067000,1.0079400};
+    Float_t wG10FR4[14] = {0.15144894,0.08147477,0.04128158,0.00904554,0.01397570,0.00287685,0.00445114,0.00498089,0.00209828,0.00420000,0.36043788,0.27529426,0.01415852,0.03427566};
+    Float_t densG10FR4= 1.8;
+    
+     //--- EPOXY  --- C18 H19 O3
+      Float_t aEpoxy[3] = {15.9994, 1.00794, 12.0107} ; 
+      Float_t zEpoxy[3] = {     8.,      1.,      6.} ; 
+      Float_t wEpoxy[3] = {     3.,     19.,     18.} ; 
+      Float_t dEpoxy = 1.8 ;
+
+      // rohacell: C9 H13 N1 O2
+    Float_t arohac[4] = {12.01,  1.01, 14.010, 16.};
+    Float_t zrohac[4] = { 6.,    1.,    7.,     8.};
+    Float_t wrohac[4] = { 14.,   10.,    2.,     6.};
+    Float_t drohac    = 0.052;
+
+    // If he/she means stainless steel (inox) + Aluminium and Zeff=15.3383 then
+//
+// %Al=81.6164 %inox=100-%Al
+
+    Float_t aInAl[5] = {27., 55.847,51.9961,58.6934,28.0855 };
+    Float_t zInAl[5] = {13., 26.,24.,28.,14. };
+    Float_t wInAl[5] = {.816164, .131443,.0330906,.0183836,.000919182};
+    Float_t dInAl    = 3.075;
+
+    // Aluminum alloy with 12% Copper - 21 Oct 10
+
+    Float_t aAlCu12[2] = {26.9815, 63.546};
+    Float_t zAlCu12[2] = {13.    , 29.   };
+    Float_t wAlCu12[2] = { 0.88  ,  0.12 };
+    Float_t dAlCu12    = 2.96;
+
+    // Kapton
+
+    Float_t aKapton[4]={1.00794,12.0107, 14.010,15.9994};
+    Float_t zKapton[4]={1.,6.,7.,8.};
+    Float_t wKapton[4]={0.026362,0.69113,0.07327,0.209235};
+    Float_t dKapton   = 1.42;
+    
+    // Kapton + Cu (for Pixel Bus)
+
+    Float_t aKaptonCu[5]={1.00794, 12.0107, 14.010, 15.9994, 63.5460};
+    Float_t zKaptonCu[5]={1., 6., 7., 8., 29.};
+    Float_t wKaptonCuBus[5];
+    
+    // Kapton + Cu (for Pixel MCM)
+
+    Float_t wKaptonCuMCM[5];
+    
+    // Kapton + Cu (mix of two above)
+
+    Float_t wKaptonCuMix[5];
+
+    //SDD ruby sph.
+    Float_t aAlOxide[2]  = { 26.981539,15.9994};
+    Float_t zAlOxide[2]  = {       13.,     8.};
+    Float_t wAlOxide[2]  = {0.4707, 0.5293};
+    Float_t dAlOxide     = 3.97;
+
+    // Silica for optical fibers: Si O2
+    Float_t aoptfib[2] = { 28.0855, 15.9994};
+    Float_t zoptfib[2] = { 14.,      8.    };
+    Float_t woptfib[2] = {  1.,      2.    };
+    Float_t doptfib    = 2.55;
+
+    // Tetrafluorethylene-Perfluorpropylene (FEP) - 08 Mar 10
+    Float_t aFEP[2] = { 12.0107, 18.9984};
+    Float_t zFEP[2] = {  6.    ,  9.    };
+    Float_t wFEP[2] = {  1.    ,  2.    };
+    Float_t dFEP    = 2.15;
+
+    // PVC (C2H3Cl)n - 08 Jul 10
+    Float_t aPVC[3] = { 12.0107, 1.00794, 35.4527};
+    Float_t zPVC[3] = {  6.    , 1.     , 35.   };
+    Float_t wPVC[3] = {  2.    , 3.     ,  1.   };
+    Float_t dPVC    = 1.3;
+
+    // PBT (Polybutylene terephthalate = C12-H12-O4) - 01 Sep 10
+    Float_t aPBT[3] = { 12.0107, 1.00794, 15.9994};
+    Float_t zPBT[3] = {  6.    , 1.     ,  8.   };
+    Float_t wPBT[3] = { 12.    ,12.     ,  4.   };
+    Float_t dPBT    = 1.31;
+
+    // POLYAX (POLYAX = C37-H24-O6-N2) - 03 Sep 10
+    Float_t aPOLYAX[4] = { 12.0107, 1.00794, 15.9994, 14.00674};
+    Float_t zPOLYAX[4] = {  6.    , 1.     ,  8.    ,  7.     };
+    Float_t wPOLYAX[4] = { 37.    ,24.     ,  6.    ,  2.     };
+    Float_t dPOLYAX    = 1.27;
+
+    // PPS (PPS = C6-H4-S) - 05 Sep 10
+    Float_t aPPS[3] = { 12.0107, 1.00794, 32.066};
+    Float_t zPPS[3] = {  6.    , 1.     , 16.   };
+    Float_t wPPS[3] = {  6.    , 4.     ,  1.   };
+    Float_t dPPS    = 1.35;
+
+    // Megolon (Polyolefin = (C-H2)n) - 20 Oct 10
+    Float_t aMegolon[2] = { 12.0107, 1.00794};
+    Float_t zMegolon[2] = {  6.    , 1.     };
+    Float_t wMegolon[2] = {  1.    , 2.     };
+    Float_t dMegolon    = 1.51; // Mean of various types
+
+    // Standard glass (from glassproperties.com/glasses - M.S. 21 Oct 10)
+    Float_t aStdGlass[7] = {15.9994  ,28.0855  ,22.98977 ,40.078   ,
+                           24.305   ,26.981539,39.0983  };
+    Float_t zStdGlass[7] = { 8.      ,14.      ,11.      ,20.      ,
+                           12.      ,13.      ,19.      };
+    Float_t wStdGlass[7] = { 0.468377, 0.348239, 0.096441, 0.071469,
+                            0.006030, 0.005293, 0.004151};
+    Float_t dStdGlass    = 2.53;
+
+    // Glass Fiber (from F.Tosello's web page - M.S. 15 Oct 10)
+    Float_t aGlass[11] = {15.9994  ,28.0855  ,40.078   ,26.981539,10.811   ,
+               24.305   ,39.0983  ,22.98977 ,18.9984  ,47.867   ,55.845};
+    Float_t zGlass[11] = { 8.      ,14.      ,20       ,13       , 5       ,
+               12.      ,19       ,11       , 9       ,22       ,26    };
+    Float_t wGlass[11] = { 0.473610, 0.252415, 0.135791, 0.068803, 0.023293,
+                0.015076, 0.008301, 0.007419, 0.007000, 0.004795, 0.003497};
+    Float_t dGlass = 2.61;
+
+    // Ryton R-4 04 (from F.Tosello's web page - M.S. 15 Oct 10)
+    Float_t aRyton[14] = {15.9994  ,28.0855  ,40.078   ,26.981539,10.811   ,
+                         24.305   ,39.0983  ,22.98977 ,18.9984  ,47.867   ,
+                         55.845   ,12.0107  , 1.00794 ,32.066   };
+    Float_t zRyton[14] = { 8.      ,14.      ,20.      ,13.      , 5.      ,
+                         12.      ,19.      ,11.      , 9.      ,22.      ,
+                         26.      , 6.      , 1.      ,16.      };
+    Float_t wRyton[14] = { 0.189445, 0.100966, 0.054316, 0.027521, 0.009317,
+                          0.006030, 0.003320, 0.002968, 0.002800, 0.001918,
+                          0.001399, 0.399760, 0.022365, 0.177875};
+    Float_t dRyton = 1.65;
+
+    // Plexiglas (Poly(methyl methacrylate) (C5O2H8)n - M.S. 05 nov 10)
+    Float_t aPlexy[3] = { 12.0107, 15.9994,  1.00794};
+    Float_t zPlexy[3] = {  6.    , 8.     ,  1.   };
+    Float_t wPlexy[3] = {  5.    , 2.     ,  8.   };
+    Float_t dPlexy    = 1.18;
+
+    //SSD NiSn capacitor ends
+    Float_t aNiSn[2]  = { 56.6934,118.710};
+    Float_t zNiSn[2]  = {     28.,     50.};
+    Float_t wNiSn[2]  = {0.33, 0.67};
+    Float_t dNiSn     = wNiSn[0]*8.908 + wNiSn[1]*7.310;
+
+    AliMaterial(1,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
+    AliMedium(1,"SI$",1,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
+
+    AliMaterial(2,"SPD SI CHIP$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
+    AliMedium(2,"SPD SI CHIP$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
+
+    AliMaterial(3,"SPD SI BUS$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
+    AliMedium(3,"SPD SI BUS$",3,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
+
+    AliMixture(4,"C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
+    AliMedium(4,"C (M55J)$",4,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(5,"AIR$",aAir,zAir,dAir,4,wAir);
+    AliMedium(5,"AIR$",5,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
+
+    AliMixture(6,"GEN AIR$",aAir,zAir,dAir,4,wAir);
+    AliMedium(6,"GEN AIR$",6,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
+
+    AliMixture(7,"SDD SI CHIP$",aSICHIP,zSICHIP,dSICHIP,6,wSICHIP);
+    AliMedium(7,"SDD SI CHIP$",7,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
+
+    AliMixture(9,"SDD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
+    AliMedium(9,"SDD C (M55J)$",9,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(10,"SDD AIR$",aAir,zAir,dAir,4,wAir);
+    AliMedium(10,"SDD AIR$",10,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
+
+    AliMaterial(11,"AL$",0.26982E+02,0.13000E+02,0.26989E+01,0.89000E+01,0.99900E+03);
+    AliMedium(11,"AL$",11,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(12, "Water$",aWater,zWater,dWater,2,wWater);
+    AliMedium(12,"WATER$",12,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(13,"Freon$",afre,zfre,densfre,-2,wfre);
+    AliMedium(13,"Freon$",13,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMaterial(14,"COPPER$",0.63546E+02,0.29000E+02,0.89600E+01,0.14300E+01,0.99900E+03);
+    AliMedium(14,"COPPER$",14,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+    AliMixture(15,"CERAMICS$",acer,zcer,denscer,5,wcer);
+    AliMedium(15,"CERAMICS$",15,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(20,"SSD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
+    AliMedium(20,"SSD C (M55J)$",20,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(21,"SSD AIR$",aAir,zAir,dAir,4,wAir);
+    AliMedium(21,"SSD AIR$",21,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
+
+    AliMixture(25,"G10FR4$",aG10FR4,zG10FR4,densG10FR4,14,wG10FR4);
+    AliMedium(25,"G10FR4$",25,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+     AliMixture(26,"GEN C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
+    AliMedium(26,"GEN C (M55J)$",26,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(27,"GEN Air$",aAir,zAir,dAir,4,wAir);
+    AliMedium(27,"GEN Air$",27,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
+
+    AliMixture(35,"PLEXYGLAS$",aPlexy,zPlexy,dPlexy,-3,wPlexy);
+    AliMedium(35,"PLEXYGLAS$",35,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(36,"STDGLASS$",aStdGlass,zStdGlass,dStdGlass,7,wStdGlass);
+    AliMedium(36,"STDGLASS$",36,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(37,"ALCU12$",aAlCu12,zAlCu12,dAlCu12,2,wAlCu12);
+    AliMedium(37,"ALCU12$",37,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(38,"MEGOLON$",aMegolon,zMegolon,dMegolon,-2,wMegolon);
+    AliMedium(38,"MEGOLON$",38,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(39,"RYTON$",aRyton,zRyton,dRyton,14,wRyton);
+    AliMedium(39,"RYTON$",39,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(40,"GLASS FIBER$",aGlass,zGlass,dGlass,11,wGlass);
+    AliMedium(40,"GLASS FIBER$",40,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(41,"AISI304L$",a304L,z304L,d304L,8,w304L);
+    AliMedium(41,"AISI304L$",41,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMaterial(42,"NICKEL$",0.58693E+02,0.28000E+02,0.89080E+01,0.14200E+01,0.99900E+03);
+    AliMedium(42,"NICKEL$",42,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+               
+    AliMixture(43,"SDD X7R weld$",aX7Rweld,zX7Rweld,dX7Rweld,2,wX7Rweld);
+    AliMedium(43,"SDD X7R weld$",43,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(44,"PPS$",aPPS,zPPS,dPPS,-3,wPPS);
+    AliMedium(44,"PPS$",44,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(45,"POLYAX$",aPOLYAX,zPOLYAX,dPOLYAX,-4,wPOLYAX);
+    AliMedium(45,"POLYAX$",45,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(46,"PBT$",aPBT,zPBT,dPBT,-3,wPBT);
+    AliMedium(46,"PBT$",46,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(47,"PVC$",aPVC,zPVC,dPVC,-3,wPVC);
+    AliMedium(47,"PVC$",47,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    Double_t cuFrac = 0.56;
+    Double_t kFrac  = 1.0 - cuFrac;
+    Double_t cuDens = 8.96;
+    Float_t dKaptonCuBus   = cuFrac * cuDens + kFrac * dKapton;
+    for (Int_t j=0; j<4; j++)
+      wKaptonCuBus[j] = wKapton[j]*kFrac;
+    wKaptonCuBus[4] = cuFrac;
+    AliMixture(48, "SPD-BUS CU KAPTON", aKaptonCu, zKaptonCu, dKaptonCuBus, 5, wKaptonCuBus);
+    AliMedium(48,"SPD-BUS CU KAPTON$",48,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+    
+    cuFrac = 0.5;
+    kFrac  = 1.0 - cuFrac;
+    Float_t dKaptonCuMCM   = cuFrac * cuDens + kFrac * dKapton;
+    for (Int_t j=0; j<4; j++)
+      wKaptonCuMCM[j] = wKapton[j]*kFrac;
+    wKaptonCuMCM[4] = cuFrac;
+    AliMixture(49, "SPD-MCM CU KAPTON", aKaptonCu, zKaptonCu, dKaptonCuMCM, 5, wKaptonCuMCM);
+    AliMedium(49,"SPD-MCM CU KAPTON$",49,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+    
+    cuFrac = (0.56 + 0.5) / 2.0;
+    kFrac  = 1.0 - cuFrac;
+    Float_t dKaptonCuMix   = cuFrac * cuDens + kFrac * dKapton;
+    for (Int_t j=0; j<4; j++)
+      wKaptonCuMix[j] = wKapton[j]*kFrac;
+    wKaptonCuMix[4] = cuFrac;
+    AliMixture(50, "SPD-MIX CU KAPTON", aKaptonCu, zKaptonCu, dKaptonCuMix, 5, wKaptonCuMix);
+    AliMedium(50,"SPD-MIX CU KAPTON$",50,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMaterial(51,"SPD SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
+    AliMedium(51,"SPD SI$",51,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
+
+    AliMaterial(52,"SPD SI CHIP$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
+    AliMedium(52,"SPD SI CHIP$",52,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
+
+    AliMaterial(53,"SPD SI BUS$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
+    AliMedium(53,"SPD SI BUS$",53,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
+
+    AliMixture(54,"SPD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
+    AliMedium(54,"SPD C (M55J)$",54,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(55,"SPD AIR$",aAir,zAir,dAir,4,wAir);
+    AliMedium(55,"SPD AIR$",55,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
+
+    AliMixture(56, "SPD KAPTON(POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
+    AliMedium(56,"SPD KAPTON(POLYCH2)$",56,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    // Gaseous Freon has same chemical composition but air density at 1.7 atm
+    AliMixture(59,"GASEOUS FREON$",afre,zfre,1.7*dAir,-2,wfre);
+    AliMedium(59,"GASEOUS FREON$",59,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(61,"EPOXY$",aEpoxy,zEpoxy,dEpoxy,-3,wEpoxy);
+    AliMedium(61,"EPOXY$",61,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMaterial(62,"SILICON$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
+    AliMedium(62,"SILICON$",62,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
+
+    AliMixture(63, "KAPTONH(POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
+    AliMedium(63,"KAPTONH(POLYCH2)$",63,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMaterial(64,"ALUMINUM$",0.26982E+02,0.13000E+02,0.26989E+01,0.89000E+01,0.99900E+03);
+    AliMedium(64,"ALUMINUM$",64,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(65,"INOX$",aINOX,zINOX,dINOX,9,wINOX);
+    AliMedium(65,"INOX$",65,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(66,"NiSn$",aNiSn,zNiSn,dNiSn,2,wNiSn);
+    AliMedium(66,"NiSn$",66,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMaterial(67,"Sn$", 118.710, 50., 7.310, 1.206, 999.);
+    AliMedium(67,"Sn$",67,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(68,"ROHACELL$",arohac,zrohac,drohac,-4,wrohac);
+    AliMedium(68,"ROHACELL$",68,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+     AliMixture(69,"SDD C AL (M55J)$",aALCM55J,zALCM55J,dALCM55J,5,wALCM55J);
+    AliMedium(69,"SDD C AL (M55J)$",69,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+  
+    AliMixture(70, "SDDKAPTON (POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
+    AliMedium(70,"SDDKAPTON (POLYCH2)$",70,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+     AliMaterial(71,"ITS SANDW A$",0.12011E+02,0.60000E+01,0.2115E+00,0.17479E+03,0.99900E+03);
+    AliMedium(71,"ITS SANDW A$",71,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMaterial(72,"ITS SANDW B$",0.12011E+02,0.60000E+01,0.27000E+00,0.18956E+03,0.99900E+03);
+    AliMedium(72,"ITS SANDW B$",72,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMaterial(73,"ITS SANDW C$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
+    AliMedium(73,"ITS SANDW C$",73,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMaterial(74,"HEAT COND GLUE$",0.12011E+02,0.60000E+01,0.1930E+01,0.22100E+02,0.99900E+03);
+    AliMedium(74,"HEAT COND GLUE$",74,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMaterial(75,"ELASTO SIL$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
+    AliMedium(75,"ELASTO SIL$",75,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    // SPD bus (data from Petra Riedler)
+    Float_t aSPDbus[5] = {1.00794,12.0107,14.01,15.9994,26.982 };
+    Float_t zSPDbus[5] = {1.,6.,7.,8.,13.};
+    Float_t wSPDbus[5] = {0.023523,0.318053,0.009776,0.078057,0.570591};
+    Float_t dSPDbus    = 2.128505;
+
+    //   AliMaterial(76,"SPDBUS(AL+KPT+EPOX)$",0.19509E+02,0.96502E+01,0.19060E+01,0.15413E+02,0.99900E+03);
+    AliMixture(76,"SPDBUS(AL+KPT+EPOX)$",aSPDbus,zSPDbus,dSPDbus,5,wSPDbus);
+    AliMedium(76,"SPDBUS(AL+KPT+EPOX)$",76,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+               
+    AliMixture(77,"SDD X7R capacitors$",aX7R,zX7R,dX7R,6,wX7R);
+    AliMedium(77,"SDD X7R capacitors$",77,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(78,"SDD ruby sph. Al2O3$",aAlOxide,zAlOxide,dAlOxide,2,wAlOxide);
+    AliMedium(78,"SDD ruby sph. Al2O3$",78,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMaterial(79,"SDD SI insensitive$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
+    AliMedium(79,"SDD SI insensitive$",79,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(80,"SDD HV microcable$",aHVm,zHVm,dHVm,5,wHVm);
+    AliMedium(80,"SDD HV microcable$",80,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(81,"SDD LV+signal cable$",aLVm,zLVm,dLVm,5,wLVm);
+    AliMedium(81,"SDD LV+signal cable$",81,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(82,"SDD hybrid microcab$",aHLVm, zHLVm,dHLVm,5,wHLVm);
+    AliMedium(82,"SDD hybrid microcab$",82,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(83,"SDD anode microcab$",aALVm,zALVm,dALVm,5,wALVm);
+    AliMedium(83,"SDD anode microcab$",83,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+    Float_t aDSring[4]={12.0107,      1.00794,     14.0067,      15.9994};
+    Float_t zDSring[4]={ 6.,          1.,           7.,           8.};
+    Float_t wDSring[4]={ 0.854323888, 0.026408778,  0.023050265,  0.096217069};
+    Float_t dDSring = 0.2875;
+    AliMixture(84,"SDD/SSD rings$",aDSring,zDSring,dDSring,4,wDSring);
+    AliMedium(84,"SDD/SSD rings$",84,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(85,"inox/alum$",aInAl,zInAl,dInAl,5,wInAl);
+    AliMedium(85,"inox/alum$",85,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    // special media to take into account services in the SDD and SSD 
+    // cones for the FMD
+    //Begin_Html
+    /*
+      <A HREF="http://www.Physics.ohio-state.edu/~nilsen/ITS/ITS_MatBudget_4B.xls">
+      </pre>
+      <br clear=left>
+      <font size=+2 color=blue>
+      <p> The Exel spread sheet from which these density number come from.
+      </font></A>
+    */
+    //End_Html
+
+    //  AliMaterial(86,"AIRFMDSDD$",0.14610E+02,0.73000E+01,0.12050E-02,0.30423E+05,0.99900E+03);
+    Float_t aA[13],zZ[13],wW[13],den;
+    // From Pierluigi Barberis calculations of 2SPD+1SDD October 2 2002.
+    zZ[0] = 1.0; aA[0] = 1.00794; // Hydrogen
+    zZ[1] = 6.0; aA[1] = 12.011; // Carbon
+    zZ[2] = 7.0; aA[2] = 14.00674; // Nitrogen
+    zZ[3] = 8.0; aA[3] = 15.9994; // Oxigen
+    zZ[4] = 14.0; aA[4] = 28.0855; // Silicon
+    zZ[5] = 24.0; aA[5] = 51.9961; //Cromium
+    zZ[6] = 25.0; aA[6] = 54.938049; // Manganese
+    zZ[7] = 26.0; aA[7] = 55.845; // Iron
+    zZ[8] = 28.0; aA[8] = 58.6934; // Nickle
+    zZ[9] = 29.0; aA[9] = 63.546; // Copper
+    zZ[10] = 13.0; aA[10] = 26.981539; // Alulminum
+    zZ[11] = 47.0; aA[11] = 107.8682; // Silver
+    zZ[12] = 27.0; aA[12] = 58.9332; // Cobolt
+    wW[0] = 0.019965;
+    wW[1] = 0.340961;
+    wW[2] = 0.041225;
+    wW[3] = 0.200352;
+    wW[4] = 0.000386;
+    wW[5] = 0.001467;
+    wW[6] = 0.000155;
+    wW[7] = 0.005113;
+    wW[8] = 0.000993;
+    wW[9] = 0.381262;
+    wW[10] = 0.008121;
+    wW[11] = 0.000000;
+    wW[12] = 0.000000;
+    if(fByThick){// New values seeITS_MatBudget_4B.xls
+       den = 1.5253276; // g/cm^3  Cell O370
+    }else{
+       den = 2.58423412; // g/cm^3 Cell L370
+    } // end if fByThick
+    //den = 6161.7/(3671.58978);//g/cm^3 Volume does not exclude holes
+    AliMixture(86,"AIRFMDSDD$",aA,zZ,den,+11,wW);
+    AliMedium(86,"AIRFMDSDD$",86,0,ifield,fieldm,tmaxfdAir,stemaxAir,
+             deemaxAir,epsilAir,stminAir);
+
+    //AliMaterial(87,"AIRFMDSSD$",0.14610E+02,0.73000E+01,0.12050E-02,0.30423E+05,0.99900E+03);
+    // From Pierluigi Barberis calculations of SSD October 2 2002.
+    wW[0] = 0.019777;
+    wW[1] = 0.325901;
+    wW[2] = 0.031848;
+    wW[3] = 0.147668;
+    wW[4] = 0.030609;
+    wW[5] = 0.013993;
+    wW[6] = 0.001479;
+    wW[7] = 0.048792;
+    wW[8] = 0.009477;
+    wW[9] = 0.350697;
+    wW[10] = 0.014546;
+    wW[11] = 0.005213;
+    wW[12] = 0.000000;
+    if(fByThick){// New values seeITS_MatBudget_4B.xls
+       den = 1.2464275; // g/cm^3   Cell O403
+    }else{
+       den = 1.28134409; // g/cm^3  Cell L403
+    } // end if fByThick
+    //den = 7666.3/(9753.553259); // volume does not exclude holes
+    AliMixture(87,"AIRFMDSSD$",aA,zZ,den,+12,wW); 
+    AliMedium(87,"AIRFMDSSD$",87,0,ifield,fieldm,tmaxfdAir,stemaxAir,
+             deemaxAir,epsilAir,stminAir);
+
+    //AliMaterial(88,"ITS SANDW CFMDSDD$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
+    // From Pierluigi Barberis calculations of 1SDD+Carbon fiber October 2 2002
+    wW[0] = 0.016302;
+    wW[1] = 0.461870;
+    wW[2] = 0.033662;
+    wW[3] = 0.163595;
+    wW[4] = 0.000315;
+    wW[5] = 0.001197;
+    wW[6] = 0.000127;
+    wW[7] = 0.004175;
+    wW[8] = 0.000811;
+    wW[9] = 0.311315;
+    wW[10] = 0.006631;
+    wW[11] = 0.000000;
+    wW[12] = 0.000000;
+    if(fByThick){// New values seeITS_MatBudget_4B.xls
+       den = 1.9353276; // g/cm^3  Cell N370
+    }else{
+       den = 3.2788626; // g/cm^3 Cell F370
+    } // end if fByThick
+    //den = 7667.1/(3671.58978); // Volume does not excludeholes
+    AliMixture(88,"ITS SANDW CFMDSDD$",aA,zZ,den,+11,wW); 
+    AliMedium(88,"ITS SANDW CFMDSDD$",88,0,ifield,fieldm,tmaxfd,stemax,
+             deemax,epsil,stmin);
+
+    //AliMaterial(89,"ITS SANDW CFMDSSD$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
+    // From Pierluigi Barberis calculations of SSD+Carbon fiber October 2 2002.
+    wW[0] = 0.014065;
+    wW[1] = 0.520598;
+    wW[2] = 0.022650;
+    wW[3] = 0.105018;
+    wW[4] = 0.021768;
+    wW[5] = 0.009952;
+    wW[6] = 0.001051;
+    wW[7] = 0.034700;
+    wW[8] = 0.006740;
+    wW[9] = 0.249406;
+    wW[10] = 0.010345;
+    wW[11] = 0.0003707;
+    wW[12] = 0.000000;
+    if(fByThick){// New values seeITS_MatBudget_4B.xls
+       den = 1.6564275; // g/cm^3  Cell N304
+    }else{
+       den = 1.7028296; // g/cm^3  Cell F304
+    } // end if fByThick
+    //den = 1166.5/(3671.58978); // Volume does not exclude holes
+    AliMixture(89,"ITS SANDW CFMDSSD$",aA,zZ,den,+12,wW); 
+    AliMedium(89,"ITS SANDW CFMDSSD$",89,0,ifield,fieldm,tmaxfd,stemax,
+             deemax,epsil,stmin);
+
+    //AliMaterial(97,"SPD SERVICES$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
+    // From Pierluigi Barberis calculations of 1SPD October 2 2002.
+    wW[0] = 0.005970;
+    wW[1] = 0.304704;
+    wW[2] = 0.042510;
+    wW[3] = 0.121715;
+    wW[4] = 0.001118;
+    wW[5] = 0.030948;
+    wW[6] = 0.003270;
+    wW[7] = 0.107910;
+    wW[8] = 0.020960;
+    wW[9] = 0.360895;
+    wW[10] = 0.000000;
+    wW[11] = 0.000000;
+    wW[12] = 0.000000;
+    if(fByThick){// New values seeITS_MatBudget_4B.xls
+       den = 80.31136576; // g/cm^3 Cell H329
+    }else{
+       den = 87.13062; // g/cm^3  Cell G329
+    } // end if fByThick
+    //den = 1251.3/(0.05*2.0*TMath::Pi()*(7.75*7.75 - 3.7*3.7)); // g/cm^3
+    AliMixture(97,"SPD SERVICES$",aA,zZ,den,+10,wW); 
+    AliMedium(97,"SPD SERVICES$",97,0,ifield,fieldm,tmaxfd,stemax,
+             deemax,epsil,stmin);
+
+
+    // Special media
+
+    AliMaterial(90,"SPD shield$", 12.011, 6., 1.93 , 22.36, 999);
+    AliMedium(90,"SPD shield$",90,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
+
+    // SPD End Ladder (data from Petra Riedler)
+    Float_t aSPDel[5] = {1.00794,12.0107,14.01,15.9994,63.54 };
+    Float_t zSPDel[5] = {1.,6.,7.,8.,29.};
+    Float_t wSPDel[5] = {0.004092,0.107274,0.011438,0.032476,0.844719};
+    Float_t dSPDel    = 3.903403;
+
+    //   AliMaterial(91, "SPD End ladder$", 47.0447, 21.7963, 3.6374, 4.4711, 999); 
+    AliMixture(91,"SPD End ladder$",aSPDel,zSPDel,dSPDel,5,wSPDel);
+    AliMedium(91,"SPD End ladder$",91,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
+
+    AliMaterial(92, "SPD cone$",28.0855, 14., 2.33, 9.36, 999);    
+    AliMedium(92,"SPD cone$",92,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
+    /*  Material with fractional Z not actually used
+    AliMaterial(93, "SDD End ladder$", 69.9298, 29.8246, 0.3824, 36.5103, 999);
+    AliMedium(93,"SDD End ladder$",93,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
+    */
+    AliMaterial(94, "SDD cone$",63.546, 29., 1.15, 1.265, 999);
+    AliMedium(94,"SDD cone$",94,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
+    /* Material with fractional Z not actually used
+    AliMaterial(95, "SSD End ladder$", 32.0988, 15.4021, 0.68, 35.3238, 999); 
+    AliMedium(95,"SSD End ladder$",95,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
+    */
+    AliMaterial(96, "SSD cone$",63.546, 29., 1.15, 1.265, 999);
+    AliMedium(96,"SSD cone$",96,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
+
+    AliMixture(98,"SDD OPTICFIB$",aoptfib,zoptfib,doptfib,-2,woptfib);
+    AliMedium(98,"SDD OPTICFIB$",98,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    AliMixture(95,"SSD FEP$",aFEP,zFEP,dFEP,-2,wFEP);
+    AliMedium(95,"SSD FEP$",95,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    // Mean material for low-voltage cables on SPD trays Side A
+    // (Copper + PolyEthylene (C2-H4)) (D.Elia for cable number and
+    // cross-section area, M.Sitta for elemental computation) - 26 Feb 10
+    wW[0] = 0.323024;//H
+    wW[2] = 0.515464;//Cu
+    wW[1] = 0.161512;//C
+    wW[3] = 0.000000;//O
+    wW[4] = 0.000000;//S
+    wW[5] = 0.000000;//F
+    wW[6] = 0.000000;//Sn
+    wW[7] = 0.000000;//Pb
+    wW[8] = 0.000000;//Cr
+    wW[9] = 0.000000;//Si
+    wW[10] = 0.000000;//Ni
+    wW[11] = 0.000000;//Ca
+
+    den = 5.078866;
+    AliMixture(60,"SPD_LOWCABLES$",aA,zZ,den,+3,wW);
+    AliMedium(60,"SPD_LOWCABLES$",60,0,ifield,fieldm,tmaxfd,stemax,
+             deemax,epsil,stmin);
+
+    // Mean material for high-voltage cables on SPD trays Side A & C
+    // (Copper + HD PolyEthylene (C2-H2)) (D.Elia for cable number and
+    // cross-section area, M.Sitta for elemental computation) - 10 Jun 10
+    wW[0] = 0.083766;//H
+    wW[2] = 0.417136;//Cu
+    wW[1] = 0.499098;//C
+    wW[3] = 0.000000;//O
+    wW[4] = 0.000000;//S
+    wW[5] = 0.000000;//F
+    wW[6] = 0.000000;//Sn
+    wW[7] = 0.000000;//Pb
+    wW[8] = 0.000000;//Cr
+    wW[9] = 0.000000;//Si
+    wW[10] = 0.000000;//Ni
+    wW[11] = 0.000000;//Ca
+
+    den = 1.514930;
+    AliMixture(58,"SPD_HICABLES$",aA,zZ,den,+3,wW);
+    AliMedium(58,"SPD_HICABLES$",58,0,ifield,fieldm,tmaxfd,stemax,
+             deemax,epsil,stmin);
+
+    // PolyUrethane [C25-H42-N2-O6] - 07 Mar 10
+    zZ[2] =  7.0; aA[2] =  14.0067; // Nitrogen - From Root TGeoElementTable
+
+    wW[0] = 0.090724;//H
+    wW[2] = 0.060035;//N
+    wW[1] = 0.643513;//C
+    wW[3] = 0.205728;//O
+    wW[4] = 0.000000;//S
+    wW[5] = 0.000000;//F
+    wW[6] = 0.000000;//Sn
+    wW[7] = 0.000000;//Pb
+    wW[8] = 0.000000;//Cr
+    wW[9] = 0.000000;//Si
+    wW[10] = 0.000000;//Ni
+    wW[11] = 0.000000;//Ca
+
+    den = 1.158910;
+    AliMixture(67,"POLYURETHANE$",aA,zZ,den,+4,wW);
+    AliMedium(67,"POLYURETHANE$",67,0,ifield,fieldm,tmaxfd,stemax,
+             deemax,epsil,stmin);
+
+    //  POM (Polyoxymethylene = (CH2O)n ) - 02 May 10
+    zZ[2] =  8.0; aA[2] =  15.9994; // Oxigen
+
+    wW[0] = 0.067137;//H
+    wW[1] = 0.400016;//C
+    wW[2] = 0.532847;//O
+    wW[3] = 0.000000;//O
+    wW[4] = 0.000000;//S
+    wW[5] = 0.000000;//F
+    wW[6] = 0.000000;//Sn
+    wW[7] = 0.000000;//Pb
+    wW[8] = 0.000000;//Cr
+    wW[9] = 0.000000;//Si
+    wW[10] = 0.000000;//Ni
+    wW[11] = 0.000000;//Ca
+
+    den = 1.4200;
+    AliMixture(57,"POLYOXYMETHYLENE$",aA,zZ,den,+3,wW);
+    AliMedium(57,"POLYOXYMETHYLENE$",57,0,ifield,fieldm,tmaxfd,stemax,
+             deemax,epsil,stmin);
+
+
+    // Anticorodal (Aliminum alloy) - 08 nov 10
+    // A,Z from Root TGeoElementTable, W from Web sites
+    zZ[0] = 13.0; aA[0] =  26.9815; // Aluminium
+    zZ[1] = 29.0; aA[1] =  63.546 ; // Copper
+    zZ[2] = 26.0; aA[2] =  55.845 ; // Iron
+    zZ[3] = 25.0; aA[3] =  54.938 ; // Manganese
+    zZ[4] = 12.0; aA[4] =  24.305 ; // Magnesium
+    zZ[5] = 14.0; aA[5] =  28.0855; // Silicon
+    zZ[6] = 30.0; aA[6] =  65.39  ; // Zinc
+    zZ[7] = 24.0; aA[7] =  51.9961; // Chromium
+    zZ[8] = 22.0; aA[8] =  47.867 ; // Titanium
+
+    wW[1] = 0.001000;//Cu
+    wW[2] = 0.005000;//Fe
+    wW[3] = 0.007000;//Mn - mean value
+    wW[4] = 0.009000;//Mg - mean value
+    wW[5] = 0.001000;//Si - mean value
+    wW[6] = 0.002000;//Zn
+    wW[7] = 0.002500;//Cr
+    wW[8] = 0.001000;//Ti
+
+    Double_t totFrac = 0;
+    for (Int_t j=1; j<9; j++)
+      totFrac += wW[j];
+    wW[0] = 1. - totFrac;//Al - the remainder
+
+    den = 2.69;
+    AliMixture(93,"ANTICORODAL$",aA,zZ,den,+9,wW);
+    AliMedium(93,"ANTICORODAL$",93,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
+    // Hokotol (another Aluminium alloy) - 08 nov 10
+    // A,Z from Root TGeoElementTable, W from Web sites
+    zZ[0] = 13.0; aA[0] =  26.9815; // Aluminium
+    zZ[1] = 29.0; aA[1] =  63.546 ; // Copper
+    zZ[2] = 26.0; aA[2] =  55.845 ; // Iron
+    zZ[3] = 25.0; aA[3] =  54.938 ; // Manganese
+    zZ[4] = 12.0; aA[4] =  24.305 ; // Magnesium
+    zZ[5] = 14.0; aA[5] =  28.0855; // Silicon
+    zZ[6] = 30.0; aA[6] =  65.39  ; // Zinc
+    zZ[7] = 24.0; aA[7] =  51.9961; // Chromium
+    zZ[8] = 22.0; aA[8] =  47.867 ; // Titanium
+    zZ[9] = 40.0; aA[9] =  91.224 ; // Zirconium
+
+    wW[1] = 0.020500;//Cu - mean value
+    wW[2] = 0.000300;//Fe
+    wW[3] = 0.022000;//Mn - mean value
+    wW[4] = 0.001000;//Mg - mean value
+    wW[5] = 0.002000;//Si - mean value
+    wW[6] = 0.066500;//Zn
+    wW[7] = 0.005000;//Cr
+    wW[8] = 0.000600;//Ti
+    wW[9] = 0.001650;//Zr - mean value
+
+    totFrac = 0;
+    for (Int_t j=1; j<10; j++)
+      totFrac += wW[j];
+    wW[0] = 1. - totFrac;//Al - the remainder
+
+    den = 2.69;
+    AliMixture(34,"HOKOTOL$",aA,zZ,den,+10,wW);
+    AliMedium(34,"HOKOTOL$",34,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+    
+    // Ergal (7075) (yet another Aluminium alloy) - 09 nov 10
+    // A,Z from Root TGeoElementTable, W from Web sites
+    zZ[0] = 13.0; aA[0] =  26.9815; // Aluminium
+    zZ[1] = 29.0; aA[1] =  63.546 ; // Copper
+    zZ[2] = 26.0; aA[2] =  55.845 ; // Iron
+    zZ[3] = 25.0; aA[3] =  54.938 ; // Manganese
+    zZ[4] = 12.0; aA[4] =  24.305 ; // Magnesium
+    zZ[5] = 14.0; aA[5] =  28.0855; // Silicon
+    zZ[6] = 30.0; aA[6] =  65.39  ; // Zinc
+    zZ[7] = 24.0; aA[7] =  51.9961; // Chromium
+    zZ[8] = 22.0; aA[8] =  47.867 ; // Titanium
+
+    wW[1] = 0.016000;//Cu - mean value
+    wW[2] = 0.005000;//Fe
+    wW[3] = 0.003000;//Mn
+    wW[4] = 0.025000;//Mg - mean value
+    wW[5] = 0.004000;//Si
+    wW[6] = 0.056000;//Zn - mean value
+    wW[7] = 0.002300;//Cr - mean value
+    wW[8] = 0.002000;//Ti
+
+    totFrac = 0;
+    for (Int_t j=1; j<9; j++)
+      totFrac += wW[j];
+    wW[0] = 1. - totFrac;//Al - the remainder
+
+    den = 2.69;
+    AliMixture(33,"ERGAL$",aA,zZ,den,+9,wW);
+    AliMedium(33,"ERGAL$",33,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
+
 }
+
 //______________________________________________________________________
-void AliITSv11::MixtureByWeight(Int_t imat,const char* name,Int_t *z,
-                               Double_t *w,Double_t dens,Int_t n,Int_t istd){
-    // Defines a Geant material by a set of elements and weights, and sets 
-    // its Geant medium proporties. The average atomic A is assumed to be 
-    // given by their natural abundances. Things like the radiation length 
-    // are calculated for you.
+void AliITSv11::Init()
+{
+    //     Initialise the ITS after it has been created.
     // Inputs:
-    //    Int_t imat       Material number.
-    //    const char* name Material name. No need to add a $ at the end.
-    //    Int_t *z         Array of The elemental numbers.
-    //    Double_t *w      Array of relative weights.
-    //    Double_t dens    The density of the material [g/cm^3].
-    //    Int_t n          the number of elements making up the mixture.
-    //    Int_t istd       Defines which standard set of transport parameters
-    //                     which should be used.   
-    // Output:
-    //     none.
+    //   none.
+    // Outputs:
+    //   none.
     // Return:
-    //     none.
-    Float_t rad,*Z,*A,tmax,stemax,deemax,epsilon;
-    char *name2;
-    Int_t len,i;
-    Z = new Float_t[n];
-    A = new Float_t[n];
-
-    len = strlng(name)+1;
-    name2 = new char[len];
-    strncpy(name2,name,len-1);
-    name2[len-1] = '\0';
-    name2[len-2] = '$';
-    for(i=0;i<n;i++){Z[i] = (Float_t)z[i];A[i] = (Float_t)GetA(z[i]);
-                     W[i] = (Float_t)w[i]}
-    rad = GetRadLength(z)/dens;
-    AliMixture(imat,name2,A,Z,dens,n,W);
-    tmax    = GetStandardTheataMax(istd);    // degree
-    stemax  = GetStandardMaxStepSize(istd);  // cm
-    deemax  = GetStandardEfraction(istd);     // #
-    epsilon = GetStandardEpsilon(istd);
-    AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
-             gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
-    delete[] name2;
+    //   none.
+
+    AliDebug(1,Form("Init: Major version %d Minor version %d",fMajorVersion,
+                fMinorVersion));
+    UpdateInternalGeometry();
+    AliITS::Init();
+
+    fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
 }
+
 //______________________________________________________________________
-void AliITSv11::MixtureByNumber(Int_t imat,const char* name,Int_t *z,
-                               Int_t *w,Double_t dens,Int_t n,Int_t istd){
-    // Defines a Geant material by a set of elements and number, and sets 
-    // its Geant medium proporties. The average atomic A is assumed to be 
-    // given by their natural abundances. Things like the radiation length 
-    // are calculated for you.
-    // Inputs:
-    //    Int_t imat       Material number.
-    //    const char* name Material name. No need to add a $ at the end.
-    //    Int_t *z         Array of The elemental numbers.
-    //    Int_t_t *w       Array of relative number.
-    //    Double_t dens    The density of the material [g/cm^3].
-    //    Int_t n          the number of elements making up the mixture.
-    //    Int_t istd       Defines which standard set of transport parameters
-    //                     which should be used.   
-    // Output:
-    //     none.
-    // Return:
-    //     none.
-    Float_t rad,*Z,*A,tmax,stemax,deemax,epsilon;
-    char *name2;
-    Int_t len,i;
-    Z = new Float_t[n];
-    A = new Float_t[n];
-
-    len = strlng(name)+1;
-    name2 = new char[len];
-    strncpy(name2,name,len-1);
-    name2[len-1] = '\0';
-    name2[len-2] = '$';
-    for(i=0;i<n;i++){Z[i] = (Float_t)z[i];A[i] = (Float_t)GetA(z[i]);
-                     W[i] = (Float_t)w[i]}
-    rad = GetRadLength(z)/dens;
-    AliMixture(imat,name2,A,Z,dens,-n,W);
-    tmax    = GetStandardTheataMax(istd);    // degree
-    stemax  = GetStandardMaxStepSize(istd);  // cm
-    deemax  = GetStandardEfraction(istd);     // #
-    epsilon = GetStandardEpsilon(istd);
-    AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
-             gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
-    delete[] name2;
-//______________________________________________________________________
-void AliITSv11::SSDConeDetail(TVector3 &tran,const char moth[3],Int_t mat0){
-    // Defines the volumes and materials for the ITS SSD Support cone.
-    // Based on drawings ALR-0767 and ALR-0767/3. Units are in mm.
+void AliITSv11::SetDefaults()
+{
+    // sets the default segmentation, response, digit and raw cluster classes
     // Inputs:
-    //   Double_t zShift  The z shift to be applied to the final volume.
+    //   none.
     // Outputs:
     //   none.
     // Return:
     //   none.
-    Double_t th = 13.0; //mm, Thickness of Rohacell+carbon fiber
-    Double_t ct=1.5; //mm, Carbon finber thickness
-    Double_t r=15.0; // mm, Radius of curvature.
-    Double_t tc=51.0; // angle of SSD cone [degrees].
-    Double_t sintc=Sind(tc),costc=Cosd(tc),tantc=Tand(tc);
-    Double_t z0=0.0,Routmax=0.5*985.,Routmin=0.5*945.,Rholemax=0.5*890.;
-    Double_t Rholemin=0.5*740.,Rin=0.5*560.,RoutHole=0.5*965.;
-    Int_t nspoaks=12,ninscrews=40,npost=4;
-    Int_t SSDcf=man0+1; // SSD support cone Carbon Fiber materal number.
-    Int_t SSDfs=mat0+2; // SSD support cone inserto stesalite 4411w.
-    Int_t SSDfo=mat0+3; // SSD support cone foam, Rohacell 50A.
-    Int_t SSDsw=mat0+4; // SSD support cone screw material,Stainless steal
-    Double_t t; // some general angle [degrees].
-    Double_t phi0=0.0,dphi=360.0,x,y,z;
-    Int_t i,j,k,l,n,nz,nrad=0;
-
-    SetScalemm();
-    // Lets start with the upper left outer carbon fiber surface.
-    // Between za[2],rmaxa[2] and za[4],rmaxa[4] there is a curved section
-    // given by rmaxa = rmaxa[2]-r*Sind(t) for 0<=t<=tc and 
-    // za = za[2] + r*Cosd(t) for 0<=t<=tc. Simularly between za[1],rmina[1
-    // and za[3],rmina[3] there is a curve section given by
-    // rmina = rmina[1]-r*Sind(t) for 0<=t<=tc and za = za[1]+r&Sind(t)
-    // for t<=0<=tc. These curves have been replaced by straight lines
-    // between the equivelent points for simplicity.
-    Double_t dza = th/sintc-(Routmax-Routmin)/tantc;
-    if(dza<=0){ // The number or order of the points are in error for a proper
-       // call to pcons!
-       Error("SSDcone","The definition of the points for a call to PCONS is"
-             " in error. abort.");
+
+    if(!fDetTypeSim){
+       Warning("SetDefaults","Error fDetTypeSim not defined");
        return;
-    } // end if
-    nz = 7;
-    Double_t *za    = new Double_t[nz];
-    Double_t *rmina = new Double_t[nz];
-    Double_t *rmaxa = new Double_t[nz];
-    za[0]    = z0;
-    rmina[0] = Routmin;
-    rmaxa[0] = Routmax;
-    za[1]    = za[0]+13.5-5.0 - dza; // za[2] - dza.
-    rmina[1] = rmina[0];
-    rmaxa[1] =rmaxa[0];
-    za[2]    = za[0]+13.5-5.0; // From Drawing ALR-0767 and ALR-0767/3
-    rmaxa[2] = rmaxa[0];
-    za[3]    = za[1]+rc*sintc;
-    rmina[3] = rmina[1]-rc*sintc;
-    rmina[2] = rmina[1]+(rmina[3]-rmina[1])*(za[2]-za[1])/(za[3]-za[1]);
-    za[4]    = za[2]+rc*sintc;
-    rmaxa[4] = rmaxa[2]-rc*sintc;
-    rmaxa[3] = rmaxa[2]+(rmaxa[4]-rmaxa[2])*(za[3]-za[2])/(za[4]-za[2]);
-    rmina[5] = Rholemax;
-    za[5]    = za[3]+(za[4]-za[3])*(rmina[5]-rmina[3])/(rmina[4]-rmina[3]);
-    rmina[4] = rmina[3]+(rmina[5]-rmina[3])*(za[4]-za[3])/(za[5]-za[3]);
-    za[6]    = th/sinth+za[5];
-    rmina[6] = Rholemax;
-    rmaxa[6] = rmina[6];
-    rmaxa[5] = rmaxa[4]+(rmaxa[6]-rmaxa[4])*(za[5]-za[4])/(za[6]-za[4]);
-    //
-    PolyCone("SCA","SSD Suport cone Carbon Fiber Surface outer left",
-            phi0,dphi,nz,*z,*rmin,*rmax,SSDcf);
-    Pos("SCA",1,moth,trans.x(),trans.y(),trans.z(),0);
-    XMatrix(1,180.0);
-    Pos("SCA",2,moth,trans.x(),trans.y(),-trans.z(),1);
-    Za[0] = 1.; Wa[0] = ; // Hydrogen Content
-    Za[1] = 6.; Wa[1] = ; // Carbon Content
-    MixtureByWeight(SSDcf,"Carbon Fiber for SSD support cone",Z,W,dens,2);
-    //
-    // Now lets define the Inserto Stesalite 4411w material volume.
-    nz = 6;
-    Double_t *zb    = new Double_t[nz];
-    Double_t *rminb = new Double_t[nz];
-    Double_t *rmaxb = new Double_t[nz];
-    zb[0] = z0;
-    rminb[0] = rmina[0]+ct;
-    rmaxb[0] = rmaxa[0]-ct;
-    zb[1] = za[1];
-    rminb[1] = rminb[0];
-    rmaxb[1] = rmaxb[0];
-    zb[2] = za[2];
-    rmaxb[2] = rmaxb[1];
-    zb[3] = za[4] - ct/sintc;
-    rmaxb[3] = rmaxb[2] - (rc-ct)*sintc;
-    zb[4] = za[3]+ct/sintc;
-    rminb[4] = rminb[1]-(rc-ct)*sintc;
-    rminb[2] = rminb[1]+(rminb[4]-rminb[1])*(zb[2]-zb[1])/(zb[4]-zb[1]);
-    rminb[3] = rminb[1]+(rminb[4]-rminb[1])*(zb[3]-zb[1])/(zb[4]-zb[1]);
-    zb[5] = zb[4]+(ct-2.*ct)/sintc;
-    rminb[5] = rminb[4]+(ct-2.*ct)*tantc;
-    rmaxb[5] = rminb[5];
-    rmaxb[4] = rmaxb[3]+(rmaxb[5]-rmaxb[3])*(zb[4]-zb[3])/(zb[5]-zb[3]);
-    PolyCone("SCB","SSD Suport cone Inserto Stesalite left edge",
-            phi0,dphi,nz,*zb,*rminb,*rmaxb,SSDfs);
-    Pos("SCB",1,"SCA",0.0,.0,0.0,0);
-    Za[0] = 1.; Wa[0] = ; // Hydrogen Content
-    Za[1] = 6.; Wa[1] = ; // Carbon Content
-    MixtureByWeight(SSDfs,"Inserto stealite 4411w for SSD support cone",
-                   Z,W,dens,3);
-    //
-    // Now lets define the Rohacell foam material volume.
-    nz = 4;
-    Double_t *zc    = new Double_t[nz];
-    Double_t *rminc = new Double_t[nz];
-    Double_t *rmaxc = new Double_t[nz];
-    zc[0] = zb[4];
-    rminc[0] = rminb[4];
-    rmaxc[0] = rmminc[0];
-    zc[1] = zb[5];
-    rmaxc[1] = rminb[5];
-    zc[2] = za[5] + ct/sintc;
-    rminc[2] = rmina[5]+ct; // leave space for carbon fiber covering hole.
-    rminc[1] = rminc[0] +(rminc[2]-rminc[0])*(zc[1]-zc[0])/(zc[2]-zc[0]);
-    zc[3] = za[6] - ct/sintc;
-    rminc[3] = rmina[6]+ct;
-    rmaxc[3] = rminc[3];
-    rmaxc[2] = rmaxc[1]+(rmaxc[3]-rmaxc[1])*(zc[2]-zc[1])/(zc[3]-zc[1]);
-    PolyCone("SCC","SSD Suport cone Rohacell foam left edge",
-            phi0,dphi,nz,*zc,*rminc,*rmaxc,SSDfo);
-    Pos("SCC",1,"SCA",0.0,.0,0.0,0);
-    Za[0] = 1.; Wa[0] = ; // Hydrogen Content
-    Za[1] = 6.; Wa[1] = ; // Carbon Content
-    MixtureByWeight(SSDfo,"Foam core (Rohacell 50A) for SSD support cone",
-                   Z,W,dens,3);
-    //
-    // In volume SCB, th Inserto Stesalite 4411w material volume, there
-    // are a number of Stainless steel screw and pin studs which will be
-    // filled with screws/studs.
-    Double_t rmin=0.0,rmax=6.0,dz=0.5*10.0; // mm
-    Tube("SCD","Screw+stud used to mount things to the SSD support cone",
-        rmin,rmax,dz,SSDsw);
-    rmin=0.0;rmax=6.0;dz=0.5*12.0; // mm
-    Tube("SCE","pin used to mount things to the SSD support cone",
-        rmin,rmax,dz,SSDsw);
-    Za[0] =  6.; Wa[0] = ; // Carbon Content
-    Za[1] = 25.; Wa[1] = ; // Iron Content
-    MixtureByWeight(SSDsw,"Stainless steal screw, pin, and stud material",
-                   Z,W,dens,3);
-    k=l=0;
-    for(i=0;i<2;i++){ // position for ITS-TPC mounting brackets
-       for(j=0;j<2;j++){ // 2 screws per bracket
-           k++;
-           t = -5.0+10.0*((Double_t)j)+180.*((Double_t)i);
-           x = RoutHole*Sind(t);
-           y = RoutHole*Cosd(t);
-           z = dz;
-           Pos("SCD",k,"SCB",x,y,z,0);
-       } // end for j
-       for(j=0;j<3;j++){ // 3 pins per bracket
-           l++;
-           t = -3.0+3.0*((Double_t)j)+180.*((Double_t)i);
-           x = RoutHole*Sind(t);
-           y = RoutHole*Cosd(t);
-           z = dz;
-           Pos("SCE",l,"SCB",x,y,z,0);
-       } // end for j
-    } // end for i
-    for(i=0;i<2;i++){ // position for ITS-rail mounting brackets
-       for(j=0;j<4;j++){ // 4 screws per bracket
-           Double_t a[4]={0.0,2.0,5.0,7.0}; // Relative angles.
-           k++;
-           t = 90.0-a[j]+187.*((Double_t)i);
-           x = RoutHole*Sind(t);
-           y = RoutHole*Cosd(t);
-           z = dz;
-           Pos("SCD",k,"SCB",x,y,z,0);
-       } // end for j
-       for(j=0;j<2;j++){ // 2 pins per bracket
-           l++;
-           t = 88+7.0*((Double_t)j)+184.*((Double_t)i);
-           x = RoutHole*Sind(t);
-           y = RoutHole*Cosd(t);
-           z = dz;
-           Pos("SCE",l,"SCB",x,y,z,0);
-       } // end for j
-    } // end for i
-    //
-    // There is no carbon fiber between this upper left section and the
-    // SSD spoaks. We remove it by replacing it with Rohacell foam.
-    nz = 4;
-    Double_t *zf    = new Double_t[nz];
-    Double_t *rminf = new Double_t[nz];
-    Double_t *rmaxf = new Double_t[nz];
-    zf[0] = zc[2];
-    rminf[0] = rminc[3];
-    rmaxf[0] = rminf[0];
-    rminf[1] = rmina[5];
-    rmaxf[1] = rminf[0];
-    zf[1] = zc[0]+(zc[2]-zc[0])*(rminf[1]-rminc[0])/(rminc[2]-rminc[0]);
-    zf[2] = zc[3];
-    rminf[2] = rminf[1];
-    rmaxf[2] = rmaxf[1];
-    zf[3] = zc[1]+(zc[3]-zc[1])*(rmaxf[3]-rmaxc[1])/(rmaxc[3]-rmaxc[1]);
-    rminf[3] = rmina[5];
-    rmaxf[3] = rminf[3];
-    PolyCone("SCF","SSD Suport cone Rohacell foam left edge",
-            phi0,dphi,nz,*zc,*rminc,*rmaxc,SSDfo);
-    Pos("SCF",1,"SCA",0.0,.0,0.0,0);
-    //=================================================================
-    // Now for the spoak part of the SSD cone.
-    // It is not posible to inclue the radius of curvature between
-    // the spoak part and the upper left part of the SSD cone or lowwer right
-    // part. This would be discribed by the following curves.
-    // R = Rmax - (5mm)*Sin(t) phi = phi0+(5mm*180/(Pi*RoutHole))*Sin(t) 
-    // where 0<=t<=90 For the inner curve a simular equiation holds.
-    phi0 = 12.5; // degrees see drawing ALR-0767.
-    dphi = 5.0; // degrees
-    nz = 4;
-    Double_t *zg    = new Double_t[nz];
-    Double_t *rming = new Double_t[nz];
-    Double_t *rmaxg = new Double_t[nz];
-    zg[0] = zb[5];
-    rming[0] = rmina[5];
-    rmaxg[0] = rming[0];
-    zg[1] = za[6];
-    rming[1] = -thatc*(zg[1]-za[3])+rmina[3];
-    rmaxg[1] = rmaxg[0];
-    rming[2] = Rholemin;
-    zg[2] = za[3]-(rming[2]-rmina[3])/tantc;
-    rmaxg[2] = -thatc*(zg[2]-za[4])+rmaxa[4];
-    rming[3] = rming[2];
-    rmaxg[3] = rming[3];
-    zg[3] = za[4]-(rmaxg[3]-rmaxa[4])/tantc;
-    PolyCone("SCG","SSD spoak carbon fiber surfaces",
-            phi0,dphi,nz,*zc,*rminc,*rmaxc,SSDcf);
-    Zmatrix(irot,360./((Double_t)nspoaks));
-    Pos("SCG",i+1,"SCA",0.0,.0,0.0,0);
-    for(i=1;i<nspoaks;i++){
-       Zmatrix(irot+i,360./((Double_t)nspoaks));
-       Pos("SCG",i+1,"SCA",0.0,.0,0.0,irot+i);
-    } // end for i
-    // For the foam core.
-    t = ct/(0.5*(Rholemax+Rholemin));// It is not posible to get the
-    // carbon fiber thickness uniform in this phi direction. We can only
-    // make it a fixed angular thickness.
-    t *= 180.0/TMath::Pi();
-    dphi = 5.0 - 2.0*t; // degrees
-    phi0 = 12.5+t; // degrees see drawing ALR-0767.
-    nz = 4;
-    Double_t *zh    = new Double_t[nz];
-    Double_t *rminh = new Double_t[nz];
-    Double_t *rmaxh = new Double_t[nz];
-    zh[0] = zf[2];
-    rminh[0] = rming[0];
-    rmaxh[0] = rmaxg[0];
-    zh[1] = zf[3];
-    rminh[1] = rming[1]-(ct/sintc-(zg[1]-zh[1]))*tantc;
-    rmaxh[1] = rmaxh[0];
-    zh[2] = zg[2]+ct/tanth;
-    rminh[2] = rming[2];
-    rmaxh[2] = rmaxg[2]-(ct/sintc-(zg[2]-zh[2]))*tantc;
-    zh[3] = zg[3]-ct/sintc;
-    rminh[3] = rminh[2];
-    rmaxh[3] = rminh[3];
-    PolyCone("SCG","SSD spoak carbon fiber surfaces",
-            phi0,dphi,nz,*zc,*rminc,*rmaxc,SSDcf);
-    Pos("SCH",1,"SCG",0.0,.0,0.0,0);
-    //
-    //==================================================================
+    }
 
-    //
-    //Now for the carbon fiber on the sides of the spoakes.
-    //==============================================================
-    delete[] za;delete[] rmina;delete[] rmaxa;
-    delete[] zb;delete[] rminb;delete[] rmaxb;
-    delete[] zc;delete[] rminc;delete[] rmaxc;
-    delete[] zd;delete[] rmind;delete[] rmaxd;
-    delete[] ze;delete[] rmine;delete[] rmaxe;
-    delete[] zf;delete[] rminf;delete[] rmaxf;
-    delete[] zg;delete[] rming;delete[] rmaxg;
-    delete[] zh;delete[] rminh;delete[] rmaxh;
-    delete[] zi;delete[] rmini;delete[] rmaxi;
-    delete[] zj;delete[] rminj;delete[] rmaxj;
-    // Set back to cm default scale before exiting.
-    SetScalecm();
+    fDetTypeSim->SetDefaults();
+    
+
+    if(fgkNTYPES>3){
+       Warning("SetDefaults",
+               "Only the four basic detector types are initialised!");
+    }// end if
     return;
 }
-//______________________________________________________________________
-void AliITSv11::CreateGeometry(){
-    ////////////////////////////////////////////////////////////////////////
-    // This routine defines and Creates the geometry for version 11 of the ITS.
-    ////////////////////////////////////////////////////////////////////////
-}
-//______________________________________________________________________
-void AliITSv11::CreateMaterials(){
-////////////////////////////////////////////////////////////////////////
-  //
-  // Create ITS materials
-  //     This function defines the default materials used in the Geant
-  // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
-  // AliITSv11.
-  // In general it is automatically replaced by
-  // the CreatMaterials routine defined in AliITSv?. Should the function
-  // CreateMaterials not exist for the geometry version you are using this
-  // one is used. See the definition found in AliITSv5 or the other routine
-  // for a complete definition.
-  //
-}
-//______________________________________________________________________
-void AliITSv11::InitAliITSgeom(){
-    //     Based on the geometry tree defined in Geant 3.21, this
-    // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
-    // sturture.
-}
 
 //______________________________________________________________________
-void AliITSv11::Init(){
-    ////////////////////////////////////////////////////////////////////////
-    //     Initialise the ITS after it has been created.
-    ////////////////////////////////////////////////////////////////////////
-}
-//______________________________________________________________________
-void AliITSv11::SetDefaults(){
-    // sets the default segmentation, response, digit and raw cluster classes
-}
-//______________________________________________________________________
-void AliITSv11::DrawModule(){
-    ////////////////////////////////////////////////////////////////////////
-    //     Draw a shaded view of the FMD version 11.
-    ////////////////////////////////////////////////////////////////////////
-}
-//______________________________________________________________________
-void AliITSv11::StepManager(){
-    ////////////////////////////////////////////////////////////////////////
+void AliITSv11::StepManager()
+{
     //    Called for every step in the ITS, then calles the AliITShit class
     // creator with the information to be recoreded about that hit.
     //     The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
@@ -1532,6 +1601,99 @@ void AliITSv11::StepManager(){
     // file read in by the routine CreateGeometry(). If set to 0 or any other
     // value except 1, the default behavior, then no such file is created nor
     // it the extra variables and the like used in the printing allocated.
-    ////////////////////////////////////////////////////////////////////////
+    // Inputs:
+    //   none.
+    // Outputs:
+    //   none.
+    // Return:
+    //   none.
+
+    if(!(this->IsActive())) return;
+    if(!(gMC->TrackCharge())) return;
+
+    Int_t copy, lay = 0;
+    Int_t id = gMC->CurrentVolID(copy);
+
+    Bool_t notSens = kFALSE;
+    while ((lay<fIdN)  && (notSens = id != fIdSens[lay])) ++lay;
+    if (notSens) return;
+
+    if(gMC->IsTrackExiting()) {
+       AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS);
+    } // if Outer ITS mother Volume
+
+    static TLorentzVector position, momentum; // Saves on calls to construtors
+    static AliITShit hit;// Saves on calls to constructors
+
+    TClonesArray &lhits = *(Hits());
+    Int_t   cpn0, cpn1, mod, status = 0;
+    //
+    // Track status
+    if(gMC->IsTrackInside())      status +=  1;
+    if(gMC->IsTrackEntering())    status +=  2;
+    if(gMC->IsTrackExiting())     status +=  4;
+    if(gMC->IsTrackOut())         status +=  8;
+    if(gMC->IsTrackDisappeared()) status += 16;
+    if(gMC->IsTrackStop())        status += 32;
+    if(gMC->IsTrackAlive())       status += 64;
+
+    //
+    // retrieve the indices with the volume path
+    //
+    switch (lay) {
+    case 0:case 1: // SPD
+      gMC->CurrentVolOffID(1,copy); // ladder
+      gMC->CurrentVolOffID(3,cpn1); // stave
+      gMC->CurrentVolOffID(5,cpn0); // sector
+      break;
+    case 2:case 3: // SDD
+      copy = 1;
+      gMC->CurrentVolOffID(2,cpn1);
+      gMC->CurrentVolOffID(3,cpn0);
+      break;
+    case 4:case 5: // SSD
+      copy = 1;
+      gMC->CurrentVolOffID(1,cpn1);
+      gMC->CurrentVolOffID(2,cpn0);
+      break;
+    default:
+      AliError(Form("Invalid value: lay= %d . Not an ITS sensitive volume",lay));
+      return; // not an ITS sensitive volume.
+    } //
+
+    fInitGeom.DecodeDetector(mod,lay+1,cpn0,cpn1,copy);
+    // We should not need to pass by the switch !
+    // This is time consuming...
+    // therefore DecodeDetectorv11(...) shouldn't be private !
+    // and we should be able to use instead :
+    //fInitGeom.DecodeDetectorv11(mod,lay+1,cpn0,cpn1,copy);
+
+    //
+    // Fill hit structure.
+    //
+    hit.SetModule(mod);
+    hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
+    gMC->TrackPosition(position);
+    gMC->TrackMomentum(momentum);
+    hit.SetPosition(position);
+    hit.SetTime(gMC->TrackTime());
+    hit.SetMomentum(momentum);
+    hit.SetStatus(status);
+    hit.SetEdep(gMC->Edep());
+    hit.SetShunt(GetIshunt());
+    if(gMC->IsTrackEntering()){
+        hit.SetStartPosition(position);
+        hit.SetStartTime(gMC->TrackTime());
+        hit.SetStartStatus(status);
+        return; // don't save entering hit.
+    } // end if IsEntering
+    // Fill hit structure with this new hit.
+    //Info("StepManager","Calling Copy Constructor");
+    new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
+    // Save old position... for next hit.
+    hit.SetStartPosition(position);
+    hit.SetStartTime(gMC->TrackTime());
+    hit.SetStartStatus(status);
+
+    return;
 }