]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New TOF geometry description (V5) -G. Cara Romeo and A. De Caro
authordecaro <decaro@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Dec 2005 08:55:33 +0000 (08:55 +0000)
committerdecaro <decaro@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Dec 2005 08:55:33 +0000 (08:55 +0000)
41 files changed:
TOF/AliTOF.cxx
TOF/AliTOF.h
TOF/AliTOFClusterFinder.cxx
TOF/AliTOFDDLRawData.cxx
TOF/AliTOFDDLRawData.h
TOF/AliTOFDigitMap.cxx
TOF/AliTOFDigitMap.h
TOF/AliTOFDigitizer.cxx
TOF/AliTOFGeometry.cxx
TOF/AliTOFGeometry.h
TOF/AliTOFGeometryV4.cxx [new file with mode: 0644]
TOF/AliTOFGeometryV4.h [new file with mode: 0644]
TOF/AliTOFGeometryV5.cxx [new file with mode: 0644]
TOF/AliTOFGeometryV5.h [new file with mode: 0644]
TOF/AliTOFHitMap.cxx
TOF/AliTOFHitMap.h
TOF/AliTOFRawStream.cxx
TOF/AliTOFRawStream.h
TOF/AliTOFReconstructor.cxx
TOF/AliTOFSDigit.cxx
TOF/AliTOFSDigit.h
TOF/AliTOFSDigitizer.cxx
TOF/AliTOFSDigitizer.h
TOF/AliTOFT0.cxx
TOF/AliTOFdigit.cxx
TOF/AliTOFdigit.h
TOF/AliTOFhitT0.h
TOF/AliTOFtrack.cxx
TOF/AliTOFtrack.h
TOF/AliTOFtracker.cxx
TOF/AliTOFtracker.h
TOF/AliTOFtrackerMI.cxx
TOF/AliTOFtrackerMI.h
TOF/AliTOFv4T0.cxx
TOF/AliTOFv4T0.h
TOF/AliTOFv5T0.cxx [new file with mode: 0644]
TOF/AliTOFv5T0.h [new file with mode: 0644]
TOF/TOFbaseLinkDef.h
TOF/TOFsimLinkDef.h
TOF/libTOFbase.pkg
TOF/libTOFsim.pkg

index dd9a84646fb52f273257ec554766e16625c7c07a..9fb4fe6459c5981f0a422046fa2b36b839d19a4c 100644 (file)
 //  This class contains the basic functions for the Time Of Flight           //
 //  detector. Functions specific to one particular geometry are              //
 //  contained in the derived classes                                         //
-//
-//  VERSIONE WITH 5 SYMMETRIC MODULES ALONG Z AXIS
-//  ==============================================
-//  
-//  VERSION WITH HOLES FOR PHOS AND TRD IN SPACEFRAME WITH HOLES
-//
-//  Volume sensibile : FPAD
-//
-//
-//
+//                                                                           //
+//  VERSIONE WITH 5 SYMMETRIC MODULES ALONG Z AXIS                           //
+//  ============================================================             //
+//                                                                           //
+//  VERSION WITH HOLES FOR PHOS AND TRD IN SPACEFRAME WITH HOLES             //
+//                                                                           //
+//  Volume sensibile : FPAD                                                  //
+//                                                                           //
+//                                                                           //
+//                                                                           //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
 // Begin_Html
 /*
 <img src="picts/AliTOFClass.gif">
 */
 //End_Html
-//             
-//
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
+
 
 
 #include <Riostream.h>
@@ -56,6 +55,7 @@
 #include <TTask.h>
 #include <TTree.h>
 #include <TVirtualMC.h>
+#include <TDirectory.h>
 
 #include "AliLog.h"
 #include "AliConfig.h"
@@ -66,6 +66,8 @@
 #include "AliRun.h"
 #include "AliTOF.h"
 #include "AliTOFGeometry.h"
+#include "AliTOFGeometryV4.h"
+#include "AliTOFGeometryV5.h"
 #include "AliTOFSDigit.h"
 #include "AliTOFdigit.h"
 #include "AliTOFhit.h"
@@ -112,12 +114,12 @@ AliTOF::AliTOF(const char *name, const char *title, Option_t *option)
   fDTask  = 0x0;
   fReTask = 0x0;
   fReconParticles= 0x0;
-  fTOFGeometry = 0;
+  fTOFGeometry = new AliTOFGeometry();
 
   if (strstr(option,"tzero")){
     fHits   = new TClonesArray("AliTOFhitT0",  1000);
     fTZero = kTRUE;
-    AliWarning("tzero option requires AliTOFv4T0 as TOF version (check Your Config.C)");
+    AliWarning("tzero option requires AliTOFv4T0/AliTOFv5T0 as TOF version (check Your Config.C)");
   }else{
     fHits   = new TClonesArray("AliTOFhit",  1000);
     fTZero = kFALSE;
@@ -275,7 +277,7 @@ void AliTOF::AddDigit(Int_t *tracks, Int_t *vol, Float_t *digits)
   new (ldigits[fNdigits++]) AliTOFdigit(tracks, vol, digits);
 }
 
-//___________________________________________
+//_____________________________________________________________________________
 void AliTOF::AddSDigit(Int_t tracknum, Int_t *vol, Float_t *digits)
 {
      
@@ -347,21 +349,30 @@ void AliTOF::CreateGeometry()
   */
   //End_Html
   //
-  const Double_t kPi=TMath::Pi();
-  const Double_t kDegrad=kPi/180.;
-  //
-  Float_t xTof, yTof, wall;
 
-  // frame inbetween TOF modules
-  wall = 4.;//cm
+  Float_t xTof, yTof;
+
+  if (IsVersion()==7) {
+
+    xTof = fTOFGeometry->StripLength();               // cm,  x-dimension of FTOA volume
+    yTof = fTOFGeometry->Rmax()-fTOFGeometry->Rmin(); // cm,  y-dimension of FTOA volume
+    Float_t zTof = fTOFGeometry->ZlenA();             // cm,  z-dimension of FTOA volume
+    
+    //  TOF module internal definitions
+    TOFpc(xTof, yTof, zTof, fTOFGeometry->ZlenB());
 
-  // Sizes of TOF module with its support etc..
-  xTof = 2.*(AliTOFGeometry::Rmin()*TMath::Tan(10*kDegrad)-wall/2-.5);
-  yTof = AliTOFGeometry::Rmax()-AliTOFGeometry::Rmin();
+  } else {
+
+    Float_t wall = 4.;//cm // frame inbetween TOF modules
+
+    // Sizes of TOF module with its support etc..
+    xTof = 2.*(fTOFGeometry->Rmin()*TMath::Tan(10.*kDegrad)-wall/2.-0.5);
+    yTof = fTOFGeometry->Rmax()-fTOFGeometry->Rmin();
+
+    //  TOF module internal definitions 
+    TOFpc(xTof, yTof, fTOFGeometry->ZlenC(), fTOFGeometry->ZlenB(), fTOFGeometry->ZlenA(), fTOFGeometry->MaxhZtof());
+  }
 
-//  TOF module internal definitions 
-  //TOFpc(xTof, yTof, fZlenC, fZlenB, fZlenA, AliTOFGeometry::MaxhZtof());
-  TOFpc(xTof, yTof, AliTOFGeometry::ZlenC(), AliTOFGeometry::ZlenB(), AliTOFGeometry::ZlenA(), AliTOFGeometry::MaxhZtof());
 }
 
 //_____________________________________________________________________________
@@ -399,156 +410,6 @@ void AliTOF::DrawModule() const
   gMC->Gdopt("hide","off");
 }
 
