Add shared pads also to dictionary and signal array
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 14 Jul 2009 16:22:50 +0000 (16:22 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 14 Jul 2009 16:22:50 +0000 (16:22 +0000)
TRD/AliTRDarrayDictionary.cxx
TRD/AliTRDarrayDictionary.h
TRD/AliTRDarraySignal.cxx
TRD/AliTRDarraySignal.h

index 335e212..94c98ea 100644 (file)
 
 #include "AliTRDarrayDictionary.h"
 #include "TArray.h"
+#include "AliTRDfeeParam.h"
 
 ClassImp(AliTRDarrayDictionary)
 
+Short_t *AliTRDarrayDictionary::fLutPadNumbering = 0x0;
+
 //________________________________________________________________________________
 AliTRDarrayDictionary::AliTRDarrayDictionary()
                       :TObject()
                       ,fNdet(0)
                       ,fNrow(0)
                       ,fNcol(0)
+                     ,fNumberOfChannels(0)
                       ,fNtime(0)
                       ,fNDdim(0)
                       ,fDictionary(0)
@@ -43,6 +47,8 @@ AliTRDarrayDictionary::AliTRDarrayDictionary()
   // AliTRDarrayDictionary default contructor
   //
 
+  CreateLut();
+
 }
 
 //________________________________________________________________________________
