]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STRUCT/AliDIPOv2.cxx
CMake: Removing all lhapdf link dependencies
[u/mrichter/AliRoot.git] / STRUCT / AliDIPOv2.cxx
index 7597398b51bec108c0c3c8cb106601cb360c1c10..5749fcbac8ae220edc33e4bd19be42a2a983ab90 100644 (file)
@@ -1,3 +1,20 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
 //  Magnetic Dipole version 1                                                //
 //End_Html
 //                                                                           //
 //                                                                           //
-///////////////////////////////////////////////////////////////////////////////
 
+#include <TGeoManager.h>
+#include <TGeoGlobalMagField.h>
+#include <TGeoVolume.h>
+#include <TVirtualMC.h>
+#include <TArrayI.h>
+
+#include "AliConst.h"
 #include "AliDIPOv2.h"
+#include "AliMagF.h"
 #include "AliRun.h"
-#include "AliConst.h"
  
 ClassImp(AliDIPOv2)
  
 //_____________________________________________________________________________
-AliDIPOv2::AliDIPOv2()
+AliDIPOv2::AliDIPOv2() 
 {
   //
-  // Default constructor for magnetic dipole version 2
+  // Last design of magnetic dipole version 2
   //
 }
  
@@ -38,328 +61,751 @@ AliDIPOv2::AliDIPOv2(const char *name, const char *title)
 {
   //
   // Standard constructor for the magnetic dipole version 2    
-   SetMarkerColor(7);
-   SetMarkerStyle(2);
-   SetMarkerSize(0.4);
 }