-//_____________________________________________________________________________
-void AliTOF::CreateMaterials()
-{
-  //
-  // Defines TOF materials for all versions
-  // Revision: F. Pierella 18-VI-2002
-  //
-
-  Int_t   isxfld = gAlice->Field()->Integ();
-  Float_t sxmgmx = gAlice->Field()->Max();
-  //
-  //--- Quartz (SiO2) to simulate float glass
-  //    density tuned to have correct float glass 
-  //    radiation length
-  Float_t   aq[2] = { 28.0855,15.9994 };
-  Float_t   zq[2] = { 14.,8. };
-  Float_t   wq[2] = { 1.,2. };
-  Float_t   dq = 2.55; // std value: 2.2
-  Int_t nq = -2;
-
-  // --- Freon C2F4H2 (TOF-TDR pagg.)
-  // Geant Manual CONS110-1, pag. 43 (Geant, Detector Description and Simulation Tool)
-  Float_t afre[3]  = {12.011,18.998,1.007};
-  Float_t zfre[3]  = { 6., 9., 1.}; 
-  Float_t wfre[3]  = { 2., 4., 2.};
-  Float_t densfre  = 0.00375;   
-// http://www.fi.infn.it/sezione/prevprot/gas/freon.html
-  Int_t nfre = -3; 
-/*
-  //-- Isobutane quencher C4H10 (5% in the sensitive mixture)
-  Float_t aiso[2]  = {12.011,1.007};
-  Float_t ziso[2]  = { 6.,  1.};
-  Float_t wiso[2]  = { 4., 10.};
-  Float_t densiso  = .......;  // (g/cm3) density
-  Int_t nfre = -2; // < 0 i.e. proportion by number of atoms of each kind
-  //-- SF6 (5% in the sensitive mixture)
-  Float_t asf[3]  = {32.066,18.998};
-  Float_t zsf[3]  = { 16., 9.};
-  Float_t wsf[3]  = {  1., 6.}; 
-  Float_t denssf  = .....;   // (g/cm3) density
-  Int_t nfre = -2; // < 0 i.e. proportion by number of atoms of each kind
-*/
-  // --- CO2 
-  Float_t ac[2]   = {12.,16.};
-  Float_t zc[2]   = { 6., 8.};
-  Float_t wc[2]   = { 1., 2.};
-  Float_t dc = .001977;
-  Int_t nc = -2;
-   // For mylar (C5H4O2) 
-  Float_t amy[3] = { 12., 1., 16. };
-  Float_t zmy[3] = {  6., 1.,  8. };
-  Float_t wmy[3] = {  5., 4.,  2. };
-  Float_t dmy    = 1.39;
-  Int_t nmy = -3;
- // For polyethilene (CH2) - honeycomb -
-  Float_t ape[2] = { 12., 1. };
-  Float_t zpe[2] = {  6., 1. };
-  Float_t wpe[2] = {  1., 2. };
-  Float_t dpe    = 0.935*0.479; //To have 1%X0 for 1cm as for honeycomb
-  Int_t npe = -2;
-  // --- G10 
-  Float_t ag10[4] = { 12.,1.,16.,28. };
-  Float_t zg10[4] = {  6.,1., 8.,14. };
-  Float_t wmatg10[4] = { .259,.288,.248,.205 };
-  Float_t densg10  = 1.7;
-  Int_t nlmatg10 = -4;
-
-  // plexiglass CH2=C(CH3)CO2CH3
-  Float_t aplex[3] = { 12.,1.,16.};
-  Float_t zplex[3] = {  6.,1., 8.};
-  Float_t wmatplex[3] = {5.,8.,2.};
-  Float_t densplex  =1.16;
-  Int_t nplex = -3;
-
-  // ---- ALUMINA (AL203) 
-  Float_t aal[2] = { 27.,16.};
-  Float_t zal[2] = { 13., 8.};
-  Float_t wmatal[2] = { 2.,3. };
-  Float_t densal  = 2.3;
-  Int_t nlmatal = -2;
-  // -- Water
-  Float_t awa[2] = {  1., 16. };
-  Float_t zwa[2] = {  1.,  8. };
-  Float_t wwa[2] = {  2.,  1. };
-  Float_t dwa    = 1.0;
-  Int_t nwa = -2;
-
-// stainless steel
-  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 };
-
-  //AliMaterial(0, "Vacuum$", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
-
-  // 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;
-
-  AliMixture( 1, "Air$", aAir, zAir, dAir, 4, wAir);
-
-  AliMaterial( 2, "Cu $",  63.54, 29.0, 8.96, 1.43, 14.8);
-  AliMaterial( 3, "C  $",  12.01,  6.0, 2.265,18.8, 74.4);
-  AliMixture ( 4, "Polyethilene$", ape, zpe, dpe, npe, wpe);
-  AliMixture ( 5, "G10$", ag10, zg10, densg10, nlmatg10, wmatg10);
-  AliMixture ( 6, "PLE$", aplex, zplex, densplex, nplex, wmatplex);
-  AliMixture ( 7, "CO2$", ac, zc, dc, nc, wc);
-  AliMixture ( 8, "ALUMINA$", aal, zal, densal, nlmatal, wmatal);
-  AliMaterial( 9, "Al $", 26.98, 13., 2.7, 8.9, 37.2);
-  AliMaterial(10, "C-TRD$", 12.01, 6., 2.265*18.8/69.282*15./100, 18.8, 74.4); // for 15%
-  AliMixture (11, "Mylar$",  amy, zmy, dmy, nmy, wmy);
-  AliMixture (12, "Freon$",  afre, zfre, densfre, nfre, wfre);
-  AliMixture (13, "Glass$", aq, zq, dq, nq, wq);
-  AliMixture (14, "Water$",  awa, zwa, dwa, nwa, wwa);
-  AliMixture (15, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel);
-
-  Float_t epsil, stmin, deemax, stemax;
-  //   Previous data
-  //       EPSIL  =  0.1   ! Tracking precision, 
-  //       STEMAX = 0.1      ! Maximum displacement for multiple scattering
-  //       DEEMAX = 0.1    ! Maximum fractional energy loss, DLS 
-  //       STMIN  = 0.1 
-  //
-  //   New data  
-  epsil  = .001;  // Tracking precision,
-  stemax = -1.;   // Maximum displacement for multiple scattering
-  deemax = -.3;   // Maximum fractional energy loss, DLS
-  stmin  = -.8;
-
-  AliMedium( 1, "Air$"  ,  1, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 2, "Cu $"  ,  2, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 3, "C  $"  ,  3, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 4, "Pol$"  ,  4, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 5, "G10$"  ,  5, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 6, "PLE$"  ,  6, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 7, "CO2$"  ,  7, 0, isxfld, sxmgmx, 10., -.01, -.1, .01, -.01);
-  AliMedium( 8,"ALUMINA$", 8, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 9,"Al Frame$",9, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(10, "DME-S$",  6, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(11, "C-TRD$", 10, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(12, "Myl$"  , 11, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(13, "Fre$"  , 12, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(14, "Fre-S$", 12, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(15, "Glass$", 13, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(16, "Water$", 14, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(17, "STEEL$", 15, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-}
-
 //_____________________________________________________________________________
 Int_t AliTOF::DistancetoPrimitive(Int_t , Int_t )
 {
@@ -590,12 +451,14 @@ void AliTOF::Init()
   //
   // Set id of TOF sensitive volume
   if (IsVersion() !=0) fIdSens=gMC->VolId("FPAD");
-  //
+
+  /*
   // Save the geometry
   TDirectory* saveDir = gDirectory;
   gAlice->GetRunLoader()->CdGAFile();
   fTOFGeometry->Write("TOFGeometry");
   saveDir->cd();
+  */
 }
 
 //____________________________________________________________________________
@@ -656,7 +519,7 @@ void AliTOF::Makehits(Bool_t hits)
 // default argument used, see AliTOF.h
 // Enable/Disable the writing of the TOF-hits branch 
 // on TreeH
-// by default : enabled for TOFv1, v2, v3, v4
+// by default :  enabled for TOFv1, v2, v3, v4, v5
 //              disabled for TOFv0
 // 
    if (hits &&  (IsVersion()!=0))
@@ -671,7 +534,7 @@ void AliTOF::FinishEvent()
 // do nothing
 }
 
-//---------------------------------------------------------------------
+//____________________________________________________________________________
 void AliTOF::Hits2SDigits()
 {
 //
@@ -688,7 +551,7 @@ void AliTOF::Hits2SDigits()
 
 }
 
-//---------------------------------------------------------------------
+//____________________________________________________________________________
 void AliTOF::Hits2SDigits(Int_t evNumber1, Int_t evNumber2)
 {
 //
@@ -727,50 +590,48 @@ Bool_t AliTOF::CheckOverlap(Int_t* vol, Float_t* digit,Int_t Track)
 // This procedure has to be optimized in the next TOF release.
 //
 
-        Bool_t overlap = kFALSE;
-        Int_t  vol2[5];
-
-        for (Int_t ndig=0; ndig<fSDigits->GetEntries(); ndig++){
-          AliTOFdigit* currentDigit = (AliTOFdigit*)(fSDigits->UncheckedAt(ndig));
-           currentDigit->GetLocation(vol2);
-           Bool_t idem= kTRUE;
-          // check on digit volume
-           for (Int_t i=0;i<=4;i++){
-              if (!idem) break;
-               if (vol[i]!=vol2[i]) idem=kFALSE;}
-
-           if (idem){  // same pad fired
-             Float_t tdc2 = digit[0];
-              Float_t tdc1 = currentDigit->GetTdc();
-
-             // we separate two digits on the same pad if
-             // they are separated in time by at least 25 ns
-             // remember that tdc time is given in ps
-
-              if (TMath::Abs(tdc1-tdc2)<25000){
-                 // in case of overlap we take the earliest
-                 if (tdc1>tdc2){
-                   currentDigit->SetTdc(tdc2); 
-                   currentDigit->SetAdc(digit[1]);
-                 }
-                 else {
-                  currentDigit->SetTdc(tdc1);
-                  currentDigit->SetAdc(digit[1]);
-                 }
-                  currentDigit->AddTrack(Track); // add track number in the track array
-                  overlap = kTRUE;
-                 return overlap;
-              } else 
+  Bool_t overlap = kFALSE;
+  Int_t  vol2[5];
+
+  for (Int_t ndig=0; ndig<fSDigits->GetEntries(); ndig++){
+    AliTOFdigit* currentDigit = (AliTOFdigit*)(fSDigits->UncheckedAt(ndig));
+    currentDigit->GetLocation(vol2);
+    Bool_t idem= kTRUE;
+    // check on digit volume
+    for (Int_t i=0;i<=4;i++){
+      if (!idem) break;
+      if (vol[i]!=vol2[i]) idem=kFALSE;}
+
+    if (idem){  // same pad fired
+      Float_t tdc2 = digit[0];
+      Float_t tdc1 = currentDigit->GetTdc();
+
+      // we separate two digits on the same pad if
+      // they are separated in time by at least 25 ns
+      // remember that tdc time is given in ps
+
+      if (TMath::Abs(tdc1-tdc2)<25000){
+       // in case of overlap we take the earliest
+       if (tdc1>tdc2){
+         currentDigit->SetTdc(tdc2); 
+         currentDigit->SetAdc(digit[1]);
+       }
+       else {
+         currentDigit->SetTdc(tdc1);
+         currentDigit->SetAdc(digit[1]);
+       }
+       currentDigit->AddTrack(Track); // add track number in the track array
+       overlap = kTRUE;
+       return overlap;
+      } else 
                overlap= kFALSE;
 
-           } // close if (idem) -> two digits on the same TOF pad
+    } // close if (idem) -> two digits on the same TOF pad
 
-        } // end loop on existing sdigits
+  } // end loop on existing sdigits
 
-        return overlap;
+  return overlap;
 }
-
-
 //____________________________________________________________________________
 void AliTOF::Digits2Raw()
 {
@@ -786,7 +647,14 @@ void AliTOF::Digits2Raw()
     return;
   }
   
-  AliTOFDDLRawData rawWriter;
+  //AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read");
+  fRunLoader->CdGAFile();
+  TFile *in=(TFile*)gFile;
+  in->cd();
+  AliTOFGeometry *geometry  = (AliTOFGeometry*)in->Get("TOFgeometry");
+
+  AliTOFDDLRawData rawWriter(geometry);
+  //AliTOFDDLRawData rawWriter;
   rawWriter.SetVerbose(0);
   
   AliInfo("Formatting raw data for TOF");
@@ -796,7 +664,8 @@ void AliTOF::Digits2Raw()
   fLoader->UnloadDigits();
   
 }
-////////////////////////////////////////////////////////////////////////
+
+//____________________________________________________________________________
 void AliTOF::RecreateSDigitsArray() {
 //
 // delete TClonesArray fSDigits and create it again
@@ -805,7 +674,7 @@ void AliTOF::RecreateSDigitsArray() {
   delete fSDigits;
   fSDigits       = new TClonesArray("AliTOFSDigit",  1000);
 }
-////////////////////////////////////////////////////////////////////////
+//____________________________________________________________________________
 void AliTOF::CreateSDigitsArray() {
 //
 // create TClonesArray fSDigits
@@ -813,4 +682,3 @@ void AliTOF::CreateSDigitsArray() {
 //
   fSDigits       = new TClonesArray("AliTOFSDigit",  1000);
 }
-
index 6e2ae84ad4d3acb5ec8190f14599af25f7ff2ef1..386d12c2d2ca672504169f545489063144206004 100644 (file)
@@ -31,7 +31,6 @@ class TFolder ;
 #include "AliTOFSDigitizer.h"
 #include "AliTOFGeometry.h"
 
-
 class AliTOF : public AliDetector {
 public:
   AliTOF(); 
@@ -48,7 +47,7 @@ public:
   virtual void    AddDigit(Int_t* tracks, Int_t* vol, Float_t* digits);
   virtual void    AddSDigit(Int_t tracknum, Int_t* vol, Float_t* digits);
   virtual void    CreateGeometry();
-  virtual void    CreateMaterials();
+  virtual void    CreateMaterials(){};
   virtual void    Init();
   //virtual void    MakeBranch(Option_t* option, const char *file=0);
   virtual void    MakeBranch(Option_t *opt=" ");
@@ -58,7 +57,9 @@ public:
   Int_t           DistancetoPrimitive(Int_t px, Int_t py);
   virtual void    StepManager()=0;
   virtual void    TOFpc(Float_t /*xtof*/, Float_t /*ytof*/, Float_t /*zlenC*/,
-                        Float_t /*zlenB*/, Float_t /*zlenA*/, Float_t /*ztof0*/){}
+                        Float_t /*zlenB*/, Float_t /*zlenA*/, Float_t /*ztof0*/){};
+  virtual void    TOFpc(Float_t /*xtof*/,  Float_t /*ytof*/, Float_t /*zlenA*/,
+                       Float_t /*zlenB*/){};
   virtual void    DrawModule() const;
   virtual void    DrawDetectorModules()=0;
   virtual void    DrawDetectorStrips()=0;
index acbb80497cff02a1b37a8865fc38f3783877638b..d9324bc198e26a6cfc90a661276ca765bcc8efca 100644 (file)
@@ -62,6 +62,8 @@ Revision 0.01  2005/07/25 A. De Caro
 #include "AliTOFdigit.h"
 #include "AliTOFcluster.h"
 #include "AliTOFGeometry.h"
+#include "AliTOFGeometryV4.h"
+#include "AliTOFGeometryV5.h"
 #include "AliTOFRawStream.h"
 
 #include "AliTOFClusterFinder.h"
@@ -99,7 +101,10 @@ AliTOFClusterFinder::AliTOFClusterFinder(AliRunLoader* runLoader):
 // Constructor
 //
 
-  fTOFGeometry = new AliTOFGeometry();
+  runLoader->CdGAFile();
+  TFile *in=(TFile*)gFile;
+  in->cd();
+  fTOFGeometry = (AliTOFGeometry*)in->Get("TOFgeometry");
 
 }
 //______________________________________________________________________________
index ab20eb09563b64fcdbf361e1e9e863a8e1020ff3..2702aded3321185edb95c9cf283bd0ee937d6fce 100644 (file)
@@ -44,6 +44,8 @@ Revision 0.01  2004/6/11 A.De Caro, S.B.Sellitto, R.Silvestri
 #include "AliBitPacking.h"
 
 #include "AliTOFGeometry.h"
+#include "AliTOFGeometryV4.h"
+#include "AliTOFGeometryV5.h"
 #include "AliTOFdigit.h"
 #include "AliTOFRawStream.h"
 #include "AliTOFDDLRawData.h"
@@ -56,6 +58,16 @@ AliTOFDDLRawData::AliTOFDDLRawData()
   //Default constructor
   fIndex=-1;
   fVerbose=0;
+  fTOFgeometry = 0;
+}
+
+//----------------------------------------------------------------------------------------
+AliTOFDDLRawData::AliTOFDDLRawData(AliTOFGeometry *tofGeom)
+{
+  //Constructor
+  fIndex=-1;
+  fVerbose=0;
+  fTOFgeometry = tofGeom;
 }
 
 //----------------------------------------------------------------------------------------
@@ -65,6 +77,7 @@ AliTOFDDLRawData::AliTOFDDLRawData(const AliTOFDDLRawData &source) :
   //Copy Constructor
   this->fIndex=source.fIndex;
   this->fVerbose=source.fVerbose;
+  this->fTOFgeometry=source.fTOFgeometry;
   return;
 }
 
@@ -74,6 +87,7 @@ AliTOFDDLRawData& AliTOFDDLRawData::operator=(const AliTOFDDLRawData &source){
   //Assigment operator
   this->fIndex=source.fIndex;
   this->fVerbose=source.fVerbose;
+  this->fTOFgeometry=source.fTOFgeometry;
   return *this;
 }
 
@@ -84,7 +98,7 @@ void AliTOFDDLRawData::GetDigits(TClonesArray *TOFdigits,Int_t nDDL,UInt_t *buf)
 
   //This method packs the TOF digits in a proper 32 bits structure
 
-  Int_t iDDL    = nDDL%AliTOFGeometry::NDDL();//(Int_t)((nDDL/4.-(Int_t)(nDDL/4.))*4);
+  Int_t iDDL    = nDDL%AliTOFGeometry::NDDL();
   Int_t iSector = (Int_t)((Float_t)nDDL/AliTOFGeometry::NDDL());
   Int_t iTRM = 0;
   Int_t iTDC = 0;
@@ -118,7 +132,7 @@ void AliTOFDDLRawData::GetDigits(TClonesArray *TOFdigits,Int_t nDDL,UInt_t *buf)
     strip  = digs->GetStrip();  // Strip Number (0-14/18/19)
     padx   = digs->GetPadx();   // Pad Number in x direction (0-47)
     padz   = digs->GetPadz();   // Pad Number in z direction (0-1)
-    eureka = digs->GetTotPad(); // Global Pad Number inside a Sector
+    eureka = digs->GetTotPad(fTOFgeometry); // Global Pad Number inside a Sector
     totCharge = (Int_t)digs->GetAdc();
     timeOfFlight = (Int_t)digs->GetTdc();
 
@@ -151,7 +165,6 @@ void AliTOFDDLRawData::GetDigits(TClonesArray *TOFdigits,Int_t nDDL,UInt_t *buf)
 
     if (fVerbose==2) ftxt << "DDL: "<<nDDL<<" TRM: "<<iTRM<<" TDC: "<<iTDC<<" Channel: "<<iCH<<" totCharge: "<<totCharge<<" tof: "<<timeOfFlight<<endl;
 
-    //AliInfo(Form("%2i %2i %2i %2i   %2i %2i %2i %2i %2i %7i %8i",nDDL,iTRM,iTDC,iCH,sector,plate,strip,padz,padx,totCharge,timeOfFlight));
     AliDebug(2,Form("%2i %2i %2i %2i   %2i %2i %2i %2i %2i %7i %8i",nDDL,iTRM,iTDC,iCH,sector,plate,strip,padz,padx,totCharge,timeOfFlight));
     
     baseWord=0;
index 8921500587e144817e99710146436b351de4848d..52556fb070de7e682d7bff13c58c01288b120644 100644 (file)
 #define AliTOFDDLRAWDATA_H
 
 class AliTOF;
+class AliTOFGeometry;
 class TTree;
 
 class AliTOFDDLRawData:public TObject{
  public:
   AliTOFDDLRawData();                               // default constructor
+  AliTOFDDLRawData(AliTOFGeometry *tofGeom);        // constructor
   virtual ~AliTOFDDLRawData(){;}                    // destructor
   AliTOFDDLRawData(const AliTOFDDLRawData &source); // copy constructor
   AliTOFDDLRawData& operator=(const AliTOFDDLRawData &source); // ass. op.
@@ -26,8 +28,10 @@ class AliTOFDDLRawData:public TObject{
   void  GetDigits(TClonesArray *TOFdigits, Int_t ddl,UInt_t *buf);
   //This method formats and stores in buf all the digits of a TOF module
 
-  Int_t fVerbose;            //Verbose level (0:no msg, 1:msg, 2:digits in txt files)
-  Int_t fIndex;              //number of 32 words to be stored into the output file
+  Int_t fVerbose;               //Verbose level (0:no msg, 1:msg, 2:digits in txt files)
+  Int_t fIndex;                 //number of 32 words to be stored into the output file
+  AliTOFGeometry *fTOFgeometry; //
+
   ClassDef(AliTOFDDLRawData,1)
 
 };
index cb7f71f4457e8f1b557589dd5742cb0cefa45330..8fd5b16a9bdbe794386b60272a60212f7b1f76bb 100644 (file)
@@ -51,10 +51,13 @@ AliTOFDigitMap::AliTOFDigitMap()
 //
   fDigitMap = 0;
   fDigits = 0;
+
+  fTOFGeometry = new AliTOFGeometry();
+
 }
 
 ////////////////////////////////////////////////////////////////////////
-AliTOFDigitMap::AliTOFDigitMap(TClonesArray *dig)
+AliTOFDigitMap::AliTOFDigitMap(TClonesArray *dig, AliTOFGeometry *tofGeom)
 {
   //
   // ctor
@@ -62,9 +65,11 @@ AliTOFDigitMap::AliTOFDigitMap(TClonesArray *dig)
   // of course, these constants must not be hardwired
   // change later
   
+  fTOFGeometry = tofGeom;
+
   fNSector = AliTOFGeometry::NSectors();
   fNplate = AliTOFGeometry::NPlates();
-  fNstrip = AliTOFGeometry::NStripC();
+  fNstrip = fTOFGeometry->NMaxNstrip();
   fNpx  = AliTOFGeometry::NpadX();
   fNpz  = AliTOFGeometry::NpadZ();
   fMaxIndex=fNSector*fNplate*fNstrip*fNpx*fNpz;
@@ -80,7 +85,8 @@ AliTOFDigitMap::AliTOFDigitMap(const AliTOFDigitMap & /*digitMap*/)
 //
 // Dummy copy constructor
 //
-    ;
+  ;
+
 }
 
  
@@ -90,7 +96,10 @@ AliTOFDigitMap::~AliTOFDigitMap()
 //
 // Destructor
 //
-    if (fDigitMap) delete[] fDigitMap;
+  if (fDigitMap) delete[] fDigitMap;
+
+  delete fTOFGeometry;
+
 }
 
 ////////////////////////////////////////////////////////////////////////
@@ -109,11 +118,11 @@ Int_t AliTOFDigitMap::CheckedIndex(Int_t *vol) const
 // Return checked indices for vol
 //
   Int_t index=
-    (vol[0]/*-1*/)*fNplate*fNstrip*fNpx*fNpz+             // sector
-    (vol[1]/*-1*/)*fNstrip*fNpx*fNpz+                     // plate
-    (vol[2]/*-1*/)*fNpx*fNpz+                             // strip
-    (vol[3]/*-1*/)*fNpz+                                  // padx
-    (vol[4]/*-1*/);                                       // padz
+    vol[0]*fNplate*fNstrip*fNpx*fNpz+             // sector
+    vol[1]*fNstrip*fNpx*fNpz+                     // plate
+    vol[2]*fNpx*fNpz+                             // strip
+    vol[3]*fNpz+                                  // padx
+    vol[4];                                       // padz
 
     if (index >= fMaxIndex) {
       Error("AliTOFDigitMap","CheckedIndex - input outside bounds");
@@ -188,8 +197,3 @@ AliTOFDigitMap & AliTOFDigitMap::operator = (const AliTOFDigitMap & /*rhs*/)
 // Dummy assignment operator
     return *this;
 }
-
-
-
-
-
index 38a950e195c823ff076b1fc294dde1df87508d5f..a42ab297714cf166f7c93f994fb42bd08082a7a1 100644 (file)
 #include "AliHitMap.h"
 #include "TObject.h"
 #include "AliTOFGeometry.h"
+
 class TClonesArray;
+class AliTOFGeometry;
 
 class AliTOFDigitMap : public TObject
 {
  public:
     AliTOFDigitMap();
-    AliTOFDigitMap(TClonesArray *dig);
+    AliTOFDigitMap(TClonesArray *dig, AliTOFGeometry *tofGeom);
     AliTOFDigitMap(const AliTOFDigitMap & digitMap);
     
     virtual ~AliTOFDigitMap();
@@ -52,9 +54,11 @@ class AliTOFDigitMap : public TObject
     Int_t fNpx;                           // Number of pads in x
     Int_t fNpz;                           // Number of pads in z
 
-    TClonesArray *fDigits;               // Pointer to sdigits
+    TClonesArray *fDigits;                // Pointer to sdigits
     Int_t fMaxIndex;                      // maximum index in hit map
-    Int_t *fDigitMap;                       // ! [fMaxIndex]         
+    Int_t *fDigitMap;                     // ! [fMaxIndex]         
+
+    AliTOFGeometry *fTOFGeometry;
 
     ClassDef(AliTOFDigitMap,0) // Implements DigitMap as a 1-dim array
 };
index 70d2fb62dc2790081cbcfb6fddfa8e758636f2db..5c54a3e1df01961ef3339608371cd79afab1f984 100644 (file)
@@ -23,6 +23,9 @@
 // -- Author :  F. Pierella (Bologna University) pierella@bo.infn.it
 //////////////////////////////////////////////////////////////////////////////
 
+#include <stdlib.h>
+#include <Riostream.h>
+
 #include <TTree.h> 
 #include <TVector.h>
 #include <TObjArray.h>
 #include <TDirectory.h>
 #include <TRandom.h>
 
+#include "AliLog.h"
+#include "AliRun.h"
+#include "AliRunLoader.h"
+#include "AliLoader.h"
+#include "AliDigitizer.h"
+#include "AliRunDigitizer.h"
+#include "AliPDG.h"
 
 #include "AliTOFDigitizer.h"
 #include "AliTOF.h"
 #include "AliTOFdigit.h"
 #include "AliTOFSDigit.h"
 #include "AliTOFHitMap.h"
-#include "AliDigitizer.h"
-#include "AliRunDigitizer.h"
-
-#include "AliLog.h"
-#include "AliRun.h"
-#include "AliRunLoader.h"
-#include "AliLoader.h"
-#include "AliPDG.h"
-
-#include <stdlib.h>
-#include <Riostream.h>
 
 ClassImp(AliTOFDigitizer)
 
@@ -109,6 +108,22 @@ void AliTOFDigitizer::Exec(Option_t* /*option*/)
      return;
    }
    
+  outrl->CdGAFile();
+  TFile *in=(TFile*)gFile;
+  TDirectory *savedir=gDirectory;
+
+  AliTOFGeometry *tofGeometry;
+  if (!in->IsOpen()) {
+    AliWarning("Geometry file is not open default  TOF geometry will be used");
+    tofGeometry = new AliTOFGeometry();
+  }
+  else {
+    in->cd();
+    tofGeometry = (AliTOFGeometry*)in->Get("TOFgeometry");
+  }
+
+  savedir->cd();
+
   AliLoader* outgime = outrl->GetLoader("TOFLoader");
   if (outgime == 0x0)
    {
@@ -129,7 +144,7 @@ void AliTOFDigitizer::Exec(Option_t* /*option*/)
   fSDigitsArray=new TClonesArray("AliTOFSDigit",1000);
   
   // create hit map (to be created in Init())
-  fhitMap = new AliTOFHitMap(fSDigitsArray);
+  fhitMap = new AliTOFHitMap(fSDigitsArray, tofGeometry);
   
   // Loop over files to digitize
 
@@ -181,7 +196,7 @@ void AliTOFDigitizer::CreateDigits()
     // TOF sdigit volumes (always the same for all slots)
     Int_t sector    = tofsdigit->GetSector(); // range [0-17]
     Int_t plate     = tofsdigit->GetPlate();  // range [0- 4]
-    Int_t strip     = tofsdigit->GetStrip();  // range [0-19]
+    Int_t strip     = tofsdigit->GetStrip();  // range [0-14/18/19]
     Int_t padz      = tofsdigit->GetPadz();   // range [0- 1]
     Int_t padx      = tofsdigit->GetPadx();   // range [0-47]
     
@@ -196,7 +211,8 @@ void AliTOFDigitizer::CreateDigits()
     Bool_t isSDigitBad = (sector<0 || sector>17 || plate<0 || plate >4 || padz<0 || padz>1 || padx<0 || padx>47);
     
     if (isSDigitBad) {
-      AliFatal("strange sdigit found");
+      //AliFatal("strange sdigit found");
+      AliFatal(Form("strange sdigit found   %3i  %2i  %2i  %3i    %3i", sector, plate, padz, padx, strip));
     }
     //-------------------------------------------------------
     
index 961cfe3a94d8ab6ba09f1f104f17fc89be10ee87..5e70406d788d00dda854083cc8b161505381c00e 100644 (file)
 
 /*
 $Log$
+Revision 1.9.1  2005/07/19 A. De Caro
+        Created daughter-classes AliTOFGeometryV4 and AliTOFGeometryV5
+       => moved global methods IsInsideThePad, DistanceToPad,
+       GetPlate, GetSector, GetStrip, GetPadX, GetPadZ,
+       GetX, GetY, GetZ, GetPadDx, GetPadDy and GetPadDz
+       in daughter-classes
+
+Revision 1.9  2005/10/20 12:41:35  hristov
+Implementation of parallel tracking. It is not the default version, one can use it passing option MI from AliReconstruction to TOF (M.Ivanov)
+
 Revision 1.8  2004/11/29 08:28:01  decaro
 Introduction of a new TOF constant (i.e. TDC bin width)
 
@@ -68,36 +78,13 @@ ClassImp(AliTOFGeometry)
 
 const Int_t AliTOFGeometry::fgkTimeDiff   = 25000;  // Min signal separation (ps)
 
-const Float_t AliTOFGeometry::fgkxTOF     = 371.;   // Inner radius of the TOF for Reconstruction (cm)
-const Float_t AliTOFGeometry::fgkRmin     = 370.;   // Inner radius of the TOF (cm)
-const Float_t AliTOFGeometry::fgkRmax     = 399;    // Outer radius of the TOF (cm)
-const Float_t AliTOFGeometry::fgkZlenA    = 106.0;  // length (cm) of the A module
-const Float_t AliTOFGeometry::fgkZlenB    = 141.0;  // length (cm) of the B module
-const Float_t AliTOFGeometry::fgkZlenC    = 177.5;  // length (cm) of the C module
 const Float_t AliTOFGeometry::fgkXPad     = 2.5;    // Pad size in the x direction (cm)
 const Float_t AliTOFGeometry::fgkZPad     = 3.5;    // Pad size in the z direction (cm)
-const Float_t AliTOFGeometry::fgkMaxhZtof = 371.5;  // Max half z-size of TOF (cm)
-const Float_t AliTOFGeometry::fgkStripLength = 122.;// Strip Length (rho X phi direction) (cm)
-const Float_t AliTOFGeometry::fgkDeadBndX = 1.0;    // Dead Boundaries of a Strip along X direction (length) (cm)
-const Float_t AliTOFGeometry::fgkDeadBndZ = 1.5;    // Dead Boundaries of a Strip along Z direction (width) (cm)
-const Float_t AliTOFGeometry::fgkOverSpc = 15.3;    // Space available for sensitive layers in radial direction (cm)
 
-
-const Float_t AliTOFGeometry::fgkSigmaForTail1= 2.;//Sig1 for simulation of TDC tails 
+const Float_t AliTOFGeometry::fgkSigmaForTail1= 2.; //Sig1 for simulation of TDC tails 
 const Float_t AliTOFGeometry::fgkSigmaForTail2= 0.5;//Sig2 for simulation of TDC tails
-const Float_t AliTOFGeometry::fgkSpeedOfLight = 0.299792458;// c (10^9 m/s)
-const Float_t AliTOFGeometry::fgkPionMass     = 0.13957;// pion mass (Gev/c^2)
-const Float_t AliTOFGeometry::fgkKaonMass     = 0.49368;// kaon mass (Gev/c^2)
-const Float_t AliTOFGeometry::fgkProtonMass   = 0.93827;// proton mass (Gev/c^2)
-const Float_t AliTOFGeometry::fgkElectronMass = 0.00051;// electron mass (Gev/c^2)
-const Float_t AliTOFGeometry::fgkMuonMass     = 0.10566;// muon mass (Gev/c^2)
-
 
-const Float_t AliTOFGeometry::fgkDprecMin = 0.0000075;//num.prec.tolerance on Thmin 
-const Float_t AliTOFGeometry::fgkDprecMax = 0.0000100;//num.prec.tolerance on Thma 
-const Float_t AliTOFGeometry::fgkDprecCen = 0.0000005;//num.prec.tolerance on <Theta> 
-
-const Float_t AliTOFGeometry::fgkTdcBin = 24.4; // time-window for the TDC bins [ps]
+const Float_t AliTOFGeometry::fgkTdcBin = 24.4;     // time-window for the TDC bins [ps]
 
 //_____________________________________________________________________________
 AliTOFGeometry::AliTOFGeometry()
@@ -105,6 +92,19 @@ AliTOFGeometry::AliTOFGeometry()
   //
   // AliTOFGeometry default constructor
   //
+
+  kNStripC     = 19;  // number of strips in C type module 
+  kMaxNstrip   = 19;  // Max. number of strips 
+  kZlenA    = 106.0;  // length (cm) of the A module
+  kZlenB    = 141.0;  // length (cm) of the B module
+  kZlenC    = 177.5;  // length (cm) of the C module
+  kMaxhZtof = 371.5;  // Max half z-size of TOF (cm)
+  kStripLength = 124.;// Strip Length (rho X phi direction) (cm)
+
+  fgkxTOF     = 371.-0.01;   // Inner radius of the TOF for Reconstruction (cm)
+  fgkRmin     = 370.-0.01;   // Inner radius of the TOF (cm)
+  fgkRmax     = 399.-0.01;   // Outer radius of the TOF (cm)
+
   Init();
 
 }
@@ -123,181 +123,8 @@ void AliTOFGeometry::Init()
   //
   // Initialize strip Tilt Angles and Heights
   //
-  // Strips Tilt Angles
  
-  Float_t const kangles[kNPlates][kMaxNstrip] ={
-
- {44.494, 43.725, 42.946, 42.156, 41.357, 40.548, 39.729, 38.899, 
-  38.060, 37.211, 36.353, 35.484, 34.606, 33.719, 32.822, 31.916, 
-  31.001, 30.077, 29.144, 28.202 },
-
- {26.884, 25.922, 24.952, 23.975, 22.989, 22.320, 21.016, 20.309,
-  19.015, 18.270, 16.989, 16.205, 14.941, 14.117, 12.871, 12.008,
-  10.784, 9.8807, 8.681, 0.0 },
-
- { 7.5835, 6.4124, 5.4058, 4.2809, 3.2448,  2.1424, 1.078, -0., -1.078, 
-  -2.1424, -3.2448, -4.2809, -5.4058, -6.4124, -7.5835, 0.0, 0.0, 0.0,
-  0.0, 0.0 },
-  
- {-8.681, -9.8807, -10.784, -12.008, -12.871, -14.117, -14.941, -16.205,
-  -16.989, -18.27, -19.015, -20.309, -21.016, -22.32, -22.989,
-   -23.975, -24.952, -25.922, -26.884, 0. },
-  
- {-28.202, -29.144, -30.077, -31.001, -31.916, -32.822, -33.719, -34.606,
-  -35.484, -36.353, -37.211, -38.06, -38.899, -39.729, -40.548,
-   -41.357, -42.156, -42.946, -43.725, -44.494 }};
-
-
-  //Strips Heights
-
-   Float_t const kheights[kNPlates][kMaxNstrip]= {
-
-  {-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5,
-   -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5 },
-  
-  {-6.3, -7.1, -7.9, -8.7, -9.5, -3, -9.5,   -3, -9.5,   -3, 
-   -9.5, -3.0, -9.5, -3.0, -9.5, -3, -9.5,   -3,   -9 , 0.},
-  
-  {  -3,   -9, -4.5,   -9, -4.5,     -9, -4.5,   -9, -4.5,   -9, 
-     -4.5,   -9, -4.5,   -9,   -3,   0.0, 0.0, 0.0, 0.0, 0.0 },
-  
-  {  -9,   -3, -9.5,   -3, -9.5, -3, -9.5,   -3, -9.5,   -3, -9.5,
-     -3, -9.5,   -3, -9.5,  -8.7, -7.9, -7.1, -6.3, 0. },
-  
-  {-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5,
-   -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5 }};
-
-
-   // Deposit in fAngles, fHeights
-
-  for (Int_t iplate = 0; iplate < kNPlates; iplate++) {
-    for (Int_t istrip = 0; istrip < kMaxNstrip; istrip++) {
-      fAngles[iplate][istrip]   = kangles[iplate][istrip];
-      fHeights[iplate][istrip]  = kheights[iplate][istrip];
-    }
-  }
-
   fPhiSec   = 360./kNSectors;
-}
-
-
-
-
-//_____________________________________________________________________________
-Float_t AliTOFGeometry::DistanceToPad(Int_t *det, Float_t *pos, Float_t *dist3d) 
-{
-//
-// Returns distance of  space point with coor pos (x,y,z) (cm) wrt 
-// pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) 
-//
-    
-  //Transform pos into Sector Frame
-
-  Float_t x = pos[0];
-  Float_t y = pos[1];
-  Float_t z = pos[2];
-
-  Float_t radius = TMath::Sqrt(x*x+y*y);
-  Float_t phi=TMath::ATan2(y,x);       
-  if(phi<0) phi=2.*TMath::Pi()+phi;
-  //  Get the local angle in the sector philoc
-  Float_t angle   = phi*kRaddeg-( Int_t (kRaddeg*phi/20.) + 0.5)*fPhiSec;
-  Float_t xs = radius*TMath::Cos(angle/kRaddeg);
-  Float_t ys = radius*TMath::Sin(angle/kRaddeg);
-  Float_t zs = z;
-
-  // Do the same for the selected pad
-
-  Float_t g[3];
-  GetPos(det,g);
-
-  Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
-  Float_t padPhi=TMath::ATan2(g[1],g[0]);      
-  if(padPhi<0) padPhi=2.*TMath::Pi()+padPhi;
-  //  Get the local angle in the sector philoc
-  Float_t padAngle   = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/20.)+ 0.5) * fPhiSec; 
-  Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
-  Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
-  Float_t padzs = g[2];
-  
-  //Now move to local pad coordinate frame. Translate:
-  
-  Float_t xt = xs-padxs;
-  Float_t yt = ys-padys;
-  Float_t zt = zs-padzs;
-  //Now Rotate:
-  
-  Float_t alpha = GetAngles(det[1],det[2]);
-  Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
-  Float_t yr = yt;
-  Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
-
-  Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
-  if (dist3d){
-    dist3d[0] = xr;
-    dist3d[1] = yr;
-    dist3d[2] = zr;
-  }
-  return dist;
-
-}
-
-
-//_____________________________________________________________________________
-Bool_t AliTOFGeometry::IsInsideThePad(Int_t *det, Float_t *pos) 
-{
-//
-// Returns true if space point with coor pos (x,y,z) (cm) falls 
-// inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) 
-//
-
-  Bool_t isInside=false; 
-
-    
-  //Transform pos into Sector Frame
-
-  Float_t x = pos[0];
-  Float_t y = pos[1];
-  Float_t z = pos[2];
-
-  Float_t radius = TMath::Sqrt(x*x+y*y);
-  Float_t phi=TMath::ATan2(y,x);       
-  if(phi<0) phi=2.*TMath::Pi()+phi;
-  //  Get the local angle in the sector philoc
-  Float_t angle   = phi*kRaddeg-( Int_t (kRaddeg*phi/20.) + 0.5) *fPhiSec;
-  Float_t xs = radius*TMath::Cos(angle/kRaddeg);
-  Float_t ys = radius*TMath::Sin(angle/kRaddeg);
-  Float_t zs = z;
-
-  // Do the same for the selected pad
-
-  Float_t g[3];
-  GetPos(det,g);
-
-  Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
-  Float_t padPhi=TMath::ATan2(g[1],g[0]);      
-  if(padPhi<0) padPhi=2.*TMath::Pi()+padPhi;
-  //  Get the local angle in the sector philoc
-  Float_t padAngle   = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/20.)+ 0.5) * fPhiSec; 
-  Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
-  Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
-  Float_t padzs = g[2];
-  
-  //Now move to local pad coordinate frame. Translate:
-  
-  Float_t xt = xs-padxs;
-  Float_t yt = ys-padys;
-  Float_t zt = zs-padzs;
-  //Now Rotate:
-  
-  Float_t alpha = GetAngles(det[1],det[2]);
-  Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
-  Float_t yr = yt;
-  Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
-
-  if(TMath::Abs(xr)<=0.75 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
-    isInside=true; 
-  return isInside;
 
 }
 
@@ -330,398 +157,3 @@ void AliTOFGeometry::GetDetID( Float_t *pos, Int_t *det)
   
 }
 //_____________________________________________________________________________
-Float_t AliTOFGeometry::GetX(Int_t *det) 
-{
-  //
-  // Returns X coordinate (cm)
-  //
-
-  Int_t isector = det[0];
-  Int_t iplate  = det[1];
-  Int_t istrip  = det[2];
-  Int_t ipadz   = det[3];
-  Int_t ipadx   = det[4];
-
-  // Find out distance d on the plane wrt median phi:
-  Float_t d = (ipadx+0.5)*fgkXPad-(kNpadX*fgkXPad)*0.5;
-
-  // The radius r in xy plane:
-  Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
-    (ipadz-0.5)*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
-
-  // local azimuthal angle in the sector philoc
-  Float_t philoc   = TMath:: ATan(d/r);
-
-  // azimuthal angle in the global frame  phi
-  Float_t phi      = philoc*kRaddeg+(isector+0.5 )*fPhiSec;                    
-
-  Float_t xCoor    = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
-  return xCoor;
-
-}
-//_____________________________________________________________________________
-Float_t AliTOFGeometry::GetY(Int_t *det) 
-{
-  //
-  // Returns Y coordinate (cm)
-  //
-
-  Int_t isector = det[0];
-  Int_t iplate  = det[1];
-  Int_t istrip  = det[2];
-  Int_t ipadz   = det[3];
-  Int_t ipadx   = det[4];
-
-  // Find out distance d on the plane wrt median phi:
-  Float_t d = (ipadx+0.5)*fgkXPad-(kNpadX*fgkXPad)*0.5;
-
-  // The radius r in xy plane:
-  Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
-    (ipadz-0.5)*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
-
-  // local azimuthal angle in the sector philoc
-  Float_t philoc   = TMath:: ATan(d/r);
-
-  // azimuthal angle in the global frame  phi
-  Float_t phi      = philoc*kRaddeg+(isector+0.5 )*fPhiSec;                    
-
-  Float_t yCoor    = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
-  return yCoor;
-
-}
-
-//_____________________________________________________________________________
-Float_t AliTOFGeometry::GetZ(Int_t *det) 
-{
-  //
-  // Returns Z coordinate (cm)
-  //
-  
-  Int_t iplate  = det[1];
-  Int_t istrip  = det[2];
-  Int_t ipadz   = det[3];
-  
-  
-  // The radius r in xy plane:
-  Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip];
-
-  Float_t zCoor = r*TMath::Tan(0.5*TMath::Pi()-GetStripTheta(iplate,istrip))-
-         (ipadz-0.5)*fgkZPad*TMath::Cos(fAngles[iplate][istrip]/kRaddeg);
-  return zCoor;
-
-}
-//_____________________________________________________________________________
-Int_t AliTOFGeometry::GetSector(Float_t *pos) 
-{
-  //
-  // Returns the Sector index 
-  //
-
-  Int_t   iSect = -1; 
-
-  Float_t x = pos[0];
-  Float_t y = pos[1];
-
-  Float_t phi     =  TMath::ATan2(y,x);        
-  if(phi<0.) phi=2.*TMath::Pi()+phi;
-  iSect  = (Int_t) (phi*kRaddeg/fPhiSec);
-
-  return iSect;
-
-}
-//_____________________________________________________________________________
-Int_t AliTOFGeometry::GetPadX(Float_t *pos) 
-{
-  //
-  // Returns the Pad index along X 
-  //
-
-  Int_t iPadX  = -1;
-
-  Float_t x = pos[0];
-  Float_t y = pos[1];
-  Float_t z = pos[2];
-
-  Int_t isector = GetSector(pos);
-  if(isector == -1){  
-    AliError("Detector Index could not be determined");
-    return iPadX;}
-  Int_t iplate =  GetPlate(pos);
-  if(iplate == -1){  
-    AliError("Detector Index could not be determined");
-    return iPadX;} 
-  Int_t istrip =  GetStrip(pos);
-  if(istrip == -1){  
-    AliError("Detector Index could not be determined");
-    return iPadX;}
-
-
-  Float_t rho=TMath::Sqrt(x*x+y*y);
-  Float_t phi =  TMath::ATan2(y,x);    
-  if(phi<0.) phi=2.*TMath::Pi()+phi;
-  // Get the local angle in the sector philoc
-  Float_t philoc   = phi*kRaddeg-(isector+0.5)*fPhiSec;
-  philoc*=TMath::Pi()/180.;
-  // theta projected on the median of the sector
-  Float_t theta = TMath::ATan2(rho*TMath::Cos(philoc),z);
-  // The radius r in xy plane:
-  Float_t r   = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
-               (theta-GetStripTheta(iplate, istrip))/
-    (GetMaxStripTheta(iplate, istrip)-GetMinStripTheta(iplate, istrip))
-   * 2.*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
-
-  // Find out distance projected onto the strip plane 
-  Float_t d = (r*TMath::Tan(philoc)+(kNpadX*fgkXPad)*0.5);
-
-  iPadX  =  (Int_t) ( d/fgkXPad);  
-  return iPadX;
-
-}
-//_____________________________________________________________________________
-Int_t AliTOFGeometry::GetPlate(Float_t *pos) 
-{
-  //
-  // Returns the Plate index 
-  //
-  Int_t iPlate=-1;
-
-  Int_t isector = GetSector(pos);
-  if(isector == -1){  
-    AliError("Detector Index could not be determined");
-    return iPlate;}
-  Float_t x = pos[0];
-  Float_t y = pos[1];
-  Float_t z = pos[2];
-
-  Float_t rho=TMath::Sqrt(x*x+y*y);
-  Float_t phi=TMath::ATan2(y,x);       
-  if(phi<0) phi=2.*TMath::Pi()+phi;
-  // Get the local angle in the sector philoc
-  Float_t philoc   = phi*kRaddeg-(isector+0.5)*fPhiSec;
-  philoc*=TMath::Pi()/180.;
-  // theta projected on the median of the sector
-  Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
-
-  for (Int_t i=0; i<kNPlates; i++){
-    if ( GetMaxPlateTheta(i) >= theta && 
-         GetMinPlateTheta(i) <= theta)iPlate=i;
-  }
-  
-  return iPlate;
-
-}
-//_____________________________________________________________________________
-Int_t AliTOFGeometry::GetStrip(Float_t *pos) 
-{
-  //
-  // Returns the Strip index 
-  //
-
-  Int_t iStrip=-1;
-
-
-  Int_t isector = GetSector(pos);
-  if(isector == -1){  
-    AliError("Detector Index could not be determined");
-    return iStrip;}
-  Int_t iplate =  GetPlate(pos);
-  if(iplate == -1){  
-    AliError("Detector Index could not be determined");
-    return iStrip;} 
-
-
-  Float_t x = pos[0];
-  Float_t y = pos[1];
-  Float_t z = pos[2];
-
-  Int_t nstrips=0;
-  if(iplate==0 || iplate == 4)nstrips=kNStripC;
-  if(iplate==1 || iplate == 3)nstrips=kNStripB;
-  if(iplate==2)               nstrips=kNStripA;
-
-  Float_t rho=TMath::Sqrt(x*x+y*y);
-  Float_t phi=TMath::ATan2(y,x);       
-  if(phi<0) phi=2.*TMath::Pi()+phi;
-  // Get the local angle in the sector philoc
-  Float_t philoc   = phi*kRaddeg-(isector+0.5)*fPhiSec;
-  philoc*=TMath::Pi()/180.;
-  // theta projected on the median of the sector
-  Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
-
-  for (Int_t istrip=0; istrip<nstrips; istrip++){
-
-    if( 
-       GetMaxStripTheta(iplate,istrip) >= theta 
-       &&  
-       GetMinStripTheta(iplate,istrip) <= theta ) iStrip = istrip;
-   
-  }
-
-  return iStrip;
-}
-//_____________________________________________________________________________
-Int_t AliTOFGeometry::GetPadZ(Float_t *pos) 
-{
-  //
-  // Returns the Pad index along Z 
-  //
-  Int_t iPadZ = -1;
-
-  Int_t isector = GetSector(pos);
-  if(isector == -1){  
-    AliError("Detector Index could not be determined");
-    return iPadZ;}
-  Int_t iplate =  GetPlate(pos);
-  if(iplate == -1){  
-    AliError("Detector Index could not be determined");
-    return iPadZ;} 
-  Int_t istrip =  GetStrip(pos);
-  if(istrip == -1){  
-    AliError("Detector Index could not be determined");
-    return iPadZ;}
-
-
-  Float_t x = pos[0];
-  Float_t y = pos[1];
-  Float_t z = pos[2];
-
-  Float_t rho=TMath::Sqrt(x*x+y*y);
-  Float_t phi=TMath::ATan2(y,x);       
-  if(phi<0) phi=2.*TMath::Pi()+phi;
-  Float_t philoc   = phi*kRaddeg-(isector+0.5)*fPhiSec;
-  philoc*=TMath::Pi()/180.;
-  Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
-
-  if (theta >= GetStripTheta(iplate, istrip))iPadZ=1;
-  else iPadZ=0;
-
-  return iPadZ;
-}
-//_____________________________________________________________________________
-Float_t AliTOFGeometry::GetMinPlateTheta(Int_t iPlate) 
-{
-  //
-  // Returns the minimum theta angle of a given plate iPlate (rad)
-  //
-  
-
-  Int_t index=0;
-
-  Float_t delta =0.;
-  if(iPlate==0)delta = -1. ;
-  if(iPlate==1)delta = -0.5;
-  if(iPlate==3)delta = +0.5;
-  if(iPlate==4)delta = +1. ;
-
-  Float_t z=(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][index]/kRaddeg)+delta;
-  Float_t r=(fgkRmin+fgkRmax)/2.+fHeights[iPlate][index];
-  z =z+fgkZPad*TMath::Cos(fAngles[iPlate][index]/kRaddeg);
-  r =r-fgkZPad*TMath::Sin(fAngles[iPlate][index]/kRaddeg);
-
-  Float_t thmin = 0.5*TMath::Pi()-TMath::ATan(z/r)-fgkDprecMin;
-  return thmin;
-
-}
-//_____________________________________________________________________________
-Float_t AliTOFGeometry::GetMaxPlateTheta(Int_t iPlate) 
-{
-  //
-  // Returns the maximum theta angle of a given plate iPlate (rad)
-  
-  Int_t index=0;
-  if(iPlate==0 ||iPlate == 4)index=kNStripC-1;
-  if(iPlate==1 ||iPlate == 3)index=kNStripB-1;
-  if(iPlate==2)              index=kNStripA-1;
-
-  Float_t delta =0.;
-  if(iPlate==0)delta = -1. ;
-  if(iPlate==1)delta = -0.5;
-  if(iPlate==3)delta = +0.5;
-  if(iPlate==4)delta = +1. ;
-
-  Float_t z=(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][index]/kRaddeg)+delta;
-  Float_t r=(fgkRmin+fgkRmax)/2.+fHeights[iPlate][index];
-  z =z-fgkZPad*TMath::Cos(fAngles[iPlate][index]/kRaddeg);
-  r= r+fgkZPad*TMath::Sin(fAngles[iPlate][index]/kRaddeg);
-
-  Float_t thmax    = 0.5*TMath::Pi()-TMath::ATan(z/r)+fgkDprecMax;
-  return thmax;
-
-}
-//_____________________________________________________________________________
-Float_t  AliTOFGeometry::GetMaxStripTheta(Int_t iPlate, Int_t iStrip) 
-{
-  //
-  // Returns the maximum theta angle of a given strip iStrip (rad)
-  //
-  
-
-  Float_t delta =0.;
-  if(iPlate==0)delta = -1. ;
-  if(iPlate==1)delta = -0.5;
-  if(iPlate==3)delta = +0.5;
-  if(iPlate==4)delta = +1. ;
-
-  Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
-  Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
-  z = z-fgkZPad*TMath::Cos(fAngles[iPlate][iStrip]/kRaddeg);
-  r = r+fgkZPad*TMath::Sin(fAngles[iPlate][iStrip]/kRaddeg);
-  Float_t thmax =0.5*TMath::Pi()-TMath::ATan(z/r)+fgkDprecMax;
-  return thmax;
-
-}
-
-//_____________________________________________________________________________
-Float_t  AliTOFGeometry::GetMinStripTheta(Int_t iPlate, Int_t iStrip) 
-{
-  //
-  // Returns the minimum theta angle of a given Strip iStrip (rad)
-  //
-  
-
-  Float_t delta =0.;
-  if(iPlate==0)delta = -1. ;
-  if(iPlate==1)delta = -0.5;
-  if(iPlate==3)delta = +0.5;
-  if(iPlate==4)delta = +1. ;
-
-
-  Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
-  Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
-  z =z+fgkZPad*TMath::Cos(fAngles[iPlate][iStrip]/kRaddeg);
-  r =r-fgkZPad*TMath::Sin(fAngles[iPlate][iStrip]/kRaddeg);
-  Float_t thmin =0.5*TMath::Pi()-TMath::ATan(z/r)-fgkDprecMin;
-
-  return thmin;
-
-}
-
-
-//_____________________________________________________________________________
-Float_t  AliTOFGeometry::GetStripTheta(Int_t iPlate, Int_t iStrip) 
-{
-  //
-  // returns the median theta angle of a given strip iStrip (rad)
-  //
-  
-
-  Float_t delta =0.;
-  if(iPlate==0)delta = -1. ;
-  if(iPlate==1)delta = -0.5;
-  if(iPlate==3)delta = +0.5;
-  if(iPlate==4)delta = +1. ;
-
-  Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
-  Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
-  Float_t theta =0.5*TMath::Pi()-TMath::ATan(z/r);
-  if(iPlate != 2){
-  if(theta > 0.5*TMath::Pi() )theta+=fgkDprecCen;
-  if(theta < 0.5*TMath::Pi() )theta-=fgkDprecCen;
-  }
-  return theta;
-}
-
-
-
index 466213b372b8574509fd7c2dc681dbe137beffae..20fa98dc6ceac4e64660618b966f20f6cf2c7452 100644 (file)
@@ -22,47 +22,40 @@ class AliTOFGeometry: public TObject{
 
   static  Int_t NStripA()     { return kNStripA;};
   static  Int_t NStripB()     { return kNStripB;};
-  static  Int_t NStripC()     { return kNStripC;};
+  virtual Int_t NStripC()     { return kNStripC;};
+  virtual Int_t NMaxNstrip()  { return kMaxNstrip;};
   static  Int_t NpadX()       { return kNpadX;};
   static  Int_t NpadZ()       { return kNpadZ;};
   static  Int_t NpadXStrip()  { return kNpadX*kNpadZ;};
   static  Int_t NSectors()    { return kNSectors;};
   static  Int_t NPlates()     { return kNPlates;};
-  static  Int_t NPadXSector() { return (kNStripA + 2*kNStripB +
-                                      2*kNStripC)*kNpadX*kNpadZ;};
+  virtual Int_t NPadXSector() { return (kNStripA + 2*kNStripB +
+                                       2*kNStripC)*kNpadX*kNpadZ;};
+
+  virtual Float_t RinTOF()    { return fgkxTOF;};
+  virtual Float_t Rmin()      { return fgkRmin;};
+  virtual Float_t Rmax()      { return fgkRmax;};
+
+  static  Float_t XPad()      { return fgkXPad;};
+  static  Float_t ZPad()      { return fgkZPad;};
+
   static  Int_t TimeDiff()    { return fgkTimeDiff;};
   static  Int_t MaxTOFTree()  { return kMaxTOFTree;};
 
-
   static  Int_t NDDL()        { return kNDDL;};
   static  Int_t NTRM()        { return kNTRM;}
   static  Int_t NTdc()        { return kNTdc;};
   static  Int_t NCh()         { return kNCh;};
   static  Int_t NPadXTRM()    { return kNCh*kNTdc;};
 
-
-  static  Float_t RinTOF()      { return fgkxTOF;};
-  static  Float_t Rmin()        { return fgkRmin;};
-  static  Float_t Rmax()        { return fgkRmax;};
-  static  Float_t ZlenA()       { return fgkZlenA;};
-  static  Float_t ZlenB()       { return fgkZlenB;};
-  static  Float_t ZlenC()       { return fgkZlenC;};
-  static  Float_t XPad()        { return fgkXPad;};
-  static  Float_t ZPad()        { return fgkZPad;};
-  static  Float_t MaxhZtof()    { return fgkMaxhZtof;};
-  static  Float_t StripLength() { return fgkStripLength;};
-  static  Float_t DeadBndX()    { return fgkDeadBndX;};
-  static  Float_t DeadBndZ()    { return fgkDeadBndZ;};
-  static  Float_t OverSpc()     { return fgkOverSpc;};
+  virtual  Float_t ZlenA()       { return kZlenA;};
+  virtual  Float_t ZlenB()       { return kZlenB;};
+  virtual  Float_t ZlenC()       { return kZlenC;};
+  virtual  Float_t MaxhZtof()    { return kMaxhZtof;};
+  virtual  Float_t StripLength() { return kStripLength;};
 
   static  Float_t SigmaForTail1() { return fgkSigmaForTail1;};
   static  Float_t SigmaForTail2() { return fgkSigmaForTail2;};
-  static  Float_t SpeedOfLight()  { return fgkSpeedOfLight;};
-  static  Float_t PionMass()      { return fgkPionMass;};
-  static  Float_t KaonMass()      { return fgkKaonMass;};
-  static  Float_t ProtonMass()    { return fgkProtonMass;};
-  static  Float_t ElectronMass()  { return fgkElectronMass;};
-  static  Float_t MuonMass()      { return fgkMuonMass;};
  
   static  Double_t GetAlpha()  { return 2 * 3.14159265358979323846 / kNSectors; }; 
  
@@ -72,37 +65,34 @@ class AliTOFGeometry: public TObject{
   virtual void    Init();
   virtual void    SetHoles(Bool_t holes) {fHoles = holes;};
   virtual Bool_t  GetHoles() const {return fHoles;};
-  virtual Bool_t  IsInsideThePad(Int_t *det, Float_t *pos); 
-  virtual Float_t DistanceToPad(Int_t *det, Float_t *pos, Float_t *dist3d=0); 
-  virtual void    GetPos(Int_t *det,Float_t *pos);
-  virtual void    GetDetID(Float_t *pos,Int_t *det);
-  virtual Int_t   GetPlate(Float_t *pos);
-  virtual Int_t   GetStrip(Float_t *pos);
-  virtual Int_t   GetSector(Float_t *pos);
-  virtual Int_t   GetPadX(Float_t *pos);
-  virtual Int_t   GetPadZ(Float_t *pos);
-  virtual Float_t GetX(Int_t *det);
-  virtual Float_t GetY(Int_t *det);
-  virtual Float_t GetZ(Int_t *det);
-  virtual Float_t GetMinPlateTheta(Int_t iPlate);
-  virtual Float_t GetMaxPlateTheta(Int_t iPlate);
-  virtual Float_t GetMinStripTheta(Int_t iPlate, Int_t iStrip);
-  virtual Float_t GetMaxStripTheta(Int_t iPlate, Int_t iStrip);
-  virtual Float_t GetStripTheta(Int_t iPlate, Int_t iStrip);
-  virtual Float_t GetAngles(Int_t iplate, Int_t istrip)  const {return fAngles[iplate][istrip];};
-  virtual Float_t GetHeights(Int_t iplate, Int_t istrip) const {return fHeights[iplate][istrip];};
-
-  private:
+
+  virtual Bool_t  IsInsideThePad(Int_t */*det*/, Float_t */*pos*/) {return kFALSE;};
+  virtual Float_t DistanceToPad(Int_t */*det*/, Float_t */*pos*/, Float_t *dist3d=0) {return dist3d[0];};
+  virtual void    GetPos(Int_t */*det*/,Float_t */*pos*/);
+  virtual void    GetDetID(Float_t */*pos*/,Int_t */*det*/);
+  virtual Int_t   GetPlate(Float_t */*pos*/) {return -1;};
+  virtual Int_t   GetStrip(Float_t */*pos*/) {return -1;};
+  virtual Int_t   GetSector(Float_t */*pos*/) {return -1;};
+  virtual Int_t   GetPadX(Float_t */*pos*/) {return -1;};
+  virtual Int_t   GetPadZ(Float_t */*pos*/) {return -1;};
+  virtual Float_t GetX(Int_t */*det*/) {return -500.;};
+  virtual Float_t GetY(Int_t */*det*/) {return -500.;};
+  virtual Float_t GetZ(Int_t */*det*/) {return -500.;};
+
+  Float_t GetAngles(Int_t iplate, Int_t istrip)  const {return fAngles[iplate][istrip];};
+  Float_t GetHeights(Int_t iplate, Int_t istrip) const {return fHeights[iplate][istrip];};
+  Float_t GetDistances(Int_t iplate, Int_t istrip) const {return fDistances[iplate][istrip];};
+
+  //private:
+  protected:
 
   enum {
     kNStripA    = 15, // number of strips in A type module 
     kNStripB    = 19, // number of strips in B type module 
-    kNStripC    = 20, // number of strips in C type module 
     kNpadX      = 48, // Number of pads along X 
     kNpadZ      = 2,  // Number of pads along Z
     kNSectors   = 18, // Number of Sectors
     kNPlates    = 5,  // Number of Plates
-    kMaxNstrip  = 20, // Max. number of strips
     kMaxTOFTree = 5   // numer of geom. levels: 
   };
 
@@ -118,42 +108,36 @@ class AliTOFGeometry: public TObject{
 
   static const Int_t fgkTimeDiff;      // Min signal separation (ps)
 
-  static const Float_t fgkRmin;        // Inner radius of the TOF (cm)
-  static const Float_t fgkRmax;        // Outer radius of the TOF (cm)
-  static const Float_t fgkZlenA;       // length (cm) of the A module
-  static const Float_t fgkZlenB;       // length (cm) of the B module
-  static const Float_t fgkZlenC;       // length (cm) of the C module
-  static const Float_t fgkXPad;        // Pad size in the x direction (cm)
-  static const Float_t fgkZPad;        // Pad size in the z direction (cm)
-  static const Float_t fgkMaxhZtof;    // Max half z-size of TOF (cm)
-  static const Float_t fgkStripLength; // Strip Length (rho X phi direction) (cm)
-  static const Float_t fgkDeadBndX;    // Dead Boundaries of a Strip along Z direction (width)
-  static const Float_t fgkDeadBndZ;    // Dead Boundaries of a Strip along X direction (length)
-  static const Float_t fgkOverSpc;     // Space available for sensitive layers in radial direction (cm)
-
-  static const Float_t fgkxTOF;// Inner TOF Radius used in Reconstruction (cm)
+  mutable Int_t kNStripC;       // number of strips in C type module 
+  mutable Int_t kMaxNstrip;     // Max. number of strips
+
+  mutable Float_t kZlenA;       // length (cm) of the A module
+  mutable Float_t kZlenB;       // length (cm) of the B module
+  mutable Float_t kZlenC;       // length (cm) of the C module
+  mutable Float_t kMaxhZtof;    // Max half z-size of TOF (cm)
+  mutable Float_t kStripLength; // Strip Length (rho X phi direction) (cm)
+
+  mutable Float_t fgkRmin;     // Inner radius of the TOF (cm)
+  mutable Float_t fgkRmax;     // Outer radius of the TOF (cm)
+  mutable Float_t fgkxTOF;     // Inner TOF Radius used in Reconstruction (cm)
+
+  static const Float_t fgkXPad;     // Pad size in the x direction (cm)
+  static const Float_t fgkZPad;     // Pad size in the z direction (cm)
 
   static const Float_t fgkSigmaForTail1;//Sig1 for simulation of TDC tails 
   static const Float_t fgkSigmaForTail2;//Sig2 for simulation of TDC tails
-  static const Float_t fgkSpeedOfLight;// c (10^9 m/s)
-  static const Float_t fgkPionMass;// pion mass (Gev/c^2)
-  static const Float_t fgkKaonMass;// kaon mass (Gev/c^2)
-  static const Float_t fgkProtonMass;// proton mass (Gev/c^2)
-  static const Float_t fgkElectronMass;// electron mass (Gev/c^2)
-  static const Float_t fgkMuonMass;// muon mass (Gev/c^2)
-
-
-  static const Float_t fgkDprecMin;//num.prec.tolerance on Thmin 
-  static const Float_t fgkDprecMax;//num.prec.tolerance on Thma 
-  static const Float_t fgkDprecCen;//num.prec.tolerance on <Theta> 
-  Bool_t fHoles; //logical for geometry version (w/wo holes) 
-  Float_t fAngles[kNPlates][kMaxNstrip]; //Strip Tilt Angles
-  Float_t fHeights[kNPlates][kMaxNstrip];//Strip heights
+
+  Bool_t fHoles; //logical for geometry version (w/wo holes)
+
+  Float_t *fAngles[kNPlates]; //Strip Tilt Angles
+  Float_t *fHeights[kNPlates];//Strip heights
+  Float_t *fDistances[kNPlates];//Strip distances
+
   Float_t fPhiSec; //sector Phi width (deg)
 
   static const Float_t fgkTdcBin;   // time-window for the TDC bins [ps]
 
-  ClassDef(AliTOFGeometry,1) // TOF Geometry base class
+  ClassDef(AliTOFGeometry,2) // TOF Geometry base class
 };
 
 #endif
diff --git a/TOF/AliTOFGeometryV4.cxx b/TOF/AliTOFGeometryV4.cxx
new file mode 100644 (file)
index 0000000..d18e310
--- /dev/null
@@ -0,0 +1,680 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/*
+$Log$
+Revision 0.1  2005/07/19 A. De Caro
+        Modify Global methods IsInsideThePad & DistanceToPad
+               according to the PPR TOF geometry
+        Implement Global  methods GetPadDx & GetPadDy & GetPadDz
+        Modify Global methods GetDetID & GetPlate & GetSector &
+                              GetStrip & GetPadX & GetPadZ
+               according to the PPR TOF geometry
+        Modify Global methods GetPos & GetX & GetY & GetZ
+               according to the PPR TOF geometry
+*/
+
+#include <stdlib.h>
+#include <Riostream.h>
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TOF Geometry class (PPR version)                                         //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliLog.h"
+#include "AliConst.h"
+
+#include "AliTOFGeometry.h"
+#include "AliTOFGeometryV4.h"
+
+ClassImp(AliTOFGeometryV4)
+
+const Int_t AliTOFGeometryV4::kNStripC      = 20;       // number of strips in C type module
+const Int_t AliTOFGeometryV4::kMaxNstrip    = 20;       // Max. number of strips
+
+const Float_t AliTOFGeometryV4::fgkZlenA    = 106.0;    // length (cm) of the A module
+const Float_t AliTOFGeometryV4::fgkZlenB    = 141.0;    // length (cm) of the B module
+const Float_t AliTOFGeometryV4::fgkZlenC    = 177.5;    // length (cm) of the C module
+const Float_t AliTOFGeometryV4::fgkMaxhZtof = 371.5;    // Max half z-size of TOF (cm)
+const Float_t AliTOFGeometryV4::fgkStripLength = 122.;  // Strip Length (rho X phi direction) (cm)
+
+const Float_t AliTOFGeometryV4::fgkDeadBndX = 1.0;      // Dead Boundaries of a Strip along X direction (length) (cm)
+const Float_t AliTOFGeometryV4::fgkDeadBndZ = 1.5;      // Dead Boundaries of a Strip along Z direction (width) (cm)
+const Float_t AliTOFGeometryV4::fgkOverSpc = 15.3;      // Space available for sensitive layers in radial direction (cm)
+
+const Float_t AliTOFGeometryV4::fgkDprecMin = 0.0000075;//num.prec.tolerance on Thmin 
+const Float_t AliTOFGeometryV4::fgkDprecMax = 0.0000100;//num.prec.tolerance on Thma 
+const Float_t AliTOFGeometryV4::fgkDprecCen = 0.0000005;//num.prec.tolerance on <Theta> 
+
+const Float_t AliTOFGeometryV4::fgkxTOF     = 371.;     // Inner radius of the TOF for Reconstruction (cm)
+const Float_t AliTOFGeometryV4::fgkRmin     = 370.;     // Inner radius of the TOF (cm)
+const Float_t AliTOFGeometryV4::fgkRmax     = 399.;     // Outer radius of the TOF (cm)
+
+//_____________________________________________________________________________
+AliTOFGeometryV4::AliTOFGeometryV4()
+  :AliTOFGeometry()
+{
+  //
+  // AliTOFGeometryV4 default constructor
+  //
+
+  AliTOFGeometry::kNStripC   = kNStripC;         // number of strips in C type module
+  AliTOFGeometry::kMaxNstrip = kMaxNstrip;       // Max. number of strips
+
+  AliTOFGeometry::kZlenA    = fgkZlenA;          // length (cm) of the A module
+  AliTOFGeometry::kZlenB    = fgkZlenB;          // length (cm) of the B module
+  AliTOFGeometry::kZlenC    = fgkZlenC;          // length (cm) of the C module
+  AliTOFGeometry::kMaxhZtof = fgkMaxhZtof;       // Max half z-size of TOF (cm)
+  AliTOFGeometry::kStripLength = fgkStripLength; // Strip Length (rho X phi direction) (cm)
+
+  AliTOFGeometry::fgkxTOF   = fgkxTOF;           // Inner radius of the TOF for Reconstruction (cm)
+  AliTOFGeometry::fgkRmin   = fgkRmin;           // Inner radius of the TOF (cm)
+  AliTOFGeometry::fgkRmax   = fgkRmax;           // Outer radius of the TOF (cm)
+
+  Init();
+
+}
+
+//_____________________________________________________________________________
+AliTOFGeometryV4::~AliTOFGeometryV4()
+{
+  //
+  // AliTOFGeometryV4 destructor
+  //
+
+}
+//_____________________________________________________________________________
+void AliTOFGeometryV4::Init()
+{
+  //
+  // Initialize strip Tilt Angles and Heights
+  //
+  // Strips Tilt Angles
+  Float_t const kangles[kNPlates][kMaxNstrip] ={
+
+ {44.494, 43.725, 42.946, 42.156, 41.357, 40.548, 39.729, 38.899, 
+  38.060, 37.211, 36.353, 35.484, 34.606, 33.719, 32.822, 31.916, 
+  31.001, 30.077, 29.144, 28.202 },
+
+ {26.884, 25.922, 24.952, 23.975, 22.989, 22.320, 21.016, 20.309,
+  19.015, 18.270, 16.989, 16.205, 14.941, 14.117, 12.871, 12.008,
+  10.784, 9.8807, 8.681, 0.0 },
+
+ { 7.5835, 6.4124, 5.4058, 4.2809, 3.2448,  2.1424, 1.078, -0., -1.078, 
+  -2.1424, -3.2448, -4.2809, -5.4058, -6.4124, -7.5835, 0.0, 0.0, 0.0,
+  0.0, 0.0 },
+  
+ {-8.681, -9.8807, -10.784, -12.008, -12.871, -14.117, -14.941, -16.205,
+  -16.989, -18.27, -19.015, -20.309, -21.016, -22.32, -22.989,
+   -23.975, -24.952, -25.922, -26.884, 0. },
+  
+ {-28.202, -29.144, -30.077, -31.001, -31.916, -32.822, -33.719, -34.606,
+  -35.484, -36.353, -37.211, -38.06, -38.899, -39.729, -40.548,
+   -41.357, -42.156, -42.946, -43.725, -44.494 }};
+
+
+  //Strips Heights
+
+   Float_t const kheights[kNPlates][kMaxNstrip]= {
+
+  {-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5,
+   -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5 },
+  
+  {-6.3, -7.1, -7.9, -8.7, -9.5, -3, -9.5,   -3, -9.5,   -3, 
+   -9.5, -3.0, -9.5, -3.0, -9.5, -3, -9.5,   -3,   -9 , 0.},
+  
+  {  -3,   -9, -4.5,   -9, -4.5,     -9, -4.5,   -9, -4.5,   -9, 
+     -4.5,   -9, -4.5,   -9,   -3,   0.0, 0.0, 0.0, 0.0, 0.0 },
+  
+  {  -9,   -3, -9.5,   -3, -9.5, -3, -9.5,   -3, -9.5,   -3, -9.5,
+     -3, -9.5,   -3, -9.5,  -8.7, -7.9, -7.1, -6.3, 0. },
+  
+  {-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5,
+   -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5 }};
+
+   // Deposit in fAngles, fHeights
+
+   for (Int_t iplate = 0; iplate < kNPlates; iplate++) AliTOFGeometry::fAngles[iplate] = new Float_t[kMaxNstrip];
+   for (Int_t iplate = 0; iplate < kNPlates; iplate++) AliTOFGeometry::fHeights[iplate] = new Float_t[kMaxNstrip];
+
+   for (Int_t iplate = 0; iplate < kNPlates; iplate++) {
+     for (Int_t istrip = 0; istrip < kMaxNstrip; istrip++) {
+       AliTOFGeometry::fAngles[iplate][istrip]   = kangles[iplate][istrip];
+       AliTOFGeometry::fHeights[iplate][istrip]  = kheights[iplate][istrip];
+     }
+   }
+
+}
+
+//_____________________________________________________________________________
+Float_t AliTOFGeometryV4::DistanceToPad(Int_t *det, Float_t *pos, Float_t *dist3d) 
+{
+//
+// Returns distance of  space point with coor pos (x,y,z) (cm) wrt 
+// pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) 
+//
+    
+  //Transform pos into Sector Frame
+
+  Float_t x = pos[0];
+  Float_t y = pos[1];
+  Float_t z = pos[2];
+
+  Float_t radius = TMath::Sqrt(x*x+y*y);
+  Float_t phi=TMath::ATan2(y,x);       
+  if(phi<0) phi=2.*TMath::Pi()+phi;
+  //  Get the local angle in the sector philoc
+  Float_t angle   = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5)*fPhiSec;
+  Float_t xs = radius*TMath::Cos(angle/kRaddeg);
+  Float_t ys = radius*TMath::Sin(angle/kRaddeg);
+  Float_t zs = z;
+
+  // Do the same for the selected pad
+
+  Float_t g[3];
+  GetPos(det,g);
+
+  Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
+  Float_t padPhi=TMath::ATan2(g[1],g[0]);      
+  if(padPhi<0) padPhi=2.*TMath::Pi()+padPhi;
+  //  Get the local angle in the sector philoc
+  Float_t padAngle   = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec; 
+  Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
+  Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
+  Float_t padzs = g[2];
+  
+  //Now move to local pad coordinate frame. Translate:
+  
+  Float_t xt = xs-padxs;
+  Float_t yt = ys-padys;
+  Float_t zt = zs-padzs;
+  //Now Rotate:
+  
+  Float_t alpha = GetAngles(det[1],det[2]);
+  Float_t xr =  xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
+  Float_t yr =  yt;
+  Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
+
+  Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
+
+  if (dist3d){
+    dist3d[0] = xr;
+    dist3d[1] = yr;
+    dist3d[2] = zr;
+  }
+
+  return dist;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTOFGeometryV4::IsInsideThePad(Int_t *det, Float_t *pos) 
+{
+//
+// Returns true if space point with coor pos (x,y,z) (cm) falls 
+// inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) 
+//
+
+  Bool_t isInside=false; 
+
+  //Transform pos into Sector Frame
+
+  Float_t x = pos[0];
+  Float_t y = pos[1];
+  Float_t z = pos[2];
+
+  Float_t radius = TMath::Sqrt(x*x+y*y);
+  Float_t phi=TMath::ATan2(y,x);       
+  if(phi<0) phi=2.*TMath::Pi()+phi;
+  //  Get the local angle in the sector philoc
+  Float_t angle   = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5) *fPhiSec;
+  Float_t xs = radius*TMath::Cos(angle/kRaddeg);
+  Float_t ys = radius*TMath::Sin(angle/kRaddeg);
+  Float_t zs = z;
+
+  // Do the same for the selected pad
+
+  Float_t g[3];
+  GetPos(det,g);
+
+  Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
+  Float_t padPhi=TMath::ATan2(g[1],g[0]);      
+  if(padPhi<0) padPhi=2.*TMath::Pi()+padPhi;
+  //  Get the local angle in the sector philoc
+  Float_t padAngle   = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec; 
+  Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
+  Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
+  Float_t padzs = g[2];
+
+  //Now move to local pad coordinate frame. Translate:
+
+  Float_t xt = xs-padxs;
+  Float_t yt = ys-padys;
+  Float_t zt = zs-padzs;
+
+  //Now Rotate:
+
+  Float_t alpha = GetAngles(det[1],det[2]);
+  Float_t xr =  xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
+  Float_t yr =  yt;
+  Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
+
+  if(TMath::Abs(xr)<=0.75 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
+    isInside=true; 
+  return isInside;
+
+}
+
+//_____________________________________________________________________________
+Float_t AliTOFGeometryV4::GetX(Int_t *det) 
+{
+  //
+  // Returns X coordinate (cm)
+  //
+
+  Int_t isector = det[0];
+  Int_t iplate  = det[1];
+  Int_t istrip  = det[2];
+  Int_t ipadz   = det[3];
+  Int_t ipadx   = det[4];
+
+  // Find out distance d on the plane wrt median phi:
+  Float_t d = (ipadx+0.5)*fgkXPad-(kNpadX*fgkXPad)*0.5;
+
+  // The radius r in xy plane:
+  Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
+    (ipadz-0.5)*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
+
+  // local azimuthal angle in the sector philoc
+  Float_t philoc   = TMath:: ATan(d/r);
+
+  // azimuthal angle in the global frame  phi
+  Float_t phi      = philoc*kRaddeg+(isector+0.5 )*fPhiSec;                    
+
+  Float_t xCoor    = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
+
+  return xCoor;
+
+}
+//_____________________________________________________________________________
+Float_t AliTOFGeometryV4::GetY(Int_t *det) 
+{
+  //
+  // Returns Y coordinate (cm)
+  //
+
+  Int_t isector = det[0];
+  Int_t iplate  = det[1];
+  Int_t istrip  = det[2];
+  Int_t ipadz   = det[3];
+  Int_t ipadx   = det[4];
+
+  // Find out distance d on the plane wrt median phi:
+  Float_t d = (ipadx+0.5)*fgkXPad-(kNpadX*fgkXPad)*0.5;
+
+  // The radius r in xy plane:
+  Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
+    (ipadz-0.5)*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
+
+  // local azimuthal angle in the sector philoc
+  Float_t philoc   = TMath:: ATan(d/r);
+
+  // azimuthal angle in the global frame  phi
+  Float_t phi      = philoc*kRaddeg+(isector+0.5 )*fPhiSec;                    
+
+  Float_t yCoor    = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
+
+  return yCoor;
+
+}
+
+//_____________________________________________________________________________
+Float_t AliTOFGeometryV4::GetZ(Int_t *det) 
+{
+  //
+  // Returns Z coordinate (cm)
+  //
+
+  Int_t iplate  = det[1];
+  Int_t istrip  = det[2];
+  Int_t ipadz   = det[3];
+
+  // The radius r in xy plane:
+  Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip];
+
+  Float_t zCoor = r*TMath::Tan(0.5*TMath::Pi()-GetStripTheta(iplate,istrip))-
+         (ipadz-0.5)*fgkZPad*TMath::Cos(fAngles[iplate][istrip]/kRaddeg);
+  return zCoor;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTOFGeometryV4::GetSector(Float_t *pos) 
+{
+  //
+  // Returns the Sector index 
+  //
+
+  Int_t   iSect = -1; 
+
+  Float_t x = pos[0];
+  Float_t y = pos[1];
+
+  Float_t phi     =  TMath::ATan2(y,x);        
+  if(phi<0.) phi=2.*TMath::Pi()+phi;
+  iSect  = (Int_t) (phi*kRaddeg/fPhiSec);
+
+  return iSect;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTOFGeometryV4::GetPadX(Float_t *pos) 
+{
+  //
+  // Returns the Pad index along X 
+  //
+
+  Int_t iPadX  = -1;
+
+  Float_t x = pos[0];
+  Float_t y = pos[1];
+  Float_t z = pos[2];
+
+  Int_t isector = GetSector(pos);
+  if(isector == -1){  
+    AliError("Detector Index could not be determined");
+    return iPadX;}
+  Int_t iplate =  GetPlate(pos);
+  if(iplate == -1){  
+    AliError("Detector Index could not be determined");
+    return iPadX;} 
+  Int_t istrip =  GetStrip(pos);
+  if(istrip == -1){  
+    AliError("Detector Index could not be determined");
+    return iPadX;}
+
+
+  Float_t rho=TMath::Sqrt(x*x+y*y);
+  Float_t phi =  TMath::ATan2(y,x);    
+  if(phi<0.) phi=2.*TMath::Pi()+phi;
+  // Get the local angle in the sector philoc
+  Float_t philoc   = phi*kRaddeg-(isector+0.5)*fPhiSec;
+  philoc*=TMath::Pi()/180.;
+  // theta projected on the median of the sector
+  Float_t theta = TMath::ATan2(rho*TMath::Cos(philoc),z);
+  // The radius r in xy plane:
+  Float_t r   = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
+               (theta-GetStripTheta(iplate, istrip))/
+    (GetMaxStripTheta(iplate, istrip)-GetMinStripTheta(iplate, istrip))
+   * 2.*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
+
+  // Find out distance projected onto the strip plane 
+  Float_t d = (r*TMath::Tan(philoc)+(kNpadX*fgkXPad)*0.5);
+
+  iPadX  =  (Int_t) ( d/fgkXPad);  
+  return iPadX;
+
+}
+//_____________________________________________________________________________
+Int_t AliTOFGeometryV4::GetPlate(Float_t *pos) 
+{
+  //
+  // Returns the Plate index 
+  //
+  Int_t iPlate=-1;
+
+  Int_t isector = GetSector(pos);
+  if(isector == -1){  
+    AliError("Detector Index could not be determined");
+    return iPlate;}
+  Float_t x = pos[0];
+  Float_t y = pos[1];
+  Float_t z = pos[2];
+
+  Float_t rho=TMath::Sqrt(x*x+y*y);
+  Float_t phi=TMath::ATan2(y,x);       
+  if(phi<0) phi=2.*TMath::Pi()+phi;
+  // Get the local angle in the sector philoc
+  Float_t philoc   = phi*kRaddeg-(isector+0.5)*fPhiSec;
+  philoc*=TMath::Pi()/180.;
+  // theta projected on the median of the sector
+  Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
+
+  for (Int_t i=0; i<kNPlates; i++){
+    if ( GetMaxPlateTheta(i) >= theta && 
+         GetMinPlateTheta(i) <= theta)iPlate=i;
+  }
+
+  return iPlate;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTOFGeometryV4::GetStrip(Float_t *pos) 
+{
+  //
+  // Returns the Strip index 
+  //
+
+  Int_t iStrip=-1;
+
+
+  Int_t isector = GetSector(pos);
+  if(isector == -1){  
+    AliError("Detector Index could not be determined");
+    return iStrip;}
+  Int_t iplate =  GetPlate(pos);
+  if(iplate == -1){  
+    AliError("Detector Index could not be determined");
+    return iStrip;} 
+
+
+  Float_t x = pos[0];
+  Float_t y = pos[1];
+  Float_t z = pos[2];
+
+  Int_t nstrips=0;
+  if(iplate==0 || iplate == 4)nstrips=kNStripC;
+  if(iplate==1 || iplate == 3)nstrips=kNStripB;
+  if(iplate==2)               nstrips=kNStripA;
+
+  Float_t rho=TMath::Sqrt(x*x+y*y);
+  Float_t phi=TMath::ATan2(y,x);       
+  if(phi<0) phi=2.*TMath::Pi()+phi;
+  // Get the local angle in the sector philoc
+  Float_t philoc   = phi*kRaddeg-(isector+0.5)*fPhiSec;
+  philoc*=TMath::Pi()/180.;
+  // theta projected on the median of the sector
+  Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
+
+  for (Int_t istrip=0; istrip<nstrips; istrip++){
+
+    if( 
+       GetMaxStripTheta(iplate,istrip) >= theta 
+       &&  
+       GetMinStripTheta(iplate,istrip) <= theta ) iStrip = istrip;
+   
+  }
+
+  return iStrip;
+
+}
+//_____________________________________________________________________________
+Int_t AliTOFGeometryV4::GetPadZ(Float_t *pos) 
+{
+  //
+  // Returns the Pad index along Z 
+  //
+  Int_t iPadZ = -1;
+
+  Int_t isector = GetSector(pos);
+  if(isector == -1){  
+    AliError("Detector Index could not be determined");
+    return iPadZ;}
+  Int_t iplate =  GetPlate(pos);
+  if(iplate == -1){  
+    AliError("Detector Index could not be determined");
+    return iPadZ;} 
+  Int_t istrip =  GetStrip(pos);
+  if(istrip == -1){  
+    AliError("Detector Index could not be determined");
+    return iPadZ;}
+
+
+  Float_t x = pos[0];
+  Float_t y = pos[1];
+  Float_t z = pos[2];
+
+  Float_t rho=TMath::Sqrt(x*x+y*y);
+  Float_t phi=TMath::ATan2(y,x);       
+  if(phi<0) phi=2.*TMath::Pi()+phi;
+  Float_t philoc   = phi*kRaddeg-(isector+0.5)*fPhiSec;
+  philoc*=TMath::Pi()/180.;
+  Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
+
+  if (theta >= GetStripTheta(iplate, istrip))iPadZ=1;
+  else iPadZ=0;
+
+  return iPadZ;
+
+}
+//_____________________________________________________________________________
+Float_t AliTOFGeometryV4::GetMinPlateTheta(Int_t iPlate) 
+{
+  //
+  // Returns the minimum theta angle of a given plate iPlate (rad)
+  //
+  
+
+  Int_t index=0;
+
+  Float_t delta =0.;
+  if(iPlate==0)delta = -1. ;
+  if(iPlate==1)delta = -0.5;
+  if(iPlate==3)delta = +0.5;
+  if(iPlate==4)delta = +1. ;
+
+  Float_t z=(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][index]/kRaddeg)+delta;
+  Float_t r=(fgkRmin+fgkRmax)/2.+fHeights[iPlate][index];
+  z =z+fgkZPad*TMath::Cos(fAngles[iPlate][index]/kRaddeg);
+  r =r-fgkZPad*TMath::Sin(fAngles[iPlate][index]/kRaddeg);
+
+  Float_t thmin = 0.5*TMath::Pi()-TMath::ATan(z/r)-fgkDprecMin;
+  return thmin;
+
+}
+//_____________________________________________________________________________
+Float_t AliTOFGeometryV4::GetMaxPlateTheta(Int_t iPlate) 
+{
+  //
+  // Returns the maximum theta angle of a given plate iPlate (rad)
+  
+  Int_t index=0;
+  if(iPlate==0 ||iPlate == 4)index=kNStripC-1;
+  if(iPlate==1 ||iPlate == 3)index=kNStripB-1;
+  if(iPlate==2)              index=kNStripA-1;
+
+  Float_t delta =0.;
+  if(iPlate==0)delta = -1. ;
+  if(iPlate==1)delta = -0.5;
+  if(iPlate==3)delta = +0.5;
+  if(iPlate==4)delta = +1. ;
+
+  Float_t z=(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][index]/kRaddeg)+delta;
+  Float_t r=(fgkRmin+fgkRmax)/2.+fHeights[iPlate][index];
+  z =z-fgkZPad*TMath::Cos(fAngles[iPlate][index]/kRaddeg);
+  r= r+fgkZPad*TMath::Sin(fAngles[iPlate][index]/kRaddeg);
+
+  Float_t thmax    = 0.5*TMath::Pi()-TMath::ATan(z/r)+fgkDprecMax;
+
+  return thmax;
+
+}
+//_____________________________________________________________________________
+Float_t  AliTOFGeometryV4::GetMaxStripTheta(Int_t iPlate, Int_t iStrip) 
+{
+  //
+  // Returns the maximum theta angle of a given strip iStrip (rad)
+  //
+
+
+  Float_t delta =0.;
+  if(iPlate==0)delta = -1. ;
+  if(iPlate==1)delta = -0.5;
+  if(iPlate==3)delta = +0.5;
+  if(iPlate==4)delta = +1. ;
+
+  Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
+  Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
+  z = z-fgkZPad*TMath::Cos(fAngles[iPlate][iStrip]/kRaddeg);
+  r = r+fgkZPad*TMath::Sin(fAngles[iPlate][iStrip]/kRaddeg);
+  Float_t thmax =0.5*TMath::Pi()-TMath::ATan(z/r)+fgkDprecMax;
+  return thmax;
+
+}
+//_____________________________________________________________________________
+Float_t  AliTOFGeometryV4::GetMinStripTheta(Int_t iPlate, Int_t iStrip) 
+{
+  //
+  // Returns the minimum theta angle of a given Strip iStrip (rad)
+  //
+  
+
+  Float_t delta =0.;
+  if(iPlate==0)delta = -1. ;
+  if(iPlate==1)delta = -0.5;
+  if(iPlate==3)delta = +0.5;
+  if(iPlate==4)delta = +1. ;
+
+
+  Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
+  Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
+  z =z+fgkZPad*TMath::Cos(fAngles[iPlate][iStrip]/kRaddeg);
+  r =r-fgkZPad*TMath::Sin(fAngles[iPlate][iStrip]/kRaddeg);
+  Float_t thmin =0.5*TMath::Pi()-TMath::ATan(z/r)-fgkDprecMin;
+
+  return thmin;
+
+}
+//_____________________________________________________________________________
+Float_t  AliTOFGeometryV4::GetStripTheta(Int_t iPlate, Int_t iStrip) 
+{
+  //
+  // returns the median theta angle of a given strip iStrip (rad)
+  //
+  
+
+  Float_t delta =0.;
+  if(iPlate==0)delta = -1. ;
+  if(iPlate==1)delta = -0.5;
+  if(iPlate==3)delta = +0.5;
+  if(iPlate==4)delta = +1. ;
+
+  Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
+  Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
+  Float_t theta =0.5*TMath::Pi()-TMath::ATan(z/r);
+  if(iPlate != 2){
+  if(theta > 0.5*TMath::Pi() )theta+=fgkDprecCen;
+  if(theta < 0.5*TMath::Pi() )theta-=fgkDprecCen;
+  }
+  return theta;
+
+}
+//_____________________________________________________________________________
diff --git a/TOF/AliTOFGeometryV4.h b/TOF/AliTOFGeometryV4.h
new file mode 100644 (file)
index 0000000..5641e3d
--- /dev/null
@@ -0,0 +1,91 @@
+#ifndef ALITOFGEOMETRYV4_H
+#define ALITOFGEOMETRYV4_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TOF geometry class (PPR version)                                         //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+
+#include "AliTOFGeometry.h"
+
+class AliTOFGeometryV4: public AliTOFGeometry {
+
+ public:
+  AliTOFGeometryV4();
+  virtual ~AliTOFGeometryV4();
+  
+  void    Init();
+  Bool_t  IsInsideThePad(Int_t *det, Float_t *pos);
+  Float_t DistanceToPad(Int_t *det, Float_t *pos, Float_t *dist3d=0);
+  Int_t   GetPlate(Float_t *pos);
+  Int_t   GetStrip(Float_t *pos);
+  Int_t   GetSector(Float_t *pos);
+  Int_t   GetPadX(Float_t *pos);
+  Int_t   GetPadZ(Float_t *pos);
+  Float_t GetX(Int_t *det);
+  Float_t GetY(Int_t *det);
+  Float_t GetZ(Int_t *det);
+  Float_t GetMinPlateTheta(Int_t iPlate);
+  Float_t GetMaxPlateTheta(Int_t iPlate);
+  Float_t GetMinStripTheta(Int_t iPlate, Int_t iStrip);
+  Float_t GetMaxStripTheta(Int_t iPlate, Int_t iStrip);
+  Float_t GetStripTheta(Int_t iPlate, Int_t iStrip);
+  //Float_t GetAngles(Int_t iplate, Int_t istrip)  const {return fAngles[iplate][istrip];};
+  //Float_t GetHeights(Int_t iplate, Int_t istrip) const {return fHeights[iplate][istrip];};
+
+  Float_t NStirpC()     { return kNStripC;};
+  Int_t   NMaxNstrip()  { return kMaxNstrip;};
+  Int_t   NPadXSector() { return (AliTOFGeometry::kNStripA + 2*AliTOFGeometry::kNStripB +
+                                 2*kNStripC)*AliTOFGeometry::kNpadX*AliTOFGeometry::kNpadZ;};
+
+  Float_t RinTOF()      { return fgkxTOF;};
+  Float_t Rmin()        { return fgkRmin;};
+  Float_t Rmax()        { return fgkRmax;};
+
+  Float_t ZlenA()       { return fgkZlenA;};
+  Float_t ZlenB()       { return fgkZlenB;};
+  Float_t ZlenC()       { return fgkZlenC;};
+  Float_t MaxhZtof()    { return fgkMaxhZtof;};
+  Float_t StripLength() { return fgkStripLength;};
+
+  static  Float_t DeadBndX()    { return fgkDeadBndX;};
+  static  Float_t DeadBndZ()    { return fgkDeadBndZ;};
+  static  Float_t OverSpc()     { return fgkOverSpc;};
+
+  protected:
+
+  //private:
+
+  static const Int_t kNStripC;         // number of strips in C type module 
+  static const Int_t kMaxNstrip;       // Max. number of strips
+
+  static const Float_t fgkZlenA;       // length (cm) of the A module
+  static const Float_t fgkZlenB;       // length (cm) of the B module
+  static const Float_t fgkZlenC;       // length (cm) of the C module
+  static const Float_t fgkMaxhZtof;    // Max half z-size of TOF (cm)
+  static const Float_t fgkStripLength; // Strip Length (rho X phi direction) (cm)
+
+  static const Float_t fgkRmin;        // Inner radius of the TOF (cm)
+  static const Float_t fgkRmax;        // Outer radius of the TOF (cm)
+  static const Float_t fgkxTOF;        // Inner TOF Radius used in Reconstruction (cm)
+
+  static const Float_t fgkDeadBndX; // Dead Boundaries of a Strip along Z direction (width)
+  static const Float_t fgkDeadBndZ; // Dead Boundaries of a Strip along X direction (length)
+  static const Float_t fgkOverSpc;  // Space available for sensitive layers in radial direction (cm)
+
+  static const Float_t fgkDprecMin;//num.prec.tolerance on Thmin 
+  static const Float_t fgkDprecMax;//num.prec.tolerance on Thma 
+  static const Float_t fgkDprecCen;//num.prec.tolerance on <Theta> 
+
+  //Float_t *fAngles[kNPlates]; //Strip Tilt Angles
+  //Float_t *fHeights[kNPlates];//Strip heights
+
+  ClassDef(AliTOFGeometryV4,0) // TOF Geometry class
+};
+
+#endif
diff --git a/TOF/AliTOFGeometryV5.cxx b/TOF/AliTOFGeometryV5.cxx
new file mode 100644 (file)
index 0000000..f2447fd
--- /dev/null
@@ -0,0 +1,1467 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/*
+$Log$
+Revision 0.1  2005/07/19 G. Cara Romeo and A. De Caro
+        Modify Global methods IsInsideThePad & DistanceToPad
+               according to the new TOF geometry
+        Implement Global  methods GetPadDx & GetPadDy & GetPadDz
+        Implement Private methods Translation & Rotation & InverseRotation
+        Modify Global methods GetDetID & GetPlate & GetSector &
+                              GetStrip & GetPadX & GetPadZ
+               according to the new TOF geometry
+        Modify Global methods GetPos & GetX & GetY & GetZ
+               according to the new TOF geometry
+*/
+
+#include <stdlib.h>
+#include <Riostream.h>
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TOF Geometry class (new version)                                         //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliLog.h"
+#include "AliConst.h"
+#include "AliTOFGeometry.h"
+#include "AliTOFGeometryV5.h"
+
+ClassImp(AliTOFGeometryV5)
+
+const Int_t AliTOFGeometryV5::kNStripC      = 19;       // number of strips in C type module
+const Int_t AliTOFGeometryV5::kMaxNstrip    = 19;       // Max. number of strips
+
+const Float_t AliTOFGeometryV5::fgkZlenA    = 370.6*2.; // length (cm) of the A module
+const Float_t AliTOFGeometryV5::fgkZlenB    = 146.5;    // length (cm) of the B module
+const Float_t AliTOFGeometryV5::fgkZlenC    = 170.45;   // length (cm) of the C module
+const Float_t AliTOFGeometryV5::fgkMaxhZtof = 370.6;    // Max half z-size of TOF (cm)
+const Float_t AliTOFGeometryV5::fgkStripLength = 124.;  // Strip Length (rho X phi direction) (cm)
+
+const Float_t AliTOFGeometryV5::fgkxTOF     = 371.-0.01;// Inner radius of the TOF for Reconstruction (cm)
+const Float_t AliTOFGeometryV5::fgkRmin     = 370.-0.01;// Inner radius of the TOF (cm)
+const Float_t AliTOFGeometryV5::fgkRmax     = 399.-0.01;// Outer radius of the TOF (cm)
+
+//_____________________________________________________________________________
+AliTOFGeometryV5::AliTOFGeometryV5()
+  :AliTOFGeometry()
+{
+  //
+  // AliTOFGeometryV5 default constructor
+  //
+
+  AliTOFGeometry::kNStripC     = kNStripC;       // number of strips in C type module
+  AliTOFGeometry::kMaxNstrip   = kMaxNstrip;     // Max. number of strips
+
+  AliTOFGeometry::kZlenA       = fgkZlenA;       // length of the TOF supermodule (cm)
+  AliTOFGeometry::kZlenB       = fgkZlenB;       // length of the B module (cm)
+  AliTOFGeometry::kZlenC       = fgkZlenC;       // length of the C module (cm)
+  AliTOFGeometry::kMaxhZtof    = fgkMaxhZtof;    // Max half z-size of TOF supermodule (cm)
+  AliTOFGeometry::kStripLength = fgkStripLength; // Strip Length (rho X phi direction) (cm)
+
+  AliTOFGeometry::fgkxTOF   = fgkxTOF;           // Inner radius of the TOF for Reconstruction (cm)
+  AliTOFGeometry::fgkRmin   = fgkRmin;           // Inner radius of the TOF (cm)
+  AliTOFGeometry::fgkRmax   = fgkRmax;           // Outer radius of the TOF (cm)
+
+  Init();
+
+}
+
+//_____________________________________________________________________________
+AliTOFGeometryV5::~AliTOFGeometryV5()
+{
+  //
+  // AliTOFGeometryV5 destructor
+  //
+
+}
+//_____________________________________________________________________________
+void AliTOFGeometryV5::Init()
+{
+  //
+  // Initialize strip Tilt Angles, Heights and Distances
+  //
+  // Strips Tilt Angles
+  // For each strip to be positoned in FLTA/FLTB/FLTC,
+  // define 3 arrays containing:
+  //   the angle of the normal with respect to the Y axis of FLTA/FLTB/FLTC
+  //   the Y of the center with respect to the FLTA/FLTB/FLTC reference frame
+  //   the Z of the center with respect to the BT01/BT02/BT03 reference frame
+
+
+  Float_t const kangles[kNPlates][kMaxNstrip] ={
+    { 43.99,  43.20,  42.40,  41.59,  40.77,  39.94,  39.11,  38.25,  37.40,  36.53,
+      35.65,  34.76,  33.87,  32.96,  32.05,  31.13,  30.19,  29.24,  12.33},
+
+    { 27.26,  26.28,  25.30,  24.31,  23.31,  22.31,  21.30,  20.29,  19.26,  18.24,
+      17.20,  16.16,  15.11,  14.05,  13.00,  11.93,  10.87,   9.80,   8.74},
+
+    {  0.00,   6.30,   5.31,   4.25,   3.19,   2.12,   1.06,   0.00,  -1.06,  -2.12,
+      -3.19,  -4.25,  -5.31,  -6.30,   0.00,   0.00,   0.00,   0.00,   0.00},
+
+    { -8.74,  -9.80, -10.87, -11.93, -13.00, -14.05, -15.11, -16.16, -17.20, -18.24,
+     -19.26, -20.29, -21.30, -22.31, -23.31, -24.31, -25.30, -26.28, -27.26},
+    
+    {-12.33, -29.24, -30.19, -31.13, -32.05, -32.96, -33.87, -34.76, -35.65, -36.53,
+     -37.40, -38.25, -39.11, -39.94, -40.77, -41.59, -42.40, -43.20, -43.99}
+  };
+
+  Float_t const kheights[kNPlates][kMaxNstrip]= {
+    {-8.2,  -7.5,  -8.2,  -7.7,  -8.1,  -7.6,  -7.7,  -7.7,  -7.7,  -7.7,
+     -7.5,  -7.2,  -7.3,  -7.5,  -7.6,  -7.8,  -8.3,  -9.3,  -3.1},
+
+    {-7.9,  -8.1,  -8.5,  -9.0, -10.1,  -3.9,  -5.9,  -7.7, -10.1,  -3.6,
+     -5.8,  -8.0, -10.4,  -4.4,  -7.2, -10.2,  -4.6,  -7.4, -10.4},
+
+    {-2.5, -10.4,  -5.0,  -9.9,  -4.8,  -9.9,  -4.7, -10.2,  -4.7,  -9.9,
+     -4.8,  -9.9,  -5.0, -10.4,  -2.5,   0.0,   0.0,   0.0,   0.0},
+
+    {-10.4, -7.4,  -4.6, -10.2,  -7.2,  -4.4, -10.4,  -8.0,  -5.8,  -3.6,
+     -10.1,  -7.7, -5.9,  -3.9, -10.1,  -9.0,  -8.5,  -8.1,  -7.9},
+
+    { -3.1,  -9.3, -8.3,  -7.8,  -7.6,  -7.5,  -7.3,  -7.2,  -7.5,  -7.7,
+      -7.7,  -7.7, -7.7,  -7.6,  -8.1,  -7.7,  -8.2,  -7.5,  -8.2}
+  };
+
+
+  Float_t const kdistances[kNPlates][kMaxNstrip]= {
+    { 364.1,  354.9,  344.5,  335.4,  325.5,  316.6,  307.2,  298.0,  288.9,  280.0,
+      271.3,  262.7,  254.0,  244.8,  236.1,  227.7,  219.1,  210.3,  205.7},
+
+    { 194.2,  186.1,  177.9,  169.8,  161.5,  156.3,  147.8,  139.4,  130.9,  125.6,
+      117.3,  109.2,  101.1,   95.3,   87.1,   79.2,   73.0,   65.1,   57.6},
+
+    {  49.5,   41.3,   35.3,   27.8,   21.2,   13.9,    7.0,    0.0,   -7.0,  -13.9,
+      -21.2,  -27.8,  -35.3,  -41.3,  -49.5,    0.0,    0.0,    0.0,    0.0},
+
+    { -57.6,  -65.1,  -73.0,  -79.2,  -87.1,  -95.3, -101.1, -109.2, -117.3, -125.6,
+     -130.9, -139.4, -147.8, -156.3, -161.5, -169.8, -177.9, -186.1, -194.2},
+
+    {-205.7, -210.3, -219.1, -227.7, -236.1, -244.8, -254.0, -262.7, -271.3, -280.0,
+     -288.9, -298.0, -307.2, -316.6, -325.5, -335.4, -344.5, -354.9, -364.1}
+  };
+
+
+   for (Int_t iplate = 0; iplate < kNPlates; iplate++) AliTOFGeometry::fAngles[iplate] = new Float_t[kMaxNstrip];
+   for (Int_t iplate = 0; iplate < kNPlates; iplate++) AliTOFGeometry::fHeights[iplate] = new Float_t[kMaxNstrip];
+   for (Int_t iplate = 0; iplate < kNPlates; iplate++) AliTOFGeometry::fDistances[iplate] = new Float_t[kMaxNstrip];
+
+  for (Int_t iplate = 0; iplate < kNPlates; iplate++) {
+    for (Int_t istrip = 0; istrip < kMaxNstrip; istrip++) {
+      AliTOFGeometry::fAngles[iplate][istrip]   = kangles[iplate][istrip];
+      AliTOFGeometry::fHeights[iplate][istrip]  = kheights[iplate][istrip];
+      AliTOFGeometry::fDistances[iplate][istrip]= kdistances[iplate][istrip];
+    }
+  }
+
+}
+
+//_____________________________________________________________________________
+Float_t AliTOFGeometryV5::DistanceToPad(Int_t *det, Float_t *pos, Float_t *dist3d) 
+{
+//
+// Returns distance of  space point with coor pos (x,y,z) (cm) wrt 
+// pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) 
+//
+    
+  //Transform pos into Sector Frame
+
+  Float_t x = pos[0];
+  Float_t y = pos[1];
+  Float_t z = pos[2];
+
+  Float_t radius = TMath::Sqrt(x*x+y*y);
+  //Float_t phi=TMath::ATan(y/x);      
+  //if(phi<0) phi = k2PI+phi; //2.*TMath::Pi()+phi;
+  Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);       
+  //  Get the local angle in the sector philoc
+  Float_t angle   = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5)*fPhiSec;
+  Float_t xs = radius*TMath::Cos(angle/kRaddeg);
+  Float_t ys = radius*TMath::Sin(angle/kRaddeg);
+  Float_t zs = z;
+
+  // Do the same for the selected pad
+
+  Float_t g[3];
+  GetPos(det,g);
+
+  Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
+  //Float_t padPhi = TMath::ATan(g[1]/g[0]);   
+  //if(padPhi<0) padPhi = k2Pi + padPhi;
+  Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);      
+
+  //  Get the local angle in the sector philoc
+  Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
+  Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
+  Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
+  Float_t padzs = g[2];
+  
+  //Now move to local pad coordinate frame. Translate:
+  
+  Float_t xt = xs-padxs;
+  Float_t yt = ys-padys;
+  Float_t zt = zs-padzs;
+  //Now Rotate:
+  
+  Float_t alpha = GetAngles(det[1],det[2]);
+  Float_t xr =  xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
+  Float_t yr =  yt;
+  Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
+
+  Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
+
+  if (dist3d){
+    dist3d[0] = xr;
+    dist3d[1] = yr;
+    dist3d[2] = zr;
+  }
+
+  return dist;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTOFGeometryV5::IsInsideThePad(Int_t *det, Float_t *pos) 
+{
+//
+// Returns true if space point with coor pos (x,y,z) (cm) falls 
+// inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) 
+//
+
+  Bool_t isInside=false; 
+
+  /*
+  const Float_t khhony    = 1.0          ; // heigth of HONY  Layer
+  const Float_t khpcby    = 0.08         ; // heigth of PCB   Layer
+  const Float_t khrgly    = 0.055        ; // heigth of RED GLASS  Layer
+  const Float_t khglfy    = 0.285        ; // heigth of GLASS+FISHLINE  Layer
+  const Float_t khcpcby   = 0.16         ; // heigth of PCB  Central Layer
+  //const Float_t kwcpcbz   = 12.4         ; // z dimension of PCB  Central Layer
+  const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
+  //const Float_t kwstripz = kwcpcbz;
+  //const Float_t klstripx = fgkStripLength;
+  */
+
+  const Float_t khsensmy = 0.05;//0.05;//0.11;//0.16;//          // heigth of Sensitive Layer
+
+  //Transform pos into Sector Frame
+
+  Float_t x = pos[0];
+  Float_t y = pos[1];
+  Float_t z = pos[2];
+
+  Float_t radius = TMath::Sqrt(x*x+y*y);
+  Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);       
+
+  //  Get the local angle in the sector philoc
+  Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5) *fPhiSec;
+  Float_t xs = radius*TMath::Cos(angle/kRaddeg);
+  Float_t ys = radius*TMath::Sin(angle/kRaddeg);
+  Float_t zs = z;
+
+  // Do the same for the selected pad
+
+  Float_t g[3];
+  GetPos(det,g);
+
+  Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
+  Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);      
+
+  //  Get the local angle in the sector philoc
+  Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec; 
+  Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
+  Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
+  Float_t padzs = g[2];
+
+  //Now move to local pad coordinate frame. Translate:
+
+  Float_t xt = xs-padxs;
+  Float_t yt = ys-padys;
+  Float_t zt = zs-padzs;
+
+  //Now Rotate:
+
+  Float_t alpha = GetAngles(det[1],det[2]);
+  Float_t xr =  xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
+  Float_t yr =  yt;
+  Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
+
+  //if(TMath::Abs(xr)<=1.50*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5)) ???
+  if(TMath::Abs(xr)<=khsensmy*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
+  //if(TMath::Abs(xr)<=khstripy*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
+    isInside=true;
+  return isInside;
+
+}
+
+//_____________________________________________________________________________
+Float_t AliTOFGeometryV5::GetX(Int_t *det)
+{
+  //
+  // Returns X coordinate (cm)
+  //
+
+  Int_t isector = det[0];
+  Int_t iplate  = det[1];
+  Int_t istrip  = det[2];
+  Int_t ipadz   = det[3];
+  Int_t ipadx   = det[4];
+
+  /*
+  // Find out distance d on the plane wrt median phi:
+  Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
+
+  // The radius r in xy plane:
+  //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
+  //  (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
+  Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
+    (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
+
+  // local azimuthal angle in the sector philoc
+  Float_t philoc  = TMath::ATan(d/r);
+  //if(philoc<0.) philoc = k2PI + philoc;
+
+  // azimuthal angle in the global frame  phi
+  Float_t phi   = philoc*kRaddeg+(isector+0.5)*fPhiSec;
+
+  Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
+  */
+
+  // Pad reference frame -> FSTR reference frame
+  //  /*
+  Float_t posLocal[3] = {0., 0., 0.};
+  Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
+  Translation(posLocal,step);
+
+  step[0] = kNpadX*0.5*fgkXPad;
+  step[1] = 0.;
+  step[2] = kNpadZ*0.5*fgkZPad;
+  //  */
+  /*
+  Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
+  Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
+  */
+  Translation(posLocal,step);
+
+  // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
+  Double_t angles[6];
+  if      (GetAngles(iplate,istrip) >0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] = GetAngles(iplate,istrip);
+    angles[5] = 90.;
+  }
+  else if (GetAngles(iplate,istrip)==0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.;
+    angles[3] = 90.;
+    angles[4] =  0;
+    angles[5] =  0.;
+  }
+  else if (GetAngles(iplate,istrip) <0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] =-GetAngles(iplate,istrip);
+    angles[5] = 270.;
+  }
+
+  InverseRotation(posLocal,angles);
+
+  step[0] = 0.;
+  step[1] = -GetHeights(iplate,istrip);
+  step[2] =  GetDistances(iplate,istrip);
+  Translation(posLocal,step);
+
+  // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
+  angles[0] = 90.;
+  angles[1] =  0.;
+  angles[2] =  0.;
+  angles[3] =  0.;
+  angles[4] = 90.;
+  angles[5] =270.;
+
+  InverseRotation(posLocal,angles);
+
+  // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
+  step[0] = 0.;
+  step[1] = 0.;
+  step[2] = -((fgkRmax+fgkRmin)*0.5);
+  Translation(posLocal,step);
+
+  angles[0] = 90.;
+  angles[1] = 90.+(isector+0.5)*fPhiSec;
+  angles[2] = 0.;
+  angles[3] = 0.;
+  angles[4] = 90.;
+  angles[5] = (isector+0.5)*fPhiSec;
+
+  InverseRotation(posLocal,angles);
+
+  Float_t xCoor = posLocal[0];
+
+  return xCoor;
+
+}
+//_____________________________________________________________________________
+Float_t AliTOFGeometryV5::GetY(Int_t *det)
+{
+  //
+  // Returns Y coordinate (cm)
+  //
+
+  Int_t isector = det[0];
+  Int_t iplate  = det[1];
+  Int_t istrip  = det[2];
+  Int_t ipadz   = det[3];
+  Int_t ipadx   = det[4];
+
+  /*
+  // Find out distance d on the plane wrt median phi:
+  Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
+
+  // The radius r in xy plane:
+  //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
+  //  (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
+  Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
+    (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
+
+  // local azimuthal angle in the sector philoc
+  Float_t philoc = TMath::ATan(d/r);
+  //if(philoc<0.) philoc = k2PI + philoc;
+
+  // azimuthal angle in the global frame  phi
+  Float_t phi   = philoc*kRaddeg+(isector+0.5)*fPhiSec;
+
+  Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
+  */
+
+  // Pad reference frame -> FSTR reference frame
+  //  /*
+  Float_t posLocal[3] = {0., 0., 0.};
+  Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
+  Translation(posLocal,step);
+
+  step[0] = kNpadX*0.5*fgkXPad;
+  step[1] = 0.;
+  step[2] = kNpadZ*0.5*fgkZPad;
+  //  */
+  /*
+  Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
+  Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
+  */
+  Translation(posLocal,step);
+
+  // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
+
+  Double_t angles[6];
+  if      (GetAngles(iplate,istrip) >0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] = GetAngles(iplate,istrip);
+    angles[5] = 90.;
+  }
+  else if (GetAngles(iplate,istrip)==0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.;
+    angles[3] = 90.;
+    angles[4] =  0;
+    angles[5] =  0.;
+  }
+  else if (GetAngles(iplate,istrip) <0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] =-GetAngles(iplate,istrip);
+    angles[5] = 270.;
+  }
+
+  InverseRotation(posLocal,angles);
+
+  step[0] = 0.;
+  step[1] = -GetHeights(iplate,istrip);
+  step[2] =  GetDistances(iplate,istrip);
+  Translation(posLocal,step);
+
+  // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
+  angles[0] = 90.;
+  angles[1] =  0.;
+  angles[2] =  0.;
+  angles[3] =  0.;
+  angles[4] = 90.;
+  angles[5] =270.;
+
+  InverseRotation(posLocal,angles);
+
+  // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
+  step[0] = 0.;
+  step[1] = 0.;
+  step[2] = -((fgkRmax+fgkRmin)*0.5);
+  Translation(posLocal,step);
+
+  angles[0] = 90.;
+  angles[1] = 90.+(isector+0.5)*fPhiSec;
+  angles[2] = 0.;
+  angles[3] = 0.;
+  angles[4] = 90.;
+  angles[5] = (isector+0.5)*fPhiSec;
+
+  InverseRotation(posLocal,angles);
+
+  Float_t yCoor = posLocal[1];
+
+  return yCoor;
+
+}
+
+//_____________________________________________________________________________
+Float_t AliTOFGeometryV5::GetZ(Int_t *det)
+{
+  //
+  // Returns Z coordinate (cm)
+  //
+
+  Int_t isector = det[0];
+  Int_t iplate  = det[1];
+  Int_t istrip  = det[2];
+  Int_t ipadz   = det[3];
+  Int_t ipadx   = det[4];
+
+  /*
+  Float_t zCoor = GetDistances(iplate,istrip) +
+    (0.5-ipadz) * fgkZPad * TMath::Cos(GetAngles(iplate,istrip)*kDegrad);
+  */
+
+  // Pad reference frame -> FSTR reference frame
+  //  /*
+  Float_t posLocal[3] = {0., 0., 0.};
+  Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
+  Translation(posLocal,step);
+
+  step[0] = kNpadX*0.5*fgkXPad;
+  step[1] = 0.;
+  step[2] = kNpadZ*0.5*fgkZPad;
+  //  */
+  /*
+  Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
+  Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
+  */
+  Translation(posLocal,step);
+
+  // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
+  Double_t angles[6];
+  if      (GetAngles(iplate,istrip) >0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] = GetAngles(iplate,istrip);
+    angles[5] = 90.;
+  }
+  else if (GetAngles(iplate,istrip)==0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.;
+    angles[3] = 90.;
+    angles[4] =  0;
+    angles[5] =  0.;
+  }
+  else if (GetAngles(iplate,istrip) <0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] =-GetAngles(iplate,istrip);
+    angles[5] = 270.;
+  }
+
+  InverseRotation(posLocal,angles);
+
+  step[0] = 0.;
+  step[1] = -GetHeights(iplate,istrip);
+  step[2] =  GetDistances(iplate,istrip);
+  Translation(posLocal,step);
+
+  // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
+  angles[0] = 90.;
+  angles[1] =  0.;
+  angles[2] =  0.;
+  angles[3] =  0.;
+  angles[4] = 90.;
+  angles[5] =270.;
+
+  InverseRotation(posLocal,angles);
+
+  // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
+  step[0] = 0.;
+  step[1] = 0.;
+  step[2] = -((fgkRmax+fgkRmin)*0.5);
+  Translation(posLocal,step);
+
+  angles[0] = 90.;
+  angles[1] = 90.+(isector+0.5)*fPhiSec;
+  angles[2] = 0.;
+  angles[3] = 0.;
+  angles[4] = 90.;
+  angles[5] = (isector+0.5)*fPhiSec;
+
+  InverseRotation(posLocal,angles);
+
+  Float_t zCoor = posLocal[2];
+
+  return zCoor;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTOFGeometryV5::GetSector(Float_t *pos) 
+{
+  //
+  // Returns the Sector index 
+  //
+
+  //const Float_t khAlWall = 0.1;
+  //const Float_t kModuleWallThickness = 0.3;
+
+  Int_t   iSect = -1; 
+
+  Float_t x = pos[0];
+  Float_t y = pos[1];
+  Float_t z = pos[2];
+
+  Float_t rho = TMath::Sqrt(x*x + y*y);
+
+  //if (!((z>=-fgkMaxhZtof && z<=fgkMaxhZtof) &&
+  if (!((z>=-fgkZlenA*0.5 && z<=fgkZlenA*0.5) &&
+       (rho>=(fgkRmin) && rho<=(fgkRmax)))) {
+    //(rho>=(fgkRmin-0.05)+kModuleWallThickness && rho<=(fgkRmax-0.05)-kModuleWallThickness-khAlWall-kModuleWallThickness))) {
+    //AliError("Detector Index could not be determined");
+    return iSect;
+  }
+
+  Float_t phi = TMath::Pi() + TMath::ATan2(-y,-x);     
+
+  iSect  = (Int_t) (phi*kRaddeg/fPhiSec);
+  
+  return iSect;
+
+}
+//_____________________________________________________________________________
+
+Int_t AliTOFGeometryV5::GetPlate(Float_t *pos)
+{
+  //
+  // Returns the Plate index 
+  //
+  const Float_t kInterCentrModBorder1 = 49.5;
+  const Float_t kInterCentrModBorder2 = 57.5;
+  const Float_t kExterInterModBorder1 = 196.0;
+  const Float_t kExterInterModBorder2 = 203.5;
+
+  const Float_t kLengthExInModBorder  = 4.7;
+  const Float_t kLengthInCeModBorder  = 7.0;
+
+  //const Float_t khAlWall = 0.1;
+  const Float_t kModuleWallThickness = 0.3;
+  //const Float_t kHoneycombLayerThickness = 1.5;
+
+  Int_t iPlate=-1;
+
+  Float_t posLocal[3];
+  for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
+
+  Int_t isector = GetSector(posLocal);
+  if(isector == -1){
+    //AliError("Detector Index could not be determined");
+    return iPlate;
+  }
+
+  // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
+  Double_t angles[6] = 
+    {90., 90.+(isector+0.5)*fPhiSec,
+      0., 0.,
+     90., (isector+0.5)*fPhiSec
+    };
+  Rotation(posLocal,angles);
+
+  Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
+  Translation(posLocal,step);
+
+  // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
+  angles[0] = 90.;
+  angles[1] =  0.;
+  angles[2] =  0.;
+  angles[3] =  0.;
+  angles[4] = 90.;
+  angles[5] =270.;
+
+  Rotation(posLocal,angles);
+
+  Float_t yLocal = posLocal[1];
+  Float_t zLocal = posLocal[2];
+
+  Float_t deltaRhoLoc  = (fgkRmax-fgkRmin)*0.5 - kModuleWallThickness + yLocal;
+  Float_t deltaZetaLoc = TMath::Abs(zLocal);
+
+  Float_t deltaRHOmax = 0.;
+
+  if (TMath::Abs(zLocal)>=kExterInterModBorder1 && TMath::Abs(zLocal)<=kExterInterModBorder2) 
+    {
+      deltaRhoLoc -= kLengthExInModBorder;
+      deltaZetaLoc = kExterInterModBorder2-deltaZetaLoc;
+      deltaRHOmax  = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthExInModBorder; // old 5.35, new 4.8
+
+      if (deltaRhoLoc > deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) {
+       if (zLocal<0) iPlate = 0;
+       else iPlate = 4;
+      }
+      else {
+       if (zLocal<0) iPlate = 1;
+       else iPlate = 3;
+      }
+    }
+  else if (TMath::Abs(zLocal)>=kInterCentrModBorder1 && TMath::Abs(zLocal)<=kInterCentrModBorder2) 
+    {
+      deltaRhoLoc -= kLengthInCeModBorder;
+      deltaZetaLoc = deltaZetaLoc-kInterCentrModBorder1;
+      deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthInCeModBorder; // old 0.39, new 0.2
+
+      if (deltaRhoLoc>deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) iPlate = 2;
+      else {
+       if (zLocal<0) iPlate = 1;
+       else iPlate = 3;
+      }
+    }
+
+  if      (zLocal>-fgkZlenA*0.5/*fgkMaxhZtof*/ && zLocal<-kExterInterModBorder2)       iPlate = 0;
+  else if (zLocal>-kExterInterModBorder1       && zLocal<-kInterCentrModBorder2)       iPlate = 1;
+  else if (zLocal>-kInterCentrModBorder1       && zLocal< kInterCentrModBorder1)       iPlate = 2;
+  else if (zLocal> kInterCentrModBorder2       && zLocal< kExterInterModBorder1)       iPlate = 3;
+  else if (zLocal> kExterInterModBorder2       && zLocal< fgkZlenA*0.5/*fgkMaxhZtof*/) iPlate = 4;
+  
+  return iPlate;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTOFGeometryV5::GetStrip(Float_t *pos)
+{
+  //
+  // Returns the Strip index 
+  //
+  const Float_t khhony    = 1.0          ; // heigth of HONY  Layer
+  const Float_t khpcby    = 0.08         ; // heigth of PCB   Layer
+  const Float_t khrgly    = 0.055        ; // heigth of RED GLASS  Layer
+  const Float_t khglfy    = 0.285        ; // heigth of GLASS+FISHLINE  Layer
+  const Float_t khcpcby   = 0.16         ; // heigth of PCB  Central Layer
+  const Float_t kwcpcbz   = 12.4         ; // z dimension of PCB  Central Layer
+  const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
+  const Float_t kwstripz = kwcpcbz;
+  const Float_t klstripx = fgkStripLength;
+  
+  Int_t iStrip=-1;
+   
+  Float_t posLocal[3];
+  for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
+  Int_t isector = GetSector(posLocal);
+  if(isector == -1){
+    //AliError("Detector Index could not be determined");
+    return iStrip;}
+  Int_t iplate =  GetPlate(posLocal);
+  if(iplate == -1){
+    //AliError("Detector Index could not be determined");
+    return iStrip;} 
+
+  Int_t nstrips=0;
+  switch (iplate) {
+  case 0:
+    nstrips=kNStripC;
+    break;
+  case 4:
+    nstrips=kNStripC;
+    break;
+  case 1:
+    nstrips=kNStripB;
+    break;
+  case 3:
+    nstrips=kNStripB;
+    break;
+  case 2:
+    nstrips=kNStripA;
+    break;
+  }
+  
+  // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
+  Double_t angles[6] = 
+    {90., 90.+(isector+0.5)*fPhiSec,
+      0., 0.,
+     90., (isector+0.5)*fPhiSec
+    };
+  Rotation(posLocal,angles);
+
+  Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
+  Translation(posLocal,step);
+
+  // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
+  angles[0] = 90.;
+  angles[1] =  0.;
+  angles[2] =  0.;
+  angles[3] =  0.;
+  angles[4] = 90.;
+  angles[5] =270.;
+
+  Rotation(posLocal,angles);
+
+  // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
+  Int_t totStrip=0;
+  for (Int_t istrip=0; istrip<nstrips; istrip++){
+
+    Float_t posLoc2[3]={posLocal[0],posLocal[1],posLocal[2]};        
+
+    step[0] = 0.;
+    step[1] = GetHeights(iplate,istrip);
+    step[2] = -GetDistances(iplate,istrip);
+    Translation(posLoc2,step);
+
+    if      (GetAngles(iplate,istrip) >0.) {
+      angles[0] = 90.;
+      angles[1] =  0.;
+      angles[2] = 90.+GetAngles(iplate,istrip);
+      angles[3] = 90.;
+      angles[4] = GetAngles(iplate,istrip);
+      angles[5] = 90.;
+    }
+    else if (GetAngles(iplate,istrip)==0.) {
+      angles[0] = 90.;
+      angles[1] =  0.;
+      angles[2] = 90.;
+      angles[3] = 90.;
+      angles[4] =  0;
+      angles[5] =  0.;
+    }
+    else if (GetAngles(iplate,istrip) <0.) {
+      angles[0] = 90.;
+      angles[1] =  0.;
+      angles[2] = 90.+GetAngles(iplate,istrip);
+      angles[3] = 90.;
+      angles[4] =-GetAngles(iplate,istrip);
+      angles[5] = 270.;
+    }
+    Rotation(posLoc2,angles);
+
+    if ((TMath::Abs(posLoc2[0])<=klstripx*0.5) &&
+       (TMath::Abs(posLoc2[1])<=khstripy*0.5) &&
+       (TMath::Abs(posLoc2[2])<=kwstripz*0.5)) {
+      iStrip = istrip;
+      totStrip++;
+      for (Int_t jj=0; jj<3; jj++) posLocal[jj]=posLoc2[jj];
+      //AliInfo(Form(" posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ", posLocal[0],posLocal[1],posLocal[2]));
+
+      //AliInfo(Form(" GetAngles(%1i,%2i) = %f, pos[0] = %f, pos[1] = %f, pos[2] = %f", iplate, istrip, GetAngles(iplate,istrip), pos[0], pos[1], pos[2]));
+      break;
+    }
+
+    if (totStrip>1) AliInfo(Form("total strip number found %2i",totStrip));
+
+  }
+
+  return iStrip;
+  
+}
+//_____________________________________________________________________________
+Int_t AliTOFGeometryV5::GetPadZ(Float_t *pos)
+{
+  //
+  // Returns the Pad index along Z 
+  //
+  //const Float_t klsensmx = kNpadX*fgkXPad;  // length of Sensitive Layer
+  //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
+  //const Float_t kwsensmz = kNpadZ*fgkZPad;  // width of Sensitive Layer
+
+  Int_t iPadZ = -1;
+
+  Float_t posLocal[3];
+  for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
+  Int_t isector = GetSector(posLocal);
+  if(isector == -1){
+    //AliError("Detector Index could not be determined");
+    return iPadZ;}
+  Int_t iplate =  GetPlate(posLocal);
+  if(iplate == -1){
+    //AliError("Detector Index could not be determined");
+    return iPadZ;}
+  Int_t istrip =  GetStrip(posLocal);
+  if(istrip == -1){
+    //AliError("Detector Index could not be determined");
+    return iPadZ;}
+
+  // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
+  Double_t angles[6] = 
+    {90., 90.+(isector+0.5)*fPhiSec,
+      0., 0.,
+     90., (isector+0.5)*fPhiSec
+    };
+  Rotation(posLocal,angles);
+
+  Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
+  Translation(posLocal,step);
+
+  // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
+  angles[0] = 90.;
+  angles[1] =  0.;
+  angles[2] =  0.;
+  angles[3] =  0.;
+  angles[4] = 90.;
+  angles[5] =270.;
+
+  Rotation(posLocal,angles);
+
+  // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
+  step[0] = 0.;
+  step[1] = GetHeights(iplate,istrip);
+  step[2] = -GetDistances(iplate,istrip);
+  Translation(posLocal,step);
+
+  if      (GetAngles(iplate,istrip) >0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] = GetAngles(iplate,istrip);
+    angles[5] = 90.;
+  }
+  else if (GetAngles(iplate,istrip)==0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.;
+    angles[3] = 90.;
+    angles[4] =  0;
+    angles[5] =  0.;
+  }
+  else if (GetAngles(iplate,istrip) <0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] =-GetAngles(iplate,istrip);
+    angles[5] = 270.;
+  }
+  Rotation(posLocal,angles);
+
+  //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
+  //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
+
+    step[0] =-0.5*kNpadX*fgkXPad;
+    step[1] = 0.;
+    step[2] =-0.5*kNpadZ*fgkZPad;
+    Translation(posLocal,step);
+
+    iPadZ = (Int_t)(posLocal[2]/fgkZPad);
+    if (iPadZ==kNpadZ) iPadZ--;
+    else if (iPadZ>kNpadZ) iPadZ=-1;
+
+  //}
+  // else AliError("Detector Index could not be determined");
+
+  return iPadZ;
+
+}
+//_____________________________________________________________________________
+Int_t AliTOFGeometryV5::GetPadX(Float_t *pos)
+{
+  //
+  // Returns the Pad index along X 
+  //
+  //const Float_t klsensmx = kNpadX*fgkXPad;  // length of Sensitive Layer
+  //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
+  //const Float_t kwsensmz = kNpadZ*fgkZPad;  // width of Sensitive Layer
+
+  Int_t iPadX  = -1;
+
+  Float_t posLocal[3];
+  for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
+  Int_t isector = GetSector(posLocal);
+  if(isector == -1){
+    //AliError("Detector Index could not be determined");
+    return iPadX;}
+  Int_t iplate =  GetPlate(posLocal);
+  if(iplate == -1){
+    //AliError("Detector Index could not be determined");
+    return iPadX;} 
+  Int_t istrip =  GetStrip(posLocal);
+  if(istrip == -1){  
+    //AliError("Detector Index could not be determined");
+    return iPadX;}
+
+  // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
+  Double_t angles[6] = 
+    {90., 90.+(isector+0.5)*fPhiSec,
+      0.,  0.,
+     90., (isector+0.5)*fPhiSec
+    };
+  Rotation(posLocal,angles);
+
+  Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
+  Translation(posLocal,step);
+
+  // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
+  angles[0] = 90.;
+  angles[1] =  0.;
+  angles[2] =  0.;
+  angles[3] =  0.;
+  angles[4] = 90.;
+  angles[5] =270.;
+
+  Rotation(posLocal,angles);
+
+  // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
+  step[0] = 0.;
+  step[1] = GetHeights(iplate,istrip);
+  step[2] = -GetDistances(iplate,istrip);
+  Translation(posLocal,step);
+
+  if      (GetAngles(iplate,istrip) >0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] = GetAngles(iplate,istrip);
+    angles[5] = 90.;
+  }
+  else if (GetAngles(iplate,istrip)==0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.;
+    angles[3] = 90.;
+    angles[4] =  0;
+    angles[5] =  0.;
+  }
+  else if (GetAngles(iplate,istrip) <0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] =-GetAngles(iplate,istrip);
+    angles[5] = 270.;
+  }
+  Rotation(posLocal,angles);
+
+  //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
+  //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
+
+    step[0] =-0.5*kNpadX*fgkXPad;
+    step[1] = 0.;
+    step[2] =-0.5*kNpadZ*fgkZPad;
+    Translation(posLocal,step);
+
+    iPadX = (Int_t)(posLocal[0]/fgkXPad);
+    if (iPadX==kNpadX) iPadX--;
+    else if (iPadX>kNpadX) iPadX=-1;
+
+  //}
+  //else AliError("Detector Index could not be determined");
+
+  return iPadX;
+
+}
+//_____________________________________________________________________________
+
+Float_t AliTOFGeometryV5::GetPadDx(Float_t *pos)
+{
+  //
+  // Returns the x coordinate in the Pad reference frame
+  //
+
+  Float_t xpad = -2.;
+
+  Float_t posLocal[3];
+  for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
+  Int_t isector = GetSector(posLocal);
+  if(isector == -1){
+    //AliError("Detector Index could not be determined");
+    return xpad;}
+  Int_t iplate =  GetPlate(posLocal);
+  if(iplate == -1){
+    //AliError("Detector Index could not be determined");
+    return xpad;} 
+  Int_t istrip =  GetStrip(posLocal);
+  if(istrip == -1){  
+    //AliError("Detector Index could not be determined");
+    return xpad;}
+  Int_t ipadz =  GetPadZ(posLocal);
+  if(ipadz == -1){  
+    //AliError("Detector Index could not be determined");
+    return xpad;}
+  Int_t ipadx =  GetPadX(posLocal);
+  if(ipadx == -1){
+    //AliError("Detector Index could not be determined");
+    return xpad;}
+
+  // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
+  Double_t angles[6] = 
+    {90., 90.+(isector+0.5)*fPhiSec,
+      0.,  0.,
+     90., (isector+0.5)*fPhiSec
+    };
+  Rotation(posLocal,angles);
+
+  Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
+  Translation(posLocal,step);
+
+  // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
+  angles[0] = 90.;
+  angles[1] =  0.;
+  angles[2] =  0.;
+  angles[3] =  0.;
+  angles[4] = 90.;
+  angles[5] =270.;
+
+  Rotation(posLocal,angles);
+
+  // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
+  step[0] = 0.;
+  step[1] = GetHeights(iplate,istrip);
+  step[2] = -GetDistances(iplate,istrip);
+  Translation(posLocal,step);
+
+  if      (GetAngles(iplate,istrip) >0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] = GetAngles(iplate,istrip);
+    angles[5] = 90.;
+  }
+  else if (GetAngles(iplate,istrip)==0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.;
+    angles[3] = 90.;
+    angles[4] =  0;
+    angles[5] =  0.;
+  }
+  else if (GetAngles(iplate,istrip) <0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] =-GetAngles(iplate,istrip);
+    angles[5] = 270.;
+  }
+  Rotation(posLocal,angles);
+
+  step[0] =-0.5*kNpadX*fgkXPad;
+  step[1] = 0.;
+  step[2] =-0.5*kNpadZ*fgkZPad;
+  Translation(posLocal,step);
+
+  step[0] = (ipadx+0.5)*fgkXPad;
+  step[1] = 0.;
+  step[2] = (ipadz+0.5)*fgkZPad;
+  Translation(posLocal,step);
+  
+  xpad=posLocal[0];
+
+  return xpad;
+
+}
+//_____________________________________________________________________________
+Float_t AliTOFGeometryV5::GetPadDy(Float_t *pos)
+{
+  //
+  // Returns the x coordinate in the Pad reference frame
+  //
+
+  Float_t ypad = -2.;
+
+  Float_t posLocal[3];
+  for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
+  Int_t isector = GetSector(posLocal);
+  if(isector == -1){
+    //AliError("Detector Index could not be determined");
+    return ypad;}
+  Int_t iplate =  GetPlate(posLocal);
+  if(iplate == -1){
+    //AliError("Detector Index could not be determined");
+    return ypad;} 
+  Int_t istrip =  GetStrip(posLocal);
+  if(istrip == -1){  
+    //AliError("Detector Index could not be determined");
+    return ypad;}
+  Int_t ipadz =  GetPadZ(posLocal);
+  if(ipadz == -1){  
+    //AliError("Detector Index could not be determined");
+    return ypad;}
+  Int_t ipadx =  GetPadX(posLocal);
+  if(ipadx == -1){
+    //AliError("Detector Index could not be determined");
+    return ypad;}
+
+  // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
+  Double_t angles[6] = 
+    {90., 90.+(isector+0.5)*fPhiSec,
+      0.,  0.,
+     90., (isector+0.5)*fPhiSec
+    };
+  Rotation(posLocal,angles);
+
+  Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
+  Translation(posLocal,step);
+
+  // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
+  angles[0] = 90.;
+  angles[1] =  0.;
+  angles[2] =  0.;
+  angles[3] =  0.;
+  angles[4] = 90.;
+  angles[5] =270.;
+
+  Rotation(posLocal,angles);
+
+  // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
+  step[0] = 0.;
+  step[1] = GetHeights(iplate,istrip);
+  step[2] = -GetDistances(iplate,istrip);
+  Translation(posLocal,step);
+
+  if      (GetAngles(iplate,istrip) >0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] = GetAngles(iplate,istrip);
+    angles[5] = 90.;
+  }
+  else if (GetAngles(iplate,istrip)==0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.;
+    angles[3] = 90.;
+    angles[4] =  0;
+    angles[5] =  0.;
+  }
+  else if (GetAngles(iplate,istrip) <0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] =-GetAngles(iplate,istrip);
+    angles[5] = 270.;
+  }
+  Rotation(posLocal,angles);
+
+  step[0] =-0.5*kNpadX*fgkXPad;
+  step[1] = 0.;
+  step[2] =-0.5*kNpadZ*fgkZPad;
+  Translation(posLocal,step);
+  
+  step[0] = (ipadx+0.5)*fgkXPad;
+  step[1] = 0.;
+  step[2] = (ipadz+0.5)*fgkZPad;
+  Translation(posLocal,step);
+  
+  ypad=posLocal[1];
+  
+  return ypad;
+
+}
+//_____________________________________________________________________________
+Float_t AliTOFGeometryV5::GetPadDz(Float_t *pos)
+{
+  //
+  // Returns the x coordinate in the Pad reference frame
+  //
+
+  Float_t zpad = -2.;
+
+  Float_t posLocal[3];
+  for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
+  Int_t isector = GetSector(posLocal);
+  if(isector == -1){
+    //AliError("Detector Index could not be determined");
+    return zpad;}
+  Int_t iplate =  GetPlate(posLocal);
+  if(iplate == -1){
+    //AliError("Detector Index could not be determined");
+    return zpad;} 
+  Int_t istrip =  GetStrip(posLocal);
+  if(istrip == -1){  
+    //AliError("Detector Index could not be determined");
+    return zpad;}
+  Int_t ipadz =  GetPadZ(posLocal);
+  if(ipadz == -1){  
+    //AliError("Detector Index could not be determined");
+    return zpad;}
+  Int_t ipadx =  GetPadX(posLocal);
+  if(ipadx == -1){
+    //AliError("Detector Index could not be determined");
+    return zpad;}
+
+  // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
+  Double_t angles[6] = 
+    {90., 90.+(isector+0.5)*fPhiSec,
+      0.,  0.,
+     90., (isector+0.5)*fPhiSec
+    };
+  Rotation(posLocal,angles);
+
+  Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
+  Translation(posLocal,step);
+
+  // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
+  angles[0] = 90.;
+  angles[1] =  0.;
+  angles[2] =  0.;
+  angles[3] =  0.;
+  angles[4] = 90.;
+  angles[5] =270.;
+
+  Rotation(posLocal,angles);
+
+  // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
+  step[0] = 0.;
+  step[1] = GetHeights(iplate,istrip);
+  step[2] = -GetDistances(iplate,istrip);
+  Translation(posLocal,step);
+
+  if      (GetAngles(iplate,istrip) >0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] = GetAngles(iplate,istrip);
+    angles[5] = 90.;
+  }
+  else if (GetAngles(iplate,istrip)==0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.;
+    angles[3] = 90.;
+    angles[4] =  0;
+    angles[5] =  0.;
+  }
+  else if (GetAngles(iplate,istrip) <0.) {
+    angles[0] = 90.;
+    angles[1] =  0.;
+    angles[2] = 90.+GetAngles(iplate,istrip);
+    angles[3] = 90.;
+    angles[4] =-GetAngles(iplate,istrip);
+    angles[5] = 270.;
+  }
+  Rotation(posLocal,angles);
+
+  step[0] =-0.5*kNpadX*fgkXPad;
+  step[1] = 0.;
+  step[2] =-0.5*kNpadZ*fgkZPad;
+  Translation(posLocal,step);
+  
+  step[0] = (ipadx+0.5)*fgkXPad;
+  step[1] = 0.;
+  step[2] = (ipadz+0.5)*fgkZPad;
+  Translation(posLocal,step);
+
+  zpad=posLocal[2];
+
+  return zpad;
+
+}
+//_____________________________________________________________________________
+
+void AliTOFGeometryV5::Translation(Float_t *xyz, Float_t translationVector[3])
+{
+
+  Int_t ii=0;
+
+  for (ii=0; ii<3; ii++)
+    xyz[ii] -= translationVector[ii];
+
+  return;
+
+}
+//_____________________________________________________________________________
+
+void AliTOFGeometryV5::Rotation(Float_t *xyz, Double_t rotationAngles[6])
+{
+
+  Int_t ii=0;
+  /*
+  TRotMatrix *matrix = new TRotMatrix("matrix","matrix", angles[0], angles[1],
+                                     angles[2], angles[3],
+                                     angles[4], angles[5]);
+  */
+
+  for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
+
+  Float_t xyzDummy[3] = {0., 0., 0.};
+
+  for (ii=0; ii<3; ii++) {
+    xyzDummy[ii] =
+      xyz[0]*TMath::Sin(rotationAngles[2*ii])*TMath::Cos(rotationAngles[2*ii+1]) +
+      xyz[1]*TMath::Sin(rotationAngles[2*ii])*TMath::Sin(rotationAngles[2*ii+1]) +
+      xyz[2]*TMath::Cos(rotationAngles[2*ii]);
+  }
+
+  for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
+
+  return;
+
+}
+//_____________________________________________________________________________
+void AliTOFGeometryV5::InverseRotation(Float_t *xyz, Double_t rotationAngles[6])
+{
+
+  Int_t ii=0;
+
+  for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
+
+  Float_t xyzDummy[3] = {0., 0., 0.};
+
+  xyzDummy[0] =
+    xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Cos(rotationAngles[1]) +
+    xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Cos(rotationAngles[3]) +
+    xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Cos(rotationAngles[5]);
+  
+  xyzDummy[1] =
+    xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Sin(rotationAngles[1]) +
+    xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Sin(rotationAngles[3]) +
+    xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Sin(rotationAngles[5]);
+  
+  xyzDummy[2] =
+    xyz[0]*TMath::Cos(rotationAngles[0]) +
+    xyz[1]*TMath::Cos(rotationAngles[2]) +
+    xyz[2]*TMath::Cos(rotationAngles[4]);
+  
+  for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
+
+  return;
+
+}
+//_____________________________________________________________________________
diff --git a/TOF/AliTOFGeometryV5.h b/TOF/AliTOFGeometryV5.h
new file mode 100644 (file)
index 0000000..917cbdf
--- /dev/null
@@ -0,0 +1,85 @@
+#ifndef ALITOFGEOMETRYV5_H
+#define ALITOFGEOMETRYV5_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TOF geometry class (new version)                                         //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+
+#include "AliTOFGeometry.h"
+
+class AliTOFGeometryV5: public AliTOFGeometry {
+
+ public:
+  AliTOFGeometryV5();
+  virtual ~AliTOFGeometryV5();
+  
+  void    Init();
+  Bool_t  IsInsideThePad(Int_t *det, Float_t *pos); 
+  Float_t DistanceToPad(Int_t *det, Float_t *pos, Float_t *dist3d=0);
+  Int_t   GetPlate(Float_t *pos);
+  Int_t   GetStrip(Float_t *pos);
+  Int_t   GetSector(Float_t *pos);
+  Int_t   GetPadX(Float_t *pos);
+  Int_t   GetPadZ(Float_t *pos);
+  Float_t GetX(Int_t *det);
+  Float_t GetY(Int_t *det);
+  Float_t GetZ(Int_t *det);
+  Float_t GetPadDx(Float_t *pos);
+  Float_t GetPadDy(Float_t *pos);
+  Float_t GetPadDz(Float_t *pos);
+  //Float_t GetAngles(Int_t iplate, Int_t istrip)  const {return fAngles[iplate][istrip];};
+  //Float_t GetHeights(Int_t iplate, Int_t istrip) const {return fHeights[iplate][istrip];};
+  //Float_t GetDistances(Int_t iplate, Int_t istrip) const {return fDistances[iplate][istrip];};
+
+  Float_t NStirpC()     { return kNStripC;};
+  Int_t   NMaxNstrip()  { return kMaxNstrip;};
+  Int_t   NPadXSector() { return (AliTOFGeometry::kNStripA + 2*AliTOFGeometry::kNStripB +
+                                 2*kNStripC)*AliTOFGeometry::kNpadX*AliTOFGeometry::kNpadZ;};
+
+  Float_t RinTOF()      { return fgkxTOF;};
+  Float_t Rmin()        { return fgkRmin;};
+  Float_t Rmax()        { return fgkRmax;};
+
+  Float_t ZlenA()       { return fgkZlenA;};
+  Float_t ZlenB()       { return fgkZlenB;};
+  Float_t ZlenC()       { return fgkZlenC;};
+  Float_t MaxhZtof()    { return fgkMaxhZtof;};
+  Float_t StripLength() { return fgkStripLength;};
+
+  void Translation(Float_t *xyz, Float_t translationVector[3]);
+  void Rotation(Float_t *xyz, Double_t rotationAngles[6]);
+  void InverseRotation(Float_t *xyz, Double_t rotationAngles[6]);
+
+  protected:
+
+  //private:
+
+  static const Int_t kNStripC;         // number of strips in C type module 
+  static const Int_t kMaxNstrip;       // Max. number of strips
+
+  static const Float_t fgkZlenA;       // length (cm) of the A module
+  static const Float_t fgkZlenB;       // length (cm) of the B module
+  static const Float_t fgkZlenC;       // length (cm) of the C module
+  static const Float_t fgkMaxhZtof;    // Max half z-size of TOF (cm)
+  static const Float_t fgkStripLength; // Strip Length (rho X phi direction) (cm)
+
+  static const Float_t fgkRmin;        // Inner radius of the TOF (cm)
+  static const Float_t fgkRmax;        // Outer radius of the TOF (cm)
+  static const Float_t fgkxTOF;        // Inner TOF Radius used in Reconstruction (cm)
+
+  Bool_t fHoles; //logical for geometry version (w/wo holes) 
+
+  //Float_t *fAngles[kNPlates];//Strip tilt angles
+  //Float_t *fHeights[kNPlates];//Strip heights
+  //Float_t *fDistances[kNPlates];//Strip distances
+
+  ClassDef(AliTOFGeometryV5,0) // TOF Geometry class
+};
+
+#endif
index 6029d0a997393c1a3a46af608b1b7754729c3342..a7659023fc0a2494c40eb0b88e8282c2629ea97c 100644 (file)
@@ -56,7 +56,7 @@ AliTOFHitMap::AliTOFHitMap()
 }
 
 ////////////////////////////////////////////////////////////////////////