@@ -51,6 +57,7 @@ AliTRDarrayDictionary::AliTRDarrayDictionary(Int_t nrow, Int_t ncol, Int_t ntime
                      ,fNdet(0)
                       ,fNrow(0)
                       ,fNcol(0)
+                     ,fNumberOfChannels(0)
                       ,fNtime(0)
                      ,fNDdim(0)
                      ,fDictionary(0)
@@ -60,6 +67,7 @@ AliTRDarrayDictionary::AliTRDarrayDictionary(Int_t nrow, Int_t ncol, Int_t ntime
   // AliTRDarrayDictionary contructor
   //
 
+  CreateLut();
   Allocate(nrow,ncol,ntime);
 
 }
@@ -70,6 +78,7 @@ AliTRDarrayDictionary::AliTRDarrayDictionary(const AliTRDarrayDictionary &a)
                      ,fNdet(a.fNdet)
                       ,fNrow(a.fNrow)
                       ,fNcol(a.fNcol)
+                     ,fNumberOfChannels(a.fNumberOfChannels)
                       ,fNtime(a.fNtime)
                      ,fNDdim(a.fNDdim)
                      ,fDictionary(0)
@@ -121,6 +130,7 @@ AliTRDarrayDictionary &AliTRDarrayDictionary::operator=(const AliTRDarrayDiction
   fNDdim=a.fNDdim;
   fNrow=a.fNrow;
   fNcol=a.fNcol;
+  fNumberOfChannels = a.fNumberOfChannels;
   fNtime=a.fNtime;
   fDictionary = new Int_t[fNDdim];
   for(Int_t i=0; i<fNDdim; i++)
@@ -136,14 +146,19 @@ void AliTRDarrayDictionary::Allocate(Int_t nrow, Int_t ncol, Int_t ntime)
 {
   //
   // Allocates memory for the dictionary array with dimensions
-  // Row*Col*Time
+  // Row*NumberOfNecessaryMCMs*ADCchannelsInMCM*Time
+  // To be consistent with AliTRDarrayADC
   // Object initialized to -1
   //
 
   fNrow=nrow;
   fNcol=ncol;
   fNtime=ntime;
-  fNDdim=nrow*ncol*ntime;
+  Int_t adcchannelspermcm = AliTRDfeeParam::GetNadcMcm(); 
+  Int_t padspermcm = AliTRDfeeParam::GetNcolMcm(); 
+  Int_t numberofmcms = fNcol/padspermcm;
+  fNumberOfChannels = numberofmcms*adcchannelspermcm;
+  fNDdim=nrow*fNumberOfChannels*ntime;
   if(fDictionary)
     {
       delete [] fDictionary;
@@ -340,3 +355,56 @@ void AliTRDarrayDictionary::Reset()
   memset(fDictionary,0,sizeof(Int_t)*fNDdim);
 
 }
+//________________________________________________________________________________
+Int_t AliTRDarrayDictionary::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 fDictionary[(nrow*fNumberOfChannels+corrcolumn)*fNtime+ntime];
+
+}
+//________________________________________________________________________________
+void AliTRDarrayDictionary::SetData(Int_t nrow, Int_t ncol, Int_t ntime, Int_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];
+
+  fDictionary[(nrow*fNumberOfChannels+colnumb)*fNtime+ntime]=value;
+
+}
+
+//________________________________________________________________________________
+void AliTRDarrayDictionary::CreateLut()
+{
+  //
+  // Initializes the Look Up Table to relate
+  // pad numbering and mcm channel numbering
+  //
+
+  if(fLutPadNumbering)  return;
+  
+   fLutPadNumbering = new Short_t[AliTRDfeeParam::GetNcol()];
+   memset(fLutPadNumbering,0,sizeof(Short_t)*AliTRDfeeParam::GetNcol());
+
+  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 360d449..bb34fab 100644 (file)
@@ -27,26 +27,30 @@ class AliTRDarrayDictionary: public TObject
   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  SetData(Int_t nrow, Int_t ncol, Int_t ntime, Int_t value)\r
-               { fDictionary[(nrow*fNcol+ncol)*fNtime+ntime]=value; };\r
-  Int_t GetData(Int_t nrow, Int_t ncol, Int_t ntime) const\r
-               { return fDictionary[(nrow*fNcol+ncol)*fNtime+ntime]; };\r
+  void  SetDataByAdcCol(Int_t nrow, Int_t ncol, Int_t ntime, Int_t value)\r
+                       {fDictionary[(nrow*fNumberOfChannels+ncol)*fNtime+ntime]=value;};\r
+  Int_t GetDataByAdcCol(Int_t nrow, Int_t ncol, Int_t ntime) const\r
+               {return fDictionary[(nrow*fNumberOfChannels+ncol)*fNtime+ntime];};\r
   Int_t GetDim() const {return fNDdim;};\r
   void  Compress();\r
   void  Expand();\r
   void  Reset();\r
+  Int_t GetData(Int_t nrow, Int_t ncol, Int_t ntime) const;\r
+  void  SetData(Int_t nrow, Int_t ncol, Int_t ntime, Int_t value);\r
+  static  void    CreateLut(); \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\r
+  Int_t   fNumberOfChannels;  //  Number of MCM channels per row\r
   Int_t   fNtime;       //Number of time bins\r
   Int_t   fNDdim;       //Dimension of the Dictionary array\r
   Int_t*  fDictionary;  //[fNDdim]  //Pointer to integers array\r
+  static Short_t *fLutPadNumbering;   //  [fNcol] Look Up Table\r
 \r
-\r
-  ClassDef(AliTRDarrayDictionary,1) //Dictionary container class\r
+  ClassDef(AliTRDarrayDictionary,2) //Dictionary container class\r
     \r
 };\r
 #endif\r
index 25bfd50..da8d08b 100644 (file)
 #include "AliTRDarraySignal.h"
 //#include "AliLog.h"
 #include "TArray.h" //for memset
+#include "AliTRDfeeParam.h"
 
 ClassImp(AliTRDarraySignal)
 
+Short_t *AliTRDarraySignal::fLutPadNumbering = 0x0;
+
 //_______________________________________________________________________
 AliTRDarraySignal::AliTRDarraySignal()
                   :TObject()
                   ,fNdet(0)
                   ,fNrow(0)
                   ,fNcol(0)
+                 ,fNumberOfChannels(0)
                   ,fNtime(0)
                   ,fNdim(0)  
                   ,fSignal(0)
@@ -44,6 +48,8 @@ AliTRDarraySignal::AliTRDarraySignal()
   //
   // AliTRDarraySignal default constructor
   //
+
+  CreateLut();
           
 }
 
@@ -53,6 +59,7 @@ AliTRDarraySignal::AliTRDarraySignal(Int_t nrow, Int_t ncol,Int_t ntime)
                   ,fNdet(0)
                   ,fNrow(0)
                   ,fNcol(0)
+                 ,fNumberOfChannels(0)
                   ,fNtime(0)
                   ,fNdim(0)
                   ,fSignal(0)
@@ -60,7 +67,8 @@ AliTRDarraySignal::AliTRDarraySignal(Int_t nrow, Int_t ncol,Int_t ntime)
   //
   // AliTRDarraySignal constructor
   //
+
+  CreateLut(); 
   Allocate(nrow,ncol,ntime);
 
 }
@@ -71,6 +79,7 @@ AliTRDarraySignal::AliTRDarraySignal(const AliTRDarraySignal &d)
                  ,fNdet(d.fNdet)
                  ,fNrow(d.fNrow)
                  ,fNcol(d.fNcol)
+                  ,fNumberOfChannels(d.fNumberOfChannels)
                  ,fNtime(d.fNtime)
                  ,fNdim(d.fNdim)
                  ,fSignal(0)
@@ -118,6 +127,7 @@ AliTRDarraySignal &AliTRDarraySignal::operator=(const AliTRDarraySignal &d)
   fNdet=d.fNdet;
   fNrow=d.fNrow;
   fNcol=d.fNcol;
