]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
fixes for bug #85807
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Aug 2011 09:27:58 +0000 (09:27 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Aug 2011 09:27:58 +0000 (09:27 +0000)
Increase awarness in tracking for clusters which are reconstructed
outside fiducial volume and reject them gracefully. Should be finally
fixed at
raw dat/clusterizer level

TRD/AliTRDchamberTimeBin.cxx
TRD/AliTRDclusterizer.cxx
TRD/AliTRDtrackingChamber.cxx
TRD/AliTRDtransform.h

index 9025eae3a69ae305a14cec50e2adbf9ebba221d9..ae7c39b1077f37ca53a9822c446a6b78bcf7e7d3 100644 (file)
@@ -288,13 +288,16 @@ void AliTRDchamberTimeBin::BuildIndices(Int_t iter)
   memset(fPositions, 0, sizeof(UChar_t)*kMaxRows);
   AliTRDcluster **cliter = &helpCL[0]; // Declare iterator running over the whole array
   const AliTRDrecoParam* const recoParam = fkReconstructor->GetRecoParam(); //the dynamic cast in GetRecoParam is slow, so caching the pointer to it
+  Int_t tb(-1);
   for(Int_t i = 0; i < fN; i++){
     // boundary check
     AliTRDcluster *cl = *(cliter++);
     UChar_t rowIndex = cl->GetPadRow();
+    if(tb<0) tb=cl->GetLocalTimeBin();
     // Insert Leaf
-    Int_t pos = FindYPosition(cl->GetY(), rowIndex, i);
-    if(pos == -1){             // zbin is empty;
+    Int_t pos = FindYPosition(cl->GetY(), rowIndex, nClStack);
+    if(pos == -2) continue;   // zbin error;
+    else if(pos == -1) {    // zbin is empty;
       Int_t upper = (rowIndex == fNRows - 1) ? nClStack : fPositions[rowIndex + 1];
       memmove(fClusters + upper + 1, fClusters + upper, (sizeof(AliTRDcluster *))*(nClStack-upper));
       memmove(fIndex + upper + 1, fIndex + upper, (sizeof(UInt_t))*(nClStack-upper));
@@ -333,7 +336,16 @@ void AliTRDchamberTimeBin::BuildIndices(Int_t iter)
 
 //     AliInfo("Positions");
 //     for(int ir=0; ir<fNRows; ir++) printf("pos[%d] %d\n", ir, fPositions[ir]);
-
+  if(nClStack < fN){
+    AliWarning(Form("Found %d out of %d clusters outside in ChamberTimeBin[%02d_%d_%d|%2d]", fN-nClStack, fN, fSector, fStack, fPlane, tb));
+    fN =  nClStack;
+    if(!fN){ // Nothing left in this time bin. Reset indexes
+      memset(&fPositions[0], 0, sizeof(UChar_t) * kMaxRows);
+      memset(&fClusters[0], 0, sizeof(AliTRDcluster*) * kMaxClustersLayer);
+      memset(&fIndex[0], 0, sizeof(UInt_t) * kMaxClustersLayer);
+      return;
+    }
+  }
   fX /= fN;
 }
 
@@ -380,6 +392,10 @@ Int_t AliTRDchamberTimeBin::FindYPosition(Double_t y, UChar_t z, Int_t nClusters
 // Index of the nearest left cluster in the StackLayer indexing (-1 if no clusters are found)
 //
 
+  if(z>=fNRows){ // check pad row of cluster
+    AliDebug(1, Form("Row[%2d] outside range [0 %2d] in %02d_%d_%d.", z, fNRows, fSector, fStack, fPlane));
+    return -2;
+  }
   Int_t start = fPositions[z];                 // starting Position of the bin
   Int_t upper = (Int_t)((z != fNRows - 1) ? fPositions[z+1] : nClusters); // ending Position of the bin 
   Int_t end = upper - 1; // ending Position of the bin 
@@ -412,7 +428,7 @@ Int_t AliTRDchamberTimeBin::FindNearestYCluster(Double_t y, UChar_t z) const
 //
 
   Int_t position = FindYPosition(y, z, fN);
-  if(position == -1) return position; // bin empty
+  if(position == -2 || position == -1) return position; // bin empty
   // FindYPosition always returns the left Neighbor. We don't know if the left or the right Neighbor is nearest
   // to the Reference y-position, so test both
   Int_t upper = (Int_t)((z < fNRows-1) ? fPositions[z+1] : fN); // ending Position of the bin
index 209fefefa704a594f6fe0e0e8a6d6816c8b55a2c..161a527ed5a34fb2f7f392790056537cfb1e6118 100644 (file)
@@ -808,7 +808,7 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
 
   fDet  = AliTRDgeometry::GetDetector(fLayer,istack,isector);
   if (fDet != det) {
-    AliError("Strange Detector number Missmatch!");
+    AliError(Form("Detector number missmatch! Request[%03d] RAW[%03d]", det, fDet));
     return kFALSE;
   }
 
@@ -824,6 +824,14 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
   fColMax    = fDigits->GetNcol();
   fTimeTotal = fDigitsManager->GetDigitsParam()->GetNTimeBins(det);
 
+  // Check consistency between Geometry and raw data
+  AliTRDpadPlane *pp(fTransform->GetPadPlane());
+  Int_t ncols(pp->GetNcols()), nrows(pp->GetNrows());
+  if(ncols != fColMax) AliError(Form("N cols missmatch in Digits for Det[%3d] :: Geom[%3d] RAW[%3d]", fDet, ncols, fColMax));
+  if(nrows != fDigits->GetNrow()) AliError(Form("N rows missmatch in Digits for Det[%3d] :: Geom[%3d] RAW[%3d]", fDet, nrows, fDigits->GetNrow()));
+  if(ncols != fIndexes->GetNcol()) AliError(Form("N cols missmatch in Digits for Det[%3d] :: Geom[%3d] RAW[%3d]", fDet, ncols, fIndexes->GetNcol()));
+  if(nrows != fIndexes->GetNrow()) AliError(Form("N rows missmatch in Digits for Det[%3d] :: Geom[%3d] RAW[%3d]", fDet, nrows, fIndexes->GetNrow()));
+
   // Check consistency between OCDB and raw data
   Int_t nTimeOCDB = calibration->GetNumberOfTimeBinsDCS();
   if(fReconstructor->IsHLT()){
@@ -835,15 +843,15 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
     if(nTimeOCDB == -1){
       AliWarning("Undefined number of timebins in OCDB, using value from raw data.");
       if(!fTimeTotal>0){
-       AliError("Number of timebins in raw data is negative, skipping chamber!");
-       return kFALSE;
+        AliError(Form("Number of timebins in raw data is negative, skipping chamber[%3d]!", fDet));
+        return kFALSE;
       }
     }else if(nTimeOCDB == -2){
       AliError("Mixed number of timebins in OCDB, no reconstruction of TRD data!"); 
       return kFALSE;
     }else if(fTimeTotal != nTimeOCDB){
-      AliError(Form("Number of timebins in raw data does not match OCDB value (RAW[%d] OCDB[%d]), skipping chamber!"
-                   ,fTimeTotal,nTimeOCDB));
+      AliError(Form("Number of timebins in raw data does not match OCDB value (RAW[%d] OCDB[%d]), skipping chamber[%3d]!"
+        ,fTimeTotal,nTimeOCDB, fDet));
       return kFALSE;
     }
   }
index c7951d19ab6ae32d4ffc13d5f31e2fd9a7da28c1..83e95acce3ead5e9a17d6b6f183affec4297c49e 100644 (file)
@@ -86,6 +86,9 @@ Bool_t AliTRDtrackingChamber::Build(AliTRDgeometry *const geo, Bool_t hlt)
     if(!fTB[itb]) continue;
     fTB[itb].SetRange(z0, zl);
     fTB[itb].SetNRows(nrows);
+    fTB[itb].SetPlane(layer);
+    fTB[itb].SetStack(stack);
+    fTB[itb].SetSector(AliTRDgeometry::GetSector(fDetector));
     fTB[itb].BuildIndices();
     index[jtb++] = itb;
   }    
index c3ccf11bd931f1de87a6e0102d392ffb9b40dd80..b46e704ffe6613d7125575769216c80e08ba1671 100644 (file)
@@ -35,6 +35,7 @@ class AliTRDtransform : public TObject {
   AliTRDtransform &operator=(const AliTRDtransform &t);
   
   virtual void     Copy(TObject &t) const;
+  AliTRDpadPlane*  GetPadPlane() const {return fPadPlane;}
   virtual Bool_t   Transform(AliTRDcluster *c);
   virtual void     Recalibrate(AliTRDcluster *c, Bool_t setDet = kTRUE);