]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Faster version of baseline correction by Theodor with additional protection against...
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Sep 2009 09:59:22 +0000 (09:59 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Sep 2009 09:59:22 +0000 (09:59 +0000)
TRD/AliTRDarrayADC.cxx
TRD/AliTRDarrayADC.h
TRD/AliTRDclusterizer.cxx
TRD/AliTRDrawFastStream.cxx
TRD/AliTRDrawStream.cxx
TRD/AliTRDrecoParam.h

index 3208f250b27d6c5af68686de9e4f563f832bf3fe..e65987809061f71d9e1e2a3ab003017e731a9e0c 100644 (file)
@@ -41,6 +41,7 @@ AliTRDarrayADC::AliTRDarrayADC()
               ,fNumberOfChannels(0)
                ,fNtime(0) 
                ,fNAdim(0)
+              ,fBaseline(0)
                ,fADC(0)
 {
   //
@@ -60,6 +61,7 @@ AliTRDarrayADC::AliTRDarrayADC(Int_t nrow, Int_t ncol, Int_t ntime)
               ,fNumberOfChannels(0)
                ,fNtime(0) 
                ,fNAdim(0)
+              ,fBaseline(0)
                ,fADC(0)
 {
   //
@@ -80,6 +82,7 @@ AliTRDarrayADC::AliTRDarrayADC(const AliTRDarrayADC &b)
               ,fNumberOfChannels(b.fNumberOfChannels)
                ,fNtime(b.fNtime) 
                ,fNAdim(b.fNAdim)
+              ,fBaseline(b.fBaseline)
                ,fADC(0)         
 {
   //
@@ -594,7 +597,8 @@ void AliTRDarrayADC::SetData(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value)
 
   Int_t colnumb = fgLutPadNumbering[ncol];
 
-  fADC[(nrow*fNumberOfChannels+colnumb)*fNtime+ntime]=value;
+  fADC[(nrow*fNumberOfChannels+colnumb)*fNtime+ntime] = TMath::Max(value-fBaseline
+                                                                 ,0);
 
 }
 
@@ -622,23 +626,3 @@ void AliTRDarrayADC::CreateLut()
        }
     }
 }