-AliTOFHitMap::AliTOFHitMap(TClonesArray *dig)
+AliTOFHitMap::AliTOFHitMap(TClonesArray *dig, AliTOFGeometry *tofGeom)
 {
 //
 // ctor
@@ -65,9 +65,11 @@ AliTOFHitMap::AliTOFHitMap(TClonesArray *dig)
 // of course, these constants must not be hardwired
 // change later
 
+  fTOFGeometry = tofGeom;
+
   fNSector = AliTOFGeometry::NSectors();
   fNplate = AliTOFGeometry::NPlates();
-  fNstrip = AliTOFGeometry::NStripC();
+  fNstrip = fTOFGeometry->NMaxNstrip();
   fNpx  = AliTOFGeometry::NpadX();
   fNpz  = AliTOFGeometry::NpadZ();
   fMaxIndex=fNSector*fNplate*fNstrip*fNpx*fNpz;
@@ -83,7 +85,7 @@ AliTOFHitMap::AliTOFHitMap(const AliTOFHitMap & /*hitMap*/)
 //
 // Dummy copy constructor
 //
-    ;
+  ;
 }
 
  
@@ -93,7 +95,10 @@ AliTOFHitMap::~AliTOFHitMap()
 //
 // Destructor
 //
-    delete[] fHitMap;
+  delete[] fHitMap;
+
+  delete fTOFGeometry;
+
 }
 
 ////////////////////////////////////////////////////////////////////////
