Updated version of the clusteization (Jan-Fiete)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 31 Mar 2006 16:56:03 +0000 (16:56 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 31 Mar 2006 16:56:03 +0000 (16:56 +0000)
TRD/AliTRDRecParam.cxx
TRD/AliTRDRecParam.h
TRD/AliTRDclusterizerV1.cxx
TRD/AliTRDclusterizerV1.h
TRD/AliTRDdigitizer.cxx

index 70102f1..d766253 100644 (file)
@@ -155,8 +155,8 @@ void AliTRDRecParam::Init()
   //
   
   // The default parameter for the clustering
-  fClusMaxThresh = 3;
-  fClusSigThresh = 1;
+  fClusMaxThresh = 3.5;
+  fClusSigThresh = 1.5;
 
   // Use the LUT
   fLUTOn         = kTRUE;
@@ -166,7 +166,7 @@ void AliTRDRecParam::Init()
 
   // The tail cancelation
   fTCOn           = kTRUE;
-  
+
   // The number of exponentials
   fTCnexp         = 1;
 
index c2d3a74..24831ce 100644 (file)
@@ -26,15 +26,15 @@ class AliTRDRecParam : public TObject
     virtual void Copy(TObject &p) const;
   
     virtual void     SetLUT(Int_t lutOn = 1)                        { fLUTOn          = lutOn;    };
-    virtual void     SetClusMaxThresh(Int_t thresh)                 { fClusMaxThresh  = thresh;   };
-    virtual void     SetClusSigThresh(Int_t thresh)                 { fClusSigThresh  = thresh;   };
+    virtual void     SetClusMaxThresh(Float_t thresh)                 { fClusMaxThresh  = thresh;   };
+    virtual void     SetClusSigThresh(Float_t thresh)                 { fClusSigThresh  = thresh;   };
     
             void SetTailCancelation(Int_t tcOn = 1)                 { fTCOn           = tcOn;     };
             void SetNexponential(Int_t nexp)                        { fTCnexp         = nexp;     };
   
     Bool_t   LUTOn()                                          const { return fLUTOn;         };
-    virtual Int_t    GetClusMaxThresh()                       const { return fClusMaxThresh; };
-    virtual Int_t    GetClusSigThresh()                       const { return fClusSigThresh; };
+    virtual Float_t    GetClusMaxThresh()                       const { return fClusMaxThresh; };
+    virtual Float_t    GetClusSigThresh()                       const { return fClusSigThresh; };
     
     virtual Double_t  LUTposition(Int_t iplane, Double_t ampL, Double_t ampC, Double_t ampR) const;
   
@@ -48,8 +48,8 @@ class AliTRDRecParam : public TObject
     void Init();
   
     // Clusterization parameter
-    Int_t                fClusMaxThresh;                      //  Threshold value for cluster maximum
-    Int_t                fClusSigThresh;                      //  Threshold value for cluster signal
+    Float_t              fClusMaxThresh;                      //  Threshold value for cluster maximum
+    Float_t              fClusSigThresh;                      //  Threshold value for cluster signal
     
     Int_t                fLUTOn;                              //  Switch for the lookup table method
     Int_t                fLUTbin;                             //  Number of bins of the LUT
@@ -64,7 +64,7 @@ class AliTRDRecParam : public TObject
     AliTRDRecParam();
     ~AliTRDRecParam();
   
-    ClassDef(AliTRDRecParam, 0)
+    ClassDef(AliTRDRecParam, 1)
 };
 
 #endif
index 97ab758..b1d7f4b 100644 (file)
@@ -220,15 +220,14 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
   } 
 
   AliTRDdataArrayI *digitsIn;
-  AliTRDdataArrayI *digitsOut;    // Should actually be Float_t here (C.L.)!!
   AliTRDdataArrayI *track0;
   AliTRDdataArrayI *track1;
   AliTRDdataArrayI *track2; 
 
   // Threshold value for the maximum