-//________________________________________________________________________________
-void AliTRDarrayADC::SubtractBaseline(Short_t baseline)
-{
-  //
-  // Subtracts the baseline to all the adc array
-  // if the value is equal or greater than baseline
-  //
-
-  Short_t value = 0, status = 0;
-  for(Int_t b=0; b<fNAdim; b++)
-    {
-      //if(fADC[b]>=baseline)
-      //{
-    value = fADC[b] & 0x03ff;
-    status = fADC[b] & 0xfc00;
-    value -= baseline;
-         fADC[b]= value | status;
-      //}
-    }
-}
index e7c6e7cbf9662d34de6c9f77931da2eb007ba3b5..33221d37bd20fc4a19d1c2c24cb526db1c95e7db 100644 (file)
@@ -1,74 +1,75 @@
-#ifndef ALITRDARRAYADC_H\r
-#define ALITRDARRAYADC_H\r
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * \r
- * See cxx source for full Copyright notice */ \r
-\r
-/* $Id: AliTRDarrayADC.h 23387 2008-01-17 17:25:16Z cblume $ */\r
-\r
-///////////////////////////////////////////////\r
-//                                           //\r
-// Container class for ADC values            //\r
-//                                           // \r
-///////////////////////////////////////////////\r
-\r
-#include <TObject.h>\r
-\r
-class AliTRDarrayADC: public TObject\r
-{\r
- public:\r
-\r
-  AliTRDarrayADC();\r
-  AliTRDarrayADC(Int_t nrow, Int_t ncol, Int_t ntime);\r
-  AliTRDarrayADC(const AliTRDarrayADC &b);\r
-  ~AliTRDarrayADC();\r
-  AliTRDarrayADC &operator=(const AliTRDarrayADC &b);\r
-\r
-  void    Allocate(Int_t nrow, Int_t ncol, Int_t ntime);\r
-  void    SetNdet(Int_t ndet) {fNdet=ndet;};  \r
-  Int_t   GetNdet()  const {return fNdet;};\r
-  void    SetDataByAdcCol(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value)\r
-                        {fADC[(nrow*fNumberOfChannels+ncol)*fNtime+ntime]=value;};\r
-  Bool_t  HasData() const {return fNtime ? 1 : 0;};\r
-  Short_t GetDataByAdcCol(Int_t nrow, Int_t ncol, Int_t ntime) const\r
-                         {return fADC[(nrow*fNumberOfChannels+ncol)*fNtime+ntime];};\r
-  inline  void GetData(Int_t r, Int_t c, Int_t t, Int_t n, Short_t *vals) const;\r
-  Short_t GetDataBits(Int_t nrow, Int_t ncol, Int_t ntime) const;\r
-  UChar_t GetPadStatus(Int_t nrow, Int_t ncol, Int_t ntime) const;\r
-  void    SetPadStatus(Int_t nrow, Int_t ncol, Int_t ntime, UChar_t status);\r
-  Bool_t  IsPadCorrupted(Int_t nrow, Int_t ncol, Int_t ntime);\r
-  void    Compress();\r
-  void    Expand();\r
-  Int_t   GetNtime() const {return fNtime;};\r
-  Int_t   GetNrow() const {return fNrow;};\r
-  Int_t   GetNcol() const {return fNcol;};\r
-  Int_t   GetDim() const {return fNAdim;};\r
-  void    DeleteNegatives();\r
-  void    Reset();\r
-  Short_t GetData(Int_t nrow, Int_t ncol, Int_t ntime) const;\r
-  void    SetData(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value);\r
-  static  void    CreateLut(); \r
-  void    SubtractBaseline(Short_t baseline);\r
-\r
- protected:\r
-\r
-  Int_t fNdet;    //ID number of the chamber\r
-  Int_t fNrow;    //Number of rows\r
-  Int_t fNcol;    //Number of columns(pads)\r
-  Int_t fNumberOfChannels;  //  Number of MCM channels per row\r
-  Int_t fNtime;   //Number of time bins\r
-  Int_t fNAdim;   //Dimension of the ADC array\r
-  Short_t* fADC;  //[fNAdim]   //Pointer to adc values\r
-  static Short_t *fgLutPadNumbering;   //  [fNcol] Look Up Table\r
-\r
-  ClassDef(AliTRDarrayADC,4) //ADC container class\r
-    \r
-};\r
-\r
-inline void AliTRDarrayADC::GetData(Int_t r, Int_t c, Int_t t, Int_t n, Short_t *vals) const\r
-{\r
-  Int_t colNum = fgLutPadNumbering[c];\r
-  for(Int_t ic=n, idx = (r*fNumberOfChannels+colNum)*fNtime+t; ic--; idx+=fNtime) vals[ic] = fADC[idx];\r
- }\r
-\r
-#endif \r
-\r
+#ifndef ALITRDARRAYADC_H
+#define ALITRDARRAYADC_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * 
+ * See cxx source for full Copyright notice */ 
+
+/* $Id: AliTRDarrayADC.h 23387 2008-01-17 17:25:16Z cblume $ */
+
+///////////////////////////////////////////////
+//                                           //
+// Container class for ADC values            //
+//                                           // 
+///////////////////////////////////////////////
+
+#include <TObject.h>
+
+class AliTRDarrayADC: public TObject
+{
+ public:
+
+  AliTRDarrayADC();
+  AliTRDarrayADC(Int_t nrow, Int_t ncol, Int_t ntime);
+  AliTRDarrayADC(const AliTRDarrayADC &b);
+  ~AliTRDarrayADC();
+  AliTRDarrayADC &operator=(const AliTRDarrayADC &b);
+
+  void    Allocate(Int_t nrow, Int_t ncol, Int_t ntime);
+  void    SetNdet(Int_t ndet) {fNdet=ndet;};  
+  Int_t   GetNdet()  const {return fNdet;};
+  void    SetDataByAdcCol(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value)
+                        {fADC[(nrow*fNumberOfChannels+ncol)*fNtime+ntime]=value-fBaseline;};
+  Bool_t  HasData() const {return fNtime ? 1 : 0;};
+  Short_t GetDataByAdcCol(Int_t nrow, Int_t ncol, Int_t ntime) const
+                         {return fADC[(nrow*fNumberOfChannels+ncol)*fNtime+ntime];};
+  inline  void GetData(Int_t r, Int_t c, Int_t t, Int_t n, Short_t *vals) const;
+  Short_t GetDataBits(Int_t nrow, Int_t ncol, Int_t ntime) const;
+  UChar_t GetPadStatus(Int_t nrow, Int_t ncol, Int_t ntime) const;
+  void    SetPadStatus(Int_t nrow, Int_t ncol, Int_t ntime, UChar_t status);
+  Bool_t  IsPadCorrupted(Int_t nrow, Int_t ncol, Int_t ntime);
+  void    Compress();
+  void    Expand();
+  Int_t   GetNtime() const {return fNtime;};
+  Int_t   GetNrow() const {return fNrow;};
+  Int_t   GetNcol() const {return fNcol;};
+  Int_t   GetDim() const {return fNAdim;};
+  void    DeleteNegatives();
+  void    Reset();
+  Short_t GetData(Int_t nrow, Int_t ncol, Int_t ntime) const;
+  void    SetData(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value);
+  static  void    CreateLut(); 
+  void    SetBaseline(Short_t baseline) {fBaseline=baseline;}
+
+ protected:
+
+  Int_t fNdet;    //ID number of the chamber
+  Int_t fNrow;    //Number of rows
+  Int_t fNcol;    //Number of columns(pads)
+  Int_t fNumberOfChannels;  //  Number of MCM channels per row
+  Int_t fNtime;   //Number of time bins
+  Int_t fNAdim;   //Dimension of the ADC array
+  Short_t fBaseline;
+  Short_t* fADC;  //[fNAdim]   //Pointer to adc values
+  static Short_t *fgLutPadNumbering;   //  [fNcol] Look Up Table
+
+  ClassDef(AliTRDarrayADC,4) //ADC container class
+    
+};
+
+inline void AliTRDarrayADC::GetData(Int_t r, Int_t c, Int_t t, Int_t n, Short_t *vals) const
+{
+  Int_t colNum = fgLutPadNumbering[c];
+  for(Int_t ic=n, idx = (r*fNumberOfChannels+colNum)*fNtime+t; ic--; idx+=fNtime) vals[ic] = fADC[idx];
+ }
+
+#endif 
+
index 955400257f35007d1db762fc7701225c8758662f..474735838401c7e052dab8d4c5c68bed77985d30 100644 (file)
@@ -728,16 +728,11 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
   //
 
   // Get the digits