@@ -112,11 +117,11 @@ Int_t AliTOFHitMap::CheckedIndex(Int_t *vol) const
 // Return checked indices for vol
 //
   Int_t index=
-    (vol[0]/*-1*/)*fNplate*fNstrip*fNpx*fNpz+             // sector
-    (vol[1]/*-1*/)*fNstrip*fNpx*fNpz+                     // plate
-    (vol[2]/*-1*/)*fNpx*fNpz+                             // strip
-    (vol[3]/*-1*/)*fNpz+                                  // padx
-    (vol[4]/*-1*/);                                       // padz
+    vol[0]*fNplate*fNstrip*fNpx*fNpz+             // sector
+    vol[1]*fNstrip*fNpx*fNpz+                     // plate
+    vol[2]*fNpx*fNpz+                             // strip
+    vol[3]*fNpz+                                  // padx
+    vol[4];                                       // padz
 
     if (index >= fMaxIndex) {
       AliError("CheckedIndex - input outside bounds");
@@ -191,8 +196,3 @@ AliTOFHitMap & AliTOFHitMap::operator = (const AliTOFHitMap & /*rhs*/)
 // Dummy assignment operator
     return *this;
 }
-
-
-
-
-
index 18b2206f90481a33cf4ce739e4ce3813beb1473e..75b8886dee091d157354ae82bee715b86b20d4e1 100644 (file)
 #include "TObject.h"
 
 class TClonesArray;
