]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDgeometry.cxx
Transition to NewIO
[u/mrichter/AliRoot.git] / TRD / AliTRDgeometry.cxx
index b007e431496c6bf3a3598453756c756ae9a78551..22cfe450cee28b3f11f179d101e5f0e7591ff23b 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-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
-
-Revision 1.12  2001/05/21 16:45:47  hristov
-Last minute changes (C.Blume)
-
-Revision 1.11  2001/05/11 07:56:12  hristov
-Consistent declarations needed on Alpha
-
-Revision 1.10  2001/05/07 08:08:05  cblume
-Update of TRD code
-
-Revision 1.9  2001/03/27 12:48:33  cblume
-Correct for volume overlaps
-
-Revision 1.8  2001/03/13 09:30:35  cblume
-Update of digitization. Moved digit branch definition to AliTRD
-
-Revision 1.7  2001/02/14 18:22:26  cblume
-Change in the geometry of the padplane
-
-Revision 1.6  2000/11/01 14:53:20  cblume
-Merge with TRD-develop
-
-Revision 1.1.4.7  2000/10/16 01:16:53  cblume
-Changed timebin 0 to be the one closest to the readout
-
-Revision 1.1.4.6  2000/10/15 23:35:57  cblume
-Include geometry constants as static member
-
-Revision 1.1.4.5  2000/10/06 16:49:46  cblume
-Made Getters const
-
-Revision 1.1.4.4  2000/10/04 16:34:58  cblume
-Replace include files by forward declarations
-
-Revision 1.1.4.3  2000/09/22 14:43:40  cblume
-Allow the pad/timebin-dimensions to be changed after initialization
-
-Revision 1.1.4.2  2000/09/18 13:37:01  cblume
-Minor coding corrections
-
-Revision 1.5  2000/10/02 21:28:19  fca
-Removal of useless dependecies via forward declarations
-
-Revision 1.4  2000/06/08 18:32:58  cblume
-Make code compliant to coding conventions
-
-Revision 1.3  2000/06/07 16:25:37  cblume
-Try to remove compiler warnings on Sun and HP
-
-Revision 1.2  2000/05/08 16:17:27  cblume
-Merge TRD-develop
-
-Revision 1.1.4.1  2000/05/08 14:45:55  cblume
-Bug fix in RotateBack(). Geometry update
-
-Revision 1.4  2000/06/08 18:32:58  cblume
-Make code compliant to coding conventions
-
-Revision 1.3  2000/06/07 16:25:37  cblume
-Try to remove compiler warnings on Sun and HP
-
-Revision 1.2  2000/05/08 16:17:27  cblume
-Merge TRD-develop
-
-Revision 1.1.4.1  2000/05/08 14:45:55  cblume
-Bug fix in RotateBack(). Geometry update
-
-Revision 1.1  2000/02/28 19:00:44  cblume
-Add new TRD classes
-
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -104,11 +21,9 @@ Add new TRD classes
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "AliMC.h"
 
 #include "AliTRDgeometry.h"
-#include "AliTRDrecPoint.h"
-#include "AliMC.h"
+#include "AliTRDparameter.h"
 
 ClassImp(AliTRDgeometry)
 
@@ -180,7 +95,7 @@ ClassImp(AliTRDgeometry)
 
   // Difference of outer chamber width and pad plane width
   const Float_t AliTRDgeometry::fgkCpadW   =   1.0;
-  const Float_t AliTRDgeometry::fgkRpadW   =   1.5;
+  const Float_t AliTRDgeometry::fgkRpadW   =   1.0;
 
   //
   // Thickness of the the material layers
@@ -272,12 +187,12 @@ void AliTRDgeometry::Init()
   fCwidth[5] = 117.8;
 
   // The outer lengths of the chambers
-  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 } };
+  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++) {
@@ -287,28 +202,10 @@ void AliTRDgeometry::Init()
     }
   }
 
-  // The pad size in column direction (rphi-direction)  
-  SetColPadSize(0,0.65);
-  SetColPadSize(1,0.68);
-  SetColPadSize(2,0.71);
-  SetColPadSize(3,0.74);
-  SetColPadSize(4,0.77);
-  SetColPadSize(5,0.80);
-
-  // The pad row (z-direction)
-  SetNRowPad();
-
-  // The number of time bins. Default is 100 ns timbin size
-  SetNTimeBin(15);
-
-  // Additional time bins before and after the drift region.
-  // Default is to only sample the drift region
-  SetExpandTimeBin(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);
@@ -322,97 +219,6 @@ void AliTRDgeometry::Init()
  
 }
 
-//_____________________________________________________________________________
-void AliTRDgeometry::SetNRowPad(const Int_t p, const Int_t c, const Int_t npad)
-{
-  //
-  // Redefines the number of pads in raw direction for
-  // a given plane and chamber number
-  //
-
-  for (Int_t isect = 0; isect < fgkNsect; isect++) {
-
-    fRowMax[p][c][isect] = npad;  
-    fRowPadSize[p][c][isect] = (fClength[p][c] - 2.*fgkRpadW)
-                            / ((Float_t) npad);
-
-  }
-
-}
-
-//_____________________________________________________________________________
-void AliTRDgeometry::SetNRowPad()
-{
-  //
-  // Defines the number of pads in row direction
-  //
-
-  Int_t isect;
-  Int_t icham;
-  Int_t iplan;
-
-  Int_t rowMax[kNplan][kNcham] = { { 16, 16, 12, 16, 16 }
-                                 , { 16, 16, 12, 16, 16 }
-                                 , { 16, 16, 12, 16, 16 }
-                                 , { 16, 16, 12, 16, 16 }
-                                 , { 14, 16, 12, 16, 14 }
-                                 , { 13, 16, 12, 16, 13 } };
-
-  for (isect = 0; isect < kNsect; isect++) {
-    for (icham = 0; icham < kNcham; icham++) {
-      for (iplan = 0; iplan < kNplan; iplan++) {
-
-        fRowMax[iplan][icham][isect]     = rowMax[iplan][icham];
-        fRowPadSize[iplan][icham][isect] = (fClength[iplan][icham] - 2.*fgkRpadW)
-                                        / ((Float_t) rowMax[iplan][icham]);
-
-        Float_t row0 = fgkRpadW - fClength[iplan][0] 
-                                - fClength[iplan][1] 
-                                - fClength[iplan][2]/2.;
-        for (Int_t ic = 0; ic < icham; ic++) {
-          row0 += fClength[iplan][ic];
-       }
-        fRow0[iplan][icham][isect]       = row0;
-
-      }
-    }
-  }
-
-}
-
-//_____________________________________________________________________________
-void AliTRDgeometry::SetColPadSize(const Int_t p, const Float_t s)
-{
-  //
-  // Redefines the pad size in column direction
-  //
-
-  fColPadSize[p] = s;
-  fCol0[p]       = - fCwidth[p]/2. + fgkCpadW;
-  fColMax[p]     = ((Int_t) ((fCwidth[p] - 2. * fgkCpadW) / s)); 
-
-}
-
-//_____________________________________________________________________________
-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 + fgkCraH + fgkCdrH
-                             + iplan * (fgkCH + fgkVspace);
-  }
-
-}
-
 //_____________________________________________________________________________
 void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
 {
@@ -423,7 +229,9 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
 }
 
 //_____________________________________________________________________________
-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 
@@ -434,35 +242,44 @@ 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);
@@ -563,42 +380,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];
+    }
   }
 
 }