]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFv6T0.cxx
Removing the tasks from the digitization (Ruben)
[u/mrichter/AliRoot.git] / TOF / AliTOFv6T0.cxx
index e3fa0242bf43d7d34bb0fd4675bf5fb30efef5d7..da19b0b1d326f9235dfe754c0161f18bf4ecab0a 100644 (file)
@@ -89,13 +89,14 @@ Revision 0.1 2007 March G. Cara Romeo and A. De Caro
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "TDirectory.h"
-#include "TLorentzVector.h"
-#include "TVirtualMC.h"
-#include "TGeoManager.h"
+#include <TDirectory.h>
+#include <TGeoGlobalMagField.h>
+#include <TGeoManager.h>
 #include <TGeoMatrix.h>
 #include <TGeoPhysicalNode.h>
 #include <TGeoVolume.h>
+#include <TLorentzVector.h>
+#include <TVirtualMC.h>
 
 #include "AliConst.h"
 #include "AliGeomManager.h"
@@ -108,7 +109,6 @@ Revision 0.1 2007 March G. Cara Romeo and A. De Caro
 #include "AliTOFGeometry.h"
 #include "AliTOFv6T0.h"
 
-extern TDirectory *gDirectory;
 extern TVirtualMC *gMC;
 extern TGeoManager *gGeoManager;
 
@@ -126,7 +126,9 @@ const Float_t AliTOFv6T0::fgkInterCentrModBorder1  =  49.5 ; // cm
 const Float_t AliTOFv6T0::fgkInterCentrModBorder2  =  57.5 ; // cm
 const Float_t AliTOFv6T0::fgkExterInterModBorder1  = 196.0 ; // cm
 const Float_t AliTOFv6T0::fgkExterInterModBorder2  = 203.5 ; // cm
-const Float_t AliTOFv6T0::fgkLengthInCeModBorder   =   7.2 ; // cm // it was 4.7 cm (AdC)
+//const Float_t AliTOFv6T0::fgkLengthInCeModBorder   =   7.2 ; // cm // it was 4.7 cm (AdC)
+const Float_t AliTOFv6T0::fgkLengthInCeModBorderU  =   5.0 ; // cm
+const Float_t AliTOFv6T0::fgkLengthInCeModBorderD  =   7.0 ; // cm
 const Float_t AliTOFv6T0::fgkLengthExInModBorder   =   5.0 ; // cm // it was 7.0 cm (AdC)
 const Float_t AliTOFv6T0::fgkModuleCoverThickness  =   2.0 ; // cm
 const Float_t AliTOFv6T0::fgkFEAwidth1    = 19.0; // cm
@@ -213,7 +215,7 @@ AliTOFv6T0::AliTOFv6T0(const char *name, const char *title):
 
   // Save the geometry
   TDirectory* saveDir = gDirectory;
-  AliRunLoader::GetRunLoader()->CdGAFile();
+  AliRunLoader::Instance()->CdGAFile();
   fTOFGeometry->Write("TOFgeometry");
   saveDir->cd();
 
@@ -375,10 +377,10 @@ void AliTOFv6T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenA)
   //
 
   AliDebug(1, "************************* TOF geometry **************************");
-  AliDebug(1,Form(" xtof   %d",  xtof));
-  AliDebug(1,Form(" ytof   %d",  ytof));
-  AliDebug(1,Form(" zlenA   %d", zlenA));
-  AliDebug(2,Form(" zlenA*0.5 = %d", zlenA*0.5));
+  AliDebug(1,Form(" xtof   %f",  xtof));
+  AliDebug(1,Form(" ytof   %f",  ytof));
+  AliDebug(1,Form(" zlenA   %f", zlenA));
+  AliDebug(2,Form(" zlenA*0.5 = %f", zlenA*0.5));
 
   Float_t xFLT, yFLT, zFLTA;
   xFLT  = xtof     - 2.*fgkModuleWallThickness;