-  Int_t maxThresh = recParam->GetClusMaxThresh();   
+  Float_t maxThresh = recParam->GetClusMaxThresh();
   // Threshold value for the digit signal
-  Int_t sigThresh = recParam->GetClusSigThresh();   
+  Float_t sigThresh = recParam->GetClusSigThresh();
   // Iteration limit for unfolding procedure
   const Float_t kEpsilon = 0.01;             
 
@@ -245,8 +244,7 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
   Double_t padSignal[kNsig];   
   Double_t clusterSignal[kNclus];
   Double_t clusterPads[kNclus];   
-  Int_t    clusterDigit[kNclus];
-  Int_t    clusterTracks[kNtrack];   
+  Int_t    clusterTracks[kNtrack];
 
   Int_t    chamBeg = 0;
   Int_t    chamEnd = AliTRDgeometry::Ncham();
@@ -288,13 +286,11 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
         AliTRDpadPlane *padPlane = commonParam->GetPadPlane(iplan,icham);
 
         // Get the digits
-        digitsIn = digitsOut = fDigitsManager->GetDigits(idet);
+        digitsIn = fDigitsManager->GetDigits(idet);
         digitsIn->Expand();
-        digitsOut->Expand();
+        AliTRDdataArrayF *digitsOut = new AliTRDdataArrayF(digitsIn->GetNrow(), digitsIn->GetNcol(), digitsIn->GetNtime());
 
-       if (recParam->TCOn()) {            // tail cancellation
-         Transform(digitsIn, digitsOut, idet, nRowMax, nColMax, nTimeTotal, ADCthreshold);
-       }
+        Transform(digitsIn, digitsOut, idet, nRowMax, nColMax, nTimeTotal, ADCthreshold);
 
         track0 = fDigitsManager->GetDictionary(idet,0);
         track0->Expand();
@@ -309,11 +305,11 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
             //for ( col = 4;  col <  nColMax-2;    col++) {
             for (time = 0; time < nTimeTotal; time++) {
 
-              Int_t signalL = TMath::Abs(digitsOut->GetDataUnchecked(row,col  ,time));
-              Int_t signalM = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time));
-              Int_t signalR = TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time));
+              Float_t signalL = TMath::Abs(digitsOut->GetDataUnchecked(row,col  ,time));
+              Float_t signalM = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time));
+              Float_t signalR = TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time));
  
-//           // Look for the maximum
+//           // Lonok for the maximum
 //               if (signalM >= maxThresh) {
 //                 if (((signalL >= sigThresh) &&
 //                      (signalL <  signalM))  ||
@@ -349,7 +345,6 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
                   clusterSignal[iPad]     = TMath::Abs(digitsOut->GetDataUnchecked(row
                                                                                ,iPadCol
                                                                                ,time));
-                  clusterDigit[iPad]      = digitsOut->GetIndexUnchecked(row,iPadCol,time);
                   clusterTracks[3*iPad  ] = track0->GetDataUnchecked(row,iPadCol,time) - 1;
                  clusterTracks[3*iPad+1] = track1->GetDataUnchecked(row,iPadCol,time) - 1;
                  clusterTracks[3*iPad+2] = track2->GetDataUnchecked(row,iPadCol,time) - 1;
@@ -510,16 +505,17 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
                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::Abs(digitsOut->GetDataUnchecked(row,jPad,time));
+                 signals[jPad-col+3] = TMath::Nint(TMath::Abs(digitsOut->GetDataUnchecked(row,jPad,time)));
                }
                cluster->SetSignals(signals);
               }
             } 
           }   
-        }     
+        }
+
+        delete digitsOut;
 
-       // Compress the arrays
-        digitsOut->Compress(1,0);
+        // Compress the arrays
         track0->Compress(1,0);
        track1->Compress(1,0);
         track2->Compress(1,0);
