]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDarrayADC.h
Undoing changes to AliGlauberMC
[u/mrichter/AliRoot.git] / TRD / AliTRDarrayADC.h
index 33221d37bd20fc4a19d1c2c24cb526db1c95e7db..93713012f724077c0c88909420735f921e673e4c 100644 (file)
 
 #include <TObject.h>
 
+class AliTRDSignalIndex;
 class AliTRDarrayADC: public TObject
 {
  public:
 
+  enum {
+    kDataInvalid = 14
+  };
+
   AliTRDarrayADC();
   AliTRDarrayADC(Int_t nrow, Int_t ncol, Int_t ntime);
   AliTRDarrayADC(const AliTRDarrayADC &b);
@@ -27,7 +32,7 @@ class AliTRDarrayADC: public TObject
   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;};
+                         {fADC[(nrow*fNumberOfChannels+ncol)*fNtime+ntime]=value;}
   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];};
@@ -44,10 +49,15 @@ 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    ConditionalReset(AliTRDSignalIndex* idx);
+  inline  Short_t* GetDataAddress(Int_t nrow, Int_t ncol, Int_t ntime = 0) const;
+  inline  Short_t GetData(Int_t nrow, Int_t ncol, Int_t ntime) const;
+  inline  void    SetData(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value);
   static  void    CreateLut(); 
-  void    SetBaseline(Short_t baseline) {fBaseline=baseline;}
+
+  Bool_t  IsValid() { return !TestBit(kDataInvalid); }
+  void    SetDataInvalid() { SetBit(kDataInvalid); }
+  void    SetDataValid() { ResetBit(kDataInvalid); }
 
  protected:
 
@@ -57,7 +67,6 @@ class AliTRDarrayADC: public TObject
   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
 
@@ -65,7 +74,48 @@ class AliTRDarrayADC: public TObject
     
 };
 
-inline void AliTRDarrayADC::GetData(Int_t r, Int_t c, Int_t t, Int_t n, Short_t *vals) const
+//________________________________________________________________________________
+Short_t* AliTRDarrayADC::GetDataAddress(Int_t nrow, Int_t ncol, Int_t ntime) const
+{
+  //
+  // Get the address of the given pad
+  //
+
+  Int_t corrcolumn = fgLutPadNumbering[ncol];
+
+  return &fADC[(nrow*fNumberOfChannels+corrcolumn)*fNtime+ntime];
+
+}
+//________________________________________________________________________________
+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 = fgLutPadNumbering[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 = fgLutPadNumbering[ncol];
+
+  fADC[(nrow*fNumberOfChannels+colnumb)*fNtime+ntime] = value;
+
+}
+
+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];