-//_____________________________________________________________________________
+
 void AliDIPOv2::CreateGeometry()
 {
   //
   // Creation of the geometry of the magnetic DIPOLE version 2
   //
-  //Begin_Html
-  /*
-    <img src="picts/AliDIPOv2Tree.gif">
-  */
-  //End_Html
-  //Begin_Html
-  /*
-    <img src="picts/AliDIPOv2.gif">
-  */
-  //End_Html
-
-  Float_t cpar[5], tpar[3], ypar[4];
+
+    CreateSpectrometerDipole();
+    CreateCompensatorDipole();
+}
+
+
+//_____________________________________________________________________________
+void AliDIPOv2::CreateSpectrometerDipole()
+{
+  //
+  // Creation of the geometry of the magnetic DIPOLE version 2
+  //
+
+  Float_t cpar[5], tpar[18], ypar[12];
   Float_t dz, dx, dy;
   Int_t idrotm[1899];
-  Float_t acc_max, the1, phi1, the2, phi2, the3, phi3;
-
-  Int_t *idtmed = fIdtmed->GetArray()-1799;
-  
-  //abs_d   = 90.;  // DEFINES DRIFT LENGTH 
-  //z_nose  = 102.;
-  //z_cone  = 285.;
-  //theta1  = 24.;  // 1. angle defining the front absorber 
-  //theta2  = 5.;   // 2. angle defining the front absorbe 
-  acc_max = 9.;   // ANGLE POLAIRE MAXIMUM 
-  //acc_min = 2.;   // ANGLE POLAIRE MINIMUM DE DETECTION 
-  //abs_l   = 503.;
-  //d_steel = 1.;   // THICKNESS OF STEEL SUPPORT 
-  //d_poly  = 7.5;
-  //d_pb    = 2.5;
-  //abs_cc  = 315.; // DEFINES LENGTH OF CARBON 
-  //abs_c   = 358.;
-  //abs_s   = 150.; // DEFINES W-SHIELD LENGTH 
-  //abs_n   = 80.;  // START OF NOSE 
-  //r_abs   = 4.;
-  //r_pb    = .1;
-  //epsilon = .01;
-  //theta_r = 3.;
-  //d_rear  = 35.;
-  //theta_open = .75;
-  
-  //z_l3      = 700.;
-  //zmag_in   = 725.;
-  //zmag_out  = 1225.;
-  //zfil_in   = 1471.;
-  //zfil_out  = 1591.;
-  //zcon_in   = 1900.;
-  //zcon_out  = 2e3;
-  //zcone_e   = 859.0875;
-  //spec_l    = 1800.;
-  //zplug_in  = 1780.;
-  //zplug_out = 1900.;
-  
-  //     Chamber position 
-  //      CZ1=515.5 
-  //cz1 = 511.;
-  //cz2 = 686.;
-  //cz3 = 971.;
-  //cz4 = 1245.;
-  //cz5 = 1445.;
-  //cz6 = 1610.;
-  //cz7 = 1710.;
+  Float_t accMax, the1, phi1, the2, phi2, the3, phi3;
   
+  Int_t *idtmed = fIdtmed->GetArray()-1799;
+
+//  const Int_t kCoil = 1813;
+//  const Int_t kCable= 1811;
+
+  const Int_t kCoil = 1808;
+  const Int_t kCable= 1808;
   
+  accMax = 9.;   // ANGLE POLAIRE MAXIMUM 
+
   //       DIPOLE MAGNET 
-  
-  tpar[0] = 300.;
-  tpar[1] = 415.;
-  tpar[2] = 250.;
-  gMC->Gsvolu("DDIP", "BOX ", idtmed[1814], tpar, 3);
-  
-  //       COILS 
-  
+  const Float_t kZDipole = 975; 
+
+  tpar[ 0] = 0.; 
+  tpar[ 1] = 360.;
+  tpar[ 2] = 4.; 
+  //
+  tpar[ 3] = -250.55 + kZDipole;
+  tpar[ 4] =  30.1;
+  tpar[ 5] = 527.34; 
+  //
+  tpar[ 6] = 37. + kZDipole;
+  tpar[ 7] =  30.1;
+  tpar[ 8] = 527.34;
+  //
+  tpar[ 9] = 37. + kZDipole;
+  tpar[10] = tpar[ 9] * TMath::Tan(2. * TMath::Pi() / 180.);
+  tpar[11] = 527.34;
+  //
+  tpar[12] = 260.55 + kZDipole;
+  tpar[13] = tpar[12] * TMath::Tan(2. * TMath::Pi() / 180.);
+  tpar[14] = 527.34;
+  TVirtualMC::GetMC()->Gsvolu("DDIP", "PCON", idtmed[1874], tpar, 15);
+  //
+  //       Coils 
   // air - m.f. 
-  cpar[0] = 210.;
-  cpar[1] = 263.;
-  cpar[2] = 83.2/2.;
-  cpar[3] = 120.;
-  cpar[4] = 240.;
-  gMC->Gsvolu("DC1 ", "TUBS", idtmed[1813], cpar, 5);
-  cpar[3] = -60.;
-  cpar[4] = 60.;
-  gMC->Gsvolu("DC2 ", "TUBS", idtmed[1813], cpar, 5);
-  // ... define regions for higher cuts 
-  cpar[0] += 10.;
-  cpar[1] += -10.;
-  cpar[2] += -10.;
-  cpar[3]  = 120.;
-  cpar[4]  = 240.;
-  gMC->Gsvolu("DC3 ", "TUBS", idtmed[1833], cpar, 5);
-  gMC->Gspos("DC3 ", 1, "DC1 ", 0., 0., 0., 0, "ONLY");
-  cpar[3] = -60.;
-  cpar[4] = 60.;
-  gMC->Gsvolu("DC4 ", "TUBS", idtmed[1833], cpar, 5);
-  gMC->Gspos("DC4 ", 1, "DC2 ", 0., 0., 0., 0, "ONLY");
-  // ... 
-  dz = 83.2/2. - 250.;
-  gMC->Gspos("DC1 ", 1, "DDIP", 0., 0.,  dz, 0, "ONLY");
-  gMC->Gspos("DC1 ", 2, "DDIP", 0., 0., -dz, 0, "ONLY");
-  gMC->Gspos("DC2 ", 1, "DDIP", 0., 0.,  dz, 0, "ONLY");
-  gMC->Gspos("DC2 ", 2, "DDIP", 0., 0., -dz, 0, "ONLY");
+  cpar[0] = 207.;
+  cpar[1] = 274.;
+  cpar[2] = 37.65;
+  cpar[3] = 119.;
+  cpar[4] = 241.; 
+  //   coil - high cuts
+  TVirtualMC::GetMC()->Gsvolu("DC1 ", "TUBS", idtmed[kCoil+40], cpar, 5);
+  cpar[3] = -61.;
+  cpar[4] = 61.;
+  TVirtualMC::GetMC()->Gsvolu("DC2 ", "TUBS", idtmed[kCoil+40], cpar, 5);
+
+  //  coil - low cuts cuts
+  cpar[0] = 207.;
+//  cpar[1] = cpar[0] + 10.;
+  cpar[1] = 217;
+  cpar[3] = 119.;
+  cpar[4] = 241.;
+
+  TVirtualMC::GetMC()->Gsvolu("DC3 ", "TUBS", idtmed[kCoil], cpar, 5);
+  cpar[0] = 207.; 
+  cpar[1] = 217; 
+  cpar[3] = -61.;
+  cpar[4] = 61.;
+  TVirtualMC::GetMC()->Gsvolu("DC4 ", "TUBS", idtmed[kCoil], cpar, 5);
+
+  TVirtualMC::GetMC()->Gspos("DC3 ", 1, "DC1 ", 0., 0., 0., 0, "ONLY");
+  TVirtualMC::GetMC()->Gspos("DC4 ", 1, "DC2 ", 0., 0., 0., 0, "ONLY");
+
+//  dz =  37.65 - 243.55
+  dz = -205.9-2.45;
+  dx = 5.;
+  TVirtualMC::GetMC()->Gspos("DC1 ", 1, "DDIP",  dx, 0.,  dz+kZDipole, 0, "ONLY");
+  TVirtualMC::GetMC()->Gspos("DC1 ", 2, "DDIP",  dx, 0., -dz+kZDipole, 0, "ONLY");
+  TVirtualMC::GetMC()->Gspos("DC2 ", 1, "DDIP", -dx, 0.,  dz+kZDipole, 0, "ONLY");
+  TVirtualMC::GetMC()->Gspos("DC2 ", 2, "DDIP", -dx, 0., -dz+kZDipole, 0, "ONLY");
   the1 = 180.;
   phi1 = 0.;
   the2 = 90.;
-  phi2 = 150.;
+  phi2 = 151.;
   the3 = 90.;
-  phi3 = 60.;
+  phi3 = 61.;
   AliMatrix(idrotm[1800], the1, phi1, the2, phi2, the3, phi3);
-  phi2 = 30.;
+  phi2 = 29.;  //90-61
   the3 = -90.;
-  phi3 = -60.;
+  phi3 = -61.;
   AliMatrix(idrotm[1801], the1, phi1, the2, phi2, the3, phi3);
   the1 = 0.;
   phi1 = 0.;
   the2 = 90.;
-  phi2 = 150.;
+  phi2 = 151.;
   the3 = 90.;
-  phi3 = 60.;
+  phi3 = 61.;
   AliMatrix(idrotm[1802], the1, phi1, the2, phi2, the3, phi3);
-  phi2 = 30.;
+  phi2 = 29.;
   the3 = -90.;
-  phi3 = -60.;
+  phi3 = -61.;
   AliMatrix(idrotm[1803], the1, phi1, the2, phi2, the3, phi3);
+
   cpar[0] = 25.;
-  cpar[1] = 108.2;
-  cpar[2] = 26.5;
+  cpar[1] = 100.3; //25+75.3
+  cpar[2] = 33.5;
   cpar[3] = 270.;
   cpar[4] = 360.;
-  gMC->Gsvolu("DC11", "TUBS", idtmed[1813], cpar, 5);
-  // ... higher cuts 
-  cpar[0] += 10.;
-  cpar[1] += -10.;
-  cpar[2] += -10.;
-  gMC->Gsvolu("DC21", "TUBS", idtmed[1833], cpar, 5);
-  gMC->Gspos("DC21", 1, "DC11", 0., 0., 0., 0, "ONLY");
-  // ... 
-  dx = TMath::Sin(30*kDegrad) * -236.5;
-  dy = TMath::Cos(30*kDegrad) * -236.5;
-  dz = cpar[1] + 10. - 250.;
-  gMC->Gspos("DC11", 1, "DDIP",  dx, dy,  dz, idrotm[1800], "ONLY");
-  gMC->Gspos("DC11", 2, "DDIP",  dx, dy, -dz, idrotm[1802], "ONLY");
-  gMC->Gspos("DC11", 3, "DDIP", -dx, dy,  dz, idrotm[1801], "ONLY");
-  gMC->Gspos("DC11", 4, "DDIP", -dx, dy, -dz, idrotm[1803], "ONLY");
+//*  coil high cuts
+  TVirtualMC::GetMC()->Gsvolu("DC11", "TUBS", idtmed[kCoil+40], cpar, 5);
+
+  dx = TMath::Sin(30.5*kDegrad) * -(207.+33.5)+5./TMath::Sin(30.5*kDegrad); 
+  dy = TMath::Cos(30.5*kDegrad) * -(207.+33.5);  
+  dz = cpar[1] - 243.55-2.45;
+  TVirtualMC::GetMC()->Gspos("DC11", 1, "DDIP",  dx, dy,  dz+kZDipole, idrotm[1800], "ONLY");
+  TVirtualMC::GetMC()->Gspos("DC11", 2, "DDIP",  dx, dy, -dz+kZDipole, idrotm[1802], "ONLY");
+  TVirtualMC::GetMC()->Gspos("DC11", 3, "DDIP", -dx, dy,  dz+kZDipole, idrotm[1801], "ONLY");
+  TVirtualMC::GetMC()->Gspos("DC11", 4, "DDIP", -dx, dy, -dz+kZDipole, idrotm[1803], "ONLY");
+
+
+
+//* ... higher cuts
   cpar[0] = 25.;
-  cpar[1] = 25.+83.2;
-  cpar[2] = 53./2.;
+  cpar[1] = 100.3; //25+75.3
+  cpar[2] = 33.5;
   cpar[3] = 0.;
   cpar[4] = 90.;
-  gMC->Gsvolu("DC12", "TUBS", idtmed[1813], cpar, 5);
-  // ... higher cuts 
-  cpar[0] += 10.;
-  cpar[1] += -10.;
-  cpar[2] += -10.;
-  gMC->Gsvolu("DC22", "TUBS", idtmed[1833], cpar, 5);
-  gMC->Gspos("DC22", 1, "DC12", 0., 0., 0., 0, "ONLY");
-  // ... 
-  dx = TMath::Sin(30*kDegrad) * -236.5;
-  dy = TMath::Cos(30*kDegrad) * 236.5;
-  dz = cpar[1] + 10. - 250.;
-  gMC->Gspos("DC12", 1, "DDIP",  dx, dy,  dz, idrotm[1801], "ONLY");
-  gMC->Gspos("DC12", 2, "DDIP",  dx, dy, -dz, idrotm[1803], "ONLY");
-  gMC->Gspos("DC12", 3, "DDIP", -dx, dy,  dz, idrotm[1800], "ONLY");
-  gMC->Gspos("DC12", 4, "DDIP", -dx, dy, -dz, idrotm[1802], "ONLY");
+//*  coil high cuts
+  TVirtualMC::GetMC()->Gsvolu("DC12", "TUBS", idtmed[kCoil+40], cpar, 5);
+
+  dx = TMath::Sin(30.5*kDegrad) * -(207.+33.5)+5./TMath::Sin(30.5*kDegrad); 
+  dy = TMath::Cos(30.5*kDegrad) *(207.+33.5);  
+  dz = cpar[1] - 243.55-2.45;
+  TVirtualMC::GetMC()->Gspos("DC12", 1, "DDIP",  dx, dy,  dz+kZDipole, idrotm[1801], "ONLY");
+  TVirtualMC::GetMC()->Gspos("DC12", 2, "DDIP",  dx, dy, -dz+kZDipole, idrotm[1803], "ONLY");
+  TVirtualMC::GetMC()->Gspos("DC12", 3, "DDIP", -dx, dy,  dz+kZDipole, idrotm[1800], "ONLY");
+  TVirtualMC::GetMC()->Gspos("DC12", 4, "DDIP", -dx, dy, -dz+kZDipole, idrotm[1802], "ONLY");
+
   the1 = 90.;
-  phi1 = 60.;
+  phi1 = 61.;
   the2 = 90.;
-  phi2 = 150.;
+  phi2 = 151.;
   the3 = 0.;
   phi3 = 0.;
   AliMatrix(idrotm[1804], the1, phi1, the2, phi2, the3, phi3);
   the1 = 90.;
-  phi1 = 120.;
+  phi1 = -61.;
   the2 = 90.;
-  phi2 = 210.;
-  the3 = 0.;
-  phi3 = 0.;
+  phi2 = -151.;
   AliMatrix(idrotm[1805], the1, phi1, the2, phi2, the3, phi3);
-  tpar[0] = 53./2.;
-  tpar[1] = 83.2/2.;
-  tpar[2] = 283.6/2.;
-  gMC->Gsvolu("DL1 ", "BOX ", idtmed[1813], tpar, 3);
-  // ... higher cuts 
-  tpar[0] -= 10.;
-  tpar[1] -= 10.;
-  gMC->Gsvolu("DL2 ", "BOX ", idtmed[1833], tpar, 3);
-  gMC->Gspos("DL2 ", 1, "DL1 ", 0., 0., 0., 0, "ONLY");
-  // ... 
-  dx = -60.5;
-  dy = -238.;
-  dz = 0.;
-  gMC->Gspos("DL1 ", 1, "DDIP", dx,  dy, dz, idrotm[1804], "ONLY");
-  gMC->Gspos("DL1 ", 2, "DDIP", dx, -dy, dz, idrotm[1805], "ONLY");
-  gMC->Gspos("DL1 ", 3, "DDIP",-dx,  dy, dz, idrotm[1805], "ONLY");
-  gMC->Gspos("DL1 ", 4, "DDIP",-dx, -dy, dz, idrotm[1804], "ONLY");
+  the1 = 90.;
+  phi1 = 119.; //180 -61
+  the2 = 90.;
+  phi2 = 209.; //270-61
+  AliMatrix(idrotm[1806], the1, phi1, the2, phi2, the3, phi3);
+  the1 = 90.;
+  phi1 = -119.;
+  the2 = 90.;
+  phi2 = -209.;
+  AliMatrix(idrotm[1807], the1, phi1, the2, phi2, the3, phi3); 
+
+//*  coil - high cuts
+
+  tpar[0] = 37.65;
+  tpar[1] = 33.5;
+  tpar[2] = 145.5;
+  TVirtualMC::GetMC()->Gsvolu("DL1 ", "BOX ", idtmed[kCoil+40], tpar, 3);
+
+// coil - low cuts
+
+  tpar[0] = 5.;
+  dx = 37.65  - 5.;  
+  TVirtualMC::GetMC()->Gsvolu("DL2 ", "BOX ", idtmed[kCoil], tpar, 3);
+  TVirtualMC::GetMC()->Gspos("DL2 ", 1, "DL1 ", dx, 0., 0., 0, "ONLY");
+
+  dx =-53.62;
+  dy =-241.26819;
+  dz = 0.; 
+  TVirtualMC::GetMC()->Gspos("DL1 ", 1, "DDIP", dx,  dy, dz+kZDipole, idrotm[1804], "ONLY");
+  TVirtualMC::GetMC()->Gspos("DL1 ", 2, "DDIP", dx, -dy, dz+kZDipole, idrotm[1805], "ONLY");
+  TVirtualMC::GetMC()->Gspos("DL1 ", 3, "DDIP",-dx,  dy, dz+kZDipole, idrotm[1806], "ONLY");
+  TVirtualMC::GetMC()->Gspos("DL1 ", 4, "DDIP",-dx, -dy, dz+kZDipole, idrotm[1807], "ONLY");
+
+  // Contactor
+
+ //  high cuts
+
+  //Steel outer face planes
+
+  cpar[0] = 207.-18.6;
+  cpar[1] = 274.+18.6;
+  cpar[2] = 1.;
+  cpar[3] = -50.;
+  cpar[4] = 50.; 
+  TVirtualMC::GetMC()->Gsvolu("DCO1", "TUBS", idtmed[1818], cpar, 5);
+  dx = -5.;
+  dz = 168.25-1.5-1.;
+  TVirtualMC::GetMC()->Gspos("DCO1", 1, "DDIP", dx, 0, dz+kZDipole, 0, "ONLY");
+  dz = 243.55+4.5+1.5+1.;
+  TVirtualMC::GetMC()->Gspos("DCO1", 2, "DDIP", dx, 0, dz+kZDipole, 0, "ONLY");
   
+  // 9.06.2000
+
+  //  cpar[0] = 207.-18.6;
+  //  cpar[1] = 274.+18.6;
+  // cpar[2] = 1.;
+  cpar[3] = 180.-50.;
+  cpar[4] = 180.+50.; 
+  TVirtualMC::GetMC()->Gsvolu("DCO2", "TUBS", idtmed[1818], cpar, 5);
+  dx = +5.;
+  dz = 168.25-1.5-1.;
+  TVirtualMC::GetMC()->Gspos("DCO2", 1, "DDIP", dx, 0, dz+kZDipole, 0, "ONLY");
+  dz = 243.55+4.5+1.5+1.;
+  TVirtualMC::GetMC()->Gspos("DCO2", 2, "DDIP", dx, 0, dz+kZDipole, 0, "ONLY");
+
+
+  // Resin face planes
+
+  cpar[0] = 207.;
+  cpar[1] = 274.;
+  cpar[2] = .75;
+  cpar[3] = -50.;
+  cpar[4] = 50.; 
+  TVirtualMC::GetMC()->Gsvolu("DCO3", "TUBS", idtmed[1812], cpar, 5);
+  dx = -5;
+  dz = 168.25-0.75;
+  TVirtualMC::GetMC()->Gspos("DCO3", 1, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+  dz = 243.55+4.5+0.75;
+  TVirtualMC::GetMC()->Gspos("DCO3", 2, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+
+  // 9.06.2000
+
+  cpar[3] = 180.-50.;
+  cpar[4] = 180.+50.; 
+  TVirtualMC::GetMC()->Gsvolu("DCO4", "TUBS", idtmed[1812], cpar, 5);
+  dx = +5;
+  dz = 168.25-0.75;
+  TVirtualMC::GetMC()->Gspos("DCO4", 1, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+  dz = 243.55+4.5+0.75 ;
+  TVirtualMC::GetMC()->Gspos("DCO4", 2, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+
+  // G10 face plane
+
+  cpar[0] = 207.;
+  cpar[1] = 274.;
+  cpar[2] = 2.25;
+  cpar[3] = -50.;
+  cpar[4] = 50.; 
+  TVirtualMC::GetMC()->Gsvolu("DCO5", "TUBS", idtmed[1810], cpar, 5);
+
+  dx = -5;
+  dz = 243.55+2.25;
+  TVirtualMC::GetMC()->Gspos("DCO5", 1, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+
+  // 9.06.2000
+
+  cpar[3] = 180.-50.;
+  cpar[4] = 180.+50.; 
+
+  TVirtualMC::GetMC()->Gsvolu("DCO6", "TUBS", idtmed[1810], cpar, 5);
+
+  dx = +5;
+  dz = 243.55+2.25;
+  TVirtualMC::GetMC()->Gspos("DCO6", 1, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+
+  //Steel supported planes
+
+  cpar[0] = 274.+1.5+2.;
+  cpar[1] = 274.+18.6;
+  cpar[2] = 1.;
+  cpar[3] = -50.;
+  cpar[4] = 50.;  
+  TVirtualMC::GetMC()->Gsvolu("DCO7", "TUBS", idtmed[1818], cpar, 5);
+
+  dx = -5;
+  dz = 168.25+1.;
+  TVirtualMC::GetMC()->Gspos("DCO7", 1, "DDIP", dx, 0, dz+kZDipole, 0, "ONLY");
+
+  // 9.06.2000
+  cpar[0] = 274.+1.5+2.;
+  cpar[1] = 274.+18.6;
+  cpar[2] = 1.;
+  cpar[3] = 180.-50.;
+  cpar[4] = 180.+50.; 
+
+  TVirtualMC::GetMC()->Gsvolu("DCO8", "TUBS", idtmed[1818], cpar, 5);
+
+  dx = +5;
+  dz = 168.25+1.;
+  TVirtualMC::GetMC()->Gspos("DCO8", 1, "DDIP", dx, 0, dz+kZDipole, 0, "ONLY");
+
+  //
+
+  cpar[0] = 207.- 18.6;
+  cpar[1] = 207.- 2.- 1.5;
+  cpar[2] = 1.;
+  cpar[3] = -50.;
+  cpar[4] = 50.; 
+
+  TVirtualMC::GetMC()->Gsvolu("DCO9", "TUBS", idtmed[1818], cpar, 5);
+
+  dx = -5;
+  dz = 168.25+1.;
+  TVirtualMC::GetMC()->Gspos("DCO9", 1, "DDIP", dx, 0, dz+kZDipole, 0, "ONLY");
+
+  // 9.06.2000
+
+  cpar[0] = 207.- 18.6;
+  cpar[1] = 207.- 2.- 1.5;
+  cpar[2] = 1.;
+  cpar[3] = 180.-50.;
+  cpar[4] = 180.+50.; 
+
+  TVirtualMC::GetMC()->Gsvolu("DCOA", "TUBS", idtmed[1818], cpar, 5);
+
+  dx = +5;
+  dz = 168.25+1.;
+  TVirtualMC::GetMC()->Gspos("DCOA", 1, "DDIP", dx, 0, dz+kZDipole, 0, "ONLY");
+
+
+  // Sides steel planes
+
+  cpar[0] = 207. - 1.5 -2.;
+  cpar[1] = 207. - 1.5;
+  cpar[2] = ((243.55+4.5+1.5)-168.25)/2;
+  cpar[3] = -50.;
+  cpar[4] = 50.; 
+  TVirtualMC::GetMC()->Gsvolu("DCOB", "TUBS", idtmed[1818], cpar, 5);
+
+  cpar[0] = 274. + 1.5;
+  cpar[1] = 274. + 1.5 +2.;
+
+  TVirtualMC::GetMC()->Gsvolu("DCOC", "TUBS", idtmed[1818], cpar, 5);
+
+  dx=-5.;
+  dz = ((243.55+4.5+1.5)+168.25)/2;
+  TVirtualMC::GetMC()->Gspos("DCOB", 1, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+  TVirtualMC::GetMC()->Gspos("DCOC", 1, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+
+  // 9.06.2000
+
+  cpar[0] = 207. - 1.5 -2.;
+  cpar[1] = 207. - 1.5;
+  cpar[2] = ((243.55+4.5+1.5)-168.25)/2;
+  cpar[3] = 180.-50.;
+  cpar[4] = 180.+50.; 
+
+  TVirtualMC::GetMC()->Gsvolu("DCOD", "TUBS", idtmed[1818], cpar, 5);
+
+  cpar[0] = 274. + 1.5;
+  cpar[1] = 274. + 1.5 +2.;
+
+  TVirtualMC::GetMC()->Gsvolu("DCOE", "TUBS", idtmed[1818], cpar, 5);
+
+  dx=+5.;
+  dz = ((243.55+4.5+1.5)+168.25)/2;
+  TVirtualMC::GetMC()->Gspos("DCOD", 1, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+  TVirtualMC::GetMC()->Gspos("DCOE", 1, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+
+
+  // Top and bottom resin  planes
+
+  cpar[0] = 207. - 1.5;
+  cpar[1] = 207.;
+  cpar[2] = ((243.55+4.5+1.5)-168.25)/2;
+  cpar[3] = -50.;
+  cpar[4] = 50.; 
+  TVirtualMC::GetMC()->Gsvolu("DCOF", "TUBS", idtmed[1812], cpar, 5);
+
+  cpar[0] = 274.;
+  cpar[1] = 274. + 1.5;
+
+  TVirtualMC::GetMC()->Gsvolu("DCOG", "TUBS", idtmed[1812], cpar, 5);
+
+
+  dx=-5.;
+  dz = ((243.55+4.5+1.5)+168.25)/2;
+  TVirtualMC::GetMC()->Gspos("DCOF", 1, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+  TVirtualMC::GetMC()->Gspos("DCOG", 1, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+
+  // 9.06.2000
+  cpar[0] = 207. - 1.5;
+  cpar[1] = 207.;
+  cpar[2] = ((243.55+4.5+1.5)-168.25)/2;
+
+  cpar[3] = 180.-50.;
+  cpar[4] = 180.+50.; 
+
+  TVirtualMC::GetMC()->Gsvolu("DCOH", "TUBS", idtmed[1812], cpar, 5);
+
+  cpar[0] = 274.;
+  cpar[1] = 274. + 1.5;
+
+  TVirtualMC::GetMC()->Gsvolu("DCOI", "TUBS", idtmed[1812], cpar, 5);
+
+
+  dx=+5.;
+  dz = ((243.55+4.5+1.5)+168.25)/2;
+  TVirtualMC::GetMC()->Gspos("DCOH", 1, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+  TVirtualMC::GetMC()->Gspos("DCOI", 1, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+
+
+  // Aluminum cabels
+
+  cpar[0] = 274. + 1.5  +2.;
+  cpar[1] = 274. + 1.5  +2. + 80.;
+  cpar[2] = 5.05/2;
+  cpar[3] = -24.;
+  cpar[4] = 24.; 
+  TVirtualMC::GetMC()->Gsvolu("DCOJ", "TUBS", idtmed[kCable], cpar, 5);
+
+  //  dx = 274. + 1.5  +2. +40.;
+  //  dx = 5. + 1.5 +2. +40.;
+  //  dx = 5. + 1.5 +2.;
+  dx=-5.;
+  dz = 168.25 + 5.05 + 5.05/2;
+  TVirtualMC::GetMC()->Gspos("DCOJ", 1, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+
+  dz = 243.55 - 5.05/2;
+  TVirtualMC::GetMC()->Gspos("DCOJ", 2, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+
+  // 9.06.2000
+
+  cpar[3] = 180.-24.;
+  cpar[4] = 180.+24.; 
+
+   TVirtualMC::GetMC()->Gsvolu("DCOK", "TUBS", idtmed[kCable], cpar, 5);
+
+  //  dx = 274. + 1.5  +2. +40.;
+  //  dx = 5. + 1.5 +2. +40.;
+  //  dx = 5. + 1.5 +2.;
+  dx=+5.;
+  dz = 168.25 + 5.05 + 5.05/2;
+  TVirtualMC::GetMC()->Gspos("DCOK", 1, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+
+  dz = 243.55 - 5.05/2;
+  TVirtualMC::GetMC()->Gspos("DCOK", 2, "DDIP", dx,  0, dz+kZDipole, 0, "ONLY");
+
   //   YOKE 
-  
-  ypar[1] = 275.8;
+
+// Top and bottom blocks
+  ypar[0] = 298.1; 
+  ypar[1] = 69.5;
+  ypar[2] = 155.75;
+
+// iron- high cuts
+  TVirtualMC::GetMC()->Gsvolu("DY1 ", "BOX ", idtmed[1858], ypar, 3);
+  ypar[0] = 144.+10.; 
+  ypar[1] = 193.3+10.;
   ypar[2] = 5.;
-  ypar[3] = 156.8;
-  ypar[0] = ypar[1] - ypar[3] * 2. * TMath::Tan(acc_max * kDegrad);
-  gMC->Gsvolu("DY1 ", "TRD1", idtmed[1809], ypar, 4);
-  // iron - 
-  dy = 283.5;
-  gMC->Gspos("DY1 ", 1, "DDIP", 0.,  dy, 0., 0, "ONLY");
-  gMC->Gspos("DY1 ", 2, "DDIP", 0., -dy, 0., 0, "ONLY");
-  ypar[2] = 60.;
-  gMC->Gsvolu("DY2 ", "TRD1", idtmed[1829], ypar, 4);
-  // iron - 
-  dy = ypar[2] + 284.;
-  gMC->Gspos("DY2 ", 1, "DDIP", 0.,  dy, 0., 0, "ONLY");
-  gMC->Gspos("DY2 ", 2, "DDIP", 0., -dy, 0., 0, "ONLY");
-  the1 = 99.;
+  ypar[3] = 155.75;
+  dy = -69.5 + 5.;
+// iron- low cuts
+  TVirtualMC::GetMC()->Gsvolu("DY11", "TRD1", idtmed[1818], ypar, 4);
+  TVirtualMC::GetMC()->Gspos("DY11", 1, "DY1 ", 0.,  dy, 0., 0, "ONLY");
+
+  dy = 365.5;
+  dz = 4.95;
+  TVirtualMC::GetMC()->Gspos("DY1 ", 1, "DDIP", 0.,  dy, -dz+kZDipole, 0, "ONLY");
+
+  the1 = 270.;
   phi1 = 0.;
-  the2 = 90.;
+  the2 = 270.;
   phi2 = 90.;
-  the3 = 9.;
+  the3 = 0.;
   phi3 = 0.;
-  AliMatrix(idrotm[1806], the1, phi1, the2, phi2, the3, phi3);
-  the1 = 261.;
+  AliMatrix(idrotm[1808], the1, phi1, the2, phi2, the3, phi3);
+  TVirtualMC::GetMC()->Gspos("DY1 ", 2, "DDIP", 0., -dy, -dz+kZDipole, idrotm[1808] , "ONLY");
+
+// side walls
+  //  ypar[0] = 579./2.; 
+  ypar[0] = 296.; 
+  ypar[1] = 0.;
+  ypar[2] = 0.;
+  ypar[3] = 155.75;
+  ypar[4] = 47.9;
+  ypar[5] = 72.55;
+  ypar[6] = 4.3058039629;
+  // z+ 
+  ypar[7] = 155.75;
+  ypar[8] = 47.9;
+  ypar[9] = 72.55;
+  ypar[10] = 4.3058039629;
+
+// iron - high cuts
+
+  TVirtualMC::GetMC()->Gsvolu("DY2 ", "TRAP", idtmed[1858], ypar,11);
+
+  ypar[4] = 47.9 -5.;
+  ypar[5] = 72.55 -5.;
+
+  ypar[8] = 47.9 -5.;
+  ypar[9] = 72.55 -5.;
+
+
+// iron - low cuts
+
+  TVirtualMC::GetMC()->Gsvolu("DY22", "TRAP", idtmed[1818], ypar,11);
+
+  dy = 0.;
+  dx = -5.;
+
+  TVirtualMC::GetMC()->Gspos("DY22", 1, "DY2 ", dx,  dy, 0., 0, "ONLY");
+
+  the1 = 90.;
+  phi1 = 180.;
+  the2 = 180.;
+  phi2 = 180.;
+  the3 = 90.;
+  phi3 = 90.;
+  AliMatrix(idrotm[1809], the1, phi1, the2, phi2, the3, phi3);
+
+  the1 = 90.;
   phi1 = 0.;
-  the3 = 171.;
-  AliMatrix(idrotm[1807], the1, phi1, the2, phi2, the3, phi3);
-  tpar[0] = 60.;
-  tpar[1] = 283.;
-  tpar[2] = 156.8;
-  gMC->Gsvolu("DYL ", "BOX ", idtmed[1814], tpar, 3);
-  tpar[0] = 5.;
-  tpar[1] = 73.;
-  gMC->Gsvolu("DY3 ", "BOX ", idtmed[1809], tpar, 3);
-  dx = tpar[0] - 60.;
-  dy = tpar[1] + 137.;
-  gMC->Gspos("DY3 ", 1, "DYL ", dx,  dy, 0., 0, "ONLY");
-  gMC->Gspos("DY3 ", 2, "DYL ", dx, -dy, 0., 0, "ONLY");
-  tpar[0] = 55.;
-  gMC->Gsvolu("DY4 ", "BOX ", idtmed[1829], tpar, 3);
-  dx = dx + 5. + tpar[0];
-  gMC->Gspos("DY4 ", 1, "DYL ", dx,  dy, 0., 0, "ONLY");
-  gMC->Gspos("DY4 ", 2, "DYL ", dx, -dy, 0., 0, "ONLY");
-  tpar[0] = 37.7;
-  tpar[1] = 137.;
-  gMC->Gsvolu("DY5 ", "BOX ", idtmed[1829], tpar, 3);
-  dx = 60. - tpar[0];
-  gMC->Gspos("DY5 ", 1, "DYL ", dx, 0., 0., 0, "ONLY");
-  tpar[0] = 5.;
-  gMC->Gsvolu("DY6 ", "BOX ", idtmed[1809], tpar, 3);
-  dx = dx - 37.7 - tpar[0];
-  gMC->Gspos("DY6 ", 1, "DYL ", dx, 0., 0., 0, "ONLY");
-  tpar[0] = 17.3;
-  tpar[1] = 5.;
-  gMC->Gsvolu("DY7 ", "BOX ", idtmed[1809], tpar, 3);
-  dx = tpar[0] - 60.;
-  dy = tpar[1] + 127.;
-  gMC->Gspos("DY7 ", 1, "DYL ", dx,  dy, 0., 0, "ONLY");
-  gMC->Gspos("DY7 ", 2, "DYL ", dx, -dy, 0., 0, "ONLY");
+  the2 = 180.;
+  phi2 = 0.;
+  the3 = 90.;
+  phi3 = 90.;
+  AliMatrix(idrotm[1810], the1, phi1, the2, phi2, the3, phi3);
+
+  dx = 228.875;
+  dz = - 4.95;
   
-  dx = ypar[0] + ypar[3] * TMath::Tan(acc_max * kDegrad) - 60.;
-  gMC->Gspos("DYL ", 1, "DDIP", dx, 0., 0., idrotm[1806], "ONLY");
-  gMC->Gspos("DYL ", 2, "DDIP",-dx, 0., 0., idrotm[1807], "ONLY");
-  gMC->Gspos("DDIP", 1, "ALIC", 0., 0., 725.+250., 0, "MANY");
-  gMC->Gsatt("DDIP", "SEEN", 0);
-  gMC->Gsatt("DC21", "SEEN", 0);
-  gMC->Gsatt("DC22", "SEEN", 0);
-  gMC->Gsatt("DC3 ", "SEEN", 0);
-  gMC->Gsatt("DC4 ", "SEEN", 0);
+  TVirtualMC::GetMC()->Gspos("DY2 ", 1, "DDIP",  dx, 0.0,  dz+kZDipole, idrotm[1809], "ONLY");
+  TVirtualMC::GetMC()->Gspos("DY2 ", 2, "DDIP", -dx, 0.0,  dz+kZDipole, idrotm[1810], "ONLY");
+  
+  AliMatrix(idrotm[1811], 270., 0., 90., 90., 180., 0.);
+  TVirtualMC::GetMC()->Gspos("DDIP", 1, "ALIC", 0., 0., 0., idrotm[1811], "ONLY");
+  gGeoManager->SetVolumeAttribute("DDIP", "SEEN", 0);
 }
 
-//_____________________________________________________________________________
-void AliDIPOv2::DrawModule()
+
+void AliDIPOv2::CreateCompensatorDipole()
 {
-  //
-  // Draw a shaded view of the muon absorber
-  //
+    //
+    //  Geometry of the compensator Dipole MBWMD (was MCB @ SPS)
+    //  LAB I/EA Note 74.10
+    //  6/5/1974
+    //
+    const Float_t kHCoil       =  22.;  // Coil Height
+    const Float_t kWCoil       =  12.;  // Coil Width
+    const Float_t kLCoilH      = 250.;  // Hor. Coil Length
+    const Float_t kRCoilC      =  31.;  // Circ Coil Radius
+    const Float_t kWBase       = 125.;  // Base Width
+    const Float_t kHBase       =  30.;  // Base Height
+    
+    const Float_t kWUYoke      =  16.;
+    const Float_t kHUYoke      =  31.;
 
-  // Set everything unseen
-  gMC->Gsatt("*", "seen", -1);
-  // 
-  // Set ALIC mother transparent
-  gMC->Gsatt("ALIC","SEEN",0);
-  //
-  // Set the volumes visible
-  gMC->Gsatt("DDIP","seen",0);
-  gMC->Gsatt("DC1 ","seen",1);
-  gMC->Gsatt("DC2 ","seen",1);
-  gMC->Gsatt("DC3 ","seen",1);
-  gMC->Gsatt("DC4 ","seen",1);
-  gMC->Gsatt("DC11","seen",1);
-  gMC->Gsatt("DC21","seen",1);
-  gMC->Gsatt("DC12","seen",1);
-  gMC->Gsatt("DC22","seen",1);
-  gMC->Gsatt("DL1 ","seen",1);
-  gMC->Gsatt("DL2 ","seen",1);
-  gMC->Gsatt("DY1 ","seen",1);
-  gMC->Gsatt("DY2 ","seen",1);
-  gMC->Gsatt("DYL ","seen",1);
-  gMC->Gsatt("DY3 ","seen",1);
-  gMC->Gsatt("DY4 ","seen",1);
-  gMC->Gsatt("DY5 ","seen",1);
-  gMC->Gsatt("DY6 ","seen",1);
-  gMC->Gsatt("DY7 ","seen",1);
-  //
-  gMC->Gdopt("hide", "on");
-  gMC->Gdopt("shad", "on");
-  gMC->Gsatt("*", "fill", 7);
-  gMC->SetClipBox(".");
-  gMC->SetClipBox(".");
-  gMC->DefaultRange();
-  gMC->Gdraw("alic", 30, 30, 0, 17, 13.5, .019, .019);
-  gMC->Gdhead(1111, "Magnetic Dipole Version 2");
-  gMC->Gdman(16, 4, "MAN");
+    const Float_t kWLYoke      =  50.0;
+    const Float_t kHLYoke      =  61.0;
+    const Float_t kLLYoke      =  kLCoilH + kRCoilC;
+
+    const Float_t kWApperture  =  12.;
+    const Float_t kDCoil       =  kHUYoke + kHLYoke - 6. - 2. * kRCoilC;
+    
+    const Float_t kH           =  kHBase +  kHUYoke +  kHLYoke;
+    
+    Int_t *idtmed = fIdtmed->GetArray()-1799;
+    Int_t idrotm[1899];
+//
+    Float_t pbox[3];
+//  Mother volumes
+    TGeoVolumeAssembly* asDCM0 = new TGeoVolumeAssembly("DCM0");
+    asDCM0->SetName("DCM0");
+    
+//
+//  Mother volume containing lower coil
+    pbox[0] = kWLYoke / 2.;
+    pbox[1] = kHLYoke / 2.;
+    pbox[2] = kLLYoke / 2.;
+    
+    TVirtualMC::GetMC()->Gsvolu("DCML", "BOX", idtmed[1809 + 40], pbox, 3);
+//
+// Base
+    pbox[0] = kWBase / 2.;
+    pbox[1] = kHBase / 2.;
+    TVirtualMC::GetMC()->Gsvolu("DCBA", "BOX", idtmed[1809 + 40], pbox, 3);
+//
+// Coil: straight sections, horizontal
+    pbox[0] = kWCoil  / 2.;
+    pbox[1] = kHCoil  / 2.;
+    pbox[2] = kLCoilH / 2.;
+    TVirtualMC::GetMC()->Gsvolu("DCH1", "BOX", idtmed[1816 + 40], pbox, 3);
+//
+// Coil: straight sections, horizontal
+    pbox[0] = kWCoil  / 2.;
+    pbox[1] = kHCoil  / 2.;
+    pbox[2] = kLCoilH / 2.;
+    TVirtualMC::GetMC()->Gsvolu("DCH2", "BOX", idtmed[1816 + 40], pbox, 3);
+
+//
+// Mother volume containing upper coil
+    pbox[0] =  kWUYoke / 2.;
+    pbox[1] =  kHUYoke / 2.;
+    pbox[2] =  kLCoilH / 2.;
+    TVirtualMC::GetMC()->Gsvolu("DCMU", "BOX", idtmed[1809 + 40], pbox, 3);
+
+//
+// Coil: straight sections, vertical
+    pbox[0] = kWCoil / 2.;
+    pbox[1] = kDCoil / 2.;
+    pbox[2] = kHCoil / 2.;
+    
+    TVirtualMC::GetMC()->Gsvolu("DCCV", "BOX", idtmed[1816 + 40], pbox, 3);
+//
+// Coil: circular section 
+
+    Float_t ptubs[5];
+    ptubs[0] = kRCoilC - kHCoil;
+    ptubs[1] = kRCoilC;
+    ptubs[2] = kWCoil / 2.;
+    ptubs[3] =  0.;
+    ptubs[4] = 90.;
+    TVirtualMC::GetMC()->Gsvolu("DCC1", "TUBS", idtmed[1816 + 40], ptubs, 5);
+//
+// Clamps
+    Float_t ppgon[10];
+    ppgon[0] =  0.;
+    ppgon[1] = 90.;
+    ppgon[2] =  1.;
+    ppgon[3] =  2.;
+    ppgon[4] = -1.;
+    ppgon[5] =  0.;
+    ppgon[6] = 24.75;
+    ppgon[7] =  1.;
+    ppgon[8] =  0.;
+    ppgon[9] = 24.75;
+    TVirtualMC::GetMC()->Gsvolu("DCLA", "PGON", idtmed[1809 + 40], ppgon, 10);
+//
+// Assemble all
+//
+    AliMatrix(idrotm[1811], -90., 0., 90., 90.,   0., 0.);
+    AliMatrix(idrotm[1812],   0., 0., 90., 90.,  90., 0.);  
+    AliMatrix(idrotm[1813], 180., 0., 90., 90.,  90., 0.);
+    AliMatrix(idrotm[1814],   0., 180., 90., 270.,  90., 0.);
+    AliMatrix(idrotm[1815], 180., 180., 90., 270.,  90., 0.);  
+    
+    Float_t dx, dy, dz;
+    Float_t dy0 = 0.;
+
+    dy0 = -kH / 2. + kHBase/2.;
+    TVirtualMC::GetMC()->Gspos("DCBA", 1, "DCM0",  0., dy0, 15.0, 0, "ONLY");
+    
+    // Lower coil
+    dx = ( kWLYoke - kWCoil) / 2.;
+    dy = (-kHLYoke + kHCoil) / 2. + 6.;
+    TVirtualMC::GetMC()->Gspos("DCH1", 1, "DCML",  dx, dy,  -kRCoilC / 2., 0, "ONLY");
+    // Lower mother volume
+    dx = (kWLYoke + kWApperture) / 2.;
+    dy0 += (kHBase +  kHLYoke) / 2.;
+    TVirtualMC::GetMC()->Gspos("DCML", 1, "DCM0", -dx, dy0, kRCoilC / 2., 0, "ONLY");
+    TVirtualMC::GetMC()->Gspos("DCML", 2, "DCM0", +dx, dy0, kRCoilC / 2., idrotm[1811], "ONLY");
+    
+    dx = (kWUYoke - kWCoil) / 2.;
+    dy = (kHUYoke - kHCoil) / 2;
+    // Upper coil
+    TVirtualMC::GetMC()->Gspos("DCH2", 1, "DCMU",   dx,  dy, 0., 0, "ONLY");
+    // Upper mother volume
+    dx = (kWUYoke + kWApperture) / 2.;
+    dy0 +=  (kHLYoke + kHUYoke) / 2.;
+    TVirtualMC::GetMC()->Gspos("DCMU", 1, "DCM0", -dx, dy0, 0., 0, "ONLY");
+    TVirtualMC::GetMC()->Gspos("DCMU", 2, "DCM0", +dx, dy0, 0., idrotm[1811], "ONLY");
+
+    // Vertical coils
+    dx =  (kWCoil +  kWApperture) / 2.;
+    dy =  kH / 2. - kDCoil / 2. - kRCoilC;
+    dz =  (kLCoilH - kHCoil) / 2. + kRCoilC;
+    TVirtualMC::GetMC()->Gspos("DCCV", 1, "DCM0",  dx,  dy, -dz, 0, "ONLY");
+    TVirtualMC::GetMC()->Gspos("DCCV", 2, "DCM0", -dx,  dy, -dz, 0, "ONLY");
+
+    dx = (kWLYoke - kWCoil) / 2.;
+    dy = -kHLYoke / 2. + kDCoil / 2. + 6. + kRCoilC;
+    dz =  kLLYoke / 2. - kHCoil / 2.;
+    
+    TVirtualMC::GetMC()->Gspos("DCCV", 3, "DCML", dx, dy,  dz, 0, "ONLY");
+
+
+
+    // Circular coil
+    dx =  (kWCoil +  kWApperture) / 2.;
+    dy = dy0 + kHUYoke / 2. - kRCoilC;
+    dz =  kLCoilH / 2.;
+    TVirtualMC::GetMC()->Gspos("DCC1", 1, "DCM0", -dx, dy,  dz, idrotm[1812], "ONLY");
+    TVirtualMC::GetMC()->Gspos("DCC1", 2, "DCM0", +dx, dy,  dz, idrotm[1812], "ONLY");
+    TVirtualMC::GetMC()->Gspos("DCC1", 3, "DCM0", +dx, dy, -dz, idrotm[1813], "ONLY");
+    TVirtualMC::GetMC()->Gspos("DCC1", 4, "DCM0", -dx, dy, -dz, idrotm[1813], "ONLY");
+    dy = -kH / 2. + kHBase + 6. + kRCoilC;
+    TVirtualMC::GetMC()->Gspos("DCC1", 5, "DCM0", +dx, dy, -dz, idrotm[1815], "ONLY");
+    TVirtualMC::GetMC()->Gspos("DCC1", 6, "DCM0", -dx, dy, -dz, idrotm[1815], "ONLY");
+
+    dx = ( kWLYoke - kWCoil) / 2.;
+    dy =  -kHLYoke / 2. + 6. + kRCoilC;
+    dz =  kLLYoke / 2. - kRCoilC;
+    TVirtualMC::GetMC()->Gspos("DCC1", 7, "DCML", dx, dy, dz, idrotm[1814], "ONLY");
+
+//  Clamps
+    dx = kWApperture / 2. + kWUYoke;
+    dy = -kH / 2. + kHLYoke + kHBase;
+    
+
+    TVirtualMC::GetMC()->Gspos("DCLA", 1, "DCM0",  dx, dy, -119., 0, "ONLY");
+    TVirtualMC::GetMC()->Gspos("DCLA", 2, "DCM0",  dx, dy,  -44., 0, "ONLY");
+    TVirtualMC::GetMC()->Gspos("DCLA", 3, "DCM0",  dx, dy,   46., 0, "ONLY");
+    TVirtualMC::GetMC()->Gspos("DCLA", 4, "DCM0",  dx, dy,  119., 0, "ONLY");
+
+    TVirtualMC::GetMC()->Gspos("DCLA", 5, "DCM0",  -dx, dy, -119., idrotm[1811], "ONLY");
+    TVirtualMC::GetMC()->Gspos("DCLA", 6, "DCM0",  -dx, dy,  -44., idrotm[1811], "ONLY");
+    TVirtualMC::GetMC()->Gspos("DCLA", 7, "DCM0",  -dx, dy,   46., idrotm[1811], "ONLY");
+    TVirtualMC::GetMC()->Gspos("DCLA", 8, "DCM0",  -dx, dy,  119., idrotm[1811], "ONLY");
+
+
+    AliMatrix(idrotm[1816], 270., 0., 90., 90.,  180., 0.);  
+    TVirtualMC::GetMC()->Gspos("DCM0", 1, "ALIC",  0., -12.,  1075., idrotm[1816], "ONLY");
 }
 
+
 //_____________________________________________________________________________
 void AliDIPOv2::CreateMaterials()
 {
@@ -367,49 +813,82 @@ void AliDIPOv2::CreateMaterials()
   // Create Materials for Magnetic Dipole version 2
   //
   
-  Int_t ISXFLD   = gAlice->Field()->Integ();
-  Float_t SXMGMX = gAlice->Field()->Max();
+  Int_t isxfld1   = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
+  Int_t isxfld2   = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->PrecInteg();
+  Float_t sxmgmx  = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
+  
   
   Float_t asteel[4] = { 55.847,51.9961,58.6934,28.0855 };
   Float_t zsteel[4] = { 26.,24.,28.,14. };
   Float_t wsteel[4] = { .715,.18,.1,.005 };
+
   Float_t acoil[3]  = { 26.98,1.01,16. };
   Float_t zcoil[3]  = { 13.,1.,8. };
   Float_t wcoil[3]  = { .66,.226,.114 };
+
+  Float_t aresi[3]  = { 1.01,12.011,16.};
+  Float_t zresi[3]  = { 1.,6.,8. };
+  Float_t wresi[3]  = { .0644,.7655,.1701 };
+
+  Float_t aG10[5] = { 1.01,12.011,16.,28.085 ,79.904 };
+  Float_t zG10[5] = { 1.,6.,8.,14.,35. };
+  Float_t wG10[5] = { .02089,.22338,.28493,.41342,.05738 };
+
+    // 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;
+  Float_t dAir1 = 1.20479E-10;
+
   
   Float_t epsil, stmin, deemax, tmaxfd, stemax;
   
   // --- Define the various materials for GEANT --- 
   //     Aluminum 
-  AliMaterial(9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
-  AliMaterial(29, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
-  AliMaterial(49, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
+  AliMaterial( 9, "ALUMINIUM0$", 26.98, 13., 2.7, 8.9, 37.2);
+  AliMaterial(29, "ALUMINIUM1$", 26.98, 13., 2.7, 8.9, 37.2);
+  AliMaterial(49, "ALUMINIUM2$", 26.98, 13., 2.7, 8.9, 37.2);
   
   //     Iron 
-  AliMaterial(10, "IRON$     ", 55.85, 26., 7.87, 1.76, 17.1);
-  AliMaterial(30, "IRON$     ", 55.85, 26., 7.87, 1.76, 17.1);
-  AliMaterial(50, "IRON$     ", 55.85, 26., 7.87, 1.76, 17.1);
-  
+  AliMaterial(10, "IRON0$     ", 55.85, 26., 7.87, 1.76, 17.1);
+  AliMaterial(30, "IRON1$     ", 55.85, 26., 7.87, 1.76, 17.1);
+  AliMaterial(50, "IRON2$     ", 55.85, 26., 7.87, 1.76, 17.1);
+  //     Copper
+  AliMaterial(17, "COPPER0$   ", 63.55, 29., 8.96, 1.43, 15.1);
+  AliMaterial(37, "COPPER1$   ", 63.55, 29., 8.96, 1.43, 15.1);
+  AliMaterial(57, "COPPER2$   ", 63.55, 29., 8.96, 1.43, 15.1);
   //     Air 
-  AliMaterial(15, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500);
-  AliMaterial(35, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500);
-  AliMaterial(55, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500);
-  
+  AliMixture(15, "AIR0$      ", aAir, zAir, dAir, 4, wAir);
+  AliMixture(35, "AIR1$      ", aAir, zAir, dAir, 4, wAir);
+  AliMixture(55, "AIR2$      ", aAir, zAir, dAir, 4, wAir);
+  AliMixture(75, "AIR_MUON   ", aAir, zAir, dAir, 4, wAir);
   //     Vacuum 
-  AliMaterial(16, "VACUUM$ ", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
-  AliMaterial(36, "VACUUM$ ", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
-  AliMaterial(56, "VACUUM$ ", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
+  AliMixture(16, "VACUUM0$ ", aAir, zAir, dAir1, 4, wAir);
+  AliMixture(36, "VACUUM1$ ", aAir, zAir, dAir1, 4, wAir);
+  AliMixture(56, "VACUUM2$ ", aAir, zAir, dAir1, 4, wAir);
   
   //     stainless Steel 
-  AliMixture(19, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel);
-  AliMixture(39, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel);
-  AliMixture(59, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel);
+  AliMixture(19, "STAINLESS STEEL0$", asteel, zsteel, 7.88, 4, wsteel);
+  AliMixture(39, "STAINLESS STEEL1$", asteel, zsteel, 7.88, 4, wsteel);
+  AliMixture(59, "STAINLESS STEEL2$", asteel, zsteel, 7.88, 4, wsteel);
   
   //     Coil 
-  AliMixture(14, "Al$", acoil, zcoil, 2.122, 3, wcoil);
-  AliMixture(34, "Al$", acoil, zcoil, 2.122, 3, wcoil);
-  AliMixture(54, "Al$", acoil, zcoil, 2.122, 3, wcoil);
-  
+  AliMixture(14, "Al0$", acoil, zcoil, 2.122, 3, wcoil);
+  AliMixture(34, "Al1$", acoil, zcoil, 2.122, 3, wcoil);
+  AliMixture(54, "Al2$", acoil, zcoil, 2.122, 3, wcoil);
+
+  //RESIN
+  AliMixture(13, "RESIN0$", aresi, zresi, 1.05, 3, wresi);
+  AliMixture(33, "RESIN1$", aresi, zresi, 1.05, 3, wresi);
+  AliMixture(53, "RESIN2$", aresi, zresi, 1.05, 3, wresi);  
+
+  //G10
+  AliMixture(11, "G100$", aG10, zG10, 1.7, 5, wG10);
+  AliMixture(31, "G101$", aG10, zG10, 1.7, 5, wG10);
+  AliMixture(51, "G102$", aG10, zG10, 1.7, 5, wG10); 
   // **************** 
   //     Defines tracking media parameters. 
   //     Les valeurs sont commentees pour laisser le defaut 
@@ -422,33 +901,55 @@ void AliDIPOv2::CreateMaterials()
   // *************** 
   
   //    Aluminum 
-  AliMedium(9, "ALU_C0          ",  9, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(29, "ALU_C1          ", 29, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(49, "ALU_C2          ", 49, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium( 9, "ALU_C0          ",  9, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(29, "ALU_C1          ", 29, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(49, "ALU_C2          ", 49, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
   
   //    Iron 
-  AliMedium(10, "FE_C0           ", 10, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(30, "FE_C1           ", 30, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(50, "FE_C2           ", 50, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(10, "FE_C0           ", 10, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(30, "FE_C1           ", 30, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(50, "FE_C2           ", 50, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
   
   //    Air 
-  AliMedium(15, "AIR_C0          ", 15, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(35, "AIR_C1          ", 35, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(55, "AIR_C2          ", 55, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(15, "AIR_C0          ", 15, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(35, "AIR_C1          ", 35, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(55, "AIR_C2          ", 55, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(75, "AIR_MUON        ", 75, 0, isxfld2, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
   
   //    Vacuum 
-  AliMedium(16, "VA_C0           ", 16, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(36, "VA_C1           ", 36, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(56, "VA_C2           ", 56, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(16, "VA_C0           ", 16, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(36, "VA_C1           ", 36, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(56, "VA_C2           ", 56, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
   
   //    Steel 
-  AliMedium(19, "ST_C0           ", 19, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(39, "ST_C1           ", 39, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(59, "ST_C3           ", 59, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(19, "ST_C0           ", 19, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(39, "ST_C1           ", 39, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(59, "ST_C3           ", 59, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
   
   //    Coil 
-  AliMedium(14, "Coil_C1         ", 14, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(34, "Coil_C2         ", 34, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(54, "Coil_C3         ", 54, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(14, "Coil_C1         ", 14, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(34, "Coil_C2         ", 34, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(54, "Coil_C3         ", 54, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+
+  //    Resin 
+  AliMedium(13, "RESIN_C0        ", 13, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(33, "RESIN_C1        ", 33, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(53, "RESIN_C2        ", 53, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+
+  //    G10 
+  AliMedium(11, "G10_C0          ", 11, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(31, "G10_C1          ", 31, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(51, "G10_C2          ", 51, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  //
+  //    Copper
+  AliMedium(17, "Cu_C0           ", 17, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(37, "Cu_C1           ", 37, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(57, "Cu_C2           ", 57, 0, isxfld1, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+
 }
 
+
+
+
+
+