+class AliTOFGeometry;
 
 class AliTOFHitMap : public TObject
 {
  public:
     AliTOFHitMap();
-    AliTOFHitMap(TClonesArray *sdig);
+    AliTOFHitMap(TClonesArray *sdig, AliTOFGeometry *tofGeom);
     AliTOFHitMap(const AliTOFHitMap & hitMap);
     
     virtual ~AliTOFHitMap();
@@ -57,6 +58,8 @@ class AliTOFHitMap : public TObject
     Int_t fMaxIndex;                      // maximum index in hit map
     Int_t *fHitMap;                       // ! [fMaxIndex]         
 
+    AliTOFGeometry *fTOFGeometry;
+
     ClassDef(AliTOFHitMap,0) // Implements HitMap as a 1-dim array
 };
 #endif 
index 8e35a1fa49d2671dbb5ce4308320b54f05882e38..85a937b5a40424be4bd24d01cfd412a5453ee9ce 100644 (file)
@@ -41,6 +41,7 @@ Revision 0.01  2005/07/22 A. De Caro
 #include "AliRawReader.h"
 
 #include "AliTOFGeometry.h"
+#include "AliTOFGeometryV5.h"
 #include "AliTOFRawStream.h"
 
 ClassImp(AliTOFRawStream)
@@ -63,6 +64,8 @@ AliTOFRawStream::AliTOFRawStream(AliRawReader* rawReader)
   fErrorFlag = -1;
   //fCounter = -1; // v0.01
 
+  fTOFGeometry = new AliTOFGeometryV5();
+
   fRawReader->Select(5);
 
 }
@@ -85,6 +88,8 @@ AliTOFRawStream::AliTOFRawStream(const AliTOFRawStream& stream) :
   fErrorFlag = -1;
   //fCounter = -1; // v0.01
 
+  fTOFGeometry = new AliTOFGeometryV5();
+
 }
 
 //_____________________________________________________________________________
@@ -104,6 +109,8 @@ AliTOFRawStream& AliTOFRawStream::operator = (const AliTOFRawStream& stream)
   fErrorFlag = stream.fErrorFlag;
   //fCounter = stream.fCounter; // v0.01
 
+  fTOFGeometry = stream.fTOFGeometry;
+
   return *this;
 
 }
@@ -113,6 +120,8 @@ AliTOFRawStream::~AliTOFRawStream()
 {
 // destructor
 
+  delete fTOFGeometry;
+
 }
 
 
@@ -187,19 +196,19 @@ Int_t AliTOFRawStream::GetPlate() const
 
   Int_t iStripPerSector = (Int_t)(iPadPerSector/(Float_t)AliTOFGeometry::NpadX()/(Float_t)AliTOFGeometry::NpadZ());
 
-  if (iStripPerSector     < AliTOFGeometry::NStripC())
+  if (iStripPerSector     < fTOFGeometry->NStripC())
     iPlate = 0;
-  else if (iStripPerSector>=AliTOFGeometry::NStripC() &&
-          iStripPerSector< AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())
+  else if (iStripPerSector>=fTOFGeometry->NStripC() &&
+          iStripPerSector< fTOFGeometry->NStripC()+AliTOFGeometry::NStripB())
     iPlate = 1;
-  else if (iStripPerSector>=AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB() &&
-          iStripPerSector< AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA())
+  else if (iStripPerSector>=fTOFGeometry->NStripC()+AliTOFGeometry::NStripB() &&
+          iStripPerSector< fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA())
     iPlate = 2;
-  else if (iStripPerSector>=AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA() &&
-          iStripPerSector< AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB())
+  else if (iStripPerSector>=fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA() &&
+          iStripPerSector< fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB())
     iPlate = 3;
-  else if (iStripPerSector>=AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB() &&
-          iStripPerSector< AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripC())
+  else if (iStripPerSector>=fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB() &&
+          iStripPerSector< fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB()+fTOFGeometry->NStripC())
     iPlate = 4;
   else
     iPlate = -1;
@@ -224,20 +233,20 @@ Int_t AliTOFRawStream::GetStrip() const
 
   Int_t iStripPerSector = (Int_t)(iPadPerSector/(Float_t)AliTOFGeometry::NpadX()/(Float_t)AliTOFGeometry::NpadZ());
 
-  if (iStripPerSector      < AliTOFGeometry::NStripC())
+  if (iStripPerSector      < fTOFGeometry->NStripC())
     iStrip = iStripPerSector;
-  else if (iStripPerSector >=AliTOFGeometry::NStripC() &&
-          iStripPerSector < AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())
-    iStrip = iStripPerSector-AliTOFGeometry::NStripC();
-  else if (iStripPerSector >=AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB() &&
-          iStripPerSector < AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()) 
-    iStrip = iStripPerSector-AliTOFGeometry::NStripC()-AliTOFGeometry::NStripB();
-  else if (iStripPerSector >=AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA() &&
-          iStripPerSector < AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB())
-    iStrip = iStripPerSector-AliTOFGeometry::NStripC()-AliTOFGeometry::NStripB()-AliTOFGeometry::NStripA();
-  else if (iStripPerSector >=AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB() &&
-          iStripPerSector < AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripC())
-    iStrip = iStripPerSector-AliTOFGeometry::NStripC()-AliTOFGeometry::NStripB()-AliTOFGeometry::NStripA()-AliTOFGeometry::NStripB();
+  else if (iStripPerSector >=fTOFGeometry->NStripC() &&
+          iStripPerSector < fTOFGeometry->NStripC()+AliTOFGeometry::NStripB())
+    iStrip = iStripPerSector-fTOFGeometry->NStripC();
+  else if (iStripPerSector >=fTOFGeometry->NStripC()+AliTOFGeometry::NStripB() &&
+          iStripPerSector < fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()) 
+    iStrip = iStripPerSector-fTOFGeometry->NStripC()-AliTOFGeometry::NStripB();
+  else if (iStripPerSector >=fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA() &&
+          iStripPerSector < fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB())
+    iStrip = iStripPerSector-fTOFGeometry->NStripC()-AliTOFGeometry::NStripB()-AliTOFGeometry::NStripA();
+  else if (iStripPerSector >=fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB() &&
+          iStripPerSector < fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB()+fTOFGeometry->NStripC())
+    iStrip = iStripPerSector-fTOFGeometry->NStripC()-AliTOFGeometry::NStripB()-AliTOFGeometry::NStripA()-AliTOFGeometry::NStripB();
   else
     iStrip = -1;
 