@@ -615,7 +611,7 @@ Double_t AliTRDclusterizerV1::Unfold(Double_t eps, Int_t plane, Double_t* padSig
 
 //_____________________________________________________________________________
 void AliTRDclusterizerV1::Transform(AliTRDdataArrayI* digitsIn,
-                                   AliTRDdataArrayI* digitsOut,
+                                   AliTRDdataArrayF* digitsOut,
                                    Int_t idet, Int_t nRowMax,
                                    Int_t nColMax, Int_t nTimeTotal,
                                    Float_t ADCthreshold)
@@ -635,7 +631,7 @@ void AliTRDclusterizerV1::Transform(AliTRDdataArrayI* digitsIn,
     return;
   }
   AliTRDcalibDB* calibration = AliTRDcalibDB::Instance();
-  
+
   Double_t *inADC  = new Double_t[nTimeTotal];  // adc data before tail cancellation
   Double_t *outADC = new Double_t[nTimeTotal];  // adc data after tail cancellation
 
@@ -656,9 +652,9 @@ void AliTRDclusterizerV1::Transform(AliTRDdataArrayI* digitsIn,
          AliError("Not a valid gain\n");
        }
        inADC[iTime]  = digitsIn->GetDataUnchecked(iRow, iCol, iTime);
-       inADC[iTime]  /= gain; 
-       outADC[iTime] = inADC[iTime];
 
+        inADC[iTime] /= gain;
+        outADC[iTime] = inADC[iTime];
       }
 
       // Apply the tail cancelation via the digital filter
@@ -667,7 +663,7 @@ void AliTRDclusterizerV1::Transform(AliTRDdataArrayI* digitsIn,
        DeConvExp(inADC,outADC,nTimeTotal,recParam->GetTCnexp());
       }
 
