]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDgeometry.cxx
New transformation function (M.Ivanov)
[u/mrichter/AliRoot.git] / TRD / AliTRDgeometry.cxx
index 179304325cef2514fc227f8e5dfb864e75bb6bb0..286c13e7904172345ce2e2d15ad2798c2d625015 100644 (file)
 
 /*
 $Log$
+Revision 1.24  2003/09/18 09:06:07  cblume
+Geometry update, Removal of compiler warnings
+
+Revision 1.22  2002/11/21 22:38:47  alibrary
+Removing AliMC and AliMCProcess
+
+Revision 1.21  2002/11/21 16:09:44  cblume
+Change fgkRpadW to 1.0 cm for new pad plane
+
+Revision 1.20  2002/10/31 17:45:35  cblume
+New chamber geometry
+
+Revision 1.19  2002/10/14 14:57:43  hristov
+Merging the VirtualMC branch to the main development branch (HEAD)
+
+Revision 1.15.6.2  2002/07/24 10:09:30  alibrary
+Updating VirtualMC
+
+Revision 1.15.6.1  2002/06/10 15:28:58  hristov
+Merged with v3-08-02
+
+Revision 1.17  2002/04/05 13:20:12  cblume
+Remove const for CreateGeometry
+
+Revision 1.16  2002/03/28 14:59:07  cblume
+Coding conventions
+
+Revision 1.18  2002/06/12 09:54:35  cblume
+Update of tracking code provided by Sergei
+
+Revision 1.17  2002/04/05 13:20:12  cblume
+Remove const for CreateGeometry
+
+Revision 1.16  2002/03/28 14:59:07  cblume
+Coding conventions
+
+Revision 1.15  2002/02/11 14:21:16  cblume
+Update of the geometry. Get rid of MANY
+
+Revision 1.14  2001/11/06 17:19:41  cblume
+Add detailed geometry and simple simulator
+
 Revision 1.13  2001/08/02 08:30:45  cblume
 Fix positions of cooling material
 
@@ -95,11 +137,9 @@ Add new TRD classes
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "AliMC.h"
 
 #include "AliTRDgeometry.h"
-#include "AliTRDrecPoint.h"
-#include "AliMC.h"
+#include "AliTRDparameter.h"
 
 ClassImp(AliTRDgeometry)
 
@@ -116,12 +156,16 @@ ClassImp(AliTRDgeometry)
   //
   // Dimensions of the detector
   //
+
+  // Inner and outer radius of the mother volumes 
   const Float_t AliTRDgeometry::fgkRmin    = 294.0;
   const Float_t AliTRDgeometry::fgkRmax    = 368.0;
 
+  // Upper and lower length of the mother volumes 
   const Float_t AliTRDgeometry::fgkZmax1   = 378.35; 
   const Float_t AliTRDgeometry::fgkZmax2   = 302.0; 
 
+  // Parameter of the BTR mother volumes 
   const Float_t AliTRDgeometry::fgkSheight =  74.0; 
   const Float_t AliTRDgeometry::fgkSwidth1 =  99.613;
   const Float_t AliTRDgeometry::fgkSwidth2 = 125.707;
@@ -129,45 +173,78 @@ ClassImp(AliTRDgeometry)
   const Float_t AliTRDgeometry::fgkSlenTR2 = 313.5; 
   const Float_t AliTRDgeometry::fgkSlenTR3 = 159.5;  
 
-  const Float_t AliTRDgeometry::fgkCheight =  11.0;  
-  const Float_t AliTRDgeometry::fgkCspace  =   1.6;
-  const Float_t AliTRDgeometry::fgkCathick =   1.0; 
-  const Float_t AliTRDgeometry::fgkCcthick =   1.0;
-  const Float_t AliTRDgeometry::fgkCaframe =   2.675; 
-  const Float_t AliTRDgeometry::fgkCcframe = AliTRDgeometry::fgkCheight 
-                                           - AliTRDgeometry::fgkCaframe;
+  // The super module side plates
+  const Float_t AliTRDgeometry::fgkSMpltT  = 0.2;
+  const Float_t AliTRDgeometry::fgkSMgapT  = 0.5;  
+
+  // Height of different chamber parts
+  // Radiator
+  const Float_t AliTRDgeometry::fgkCraH    =   4.8; 
+  // Drift region
+  const Float_t AliTRDgeometry::fgkCdrH    =   3.0;
+  // Amplification region
+  const Float_t AliTRDgeometry::fgkCamH    =   0.7;
+  // Readout
+  const Float_t AliTRDgeometry::fgkCroH    =   2.316;
+  // Total height
+  const Float_t AliTRDgeometry::fgkCH      = AliTRDgeometry::fgkCraH
+                                           + AliTRDgeometry::fgkCdrH
+                                           + AliTRDgeometry::fgkCamH
+                                           + AliTRDgeometry::fgkCroH;  
+
+  // Vertical spacing of the chambers
+  const Float_t AliTRDgeometry::fgkVspace  =   1.784;
+
+  // Horizontal spacing of the chambers
+  const Float_t AliTRDgeometry::fgkHspace  =   2.0;
+
+  // Thicknesses of different parts of the chamber frame
+  // Lower aluminum frame
+  const Float_t AliTRDgeometry::fgkCalT    =   0.3;
+  // Lower G10 frame sides
+  const Float_t AliTRDgeometry::fgkCclsT   =   0.3;
+  // Lower G10 frame front
+  const Float_t AliTRDgeometry::fgkCclfT   =   1.0;
+  // Upper G10 frame
+  const Float_t AliTRDgeometry::fgkCcuT    =   0.9;
+  // Upper Al frame
+  const Float_t AliTRDgeometry::fgkCauT    =   1.5;
+
+  // Additional width of the readout chamber frames
+  const Float_t AliTRDgeometry::fgkCroW    =   0.9;
+
+  // Difference of outer chamber width and pad plane width
+  //const Float_t AliTRDgeometry::fgkCpadW   =   1.0;
+  const Float_t AliTRDgeometry::fgkCpadW   =   0.0;
+  const Float_t AliTRDgeometry::fgkRpadW   =   1.0;
 
   //
   // Thickness of the the material layers
   //
   const Float_t AliTRDgeometry::fgkRaThick = 0.3646;  
   const Float_t AliTRDgeometry::fgkMyThick = 0.005;
-  const Float_t AliTRDgeometry::fgkXeThick = 3.5;
-  const Float_t AliTRDgeometry::fgkDrThick = 3.0;
-  const Float_t AliTRDgeometry::fgkAmThick = AliTRDgeometry::fgkXeThick 
-                                           - AliTRDgeometry::fgkDrThick;
+  const Float_t AliTRDgeometry::fgkDrThick = AliTRDgeometry::fgkCdrH;    
+  const Float_t AliTRDgeometry::fgkAmThick = AliTRDgeometry::fgkCamH;
+  const Float_t AliTRDgeometry::fgkXeThick = AliTRDgeometry::fgkDrThick
+                                           + AliTRDgeometry::fgkAmThick;
   const Float_t AliTRDgeometry::fgkCuThick = 0.001; 
   const Float_t AliTRDgeometry::fgkSuThick = 0.06; 
   const Float_t AliTRDgeometry::fgkFeThick = 0.0044; 
   const Float_t AliTRDgeometry::fgkCoThick = 0.02;
-//const Float_t AliTRDgeometry::fgkWaThick = 0.01;
   const Float_t AliTRDgeometry::fgkWaThick = 0.02;
 
   //
   // Position of the material layers
   //
-  const Float_t AliTRDgeometry::fgkRaZpos  = -1.74;
-  const Float_t AliTRDgeometry::fgkMyZpos  =  0.6550;
-  const Float_t AliTRDgeometry::fgkDrZpos  =  2.1600;
-  const Float_t AliTRDgeometry::fgkAmZpos  =  3.9100;
-  const Float_t AliTRDgeometry::fgkCuZpos  = -1.3370; 
+  const Float_t AliTRDgeometry::fgkRaZpos  = -1.50;
+  const Float_t AliTRDgeometry::fgkMyZpos  =  0.895;
+  const Float_t AliTRDgeometry::fgkDrZpos  =  2.4;
+  const Float_t AliTRDgeometry::fgkAmZpos  =  0.0;
+  const Float_t AliTRDgeometry::fgkCuZpos  = -0.9995;
   const Float_t AliTRDgeometry::fgkSuZpos  =  0.0000;
-//const Float_t AliTRDgeometry::fgkFeZpos  =  1.3053;
-//const Float_t AliTRDgeometry::fgkCoZpos  =  1.3175;
-//const Float_t AliTRDgeometry::fgkWaZpos  =  1.3325;
-  const Float_t AliTRDgeometry::fgkFeZpos  =  1.2853;
-  const Float_t AliTRDgeometry::fgkCoZpos  =  1.2975;
-  const Float_t AliTRDgeometry::fgkWaZpos  =  1.3175;
+  const Float_t AliTRDgeometry::fgkFeZpos  =  0.0322;
+  const Float_t AliTRDgeometry::fgkCoZpos  =  0.97;
+  const Float_t AliTRDgeometry::fgkWaZpos  =  0.99;
 
 //_____________________________________________________________________________
 AliTRDgeometry::AliTRDgeometry():AliGeometry()
@@ -195,17 +272,6 @@ void AliTRDgeometry::Init()
   //
   // Initializes the geometry parameter
   //
-
-  Int_t isect;
-
-  // The width of the chambers
-  fCwidth[0] =  99.6;
-  fCwidth[1] = 104.1;
-  fCwidth[2] = 108.5;
-  fCwidth[3] = 112.9;
-  fCwidth[4] = 117.4;
-  fCwidth[5] = 121.8;
-
   // The maximum number of pads
   // and the position of pad 0,0,0 
   // 
@@ -229,20 +295,39 @@ void AliTRDgeometry::Init()
   // closest to the readout !!!
   //
 
-  // The pad column (rphi-direction)  
-  SetNColPad(96);
-
-  // The number of time bins. Default is 100 ns timbin size
-  SetNTimeBin(15);
+  Int_t icham;
+  Int_t iplan;
+  Int_t isect;
 
-  // Additional time bins before and after the drift region.
-  // Default is to only sample the drift region
-  SetExpandTimeBin(0,0);
+  // The outer width of the chambers
+  fCwidth[0] =  94.8;
+  fCwidth[1] =  99.3;
+  fCwidth[2] = 103.7;
+  fCwidth[3] = 108.1;
+  fCwidth[4] = 112.6;
+  fCwidth[5] = 117.0;
+
+  // The outer lengths of the chambers
+  // Includes the spacings between the chambers!
+  Float_t length[kNplan][kNcham]   = { { 124.0, 124.0, 110.0, 124.0, 124.0 }
+                                     , { 131.0, 131.0, 110.0, 131.0, 131.0 }
+                                     , { 138.0, 138.0, 110.0, 138.0, 138.0 }
+                                     , { 145.0, 145.0, 110.0, 145.0, 145.0 }
+                                     , { 147.0, 147.0, 110.0, 147.0, 147.0 }
+                                     , { 147.0, 147.0, 110.0, 147.0, 147.0 } };
+
+  for (icham = 0; icham < kNcham; icham++) {
+    for (iplan = 0; iplan < kNplan; iplan++) {
+      fClength[iplan][icham]   = length[iplan][icham];
+      fClengthPH[iplan][icham] = 0.0;
+      fClengthRH[iplan][icham] = 0.0;
+    }
+  }
 
   // The rotation matrix elements
   Float_t phi = 0;
   for (isect = 0; isect < fgkNsect; isect++) {
-    phi = -2.0 * kPI /  (Float_t) fgkNsect * ((Float_t) isect + 0.5);
+    phi = -2.0 * TMath::Pi() /  (Float_t) fgkNsect * ((Float_t) isect + 0.5);
     fRotA11[isect] = TMath::Cos(phi);
     fRotA12[isect] = TMath::Sin(phi);
     fRotA21[isect] = TMath::Sin(phi);
@@ -257,194 +342,18 @@ void AliTRDgeometry::Init()
 }
 
 //_____________________________________________________________________________
-void AliTRDgeometry::SetNColPad(const Int_t npad)
+void AliTRDgeometry::CreateGeometry(Int_t* )
 {
   //
-  // Redefines the number of pads in column direction
+  // Create TRD geometry
   //
 
-  for (Int_t iplan = 0; iplan < fgkNplan; iplan++) {
-    fColMax[iplan]     = npad;
-    fColPadSize[iplan] = (fCwidth[iplan] - 2. * fgkCcthick) / fColMax[iplan];
-    fCol0[iplan]       = -fCwidth[iplan]/2. + fgkCcthick;
-  }
-
-}
-
-//_____________________________________________________________________________
-void AliTRDgeometry::SetNTimeBin(const Int_t nbin)
-{
-  //
-  // Redefines the number of time bins in the drift region.
-  // The time bin width is defined by the length of the
-  // drift region divided by <nbin>.
-  //
-
-  fTimeMax     = nbin;
-  fTimeBinSize = fgkDrThick / ((Float_t) fTimeMax);
-  for (Int_t iplan = 0; iplan < fgkNplan; iplan++) {
-    fTime0[iplan]  = fgkRmin + fgkCcframe/2. + fgkDrZpos + 0.5 * fgkDrThick
-                             + iplan * (fgkCheight + fgkCspace);
-  }
-
 }
 
 //_____________________________________________________________________________
-void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
-{
-  //
-  // Create the TRD geometry
-  //
-  // Author: Christoph Blume (C.Blume@gsi.de) 20/07/99
-  //
-  // The volumes:
-  //    TRD1-3     (Air)   --- The TRD mother volumes for one sector. 
-  //                           To be placed into the spaceframe.
-  //
-  //    UAFI(/M/O) (Al)    --- The aluminum frame of the inner(/middle/outer) chambers (readout)
-  //    UCFI(/M/O) (C)     --- The carbon frame of the inner(/middle/outer) chambers 
-  //                           (driftchamber + radiator)
-  //    UAII(/M/O) (Air)   --- The inner part of the readout of the inner(/middle/outer) chambers
-  //    UFII(/M/O) (Air)   --- The inner part of the chamner and radiator of the 
-  //                           inner(/middle/outer) chambers
-  //
-  // The material layers in one chamber:
-  //    UL03       (Rohacell) --- The radiator
-  //    UL04       (Mylar)    --- Entrance window to the driftvolume and HV-cathode
-  //    UL05       (Xe)       --- The driftvolume
-  //    UL06       (Xe)       --- The amplification region
-  //    
-  //    UL07       (Cu)       --- The pad plane
-  //    UL08       (G10)      --- The Nomex honeycomb support structure
-  //    UL09       (Cu)       --- FEE and signal lines
-  //    UL10       (Al)       --- The cooling devices
-  //    UL11       (Water)    --- The cooling water
-
-  const Int_t kNparCha = 3;
-
-  Float_t parDum[3];
-  Float_t parCha[kNparCha];
-
-  Float_t xpos, ypos, zpos;
-
-  // The aluminum frames - readout + electronics (Al)
-  // The inner chambers
-  gMC->Gsvolu("UAFI","BOX ",idtmed[1301-1],parDum,0);
-  // The middle chambers
-  gMC->Gsvolu("UAFM","BOX ",idtmed[1301-1],parDum,0);
-  // The outer chambers
-  gMC->Gsvolu("UAFO","BOX ",idtmed[1301-1],parDum,0);
-
-  // The inner part of the aluminum frames (Air)
-  // The inner chambers
-  gMC->Gsvolu("UAII","BOX ",idtmed[1302-1],parDum,0);
-  // The middle chambers
-  gMC->Gsvolu("UAIM","BOX ",idtmed[1302-1],parDum,0);
-  // The outer chambers
-  gMC->Gsvolu("UAIO","BOX ",idtmed[1302-1],parDum,0);
-
-  // The carbon frames - radiator + driftchamber (C)
-  // The inner chambers
-  gMC->Gsvolu("UCFI","BOX ",idtmed[1307-1],parDum,0);
-  // The middle chambers
-  gMC->Gsvolu("UCFM","BOX ",idtmed[1307-1],parDum,0);
-  // The outer chambers
-  gMC->Gsvolu("UCFO","BOX ",idtmed[1307-1],parDum,0);
-
-  // The inner part of the carbon frames (Air)
-  // The inner chambers
-  gMC->Gsvolu("UCII","BOX ",idtmed[1302-1],parDum,0);
-  // The middle chambers
-  gMC->Gsvolu("UCIM","BOX ",idtmed[1302-1],parDum,0);
-  // The outer chambers
-  gMC->Gsvolu("UCIO","BOX ",idtmed[1302-1],parDum,0);
-
-  // The material layers inside the chambers
-  parCha[0] = -1.;
-  parCha[1] = -1.;
-  // Rohacell layer (radiator)
-  parCha[2] = fgkRaThick/2;
-  gMC->Gsvolu("UL03","BOX ",idtmed[1315-1],parCha,kNparCha);
-  // Mylar layer (entrance window + HV cathode) 
-  parCha[2] = fgkMyThick/2;
-  gMC->Gsvolu("UL04","BOX ",idtmed[1308-1],parCha,kNparCha);
-  // Xe/Isobutane layer (drift volume) 
-  parCha[2] = fgkDrThick/2.;
-  gMC->Gsvolu("UL05","BOX ",idtmed[1309-1],parCha,kNparCha);
-  // Xe/Isobutane layer (amplification volume)
-  parCha[2] = fgkAmThick/2.;
-  gMC->Gsvolu("UL06","BOX ",idtmed[1309-1],parCha,kNparCha);
-  
-  // Cu layer (pad plane)
-  parCha[2] = fgkCuThick/2;
-  gMC->Gsvolu("UL07","BOX ",idtmed[1305-1],parCha,kNparCha);
-  // G10 layer (support structure)
-  parCha[2] = fgkSuThick/2;
-  gMC->Gsvolu("UL08","BOX ",idtmed[1313-1],parCha,kNparCha);
-  // Cu layer (FEE + signal lines)
-  parCha[2] = fgkFeThick/2;
-  gMC->Gsvolu("UL09","BOX ",idtmed[1305-1],parCha,kNparCha);
-  // Al layer (cooling devices)
-  parCha[2] = fgkCoThick/2;
-  gMC->Gsvolu("UL10","BOX ",idtmed[1301-1],parCha,kNparCha);
-  // Water layer (cooling)
-  parCha[2] = fgkWaThick/2;
-  gMC->Gsvolu("UL11","BOX ",idtmed[1314-1],parCha,kNparCha);
-
-  // Position the layers in the chambers
-  xpos = 0;
-  ypos = 0;
-
-  // Rohacell layer (radiator)
-  zpos = fgkRaZpos;
-  gMC->Gspos("UL03",1,"UCII",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL03",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL03",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
-  // Mylar layer (entrance window + HV cathode)   
-  zpos = fgkMyZpos;
-  gMC->Gspos("UL04",1,"UCII",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL04",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL04",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
-  // Xe/Isobutane layer (drift volume) 
-  zpos = fgkDrZpos;
-  gMC->Gspos("UL05",1,"UCII",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL05",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL05",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
-  // Xe/Isobutane layer (amplification volume)
-  zpos = fgkAmZpos;
-  gMC->Gspos("UL06",1,"UCII",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL06",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL06",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
-  // Cu layer (pad plane)
-  zpos = fgkCuZpos;
-  gMC->Gspos("UL07",1,"UAII",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL07",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL07",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
-  // G10 layer (support structure)
-  zpos = fgkSuZpos;
-  gMC->Gspos("UL08",1,"UAII",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL08",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL08",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
-  // Cu layer (FEE + signal lines)
-  zpos = fgkFeZpos; 
-  gMC->Gspos("UL09",1,"UAII",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL09",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL09",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
-  // Al layer (cooling devices)
-  zpos = fgkCoZpos;
-  gMC->Gspos("UL10",1,"UAII",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL10",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL10",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
-  // Water layer (cooling)
-  zpos = fgkWaZpos;
-  gMC->Gspos("UL11",1,"UAII",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL11",1,"UAIM",xpos,ypos,zpos,0,"ONLY");
-  gMC->Gspos("UL11",1,"UAIO",xpos,ypos,zpos,0,"ONLY");
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local, Float_t *global) const
+Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local
+                                   , Float_t *global
+                                   , AliTRDparameter *par) const
 {
   //
   // Converts local pad-coordinates (row,col,time) into 
@@ -455,41 +364,128 @@ Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local, Float_t *global)
   Int_t isect = GetSector(idet);     // Sector info  (0-17)
   Int_t iplan = GetPlane(idet);      // Plane info   (0-5)
 
-  return Local2Global(iplan,icham,isect,local,global);
+  return Local2Global(iplan,icham,isect,local,global,par);
 
 }
  
 //_____________________________________________________________________________
 Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
-                                  , Float_t *local, Float_t *global) const
+                                  , Float_t *local, Float_t *global
+                                  , AliTRDparameter *par) const
 {
   //
   // Converts local pad-coordinates (row,col,time) into 
   // global ALICE reference frame coordinates (x,y,z)
   //
 
+  if (!par) {
+    Error("Local2Global","No parameter defined\n");
+    return kFALSE;
+  }
+
   Int_t    idet      = GetDetector(iplan,icham,isect); // Detector number
 
   Float_t  padRow    = local[0]+0.5;                   // Pad Row position
   Float_t  padCol    = local[1]+0.5;                   // Pad Column position
   Float_t  timeSlice = local[2]+0.5;                   // Time "position"
 
-  Float_t  row0      = GetRow0(iplan,icham,isect);
-  Float_t  col0      = GetCol0(iplan);
-  Float_t  time0     = GetTime0(iplan);
+  Float_t  row0      = par->GetRow0(iplan,icham,isect);
+  Float_t  col0      = par->GetCol0(iplan);
+  Float_t  time0     = par->GetTime0(iplan);
 
   Float_t  rot[3];
 
   // calculate (x,y,z) position in rotated chamber
-  rot[0] = time0 - (timeSlice - fTimeBefore) * fTimeBinSize;
-  rot[1] = col0  + padCol                    * fColPadSize[iplan];
-  rot[2] = row0  + padRow                    * fRowPadSize[iplan][icham][isect];
+  rot[0] = time0 - (timeSlice - par->GetTimeBefore()) 
+         * par->GetTimeBinSize();
+  rot[1] = col0  + padCol                    
+         * par->GetColPadSize(iplan);
+  rot[2] = row0  + padRow                    
+         * par->GetRowPadSize(iplan,icham,isect);
 
   // Rotate back to original position
   return RotateBack(idet,rot,global);
 
 }
 
+
+
+//_____________________________________________________________________________
+Bool_t AliTRDgeometry::Global2Local(Int_t mode, Float_t *local, Float_t *global, Int_t* index,  AliTRDparameter *par) const
+{
+  //
+  // Converts local pad-coordinates (row,col,time) into 
+  // global ALICE reference frame coordinates (x,y,z)
+  //
+  //index[0]=plane number
+  //index[1]=chamber number
+  //index[2]=sector number
+  //
+  // mode=0  - local coordinate in y, z,             x - rotated global   
+  // mode=2  - local coordinate in pad, and pad row, x - rotated global
+  //
+  if (!par) {
+    Error("Local2Global","No parameter defined\n");
+    return kFALSE;
+  }
+  
+  //Int_t    idet    = GetDetector(iplan,icham,isect); // Detector number
+  Int_t    idet      = GetDetector(index[0],index[1],index[2]); // Detector number
+  Rotate(idet,global,local);
+  if (mode==0) return kTRUE;
+  //
+  //  Float_t  row0      = par->GetRow0(iplan,icham,isect);
+  //Float_t  col0      = par->GetCol0(iplan);
+  //Float_t  time0     = par->GetTime0(iplan);
+  //
+  // mode 1 to be implemented later
+  // calculate (x,y,z) position in time bin pad row pad
+  //
+  //rot[0] = time0 - (timeSlice - par->GetTimeBefore()) 
+  //       * par->GetTimeBinSize();
+  //rot[1] = col0  + padCol                    
+  //       * par->GetColPadSize(iplan);
+  //rot[2] = row0  + padRow                    
+  //       * par->GetRowPadSize(iplan,icham,isect);
+
+  return kTRUE;
+
+}
+
+//___________________________________________________________________
+Bool_t   AliTRDgeometry::Global2Detector(Float_t global[3], Int_t index[3], AliTRDparameter *par)
+{
+  //  
+  //
+  //input = global position
+  //output =index
+  //index[0]=plane number
+  //index[1]=chamber number
+  //index[2]=sector number
+  Float_t fi;
+  //
+  fi = TMath::ATan2(global[1],global[0]);
+  if (fi<0) fi += 2*TMath::Pi();
+  index[2] = Int_t(TMath::Nint((fi - GetAlpha()/2.)/GetAlpha()));
+  //
+  //
+  Float_t locx = global[0] * fRotA11[index[2]] + global[1] * fRotA12[index[2]];  
+  index[0] = 0;
+  Float_t max = locx-par->GetTime0(0);
+  for (Int_t iplane=1; iplane<fgkNplan;iplane++){
+    Float_t dist = TMath::Abs(locx-par->GetTime0(iplane));
+    if (dist < max){
+      index[0] = iplane;
+      max = dist;
+    }
+  }
+  Float_t theta = TMath::ATan2(global[2],locx);
+  index[1] = TMath::Nint(float(fgkNcham)*theta/(0.25*TMath::Pi()));
+  return kTRUE;
+
+}
+
+
 //_____________________________________________________________________________
 Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) const
 {
@@ -528,6 +524,17 @@ Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) const
 
 }
 
+//_____________________________________________________________________________
+Int_t AliTRDgeometry::GetDetectorSec(const Int_t p, const Int_t c) const
+{
+  //
+  // Convert plane / chamber into detector number for one single sector
+  //
+
+  return (p + c * fgkNplan);
+
+}
+
 //_____________________________________________________________________________
 Int_t AliTRDgeometry::GetDetector(const Int_t p, const Int_t c, const Int_t s) const
 {
@@ -573,42 +580,26 @@ Int_t AliTRDgeometry::GetSector(const Int_t d) const
 }
 
 //_____________________________________________________________________________
-void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos
-                             , TMatrix &mat) const
+void AliTRDgeometry::SetOldGeometry()
 {
-  // 
-  // Returns the global coordinate and error matrix of a AliTRDrecPoint
   //
-
-  GetGlobal(p,pos);
-  mat.Zero();
-
-}
-
-//_____________________________________________________________________________
-void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos) const
-{
-  // 
-  // Returns the global coordinate and error matrix of a AliTRDrecPoint
+  // Use the old chamber lengths
   //
 
-  Int_t detector = ((AliTRDrecPoint *) p)->GetDetector();
+  Int_t icham;
+  Int_t iplan;
 
-  Float_t global[3];
-  Float_t local[3];
-  local[0] = ((AliTRDrecPoint *) p)->GetLocalRow();
-  local[1] = ((AliTRDrecPoint *) p)->GetLocalCol();
-  local[2] = ((AliTRDrecPoint *) p)->GetLocalTime();
+  Float_t length[kNplan][kNcham]   = { { 123.5, 123.5, 110.0, 123.5, 123.5 }
+                                    , { 131.0, 131.0, 110.0, 131.0, 131.0 }
+                                    , { 134.5, 138.5, 110.0, 138.5, 134.5 }
+                                    , { 142.0, 146.0, 110.0, 146.0, 142.0 }
+                                    , { 142.0, 153.0, 110.0, 153.0, 142.0 }
+                                     , { 134.0, 160.5, 110.0, 160.5, 134.0 } };
 
-  if (Local2Global(detector,local,global)) {
-    pos.SetX(global[0]);
-    pos.SetY(global[1]);
-    pos.SetZ(global[2]);
-  }
-  else {
-    pos.SetX(0.0);
-    pos.SetY(0.0);
-    pos.SetZ(0.0);
+  for (icham = 0; icham < kNcham; icham++) {
+    for (iplan = 0; iplan < kNplan; iplan++) {
+      fClength[iplan][icham]   = length[iplan][icham];
+    }
   }
 
 }