index 6138db42e84cc4e524bd2fc14ebf9c7577c4cc50..71b1d9e804893e21e0caf795bcfc8d4759ce09ec 100644 (file)
@@ -57,6 +57,8 @@ class AliTOFRawStream: public TObject {
   Int_t            fADC;        // 'charge' measurement
   Int_t            fErrorFlag;  // error flag
   
+  AliTOFGeometry *fTOFGeometry; // pointer to the TOF geometry
+
   //Int_t            fCounter;    // counter for TOF raw data rows in DDL files // v0.01
 
   ClassDef(AliTOFRawStream, 1)  // class for reading TOF raw digits
index 8405364652615f215090a98fac272f23b6ce4d0b..a78de05b8d96710ed22dfca9b0936098b930eecd 100644 (file)
 #include "AliRun.h"
 #include "AliRunLoader.h"
 
+#include "AliTOFGeometry.h"
+#include "AliTOFGeometryV4.h"
+#include "AliTOFGeometryV5.h"
 #include "AliTOFtracker.h"
 #include "AliTOFtrackerMI.h"
 #include "AliTOFClusterFinder.h"
 #include "AliTOFReconstructor.h"
 
-
 ClassImp(AliTOFReconstructor)
 
-
 //_____________________________________________________________________________
   void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader) const
 {
@@ -109,8 +110,22 @@ AliTOFGeometry* AliTOFReconstructor::GetTOFGeometry(AliRunLoader* runLoader) con
 {
 // get the TOF parameters
 
+  AliTOFGeometry *tofGeom;
+
   runLoader->CdGAFile();
-  AliTOFGeometry* tofGeom = (AliTOFGeometry*) gFile->Get("TOFGeometry"); 
+  TDirectory *savedir=gDirectory; 
+  TFile *in=(TFile*)gFile;  
+  if (!in->IsOpen()) {
+    AliWarning("Geometry file is not open default  TOF geometry will be used");
+    tofGeom = new AliTOFGeometry();
+  }
+  else {
+    in->cd();  
+    tofGeom = (AliTOFGeometry*) in->Get("TOFgeometry");
+  }
+
+  savedir->cd();  
+
   if (!tofGeom) {
     AliError("no TOF geometry available");
     return NULL;
index f5644ee00c1c05e359356d2500b1592d8843c54a..a9cc26e6be5b6c6b3714d28dc9c97fbadad0c285 100644 (file)
@@ -194,7 +194,7 @@ void AliTOFSDigit::Update(AliTOFSDigit* sdig)
   Int_t nlocations=sdig->GetNDigits();
 
   for (Int_t j = 0; j < nlocations; j++) {
-    Float_t tdcbin=50.; // [ps] hardwired for the time being
+    Float_t tdcbin = AliTOFGeometry::TdcBinWidth();// [ps] hardwired for the time being
     Int_t tdc=(Int_t)sdig->GetTdc(j);
     Int_t adc=(Int_t)sdig->GetAdc(j);
     // getting here only the first track number
@@ -254,7 +254,7 @@ AliTOFSDigit::~AliTOFSDigit()
 
 ////////////////////////////////////////////////////////////////////////
 
-Int_t AliTOFSDigit::GetTotPad() const
+Int_t AliTOFSDigit::GetTotPad(AliTOFGeometry *tofGeom) const
 {
   //
   // Get the "total" index of the pad inside a Sector
@@ -270,16 +270,16 @@ Int_t AliTOFSDigit::GetTotPad() const
     //before = 0;
     break;
   case 1:
-    before = AliTOFGeometry::NStripC();
+    before = tofGeom->NStripC();
     break;
   case 2:
-    before = AliTOFGeometry::NStripB() +   AliTOFGeometry::NStripC();
+    before = AliTOFGeometry::NStripB() +   tofGeom->NStripC();
     break;
   case 3:
-    before = AliTOFGeometry::NStripA() +   AliTOFGeometry::NStripB() + AliTOFGeometry::NStripC();
+    before = AliTOFGeometry::NStripA() +   AliTOFGeometry::NStripB() + tofGeom->NStripC();
     break;
   case 4:
-    before = AliTOFGeometry::NStripA() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripC();
+    before = AliTOFGeometry::NStripA() + 2*AliTOFGeometry::NStripB() + tofGeom->NStripC();
     break;
   }
   
@@ -287,4 +287,3 @@ Int_t AliTOFSDigit::GetTotPad() const
   Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;
   return padTot;
 }
-
index 1224118b5d84dfee9d02cf0fb6215653cd4ffd7d..14dd2960ad26f5633b17412bfc22e0346484895c 100644 (file)
@@ -17,7 +17,7 @@
 #include "AliDigit.h"
 
 //class TArrayF;
-//class TArrayI;
+class AliTOFGeometry;
 
 // number 3 is a legacy from AliDigit object
 const Int_t kMAXDIGITS = 3;
@@ -25,10 +25,10 @@ const Int_t kMAXDIGITS = 3;
 class AliTOFSDigit : public TObject {
 
   //overloading of the streamer << operator
-//friend ostream& operator << ( ostream& , const AliTOFSDigit&) ;
+  //friend ostream& operator << ( ostream& , const AliTOFSDigit&) ;
 
  public:
- AliTOFSDigit();
 AliTOFSDigit();
   AliTOFSDigit(Int_t tracknum, Int_t* vol, Float_t* digit);
 // new ctor for sdigits
   AliTOFSDigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx, Int_t padz, Float_t tdc, Float_t adc);
@@ -36,7 +36,7 @@ class AliTOFSDigit : public TObject {
   AliTOFSDigit(const AliTOFSDigit & digit) ;
   virtual ~AliTOFSDigit();
   void            GetLocation(Int_t* Loc) const;
-  Int_t           GetTotPad() const;
+  Int_t           GetTotPad(AliTOFGeometry *tofGeom) const;
 
   void Update(Float_t tdcbin, Int_t tdc, Int_t adc, Int_t track);
   void Update(AliTOFSDigit* sdig);
@@ -68,8 +68,8 @@ protected:
 //  Float_t *fTdc;    //[fNDigits] tdc values for sdigit
 //  Float_t *fAdc;    //[fNDigits] adc values for sdigit
 //  Int_t **fTracks;  //[fNDigits] contributing tracks, pointers to
-                    //  arrays with track indices
+                     //arrays with track indices
+
   ClassDef(AliTOFSDigit,1)  // SDigit for Time Of Flight
 };
 
index 1ffbe7f4bbfec5e97758df4322ad5baf51b71286..16527248363e9eb9d2a19224f1bc557ae04147dd 100644 (file)
 #include "AliLog.h"
 #include "AliDetector.h"
 #include "AliLoader.h"
+#include "AliMC.h"
 #include "AliRun.h"
 #include "AliRunLoader.h"
+
 #include "AliTOF.h"
 #include "AliTOFGeometry.h"
 #include "AliTOFHitMap.h"
@@ -51,7 +53,6 @@
 #include "AliTOFSDigitizer.h"
 #include "AliTOFhit.h"
 #include "AliTOFhitT0.h"
-#include "AliMC.h"
 
 ClassImp(AliTOFSDigitizer)
 
@@ -68,6 +69,9 @@ ClassImp(AliTOFSDigitizer)
   ftail           = 0;
   fSelectedSector = -1;
   fSelectedPlate  = -1;
+
+  fTOFGeometry = new AliTOFGeometry();
+
 }
 
 //____________________________________________________________________________ 
@@ -97,6 +101,21 @@ AliTOFSDigitizer::AliTOFSDigitizer(const char* HeaderFile, Int_t evNumber1, Int_
       return;
     }
 
+  fRunLoader->CdGAFile();
+  TDirectory *savedir=gDirectory;
+  TFile *in=(TFile*)gFile;
+
+  if (!in->IsOpen()) {
+    AliWarning("Geometry file is not open default TOF geometry will be used");
+    fTOFGeometry = new AliTOFGeometry();
+  }
+  else {
+    in->cd();
+    fTOFGeometry = (AliTOFGeometry*)in->Get("TOFgeometry");
+  }
+
+  savedir->cd();
+
   if (fRunLoader->TreeE() == 0x0) fRunLoader->LoadHeader();
   
   if (evNumber1>=0) fEvent1 = evNumber1;
@@ -130,6 +149,9 @@ AliTOFSDigitizer::~AliTOFSDigitizer()
 {
   // dtor
   fTOFLoader->CleanSDigitizer();
+
+  //delete fTOFGeometry;
+
 }
 
 //____________________________________________________________________________ 
@@ -191,7 +213,6 @@ Double_t TimeWithTail(Double_t* x, Double_t* par)
   return f;
 }
 
-
 //____________________________________________________________________________
 void AliTOFSDigitizer::Exec(Option_t *verboseOption) { 
 
@@ -262,7 +283,7 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
     TClonesArray *tofHitArray = tof->Hits();
 
     // create hit map
-    AliTOFHitMap *hitMap = new AliTOFHitMap(tof->SDigits());
+    AliTOFHitMap *hitMap = new AliTOFHitMap(tof->SDigits(), fTOFGeometry);
 
     TBranch * tofHitsBranch = hitTree->GetBranch("TOF");
 
@@ -293,7 +314,7 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
 
        // fp: really sorry for this, it is a temporary trick to have
        // track length too
-       if(version!=6){
+       if(version!=6 && version!=7){
          AliTOFhit *tofHit = (AliTOFhit *) tofHitArray->UncheckedAt(hit);
          tracknum = tofHit->GetTrack();
          vol[0] = tofHit->GetSector();
@@ -793,7 +814,7 @@ void AliTOFSDigitizer::PrintParameters()const
   cout << " Time walk (ps) at the boundary of the pad       : "<< fTimeWalkBoundary<< endl;
   cout << " Slope (ps/K) for neighbouring pad               : "<< fTimeWalkSlope<<endl;
   cout << " Pulse Heigth Simulation Parameters " << endl;
-  cout << " Flag for delay due to the PulseHeightEffect: "<< fTimeDelayFlag <<endl;
+  cout << " Flag for delay due to the PulseHeightEffect  : "<< fTimeDelayFlag <<endl;
   cout << " Pulse Height Slope                           : "<< fPulseHeightSlope<<endl;
   cout << " Time Delay Slope                             : "<< fTimeDelaySlope<<endl;
   cout << " Minimum charge amount which could be induced : "<< fMinimumCharge<<endl;
index 9e37f9253052376a7a66c2917320f28270f5b286..9abd22d5f30691d0e8a20dca3932dd4bad51bcec 100644 (file)
@@ -15,6 +15,7 @@
 class AliRunLoader;
 class AliLoader;
 
+class AliTOFGeometry;
 class TF1;
 
 class AliTOFSDigitizer: public TTask {
@@ -118,7 +119,8 @@ private:
   TString fHeadersFile;     // input file
   AliRunLoader* fRunLoader; //! Run Loader
   AliLoader* fTOFLoader;    //! Loader
-  
+
+  AliTOFGeometry* fTOFGeometry;    //  
 
   Int_t fSelectedSector;    // sector number for sdigitization
   Int_t fSelectedPlate ;    // plate  number for sdigitization
index a4b0ea04b993f30b7f6306e14b3569a55b80c98e..083e33378fc6ac2ef1f858b552c5b09709305434 100644 (file)
 #include <TVirtualMC.h>
 
 #include "AliDetector.h"
+#include "AliMC.h"
 #include "AliRun.h"
+
 #include "AliTOF.h"
 #include "AliTOFT0.h"
 #include "AliTOFhitT0.h"
 #include "AliTOFv4T0.h"
-#include "AliMC.h"
+#include "AliTOFv5T0.h"
 
 ClassImp(AliTOFT0)
 
@@ -495,4 +497,3 @@ Bool_t AliTOFT0::operator==( AliTOFT0 const &tzero )const
   else
     return kFALSE ;
 }
-
index bd5f0bf55cff58a24a2b3116277878efa13178e0..7ff76abd4a031f28d1281a4f0452a0a5605f4b7d 100644 (file)
 #include <Riostream.h>
 
 #include "AliRun.h"
+
 #include "AliTOFGeometry.h"
+#include "AliTOFGeometryV4.h"
+#include "AliTOFGeometryV5.h"
 #include "AliTOFdigit.h"
 
 ClassImp(AliTOFdigit)
@@ -107,7 +110,7 @@ void AliTOFdigit::GetLocation(Int_t *Loc) const
 }
 
 //______________________________________________________________________________
-Int_t AliTOFdigit::GetTotPad() const
+Int_t AliTOFdigit::GetTotPad(AliTOFGeometry *tofGeom) const
 {
 //
 // Get the "total" index of the pad inside a Sector
@@ -121,16 +124,16 @@ Int_t AliTOFdigit::GetTotPad() const
     //before = 0;
     break;
   case 1:
-    before = AliTOFGeometry::NStripC();
+    before = tofGeom->NStripC();
     break;
   case 2:
-    before = AliTOFGeometry::NStripC() +   AliTOFGeometry::NStripB();
+    before = tofGeom->NStripC() +   AliTOFGeometry::NStripB();
     break;
   case 3:
-    before = AliTOFGeometry::NStripC() +   AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
+    before = tofGeom->NStripC() +   AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
     break;
   case 4:
-    before = AliTOFGeometry::NStripC() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
+    before = tofGeom->NStripC() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
     break;
   }
   
index 6dd6f76398c7bf2239b1b6d5fb03ec82a445bd54..11ba9c8e35b9025da0c2445365492b66c75f9738 100644 (file)
@@ -16,6 +16,8 @@
 
 #include "AliDigit.h"
 
+class AliTOFGeometry;
+
 class AliTOFdigit : public AliDigit {
 
   //overloading of the streamer << operator
@@ -30,7 +32,7 @@ friend ostream& operator << ( ostream& , const AliTOFdigit&) ;
   AliTOFdigit(const AliTOFdigit & digit) ;
   virtual ~AliTOFdigit(){}
   void            GetLocation(Int_t* Loc) const;
-  Int_t           GetTotPad() const;
+  Int_t           GetTotPad(AliTOFGeometry *tofGeom) const;
   void            AddTrack(Int_t track);
   // getters for AliTOFdigit object 
   Float_t GetTdc()    const     {return fTdc;}
index 9ecce33fedb7791b3a456d7204702fb083f5b00b..a639aa010862724290720fa5e1a6eefd41c12956 100644 (file)
@@ -34,6 +34,7 @@ public:
   Float_t GetPy()     const {return fPy;}
   Float_t GetPz()     const {return fPz;}
   Float_t GetDx()     const {return fDx;}
+  Float_t GetDy()     const {return fDy;}
   Float_t GetDz()     const {return fDz;}
   Float_t GetIncA()   const {return fIncA;}
   Float_t GetEdep()   const {return fEdep;}
index e935cea956b18f779aeeb9070dcf665e4c71d1ea..795cfa3baecceff019da86b06b69ca607c8ee715 100644 (file)
 /* $Id$ */
 
 #include <Riostream.h>
+
 #include <TObject.h>   
+
 #include "AliLog.h" 
-#include "AliTOFtrack.h" 
 #include "AliESDtrack.h" 
 
+#include "AliTOFGeometry.h"
+#include "AliTOFGeometryV4.h"
+#include "AliTOFGeometryV5.h"
+#include "AliTOFtrack.h" 
+
 ClassImp(AliTOFtrack)
 
 //_____________________________________________________________________________
@@ -51,6 +57,7 @@ AliTOFtrack::AliTOFtrack(const AliTOFtrack& t) : AliKalmanTrack(t) {
   fCty=t.fCty;  fCtz=t.fCtz;  fCte=t.fCte;  fCtt=t.fCtt;
   fCcy=t.fCcy;  fCcz=t.fCcz;  fCce=t.fCce;  fCct=t.fCct;  fCcc=t.fCcc;  
 
+  fTOFgeometry = new AliTOFGeometryV4();
 
 }                                
 
@@ -61,6 +68,8 @@ AliTOFtrack::AliTOFtrack(const AliESDtrack& t)
   // Constructor from AliESDtrack
   //
 
+  fTOFgeometry = new AliTOFGeometryV4();
+
   SetSeedIndex(-1);
   SetLabel(t.GetLabel());
   SetChi2(0.);
@@ -279,9 +288,9 @@ Int_t AliTOFtrack::PropagateToInnerTOF( Bool_t holes)
   // defined by x=xk through media of density=rho and radiationLength=x0
 
 
-  Double_t ymax=AliTOFGeometry::RinTOF()*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
+  Double_t ymax=fTOFgeometry->RinTOF()*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
   Bool_t skip = kFALSE;
-  Double_t y=GetYat(AliTOFGeometry::RinTOF(),skip);
+  Double_t y=GetYat(fTOFgeometry->RinTOF(),skip);
   if(skip){
     return 0;
   }
@@ -306,7 +315,7 @@ Int_t AliTOFtrack::PropagateToInnerTOF( Bool_t holes)
     
   }
   
-  if(!PropagateTo(AliTOFGeometry::RinTOF()))return 0;
+  if(!PropagateTo(fTOFgeometry->RinTOF()))return 0;
   
   return 1;
   
index ab710b9eeb88ccc84c4f2c9c97a6ae481cbbab2f..d164542ed4c04050954761164c6d724e67798f01 100644 (file)
@@ -54,7 +54,7 @@ public:
    Int_t Compare(const TObject *o) const;
 
 
-   Double_t GetYat(Double_t xk, Bool_t & skip) const;      
+   Double_t GetYat(Double_t xk, Bool_t & skip) const;
    Int_t    PropagateTo(Double_t xr, Double_t x0=8.72, Double_t rho=5.86e-3);
    Int_t    PropagateToInnerTOF(Bool_t holes);
    void     ResetCovariance();   
@@ -86,6 +86,8 @@ protected:
    Double_t fCty, fCtz, fCte, fCtt;       // track
    Double_t fCcy, fCcz, fCce, fCct, fCcc; // parameters   
 
+   AliTOFGeometry *fTOFgeometry; // pointer to the TOF geometry
+
  private:
 
    void GetPropagationParameters(Bool_t holes, Double_t *param);
index 39d517559147eabb3d56bb918b96b952e76ca26b..513305e6dd0543926cad34f12237cc7f926aae47 100644 (file)
@@ -42,7 +42,7 @@ ClassImp(AliTOFtracker)
 AliTOFtracker::AliTOFtracker(AliTOFGeometry * geom, Double_t parPID[2]) { 
   //AliTOFtracker main Ctor
 
-  fHoles=true;
+  //fHoles=true;
   fNseeds=0;
   fNseedsTOF=0;
   fngoodmatch=0;
@@ -60,7 +60,8 @@ AliTOFtracker::AliTOFtracker(AliTOFGeometry * geom, Double_t parPID[2]) {
   fSeeds=0x0;
   fTracks=0x0;
   fN=0;
-  Init(); // temporary solution to know about Holes/no Holes
+  //Init(); // temporary solution to know about Holes/no Holes
+  fHoles = fGeom->GetHoles();
 }
 //_____________________________________________________________________________
 AliTOFtracker::AliTOFtracker(const AliTOFtracker &t):AliTracker() { 
@@ -86,11 +87,11 @@ AliTOFtracker::AliTOFtracker(const AliTOFtracker &t):AliTracker() {
   fN=t.fN;
 }
 //_____________________________________________________________________________
+/*
 void AliTOFtracker::Init() { 
 
 // temporary solution to know about Holes/no Holes, will be implemented as 
 // an AliTOFGeometry getter
-
   AliModule* frame=gAlice->GetModule("FRAME"); 
 
   if(!frame) {
@@ -100,7 +101,9 @@ void AliTOFtracker::Init() {
     if(frame->IsVersion()==1) {fHoles=false;}    
     else {fHoles=true;}      
   }
+
 }
+*/
 //_____________________________________________________________________________
 Int_t AliTOFtracker::PropagateBack(AliESD* event) {
   //
@@ -196,7 +199,7 @@ void AliTOFtracker::CollectESD() {
     Double_t x = track->GetX(); //New
 
     if (((t->GetStatus()&AliESDtrack::kTRDout)!=0 ) && 
-        ( x >= AliTOFGeometry::RinTOF()) ){
+        ( x >= fGeom->RinTOF()) ){
       track->SetSeedIndex(i);
       t->UpdateTrackParams(track,AliESDtrack::kTOFout);    
       new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
@@ -244,7 +247,7 @@ void AliTOFtracker::MatchTracks( Bool_t mLastStep){
     if(t->GetTOFsignal()>0. ) continue;
     AliTOFtrack *trackTOFin =new AliTOFtrack(*track);
 
-    // Some init 
+    // Some init
 
     Int_t         index[10000];
     Float_t        dist[10000];
@@ -302,7 +305,7 @@ void AliTOFtracker::MatchTracks( Bool_t mLastStep){
     Int_t nStepsDone = 0;
     for( Int_t istep=0; istep<nSteps; istep++){ 
 
-      Float_t xs=AliTOFGeometry::RinTOF()+istep*0.1;
+      Float_t xs=fGeom->RinTOF()+istep*0.1;
       Double_t ymax=xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
 
       Bool_t skip=kFALSE;
@@ -362,7 +365,7 @@ void AliTOFtracker::MatchTracks( Bool_t mLastStep){
          dist[nfound]=fGeom->DistanceToPad(cind,ctrackPos);
          crecL[nfound]=trackPos[3][istep];
          index[nfound]=clind[5][i]; // store cluster id            
-         cxpos[nfound]=AliTOFGeometry::RinTOF()+istep*0.1; //store prop.radius
+         cxpos[nfound]=fGeom->RinTOF()+istep*0.1; //store prop.radius
          nfound++;
          if(isInside)break;
        }//end if accept
@@ -419,9 +422,15 @@ void AliTOFtracker::MatchTracks( Bool_t mLastStep){
        (c->GetLabel(2)==TMath::Abs(trackTOFin->GetLabel()))
        ) {
       fngoodmatch++;
+
+      //AliInfo(Form(" track label good %5i",trackTOFin->GetLabel()));
+
     }
     else{
       fnbadmatch++;
+
+      //AliInfo(Form(" track label  bad %5i",trackTOFin->GetLabel()));
+
     }
 
     delete trackTOFin;
@@ -429,8 +438,7 @@ void AliTOFtracker::MatchTracks( Bool_t mLastStep){
     //Double_t tof=50*c->GetTDC()+32; // in ps
     Double_t tof=AliTOFGeometry::TdcBinWidth()*c->GetTDC()+32; // in ps
     t->SetTOFsignal(tof);
-    //t->SetTOFcluster(c->GetIndex()); // pointing to the digits tree
-    t->SetTOFcluster(idclus); // pointing to the recPoints tree
+    t->SetTOFcluster(c->GetIndex());
     Double_t time[10]; t->GetIntegratedTimes(time);
     Double_t mom=t->GetP();
     for(Int_t j=0;j<=AliPID::kSPECIES;j++){
@@ -524,4 +532,3 @@ Int_t AliTOFtracker::FindClusterIndex(Double_t z) const {
   }
   return m;
 }
-
index 11c841500dbd87cbf8be285e9bf2bbd15c97255a..affcdd60656050c86b6322ccfb23a8463adbb99e 100644 (file)
@@ -46,7 +46,7 @@ private:
   Int_t FindClusterIndex(Double_t z) const; // Returns cluster index 
   void  MatchTracks(Bool_t mLastStep); // Matching Algorithm 
   void  CollectESD(); // Select starting Set for Matching 
-  void  Init();
+  //void  Init();
 
   AliTOFGeometry*  fGeom;                 // Pointer to TOF geometry
   AliTOFpidESD*    fTOFpid;               // Pointer to TOF PID
@@ -74,5 +74,3 @@ private:
 };
 
 #endif
-
-
index 536ec63734a850c1a10f54437b0226d3938e455e..3339946fbfae69adc18d3c4e6d067e874a0e7815 100644 (file)
@@ -37,7 +37,7 @@ ClassImp(AliTOFtrackerMI)
 AliTOFtrackerMI::AliTOFtrackerMI(AliTOFGeometry * geom, Double_t parPID[2]) { 
   //AliTOFtrackerMI main Ctor
 
-  fHoles=true;
+  //fHoles=true;
   fNseeds=0;
   fNseedsTOF=0;
   fngoodmatch=0;
@@ -56,7 +56,8 @@ AliTOFtrackerMI::AliTOFtrackerMI(AliTOFGeometry * geom, Double_t parPID[2]) {
   fTracks=0x0;
   fN=0;
   fDebugStreamer = new TTreeSRedirector("TOFdebug.root");   
-  Init(); // temporary solution to know about Holes/no Holes
+  //Init(); // temporary solution to know about Holes/no Holes
+  fHoles=geom->GetHoles();
 }
 //_____________________________________________________________________________
 AliTOFtrackerMI::AliTOFtrackerMI(const AliTOFtrackerMI &t):AliTracker() { 
@@ -95,6 +96,7 @@ AliTOFtrackerMI::~AliTOFtrackerMI(){
 }
 
 //_____________________________________________________________________________
+/*
 void AliTOFtrackerMI::Init() { 
 
 // temporary solution to know about Holes/no Holes, will be implemented as 
@@ -110,6 +112,7 @@ void AliTOFtrackerMI::Init() {
     else {fHoles=true;}      
   }
 }
+*/
 //_____________________________________________________________________________
 Int_t AliTOFtrackerMI::PropagateBack(AliESD* event) {
   //
@@ -215,7 +218,7 @@ void AliTOFtrackerMI::CollectESD() {
     Double_t x = track->GetX(); //New
 
     if (((t->GetStatus()&AliESDtrack::kTRDout)!=0 ) && 
-        ( x >= AliTOFGeometry::RinTOF()) ){
+        ( x >= fGeom->RinTOF()) ){
       track->SetSeedIndex(i);
       t->UpdateTrackParams(track,AliESDtrack::kTOFout);    
       new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
@@ -321,9 +324,9 @@ void AliTOFtrackerMI::MatchTracksMI(Bool_t mLastStep){
     //
     //propagat track to the middle of TOF
     //
-    Float_t xs = 378.2;  // should be defined in the TOF gemotry
+    Float_t xs = 378.2;  // should be defined in the TOF geometry
     Double_t ymax=xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());  
-    Bool_t skip;
+    Bool_t skip=kFALSE;
     Double_t ysect=trackTOFin->GetYat(xs,skip);
     if (skip){
       xs = 372.;
index a01ef91d9daa7f742be93f3474b91dd654a28153..ef7ece1f1d0ca901415da826142a377fed74e69e 100644 (file)
@@ -84,7 +84,7 @@ private:
   void  MatchTracks(Bool_t mLastStep); // Matching Algorithm 
   void  MatchTracksMI(Bool_t mLastStep); // Matching Algorithm 
   void  CollectESD(); // Select starting Set for Matching 
-  void  Init();
+  //void  Init();
   Float_t GetLinearDistances(AliTOFtrack * track, AliTOFcluster *cluster, Float_t distances[5]);
   AliTOFGeometry*  fGeom;                 // Pointer to TOF geometry
   AliTOFpidESD*    fTOFpid;               // Pointer to TOF PID
@@ -112,5 +112,3 @@ private:
 };
 
 #endif
-
-
index f6c0117e02b95f3c96445af863e2e1af4c1d63db..9a2af23d6af03d86435151777fdbf4e6f7a4b0dc 100644 (file)
@@ -39,8 +39,8 @@
 
 #include <Riostream.h>
 #include <stdlib.h>
-#include "TVirtualMC.h"
 
+#include "TVirtualMC.h"
 #include <TBRIK.h>
 #include <TGeometry.h>
 #include <TLorentzVector.h>
 #include "AliLog.h"
 #include "AliConst.h"
 #include "AliRun.h"
-#include "AliTOFv4T0.h"
-#include "AliTOFGeometry.h"
 #include "AliMC.h"
+#include "AliMagF.h"
+
+#include "AliTOFGeometry.h"
+#include "AliTOFGeometryV4.h"
+#include "AliTOFv4T0.h"
+
 ClassImp(AliTOFv4T0)
+
 //_____________________________________________________________________________
 AliTOFv4T0::AliTOFv4T0()
 {
@@ -83,7 +86,7 @@ AliTOFv4T0::AliTOFv4T0(const char *name, const char *title)
   } else{
     
     if (fTOFGeometry) delete fTOFGeometry;
-    fTOFGeometry = new AliTOFGeometry();
+    fTOFGeometry = new AliTOFGeometryV4();
 
     if(frame->IsVersion()==1) {
       AliInfo(Form("Frame version %d", frame->IsVersion())); 
@@ -95,6 +98,13 @@ AliTOFv4T0::AliTOFv4T0(const char *name, const char *title)
       fTOFHoles=true;}      
   }
   fTOFGeometry->SetHoles(fTOFHoles);
+
+  // Save the geometry
+  TDirectory* saveDir = gDirectory;
+  gAlice->GetRunLoader()->CdGAFile();
+  fTOFGeometry->Write("TOFgeometry");
+  saveDir->cd();
+
 } 
 
 //____________________________________________________________________________
@@ -110,16 +120,16 @@ void AliTOFv4T0::BuildGeometry()
   top = gAlice->GetGeometry()->GetNode("alice");
   
   // Position the different copies
-  const Float_t krTof  =(AliTOFGeometry::Rmax()+AliTOFGeometry::Rmin())/2;
-  const Float_t khTof  = AliTOFGeometry::Rmax()-AliTOFGeometry::Rmin();
-  const Int_t   kNTof  = AliTOFGeometry::NSectors();
+  const Float_t krTof  =(fTOFGeometry->Rmax()+fTOFGeometry->Rmin())/2.;
+  const Float_t khTof  = fTOFGeometry->Rmax()-fTOFGeometry->Rmin();
+  const Int_t   kNTof  = fTOFGeometry->NSectors();
   const Float_t kPi    = TMath::Pi();
   const Float_t kangle = 2*kPi/kNTof;
   Float_t ang;
   
   // define offset for nodes
-  Float_t zOffsetC = AliTOFGeometry::MaxhZtof() - AliTOFGeometry::ZlenC()*0.5;
-  Float_t zOffsetB = AliTOFGeometry::MaxhZtof() - AliTOFGeometry::ZlenC() - AliTOFGeometry::ZlenB()*0.5;
+  Float_t zOffsetC = fTOFGeometry->MaxhZtof() - fTOFGeometry->ZlenC()*0.5;
+  Float_t zOffsetB = fTOFGeometry->MaxhZtof() - fTOFGeometry->ZlenC() - fTOFGeometry->ZlenB()*0.5;
   Float_t zOffsetA = 0.;
   // Define TOF basic volume
   
@@ -127,11 +137,11 @@ void AliTOFv4T0::BuildGeometry()
   char nodeName3[7], nodeName4[7], rotMatNum[7];
   
   new TBRIK("S_TOF_C","TOF box","void",
-            AliTOFGeometry::StripLength()*0.5,khTof*0.5,AliTOFGeometry::ZlenC()*0.5);
+            fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenC()*0.5);
   new TBRIK("S_TOF_B","TOF box","void",
-            AliTOFGeometry::StripLength()*0.5,khTof*0.5,AliTOFGeometry::ZlenB()*0.5);
+            fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenB()*0.5);
   new TBRIK("S_TOF_A","TOF box","void",
-            AliTOFGeometry::StripLength()*0.5,khTof*0.5,AliTOFGeometry::ZlenA()*0.5);
+            fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenA()*0.5);
   
   for (Int_t nodeNum=1;nodeNum<19;nodeNum++){
     
@@ -156,33 +166,32 @@ void AliTOFv4T0::BuildGeometry()
     ang = (4.5-nodeNum) * kangle;
 
     top->cd();
-    node = new TNode(nodeName0,nodeName0,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetC,rotMatNum);
+    node = new TNode(nodeName0,nodeName0,"S_TOF_C", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang), zOffsetC,rotMatNum);
     node->SetLineColor(kColorTOF);
     fNodes->Add(node);
     
     top->cd();
-    node = new TNode(nodeName1,nodeName1,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-zOffsetC,rotMatNum);
+    node = new TNode(nodeName1,nodeName1,"S_TOF_C", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang),-zOffsetC,rotMatNum);
     node->SetLineColor(kColorTOF);
     fNodes->Add(node);
     
     top->cd();
-    node = new TNode(nodeName2,nodeName2,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetB,rotMatNum);
+    node = new TNode(nodeName2,nodeName2,"S_TOF_B", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang), zOffsetB,rotMatNum);
     node->SetLineColor(kColorTOF);
     fNodes->Add(node);
     
     top->cd();
-    node = new TNode(nodeName3,nodeName3,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-zOffsetB,rotMatNum);
+    node = new TNode(nodeName3,nodeName3,"S_TOF_B", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang),-zOffsetB,rotMatNum);
     node->SetLineColor(kColorTOF);
     fNodes->Add(node);
     
     top->cd();
-    node = new TNode(nodeName4,nodeName4,"S_TOF_A",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetA,rotMatNum);
+    node = new TNode(nodeName4,nodeName4,"S_TOF_A", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang), zOffsetA,rotMatNum);
     node->SetLineColor(kColorTOF);
     fNodes->Add(node);
   } // end loop on nodeNum
-}
-
 
+}
  
 //_____________________________________________________________________________
 void AliTOFv4T0::CreateGeometry()
@@ -209,16 +218,15 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   //
   // Definition of the Time Of Fligh Resistive Plate Chambers
   // xFLT, yFLT, zFLT - sizes of TOF modules (large)
-  
+
   Float_t  ycoor;
   Float_t  par[3];
   Int_t    *idtmed = fIdtmed->GetArray()-499;
   Int_t    idrotm[100];
   Int_t    nrot = 0;
 
-  Float_t radius = AliTOFGeometry::Rmin()+2.;//cm
+  Float_t radius = fTOFGeometry->Rmin()+2.;//cm
 
-  
   par[0] =  xtof * 0.5;
   par[1] =  ytof * 0.5;
   par[2] = zlenC * 0.5;
@@ -260,13 +268,13 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   Float_t db = 0.5; // cm
   Float_t xFLT, xFST, yFLT, zFLTA, zFLTB, zFLTC;
   
-  xFLT = AliTOFGeometry::StripLength();
+  xFLT = fTOFGeometry->StripLength();
   yFLT = ytof;
   zFLTA = zlenA;
   zFLTB = zlenB;
   zFLTC = zlenC;
   
-  xFST = xFLT - AliTOFGeometry::DeadBndX()*2; // cm
+  xFST = xFLT - dynamic_cast<AliTOFGeometryV4*>(fTOFGeometry)->DeadBndX()*2.; // cm
   
   // Sizes of MRPC pads
   
@@ -314,12 +322,12 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   
   ///////////////// Detector itself //////////////////////
   
-  const Float_t  kdeadBound  =  AliTOFGeometry::DeadBndZ(); //cm non-sensitive between the pad edge 
+  const Float_t  kdeadBound  =  dynamic_cast<AliTOFGeometryV4*>(fTOFGeometry)->DeadBndZ(); //cm non-sensitive between the pad edge 
   //and the boundary of the strip
-  const Int_t    knx    = AliTOFGeometry::NpadX();  // number of pads along x
-  const Int_t    knz    = AliTOFGeometry::NpadZ();  // number of pads along z
+  const Int_t    knx    = fTOFGeometry->NpadX();  // number of pads along x
+  const Int_t    knz    = fTOFGeometry->NpadZ();  // number of pads along z
   
-  Float_t zSenStrip  = AliTOFGeometry::ZPad() * AliTOFGeometry::NpadZ(); // cm
+  Float_t zSenStrip  = fTOFGeometry->ZPad() * fTOFGeometry->NpadZ(); // cm
   Float_t stripWidth = zSenStrip + 2*kdeadBound;
   
   par[0] = xFLT*0.5;
@@ -460,7 +468,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
     ang /= kRaddeg;
     Float_t zpos = tan(ang)*radius;
     Float_t ypos= fTOFGeometry->GetHeights(2,istrip);
-    gMC->Gspos("FSTR",AliTOFGeometry::NStripA()-istrip,"FLTA",0.,ypos, zpos,idrotm[0],  "ONLY");
+    gMC->Gspos("FSTR",fTOFGeometry->NStripA()-istrip,"FLTA",0.,ypos, zpos,idrotm[0],  "ONLY");
     AliDebug(1, Form("y = %f,  z = %f, , z coord = %f, Rot ang = %f, St. %2i",ypos,zpos,tan(ang)*radius ,ang*kRaddeg,istrip));
   }
 
@@ -495,7 +503,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   ////////// Layers after strips /////////////////
   // Al Layer thickness (2.3mm) factor 0.7
   
-  Float_t overSpace = AliTOFGeometry::OverSpc();//cm
+  Float_t overSpace = dynamic_cast<AliTOFGeometryV4*>(fTOFGeometry)->OverSpc();//cm
   
   par[0] = xFLT*0.5;
   par[1] = 0.115*0.7; // factor 0.7
@@ -891,7 +899,154 @@ void AliTOFv4T0::CreateMaterials()
   //
   // Define materials for the Time Of Flight
   //
-  AliTOF::CreateMaterials();
+  //AliTOF::CreateMaterials();
+
+  //
+  // Defines TOF materials for all versions
+  // Revision: F. Pierella 18-VI-2002
+  //
+
+  Int_t   isxfld = gAlice->Field()->Integ();
+  Float_t sxmgmx = gAlice->Field()->Max();
+  //
+  //--- Quartz (SiO2) to simulate float glass
+  //    density tuned to have correct float glass 
+  //    radiation length
+  Float_t   aq[2] = { 28.0855,15.9994 };
+  Float_t   zq[2] = { 14.,8. };
+  Float_t   wq[2] = { 1.,2. };
+  Float_t   dq = 2.55; // std value: 2.2
+  Int_t nq = -2;
+
+  // --- Freon C2F4H2 (TOF-TDR pagg.)
+  // Geant Manual CONS110-1, pag. 43 (Geant, Detector Description and Simulation Tool)
+  Float_t afre[3]  = {12.011,18.998,1.007};
+  Float_t zfre[3]  = { 6., 9., 1.}; 
+  Float_t wfre[3]  = { 2., 4., 2.};
+  Float_t densfre  = 0.00375;   
+// http://www.fi.infn.it/sezione/prevprot/gas/freon.html
+  Int_t nfre = -3; 
+/*
+  //-- Isobutane quencher C4H10 (5% in the sensitive mixture)
+  Float_t aiso[2]  = {12.011,1.007};
+  Float_t ziso[2]  = { 6.,  1.};
+  Float_t wiso[2]  = { 4., 10.};
+  Float_t densiso  = .......;  // (g/cm3) density
+  Int_t nfre = -2; // < 0 i.e. proportion by number of atoms of each kind
+  //-- SF6 (5% in the sensitive mixture)
+  Float_t asf[3]  = {32.066,18.998};
+  Float_t zsf[3]  = { 16., 9.};
+  Float_t wsf[3]  = {  1., 6.}; 
+  Float_t denssf  = .....;   // (g/cm3) density
+  Int_t nfre = -2; // < 0 i.e. proportion by number of atoms of each kind
+*/
+  // --- CO2 
+  Float_t ac[2]   = {12.,16.};
+  Float_t zc[2]   = { 6., 8.};
+  Float_t wc[2]   = { 1., 2.};
+  Float_t dc = .001977;
+  Int_t nc = -2;
+   // For mylar (C5H4O2) 
+  Float_t amy[3] = { 12., 1., 16. };
+  Float_t zmy[3] = {  6., 1.,  8. };
+  Float_t wmy[3] = {  5., 4.,  2. };
+  Float_t dmy    = 1.39;
+  Int_t nmy = -3;
+ // For polyethilene (CH2) - honeycomb -
+  Float_t ape[2] = { 12., 1. };
+  Float_t zpe[2] = {  6., 1. };
+  Float_t wpe[2] = {  1., 2. };
+  Float_t dpe    = 0.935*0.479; //To have 1%X0 for 1cm as for honeycomb
+  Int_t npe = -2;
+  // --- G10 
+  Float_t ag10[4] = { 12.,1.,16.,28. };
+  Float_t zg10[4] = {  6.,1., 8.,14. };
+  Float_t wmatg10[4] = { .259,.288,.248,.205 };
+  Float_t densg10  = 1.7;
+  Int_t nlmatg10 = -4;
+
+  // plexiglass CH2=C(CH3)CO2CH3
+  Float_t aplex[3] = { 12.,1.,16.};
+  Float_t zplex[3] = {  6.,1., 8.};
+  Float_t wmatplex[3] = {5.,8.,2.};
+  Float_t densplex  =1.16;
+  Int_t nplex = -3;
+
+  // ---- ALUMINA (AL203) 
+  Float_t aal[2] = { 27.,16.};
+  Float_t zal[2] = { 13., 8.};
+  Float_t wmatal[2] = { 2.,3. };
+  Float_t densal  = 2.3;
+  Int_t nlmatal = -2;
+  // -- Water
+  Float_t awa[2] = {  1., 16. };
+  Float_t zwa[2] = {  1.,  8. };
+  Float_t wwa[2] = {  2.,  1. };
+  Float_t dwa    = 1.0;
+  Int_t nwa = -2;
+
+// stainless steel
+  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 };
+
+  //AliMaterial(0, "Vacuum$", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
+
+  // 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;
+
+  AliMixture( 1, "Air$", aAir, zAir, dAir, 4, wAir);
+
+  AliMaterial( 2, "Cu $",  63.54, 29.0, 8.96, 1.43, 14.8);
+  AliMaterial( 3, "C  $",  12.01,  6.0, 2.265,18.8, 74.4);
+  AliMixture ( 4, "Polyethilene$", ape, zpe, dpe, npe, wpe);
+  AliMixture ( 5, "G10$", ag10, zg10, densg10, nlmatg10, wmatg10);
+  AliMixture ( 6, "PLE$", aplex, zplex, densplex, nplex, wmatplex);
+  AliMixture ( 7, "CO2$", ac, zc, dc, nc, wc);
+  AliMixture ( 8, "ALUMINA$", aal, zal, densal, nlmatal, wmatal);
+  AliMaterial( 9, "Al $", 26.98, 13., 2.7, 8.9, 37.2);
+  AliMaterial(10, "C-TRD$", 12.01, 6., 2.265*18.8/69.282*15./100, 18.8, 74.4); // for 15%
+  AliMixture (11, "Mylar$",  amy, zmy, dmy, nmy, wmy);
+  AliMixture (12, "Freon$",  afre, zfre, densfre, nfre, wfre);
+  AliMixture (13, "Glass$", aq, zq, dq, nq, wq);
+  AliMixture (14, "Water$",  awa, zwa, dwa, nwa, wwa);
+  AliMixture (15, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel);
+
+  Float_t epsil, stmin, deemax, stemax;
+  //   Previous data
+  //       EPSIL  =  0.1   ! Tracking precision, 
+  //       STEMAX = 0.1      ! Maximum displacement for multiple scattering
+  //       DEEMAX = 0.1    ! Maximum fractional energy loss, DLS 
+  //       STMIN  = 0.1 
+  //
+  //   New data  
+  epsil  = .001;  // Tracking precision,
+  stemax = -1.;   // Maximum displacement for multiple scattering
+  deemax = -.3;   // Maximum fractional energy loss, DLS
+  stmin  = -.8;
+
+  AliMedium( 1, "Air$"  ,  1, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 2, "Cu $"  ,  2, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 3, "C  $"  ,  3, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 4, "Pol$"  ,  4, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 5, "G10$"  ,  5, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 6, "PLE$"  ,  6, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 7, "CO2$"  ,  7, 0, isxfld, sxmgmx, 10., -.01, -.1, .01, -.01);
+  AliMedium( 8,"ALUMINA$", 8, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 9,"Al Frame$",9, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium(10, "DME-S$",  6, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium(11, "C-TRD$", 10, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium(12, "Myl$"  , 11, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium(13, "Fre$"  , 12, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium(14, "Fre-S$", 12, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium(15, "Glass$", 13, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium(16, "Water$", 14, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium(17, "STEEL$", 15, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+
 }
 
 //_____________________________________________________________________________
@@ -937,9 +1092,12 @@ void AliTOFv4T0::StepManager()
   Int_t   *idtmed = fIdtmed->GetArray()-499;
   Float_t incidenceAngle;
       
-  if(gMC->GetMedium()==idtmed[513] && 
-     gMC->IsTrackEntering() && gMC->TrackCharge()
-     && gMC->CurrentVolID(copy)==fIdSens) 
+  if(
+     gMC->IsTrackEntering()
+     && gMC->TrackCharge()
+     && gMC->GetMedium()==idtmed[513]
+     && gMC->CurrentVolID(copy)==fIdSens
+     )
   {
 
     AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
@@ -989,13 +1147,13 @@ void AliTOFv4T0::StepManager()
 
     plate = -1;  
 
-    if (TMath::Abs(z) <=  AliTOFGeometry::ZlenA()*0.5)  plate = 2;
-    if (z < (AliTOFGeometry::ZlenA()*0.5+AliTOFGeometry::ZlenB()) && 
-        z >  AliTOFGeometry::ZlenA()*0.5)               plate = 1;
-    if (z >-(AliTOFGeometry::ZlenA()*0.5+AliTOFGeometry::ZlenB()) &&
-        z < -AliTOFGeometry::ZlenA()*0.5)               plate = 3;
-    if (z > (AliTOFGeometry::ZlenA()*0.5+AliTOFGeometry::ZlenB()))     plate = 0;
-    if (z <-(AliTOFGeometry::ZlenA()*0.5+AliTOFGeometry::ZlenB()))     plate = 4;
+    if (TMath::Abs(z) <=  fTOFGeometry->ZlenA()*0.5)  plate = 2;
+    if (z < (fTOFGeometry->ZlenA()*0.5+fTOFGeometry->ZlenB()) && 
+        z >  fTOFGeometry->ZlenA()*0.5)               plate = 1;
+    if (z >-(fTOFGeometry->ZlenA()*0.5+fTOFGeometry->ZlenB()) &&
+        z < -fTOFGeometry->ZlenA()*0.5)               plate = 3;
+    if (z > (fTOFGeometry->ZlenA()*0.5+fTOFGeometry->ZlenB()))     plate = 0;
+    if (z <-(fTOFGeometry->ZlenA()*0.5+fTOFGeometry->ZlenB()))     plate = 4;
 
 
     if (plate==0) strip=fTOFGeometry->NStripC()-strip;
index 7382643d414b77f53f3940deba7154dd12217a58..fa691aa45d57e04d6c9f3f6ded957a8ad4eaab17 100644 (file)
@@ -27,6 +27,7 @@ public:
   virtual Int_t  IsVersion() const {return 6;}
   virtual void   TOFpc(Float_t xtof,Float_t ytof,Float_t zlenC,Float_t zlenB,
                        Float_t zlenA,Float_t ztof0);
+  virtual void   TOFpc(Float_t, Float_t, Float_t, Float_t) {};
   virtual void   StepManager();
   virtual void   DrawModule() const;
   virtual void   DrawDetectorModules();
@@ -41,7 +42,7 @@ private:
   Int_t fIdFLTC; // FLTC volume identifier (inner plate C)
   Bool_t fTOFHoles; // Selecting Geometry with and w/o holes
  
-  ClassDef(AliTOFv4T0,1)  //Time Of Flight version 4
+  ClassDef(AliTOFv4T0,2)  //Time Of Flight version 4
 };
  
 #endif /* ALITOFv4T0_H */
diff --git a/TOF/AliTOFv5T0.cxx b/TOF/AliTOFv5T0.cxx
new file mode 100644 (file)
index 0000000..55c7cdd
--- /dev/null
@@ -0,0 +1,1339 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/*
+$Log$
+
+Revision 0.1 2004 November G. Cara Romeo and A. De Caro
+        Implement new TOF geometry version
+       in order to
+          suppress few volume overlaps
+               (in the 4th TOF geometry version),
+          insert the realistic strip numbers and positions
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  This class contains the functions for version 5 of the Time Of Flight    //
+//  detector.                                                                //
+//                                                                           //
+//  VERSION WITH 5 MODULES AND TILTED STRIPS                                 //
+//                                                                           //
+//  FULL COVERAGE VERSION + OPTION for PHOS holes                            //
+//                                                                           //
+//                                                                           //
+//Begin_Html                                                                 //
+/*                                                                           //
+<img src="picts/AliTOFv5T0Class.gif">                                        //
+*/                                                                           //
+//End_Html                                                                   //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "Riostream.h"
+#include <stdlib.h>
+
+#include "TVirtualMC.h"
+#include <TBRIK.h>
+#include <TGeometry.h>
+#include <TLorentzVector.h>
+#include <TNode.h>
+#include <TObject.h>
+#include <TVirtualMC.h>
+
+#include "AliLog.h"
+#include "AliConst.h"
+#include "AliRun.h"
+#include "AliMC.h"
+#include "AliMagF.h"
+
+#include "AliTOFGeometry.h"
+#include "AliTOFGeometryV5.h"
+#include "AliTOFv5T0.h"
+
+ClassImp(AliTOFv5T0)
+
+//_____________________________________________________________________________
+AliTOFv5T0::AliTOFv5T0()
+{
+  //
+  // Default constructor
+  //
+}
+//_____________________________________________________________________________
+AliTOFv5T0::AliTOFv5T0(const char *name, const char *title)
+        : AliTOF(name,title,"tzero")
+{
+  //
+  // Standard constructor
+  //
+  //
+  // Check that FRAME is there otherwise we have no place where to
+  // put TOF
+
+
+  AliModule* frame=gAlice->GetModule("FRAME");
+  if(!frame) {
+    AliFatal("TOF needs FRAME to be present");
+  } else{
+    
+    if (fTOFGeometry) delete fTOFGeometry;
+    fTOFGeometry = new AliTOFGeometryV5();
+
+    if(frame->IsVersion()==1) {
+      AliInfo(Form("Frame version %d", frame->IsVersion())); 
+      AliInfo("Full Coverage for TOF");
+      fTOFHoles=false;}    
+    else {
+      AliInfo(Form("Frame version %d", frame->IsVersion())); 
+      AliInfo("TOF with Holes for PHOS");
+      fTOFHoles=true;}      
+  }
+  fTOFGeometry->SetHoles(fTOFHoles);
+
+  //AliTOF::fTOFGeometry = fTOFGeometry;
+
+  // Save the geometry
+  TDirectory* saveDir = gDirectory;
+  gAlice->GetRunLoader()->CdGAFile();
+  fTOFGeometry->Write("TOFgeometry");
+  saveDir->cd();
+
+} 
+
+//____________________________________________________________________________
+void AliTOFv5T0::BuildGeometry()
+{
+  //
+  // Build TOF ROOT geometry for the ALICE event display
+  //
+  TNode *node, *top;
+  const int kColorTOF  = 27;
+  
+  // Find top TNODE
+  top = gAlice->GetGeometry()->GetNode("alice");
+  
+  // Position the different copies
+  const Float_t krTof  =(fTOFGeometry->Rmax()+fTOFGeometry->Rmin())/2.;
+  const Float_t khTof  = fTOFGeometry->Rmax()-fTOFGeometry->Rmin();
+  const Int_t   kNTof  = fTOFGeometry->NSectors();
+  const Float_t kangle = k2PI/kNTof;
+
+  const Float_t kInterCentrModBorder1 = 49.5;
+  const Float_t kInterCentrModBorder2 = 57.5;
+
+  Float_t ang;
+  
+  // define offset for nodes
+  Float_t zOffsetB = (fTOFGeometry->ZlenA()*0.5 + (kInterCentrModBorder1+kInterCentrModBorder2)*0.5)*0.5;
+  Float_t zOffsetA = 0.;
+  // Define TOF basic volume
+  
+  char nodeName0[7], nodeName1[7], nodeName2[7];
+  char nodeName3[7], nodeName4[7], rotMatNum[7];
+
+  if (fTOFHoles) {
+    new TBRIK("S_TOF_B","TOF box","void",
+             fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenB()*0.5);
+    new TBRIK("S_TOF_C","TOF box","void",
+             fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenB()*0.5);
+  }
+  new TBRIK("S_TOF_A","TOF box","void",
+            fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenA()*0.5);
+  
+  for (Int_t nodeNum=1;nodeNum<19;nodeNum++){
+    
+    if (nodeNum<10) {
+      sprintf(rotMatNum,"rot50%i",nodeNum);
+      sprintf(nodeName0,"FTO00%i",nodeNum);
+      sprintf(nodeName1,"FTO10%i",nodeNum);
+      sprintf(nodeName2,"FTO20%i",nodeNum);
+      sprintf(nodeName3,"FTO30%i",nodeNum);
+      sprintf(nodeName4,"FTO40%i",nodeNum);
+    }
+    if (nodeNum>9) {
+      sprintf(rotMatNum,"rot5%i",nodeNum);
+      sprintf(nodeName0,"FTO0%i",nodeNum);
+      sprintf(nodeName1,"FTO1%i",nodeNum);
+      sprintf(nodeName2,"FTO2%i",nodeNum);
+      sprintf(nodeName3,"FTO3%i",nodeNum);
+      sprintf(nodeName4,"FTO4%i",nodeNum);
+    }
+    
+    new TRotMatrix(rotMatNum,rotMatNum,90,-20*nodeNum,90,90-20*nodeNum,0,0);
+    ang = (4.5-nodeNum) * kangle;
+
+    if (fTOFHoles) {   
+      top->cd();
+      node = new TNode(nodeName2,nodeName2,"S_TOF_B", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang), zOffsetB,rotMatNum);
+      node->SetLineColor(kColorTOF);
+      fNodes->Add(node);
+      
+      top->cd();
+      node = new TNode(nodeName3,nodeName3,"S_TOF_C", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang),-zOffsetB,rotMatNum);
+      node->SetLineColor(kColorTOF);
+      fNodes->Add(node);
+    }
+
+    top->cd();
+    node = new TNode(nodeName4,nodeName4,"S_TOF_A", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang), zOffsetA,rotMatNum);
+    node->SetLineColor(kColorTOF);
+    fNodes->Add(node);
+  } // end loop on nodeNum
+
+}
+
+//_____________________________________________________________________________
+void AliTOFv5T0::CreateGeometry()
+{
+  //
+  // Create geometry for Time Of Flight version 0
+  //
+  //Begin_Html
+  /*
+    <img src="picts/AliTOFv5T0.gif">
+  */
+  //End_Html
+  //
+  // Creates common geometry
+  //
+  AliTOF::CreateGeometry();
+}
+
+//_____________________________________________________________________________
+void AliTOFv5T0::TOFpc(Float_t xtof,  Float_t ytof, Float_t zlenA,
+                      Float_t zlenB)
+{
+
+  const Float_t kPi = TMath::Pi();
+
+  const Float_t kInterCentrModBorder1 = 49.5;
+  const Float_t kInterCentrModBorder2 = 57.5;
+  const Float_t kExterInterModBorder1 = 196.0;
+  const Float_t kExterInterModBorder2 = 203.5;
+
+  const Float_t kLengthExInModBorder  = 4.7;
+  const Float_t kLengthInCeModBorder  = 7.0;
+
+  const Float_t khAlWall = 0.1;
+
+  // module wall thickness
+  const Float_t kModuleWallThickness = 0.3;
+
+  //  1.5 cm Al honeycomb layer between strips and cards
+  const Float_t kHoneycombLayerThickness = 1.5;
+
+  AliDebug(2,Form("zlenA*0.5 = %d", zlenA*0.5));
+  AliDebug(1, "************************* TOF geometry **************************");
+  
+  // Definition of the Time Of Fligh Resistive Plate Chambers
+  // xFLT, yFLT, zFLT - sizes of TOF modules (large)
+  
+  Float_t  ycoor, zcoor;
+  Float_t  par[3];
+  Int_t    *idtmed = fIdtmed->GetArray()-499;
+  Int_t    idrotm[100];
+
+  par[0] =  xtof * 0.5;
+  par[1] =  ytof * 0.5;
+  par[2] = zlenA * 0.5;
+  gMC->Gsvolu("FTOA", "BOX ", idtmed[503], par, 3);  // fibre glass
+  
+  if (fTOFHoles) {
+    par[2] = (zlenA*0.5 - kInterCentrModBorder1)*0.5;
+    gMC->Gsvolu("FTOB", "BOX ", idtmed[503], par, 3);
+    gMC->Gsvolu("FTOC", "BOX ", idtmed[503], par, 3);
+  }
+
+  // Positioning of modules
+  
+  //AliMatrix(idrotm[0], 90.,  0., 0., 0., 90.,-90.);
+  AliMatrix(idrotm[0], 90.,  0., 0., 0., 90.,270.); // adc
+
+  Float_t zcor3 = 0.;
+
+  gMC->Gspos("FTOA", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
+  gMC->Gspos("FTOA", 0, "BTO3", 0, zcor3,  0, idrotm[0], "ONLY");
+  
+  if (fTOFHoles) {
+    zcor3 = (zlenA*0.5 + kInterCentrModBorder1)*0.5;
+    gMC->Gspos("FTOB", 0, "BTO2", 0, zcor3,  0, idrotm[0], "ONLY");
+    gMC->Gspos("FTOC", 0, "BTO2", 0,-zcor3,  0, idrotm[0], "ONLY");
+  }
+  else gMC->Gspos("FTOA", 0, "BTO2", 0, zcor3,  0, idrotm[0], "ONLY");
+
+  // Large not sensitive volumes with Insensitive Freon  (FLTA, FLTB and FLTC)
+
+  Float_t xFLT, yFLT, zFLTA;
+  
+  xFLT  = xtof  - kModuleWallThickness*2.;
+  yFLT  = ytof  - kModuleWallThickness*2.;
+  zFLTA = zlenA - kModuleWallThickness*2.;
+  
+  par[0] = xFLT*0.5;
+  par[1] = yFLT*0.5;
+
+  par[2] = zFLTA*0.5;
+  gMC->Gsvolu("FLTA", "BOX ", idtmed[507], par, 3); //  Freon mix     ok
+  gMC->Gspos ("FLTA", 0, "FTOA", 0., 0., 0., 0, "ONLY");
+
+  if (fTOFHoles) {
+    par[2] = (zlenA*0.5 - kInterCentrModBorder1-kModuleWallThickness)*0.5;
+    gMC->Gsvolu("FLTB", "BOX ", idtmed[507], par, 3); // Freon mix
+    gMC->Gspos ("FLTB", 0, "FTOB", 0., 0.,  kModuleWallThickness*0.5, 0, "ONLY");
+    gMC->Gsvolu("FLTC", "BOX ", idtmed[507], par, 3); // Freon mix
+    gMC->Gspos ("FLTC", 0, "FTOC", 0., 0., -kModuleWallThickness*0.5, 0, "ONLY");
+  }
+
+  // Layer of Aluminum after detector
+  //par[0] = xFLT*0.5;
+  par[1] = khAlWall*0.5;
+
+  par[2] = zFLTA *0.5;
+  ycoor = (-yFLT + khAlWall)*0.5;
+  gMC->Gsvolu("FALA", "BOX ", idtmed[505], par, 3); // Alluminium     ok
+  gMC->Gspos ("FALA", 0, "FLTA", 0., -ycoor, 0., 0, "ONLY");
+
+  if (fTOFHoles) {
+    par[2] = (zlenA*0.5 - kInterCentrModBorder2-kModuleWallThickness)*0.5;
+    gMC->Gsvolu("FALB", "BOX ", idtmed[505], par, 3); // Alluminium
+    gMC->Gspos ("FALB", 1, "FLTB", 0.,-ycoor, -(kInterCentrModBorder2-kInterCentrModBorder1)*0.5, 0, "ONLY");
+    gMC->Gspos ("FALB", 2, "FLTC", 0.,-ycoor,  (kInterCentrModBorder2-kInterCentrModBorder1)*0.5, 0, "ONLY");
+  }
+
+  Float_t y0, alpha, beta, tgbe, trpa[11], dy, zcoo;
+  dy  = yFLT*0.5;
+
+  // wall between central and intermediate modules
+  y0    = kLengthInCeModBorder;
+  zcoor = kInterCentrModBorder1;
+  zcoo  = kInterCentrModBorder2;
+  alpha = TMath::ATan((dy-2.*y0)/(zcoo-zcoor));
+  beta = (kPi*0.5-alpha)*0.5;
+  tgbe = TMath::Tan(beta);
+  trpa[0]  = xFLT*0.5;//par[0];
+  trpa[1]  = 0.;
+  trpa[2]  = 0.;
+  trpa[3]  = kModuleWallThickness;
+  trpa[4]  = (y0-kModuleWallThickness*tgbe)*0.5;
+  trpa[5]  = (y0+kModuleWallThickness*tgbe)*0.5;
+  trpa[6]  = TMath::ATan(tgbe*0.5)*kRaddeg;
+  trpa[7]  = kModuleWallThickness;
+  trpa[8]  = (y0-kModuleWallThickness*tgbe)*0.5;
+  trpa[9]  = (y0+kModuleWallThickness*tgbe)*0.5;
+  trpa[10] = TMath::ATan(tgbe*0.5)*kRaddeg;
+
+  gMC->Gsvolu("FWZ1","TRAP", idtmed[503], trpa, 11);   // fibre glass
+
+  AliMatrix (idrotm[1],90., 90.,180.,0.,90.,180.);
+  ycoor = -dy + y0*0.5;
+  gMC->Gspos("FWZ1", 1,"FLTA",0.,ycoor, zcoor,idrotm[1],"ONLY");
+
+  AliMatrix (idrotm[4],90., 90.,  0.,0.,90.,  0.);
+  gMC->Gspos("FWZ1", 2,"FLTA",0.,ycoor,-zcoor,idrotm[4],"ONLY");
+
+  if (fTOFHoles) {
+    Float_t y0B = y0 - kModuleWallThickness*0.5*tgbe;
+    Float_t ycoorB = ycoor - kModuleWallThickness*0.25/tgbe;
+    trpa[0]  = xFLT*0.5;//par[0];
+    trpa[1]  = 0.;
+    trpa[2]  = 0.;
+    trpa[3]  = kModuleWallThickness*0.5;
+    trpa[4]  = (y0B-kModuleWallThickness*0.5*tgbe)*0.5;
+    trpa[5]  = (y0B+kModuleWallThickness*0.5*tgbe)*0.5;
+    trpa[6]  = TMath::ATan(tgbe*0.5)*kRaddeg;
+    trpa[7]  = kModuleWallThickness*0.5;
+    trpa[8]  = (y0B-kModuleWallThickness*0.5*tgbe)*0.5;
+    trpa[9]  = (y0B+kModuleWallThickness*0.5*tgbe)*0.5;
+    trpa[10] = TMath::ATan(tgbe*0.5)*kRaddeg;
+    gMC->Gsvolu("FZ1B","TRAP", idtmed[503], trpa, 11);   // fibre glass
+    gMC->Gspos("FZ1B", 5,"FLTB",0.,ycoorB,-zcoor+(zlenA*0.5+kInterCentrModBorder1)*0.5-kModuleWallThickness,idrotm[4],"ONLY");
+    gMC->Gspos("FZ1B", 6,"FLTC",0.,ycoorB,+zcoor-(zlenA*0.5+kInterCentrModBorder1)*0.5+kModuleWallThickness,idrotm[1],"ONLY");
+  }
+
+  AliMatrix (idrotm[2],90.,270.,  0.,0.,90.,180.);
+  ycoor = -y0*0.5;
+  gMC->Gspos("FWZ1", 3,"FLTA",0.,ycoor, zcoo,idrotm[2],"ONLY");
+  AliMatrix (idrotm[5],90.,270.,180.,0.,90.,  0.);
+  gMC->Gspos("FWZ1", 4,"FLTA",0.,ycoor,-zcoo,idrotm[5],"ONLY");
+
+  if (fTOFHoles) {
+    Float_t y0B = y0 + kModuleWallThickness*0.5*tgbe;
+    Float_t ycoorB = ycoor - kModuleWallThickness*0.25/tgbe;
+    trpa[0]  = xFLT*0.5;//par[0];
+    trpa[1]  = 0.;
+    trpa[2]  = 0.;
+    trpa[3]  = kModuleWallThickness*0.5;
+    trpa[4]  = (y0B-kModuleWallThickness*0.5*tgbe)*0.5;
+    trpa[5]  = (y0B+kModuleWallThickness*0.5*tgbe)*0.5;
+    trpa[6]  = TMath::ATan(tgbe*0.5)*kRaddeg;
+    trpa[7]  = kModuleWallThickness*0.5;
+    trpa[8]  = (y0B-kModuleWallThickness*0.5*tgbe)*0.5;
+    trpa[9]  = (y0B+kModuleWallThickness*0.5*tgbe)*0.5;
+    trpa[10] = TMath::ATan(tgbe*0.5)*kRaddeg;
+    gMC->Gsvolu("FZ1C","TRAP", idtmed[503], trpa, 11);   // fibre glass
+    gMC->Gspos("FZ1C", 7,"FLTB",0.,ycoorB,-zcoo+(zlenA*0.5+kInterCentrModBorder1)*0.5-kModuleWallThickness,idrotm[5],"ONLY");
+    gMC->Gspos("FZ1C", 8,"FLTC",0.,ycoorB, zcoo-(zlenA*0.5+kInterCentrModBorder1)*0.5+kModuleWallThickness,idrotm[2],"ONLY");
+  }
+
+  trpa[0] = 0.5*(zcoo-zcoor)/TMath::Cos(alpha);
+  trpa[1] = kModuleWallThickness;
+  trpa[2] = xFLT*0.5;//par[0];
+  trpa[3] = -beta*kRaddeg;
+  trpa[4] = 0.;
+  trpa[5] = 0.;
+  gMC->Gsvolu("FWZ2","PARA", idtmed[503], trpa, 6);    // fibre glass
+  AliMatrix (idrotm[3],     alpha*kRaddeg,90.,90.+alpha*kRaddeg,90.,90.,180.);
+  gMC->Gspos("FWZ2", 1,"FLTA",0.,-dy*0.5, (zcoo+zcoor)*0.5,idrotm[3],"ONLY");
+  AliMatrix (idrotm[6],180.-alpha*kRaddeg,90.,90.-alpha*kRaddeg,90.,90.,  0.);
+  gMC->Gspos("FWZ2", 2,"FLTA",0.,-dy*0.5,-(zcoo+zcoor)*0.5,idrotm[6],"ONLY");
+
+  if (fTOFHoles) {
+    trpa[0] = 0.5*(zcoo-zcoor)/TMath::Cos(alpha);
+    trpa[1] = kModuleWallThickness*0.5;
+    trpa[2] = xFLT*0.5;//par[0];
+    trpa[3] = -beta*kRaddeg;
+    trpa[4] = 0.;
+    trpa[5] = 0.;
+    gMC->Gsvolu("FZ2B","PARA", idtmed[503], trpa, 6);    // fibre glass
+    gMC->Gspos("FZ2B", 3,"FLTB",0.,-dy*0.5-kModuleWallThickness*0.5/tgbe,-(zcoo+zcoor)*0.5+(zlenA*0.5+kInterCentrModBorder1)*0.5-kModuleWallThickness,idrotm[6],"ONLY");
+    gMC->Gspos("FZ2B", 4,"FLTC",0.,-dy*0.5-kModuleWallThickness*0.5/tgbe,+(zcoo+zcoor)*0.5-(zlenA*0.5+kInterCentrModBorder1)*0.5+kModuleWallThickness,idrotm[3],"ONLY");
+  }
+
+  // wall between intermediate and lateral modules
+  y0    = kLengthExInModBorder;//4.7;
+  zcoor = kExterInterModBorder1;//196.;
+  zcoo  = kExterInterModBorder2;//203.5;
+  alpha = TMath::ATan((dy-2.*y0)/(zcoo-zcoor));
+  beta = (kPi*0.5-alpha)*0.5;
+  tgbe = TMath::Tan(beta);
+  trpa[0]  = xFLT*0.5;//par[0];
+  trpa[1]  = 0.;
+  trpa[2]  = 0.;
+  trpa[3]  = kModuleWallThickness;
+  trpa[4]  = (y0-kModuleWallThickness*tgbe)*0.5;
+  trpa[5]  = (y0+kModuleWallThickness*tgbe)*0.5;
+  trpa[6]  = TMath::ATan(tgbe*0.5)*kRaddeg;
+  trpa[7]  = kModuleWallThickness;
+  trpa[8]  = (y0-kModuleWallThickness*tgbe)*0.5;
+  trpa[9]  = (y0+kModuleWallThickness*tgbe)*0.5;
+  trpa[10] = TMath::ATan(tgbe*0.5)*kRaddeg;
+  gMC->Gsvolu("FWZ3","TRAP", idtmed[503], trpa, 11);    // fibre glass
+  ycoor = -y0*0.5;
+  gMC->Gspos("FWZ3", 1,"FLTA",0.,ycoor, zcoor,idrotm[5],"ONLY");
+  gMC->Gspos("FWZ3", 2,"FLTA",0.,ycoor,-zcoor,idrotm[2],"ONLY");
+
+  if (fTOFHoles) {
+    gMC->Gspos("FWZ3", 5,"FLTB",0.,ycoor,-zcoor+(zlenA*0.5 + kInterCentrModBorder1 - kModuleWallThickness)*0.5,idrotm[2],"ONLY");
+    gMC->Gspos("FWZ3", 6,"FLTC",0.,ycoor, zcoor-(zlenA*0.5 + kInterCentrModBorder1 - kModuleWallThickness)*0.5,idrotm[5],"ONLY");
+  }
+  ycoor = -dy+y0*0.5;
+  gMC->Gspos("FWZ3", 3,"FLTA",0.,ycoor, zcoo,idrotm[4],"ONLY");
+  gMC->Gspos("FWZ3", 4,"FLTA",0.,ycoor,-zcoo,idrotm[1],"ONLY");
+
+  if (fTOFHoles) {
+    gMC->Gspos("FWZ3", 7,"FLTB",0.,ycoor,-zcoo+(zlenA*0.5 + kInterCentrModBorder1 - kModuleWallThickness)*0.5,idrotm[1],"ONLY");
+    gMC->Gspos("FWZ3", 8,"FLTC",0.,ycoor, zcoo-(zlenA*0.5 + kInterCentrModBorder1 - kModuleWallThickness)*0.5,idrotm[4],"ONLY");
+  }
+
+  trpa[0] = 0.5*(zcoo-zcoor)/TMath::Cos(alpha);
+  trpa[1] = kModuleWallThickness;
+  trpa[2] = xFLT*0.5;//par[0];
+  trpa[3] = -beta*kRaddeg;
+  trpa[4] = 0.;
+  trpa[5] = 0.;
+  gMC->Gsvolu("FWZ4","PARA", idtmed[503], trpa, 6);    // fibre glass
+  AliMatrix (idrotm[3],alpha*kRaddeg,90.,90.+alpha*kRaddeg,90.,90.,180.);
+  AliMatrix (idrotm[6],180.-alpha*kRaddeg,90.,90.-alpha*kRaddeg,90.,90.,0.);
+  gMC->Gspos("FWZ4", 1,"FLTA",0.,-dy*0.5, (zcoo+zcoor)*0.5,idrotm[6],"ONLY");
+  gMC->Gspos("FWZ4", 2,"FLTA",0.,-dy*0.5,-(zcoo+zcoor)*0.5,idrotm[3],"ONLY");
+
+  if (fTOFHoles) {
+    gMC->Gspos("FWZ4", 3,"FLTB",0.,-dy*0.5,-(zcoo+zcoor)*0.5+(zlenA*0.5 + kInterCentrModBorder1 - kModuleWallThickness)*0.5,idrotm[3],"ONLY");
+    gMC->Gspos("FWZ4", 4,"FLTC",0.,-dy*0.5, (zcoo+zcoor)*0.5-(zlenA*0.5 + kInterCentrModBorder1 - kModuleWallThickness)*0.5,idrotm[6],"ONLY");
+  }
+
+  ///////////////// Detector itself //////////////////////
+
+  const Int_t    knx   = fTOFGeometry->NpadX();  // number of pads along x
+  const Int_t    knz   = fTOFGeometry->NpadZ();  // number of pads along z
+  const Float_t  kPadX = fTOFGeometry->XPad();   // pad length along x
+  const Float_t  kPadZ = fTOFGeometry->ZPad();   // pad length along z
+
+  // new description for strip volume -double stack strip-
+  // -- all constants are expressed in cm
+  // heigth of different layers
+  const Float_t khhony   = 1.0    ;   // heigth of HONY  Layer
+  const Float_t khpcby   = 0.08   ;   // heigth of PCB   Layer
+  const Float_t khrgly   = 0.055  ;   // heigth of RED GLASS  Layer
+  const Float_t khglfy   = 0.285  ;   // heigth of GLASS+FISHLINE  Layer
+  const Float_t khcpcby  = 0.16   ;   // heigth of PCB  Central Layer
+  const Float_t kwhonz   = 8.1    ;   // z dimension of HONEY  Layer
+  const Float_t kwpcbz1  = 10.6   ;   // z dimension of PCB  Lower Layer
+  const Float_t kwpcbz2  = 11.6   ;   // z dimension of PCB  Upper Layer
+  const Float_t kwcpcbz  = 12.4   ;   // z dimension of PCB  Central Layer
+  const Float_t kwrglz   = 8.     ;   // z dimension of RED GLASS  Layer
+  const Float_t kwglfz   = 7.     ;   // z dimension of GLASS+FISHLN Layer
+  const Float_t klsensmx = knx*kPadX; // length of Sensitive Layer
+  const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer // ADC
+  const Float_t kwsensmz = knz*kPadZ; // width of Sensitive Layer
+  
+  // heigth of the FSTR Volume (the strip volume)
+  const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;
+
+  // width  of the FSTR Volume (the strip volume)
+  const Float_t kwstripz = kwcpcbz;
+  // length of the FSTR Volume (the strip volume)
+  const Float_t klstripx = fTOFGeometry->StripLength();//122.;
+  
+  Float_t parfp[3]={klstripx*0.5,khstripy*0.5,kwstripz*0.5};
+  // Coordinates of the strip center in the strip reference frame;
+  // used for positioning internal strip volumes
+  Float_t posfp[3]={0.,0.,0.};  
+
+  // FSTR volume definition-filling this volume with non sensitive Gas Mixture
+  gMC->Gsvolu("FSTR","BOX",idtmed[507],parfp,3);     // Freon mix
+
+  //-- HONY Layer definition
+  parfp[1] = khhony*0.5;
+  parfp[2] = kwhonz*0.5;
+  gMC->Gsvolu("FHON","BOX",idtmed[501],parfp,3);     // honeycomb (Nomex)
+  // positioning 2 HONY Layers on FSTR volume
+  posfp[1] =-khstripy*0.5+parfp[1];
+  gMC->Gspos("FHON",1,"FSTR",0., posfp[1],0.,0,"ONLY");
+  gMC->Gspos("FHON",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
+  
+  //-- PCB Layer definition
+  parfp[1] = khpcby*0.5;
+  parfp[2] = kwpcbz1*0.5;
+  gMC->Gsvolu("FPC1","BOX",idtmed[502],parfp,3);     // G10
+  parfp[2] = kwpcbz2*0.5;
+  gMC->Gsvolu("FPC2","BOX",idtmed[502],parfp,3);     // G10
+  // positioning 2 PCB Layers on FSTR volume
+  posfp[1] =-khstripy*0.5+khhony+parfp[1];
+  gMC->Gspos("FPC1",1,"FSTR",0.,-posfp[1],0.,0,"ONLY");
+  gMC->Gspos("FPC2",1,"FSTR",0., posfp[1],0.,0,"ONLY");
+
+  //-- central PCB layer definition
+  parfp[1] = khcpcby*0.5;
+  parfp[2] = kwcpcbz*0.5;
+  gMC->Gsvolu("FPCB","BOX",idtmed[502],parfp,3);     // G10
+  // positioning the central PCB layer
+  gMC->Gspos("FPCB",1,"FSTR",0.,0.,0.,0,"ONLY");
+  
+  //      Sensitive volume
+  Float_t parfs[3] = {klsensmx*0.5, khsensmy*0.5, kwsensmz*0.5};
+  gMC->Gsvolu("FSEN","BOX",idtmed[508],parfs,3);     // sensitive ...
+  // dividing FSEN along z in knz=2 and along x in knx=48
+  gMC->Gsdvn("FSEZ","FSEN",knz,3);
+  gMC->Gsdvn("FPAD","FSEZ",knx,1);
+  // positioning a Sensitive layer inside FPCB
+  gMC->Gspos("FSEN",1,"FPCB",0.,0.,0.,0,"ONLY");
+
+  //-- RED GLASS Layer definition
+  parfp[1] = khrgly*0.5;
+  parfp[2] = kwrglz*0.5;
+  gMC->Gsvolu("FRGL","BOX",idtmed[509],parfp,3);     // glass
+  // positioning 4 RED GLASS Layers on FSTR volume
+  posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1];
+  gMC->Gspos("FRGL",1,"FSTR",0., posfp[1],0.,0,"ONLY");
+  gMC->Gspos("FRGL",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
+  posfp[1] = (khcpcby+khrgly)*0.5;
+  gMC->Gspos("FRGL",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
+  gMC->Gspos("FRGL",3,"FSTR",0., posfp[1],0.,0,"ONLY");
+
+  //-- GLASS+FISHLINE Layer definition
+  parfp[1] = khglfy*0.5;
+  parfp[2] = kwglfz*0.5;
+  gMC->Gsvolu("FGLF","BOX",idtmed[504],parfp,3);
+
+  // positioning 2 GLASS+FISHLINE Layers on FSTR volume
+  posfp[1] = (khcpcby+khglfy)*0.5+khrgly;
+  gMC->Gspos("FGLF",1,"FSTR",0.,-posfp[1],0.,0,"ONLY");
+  gMC->Gspos("FGLF",2,"FSTR",0., posfp[1],0.,0,"ONLY");
+
+
+  //  Positioning the Strips  (FSTR) in the FLT volumes
+  Int_t maxStripNumbers [5] ={fTOFGeometry->NStripC(),
+                             fTOFGeometry->NStripB(),
+                             fTOFGeometry->NStripA(),
+                             fTOFGeometry->NStripB(),
+                             fTOFGeometry->NStripC()};
+
+  Int_t totalStrip = 0;
+  Float_t zpos, ypos, ang;
+  for(Int_t iplate =0; iplate < fTOFGeometry->NPlates(); iplate++){
+    if (iplate>0) totalStrip += maxStripNumbers[iplate-1];
+    for(Int_t istrip =0; istrip < maxStripNumbers[iplate]; istrip++){
+
+      ang = fTOFGeometry->GetAngles(iplate,istrip);
+      AliDebug(1, Form(" iplate = %1i, istrip = %2i ---> ang = %f", iplate, istrip, ang));
+      if (ang>0.)       AliMatrix (idrotm[istrip+totalStrip+1],90.,0.,90.+ang,90., ang, 90.);
+      else if (ang==0.) AliMatrix (idrotm[istrip+totalStrip+1],90.,0.,90.,90., 0., 0.);
+      else if (ang<0.)  AliMatrix (idrotm[istrip+totalStrip+1],90.,0.,90.+ang,90.,-ang,270.);
+
+
+      zpos = fTOFGeometry->GetDistances(iplate,istrip);
+      ypos = fTOFGeometry->GetHeights(iplate,istrip);
+
+      gMC->Gspos("FSTR",istrip+totalStrip+1,"FLTA",0.,ypos,-zpos,idrotm[istrip+totalStrip+1],  "ONLY");
+
+      if (fTOFHoles) {
+       if (istrip+totalStrip+1>53) gMC->Gspos("FSTR",istrip+totalStrip+1,"FLTC",0.,ypos,-zpos-(zlenA*0.5 + kInterCentrModBorder1 - kModuleWallThickness)*0.5,idrotm[istrip+totalStrip+1],"ONLY");
+       if (istrip+totalStrip+1<39) gMC->Gspos("FSTR",istrip+totalStrip+1,"FLTB",0.,ypos,-zpos+(zlenA*0.5 + kInterCentrModBorder1 - kModuleWallThickness)*0.5,idrotm[istrip+totalStrip+1],"ONLY");
+      }
+    }
+  }
+
+  //  1.5 cm Al honeycomb layer between strips and cards
+  par[0] = xFLT*0.5;
+  par[1] = kHoneycombLayerThickness*0.5;
+  par[2] = zFLTA*0.5;
+  ycoor  = kHoneycombLayerThickness*0.5;
+  gMC->Gsvolu("FPEA", "BOX ", idtmed[506], par, 3);   // Al honeycomb ok giovanni cara romeo
+  gMC->Gspos ("FPEA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+
+  if (fTOFHoles) {
+    par[2] = (zlenA*0.5 - kInterCentrModBorder2-kModuleWallThickness)*0.5;
+    ycoor = kHoneycombLayerThickness*0.5;
+    gMC->Gsvolu("FPEB", "BOX ", idtmed[506], par, 3);   // Al honeycomb ok giovanni cara romeo
+    gMC->Gspos ("FPEB", 1, "FLTB", 0., ycoor, -(kInterCentrModBorder2-kInterCentrModBorder1)*0.5, 0, "ONLY");
+    gMC->Gspos ("FPEB", 2, "FLTC", 0., ycoor,  (kInterCentrModBorder2-kInterCentrModBorder1)*0.5, 0, "ONLY");
+  }
+
+  // frame of Air
+  ycoor += kHoneycombLayerThickness*0.5;
+  //par[0] = xFLT*0.5;
+  par[1] = (yFLT*0.5-kHoneycombLayerThickness-khAlWall)*0.5;
+  par[2] = zFLTA *0.5;
+  ycoor += (yFLT*0.5-kHoneycombLayerThickness-khAlWall)*0.5;
+  gMC->Gsvolu("FAIA", "BOX ", idtmed[500], par, 3); // Air
+  gMC->Gspos ("FAIA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+
+  if (fTOFHoles) {
+    par[2] = (zlenA*0.5 - kInterCentrModBorder2 - kModuleWallThickness)*0.5;
+    gMC->Gsvolu("FAIB", "BOX ", idtmed[500], par, 3); // Air
+    gMC->Gspos ("FAIB", 0, "FLTB", 0., ycoor, -(kInterCentrModBorder2-kInterCentrModBorder1)*0.5, 0, "ONLY");
+    gMC->Gsvolu("FAIC", "BOX ", idtmed[500], par, 3); // Air
+    gMC->Gspos ("FAIC", 0, "FLTC", 0., ycoor,  (kInterCentrModBorder2-kInterCentrModBorder1)*0.5, 0, "ONLY");
+  }
+
+  // start with cards and cooling tubes
+  // finally, cards, cooling tubes and layer for thermal dispersion
+  // 3 volumes
+  
+  // see GEOM200 in GEANT manual
+
+  //AliMatrix(idrotm[98], 90., 0., 90., 90., 0., 0.); // 0 deg
+  
+  Float_t cardpar[3];
+
+  // card volume definition
+  cardpar[0]= xFLT*0.5;
+  cardpar[1]= 5.;
+  cardpar[2]= 0.1;
+  gMC->Gsvolu("FCAR", "BOX ", idtmed[502], cardpar, 3); // PCB Card 
+
+  //alu plate volume definition
+  cardpar[1]= 3.5;
+  cardpar[2]= 0.05;
+  gMC->Gsvolu("FALP", "BOX ", idtmed[505], cardpar, 3); // Alu Plate
+
+  // tube volume definition
+  Float_t tubepar[3];
+  tubepar[0]= 0.;
+  tubepar[1]= 0.4;
+  tubepar[2]= 61.;
+  gMC->Gsvolu("FTUB", "TUBE", idtmed[511], tubepar, 3); // cooling tubes (steel)
+
+  //tubepar[0]= 0.;
+  tubepar[1]= 0.35;
+  //tubepar[2]= 61.;
+  gMC->Gsvolu("FITU", "TUBE", idtmed[510], tubepar, 3); // cooling water
+  // positioning water tube into the steel one
+  gMC->Gspos("FITU",1,"FTUB",0.,0.,0.,0,"ONLY");
+
+  // rotation matrix
+  AliMatrix(idrotm[99], 180., 90., 90., 90., 90., 0.);
+
+  // central module positioning
+  Float_t cardpos[3], aplpos2;
+  Float_t stepforcardA=6.625;
+  Float_t tdis=0.6;
+  Float_t aplpos1 = -2.;
+
+  cardpos[0]= 0.;
+  cardpos[1]= -0.5;
+  cardpos[2]= -53.;
+  //  tubepos= -53.+tdis;
+  Int_t icard;
+  for (icard=39; icard<54; ++icard) {
+    cardpos[2]= cardpos[2]+stepforcardA;
+    aplpos2 = cardpos[2]+0.15;
+    gMC->Gspos("FCAR",icard,"FAIA",cardpos[0],cardpos[1],     cardpos[2],         0,"ONLY"); 
+    gMC->Gspos("FALP",icard,"FAIA",cardpos[0],   aplpos1,        aplpos2,         0,"ONLY");
+    gMC->Gspos("FTUB",icard,"FAIA",        0.,cardpos[1],cardpos[2]+tdis,idrotm[99],"ONLY");
+  }
+  
+  // intermediate module positioning
+  Float_t stepforcardB= 7.05;
+  Float_t offs = 53.;
+
+  cardpos[2]= offs;
+  for (icard=20; icard<39; ++icard) {
+    cardpos[2]= cardpos[2]+stepforcardB;
+    aplpos2 = cardpos[2]+0.15;
+
+    gMC->Gspos("FCAR",icard+34,"FAIA",cardpos[0],cardpos[1],      cardpos[2],         0,"ONLY");
+    gMC->Gspos("FALP",icard+34,"FAIA",cardpos[0],   aplpos1,         aplpos2,         0,"ONLY");
+    gMC->Gspos("FTUB",icard+34,"FAIA",        0.,cardpos[1], cardpos[2]+tdis,idrotm[99],"ONLY");
+    gMC->Gspos("FCAR",58-icard,"FAIA",cardpos[0],cardpos[1],     -cardpos[2],         0,"ONLY");
+    gMC->Gspos("FALP",58-icard,"FAIA",cardpos[0],   aplpos1,        -aplpos2,         0,"ONLY");
+    gMC->Gspos("FTUB",58-icard,"FAIA",        0.,cardpos[1],-cardpos[2]-tdis,idrotm[99],"ONLY");
+
+    if (fTOFHoles) {
+      gMC->Gspos("FCAR",icard+34+182,"FAIC",cardpos[0],cardpos[1],      cardpos[2]-(zlenA*0.5 + kInterCentrModBorder2 - kModuleWallThickness)*0.5,         0,"ONLY");
+      gMC->Gspos("FALP",icard+34+182,"FAIC",cardpos[0],   aplpos1,         aplpos2-(zlenA*0.5 + kInterCentrModBorder2 - kModuleWallThickness)*0.5,         0,"ONLY");
+      gMC->Gspos("FTUB",icard+34+182,"FAIC",        0.,cardpos[1], cardpos[2]+tdis-(zlenA*0.5 + kInterCentrModBorder2 - kModuleWallThickness)*0.5,idrotm[99],"ONLY");
+      gMC->Gspos("FCAR",58-icard+ 91,"FAIB",cardpos[0],cardpos[1],     -cardpos[2]+(zlenA*0.5 + kInterCentrModBorder2 - kModuleWallThickness)*0.5,         0,"ONLY");
+      gMC->Gspos("FALP",58-icard+ 91,"FAIB",cardpos[0],   aplpos1,        -aplpos2+(zlenA*0.5 + kInterCentrModBorder2 - kModuleWallThickness)*0.5,         0,"ONLY");
+      gMC->Gspos("FTUB",58-icard+ 91,"FAIB",        0.,cardpos[1],-cardpos[2]-tdis+(zlenA*0.5 + kInterCentrModBorder2 - kModuleWallThickness)*0.5,idrotm[99],"ONLY");
+    }
+    
+  }
+
+  // outer module positioning
+  Float_t stepforcardC= 8.45238;
+  offs += zlenB;
+  cardpos[2]= offs;
+  for (icard=1; icard<20; ++icard) {
+    cardpos[2]= cardpos[2]+stepforcardC;
+    aplpos2 = cardpos[2]+0.15;
+
+    gMC->Gspos("FCAR",icard+72,"FAIA",cardpos[0],cardpos[1],      cardpos[2],         0,"ONLY"); 
+    gMC->Gspos("FALP",icard+72,"FAIA",cardpos[0],   aplpos1,         aplpos2,         0,"ONLY");
+    gMC->Gspos("FTUB",icard+72,"FAIA",        0.,cardpos[1], cardpos[2]+tdis,idrotm[99],"ONLY");
+    gMC->Gspos("FCAR",20-icard,"FAIA",cardpos[0],cardpos[1],     -cardpos[2],         0,"ONLY");
+    gMC->Gspos("FALP",20-icard,"FAIA",cardpos[0],   aplpos1,        -aplpos2,         0,"ONLY");
+    gMC->Gspos("FTUB",20-icard,"FAIA",        0.,cardpos[1],-cardpos[2]-tdis,idrotm[99],"ONLY");
+
+    if (fTOFHoles) {
+      gMC->Gspos("FCAR",icard+72+182,"FAIC",cardpos[0],cardpos[1],      cardpos[2]-(zlenA*0.5 + kInterCentrModBorder2 - kModuleWallThickness)*0.5,         0,"ONLY");
+      gMC->Gspos("FALP",icard+72+182,"FAIC",cardpos[0],   aplpos1,         aplpos2-(zlenA*0.5 + kInterCentrModBorder2 - kModuleWallThickness)*0.5,         0,"ONLY");
+      gMC->Gspos("FTUB",icard+72+182,"FAIC",        0.,cardpos[1], cardpos[2]+tdis-(zlenA*0.5 + kInterCentrModBorder2 - kModuleWallThickness)*0.5,idrotm[99],"ONLY");
+      gMC->Gspos("FCAR",20-icard+ 91,"FAIB",cardpos[0],cardpos[1],     -cardpos[2]+(zlenA*0.5 + kInterCentrModBorder2 - kModuleWallThickness)*0.5,         0,"ONLY");
+      gMC->Gspos("FALP",20-icard+ 91,"FAIB",cardpos[0],   aplpos1,        -aplpos2+(zlenA*0.5 + kInterCentrModBorder2 - kModuleWallThickness)*0.5,         0,"ONLY");
+      gMC->Gspos("FTUB",20-icard+ 91,"FAIB",        0.,cardpos[1],-cardpos[2]-tdis+(zlenA*0.5 + kInterCentrModBorder2 - kModuleWallThickness)*0.5,idrotm[99],"ONLY");
+    }
+  }
+
+}
+//_____________________________________________________________________________
+void AliTOFv5T0::DrawModule() const
+{
+  //
+  // Draw a shaded view of the Time Of Flight version 4
+  //
+
+  // 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   -
+
+  gMC->Gsatt("BTR1","seen", 0);  // all BTR1 sub-levels skipped   -
+  gMC->Gsatt("BTO1","seen", 0);
+
+  // Level 2 of B074
+  gMC->Gsatt("BTR2","seen", 0);  // all BTR1 sub-levels skipped   -
+  gMC->Gsatt("BTO2","seen", 0);
+
+  // Level 2 of B075
+  gMC->Gsatt("BTR3","seen", 0);  // all BTR1 sub-levels skipped   -
+  gMC->Gsatt("BTO3","seen", 0);
+
+  // Level 3 of B071, B074 and B075
+  gMC->Gsatt("FTOA","SEEN", 0);
+  if (fTOFHoles) gMC->Gsatt("FTOB","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",-1);  // all FAIA sub-levels skipped   -
+  if (fTOFHoles) gMC->Gsatt("FAIB","SEEN",-1);  // all FAIB sub-levels skipped   -
+  if (fTOFHoles) gMC->Gsatt("FAIC","SEEN",-1);  // all FAIC sub-levels skipped   -
+
+  gMC->Gsatt("FALA","SEEN", 0);
+  if (fTOFHoles) gMC->Gsatt("FALB","SEEN", 0);
+
+  gMC->Gsatt("FPEA","SEEN", 1);
+  if (fTOFHoles) gMC->Gsatt("FPEB","SEEN", 1);
+
+  gMC->Gsatt("FSTR","SEEN",-1);  // all FSTR sub-levels skipped   -
+
+  gMC->Gsatt("FWZ1","SEEN", 0);
+  gMC->Gsatt("FWZ2","SEEN", 0);
+  gMC->Gsatt("FWZ3","SEEN", 0);
+  gMC->Gsatt("FWZ4","SEEN", 0);
+  if (fTOFHoles) {
+    gMC->Gsatt("FZ1B","SEEN", 0);
+    gMC->Gsatt("FZ1C","SEEN", 0);
+    gMC->Gsatt("FZ2B","SEEN", 0);
+  }
+
+  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 AliTOFv5T0::DrawDetectorModules()
+{
+  //
+  // Draw a shaded view of the TOF detector version 4
+  //
+  // 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   -
+
+  gMC->Gsatt("BTR1","seen", 0);  // all BTR1 sub-levels skipped   -
+  gMC->Gsatt("BTO1","seen", 0);
+
+  // Level 2 of B074
+  gMC->Gsatt("BTR2","seen", 0);  // all BTR1 sub-levels skipped   -
+  gMC->Gsatt("BTO2","seen", 0);
+
+  // Level 2 of B075
+  gMC->Gsatt("BTR3","seen", 0);  // all BTR1 sub-levels skipped   -
+  gMC->Gsatt("BTO3","seen", 0);
+
+  // 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   -
+    gMC->Gsatt("FTOC","seen",-2);  // all FTOC 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 AliTOFv5T0::DrawDetectorStrips()
+{
+  //
+  // Draw a shaded view of the TOF strips for version 4
+  //
+
+  // 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   -
+
+  gMC->Gsatt("BTR1","seen", 0);  // all BTR1 sub-levels skipped   -
+  gMC->Gsatt("BTO1","seen", 0);
+
+  // Level 2 of B074
+  gMC->Gsatt("BTR2","seen", 0);  // all BTR1 sub-levels skipped   -
+  gMC->Gsatt("BTO2","seen", 0);
+
+  // Level 2 of B075
+  gMC->Gsatt("BTR3","seen", 0);  // all BTR1 sub-levels skipped   -
+  gMC->Gsatt("BTO3","seen", 0);
+
+  // Level 3 of B071, B074 and B075
+  gMC->Gsatt("FTOA","SEEN", 0);
+  if (fTOFHoles) {
+    gMC->Gsatt("FTOB","SEEN", 0);
+    gMC->Gsatt("FTOC","SEEN", 0);
+  }
+
+  // Level 4 of B071, B074 and B075
+  gMC->Gsatt("FLTA","SEEN", 0);
+  if (fTOFHoles) {
+    gMC->Gsatt("FLTB","SEEN", 0);
+    gMC->Gsatt("FLTC","SEEN", 0);
+  }
+
+  // Level 5 of B071, B074 and B075
+  gMC->Gsatt("FAIA","SEEN",-1);  // all FAIA sub-levels skipped   -
+  if (fTOFHoles) {
+    gMC->Gsatt("FAIB","SEEN",-1);  // all FAIB sub-levels skipped   -
+    gMC->Gsatt("FAIC","SEEN",-1);  // all FAIC sub-levels skipped   -
+  }
+
+  gMC->Gsatt("FALA","SEEN", 0);
+  if (fTOFHoles) gMC->Gsatt("FALB","SEEN", 0);
+
+  gMC->Gsatt("FPEA","SEEN", 0);
+  if (fTOFHoles) gMC->Gsatt("FPEB","SEEN", 0);
+
+  gMC->Gsatt("FSTR","SEEN",-2);  // all FSTR sub-levels skipped   -
+
+  gMC->Gsatt("FWZ1","SEEN", 0);
+  gMC->Gsatt("FWZ2","SEEN", 0);
+  gMC->Gsatt("FWZ3","SEEN", 0);
+  gMC->Gsatt("FWZ4","SEEN", 0);
+  if (fTOFHoles){
+    gMC->Gsatt("FZ1B","SEEN", 0);
+    gMC->Gsatt("FZ1C","SEEN", 0);
+    gMC->Gsatt("FZ2B","SEEN", 0);
+  }
+
+  /*
+  // Level 2 of FAIA
+  // Level 2 of FAIB
+  // Level 2 of FAIC
+  gMC->Gsatt("FALP","SEEN",0);
+  gMC->Gsatt("FCAR","SEEN",0);
+  gMC->Gsatt("FTUB","SEEN",-1);  // all FTUB sub-levels skipped   -
+
+  // Level 2 of FTUB
+  gMC->Gsatt("FITU","SEEN",0);
+  */
+
+  /*
+  // Level 2 of FSTR
+  gMC->Gsatt("FGLF","SEEN",0);
+  gMC->Gsatt("FHON","SEEN",0);
+  gMC->Gsatt("FPC1","SEEN",0);
+  gMC->Gsatt("FPC2","SEEN",0);
+  gMC->Gsatt("FPCB","SEEN",0);
+  gMC->Gsatt("FRGL","SEEN",0);
+
+  // 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 AliTOFv5T0::CreateMaterials()
+{
+  //
+  // Define materials for the Time Of Flight
+  //
+
+  //AliTOF::CreateMaterials();
+
+  Int_t   isxfld = gAlice->Field()->Integ();
+  Float_t sxmgmx = gAlice->Field()->Max();
+  Float_t we[7], ae[7], na[7], fr[7], vl[7];
+  Int_t i;
+
+  //
+  //--- Quartz (SiO2) to simulate float glass
+  //    density tuned to have correct float glass 
+  //    radiation length
+  Float_t   aq[2] = { 28.0855,15.9994 };
+  Float_t   zq[2] = { 14.,8. };
+  Float_t   wq[2] = { 1.,2. };
+  Float_t   dq = 2.55; // std value: 2.2
+  Int_t nq = -2;
+
+  // --- Nomex
+  Float_t anox[4] = {12.01,1.01,16.00,14.01};
+  Float_t znox[4] = { 6.,  1.,  8.,  7.};
+  Float_t wnox[4] = {14., 22., 2., 2.};
+  Float_t dnox  = 0.048;
+  Int_t nnox   = -4;
+
+  //  { Si, C, H, O }
+  Float_t ag10[4] = {28.09,12.01,1.01,16.00};
+  Float_t zg10[4] = {14.,  6.,  1.,  8.};
+  Float_t wmatg10[4];
+  Int_t nlmatg10  = 4;
+  for (i = 0; i < nlmatg10; ++i) {
+    ae[i] = ag10[i];
+    vl[i] = 1.;
+  }
+  ae[4] = 16.00;
+  vl[4] = 1.;
+  na[0] = 1.; 
+  na[1] = 14.;
+  na[2] = 20.;
+  na[3] = 2.;
+  na[4] = 3.;
+  fr[0] = 0.6;
+  fr[1] = 0.4;
+  fr[2] = 0.4;
+  fr[3] = 0.6;
+  fr[4] = 0.4;
+  MaterialMixer(we,ae,na,fr,vl,5);
+  we[3] += we[4];
+  wmatg10[0]= we[0];
+  wmatg10[1]= we[1];
+  wmatg10[2]= we[2];
+  wmatg10[3]= we[3];
+  Float_t densg10 = 1.7;
+
+  // -- Water
+  Float_t awa[2] = {  1., 16. };
+  Float_t zwa[2] = {  1.,  8. };
+  Float_t wwa[2] = {  2.,  1. };
+  Float_t dwa    = 1.0;
+  Int_t nwa = -2;
+
+  // stainless steel
+  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 };
+
+  // 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;
+
+  // --- fibre glass
+  Float_t afg[4] = {28.09,16.00,12.01,1.01};
+  Float_t zfg[4] = {14., 8., 6., 1.};
+  Float_t wfg[4] = {0.12906,0.29405,0.51502,0.06187};
+  Float_t dfg  = 1.111;
+  Int_t nfg   = 4;
+
+  // --- Freon C2F4H2 + SF6
+  Float_t afre[4]= {12.01,1.01,19.00,32.07};
+  Float_t zfre[4]= { 6., 1., 9., 16.};
+  Float_t wfre[4]= {0.21250,0.01787,0.74827,0.021355};
+  Float_t densfre= 0.00375;
+  Int_t nfre  = 4;
+
+  char namat[15] = "            ";
+  Float_t ama[2], zma[2], dma, radl, absl, buf[1];
+  Int_t nbuf;
+
+  AliMixture ( 0, "Air$", aAir, zAir, dAir, 4, wAir);
+  AliMixture ( 1, "Nomex$", anox, znox, dnox, nnox, wnox);
+  AliMixture ( 2, "G10$", ag10, zg10, densg10, nlmatg10, wmatg10);
+  AliMixture ( 3, "fibre glass$", afg, zfg, dfg, nfg, wfg);
+  AliMaterial( 4, "Al $", 26.98, 13., 2.7, 8.9, 37.2);
+  AliMaterial( 5, "Al honeycomb$", 26.98, 13., 0.0496, 483., 2483.);
+  AliMixture ( 6, "Freon$",  afre, zfre, densfre, nfre, wfre);
+  AliMixture ( 7, "Glass$", aq, zq, dq, nq, wq);
+
+  // get freon and glass
+  gMC->Gfmate((*fIdmate)[6],namat,ama[0],zma[0],dma,radl,absl,buf,nbuf);
+  gMC->Gfmate((*fIdmate)[7],namat,ama[1],zma[1],dma,radl,absl,buf,nbuf);
+
+  // --- glass-freon
+  Float_t wgfr[2]= {0.0011,0.9989};
+  Float_t dgfr = 1.434;
+  Int_t ngfr  = 2;
+  AliMixture ( 8, "glass-freon$", ama, zma, dgfr, ngfr, wgfr);
+  AliMixture ( 9, "Water$",  awa, zwa, dwa, nwa, wwa);
+  AliMixture (10, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel);
+
+  Float_t epsil, stmin, deemax, stemax;
+  //   Previous data
+  //       EPSIL  = 0.1   ! Tracking precision,
+  //       STEMAX = 0.1   ! Maximum displacement for multiple scattering
+  //       DEEMAX = 0.1   ! Maximum fractional energy loss, DLS
+  //       STMIN  = 0.1
+
+  //   New data
+  epsil  = .001;  // Tracking precision,
+  stemax = -1.;   // Maximum displacement for multiple scattering
+  deemax = -.3;   // Maximum fractional energy loss, DLS
+  stmin  = -.8;
+
+  AliMedium( 1, "Air$",         0, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 2,"Nomex$",        1, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 3,"G10$",          2, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 4,"fibre glass$",  3, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 5,"glass-freon$",  8, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 6,"Al Frame$",     4, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 7,"Al honeycomb$", 5, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 8,"Fre$",          6, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 9,"PCB-S$",        2, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium(10,"Glass$",        7, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium(11,"Water$",        9, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium(12,"STEEL$",       10, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+
+}
+//_____________________________________________________________________________
+void AliTOFv5T0::Init()
+{
+  //
+  // Initialise the detector after the geometry has been defined
+  //
+  AliDebug(1, "**************************************"
+           "  TOF  "
+           "**************************************");
+  AliDebug(1, "  Version 4 of TOF initialing, "
+          "symmetric TOF - Full Coverage version");
+  
+  AliTOF::Init();
+  
+  fIdFTOA = gMC->VolId("FTOA");
+  if (fTOFHoles) {
+    fIdFTOB = gMC->VolId("FTOB");
+    fIdFTOC = gMC->VolId("FTOC");
+  }
+  fIdFLTA = gMC->VolId("FLTA");
+  if (fTOFHoles) {
+    fIdFLTB = gMC->VolId("FLTB");
+    fIdFLTC = gMC->VolId("FLTC");
+  }
+
+  AliDebug(1, "**************************************"
+           "  TOF  "
+           "**************************************");
+}
+//_____________________________________________________________________________
+void AliTOFv5T0::StepManager()
+{
+
+  //
+  // Procedure called at each step in the Time Of Flight
+  //
+
+  TLorentzVector mom, pos;
+  Float_t xm[3],pm[3],xpad[3],ppad[3];
+  Float_t hits[14],phi,phid;
+  Int_t   vol[5];
+  Int_t   plate = -1;
+  Int_t   sector, padx, padz, strip;
+  Int_t   copy, padzid, padxid, stripid, i;
+  Int_t   *idtmed = fIdtmed->GetArray()-499;
+  Float_t incidenceAngle;
+
+  if(
+     gMC->IsTrackEntering()
+     && gMC->TrackCharge()
+     && gMC->GetMedium()==idtmed[508]
+     && gMC->CurrentVolID(copy)==fIdSens
+     )
+  {
+
+    AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
+
+    // getting information about hit volumes
+    
+    padzid=gMC->CurrentVolOffID(1,copy);
+    padz=copy;
+    padz--;
+
+    padxid=gMC->CurrentVolOffID(0,copy);
+    padx=copy; 
+    padx--;
+    
+    stripid=gMC->CurrentVolOffID(4,copy);
+    strip=copy; 
+    strip--;
+
+    gMC->TrackPosition(pos);
+    gMC->TrackMomentum(mom);
+
+    Double_t normMom=1./mom.Rho();
+
+    //  getting the coordinates in pad ref system
+
+    xm[0] = (Float_t)pos.X();
+    xm[1] = (Float_t)pos.Y();
+    xm[2] = (Float_t)pos.Z();
+
+    pm[0] = (Float_t)mom.X()*normMom;
+    pm[1] = (Float_t)mom.Y()*normMom;
+    pm[2] = (Float_t)mom.Z()*normMom;
+    gMC->Gmtod(xm,xpad,1); // from MRS to DRS: coordinates convertion
+    gMC->Gmtod(pm,ppad,2); // from MRS to DRS: direction cosinus convertion
+
+
+    if (TMath::Abs(ppad[1])>1) {
+      AliWarning("Abs(ppad) > 1");
+      ppad[1]=TMath::Sign((Float_t)1,ppad[1]);
+    }
+    incidenceAngle = TMath::ACos(ppad[1])*kRaddeg;
+
+    phi = pos.Phi();
+    if (phi>=0.) phid = phi*kRaddeg;
+    else phid = phi*kRaddeg + 360.;
+
+    sector = Int_t (phid/20.);
+
+    if      (strip <  fTOFGeometry->NStripC()) {
+      plate = 0;
+      //strip = strip;
+    }
+    else if (strip >= fTOFGeometry->NStripC() && 
+            strip <  fTOFGeometry->NStripC() + fTOFGeometry->NStripB()) {
+      plate = 1;
+      strip = strip - fTOFGeometry->NStripC();
+    }
+    else if (strip >= fTOFGeometry->NStripC() + fTOFGeometry->NStripB() &&
+            strip <  fTOFGeometry->NStripC() + fTOFGeometry->NStripB() + fTOFGeometry->NStripA()) {
+      plate = 2;
+      strip = strip - fTOFGeometry->NStripC() - fTOFGeometry->NStripB();
+    }
+    else if (strip >= fTOFGeometry->NStripC() + fTOFGeometry->NStripB() + fTOFGeometry->NStripA() &&
+            strip <  fTOFGeometry->NStripC() + fTOFGeometry->NStripB() + fTOFGeometry->NStripA() + fTOFGeometry->NStripB()) {
+      plate = 3;
+      strip = strip - fTOFGeometry->NStripC() - fTOFGeometry->NStripB() - fTOFGeometry->NStripA();
+    }
+    else                                {
+      plate = 4;
+      strip = strip - fTOFGeometry->NStripC() - fTOFGeometry->NStripB() - fTOFGeometry->NStripA() - fTOFGeometry->NStripB();
+    }
+
+    for(i=0;i<3;++i) {
+      hits[i]   = pos[i];
+      hits[i+3] = pm[i];
+    }
+
+    hits[6] = mom.Rho();
+    hits[7] = pos[3];
+    hits[8] = xpad[0];
+    hits[9] = xpad[1];
+    hits[10]= xpad[2];
+    hits[11]= incidenceAngle;
+    hits[12]= gMC->Edep();
+    hits[13]= gMC->TrackLength();
+    
+    vol[0]= sector;
+    vol[1]= plate;
+    vol[2]= strip;
+    vol[3]= padx;
+    vol[4]= padz;    
+
+    AddT0Hit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits);
+  }
+}
+//-------------------------------------------------------------------
+void AliTOFv5T0::MaterialMixer(Float_t* p,Float_t* a,Float_t* m,Float_t* d,Float_t* s,Int_t n) {
+  // a[] atomic weights vector  (in)
+  //     (atoms present in more compound appear separately)
+  // m[] number of corresponding atoms in the mixture  (in)
+  // d[] fraction of the compound relative to the corresponding atoms  (in)
+  // s[] further possible weights     "        "        "        "     (in)
+  Float_t t = 0.;
+  for (Int_t i = 0; i < n; ++i) {
+    p[i] = a[i]*m[i]*d[i]*s[i];
+    t  += p[i];
+  }
+  for (Int_t i = 0; i < n; ++i) {
+    p[i] = p[i]/t;
+    //    AliInfo(Form((\n weight[%i] = %f (,i,p[i]));
+  }
+}
diff --git a/TOF/AliTOFv5T0.h b/TOF/AliTOFv5T0.h
new file mode 100644 (file)
index 0000000..3da9a0a
--- /dev/null
@@ -0,0 +1,52 @@
+//_________________________________________________________________________
+// Implementation version v5 of TOF Manager class
+// FULL COVERAGE VERSION + OPTION FOR PHOS HOLES
+//
+//*-- Authors: G. Cara Romeo, A. De Caro
+
+#ifndef ALITOFv5T0_H
+#define ALITOFv5T0_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+#include "AliTOF.h"
+class AliTOFv5T0 : public AliTOF {
+
+public:
+  AliTOFv5T0();
+  AliTOFv5T0(const char *name, const char *title);
+  virtual ~AliTOFv5T0() {   if (fTOFGeometry) {delete fTOFGeometry; 
+    fTOFGeometry  = 0;  }
+}
+  virtual void   BuildGeometry();
+  virtual void   CreateGeometry();
+  virtual void   CreateMaterials();
+  virtual void   Init();
+  virtual Int_t  IsVersion() const {return 7;}
+  virtual void   TOFpc(Float_t xtof,  Float_t ytof, Float_t zlenA,
+                      Float_t zlenB);
+  virtual void   TOFpc(Float_t, Float_t, Float_t, Float_t, Float_t, Float_t) {};
+  virtual void   StepManager();
+  virtual void   DrawModule() const;
+  virtual void   DrawDetectorModules();
+  virtual void   DrawDetectorStrips();
+ protected:
+
+  void MaterialMixer(Float_t* p,Float_t* a,Float_t* m,Float_t* d,Float_t* s,Int_t n);
+
+private:
+  Int_t fIdFTOA; // FTOA volume identifier (outer plate A)
+  Int_t fIdFTOB; // FTOB volume identifier (outer plate B)
+  Int_t fIdFTOC; // FTOC volume identifier (outer plate C)
+  Int_t fIdFLTA; // FLTA volume identifier (inner plate A)
+  Int_t fIdFLTB; // FLTB volume identifier (inner plate B)
+  Int_t fIdFLTC; // FLTC volume identifier (inner plate C)
+  Bool_t fTOFHoles; // Selecting Geometry with and w/o holes
+  ClassDef(AliTOFv5T0,0)  //Time Of Flight version 5
+};
+#endif /* ALITOFv5T0_H */
index 9d6cfc88cc65d38534dccd7d600d8a9219de7ebf..6a63b22aa72209b1887765ce4d9e9336dab6b00f 100644 (file)
@@ -9,6 +9,8 @@
 #pragma link off all functions;
  
 #pragma link C++ class  AliTOFGeometry+;
+#pragma link C++ class  AliTOFGeometryV4+;
+#pragma link C++ class  AliTOFGeometryV5+;
 #pragma link C++ class  AliTOFdigit+;
 #pragma link C++ class  AliTOFRawStream+;
 
index 0ffba3cd7c047f27c203cc5d1ebc2290197a5eba..ccd9c59b0567e22879a6b34ecfa2a3936ff51dee 100644 (file)
@@ -9,6 +9,7 @@
 #pragma link off all functions;
  
 #pragma link C++ class  AliTOF+;
+#pragma link C++ class  AliTOFv5T0+;
 #pragma link C++ class  AliTOFv4T0+;
 #pragma link C++ class  AliTOFhit+;
 #pragma link C++ class  AliTOFhitT0+;
index 7def8de607241e4adb51d247e551413a564d9ce0..483e2859642ada2c1386b68b0b6b0c6e4da34c90 100644 (file)
@@ -2,7 +2,9 @@
 # $Id$
 
 SRCS  = AliTOFGeometry.cxx  \
-        AliTOFdigit.cxx     \
+       AliTOFGeometryV4.cxx  \
+       AliTOFGeometryV5.cxx  \
+        AliTOFdigit.cxx  \
         AliTOFRawStream.cxx
 
 HDRS:= $(SRCS:.cxx=.h)
index 7a5ca9603d483663bbc33883d184b5af7caf3013..087bf09e45e32c44f93c7fa1d467560cf583bdd4 100644 (file)
@@ -1,7 +1,7 @@
 #-*- Mode: Makefile -*-
 # $Id$
 
-SRCS  = AliTOF.cxx  AliTOFv4T0.cxx  \
+SRCS  = AliTOF.cxx  AliTOFv5T0.cxx  AliTOFv4T0.cxx  \
        AliTOFhit.cxx  AliTOFhitT0.cxx  \
        AliTOFHitMap.cxx  \
        AliTOFSDigit.cxx  AliTOFSDigitizer.cxx  \