-      for (Int_t iTime = 0; iTime < nTimeTotal; iTime++) {   
+      for (Int_t iTime = 0; iTime < nTimeTotal; iTime++) {
        // Store the amplitude of the digit if above threshold
        if (outADC[iTime] > ADCthreshold) {
          if (fVerbose > 1)
@@ -675,7 +671,7 @@ void AliTRDclusterizerV1::Transform(AliTRDdataArrayI* digitsIn,
            printf("  iRow = %d, iCol = %d, iTime = %d, adc = %f\n"
                   ,iRow,iCol,iTime,outADC[iTime]);
          }
-         digitsOut->SetDataUnchecked(iRow,iCol,iTime,(Int_t)outADC[iTime]);
+         digitsOut->SetDataUnchecked(iRow,iCol,iTime,outADC[iTime]);
        }
 
       }
index db1e2bc..c2b5de0 100644 (file)
@@ -12,6 +12,7 @@
 ///////////////////////////////////////////////////////
 
 class AliTRDdataArrayI;
+class AliTRDdataArrayF;
 class AliTRDdigitsManager;
 class AliRawReader;
 
@@ -36,7 +37,7 @@ class AliTRDclusterizerV1 : public AliTRDclusterizer {
 
  private:
   void DeConvExp(Double_t *source, Double_t *target, Int_t nTimeTotal, Int_t nexp);
-  void Transform(AliTRDdataArrayI* digitsIn, AliTRDdataArrayI* digitsOut,
+  void Transform(AliTRDdataArrayI* digitsIn, AliTRDdataArrayF* digitsOut,
                 Int_t idet, Int_t nRowMax, Int_t nColMax, Int_t nTimeTotal, Float_t ADCthreshold);
   virtual Double_t Unfold(Double_t eps, Int_t plane, Double_t *padSignal);
   Double_t GetCOG(Double_t signal[5]);      // get COG position
index 5d02358..bdd6933 100644 (file)
@@ -1145,18 +1145,21 @@ Bool_t AliTRDdigitizer::MakeDigits()
 
             for (iTime = 0; iTime < nTimeTotal; iTime++) {         
               Float_t signalAmp = signals->GetDataUnchecked(iRow,iCol,iTime);
+
               // Pad and time coupling
               signalAmp *= coupling;
-             Float_t padgain = calibration->GetGainFactor(iDet, iCol, iRow);
+
+              Float_t padgain = calibration->GetGainFactor(iDet, iCol, iRow);
               if (padgain<=0) {
                 TString error;
                 error.Form("Not a valid gain %f, %d %d %d\n", padgain, iDet, iCol, iRow);
                 AliError(error);
               }
              signalAmp *= padgain;
+
               // Add the noise, starting from minus ADC baseline in electrons
               Double_t baselineEl = simParam->GetADCbaseline() * (simParam->GetADCinRange()
-                                                           / simParam->GetADCoutRange()) 
+                                                           / simParam->GetADCoutRange())
                                                            / convert;
               signalAmp  = TMath::Max((Double_t) gRandom->Gaus(signalAmp,simParam->GetNoise())
                                      ,-baselineEl);
@@ -1165,16 +1168,17 @@ Bool_t AliTRDdigitizer::MakeDigits()
               // Add ADC baseline in mV
               signalAmp += simParam->GetADCbaseline() * (simParam->GetADCinRange()
                                                    / simParam->GetADCoutRange());
-             // Convert to ADC counts. Set the overflow-bit fADCoutRange if the 
+             // Convert to ADC counts. Set the overflow-bit fADCoutRange if the
              // signal is larger than fADCinRange
               Int_t adc  = 0;
               if (signalAmp >= simParam->GetADCinRange()) {
                 adc = ((Int_t) simParam->GetADCoutRange());
              }
               else {
-                adc = ((Int_t) (signalAmp * (simParam->GetADCoutRange() 
-                                           / simParam->GetADCinRange())));
+                adc = TMath::Nint(signalAmp * (simParam->GetADCoutRange()
+                                           / simParam->GetADCinRange()));
              }
+
               inADC[iTime]  = adc;
               outADC[iTime] = adc;
            }
@@ -1358,7 +1362,7 @@ Bool_t AliTRDdigitizer::ConvertSDigits()
     for (iRow  = 0; iRow  <  nRowMax;   iRow++ ) {
       for (iCol  = 0; iCol  <  nColMax;   iCol++ ) {
 
-        for (iTime = 0; iTime < nTimeTotal; iTime++) {         
+        for (iTime = 0; iTime < nTimeTotal; iTime++) {
           Double_t signal = (Double_t) digitsIn->GetDataUnchecked(iRow,iCol,iTime);
           signal *= sDigitsScale;
           Float_t padgain = calibration->GetGainFactor(iDet, iCol, iRow);
@@ -1367,6 +1371,7 @@ Bool_t AliTRDdigitizer::ConvertSDigits()
                   error.Form("Not a valid gain %f, %d %d %d\n", padgain, iDet, iCol, iRow);
                   AliError(error);
           }
+
           signal *= padgain;
           // Pad and time coupling
           signal *= coupling;
@@ -1377,20 +1382,20 @@ Bool_t AliTRDdigitizer::ConvertSDigits()
           signal *= convert;
           // add ADC baseline in mV
           signal += adcBaseline * (adcInRange / adcOutRange);
-         // Convert to ADC counts. Set the overflow-bit adcOutRange if the 
+         // Convert to ADC counts. Set the overflow-bit adcOutRange if the
          // signal is larger than adcInRange
           Int_t adc  = 0;
           if (signal >= adcInRange) {
             adc = ((Int_t) adcOutRange);
          }
           else {
-            adc = ((Int_t) (signal * (adcOutRange / adcInRange)));
+            adc = TMath::Nint(signal * (adcOutRange / adcInRange));
          }
           inADC[iTime]  = adc;
           outADC[iTime] = adc;
        }
 
-        for (iTime = 0; iTime < nTimeTotal; iTime++) {   
+        for (iTime = 0; iTime < nTimeTotal; iTime++) {
           // Store the amplitude of the digit if above threshold
           if (outADC[iTime] > adcThreshold) {
             digitsOut->SetDataUnchecked(iRow,iCol,iTime,((Int_t) outADC[iTime]));