Next update of the pad status encoding
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 1 Apr 2008 11:19:44 +0000 (11:19 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 1 Apr 2008 11:19:44 +0000 (11:19 +0000)
TRD/AliTRDcluster.cxx
TRD/AliTRDcluster.h
TRD/AliTRDclusterizer.cxx
TRD/AliTRDdataArrayDigits.cxx
TRD/AliTRDdataArrayDigits.h
TRD/AliTRDdigitsManager.cxx
TRD/AliTRDdigitsManager.h
TRD/AliTRDrawStreamTB.cxx

index 0cc0a22..cb16615 100644 (file)
@@ -29,14 +29,15 @@ ClassImp(AliTRDcluster)
 //___________________________________________________________________________
 AliTRDcluster::AliTRDcluster() 
   :AliCluster() 
-  ,fDetector(0)
-  ,fLocalTimeBin(0)
-  ,fQ(0)
-  ,fNPads(0)
-  ,fCenter(0)
   ,fPadCol(0)
   ,fPadRow(0)
   ,fPadTime(0)
+  ,fLocalTimeBin(0)
+  ,fNPads(0)
+  ,fClusterMasking(0)
+  ,fDetector(0)
+  ,fQ(0)
+  ,fCenter(0)
 { 
   //
   // Default constructor
@@ -55,14 +56,15 @@ AliTRDcluster::AliTRDcluster(Int_t det, Float_t q
                            , UChar_t col, UChar_t row, UChar_t time
                            , Char_t timebin, Float_t center, UShort_t volid)
   :AliCluster(volid,pos[0],pos[1],pos[2],sig[0],sig[1],0.0,0x0) 
-  ,fDetector(det)
-  ,fLocalTimeBin(timebin)
-  ,fQ(q)
-  ,fNPads(npads)
-  ,fCenter(center)
   ,fPadCol(col)
   ,fPadRow(row)
   ,fPadTime(time)
+  ,fLocalTimeBin(timebin)
+  ,fNPads(npads)
+  ,fClusterMasking(0)
+  ,fDetector(det)
+  ,fQ(q)
+  ,fCenter(center)
 { 
   //
   // Constructor
@@ -81,14 +83,15 @@ AliTRDcluster::AliTRDcluster(Int_t det, Float_t q
 //_____________________________________________________________________________
 AliTRDcluster::AliTRDcluster(const AliTRDcluster &c)
   :AliCluster(c)
-  ,fDetector(c.fDetector)
-  ,fLocalTimeBin(c.fLocalTimeBin)
-  ,fQ(c.fQ)
-  ,fNPads(c.fNPads)
-  ,fCenter(c.fCenter)
   ,fPadCol(c.fPadCol)
   ,fPadRow(c.fPadRow)
   ,fPadTime(c.fPadTime)
+  ,fLocalTimeBin(c.fLocalTimeBin)
+  ,fNPads(c.fNPads)
+  ,fClusterMasking(c.fClusterMasking)
+  ,fDetector(c.fDetector)
+  ,fQ(c.fQ)
+  ,fCenter(c.fCenter)
 {
   //
   // Copy constructor 
@@ -204,3 +207,33 @@ Float_t AliTRDcluster::GetSumS() const
   return sum;
 
 }
+
+//_____________________________________________________________________________
+void AliTRDcluster::SetPadMaskedPosition(UChar_t position)
+{
+  //
+  // store the pad corruption position code
+  // 
+  // Code: 1 = left cluster
+  //       2 = middle cluster;
+  //       4 = right cluster
+  //
+  for(Int_t ipos = 0; ipos < 3; ipos++)
+    if(TESTBIT(position, ipos))
+      SETBIT(fClusterMasking, ipos);
+}
+
+//_____________________________________________________________________________
+void AliTRDcluster::SetPadMaskedStatus(UChar_t status)
+{
+  //
+  // store the status of the corrupted pad
+  //
+  // Code: 2 = noisy
+  //       4 = Bridged Left
+  //       8 = Bridged Right
+  //      32 = Not Connected
+  for(Int_t ipos = 0; ipos < 5; ipos++)
+    if(TESTBIT(status, ipos))
+      SETBIT(fClusterMasking, ipos + 3);
+}
index 262fb87..68012db 100644 (file)
@@ -17,9 +17,13 @@ class AliTRDcluster : public AliCluster {
 
  public:
 
-  enum { kInChamber = 1
-       , kShared    = 2
-       , kMasked    = 4 };
+  enum { kInChamber = BIT(1)
+       , kShared    = BIT(2)
+  };
+  enum { kMaskedLeft = BIT(0)
+      , kMaskedCenter= BIT(1)
+      , kMaskedRight = BIT(2)
+  };
 
   AliTRDcluster();
   AliTRDcluster(Int_t det, Float_t q, Float_t *pos, Float_t *sig
@@ -32,41 +36,42 @@ class AliTRDcluster : public AliCluster {
   virtual void     AddTrackIndex(Int_t *i); 
 
           Bool_t   IsInChamber() const             { return TestBit(kInChamber);       }
+          Bool_t   IsMasked() const                { return fClusterMasking ? kTRUE : kFALSE; }
           Bool_t   IsShared() const                { return TestBit(kShared);          }
           Bool_t   IsUsed() const                  { return (fQ < 0) ? kTRUE : kFALSE; }
-          Bool_t   HasMaskedPad() const            { return TestBit(kMasked);          }
-          
-          void     Use(Int_t = 0)                  { fQ = -fQ;              }
-    
+
+          UChar_t  GetPadMaskedPosition() const    { return fClusterMasking & 7; }
+          UChar_t  GetPadMaskedStatus() const      { return fClusterMasking >> 3; }
           Int_t    GetDetector() const             { return fDetector;      }
           Int_t    GetLocalTimeBin() const         { return fLocalTimeBin;  }
           Float_t  GetQ() const                    { return fQ;             }
           Int_t    GetNPads() const                { return fNPads;         }
           Float_t  GetCenter() const               { return fCenter;        }
-         Int_t    GetPadCol() const               { return fPadCol;        }
-         Int_t    GetPadRow() const               { return fPadRow;        }
+          Int_t    GetPadCol() const               { return fPadCol;        }
+          Int_t    GetPadRow() const               { return fPadRow;        }
           Int_t    GetPadTime() const              { return fPadTime;       }
           Short_t *GetSignals()                    { return fSignals;       }
           Float_t  GetSumS() const;
 
           void     SetLocalTimeBin(Char_t t)       { fLocalTimeBin = t;     }
           void     SetInChamber(Bool_t in = kTRUE) { SetBit(kInChamber,in); }
+          void     SetPadMaskedPosition(UChar_t position);
+          void     SetPadMaskedStatus(UChar_t status);
           void     SetShared(Bool_t sh  = kTRUE)   { SetBit(kShared,sh);    }
-          void     SetMaskedPad(Bool_t mp = kTRUE) { SetBit(kMasked,mp);    }
+          void     Use(Int_t = 0)                  { fQ = -fQ;              }
 
- protected:
-  
-          Int_t   fDetector;       //  TRD detector number
-          Char_t  fLocalTimeBin;   //  T0-calibrated time bin number
-          Float_t fQ;              //  Amplitude 
-          Char_t  fNPads;          //  Number of pads in cluster
-          Float_t fCenter;         //  Center of the cluster relative to the pad 
-         UChar_t fPadCol;         //  Central pad number in column direction
-         UChar_t fPadRow;         //  Central pad number in row direction
-         UChar_t fPadTime;        //  Uncalibrated time bin number
-          Short_t fSignals[7];     //  Signals in the cluster
+  protected:
+    UChar_t fPadCol;         //  Central pad number in column direction
+    UChar_t fPadRow;         //  Central pad number in row direction
+    UChar_t fPadTime;        //  Uncalibrated time bin number
+    Char_t  fLocalTimeBin;   //  T0-calibrated time bin number
+    UChar_t fNPads;          //  Number of pads in cluster
+    UChar_t fClusterMasking; //  Bit field containing cluster status information;
+    Short_t fDetector;       //  TRD detector number
+    Short_t fSignals[7];     //  Signals in the cluster
+    Float_t fQ;              //  Amplitude 
+    Float_t fCenter;         //  Center of the cluster relative to the pad 
 
-  ClassDef(AliTRDcluster,5)        //  Cluster for the TRD
+    ClassDef(AliTRDcluster, 6)        //  Cluster for the TRD
 };
 #endif
index f456408..f2fd8d6 100644 (file)
@@ -608,7 +608,7 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
   //   digits should be expanded beforehand!
   //   digitsIn->Expand();
   AliTRDdataArrayDigits *digitsIn = (AliTRDdataArrayDigits *) fDigitsManager->GetDigits(det);      
-
+  
   // This is to take care of switched off super modules
   if (!digitsIn->HasData()) 
     {
@@ -696,295 +696,266 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
 
   // Apply the gain and the tail cancelation via digital filter
   TailCancelation(digitsIn
-                ,digitsOut  
-                ,indexesIn
-                ,fIndexesOut
-                ,nTimeTotal
-                 ,adcThreshold
-                 ,calGainFactorROC
-                 ,calGainFactorDetValue);      
+                ,digitsOut  
+                ,indexesIn
+                ,fIndexesOut
+                ,nTimeTotal
+                ,adcThreshold
+                ,calGainFactorROC
+                ,calGainFactorDetValue);       
        
   Int_t row  = 0;
   Int_t col  = 0;
   Int_t time = 0;
   Int_t iPad = 0;
     
-       UChar_t status[3], ipos;
-       Short_t signal;
+  UChar_t status[3]={0, 0, 0}, ipos = 0;
   fIndexesOut->ResetCounters();
   while (fIndexesOut->NextRCTbinIndex(row, col, time)){
-               Float_t signalM = TMath::Abs(digitsOut->GetDataUnchecked(row,col,time));
-               signal = digitsIn->GetDataUnchecked(row,col,time);
-               status[1] = digitsIn->GetPadStatus(row, col, time);
-               ipos = status[1] ? 2 : 0;
-
-               // Look for the maximum
-               if (signalM >= maxThresh) {
-                       if (col + 1 >= nColMax || col-1 < 0) continue;
-
-                       Float_t signalL = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time));
-                       signal = digitsIn->GetDataUnchecked(row,col+1,time);
-                       status[0] = digitsIn->GetPadStatus(row,col+1,time);
-                       ipos += status[0] ? 1 : 0;
-
-                       Float_t signalR = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time));
-                       signal = digitsIn->GetDataUnchecked(row,col-1,time);
-                       status[2] = digitsIn->GetPadStatus(row, col-1, time);
-                       ipos += status[0] ? 4 : 0;
-
-                       // reject candidates with more than 1 problematic pad
-                       if(ipos == 3 || ipos > 4) continue;
-
-                       if(!status[1]){ // good central pad
-                               if(!ipos){ // all pads are OK
-                                       if ((signalL <= signalM) && (signalR <  signalM)) {
-                                               if ((signalL >= sigThresh) || (signalR >= sigThresh)) {
-                                                       // Maximum found, mark the position by a negative signal
-                                                       digitsOut->SetDataUnchecked(row,col,time,-signalM);
-                                                       fIndexesMaxima->AddIndexTBin(row,col,time);
-                                                       padStatus.SetDataUnchecked(row, col, time, ipos);
-                                               }
-                                       }
-                               } else { // one of the neighbouring pads are bad
-                                       if(status[0] && signalR < signalM && signalR >= sigThresh){
-                                               digitsOut->SetDataUnchecked(row,col,time,-signalM);
-                                               digitsOut->SetDataUnchecked(row, col, time+1, 0.);
-                                               fIndexesMaxima->AddIndexTBin(row,col,time);
-                                               padStatus.SetDataUnchecked(row, col, time, ipos);
-                                       } else if(status[2] && signalL <= signalM && signalL >= sigThresh){
-                                               digitsOut->SetDataUnchecked(row,col,time,-signalM);
-                                               digitsOut->SetDataUnchecked(row, col, time-1, 0.);
-                                               fIndexesMaxima->AddIndexTBin(row,col,time);
-                                               padStatus.SetDataUnchecked(row, col, time, ipos);
-                                       }
-                               }
-                       } else { // wrong maximum pad
-                               if ((signalL >= sigThresh) || (signalR >= sigThresh)) {
-                                       // Maximum found, mark the position by a negative signal
-                                       digitsOut->SetDataUnchecked(row,col,time,-maxThresh);
-                                       fIndexesMaxima->AddIndexTBin(row,col,time);
-                                       padStatus.SetDataUnchecked(row, col, time, ipos);
-                               }
-                       }
-               }
-       }
-              
-  // The index to the first cluster of a given ROC
-  Int_t firstClusterROC = -1;
-  // The number of cluster in a given ROC
-  Int_t nClusterROC     =  0;
-
-  // Now check the maxima and calculate the cluster position
-  fIndexesMaxima->ResetCounters();
-  while (fIndexesMaxima->NextRCTbinIndex(row, col, time)) 
-    {
+    Float_t signalM = TMath::Abs(digitsOut->GetDataUnchecked(row,col,time));
+    status[1] = digitsIn->GetPadStatus(row,col,time);
+    if(status[1]) SETBIT(ipos, AliTRDcluster::kMaskedCenter);
+
+    // Look for the maximum
+    if (signalM >= maxThresh) {
+      if (col + 1 >= nColMax || col-1 < 0) continue;
+    
+      Float_t signalL = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time));
+      status[0] = digitsIn->GetPadStatus(row,col+1,time);
+      if(status[0]) SETBIT(ipos, AliTRDcluster::kMaskedLeft);
+    
+      Float_t signalR = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time));
+      status[2] = digitsIn->GetPadStatus(row,col-1,time);
+      if(status[2]) SETBIT(ipos, AliTRDcluster::kMaskedRight);
+    
+      // reject candidates with more than 1 problematic pad
+      if(ipos == 3 || ipos > 4) continue;
+    
+      if(!status[1]){ // good central pad
+        if(!ipos){ // all pads are OK
+          if ((signalL <= signalM) && (signalR <  signalM)) {
+            if ((signalL >= sigThresh) || (signalR >= sigThresh)) {
+              // Maximum found, mark the position by a negative signal
+              digitsOut->SetDataUnchecked(row,col,time,-signalM);
+              fIndexesMaxima->AddIndexTBin(row,col,time);
+              padStatus.SetDataUnchecked(row, col, time, ipos);
+              }
+            }
+          } else { // one of the neighbouring pads are bad
+            if(status[0] && signalR < signalM && signalR >= sigThresh){
+              digitsOut->SetDataUnchecked(row,col,time,-signalM);
+              digitsOut->SetDataUnchecked(row, col, time+1, 0.);
+              fIndexesMaxima->AddIndexTBin(row,col,time);
+              padStatus.SetDataUnchecked(row, col, time, ipos);
+            } else if(status[2] && signalL <= signalM && signalL >= sigThresh){
+              digitsOut->SetDataUnchecked(row,col,time,-signalM);
+              digitsOut->SetDataUnchecked(row, col, time-1, 0.);
+              fIndexesMaxima->AddIndexTBin(row,col,time);
+              padStatus.SetDataUnchecked(row, col, time, ipos);
+            }
+          }
+        } else { // wrong maximum pad
+          if ((signalL >= sigThresh) || (signalR >= sigThresh)) {
+            // Maximum found, mark the position by a negative signal
+            digitsOut->SetDataUnchecked(row,col,time,-maxThresh);
+            fIndexesMaxima->AddIndexTBin(row,col,time);
+            padStatus.SetDataUnchecked(row, col, time, ipos);
+          }
+        }
+      }
+    }
+
+    // The index to the first cluster of a given ROC
+    Int_t firstClusterROC = -1;
+    // The number of cluster in a given ROC
+    Int_t nClusterROC     =  0;
+
+    // Now check the maxima and calculate the cluster position
+    fIndexesMaxima->ResetCounters();
+    while (fIndexesMaxima->NextRCTbinIndex(row, col, time)) {
 
       // Maximum found ?             
-      if (digitsOut->GetDataUnchecked(row,col,time) < 0.0) 
-        {
+      if (digitsOut->GetDataUnchecked(row,col,time) < 0.0) {
+        for (iPad = 0; iPad < kNclus; iPad++) {
+          Int_t iPadCol = col - 1 + iPad;
+          clusterSignal[iPad] = TMath::Abs(digitsOut->GetDataUnchecked(row,iPadCol,time));
+        }
 
-         for (iPad = 0; iPad < kNclus; iPad++) 
-            {
-             Int_t iPadCol = col - 1 + iPad;
-             clusterSignal[iPad] = TMath::Abs(digitsOut->GetDataUnchecked(row,iPadCol,time));
-           }
+        // Count the number of pads in the cluster
+        Int_t nPadCount = 0;
+        Int_t ii;
+        // Look to the left
+        ii = 0;
+        while (TMath::Abs(digitsOut->GetDataUnchecked(row,col-ii  ,time)) >= sigThresh) {
+          nPadCount++;
+          ii++;
+          if (col-ii   <        0) break;
+        }
+        // Look to the right
+        ii = 0;
+        while (TMath::Abs(digitsOut->GetDataUnchecked(row,col+ii+1,time)) >= sigThresh){
+          nPadCount++;
+          ii++;
+          if (col+ii+1 >= nColMax) break;
+        }
+        nClusters++;
+
+        // Look for 5 pad cluster with minimum in the middle
+        Bool_t fivePadCluster = kFALSE;
+        if (col < (nColMax - 3)){
+          if (digitsOut->GetDataUnchecked(row,col+2,time) < 0) {
+            fivePadCluster = kTRUE;
+          }
+          if ((fivePadCluster) && (col < (nColMax - 5))) {
+            if (digitsOut->GetDataUnchecked(row,col+4,time) >= sigThresh){
+              fivePadCluster = kFALSE;
+            }
+          }
+          if ((fivePadCluster) && (col >             1)){
+            if (digitsOut->GetDataUnchecked(row,col-2,time) >= sigThresh){
+              fivePadCluster = kFALSE;
+            }
+          }
+        }
 
-         // Count the number of pads in the cluster
-         Int_t nPadCount = 0;
-         Int_t ii;
-         // Look to the left
-         ii = 0;
-         while (TMath::Abs(digitsOut->GetDataUnchecked(row,col-ii  ,time)) >= sigThresh) 
-            {
-             nPadCount++;
-             ii++;
-             if (col-ii   <        0) break;
-           }
-         // Look to the right
-         ii = 0;
-         while (TMath::Abs(digitsOut->GetDataUnchecked(row,col+ii+1,time)) >= sigThresh) 
-            {
-             nPadCount++;
-             ii++;
-             if (col+ii+1 >= nColMax) break;
-           }
-         nClusters++;
-
-         // Look for 5 pad cluster with minimum in the middle
-         Bool_t fivePadCluster = kFALSE;
-         if (col < (nColMax - 3)) 
-            {
-             if (digitsOut->GetDataUnchecked(row,col+2,time) < 0) 
-                {
-                 fivePadCluster = kTRUE;
-               }
-             if ((fivePadCluster) && (col < (nColMax - 5))) 
-                {
-                 if (digitsOut->GetDataUnchecked(row,col+4,time) >= sigThresh) 
-                    {
-                     fivePadCluster = kFALSE;
-                   }
-               }
-             if ((fivePadCluster) && (col >             1)) 
-                {
-                 if (digitsOut->GetDataUnchecked(row,col-2,time) >= sigThresh) 
-                    {
-                     fivePadCluster = kFALSE;
-                   }
-               }
-           }
+        // 5 pad cluster
+        // Modify the signal of the overlapping pad for the left part 
+        // of the cluster which remains from a previous unfolding
+        if (iUnfold) {
+          clusterSignal[0] *= ratioLeft;
+          iUnfold = 0;
+        }
 
-         // 5 pad cluster
-         // Modify the signal of the overlapping pad for the left part 
-         // of the cluster which remains from a previous unfolding
-         if (iUnfold) 
-            {
-             clusterSignal[0] *= ratioLeft;
-             iUnfold = 0;
-           }
+        // Unfold the 5 pad cluster
+        if (fivePadCluster){
+          for (iPad = 0; iPad < kNsig; iPad++) {
+            padSignal[iPad] = TMath::Abs(digitsOut->GetDataUnchecked(row
+                      ,col-1+iPad
+                      ,time));
+          }
+          // Unfold the two maxima and set the signal on 
+          // the overlapping pad to the ratio
+          ratioRight        = Unfold(kEpsilon,iplan,padSignal);
+          ratioLeft         = 1.0 - ratioRight; 
+          clusterSignal[2] *= ratioRight;
+          iUnfold = 1;
+        }
 
-         // Unfold the 5 pad cluster
-         if (fivePadCluster) 
-            {
-             for (iPad = 0; iPad < kNsig; iPad++) 
-                {
-                 padSignal[iPad] = TMath::Abs(digitsOut->GetDataUnchecked(row
-                                                                         ,col-1+iPad
-                                                                         ,time));
-               }
-             // Unfold the two maxima and set the signal on 
-             // the overlapping pad to the ratio
-             ratioRight        = Unfold(kEpsilon,iplan,padSignal);
-             ratioLeft         = 1.0 - ratioRight; 
-             clusterSignal[2] *= ratioRight;
-             iUnfold = 1;
-           }
+        // The position of the cluster in COL direction relative to the center pad (pad units)
+        Double_t clusterPosCol = 0.0;
+        if (AliTRDReconstructor::RecoParam()->LUTOn()) {
+          // Calculate the position of the cluster by using the
+          // lookup table method
+          clusterPosCol = LUTposition(iplan,clusterSignal[0]
+              ,clusterSignal[1]
+              ,clusterSignal[2]);
+        } else {
+          // Calculate the position of the cluster by using the
+          // center of gravity method
+          for (Int_t i = 0; i < kNsig; i++) {
+            padSignal[i] = 0.0;
+          }
+          padSignal[2] = TMath::Abs(digitsOut->GetDataUnchecked(row,col  ,time)); // Central pad
+          padSignal[1] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time)); // Left    pad
+          padSignal[3] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time)); // Right   pad
+
+          if ((col >           2) && 
+              (TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time)) < padSignal[1])) {
+              padSignal[0] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time));
+          }
+          if ((col < nColMax - 3) &&
+              (TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time)) < padSignal[3])){
+              padSignal[4] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time));
+          }
+          clusterPosCol = GetCOG(padSignal);
+        }
 