-  //   digits should be expanded beforehand! 
-  //   digitsIn->Expand();
   fDigits = (AliTRDarrayADC *) fDigitsManager->GetDigits(det); //mod     
   
   // This is to take care of switched off super modules
   if (!fDigits->HasData()) return kFALSE;
 
-  // Subtract the ADC baseline
-  fDigits->SubtractBaseline(fDigitsManager->GetDigitsParam()->GetADCbaseline());
-
   fIndexes = fDigitsManager->GetIndexes(det);
   if (fIndexes->IsAllocated() == kFALSE) {
     AliError("Indexes do not exist!");
index 2b783568e2722c286baf8d58365151d1e52592be..dffe0be50a15b32e7d604c3e0219319de74473a3 100644 (file)
@@ -690,6 +690,7 @@ Int_t AliTRDrawFastStream::NextChamber(AliTRDdigitsManager *digitsManager, UInt_
       // Allocate memory space for the digits buffer
       if (digits->GetNtime() == 0) {
         digits->Allocate(rowMax, colMax, ntbins);
+       digits->SetBaseline(digitsparam->GetADCbaseline());
         if (digitsManager->UsesDictionaries()) {
           track0->Allocate(rowMax, colMax, ntbins);
           track1->Allocate(rowMax, colMax, ntbins);
index 5a8e4920c3a6d962da99c36d485ed7e38f63639d..75c882038d757ca60f7a96a9a1eeaf84b7c37464 100644 (file)
@@ -777,6 +777,7 @@ Int_t AliTRDrawStream::NextChamber(AliTRDdigitsManager *const digitsManager, UIn
       // Allocate memory space for the digits buffer
       if (digits->GetNtime() == 0) {
         digits->Allocate(rowMax, colMax, ntbins);
+       digits->SetBaseline(digitsparam->GetADCbaseline());
         if (digitsManager->UsesDictionaries()) {
           track0->Allocate(rowMax, colMax, ntbins);
           track1->Allocate(rowMax, colMax, ntbins);
index d07996be91b6c767b46208d48a2b96230684a6ad..1cfc0afd6ee60b32e1a92a358afa928857c370b1 100644 (file)
@@ -97,10 +97,10 @@ public:
   void     SetClusterSharing()                                {SETBIT(fFlags, kClusterSharing);}
   void     SetEightSlices()                                   {SETBIT(fFlags, kEightSlices);}
   void     SetImproveTracklets()                              {SETBIT(fFlags, kImproveTracklet);}
-  void     SetLUT()                                           {SETBIT(fFlags, kLUT);}
-  void     SetGAUS()                                          {SETBIT(fFlags, kGAUS);}
-  void     SetPIDNeuralNetwork()                              {SETBIT(fFlags, kSteerPID);}
-  void     SetTailCancelation()                               {SETBIT(fFlags, kTailCancelation);}
+  void     SetLUT(Bool_t b=kTRUE)                             {if(b) SETBIT(fFlags, kLUT); else CLRBIT(fFlags, kLUT);}
+  void     SetGAUS(Bool_t b=kTRUE)                            {if(b) SETBIT(fFlags, kGAUS); else CLRBIT(fFlags, kGAUS);}
+  void     SetPIDNeuralNetwork(Bool_t b=kTRUE)                {if(b) SETBIT(fFlags, kSteerPID); else CLRBIT(fFlags, kSteerPID);}
+  void     SetTailCancelation(Bool_t b=kTRUE)                 {if(b) SETBIT(fFlags, kTailCancelation); else CLRBIT(fFlags, kTailCancelation);}
   void     SetXenon()                                         {CLRBIT(fFlags, kDriftGas);}
   void     SetVertexConstrained()                             {SETBIT(fFlags, kVertexConstraint);}
   void     SetMaxTheta(Double_t maxTheta)                     {fkMaxTheta = maxTheta;}