Use noise information in cluster finder
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Jun 2008 18:04:24 +0000 (18:04 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Jun 2008 18:04:24 +0000 (18:04 +0000)
TRD/AliTRDcalibDB.cxx
TRD/AliTRDcalibDB.h
TRD/AliTRDclusterizer.cxx
TRD/AliTRDrecoParam.cxx
TRD/AliTRDrecoParam.h

index 3772b0c..3e710ec 100644 (file)
@@ -223,6 +223,13 @@ const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id)
     case kIDGainFactorChamber : 
       return CacheCDBEntry(kIDGainFactorChamber ,"TRD/Calib/ChamberGainFactor"); 
       break;
+    case kIDNoiseChamber : 
+      return CacheCDBEntry(kIDNoiseChamber ,"TRD/Calib/DetNoise"); 
+      break;
+    case kIDNoisePad : 
+      return CacheCDBEntry(kIDNoisePad ,"TRD/Calib/PadNoise"); 
+      break;
+
 
     // Parameters defined per pad
     case kIDPRFWidth : 
@@ -331,6 +338,76 @@ void AliTRDcalibDB::Invalidate()
   }
 
 }
+//_____________________________________________________________________________
+Float_t AliTRDcalibDB::GetNoise(Int_t det, Int_t col, Int_t row)
+{
+  //
+  // Returns the noise level in ADC counts for the given pad.
+  //
+
+  const AliTRDCalPad *calPad     = dynamic_cast<const AliTRDCalPad *> 
+                                   (GetCachedCDBObject(kIDNoisePad));
+  if (!calPad) {
+    return -1;
+  }
+
+  AliTRDCalROC       *roc        = calPad->GetCalROC(det);
+  if (!roc) {
+    return -1;
+  }
+
+  const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> 
+                                   (GetCachedCDBObject(kIDNoiseChamber));
+  if (!calChamber) {
+    return -1;
+  }
+
+  return calChamber->GetValue(det) * roc->GetValue(col,row);
+
+}
+//_____________________________________________________________________________
+AliTRDCalROC *AliTRDcalibDB::GetNoiseROC(Int_t det)
+{
+  //
+  // Returns the Vdrift calibration object for a given ROC
+  // containing one number per pad 
+  //
+  
+  const AliTRDCalPad     *calPad     = dynamic_cast<const AliTRDCalPad *> 
+                                       (GetCachedCDBObject(kIDNoisePad));
+  if (!calPad) {
+    return 0;
+  }
+
+  AliTRDCalROC           *roc        = calPad->GetCalROC(det);
+  if (!roc) {
+    return 0;
+  }
+  else {
+    return roc;
+  }
+
+}
+
+//_____________________________________________________________________________
+const AliTRDCalDet *AliTRDcalibDB::GetNoiseDet()
+{
+  //
+  // Returns the Vdrift calibration object
+  // containing one number per detector
+  //
+  
+  const AliTRDCalDet     *calChamber = dynamic_cast<const AliTRDCalDet *> 
+                                       (GetCachedCDBObject(kIDNoiseChamber));
+  if (!calChamber) {
+    return 0;
+  }
+  else {
+    return calChamber;
+  }
+
+}
 
 //_____________________________________________________________________________
 Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
