]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Digits marked according to pad status
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 Mar 2008 17:27:42 +0000 (17:27 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 Mar 2008 17:27:42 +0000 (17:27 +0000)
TRD/AliTRDcalibDB.cxx
TRD/AliTRDcalibDB.h
TRD/AliTRDclusterizer.cxx
TRD/AliTRDclusterizer.h
TRD/AliTRDrawStreamTB.cxx
TRD/Cal/AliTRDCalPadStatus.h
TRD/Cal/AliTRDCalSingleChamberStatus.h

index ec78921b0ac3ef19e245d115461b8120aaca9f0e..e7a45c1136a46ffac9aab6c5eac2917b9f823724 100644 (file)
@@ -787,6 +787,22 @@ Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row)
 
 }
 
+//_____________________________________________________________________________
+Bool_t AliTRDcalibDB::IsPadNotConnected(Int_t det, Int_t col, Int_t row)
+{
+  //
+  // Returns status, see name of functions for details ;-)
+  //
+  const AliTRDCalPadStatus         * cal = dynamic_cast<const AliTRDCalPadStatus *> 
+                                           (GetCachedCDBObject(kIDPadStatus));
+  if (!cal) {
+    return -1;
+  }
+
+  return cal->IsNotConnected(det,col,row);
+
+}
+
 //_____________________________________________________________________________
 Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det)
 {
index 84ec825f98c66cd072d303772cec10a833282205..8ef6345c0986794982370657c1c008c91e90a2d1 100644 (file)
@@ -54,6 +54,11 @@ class AliTRDcalibDB : public TObject {
         AliTRDCalROC                 *GetPRFROC(Int_t det);
   Float_t                             GetPRFWidth(Int_t det, Int_t col, Int_t row);
 
+  Float_t*                            GetSampledPRF() { return fPRFsmp; };
+  Int_t                               GetPRFbin()     { return fPRFbin; };
+  Float_t                             GetPRFlo()      { return fPRFlo;  };
+  Float_t                             GetPRFhi()      { return fPRFhi;  };
+
   Int_t                               GetNumberOfTimeBins();
 
   Char_t                              GetPadStatus(Int_t det, Int_t col, Int_t row);
@@ -64,6 +69,7 @@ class AliTRDcalibDB : public TObject {
   Bool_t                              IsPadMasked(Int_t det, Int_t col, Int_t row);
   Bool_t                              IsPadBridgedLeft(Int_t det, Int_t col, Int_t row);
   Bool_t                              IsPadBridgedRight(Int_t det, Int_t col, Int_t row);
+  Bool_t                              IsPadNotConnected(Int_t det, Int_t col, Int_t row);
   
   Bool_t                              IsChamberInstalled(Int_t det);
   Bool_t                              IsChamberMasked(Int_t det);
index c332b6500024a35e4e9f08979253dadaad3e2cb9..15b379718a2022f6c21f0fb16bfe451c2c7cbecb 100644 (file)
@@ -579,6 +579,23 @@ Bool_t AliTRDclusterizer::Raw2ClustersChamber(AliRawReader *rawReader)
 
 }
 
+//_____________________________________________________________________________
+UChar_t AliTRDclusterizer::GetStatus(Short_t &signal)
+{
+       UChar_t status = 0;
+       // check if pad is masked
+       if(signal>0 && TESTBIT(signal, 10)){
+               CLRBIT(signal, 10);
+               for(int ibit=0; ibit<4; ibit++){
+                       if(TESTBIT(signal, 11+ibit)){
+                               SETBIT(status, ibit);
+                               CLRBIT(signal, 11+ibit);
+                       } 
+               }
+       }
+       return status;
+}
+
 //_____________________________________________________________________________
 Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
 {
@@ -659,6 +676,7 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
   UShort_t volid   = AliGeomManager::LayerToVolUID(ilayer,imodule); 
 
   Int_t nColMax    = digitsIn->GetNcol();
+  Int_t nRowMax    = digitsIn->GetNrow();
   Int_t nTimeTotal = digitsIn->GetNtime();
 
   // Detector wise calibration object for the gain factors
@@ -668,14 +686,10 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
   // Calibration value for chamber wise gain factor
   Float_t                       calGainFactorDetValue = calGainFactorDet->GetValue(idet);
 
-  // Calibration object with the pad status information
-  AliTRDCalSingleChamberStatus *calPadStatusROC       = calibration->GetPadStatusROC(idet);
-
   Int_t nClusters = 0;
 
-  AliTRDdataArrayF *digitsOut = new AliTRDdataArrayF(digitsIn->GetNrow()
-                                                    ,digitsIn->GetNcol()
-                                                   ,digitsIn->GetNtime()); 
+  AliTRDdataArrayF *digitsOut = new AliTRDdataArrayF(nRowMax, nColMax, nTimeTotal);
+  AliTRDdataArrayS padStatus(nRowMax, nColMax, nTimeTotal); 
 
   ResetHelperIndexes(indexesIn);
 
@@ -694,37 +708,65 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
   Int_t time = 0;
   Int_t iPad = 0;
     
+       UChar_t status[3], ipos;
+       Short_t signal;
   fIndexesOut->ResetCounters();
-  while (fIndexesOut->NextRCTbinIndex(row, col, time))
-    {
-
-      Float_t signalM = TMath::Abs(digitsOut->GetDataUnchecked(row,col,time));
-           
-      // 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));
-         Float_t signalR = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time));
-
-         if ((TMath::Abs(signalL) <= signalM) && 
-             (TMath::Abs(signalR) <  signalM)) 
-           {
-             if ((TMath::Abs(signalL) >= sigThresh) ||
-                 (TMath::Abs(signalR) >= sigThresh)) 
-               {
-                 // Maximum found, mark the position by a negative signal
-                 digitsOut->SetDataUnchecked(row,col,time,-signalM);
-                 fIndexesMaxima->AddIndexTBin(row,col,time);
+  while (fIndexesOut->NextRCTbinIndex(row, col, time)){
+               Float_t signalM = TMath::Abs(digitsOut->GetDataUnchecked(row,col,time));
+               signal = digitsIn->GetDataUnchecked(row,col,time);
+               status[1] = GetStatus(signal);
+               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] = GetStatus(signal);
+                       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] = GetStatus(signal);
+                       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;
@@ -854,7 +896,6 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
          // 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 };
-          Bool_t  hasMasked  = kFALSE;
          for (Int_t jPad = col-3; jPad <= col+3; jPad++) 
             {
              if ((jPad <          0) || 
@@ -863,25 +904,22 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
                  continue;
                }
              signals[jPad-col+3] = TMath::Nint(TMath::Abs(digitsOut->GetDataUnchecked(row,jPad,time)));
-              if (calPadStatusROC->IsMasked(jPad,row)) {
-                hasMasked = kTRUE;
-             }
            }
 
           // 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;
+               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)) {
@@ -911,8 +949,12 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
                                                      ,clusterPosCol
                                                      ,volid);
            cluster->SetInChamber(!out);
-           cluster->SetMaskedPad(hasMasked);
-       
+           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);
index 280f515ffeecbedd6b9d06b4d88d31d1840bb936..27f58b4d1c70b12456f96f1053c8ef9d89dcebdc 100644 (file)
@@ -65,6 +65,8 @@ class AliTRDclusterizer : public TNamed {
                                                return fAddLabels;  } // should we assign labels to clusters
   virtual void     SetRawVersion(Int_t iver) { fRawVersion = iver; } // set the expected raw data version
 