-         // The position of the cluster in COL direction relative to the center pad (pad units)
-          Double_t clusterPosCol = 0.0;
-         if (AliTRDReconstructor::RecoParam()->LUTOn()) 
-            {
-             // Calculate the position of the cluster by using the
-             // lookup table method
-             clusterPosCol = LUTposition(iplan,clusterSignal[0]
-                                               ,clusterSignal[1]
-                                              ,clusterSignal[2]);
-           }
-         else 
-            {
-             // Calculate the position of the cluster by using the
-             // center of gravity method
-             for (Int_t i = 0; i < kNsig; i++) 
-                {
-                 padSignal[i] = 0.0;
-               }
-             padSignal[2] = TMath::Abs(digitsOut->GetDataUnchecked(row,col  ,time)); // Central pad
-             padSignal[1] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time)); // Left    pad
-             padSignal[3] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time)); // Right   pad
-             if ((col >           2) && 
-                 (TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time)) < padSignal[1])) 
-                {
-                 padSignal[0] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time));
-               }
-             if ((col < nColMax - 3) &&
-                 (TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time)) < padSignal[3])) 
-                {
-                 padSignal[4] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time));
-               }  
-             clusterPosCol = GetCOG(padSignal);
-           }
+        // Store the amplitudes of the pads in the cluster for later analysis
+        // and check whether one of these pads is masked in the database
+        Short_t signals[7] = { 0, 0, 0, 0, 0, 0, 0 };
+        for (Int_t jPad = col-3; jPad <= col+3; jPad++) {
+          if ((jPad <          0) || 
+              (jPad >= nColMax-1)) {
+              continue;
+          }
+          signals[jPad-col+3] = TMath::Nint(TMath::Abs(digitsOut->GetDataUnchecked(row,jPad,time)));
+        }
 
