Change to extended data arrays for all MCM channels and rename GetDataB to GetDataBits
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 May 2009 08:16:02 +0000 (08:16 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 May 2009 08:16:02 +0000 (08:16 +0000)
TRD/AliTRDarrayADC.cxx
TRD/AliTRDarrayADC.h
TRD/AliTRDdigitsManager.cxx

index d1cce1e..52aa9ca 100644 (file)
@@ -25,7 +25,8 @@
 ////////////////////////////////////////////////////////
 
 #include "AliTRDarrayADC.h"
-#include "Cal/AliTRDCalPadStatus.h" 
+#include "Cal/AliTRDCalPadStatus.h"
+#include "AliTRDfeeParam.h"
 
 ClassImp(AliTRDarrayADC)
 
@@ -35,9 +36,11 @@ AliTRDarrayADC::AliTRDarrayADC()
                ,fNdet(0)
                ,fNrow(0)
                ,fNcol(0)
+              ,fNumberOfChannels(0)
                ,fNtime(0) 
                ,fNAdim(0)
                ,fADC(0)
+               ,fLutPadNumbering(0)
 {
   //
   // AliTRDarrayADC default constructor
@@ -51,9 +54,11 @@ AliTRDarrayADC::AliTRDarrayADC(Int_t nrow, Int_t ncol, Int_t ntime)
               ,fNdet(0)               
                ,fNrow(0)
                ,fNcol(0)
+              ,fNumberOfChannels(0)
                ,fNtime(0) 
                ,fNAdim(0)
                ,fADC(0)
+               ,fLutPadNumbering(0)
 {
   //
   // AliTRDarrayADC constructor
@@ -69,9 +74,11 @@ AliTRDarrayADC::AliTRDarrayADC(const AliTRDarrayADC &b)
               ,fNdet(b.fNdet)
                ,fNrow(b.fNrow)
                ,fNcol(b.fNcol)
+              ,fNumberOfChannels(b.fNumberOfChannels)
                ,fNtime(b.fNtime) 
                ,fNAdim(b.fNAdim)
-               ,fADC(0)
+               ,fADC(0)         
+              ,fLutPadNumbering(0)
 {
   //
   // AliTRDarrayADC copy constructor
@@ -79,6 +86,8 @@ AliTRDarrayADC::AliTRDarrayADC(const AliTRDarrayADC &b)
 
   fADC =  new Short_t[fNAdim];
   memcpy(fADC,b.fADC, fNAdim*sizeof(Short_t));
+  fLutPadNumbering = new Short_t[fNcol];
+  memcpy(fLutPadNumbering,b.fLutPadNumbering, fNcol*sizeof(Short_t));   
 
 }
 
@@ -94,6 +103,11 @@ AliTRDarrayADC::~AliTRDarrayADC()
       delete [] fADC;
       fADC=0;
     }
+  if(fLutPadNumbering)
+    {
+      delete [] fLutPadNumbering;
+      fLutPadNumbering=0;
+    }
 
 }
 
@@ -108,19 +122,25 @@ AliTRDarrayADC &AliTRDarrayADC::operator=(const AliTRDarrayADC &b)
     {
       return *this;
     }
-
   if(fADC)
     {
       delete [] fADC;
     }
+  if(fLutPadNumbering)
+    {
+      delete [] fLutPadNumbering;
+    }
   fNdet=b.fNdet;
   fNrow=b.fNrow;
   fNcol=b.fNcol;
+  fNumberOfChannels = b.fNumberOfChannels;
   fNtime=b.fNtime;
   fNAdim=b.fNAdim;
   fADC = new Short_t[fNAdim];
   memcpy(fADC,b.fADC, fNAdim*sizeof(Short_t));
-  
+  fLutPadNumbering = new Short_t[fNcol];
+  memcpy(fLutPadNumbering,b.fLutPadNumbering, fNcol*sizeof(Short_t)); 
+
   return *this;
 
 }