+       static UChar_t GetStatus(Short_t &signal);
+
  protected:
 
           void     DeConvExp(Double_t *source, Double_t *target
index 37d5cd0cb521ca34e335aedfbd5e7b8d9bf23574..b46a8688633d1cd9adf3b39f6eaae69f656da6b2 100644 (file)
@@ -1,4 +1,4 @@
-/**************************************************************************
+#/**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
  * Author: The ALICE Off-line Project.                                    *
@@ -41,6 +41,8 @@
 #include "AliTRDSignalIndex.h"
 #include "AliTRDReconstructor.h"
 #include "AliTRDrecoParam.h"
+#include "AliTRDcalibDB.h"
+#include "Cal/AliTRDCalPadStatus.h"
 
 #include "AliLog.h"
 #include "AliRawReader.h"
@@ -653,6 +655,7 @@ AliTRDrawStreamTB::NextChamber(AliTRDdigitsManager *digitsManager)
   // Return value is the detector number
   //
 
+  AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
   AliTRDdataArrayS *digits = 0;
   AliTRDdataArrayI *track0 = 0;
   AliTRDdataArrayI *track1 = 0;
@@ -707,6 +710,7 @@ AliTRDrawStreamTB::NextChamber(AliTRDdigitsManager *digitsManager)
 
          // Add a container for the digits of this detector
          digits = (AliTRDdataArrayS *) digitsManager->GetDigits(det);
+
           if (digitsManager->UsesDictionaries()) 
             {
              track0 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,0);
@@ -752,13 +756,49 @@ AliTRDrawStreamTB::NextChamber(AliTRDdigitsManager *digitsManager)
          if (indexes->IsAllocated() == kFALSE)
            indexes->Allocate(rowMax, colMax, ntbins);
        }
-    
+
+      Char_t padStatus =  cal->GetPadStatus(det, GetCol(), GetRow());
+  
       // ntimebins data are ready to read
       for (it = 0; it < GetNumberOfTimeBins(); it++)
        {
          if ((GetSignals()[it] - adcBaseline) > 0)
            {
-             digits->SetDataUnchecked(GetRow(), GetCol(), it, GetSignals()[it] - adcBaseline);
+             Short_t sigvalue = GetSignals()[it] - adcBaseline;
+             // Masking Pads in the signal
+             // Coding:
+             // Any Corruption: Bit 10 set 1
+             // Noisy: Bit 11: 0, Bit 12: 0
+             // Not Connected: Bit 11: 1, Bit 12: 0
+             // Bridged: Bit 11: 0, Bit 12: 1 resp. Bit 11: 1, Bit 12: 1
+             switch(padStatus)
+               {
+               case AliTRDCalPadStatus::kMasked:
+                 SETBIT(sigvalue, 10);
+                 CLRBIT(sigvalue, 11);
+                 CLRBIT(sigvalue, 12);
+                 break;
+               case AliTRDCalPadStatus::kNotConnected:
+                 SETBIT(sigvalue, 10);
+                 SETBIT(sigvalue, 11);
+                 CLRBIT(sigvalue, 12);
+                 break;
+               case AliTRDCalPadStatus::kPadBridgedLeft:
+                 SETBIT(sigvalue, 10);
+                 CLRBIT(sigvalue, 11);
+                 SETBIT(sigvalue, 12);
+                 break;
+               case AliTRDCalPadStatus::kPadBridgedRight:
+                 SETBIT(sigvalue, 10);
+                 SETBIT(sigvalue, 11);
+                 SETBIT(sigvalue, 12);
+               default:
+                 // No corruption
+                 CLRBIT(sigvalue, 10);
+                 CLRBIT(sigvalue, 11);
+                 CLRBIT(sigvalue, 12);
+               }
+             digits->SetDataUnchecked(GetRow(), GetCol(), it, sigvalue);
              
              indexes->AddIndexTBin(GetRow(), GetCol(), it);
               if (digitsManager->UsesDictionaries()) 
index 83b15756f80b84a19c252942a3d321eee4ec0180..c34fc8c19ab146f44e22b6f0c66b7951b052f341 100644 (file)
 #include "TNamed.h"
 
 class AliTRDCalSingleChamberStatus;
+class TH1F;
+class TH2F;
 
 class AliTRDCalPadStatus : public TNamed {
 
  public:
  
   enum { kNplan = 6, kNcham = 5, kNsect = 18, kNdet = 540 };
-  enum { kMasked = 2, kPadBridgedLeft = 4, kPadBridgedRight = 8, kReadSecond = 16 };
+  enum { kMasked = 2, kPadBridgedLeft = 4, kPadBridgedRight = 8, kReadSecond = 16 , kNotConnected = 32};
 
   AliTRDCalPadStatus();
   AliTRDCalPadStatus(const Text_t* name, const Text_t* title);
@@ -38,6 +40,8 @@ class AliTRDCalPadStatus : public TNamed {
                                                { return CheckStatus(d, col, row, kPadBridgedRight); };
          Bool_t      IsReadSecond(Int_t d, Int_t col, Int_t row) const 
                                               { return CheckStatus(d, col, row, kReadSecond); };
+         Bool_t      IsNotConnected(Int_t d, Int_t col, Int_t row) const
+                                              { return CheckStatus(d, col, row, kNotConnected); };
           Bool_t      CheckStatus(Int_t d, Int_t col, Int_t row, Int_t bitMask) const;
 
   AliTRDCalSingleChamberStatus *GetCalROC(Int_t d) const { return fROC[d]; };
index 79e985cbe961d5f5df8fca3c116c0b658f623094..4f3ff8c199958220e042ffea9376658aba99f040 100644 (file)
@@ -21,7 +21,9 @@ class AliTRDCalSingleChamberStatus : public TObject {
   enum { kMasked          = 2
        , kPadBridgedLeft  = 4
        , kPadBridgedRight = 8
-       , kReadSecond      = 16 };
+       , kReadSecond      = 16 
+       , kNotConnected    = 32
+};
 
   AliTRDCalSingleChamberStatus();
   AliTRDCalSingleChamberStatus(Int_t p, Int_t c, Int_t cols);
@@ -34,7 +36,9 @@ class AliTRDCalSingleChamberStatus : public TObject {
           Bool_t  IsMasked(Int_t col, Int_t row) const       { return ((GetStatus(col,row) & kMasked) 
                                                                        ? kTRUE 
                                                                        : kFALSE);                 };
-
+         Bool_t  IsBridgedLeft(Int_t col, Int_t row) const  { return ((GetStatus(col, row) & kPadBridgedLeft)                                            ? kTRUE                                                                         : kFALSE);                 };
+         Bool_t  IsBridgedRight(Int_t col, Int_t row) const { return ((GetStatus(col, row) & kPadBridgedRight)                                           ? kTRUE                                                                         : kFALSE);                 };
+         Bool_t  IsNotConnected(Int_t col, Int_t row) const { return ((GetStatus(col, row) & kNotConnected)                                           ? kTRUE                                                                         : kFALSE);                 };
           Int_t   GetNrows() const                           { return fNrows;                     };
           Int_t   GetNcols() const                           { return fNcols;                     };