]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDgtuParam.cxx
Bug fix by Sylwester
[u/mrichter/AliRoot.git] / TRD / AliTRDgtuParam.cxx
index 9c66775cac3b8ce226e2a807c36377756ff94ff7..ccc5f6fe1ca6f233d17dd6ada20ade0344be2d29 100644 (file)
@@ -72,7 +72,7 @@ AliTRDgtuParam::AliTRDgtuParam() :
   fRefLayers[0] = 3;
   fRefLayers[1] = 2;
   fRefLayers[2] = 1;
-  zChannelGen(); 
+  GenerateZChannelMap(); 
 }
 
 AliTRDgtuParam::~AliTRDgtuParam() 
@@ -115,13 +115,15 @@ Int_t AliTRDgtuParam::GetZSubchannel(Int_t stack, Int_t layer, Int_t zchannel, I
 
 Int_t AliTRDgtuParam::GetRefLayer(Int_t refLayerIdx) const 
 {
+  // returns the reference layer indexed by refLayerIdx
+
   if (refLayerIdx >= 0 && refLayerIdx < fgkNRefLayers)
     return fRefLayers[refLayerIdx];
   else 
     return -1;
 }
 
-Int_t AliTRDgtuParam::zChannelGen() 
+Int_t AliTRDgtuParam::GenerateZChannelMap() 
 {
   // generate the z-channel map
   // assuming that the tracks come from the vertex 
@@ -132,15 +134,15 @@ Int_t AliTRDgtuParam::zChannelGen()
 
   for (Int_t iStack = 0; iStack < fGeo->Nstack(); iStack++) {
 
-    Float_t X[6] = { 0 };
-    Float_t Z[6][16] = {{ 0 }};
+    Float_t x[6] = { 0 };
+    Float_t z[6][16] = {{ 0 }};
     Float_t dZ[6][16] = {{ 0 }};
     
     for (Int_t iLayer = 0; iLayer < fGeo->Nlayer(); iLayer++) {
       AliTRDpadPlane *pp = fGeo->GetPadPlane(iLayer, iStack);
-      X[iLayer]  = fGeo->GetTime0(iLayer) - fGeo->CdrHght(); // ???
+      x[iLayer]  = fGeo->GetTime0(iLayer) - fGeo->CdrHght(); // ???
       for (Int_t iRow = 0; iRow < fGeo->GetRowMax(iLayer, iStack, iSec); iRow++) {
-       Z[iLayer][iRow]  = pp->GetRowPos(iRow); // this is the right (pos. z-direction) border of the pad
+       z[iLayer][iRow]  = pp->GetRowPos(iRow); // this is the right (pos. z-direction) border of the pad
        dZ[iLayer][iRow] = pp->GetRowSize(iRow); // length of the pad in z-direction
        for (Int_t i = 0; i < fgkNZChannels; i++) 
            fZSubChannel[iStack][i][iLayer][iRow] = 0;
@@ -149,26 +151,26 @@ Int_t AliTRDgtuParam::zChannelGen()
 
     for (Int_t fixRow = 0; fixRow < fGeo->GetRowMax(fgkFixLayer, iStack, iSec); fixRow++) {
        
-      Double_t fixZmin = Z[fgkFixLayer][fixRow] - dZ[fgkFixLayer][fixRow];  
-      Double_t fixZmax = Z[fgkFixLayer][fixRow];
-      Double_t fixX    = X[fgkFixLayer] + 1.5; // ??? 1.5 from where? 
+      Double_t fixZmin = z[fgkFixLayer][fixRow] - dZ[fgkFixLayer][fixRow];  
+      Double_t fixZmax = z[fgkFixLayer][fixRow];
+      Double_t fixX    = x[fgkFixLayer] + 1.5; // ??? 1.5 from where? 
 
       for (Int_t iLayer = 0; iLayer < fGeo->Nlayer(); iLayer++) {
        Double_t leftZ, rightZ;
        
        if (iLayer <= fgkFixLayer) {
-         leftZ  = (fixZmin + fVertexSize) * (X[iLayer] + 1.5) / fixX - fVertexSize;
-         rightZ = (fixZmax - fVertexSize) * (X[iLayer] + 1.5) / fixX + fVertexSize;
+         leftZ  = (fixZmin + fVertexSize) * (x[iLayer] + 1.5) / fixX - fVertexSize;
+         rightZ = (fixZmax - fVertexSize) * (x[iLayer] + 1.5) / fixX + fVertexSize;
        }
        else {
-         leftZ  = (fixZmin - fVertexSize) * (X[iLayer] + 1.5) / fixX + fVertexSize;
-         rightZ = (fixZmax + fVertexSize) * (X[iLayer] + 1.5) / fixX - fVertexSize;
+         leftZ  = (fixZmin - fVertexSize) * (x[iLayer] + 1.5) / fixX + fVertexSize;
+         rightZ = (fixZmax + fVertexSize) * (x[iLayer] + 1.5) / fixX - fVertexSize;
        }
        
        Double_t epsilon = 0.001;
        for (Int_t iRow = 0; iRow < fGeo->GetRowMax(iLayer, iStack, iSec); iRow++) {
-         if ( (Z[iLayer][iRow] )                    > (leftZ  + epsilon) && 
-              (Z[iLayer][iRow] - dZ[iLayer][iRow] ) < (rightZ - epsilon) ) {
+         if ( (z[iLayer][iRow] )                    > (leftZ  + epsilon) && 
+              (z[iLayer][iRow] - dZ[iLayer][iRow] ) < (rightZ - epsilon) ) {
            fZChannelMap[iStack][fixRow][iLayer][iRow] = 1;
            if (fZSubChannel[iStack][fixRow % fgkNZChannels][iLayer][iRow] != 0) {
              AliError("Collision in Z-Channel assignment occured! No reliable tracking!!!");
@@ -237,17 +239,17 @@ Int_t AliTRDgtuParam::GetCiAlpha(Int_t layer) const
 {
   // get the constant for the calculation of alpha
 
-  Int_t Ci = (Int_t) (GetChamberThickness() / fGeo->GetTime0(layer) * GetBinWidthY() / GetBinWidthdY() * (1 << (GetBitExcessAlpha() + GetBitExcessY() + 1)) );
-  return Ci;
+  Int_t ci = (Int_t) (GetChamberThickness() / fGeo->GetTime0(layer) * GetBinWidthY() / GetBinWidthdY() * (1 << (GetBitExcessAlpha() + GetBitExcessY() + 1)) );
+  return ci;
 }
 
 Int_t AliTRDgtuParam::GetCiYProj(Int_t layer) const 
 {
   // get the constant for the calculation of y_proj
 
-  Float_t Xmid = (fGeo->GetTime0(0) + fGeo->GetTime0(fGeo->Nlayer()-1)) / 2.; 
-  Int_t Ci = (Int_t) (- (fGeo->GetTime0(layer) - Xmid) / GetChamberThickness() * GetBinWidthdY() / GetBinWidthY() * (1 << GetBitExcessYProj()) );
-  return Ci;
+  Float_t xmid = (fGeo->GetTime0(0) + fGeo->GetTime0(fGeo->Nlayer()-1)) / 2.; 
+  Int_t ci = (Int_t) (- (fGeo->GetTime0(layer) - xmid) / GetChamberThickness() * GetBinWidthdY() / GetBinWidthY() * (1 << GetBitExcessYProj()) );
+  return ci;
 }
 
 Int_t AliTRDgtuParam::GetYt(Int_t stack, Int_t layer, Int_t zrow) const
@@ -259,6 +261,9 @@ Int_t AliTRDgtuParam::GetYt(Int_t stack, Int_t layer, Int_t zrow) const
 
 Bool_t AliTRDgtuParam::GenerateRecoCoefficients(Int_t trackletMask) 
 {
+  // calculate the coefficients for the straight line fit 
+  // depending on the mask of contributing tracklets
+
   fCurrTrackletMask = trackletMask;
 
   TMatrix a(GetNLayers(), 3);
@@ -391,14 +396,16 @@ Bool_t AliTRDgtuParam::GetIntersectionPoints(Int_t k, Float_t &x1, Float_t &x2)
   return ( (l1 >= 0) && (l2 >= 0) );
 }
 
-Float_t AliTRDgtuParam::GetRadius(Int_t a, Float_t b, Float_t x1, Float_t x2) 
+Float_t AliTRDgtuParam::GetRadius(Int_t a, Float_t b, Float_t x1, Float_t x2) const
 {
   // get the radius for the track
   Float_t d = (1 + b * b /2 ) * (x2 - x1);
   Float_t c1 = x1 * x2 / 2;
 //  Float_t c2 = (x1 + x2) / (x1 * x2);
-  printf("c1: %f\n", c1);
-  Float_t r = (375. / 10000.) * c1 * 256 / (a >> 1);
+//  printf("c1: %f\n", c1);
+  Float_t r = 0;
+  if ( (a >> 1) != 0)
+    r = (375. / 10000.) * c1 * 256 / (a >> 1);
   return r;
 
   Float_t y1 = a + b*x1;