+  fNumberOfChannels = d.fNumberOfChannels;
   fNtime=d.fNtime;
   fNdim=d.fNdim;
   fSignal = new Float_t[fNdim];
@@ -132,13 +142,18 @@ void AliTRDarraySignal::Allocate(Int_t nrow, Int_t ncol, Int_t ntime)
 {
   //
   // Allocates memory for an AliTRDarraySignal object with dimensions 
-  // Row*Col*Time
+  // Row*NumberOfNecessaryMCMs*ADCchannelsInMCM*Time
+  // To be consistent with AliTRDarrayADC
   //
 
   fNrow=nrow;
   fNcol=ncol;
   fNtime=ntime;
-  fNdim = nrow*ncol*ntime;
+  Int_t adcchannelspermcm = AliTRDfeeParam::GetNadcMcm(); 
+  Int_t padspermcm = AliTRDfeeParam::GetNcolMcm(); 
+  Int_t numberofmcms = fNcol/padspermcm; 
+  fNumberOfChannels = numberofmcms*adcchannelspermcm;
+  fNdim = nrow*fNumberOfChannels*ntime;
   if (fSignal)   
     {
       delete [] fSignal;
@@ -367,3 +382,56 @@ void AliTRDarraySignal::Reset()
   memset(fSignal,0,sizeof(Float_t)*fNdim);
 
 }
+//________________________________________________________________________________
+Float_t AliTRDarraySignal::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 fSignal[(nrow*fNumberOfChannels+corrcolumn)*fNtime+ntime];
+
+}
+//________________________________________________________________________________
+void AliTRDarraySignal::SetData(Int_t nrow, Int_t ncol, Int_t ntime, Float_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];
+
+  fSignal[(nrow*fNumberOfChannels+colnumb)*fNtime+ntime]=value;
+
+}
+
+//________________________________________________________________________________
+void AliTRDarraySignal::CreateLut()
+{
+  //
+  // Initializes the Look Up Table to relate
+  // pad numbering and mcm channel numbering
+  //
+
+  if(fLutPadNumbering)  return;
+  
+   fLutPadNumbering = new Short_t[AliTRDfeeParam::GetNcol()];
+   memset(fLutPadNumbering,0,sizeof(Short_t)*AliTRDfeeParam::GetNcol());
+
+  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 02c2569..97aacc5 100644 (file)
@@ -30,27 +30,32 @@ class AliTRDarraySignal: public TObject
   Int_t   GetNrow()  const {return fNrow;};
   Int_t   GetNcol()  const {return fNcol;};
   Int_t   GetNtime() const {return fNtime;};
-  Float_t GetData(Int_t row, Int_t col, Int_t time) const
-               {return fSignal[(row*fNcol+col)*fNtime+time];};
-  void    SetData(Int_t row, Int_t col, Int_t time, Float_t value)
-              {fSignal[(row*fNcol+col)*fNtime+time]=value;};
+  Float_t GetDataByAdcCol(Int_t row, Int_t col, Int_t time) const
+               {return fSignal[(row*fNumberOfChannels+col)*fNtime+time];};
+  void    SetDataByAdcCol(Int_t row, Int_t col, Int_t time, Float_t value)
+              {fSignal[(row*fNumberOfChannels+col)*fNtime+time]=value;};
   Bool_t  HasData() const {return fNtime ? 1 : 0;};
   Int_t   GetDim() const {return fNdim;};
   Int_t   GetOverThreshold(Float_t threshold);
   void    Compress(Float_t minval);
   void    Expand();
   void    Reset();
+  Float_t GetData(Int_t nrow, Int_t ncol, Int_t ntime) const;
+  void    SetData(Int_t nrow, Int_t ncol, Int_t ntime, Float_t value);
+  static  void    CreateLut(); 
 
  protected:
 
   Int_t    fNdet;      //ID number of the chamber
   Int_t    fNrow;      //Number of rows of the chamber
   Int_t    fNcol;      //Number of columns of the chamber
+  Int_t    fNumberOfChannels;  //  Number of MCM channels per row
   Int_t    fNtime;     //Number of time bins
   Int_t    fNdim;      //Dimension of the array
-  Float_t *fSignal;    //[fNdim]  //Pointer to signals 
+  Float_t *fSignal;    //[fNdim]  //Pointer to signals
+  static Short_t *fLutPadNumbering;   //  [fNcol] Look Up Table 
 
-  ClassDef(AliTRDarraySignal,1)  //Signal container class
+  ClassDef(AliTRDarraySignal,2)  //Signal container class
     
 };
 #endif