-         // Store the amplitudes of the pads in the cluster for later analysis
-         // and check whether one of these pads is masked in the database
-         Short_t signals[7] = { 0, 0, 0, 0, 0, 0, 0 };
-         for (Int_t jPad = col-3; jPad <= col+3; jPad++) 
-            {
-             if ((jPad <          0) || 
-                 (jPad >= nColMax-1)) 
-                {
-                 continue;
-               }
-             signals[jPad-col+3] = TMath::Nint(TMath::Abs(digitsOut->GetDataUnchecked(row,jPad,time)));
-           }
+        // Transform the local cluster coordinates into calibrated 
+        // space point positions defined in the local tracking system.
+        // Here the calibration for T0, Vdrift and ExB is applied as well.
+        Double_t clusterXYZ[6];
+        clusterXYZ[0] = clusterPosCol;
+        clusterXYZ[1] = clusterSignal[0];
+        clusterXYZ[2] = clusterSignal[1];
+        clusterXYZ[3] = clusterSignal[2];
+        clusterXYZ[4] = 0.0;
+        clusterXYZ[5] = 0.0;
+        Int_t    clusterRCT[3];
+        clusterRCT[0] = row;
+        clusterRCT[1] = col;
+        clusterRCT[2] = 0;
+        
+        Bool_t out = kTRUE;
+        if (fTransform->Transform(clusterXYZ, clusterRCT, ((UInt_t) time), out, 0)) {
+
+        // Add the cluster to the output array
+        // The track indices will be stored later 
+        Float_t clusterPos[3];
+        clusterPos[0] = clusterXYZ[0];
+        clusterPos[1] = clusterXYZ[1];
+        clusterPos[2] = clusterXYZ[2];
+        Float_t clusterSig[2];
+        clusterSig[0] = clusterXYZ[4];
+        clusterSig[1] = clusterXYZ[5];
+        Double_t clusterCharge  = clusterXYZ[3];
+        Char_t   clusterTimeBin = ((Char_t) clusterRCT[2]);
+        AliTRDcluster *cluster = new AliTRDcluster(idet
+                    ,clusterCharge
+                    ,clusterPos
+                    ,clusterSig
+                    ,0x0
+                    ,((Char_t) nPadCount)
+                    ,signals
+                    ,((UChar_t) col)
+                    ,((UChar_t) row)
+                    ,((UChar_t) time)
+                    ,clusterTimeBin
+                    ,clusterPosCol
+                    ,volid);
+        cluster->SetInChamber(!out);
+        UChar_t maskPosition = padStatus.GetDataUnchecked(row, col, time);
+        if(maskPosition){ 
+          cluster->SetPadMaskedPosition(maskPosition);
+
+          if(maskPosition & AliTRDcluster::kMaskedLeft) cluster->SetPadMaskedStatus(status[0]);
+          else if(maskPosition & AliTRDcluster::kMaskedCenter) cluster->SetPadMaskedStatus(status[1]);
+          else cluster->SetPadMaskedStatus(status[2]);
+        }
 
-          // Transform the local cluster coordinates into calibrated 
-          // space point positions defined in the local tracking system.
-          // Here the calibration for T0, Vdrift and ExB is applied as well.
-               Double_t clusterXYZ[6];
-               clusterXYZ[0] = clusterPosCol;
-               clusterXYZ[1] = clusterSignal[0];
-               clusterXYZ[2] = clusterSignal[1];
-               clusterXYZ[3] = clusterSignal[2];
-               clusterXYZ[4] = 0.0;
-               clusterXYZ[5] = 0.0;
-               Int_t    clusterRCT[3];
-               clusterRCT[0] = row;
-               clusterRCT[1] = col;
-               clusterRCT[2] = 0;
-               
-         Bool_t out = kTRUE;
-         if (fTransform->Transform(clusterXYZ, clusterRCT, ((UInt_t) time), out, 0)) {
-
-           // Add the cluster to the output array
-           // The track indices will be stored later 
-            Float_t clusterPos[3];
-            clusterPos[0] = clusterXYZ[0];
-            clusterPos[1] = clusterXYZ[1];
-            clusterPos[2] = clusterXYZ[2];
-           Float_t clusterSig[2];
-           clusterSig[0] = clusterXYZ[4];
-           clusterSig[1] = clusterXYZ[5];
-            Double_t clusterCharge  = clusterXYZ[3];
-           Char_t   clusterTimeBin = ((Char_t) clusterRCT[2]);
-           AliTRDcluster *cluster = new AliTRDcluster(idet
-                                                     ,clusterCharge
-                                                     ,clusterPos
-                                                     ,clusterSig
-                                                     ,0x0
-                                                     ,((Char_t) nPadCount)
-                                                     ,signals
-                                                     ,((UChar_t) col)
-                                                     ,((UChar_t) row)
-                                                     ,((UChar_t) time)
-                                                     ,clusterTimeBin
-                                                     ,clusterPosCol
-                                                     ,volid);
-           cluster->SetInChamber(!out);
-           if(padStatus.GetDataUnchecked(row, col, time)){ 
-                               cluster->SetMaskedPad(kTRUE);
-                               //cluster->SetPadMasked(center/side);
-                               //cluster->SetPadMaskedStatus(status);
-                       }
-
-           // Temporarily store the row, column and time bin of the center pad
-           // Used to later on assign the track indices
-           cluster->SetLabel( row,0);
-           cluster->SetLabel( col,1);
-           cluster->SetLabel(time,2);
-
-           RecPoints()->Add(cluster);
-
-           // Store the index of the first cluster in the current ROC
-           if (firstClusterROC < 0) 
-              {
-               firstClusterROC = RecPoints()->GetEntriesFast() - 1;
-             }
-
-           // Count the number of cluster in the current ROC
-           nClusterROC++;
-
-         } // if: Transform ok ?
-
-        } // if: Maximum found ?
+        // Temporarily store the row, column and time bin of the center pad
+        // Used to later on assign the track indices
+        cluster->SetLabel( row,0);
+        cluster->SetLabel( col,1);
+        cluster->SetLabel(time,2);
+  
+        RecPoints()->Add(cluster);
 