@@ -464,7 +466,8 @@ void AliTOFv6T0::CreateModules(Float_t xtof,  Float_t ytof, Float_t zlenA,
   // Definition and positioning
   // of the fibre glass walls between central and intermediate modules (FWZ1 and FWZ2)
   Float_t alpha, tgal, beta, tgbe, trpa[11];
-  tgal  = (yFLT - 2.*fgkLengthInCeModBorder)/(fgkInterCentrModBorder2 - fgkInterCentrModBorder1);
+  //tgal  = (yFLT - 2.*fgkLengthInCeModBorder)/(fgkInterCentrModBorder2 - fgkInterCentrModBorder1);
+  tgal  = (yFLT - fgkLengthInCeModBorderU - fgkLengthInCeModBorderD)/(fgkInterCentrModBorder2 - fgkInterCentrModBorder1);
   alpha = TMath::ATan(tgal);
   beta  = (kPi*0.5 - alpha)*0.5;
   tgbe  = TMath::Tan(beta);
@@ -472,28 +475,34 @@ void AliTOFv6T0::CreateModules(Float_t xtof,  Float_t ytof, Float_t zlenA,
   trpa[1]  = 0.;
   trpa[2]  = 0.;
   trpa[3]  = 2.*fgkModuleWallThickness;
-  trpa[4]  = (fgkLengthInCeModBorder - 2.*fgkModuleWallThickness*tgbe)*0.5;
-  trpa[5]  = (fgkLengthInCeModBorder + 2.*fgkModuleWallThickness*tgbe)*0.5;
+  //trpa[4]  = (fgkLengthInCeModBorder - 2.*fgkModuleWallThickness*tgbe)*0.5;
+  //trpa[5]  = (fgkLengthInCeModBorder + 2.*fgkModuleWallThickness*tgbe)*0.5;
+  trpa[4]  = (fgkLengthInCeModBorderD - 2.*fgkModuleWallThickness*tgbe)*0.5;
+  trpa[5]  = (fgkLengthInCeModBorderD + 2.*fgkModuleWallThickness*tgbe)*0.5;
   trpa[6]  = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
   trpa[7]  = 2.*fgkModuleWallThickness;
-  trpa[8]  = (fgkLengthInCeModBorder - 2.*fgkModuleWallThickness*tgbe)*0.5;
-  trpa[9]  = (fgkLengthInCeModBorder + 2.*fgkModuleWallThickness*tgbe)*0.5;
+  trpa[8]  = (fgkLengthInCeModBorderD - 2.*fgkModuleWallThickness*tgbe)*0.5;
+  trpa[9]  = (fgkLengthInCeModBorderD + 2.*fgkModuleWallThickness*tgbe)*0.5;
+  //trpa[8]  = (fgkLengthInCeModBorder - 2.*fgkModuleWallThickness*tgbe)*0.5;
+  //trpa[9]  = (fgkLengthInCeModBorder + 2.*fgkModuleWallThickness*tgbe)*0.5;
   trpa[10] = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
-  gMC->Gsvolu("FWZ1", "TRAP", idtmed[503], trpa, 11); // Fibre glass
+  gMC->Gsvolu("FWZ1D", "TRAP", idtmed[503], trpa, 11); // Fibre glass
 
   AliMatrix (idrotm[0],90., 90.,180.,0.,90.,180.);
   AliMatrix (idrotm[1],90., 90.,  0.,0.,90.,  0.);
 
   //xcoor = 0.;
-  ycoor = -(yFLT - fgkLengthInCeModBorder)*0.5;
+  //ycoor = -(yFLT - fgkLengthInCeModBorder)*0.5;
+  ycoor = -(yFLT - fgkLengthInCeModBorderD)*0.5;
   zcoor = fgkInterCentrModBorder1;
-  gMC->Gspos("FWZ1", 1, "FLTA", xcoor, ycoor, zcoor, idrotm[0], "ONLY");
-  gMC->Gspos("FWZ1", 2, "FLTA", xcoor, ycoor,-zcoor, idrotm[1], "ONLY");
+  gMC->Gspos("FWZ1D", 1, "FLTA", xcoor, ycoor, zcoor, idrotm[0], "ONLY");
+  gMC->Gspos("FWZ1D", 2, "FLTA", xcoor, ycoor,-zcoor, idrotm[1], "ONLY");
 
   Float_t y0B, ycoorB, zcoorB;
 
   if (fTOFHoles) {
-    y0B = fgkLengthInCeModBorder - fgkModuleWallThickness*tgbe;
+    //y0B = fgkLengthInCeModBorder - fgkModuleWallThickness*tgbe;
+    y0B = fgkLengthInCeModBorderD - fgkModuleWallThickness*tgbe;
     trpa[0]  = xFLT*0.5;
     trpa[1]  = 0.;
     trpa[2]  = 0.;
@@ -508,22 +517,48 @@ void AliTOFv6T0::CreateModules(Float_t xtof,  Float_t ytof, Float_t zlenA,
     //xcoor = 0.;
     ycoorB = ycoor - fgkModuleWallThickness*0.5*tgbe;
     zcoorB = (zlenA*0.5 - 2.*fgkModuleWallThickness - fgkInterCentrModBorder1)*0.5 - 2.*fgkModuleWallThickness;
-    gMC->Gsvolu("FWZA", "TRAP", idtmed[503], trpa, 11); // Fibre glass
-    gMC->Gspos("FWZA", 1, "FLTB", xcoor, ycoorB, zcoorB, idrotm[1], "ONLY");
-    gMC->Gspos("FWZA", 2, "FLTC", xcoor, ycoorB,-zcoorB, idrotm[0], "ONLY");
+    gMC->Gsvolu("FWZAD", "TRAP", idtmed[503], trpa, 11); // Fibre glass
+    gMC->Gspos("FWZAD", 1, "FLTB", xcoor, ycoorB, zcoorB, idrotm[1], "ONLY");
+    gMC->Gspos("FWZAD", 2, "FLTC", xcoor, ycoorB,-zcoorB, idrotm[0], "ONLY");
   }
 
+
+
+  tgal  = (yFLT - fgkLengthInCeModBorderU - fgkLengthInCeModBorderD)/(fgkInterCentrModBorder2 - fgkInterCentrModBorder1);
+  alpha = TMath::ATan(tgal);
+  beta  = (kPi*0.5 - alpha)*0.5;
+  tgbe  = TMath::Tan(beta);
+  trpa[0]  = xFLT*0.5;
+  trpa[1]  = 0.;
+  trpa[2]  = 0.;
+  trpa[3]  = 2.*fgkModuleWallThickness;
+  //trpa[4]  = (fgkLengthInCeModBorder - 2.*fgkModuleWallThickness*tgbe)*0.5;
+  //trpa[5]  = (fgkLengthInCeModBorder + 2.*fgkModuleWallThickness*tgbe)*0.5;
+  trpa[4]  = (fgkLengthInCeModBorderU - 2.*fgkModuleWallThickness*tgbe)*0.5;
+  trpa[5]  = (fgkLengthInCeModBorderU + 2.*fgkModuleWallThickness*tgbe)*0.5;
+  trpa[6]  = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
+  trpa[7]  = 2.*fgkModuleWallThickness;
+  trpa[8]  = (fgkLengthInCeModBorderU - 2.*fgkModuleWallThickness*tgbe)*0.5;
+  trpa[9]  = (fgkLengthInCeModBorderU + 2.*fgkModuleWallThickness*tgbe)*0.5;
+  //trpa[8]  = (fgkLengthInCeModBorder - 2.*fgkModuleWallThickness*tgbe)*0.5;
+  //trpa[9]  = (fgkLengthInCeModBorder + 2.*fgkModuleWallThickness*tgbe)*0.5;
+  trpa[10] = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
+  gMC->Gsvolu("FWZ1U", "TRAP", idtmed[503], trpa, 11); // Fibre glass
+
+
   AliMatrix (idrotm[2],90.,270.,  0.,0.,90.,180.);
   AliMatrix (idrotm[3],90.,270.,180.,0.,90.,  0.);
 
   //xcoor = 0.;
-  ycoor = (yFLT - fgkLengthInCeModBorder)*0.5;
+  //ycoor = (yFLT - fgkLengthInCeModBorder)*0.5;
+  ycoor = (yFLT - fgkLengthInCeModBorderU)*0.5;
   zcoor = fgkInterCentrModBorder2;
-  gMC->Gspos("FWZ1", 3, "FLTA", xcoor, ycoor, zcoor,idrotm[2], "ONLY");
-  gMC->Gspos("FWZ1", 4, "FLTA", xcoor, ycoor,-zcoor,idrotm[3], "ONLY");
+  gMC->Gspos("FWZ1U", 1, "FLTA", xcoor, ycoor, zcoor,idrotm[2], "ONLY");
+  gMC->Gspos("FWZ1U", 2, "FLTA", xcoor, ycoor,-zcoor,idrotm[3], "ONLY");
 
   if (fTOFHoles) {
-    y0B = fgkLengthInCeModBorder + fgkModuleWallThickness*tgbe;
+    //y0B = fgkLengthInCeModBorder + fgkModuleWallThickness*tgbe;
+    y0B = fgkLengthInCeModBorderU + fgkModuleWallThickness*tgbe;
     trpa[0]  = xFLT*0.5;
     trpa[1]  = 0.;
     trpa[2]  = 0.;
@@ -535,13 +570,13 @@ void AliTOFv6T0::CreateModules(Float_t xtof,  Float_t ytof, Float_t zlenA,
     trpa[8]  = (y0B - fgkModuleWallThickness*tgbe)*0.5;
     trpa[9]  = (y0B + fgkModuleWallThickness*tgbe)*0.5;
     trpa[10] = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
-    gMC->Gsvolu("FWZB", "TRAP", idtmed[503], trpa, 11); // Fibre glass
+    gMC->Gsvolu("FWZBU", "TRAP", idtmed[503], trpa, 11); // Fibre glass
     //xcoor = 0.;
     ycoorB = ycoor - fgkModuleWallThickness*0.5*tgbe;
     zcoorB = (zlenA*0.5 - 2.*fgkModuleWallThickness - fgkInterCentrModBorder1)*0.5 -
       (fgkInterCentrModBorder2 - fgkInterCentrModBorder1) - 2.*fgkModuleWallThickness;
-    gMC->Gspos("FWZB", 1, "FLTB", xcoor, ycoorB, zcoorB, idrotm[3], "ONLY");
-    gMC->Gspos("FWZB", 2, "FLTC", xcoor, ycoorB,-zcoorB, idrotm[2], "ONLY");
+    gMC->Gspos("FWZBU", 1, "FLTB", xcoor, ycoorB, zcoorB, idrotm[3], "ONLY");
+    gMC->Gspos("FWZBU", 2, "FLTC", xcoor, ycoorB,-zcoorB, idrotm[2], "ONLY");
   }
 
   trpa[0] = 0.5*(fgkInterCentrModBorder2 - fgkInterCentrModBorder1)/TMath::Cos(alpha);
@@ -556,7 +591,8 @@ void AliTOFv6T0::CreateModules(Float_t xtof,  Float_t ytof, Float_t zlenA,
   AliMatrix (idrotm[5],180.-alpha*kRaddeg,90.,90.-alpha*kRaddeg,90.,90.,  0.);
 
   //xcoor = 0.;
-  ycoor = 0.;
+  //ycoor = 0.;
+  ycoor = (fgkLengthInCeModBorderD - fgkLengthInCeModBorderU)*0.5;
   zcoor = (fgkInterCentrModBorder2 + fgkInterCentrModBorder1)*0.5;
   gMC->Gspos("FWZ2", 1, "FLTA", xcoor, ycoor, zcoor, idrotm[4], "ONLY");
   gMC->Gspos("FWZ2", 2, "FLTA", xcoor, ycoor,-zcoor, idrotm[5], "ONLY");
@@ -857,6 +893,8 @@ void AliTOFv6T0::MakeModulesInBTOFvolumes(Float_t ytof, Float_t zlenA) const
   // are filled with volumes: FTOB and FTOC (MRPC containers),
   //
 
+  const Int_t kSize=16;
+
   Int_t idrotm[1];
 
   //AliMatrix(idrotm[0], 90.,  0., 0., 0., 90.,-90.);
@@ -868,8 +906,9 @@ void AliTOFv6T0::MakeModulesInBTOFvolumes(Float_t ytof, Float_t zlenA) const
   // Positioning of fibre glass modules (FTOA, FTOB and FTOC)
   for(Int_t isec=0; isec<fTOFGeometry->NSectors(); isec++){
     if(fTOFSectors[isec]==-1)continue;
-    char name[16];
-    sprintf(name, "BTOF%d",isec);
+
+    char name[kSize];
+    snprintf(name, kSize, "BTOF%d",isec);
     if (fTOFHoles && (isec==13 || isec==14 || isec==15)) {
       //xcoor = 0.;
       ycoor = (zlenA*0.5 + fgkInterCentrModBorder1)*0.5;
@@ -898,6 +937,8 @@ void AliTOFv6T0::MakeCoversInBTOFvolumes() const
   // (to separate MRPC strips from FEA cards)
   //
 
+  const Int_t kSize=16;
+
   Int_t idrotm[1];
 
   //AliMatrix(idrotm[0], 90.,  0., 0., 0., 90.,-90.);
@@ -908,12 +949,12 @@ void AliTOFv6T0::MakeCoversInBTOFvolumes() const
   ycoor = 0.;
   zcoor = fgkModuleCoverThickness*0.5;
 
-  char name[16];
+  char name[kSize];
 
   // Positioning of module covers (FPEA, FPEB)
   for(Int_t isec=0; isec<fTOFGeometry->NSectors(); isec++) {
     if(fTOFSectors[isec]==-1)continue;
-    sprintf(name, "BTOF%d",isec);
+    snprintf(name, kSize, "BTOF%d",isec);
     if (fTOFHoles && (isec==13 || isec==14 || isec==15))
       gMC->Gspos("FPEB", 0, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
     else
@@ -932,6 +973,8 @@ void AliTOFv6T0::MakeBackInBTOFvolumes(Float_t ytof) const
   // filled with volumes FAIB (FEA cards and services container).
   //
 
+  const Int_t kSize=16;
+
   Int_t idrotm[1];
 
   //AliMatrix(idrotm[0], 90.,  0., 0., 0., 90.,-90.);
@@ -942,12 +985,12 @@ void AliTOFv6T0::MakeBackInBTOFvolumes(Float_t ytof) const
   ycoor = 0.;
   zcoor = fgkModuleCoverThickness + (ytof*0.5 - fgkModuleCoverThickness)*0.5;
 
-  char name[16];
+  char name[kSize];
 
   // Positioning of FEA cards and services containers (FAIA, FAIC and FAIB)
   for(Int_t isec=0; isec<fTOFGeometry->NSectors(); isec++) {
     if(fTOFSectors[isec]==-1)continue;
-    sprintf(name, "BTOF%d",isec);
+    snprintf(name, kSize, "BTOF%d",isec);
     if (fgkFEAwithMasks[isec])
       gMC->Gspos("FAIA", 0, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
     else {
@@ -1880,260 +1923,6 @@ void AliTOFv6T0::MakeReadoutCrates(Float_t ytof) const
 
 }
 
-//_____________________________________________________________________________
-void AliTOFv6T0::DrawModule() const
-{
-  //
-  // Draw a shaded view of the Time Of Flight version 5
-  //
-
-  // Set everything unseen
-  gMC->Gsatt("*", "seen", -1);
-
-  //
-  //Set volumes visible
-  // 
-
-  //Set ALIC mother transparent
-  gMC->Gsatt("ALIC","SEEN", 0);
-
-//=====> Level 1
-  // Level 1 for TOF volumes
-  gMC->Gsatt("B077","seen", 0);
-
-//=====> Level 2
-  // Level 2 for TOF volumes
-  gMC->Gsatt("B071","seen", 0);
-  gMC->Gsatt("B074","seen", 0);
-  gMC->Gsatt("B075","seen", 0);
-  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
-  gMC->Gsatt("B080","seen", 0);  // B080 does not has sub-level                
-
-  // Level 2 of B071
-  gMC->Gsatt("B056","seen", 0);  // B056 does not has sub-levels  -
-  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
-  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
-  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
-  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
-
-  char name[16];
-  for (Int_t isec=0; isec<fTOFGeometry->NSectors(); isec++) {
-    sprintf(name, "BREF%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BREF%d sub-levels skipped   -
-    sprintf(name, "BTRD%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BTRD%d sub-levels skipped   -
-    sprintf(name, "BTOF%d",isec);
-    gMC->Gsatt(name,"seen",-2);  // all BTOF%d sub-levels skipped   -
-  }
-
-  gMC->Gdopt("hide", "on");
-  gMC->Gdopt("shad", "on");
-  gMC->Gsatt("*", "fill", 7);
-  gMC->SetClipBox(".");
-  gMC->SetClipBox("*", 100, 1000, 100, 1000, 100, 1000);
-  gMC->DefaultRange();
-  gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .018, .018);
-  gMC->Gdhead(1111, "Time Of Flight");
-  gMC->Gdman(18, 3, "MAN");
-  gMC->Gdopt("hide","off");
-}
-//_____________________________________________________________________________
-void AliTOFv6T0::DrawDetectorModules() const
-{
-  //
-  // Draw a shaded view of the TOF detector SuperModules version 5
-  //
-  // Set everything unseen
-  gMC->Gsatt("*", "seen", -1);
-
-  //
-  //Set volumes visible
-  // 
-
-  //Set ALIC mother transparent
-  gMC->Gsatt("ALIC","SEEN", 0);
-
-//=====> Level 1
-  // Level 1 for TOF volumes
-  gMC->Gsatt("B077","seen", 0);
-
-//=====> Level 2
-  // Level 2 for TOF volumes
-  gMC->Gsatt("B071","seen", 0);
-  gMC->Gsatt("B074","seen", 0);
-  gMC->Gsatt("B075","seen", 0);
-  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
-  gMC->Gsatt("B080","seen", 0);  // B080 does not has sub-level                
-
-  // Level 2 of B071
-  gMC->Gsatt("B056","seen", 0);  // B056 does not has sub-levels  -
-  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
-  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
-  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
-  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
-
-  char name[16];
-  for (Int_t isec=0; isec<fTOFGeometry->NSectors(); isec++) {
-    sprintf(name, "BREF%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BREF%d sub-levels skipped   -
-    sprintf(name, "BTRD%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BTRD%d sub-levels skipped   -
-    sprintf(name, "BTOF%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BTOF%d sub-levels skipped   -
-  }
-
-  // Level 3 of B071, B075 and B074
-  gMC->Gsatt("FTOA","seen",-2);  // all FTOA sub-levels skipped   -
-  if (fTOFHoles) gMC->Gsatt("FTOB","seen",-2);  // all FTOB sub-levels skipped   -
-  if (fTOFHoles) gMC->Gsatt("FTOC","seen",-2);  // all FTOC sub-levels skipped   -
-
-  // Level 3 of B071, B075 and B074
-  gMC->Gsatt("FAIA","seen",-1);  // all FAIA sub-levels skipped   -
-  gMC->Gsatt("FAIC","seen",-1);  // all FAIC sub-levels skipped   -
-  if (fTOFHoles) gMC->Gsatt("FAIB","seen",-1);  // all FAIB sub-levels skipped   -
-
-  // Level 3 of B071, B075 and B074
-  gMC->Gsatt("FPEA","seen",-2/*1*/);  // all FPEA sub-levels skipped   -
-  if (fTOFHoles) gMC->Gsatt("FPEB","seen",-2/*1*/);  // all FPEB sub-levels skipped   -
-
-  gMC->Gdopt("hide","on");
-  gMC->Gdopt("shad","on");
-  gMC->Gsatt("*", "fill", 5);
-  gMC->SetClipBox(".");
-  gMC->SetClipBox("*", 100, 1000, 100, 1000, 0, 1000);
-  gMC->DefaultRange();
-  gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .018, .018);
-  gMC->Gdhead(1111,"TOF detector");
-  gMC->Gdman(18, 3, "MAN");
-  gMC->Gdopt("hide","off");
-}                                 
-
-//_____________________________________________________________________________
-void AliTOFv6T0::DrawDetectorStrips() const
-{
-  //
-  // Draw a shaded view of the TOF strips for version 5
-  //
-
-  // Set everything unseen
-  gMC->Gsatt("*", "seen", -1);
-
-  //
-  //Set volumes visible
-  // 
-  
-  //Set ALIC mother transparent
-  gMC->Gsatt("ALIC","SEEN", 0);
-  
-//=====> Level 1
-  // Level 1 for TOF volumes
-  gMC->Gsatt("B077","seen", 0);
-
-//=====> Level 2
-  // Level 2 for TOF volumes
-  gMC->Gsatt("B071","seen", 0);
-  gMC->Gsatt("B074","seen", 0);
-  gMC->Gsatt("B075","seen", 0);
-  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
-  gMC->Gsatt("B080","seen", 0);  // B080 does not has sub-level                
-
-  // Level 2 of B071
-  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
-  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
-  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
-  gMC->Gsatt("B056","seen", 0);  // B056 does not has sub-levels  -
-  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
-
-  char name[16];
-  for (Int_t isec=0; isec<fTOFGeometry->NSectors(); isec++) {
-    sprintf(name, "BREF%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BREF%d sub-levels skipped   -
-    sprintf(name, "BTRD%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BTRD%d sub-levels skipped   -
-    sprintf(name, "BTOF%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BTOF%d sub-levels skipped   -
-  }
-
-  // Level 3 of B071, B074 and B075
-  gMC->Gsatt("FTOA","SEEN", 0);
-  if (fTOFHoles) gMC->Gsatt("FTOB","SEEN", 0);
-  if (fTOFHoles) gMC->Gsatt("FTOC","SEEN", 0);
-
-  // Level 4 of B071, B074 and B075
-  gMC->Gsatt("FLTA","SEEN", 0);
-  if (fTOFHoles) gMC->Gsatt("FLTB","SEEN", 0);
-  if (fTOFHoles) gMC->Gsatt("FLTC","SEEN", 0);
-
-  // Level 5 of B071, B074 and B075
-  gMC->Gsatt("FAIA","SEEN", 0);
-  gMC->Gsatt("FAIC","seen",-1);  // all FAIC sub-levels skipped   -
-  if (fTOFHoles) gMC->Gsatt("FAIB","SEEN", 0);
-
-  gMC->Gsatt("FPEA","SEEN", -2/*1*/);
-  if (fTOFHoles) gMC->Gsatt("FPEB","SEEN", -2/*1*/);
-
-  gMC->Gsatt("FSTR","SEEN",-2);  // all FSTR sub-levels skipped   -
-
-  gMC->Gsatt("FWZ1","SEEN", 1);
-  gMC->Gsatt("FWZ2","SEEN", 1);
-  gMC->Gsatt("FWZ3","SEEN", 1);
-  gMC->Gsatt("FWZ4","SEEN", 1);
-  if (fTOFHoles) {
-    gMC->Gsatt("FWZA","SEEN", 1);
-    gMC->Gsatt("FWZB","SEEN", 1);
-    gMC->Gsatt("FWZC","SEEN", 1);
-  }
-
-  // Level 2 of FAIA
-  // Level 2 of FAIB
-  // Level 2 of FAIC
-  gMC->Gsatt("FCA1","SEEN", 0);
-  gMC->Gsatt("FCA2","SEEN", 0);
-  gMC->Gsatt("FCAB","SEEN", 0);
-  gMC->Gsatt("FCAL","SEEN", 0);
-  gMC->Gsatt("FTUB","SEEN",-1);  // all FTUB sub-levels skipped   -
-  gMC->Gsatt("FTLN","SEEN", 0);
-  gMC->Gsatt("FLO1","SEEN", 0);
-  gMC->Gsatt("FLO2","SEEN", 0);
-  gMC->Gsatt("FLO3","SEEN", 0);
-  gMC->Gsatt("FCBL","SEEN", 0);
-  if (fTOFHoles) gMC->Gsatt("FCBB","SEEN", 0);
-  gMC->Gsatt("FSAW","SEEN", 0);
-  gMC->Gsatt("FCOV","SEEN", 0);
-  if (fTOFHoles) {
-    gMC->Gsatt("FCOB","SEEN", 0);
-    gMC->Gsatt("FCOP","SEEN", 0);
-  }
-
-  // Level 2 of FTUB
-  gMC->Gsatt("FITU","SEEN", 0);
-
-  // Level 2 of FSTR
-  gMC->Gsatt("FHON","SEEN", 1);
-  gMC->Gsatt("FPC1","SEEN", 1);
-  gMC->Gsatt("FPC2","SEEN", 1);
-  gMC->Gsatt("FPCB","SEEN", 1);
-  gMC->Gsatt("FRGL","SEEN", 1);
-  gMC->Gsatt("FGLF","SEEN", 1);
-
-  // Level 2 of FPCB => Level 3 of FSTR
-  gMC->Gsatt("FSEN","SEEN", 0);
-  gMC->Gsatt("FSEZ","SEEN", 0);
-  gMC->Gsatt("FPAD","SEEN", 1);
-
-  gMC->Gdopt("hide","on");
-  gMC->Gdopt("shad","on");
-  gMC->Gsatt("*", "fill", 5);
-  gMC->SetClipBox(".");
-  gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
-  gMC->DefaultRange();
-  gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .018, .018);
-  gMC->Gdhead(1111,"TOF Strips");
-  gMC->Gdman(18, 3, "MAN");
-  gMC->Gdopt("hide","off");
-}
-
 //_____________________________________________________________________________
 void AliTOFv6T0::CreateMaterials()
 {
@@ -2143,7 +1932,7 @@ void AliTOFv6T0::CreateMaterials()
 
   //AliTOF::CreateMaterials();
 
-  AliMagF *magneticField = (AliMagF*)gAlice->Field();
+  AliMagF *magneticField = (AliMagF*)((AliMagF*)TGeoGlobalMagField::Instance()->GetField());
 
   Int_t   isxfld = magneticField->Integ();
   Float_t sxmgmx = magneticField->Max();
@@ -2179,7 +1968,7 @@ void AliTOFv6T0::CreateMaterials()
   wmatg10[2]= we[2]*0.4;
   wmatg10[3]= we[3]*0.4;
   wmatg10[4]= we[4]*0.4;
-  AliDebug(1,Form("wg10  %d  %d  %d  %d  %d", wmatg10[0], wmatg10[1], wmatg10[2], wmatg10[3], wmatg10[4]));
+  AliDebug(1,Form("wg10  %f  %f  %f  %f  %f", wmatg10[0], wmatg10[1], wmatg10[2], wmatg10[3], wmatg10[4]));
   //Float_t densg10 = 1.7; //old value
   Float_t densg10 = 2.0; // (+17.8%)
 
@@ -2466,7 +2255,8 @@ void AliTOFv6T0::StepManager()
   }
 }
 //-------------------------------------------------------------------
-void AliTOFv6T0::MaterialMixer(Float_t* p,Float_t* a,Float_t* m,Int_t n) const
+void AliTOFv6T0::MaterialMixer(Float_t * p, const Float_t * const a,
+                              const Float_t * const m, Int_t n) const
 {
   // a[] atomic weights vector      (in)
   //     (atoms present in more compound appear separately)