index 7993d9b..0d22a03 100644 (file)
@@ -36,6 +36,10 @@ class AliTRDcalibDB : public TObject {
   void                                SetRun(Long64_t run);
   Long64_t                            GetRun() const { return fRun; }
 
+  Float_t                             GetNoise(Int_t det, Int_t col, Int_t row);
+        AliTRDCalROC                 *GetNoiseROC(Int_t det);
+  const AliTRDCalDet                 *GetNoiseDet();
+
   Float_t                             GetVdrift(Int_t det, Int_t col, Int_t row);
   Float_t                             GetVdriftAverage(Int_t det);
         AliTRDCalROC                 *GetVdriftROC(Int_t det);
@@ -85,13 +89,15 @@ class AliTRDcalibDB : public TObject {
  protected:
 
   // For caching see also implentation of GetCachedCDBObject in the .cxx file
-  enum { kCDBCacheSize = 16 };   // Number of cached objects
+  enum { kCDBCacheSize = 18 };   // Number of cached objects
   enum { kIDVdriftPad = 0
        , kIDVdriftChamber
        , kIDT0Pad
        , kIDT0Chamber
        , kIDGainFactorPad
        , kIDGainFactorChamber
+       , kIDNoiseChamber
+       , kIDNoisePad
        , kIDPRFWidth
        , kIDFEE
        , kIDChamberPos
index 3038650..5ba62ac 100644 (file)
@@ -645,6 +645,11 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
   // Threshold value for the digit signal
   Float_t sigThresh      = AliTRDReconstructor::RecoParam()->GetClusSigThresh();
 
+  // Threshold value for the maximum ( cut noise)
+  Float_t minMaxCutSigma = AliTRDReconstructor::RecoParam()->GetMinMaxCutSigma();
+  // Threshold value for the sum pad ( cut noise)
+  Float_t minLeftRightCutSigma = AliTRDReconstructor::RecoParam()->GetMinLeftRightCutSigma();
+
   // Iteration limit for unfolding procedure
   const Float_t kEpsilon = 0.01;             
   const Int_t   kNclus   = 3;  
@@ -688,6 +693,14 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
   // Calibration value for chamber wise gain factor
   Float_t                       calGainFactorDetValue = calGainFactorDet->GetValue(idet);
 
+
+  // Detector wise calibration object for the noise
+  const AliTRDCalDet           *calNoiseDet           = calibration->GetNoiseDet();
+  // Calibration object with pad wise values for the noise
+  AliTRDCalROC                 *calNoiseROC           = calibration->GetNoiseROC(idet);
+  // Calibration value for chamber wise noise
+  Float_t                       calNoiseDetValue      = calNoiseDet->GetValue(idet);
+
   Int_t nClusters = 0;
 
   AliTRDdataArrayF *digitsOut = new AliTRDdataArrayF(nRowMax, nColMax, nTimeTotal);
@@ -717,57 +730,62 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
     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;
+    if(signalM < maxThresh) continue; 
+
+    Float_t  noiseMiddleThresh = minMaxCutSigma*calNoiseDetValue*calNoiseROC->GetValue(col,row);
+    if (signalM < noiseMiddleThresh) continue;
+
+    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 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);
+    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;
+    // 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.);
+    if(!status[1]){ // good central pad
+      if(!ipos){ // all pads are OK
+       if ((signalL <= signalM) && (signalR <  signalM)) {
+         if ((signalL >= sigThresh) || (signalR >= sigThresh)) {
+           Float_t  noiseSumThresh    = minLeftRightCutSigma*calNoiseDetValue*calNoiseROC->GetValue(col,row);
+           if((signalL+signalR+signalM) >= noiseSumThresh){
+             // 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);
-          }
-        }
+       }
+      }
+    } 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;
+  Int_t firstClusterROC = -1;
     // The number of cluster in a given ROC
     Int_t nClusterROC     =  0;
 
index d24992e..e286eaf 100644 (file)
@@ -51,6 +51,8 @@ AliTRDrecoParam::AliTRDrecoParam()
   ,fkStreamLevel(0)
   ,fSeedingOn(kFALSE)
   ,fVertexConstrained(kTRUE)
+  ,fMinMaxCutSigma(4.)
+  ,fMinLeftRightCutSigma(8.)
   ,fClusMaxThresh(4.5)
   ,fClusSigThresh(3.5)
   ,fLUTOn(kTRUE)
index 69d1575..a9bf493 100644 (file)
@@ -51,7 +51,9 @@ class AliTRDrecoParam : public AliDetectorRecoParam
        Bool_t SeedingOn() const { return fSeedingOn; }
        Bool_t IsVertexConstrained() const { return fVertexConstrained; }
        
-        Double_t GetClusMaxThresh() const         { return fClusMaxThresh;   };
+       Double_t GetMinMaxCutSigma() const        { return fMinMaxCutSigma;     };
+       Double_t GetMinLeftRightCutSigma() const  { return fMinLeftRightCutSigma;  };
+       Double_t GetClusMaxThresh() const         { return fClusMaxThresh;   };
         Double_t GetClusSigThresh() const         { return fClusSigThresh;   };
         Int_t    GetTCnexp() const                { return fTCnexp;          };
         Bool_t   LUTOn() const                    { return fLUTOn;           };
@@ -63,17 +65,19 @@ class AliTRDrecoParam : public AliDetectorRecoParam
         static   AliTRDrecoParam *GetHighFluxParam();
         static   AliTRDrecoParam *GetCosmicTestParam();
 
-       void     SetClusterSharing(Bool_t share = kTRUE) { fkClusterSharing = share;  };
-       void     SetPIDMethod(Int_t pid = 1)             { fkPIDMethod = pid ? 1 : 0; };
-       void     SetSeedingOn(Bool_t seedingOn = kTRUE)  { fSeedingOn = seedingOn; }
+       void     SetClusterSharing(Bool_t share = kTRUE)            { fkClusterSharing = share;  };
+       void     SetPIDMethod(Int_t pid = 1)                        { fkPIDMethod = pid ? 1 : 0; };
+       void     SetSeedingOn(Bool_t seedingOn = kTRUE)             { fSeedingOn = seedingOn; }
        void     SetVertexConstrained(Bool_t vertexConstrained = kTRUE) { fVertexConstrained = vertexConstrained; }
-       void     SetStreamLevel(Int_t streamLevel= 1) { fkStreamLevel = streamLevel; }
-        void     SetLUT(Int_t lutOn = 1)                 { fLUTOn           = lutOn;  };
-        void     SetClusMaxThresh(Float_t thresh)        { fClusMaxThresh   = thresh; };
-        void     SetClusSigThresh(Float_t thresh)        { fClusSigThresh   = thresh; };
-        void     SetTailCancelation(Int_t tcOn = 1)      { fTCOn            = tcOn;   };
-        void     SetNexponential(Int_t nexp)             { fTCnexp          = nexp;   };
-        void     SetADCbaseline(Int_t base)              { fADCbaseline     = base;   };
+       void     SetStreamLevel(Int_t streamLevel= 1)               { fkStreamLevel = streamLevel; }
+        void     SetLUT(Int_t lutOn = 1)                            { fLUTOn           = lutOn;  };
+       void     SetMinMaxCutSigma(Float_t minMaxCutSigma)          { fMinMaxCutSigma   = minMaxCutSigma; };
+       void     SetMinLeftRightCutSigma(Float_t minLeftRightCutSigma) { fMinLeftRightCutSigma   = minLeftRightCutSigma; };
+        void     SetClusMaxThresh(Float_t thresh)                   { fClusMaxThresh   = thresh; };
+        void     SetClusSigThresh(Float_t thresh)                   { fClusSigThresh   = thresh; };
+        void     SetTailCancelation(Int_t tcOn = 1)                 { fTCOn            = tcOn;   };
+        void     SetNexponential(Int_t nexp)                        { fTCnexp          = nexp;   };
+        void     SetADCbaseline(Int_t base)                         { fADCbaseline     = base;   };
 
  private:
 
@@ -103,6 +107,8 @@ class AliTRDrecoParam : public AliDetectorRecoParam
        Bool_t    fVertexConstrained;      // Perform vertex constrained fit
 
         // Clusterization parameter
+       Double_t  fMinMaxCutSigma;         // Threshold sigma noise pad middle
+       Double_t  fMinLeftRightCutSigma;   // Threshold sigma noise sum pad
         Double_t  fClusMaxThresh;          // Threshold value for cluster maximum
         Double_t  fClusSigThresh;          // Threshold value for cluster signal
         Int_t     fLUTOn;                  // Switch for the lookup table method