-    }
+        // Store the index of the first cluster in the current ROC
+        if (firstClusterROC < 0) {
+          firstClusterROC = RecPoints()->GetEntriesFast() - 1;
+        }
+
+        // Count the number of cluster in the current ROC
+        nClusterROC++;
+
+      } // if: Transform ok ?
+    } // if: Maximum found ?
+  }
 
   delete digitsOut;
 
-  if (fAddLabels) 
-    {
-      AddLabels(idet, firstClusterROC, nClusterROC);
-    }
+  if (fAddLabels) AddLabels(idet, firstClusterROC, nClusterROC);
 
   // Write the cluster and reset the array
   WriteClusters(idet);
@@ -1169,19 +1140,24 @@ void AliTRDclusterizer::TailCancelation(AliTRDdataArrayDigits *digitsIn
       Double_t gain                  = calGainFactorDetValue 
                                      * calGainFactorROCValue;
 
+      Bool_t corrupted = kFALSE;
       for (iTime = 0; iTime < nTimeTotal; iTime++) 
        {         
          // Apply gain gain factor
          inADC[iTime]   = digitsIn->GetDataUnchecked(iRow,iCol,iTime);
+         if(digitsIn->GetPadStatus(iRow, iCol, iTime)) corrupted = kTRUE;
          inADC[iTime]  /= gain;
          outADC[iTime]  = inADC[iTime];
        }
-
-      // Apply the tail cancelation via the digital filter
-      if (AliTRDReconstructor::RecoParam()->TCOn()) 
-        {
-         DeConvExp(inADC,outADC,nTimeTotal,AliTRDReconstructor::RecoParam()->GetTCnexp());
-        }
+      if(!corrupted)
+       {
+         // Apply the tail cancelation via the digital filter
+         // (only for non-coorupted pads)
+         if (AliTRDReconstructor::RecoParam()->TCOn()) 
+           {
+             DeConvExp(inADC,outADC,nTimeTotal,AliTRDReconstructor::RecoParam()->GetTCnexp());
+           }
+       }
 
       indexesIn->ResetTbinCounter();
       while (indexesIn->NextTbinIndex(iTime))
index 2a66659..a6b984d 100644 (file)
@@ -1,29 +1,3 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: The ALICE Off-line Project.                                    *
- * Contributors are mentioned in the code where appropriate.              *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-
-/* $Id: AliTRDdataArrayDigits.cxx,v 1.17 2006/08/28 14:37:05 cblume Exp $ */
-
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Container for TRD signals type of short taking pad masking into account   //
-//                                                                           //
-// Author:                                                                   // 
-//   Markus Fasel (markus.fasel@web.de)                                      //
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
-
 #include <TROOT.h>
 
 #include "AliLog.h"
@@ -35,8 +9,7 @@
 ClassImp(AliTRDdataArrayDigits)
 
 //_____________________________________________________________________________
-AliTRDdataArrayDigits::AliTRDdataArrayDigits(Int_t nrow, Int_t ncol, Int_t ntime)
-                      :AliTRDdataArrayS(nrow, ncol, ntime)
+AliTRDdataArrayDigits::AliTRDdataArrayDigits(Int_t nrow, Int_t ncol, Int_t ntime): AliTRDdataArrayS(nrow, ncol, ntime)
 {
   //
   // Constructor
@@ -172,7 +145,7 @@ void AliTRDdataArrayDigits::SetPadStatus(Int_t row, Int_t col, Int_t time, UChar
   //               Bridged Left masking:    Bit 11(0), Bit 12(1)
   //               Bridged Right masking:   Bit 11(1), Bit 12(1)
   // 
-  Short_t signal = GetDataFast(GetIdx1Unchecked(col, row), time);
+  Short_t signal = GetDataFast(GetIdx1Unchecked(row, col), time);
   // only set the Pad Status if the signal is > 0
   if(signal > 0){
     switch(status)
index 0e361ee..8ed1d55 100644 (file)
@@ -1,37 +1,25 @@
 #ifndef ALITRDDATAARRAYDIGITS_H
 #define ALITRDDATAARRAYDIGITS_H
 
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/* $Id: AliTRDdataArrayDigits.h,v Exp $ */
+#include "AliTRDdataArrayS.h"
 
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Container for TRD signals type of short taking pad masking into account   //
-//                                                                           //
-// Author:                                                                   // 
-//   Markus Fasel (markus.fasel@web.de)                                      //
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
+//#define DEBUG
 
-#include "AliTRDdataArrayS.h"
+class AliTRDdataArrayDigits;
 
 class AliTRDdataArrayDigits : public AliTRDdataArrayS
 {
-
  public:
-
   AliTRDdataArrayDigits(){};
   AliTRDdataArrayDigits(Int_t nrow, Int_t ncol, Int_t ntime);
   virtual ~AliTRDdataArrayDigits(){};
 
-  virtual Short_t GetDataUnchecked(Int_t row, Int_t col, Int_t time) const;
-  virtual Short_t GetData(Int_t row, Int_t col, Int_t time) const;
-  virtual Int_t   GetOverThreshold(Short_t threshold);  
-          UChar_t GetPadStatus(Int_t row, Int_t col, Int_t time) const;
-          void    SetPadStatus(Int_t col, Int_t row, Int_t time, UChar_t status);
-          Bool_t  IsPadCorrupted(Int_t row, Int_t col, Int_t time);
+  Short_t GetDataUnchecked(Int_t row, Int_t col, Int_t time) const;
+  Short_t GetData(Int_t row, Int_t col, Int_t time) const;
+  Int_t   GetOverThreshold(Short_t threshold);  
+  UChar_t GetPadStatus(Int_t row, Int_t col, Int_t time) const;
+  void SetPadStatus(Int_t col, Int_t row, Int_t time, UChar_t status);
+  Bool_t IsPadCorrupted(Int_t row, Int_t col, Int_t time);
 
   ClassDef(AliTRDdataArrayDigits, 1) // Container for TRD signals type of short taking pad masking into account
 };
index 3a8ef55..03e96d6 100644 (file)
@@ -36,6 +36,7 @@
 #include "AliTRDdataArray.h"
 #include "AliTRDdataArrayI.h"
 #include "AliTRDdataArrayS.h"
+#include "AliTRDdataArrayDigits.h"
 #include "AliTRDdigit.h"
 #include "AliTRDgeometry.h"
 
@@ -156,7 +157,7 @@ void AliTRDdigitsManager::CreateArrays()
     fDigits = new AliTRDsegmentArray("AliTRDdataArrayF",AliTRDgeometry::Ndet());
   }
   else {
-    fDigits = new AliTRDsegmentArray("AliTRDdataArrayS",AliTRDgeometry::Ndet());
+    fDigits = new AliTRDsegmentArray("AliTRDdataArrayDigits",AliTRDgeometry::Ndet());
   }
 
   if (fUseDictionaries) {
@@ -220,7 +221,7 @@ Short_t AliTRDdigitsManager::GetDigitAmp(Int_t row, Int_t col,Int_t time
     return 0;
   }
 
-  return ((Short_t) ((AliTRDdataArrayS *) GetDigits(det))->GetData(row,col,time));
+  return ((Short_t) ((AliTRDdataArrayDigits *) GetDigits(det))->GetData(row,col,time));
 
 }
  
@@ -370,7 +371,7 @@ AliTRDdigit *AliTRDdigitsManager::GetDigit(Int_t row, Int_t col
   digits[2] = col;
   digits[3] = time;
 
-  amp[0]    = ((AliTRDdataArrayS *) GetDigits(det))->GetData(row,col,time);
+  amp[0]    = ((AliTRDdataArrayDigits *) GetDigits(det))->GetData(row,col,time);
   
   return (new AliTRDdigit(digits,amp));
 
@@ -401,7 +402,7 @@ Int_t AliTRDdigitsManager::GetTrack(Int_t track
 }
 
 //_____________________________________________________________________________
-AliTRDdataArray *AliTRDdigitsManager::GetDigits(Int_t det) const
+AliTRDdataArrayDigits *AliTRDdigitsManager::GetDigits(Int_t det) const
 {
   //
   // Returns the digits array for one detector
@@ -411,7 +412,7 @@ AliTRDdataArray *AliTRDdigitsManager::GetDigits(Int_t det) const
     return 0x0;
   }
 
-  return (AliTRDdataArray *) fDigits->At(det);
+  return (AliTRDdataArrayDigits *) fDigits->At(det);
 
 }
 
@@ -508,13 +509,13 @@ Bool_t AliTRDdigitsManager::BuildIndexes(Int_t det)
   Int_t nTbins = 0;
 
   AliTRDgeometry    geom;
-  AliTRDdataArrayS *digits = 0x0;
+  AliTRDdataArrayDigits *digits = 0x0;
 
   if (fHasSDigits) {
     return kFALSE;
   }
   else {
-    digits = (AliTRDdataArrayS *) GetDigits(det);
+    digits = (AliTRDdataArrayDigits *) GetDigits(det);
   }
 
   //digits should be expanded by now!!!
index 1972d53..ba70826 100644 (file)
@@ -17,6 +17,7 @@ class TTree;
 
 class AliTRDsegmentArray;
 class AliTRDdataArray;
+class AliTRDdataArrayDigits;
 class AliTRDdigit;
 class AliTRDSignalIndex;
 
@@ -56,7 +57,7 @@ class AliTRDdigitsManager : public TObject {
           Int_t               GetTrack(Int_t track, Int_t row, Int_t col
                                      , Int_t time, Int_t det) const;
 
-          AliTRDdataArray    *GetDigits(Int_t det) const;
+          AliTRDdataArrayDigits    *GetDigits(Int_t det) const;
           AliTRDdataArray    *GetDictionary(Int_t det, Int_t i) const;
 
          AliTRDSignalIndex  *GetIndexes(Int_t det);
index 3a4129c..bc13d1d 100644 (file)
@@ -766,7 +766,8 @@ AliTRDrawStreamTB::NextChamber(AliTRDdigitsManager *digitsManager)
          if ((GetSignals()[it] - adcBaseline) > 0)
            {
              digits->SetDataUnchecked(GetRow(), GetCol(), it, GetSignals()[it] - adcBaseline);
-             digits->SetPadStatus(GetRow(), GetCol(), it, padStatus);
+             if(padStatus)
+               digits->SetPadStatus(GetRow(), GetCol(), it, padStatus);
                      
              indexes->AddIndexTBin(GetRow(), GetCol(), it);
               if (digitsManager->UsesDictionaries())