@@ -130,13 +150,18 @@ void AliTRDarrayADC::Allocate(Int_t nrow, Int_t ncol, Int_t ntime)
 {
   //
   // Allocate memory for an AliTRDarrayADC array with dimensions
-  // Row*Col*Time
+  // Row*NumberOfNecessaryMCMs*ADCchannelsInMCM*Time
   //
   
   fNrow=nrow;
   fNcol=ncol;
   fNtime=ntime;
-  fNAdim=nrow*ncol*ntime;  
+  Int_t adcchannelspermcm = AliTRDfeeParam::GetNadcMcm(); 
+  Int_t padspermcm = AliTRDfeeParam::GetNcolMcm(); 
+  Int_t numberofmcms = fNcol/padspermcm; 
+  fNumberOfChannels = numberofmcms*adcchannelspermcm; 
+  fNAdim=nrow*fNumberOfChannels*ntime;
+  CreateLut();
 
   if(fADC)
     {
@@ -149,7 +174,7 @@ void AliTRDarrayADC::Allocate(Int_t nrow, Int_t ncol, Int_t ntime)
 }
 
 //____________________________________________________________________________________
-Short_t AliTRDarrayADC::GetDataB(Int_t row, Int_t col, Int_t time) const
+Short_t AliTRDarrayADC::GetDataBits(Int_t row, Int_t col, Int_t time) const
 {
   //
   // Get the ADC value for a given position: row, col, time
@@ -158,7 +183,7 @@ Short_t AliTRDarrayADC::GetDataB(Int_t row, Int_t col, Int_t time) const
   // Adapted from code of the class AliTRDdataArrayDigits 
   //
 
-  Short_t tempval = fADC[(row*fNcol+col)*fNtime+time];
+  Short_t tempval = GetData(row,col,time);
   // Be aware of manipulations introduced by pad masking in the RawReader
   // Only output the manipulated Value
   CLRBIT(tempval, 10);
@@ -556,4 +581,60 @@ void AliTRDarrayADC::Reset()
   memset(fADC,0,sizeof(Short_t)*fNAdim);
 
 }
+//________________________________________________________________________________
+Short_t AliTRDarrayADC::GetData(Int_t nrow, Int_t ncol, Int_t ntime) const
+{
+  //
+  // Get the data using the pad numbering.
+  // To access data using the mcm scheme use instead
+  // the method GetDataByAdcCol
+  //
+
+  Int_t corrcolumn = fLutPadNumbering[ncol];
+
+  return fADC[(nrow*fNumberOfChannels+corrcolumn)*fNtime+ntime];
+
+}
+//________________________________________________________________________________
+void AliTRDarrayADC::SetData(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value)
+{
+  //
+  // Set the data using the pad numbering.
+  // To write data using the mcm scheme use instead
+  // the method SetDataByAdcCol
+  //
+
+  Int_t colnumb = fLutPadNumbering[ncol];
+
+  fADC[(nrow*fNumberOfChannels+colnumb)*fNtime+ntime]=value;
+
+}
+
+//________________________________________________________________________________
+void AliTRDarrayADC::CreateLut()
+{
+  //
+  // Initializes the Look Up Table to relate
+  // pad numbering and mcm channel numbering
+  //
+
+  if(fLutPadNumbering)
+    {
+      delete [] fLutPadNumbering;
+    }
+  
+   fLutPadNumbering = new Short_t[fNcol];
+   memset(fLutPadNumbering,0,sizeof(Short_t)*fNcol);
+
+  for(Int_t mcm=0; mcm<8; mcm++)
+    {
+      Int_t lowerlimit=0+mcm*18;
+      Int_t upperlimit=18+mcm*18;
+      Int_t shiftposition = 1+3*mcm;
+      for(Int_t index=lowerlimit;index<upperlimit;index++)
+       {
+         fLutPadNumbering[index]=index+shiftposition;
+       }
+    }
+}
 
index 67e9d70..03ae2c7 100644 (file)
@@ -26,13 +26,13 @@ class AliTRDarrayADC: public TObject
   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    SetData(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value)
-                        {fADC[(nrow*fNcol+ncol)*fNtime+ntime]=value;};
+  void    SetDataByAdcCol(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value)
+                        {fADC[(nrow*fNumberOfChannels+ncol)*fNtime+ntime]=value;};
   Bool_t  HasData() const {return fNtime ? 1 : 0;};
-  Short_t GetData(Int_t nrow, Int_t ncol, Int_t ntime) const
-                       {return fADC[(nrow*fNcol+ncol)*fNtime+ntime];};
-  inline void GetData(Int_t r, Int_t c, Int_t t, Int_t n, Short_t *vals) const;
-  Short_t GetDataB(Int_t nrow, Int_t ncol, Int_t ntime) const;
+  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);
@@ -44,23 +44,30 @@ class AliTRDarrayADC: public TObject
   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);
+  void    CreateLut(); 
 
  protected:
 
   Int_t fNdet;    //ID number of the chamber
   Int_t fNrow;    //Number of rows
-  Int_t fNcol;    //Number of columns
+  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* fADC;  //[fNAdim]   //Pointer to adc values
+  Short_t *fLutPadNumbering;   //  [fNcol] Look Up Table
 
-  ClassDef(AliTRDarrayADC,1) //ADC container class
+  ClassDef(AliTRDarrayADC,2) //ADC container class
     
 };
 
 inline void AliTRDarrayADC::GetData(Int_t r, Int_t c, Int_t t, Int_t n, Short_t *vals) const
 {
-  for(Int_t ic=n, idx = (r*fNcol+c)*fNtime+t; ic--; idx+=fNtime) vals[ic] = fADC[idx];
-}
+  Int_t ColNum = fLutPadNumbering[c];
+  for(Int_t ic=n, idx = (r*fNumberOfChannels+ColNum)*fNtime+t; ic--; idx+=fNtime) vals[ic] = fADC[idx];
+ }
 
 #endif 
+
index 906ea6d..44f0915 100644 (file)
@@ -309,7 +309,7 @@ Short_t AliTRDdigitsManager::GetDigitAmp(Int_t row, Int_t col,Int_t time, Int_t
 
   if (!GetDigits(det)) return 0;
   
-  return ((Short_t) ((AliTRDarrayADC *) GetDigits(det))->GetDataB(row,col,time));
+  return ((Short_t) ((AliTRDarrayADC *) GetDigits(det))->GetDataBits(row,col,time));
 
 }
 
@@ -780,7 +780,7 @@ Bool_t AliTRDdigitsManager::BuildIndexes(Int_t det)
            {
              for (Int_t it = 0; it < nTbins; it++)
                {         
-                 Int_t isig = digits->GetDataB(ir,ic,it);
+                 Int_t isig = digits->GetDataBits(ir,ic,it);
                  if (isig > 0) 
                    {
                      indexes->AddIndexRC(ir,ic);