]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDpadPlane.cxx
Remove AliTRDmatrix
[u/mrichter/AliRoot.git] / TRD / AliTRDpadPlane.cxx
index 58d913638eddc01c02c228cf13da9d791273af13..c59046a30f4f82209d76acdb17070f35a3db99ee 100644 (file)
@@ -27,7 +27,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "AliTRDpadPlane.h"
-#include "AliTRDgeometryFull.h"
+#include "AliTRDgeometry.h"
 
 ClassImp(AliTRDpadPlane)
 
@@ -62,24 +62,22 @@ AliTRDpadPlane::AliTRDpadPlane():TObject()
   fPadCol       = 0;
 
   fTiltingAngle = 0.0;
+  fTiltingTan   = 0.0;
 
 }
 
 //_____________________________________________________________________________
-AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c):TObject()
+AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c):TObject(),fPadRow(0),fPadCol(0)
 {
   //
   // Constructor that initializes a given pad plane type
   //
 
-  fGeo = new AliTRDgeometryFull();
+  fGeo = new AliTRDgeometry();
 
   fPla = p;
   fCha = c;
 
-  //fRowSpacing = 0.025;
-  //fColSpacing = 0.025;
-
   fRowSpacing = 0.0;
   fColSpacing = 0.0;
 
@@ -97,7 +95,7 @@ AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c):TObject()
       // L0C0 type
       fNrows        =  12;
       fLength       = 108.0;
-      fWidth        =  94.4;
+      fWidth        =  92.2;
       fLengthOPad   =   8.0;
       fWidthOPad    =   0.515;
       fLengthIPad   =   9.0;
@@ -108,7 +106,7 @@ AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c):TObject()
       // L0C1 type
       fNrows        =  16;
       fLength       = 122.0;
-      fWidth        =  94.4;
+      fWidth        =  92.2;
       fLengthOPad   =   7.5;
       fWidthOPad    =   0.515;
       fLengthIPad   =   7.5;
@@ -238,16 +236,21 @@ AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c):TObject()
     break;
   };
 
+  //
+  // Store tilting angle as tangens
+  //
+  fTiltingTan = TMath::Tan(TMath::Pi()/180.0 * fTiltingAngle);
+
   //
   // The positions of the borders of the pads
   //
   // Row direction
   //
-  if (fPadRow) delete [] fPadRow;
   fPadRow = new Double_t[fNrows];
   Double_t row = fGeo->GetChamberLength(p,0)
               + fGeo->GetChamberLength(p,1)
                + fGeo->GetChamberLength(p,2) / 2.
+               - fGeo->RpadW()
                - fLengthRim;
   for (Int_t ic = 0; ic < c; ic++) {
     row -= fGeo->GetChamberLength(p,ic);
@@ -255,7 +258,7 @@ AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c):TObject()
   for (Int_t ir = 0; ir < fNrows; ir++) {
     fPadRow[ir] = row;
     row -= fRowSpacing;
-    if (ir == 1) {
+    if (ir == 0) {
       row -= fLengthOPad;
     }
     else {
@@ -265,14 +268,14 @@ AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c):TObject()
   //
   // Column direction
   //
-  if (fPadCol) delete [] fPadCol;
   fPadCol = new Double_t[fNcols];
   Double_t col = fGeo->GetChamberWidth(p) / 2. 
+               + fGeo->CroWid()
                - fWidthRim;
   for (Int_t ic = 0; ic < fNcols; ic++) {
     fPadCol[ic] = col;
     col -= fColSpacing;
-    if (ic == 1) {
+    if (ic == 0) {
       col -= fWidthOPad;
     }
     else {
@@ -359,6 +362,7 @@ void AliTRDpadPlane::Copy(TObject &p) const
   ((AliTRDpadPlane &) p).fNcols        = fNcols;
 
   ((AliTRDpadPlane &) p).fTiltingAngle = fTiltingAngle;
+  ((AliTRDpadPlane &) p).fTiltingTan   = fTiltingTan;
 
   if (((AliTRDpadPlane &) p).fPadRow) delete [] ((AliTRDpadPlane &) p).fPadRow;
   ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
@@ -377,7 +381,7 @@ void AliTRDpadPlane::Copy(TObject &p) const
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDpadPlane::GetPadRowNumber(const Double_t z)
+Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const
 {
   //
   // Finds the pad row number for a given global z-position
@@ -388,11 +392,13 @@ Int_t AliTRDpadPlane::GetPadRowNumber(const Double_t z)
   Int_t nbelow = 0;
   Int_t middle = 0;
 
-  if ((z > fPadRow[0]) ||
-      (z < fPadRow[0] - fLength + 2.0*fLengthRim)) {
+  if ((z > GetRow0()) || (z < GetRowEnd())) {
+
     row = -1;
+
   }
   else {
+
     nabove = fNrows+1;
     nbelow = 0;
     while (nabove - nbelow > 1) {
@@ -402,6 +408,7 @@ Int_t AliTRDpadPlane::GetPadRowNumber(const Double_t z)
       else                        nbelow = middle;
     }
     row = nbelow - 1;
+
   }
 
   return row;
@@ -409,65 +416,46 @@ Int_t AliTRDpadPlane::GetPadRowNumber(const Double_t z)
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDpadPlane::GetPadColNumber(const Double_t rphi)
+Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi
+                                     , Double_t /*rowOffset*/) const
 {
   //
   // Finds the pad column number for a given global rphi-position
   //
 
-  Int_t col    = 0;
-  Int_t nabove = 0;
-  Int_t nbelow = 0;
-  Int_t middle = 0;
+  Int_t    col       = 0;
+  Int_t    nabove    = 0;
+  Int_t    nbelow    = 0;
+  Int_t    middle    = 0;
+  Double_t rphiShift = 0;
+
+  // MI change don't apply tilting angle here - better to do it directly on hit level
+  // Take the tilting angle into account by shifting the hit position
+  // into the opposite direction
+  // 
+
+
+  rphiShift = rphi ;
+
+  if ((rphiShift > GetCol0()) || (rphiShift < GetColEnd())) {
 
-  if ((rphi > fPadCol[0]) ||
-      (rphi < fPadCol[0] - fWidth + 2.0*fWidthRim)) {
     col = -1;
+
   }
   else {
+
     nabove = fNcols+1;
     nbelow = 0;
     while (nabove - nbelow > 1) {
       middle = (nabove + nbelow) / 2;
-      if (rphi == fPadCol[middle-1]) col    = middle;
-      if (rphi  > fPadCol[middle-1]) nabove = middle;
-      else                           nbelow = middle;
+      if (rphiShift == fPadCol[middle-1]) col    = middle;
+      if (rphiShift  > fPadCol[middle-1]) nabove = middle;
+      else                                nbelow = middle;
     }
     col = nbelow - 1;
-  }
-
-  return col;
 
-}
-
-//_____________________________________________________________________________
-Double_t AliTRDpadPlane::GetPadRowOffset(const Int_t row, const Double_t z)
-{
-  //
-  // Calculates the distance to the pad border in row direction
-  //
-
-  if ((row < 0) || (row >= fNrows)) {
-    return -1.0;
   }
-  else {
-    return fPadRow[row] - z;
-  }
-
-}
-
-//_____________________________________________________________________________
-Double_t AliTRDpadPlane::GetPadColOffset(const Int_t col, const Double_t rphi)
-{
-  //
-  // Calculates the distance to the pad border in column direction
-  //
 
-  if ((col < 0) || (col >= fNcols)) {
-    return -1.0;
-  }
-  else {
-    return fPadCol[col] - rphi;
-  }
+  return col;
 
 }