]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
ALIROOT-5492 Add field to separate HG and LG digits
authorprsnko <Dmitri.Peressounko@cern.ch>
Fri, 20 Jun 2014 07:48:05 +0000 (11:48 +0400)
committerhristov <Peter.Hristov@cern.ch>
Tue, 1 Jul 2014 05:14:40 +0000 (09:14 +0400)
STEER/AOD/AliAODCaloCells.cxx
STEER/AOD/AliAODCaloCells.h
STEER/ESD/AliESDCaloCells.cxx
STEER/ESD/AliESDCaloCells.h
STEER/STEERBase/AliVCaloCells.h

index bc65806d0ccd74bc3e092b802dfc6623dcc6d139..2651765d7c734ceda1d516a098dbbd17932a8fe7 100644 (file)
@@ -26,7 +26,7 @@ ClassImp(AliAODCaloCells)
 
 //_______________________________________________________
 AliAODCaloCells::AliAODCaloCells() : 
-    AliVCaloCells(), fNCells(0), fCellNumber(0), 
+    AliVCaloCells(), fNCells(0), fHGLG(0), fCellNumber(0), 
     fAmplitude(0), fTime(0), fEFraction(0), fMCLabel(0),
     fIsSorted(kTRUE), fType(kUndef)
 {
@@ -35,7 +35,7 @@ AliAODCaloCells::AliAODCaloCells() :
 
 //_____________________________________________________________________________________
 AliAODCaloCells::AliAODCaloCells(const char* name, const char* title, VCells_t ttype) :
-    AliVCaloCells(name, title), fNCells(0), fCellNumber(0), 
+    AliVCaloCells(name, title), fNCells(0), fHGLG(0), fCellNumber(0), 
     fAmplitude(0), fTime(0), fEFraction(0), fMCLabel(0),
     fIsSorted(kTRUE), fType(ttype)
 {
@@ -44,11 +44,12 @@ AliAODCaloCells::AliAODCaloCells(const char* name, const char* title, VCells_t t
 
 //________________________________________________________________
 AliAODCaloCells::AliAODCaloCells(const AliAODCaloCells& cells) :
-    AliVCaloCells(cells), fNCells(cells.fNCells), fCellNumber(0),
+    AliVCaloCells(cells), fNCells(cells.fNCells), fHGLG(0), fCellNumber(0),
     fAmplitude(0), fTime(0), fEFraction(0), fMCLabel(0),
     fIsSorted(cells.fIsSorted), fType(cells.fType)
 {
 // Copy constructor
+  fHGLG       = new Bool_t[fNCells] ;
   fCellNumber = new Short_t[fNCells];
   fAmplitude  = new Double32_t[fNCells]; 
   fTime       = new Double32_t[fNCells]; 
@@ -56,6 +57,7 @@ AliAODCaloCells::AliAODCaloCells(const AliAODCaloCells& cells) :
   fEFraction  = new Double32_t[fNCells]; 
 
   for (Int_t i = 0; i < fNCells; i++) {
+    fHGLG[i]          = cells.fHGLG[i];     
     fCellNumber[i]    = cells.fCellNumber[i];
     fAmplitude[i]     = cells.fAmplitude[i];
     if(cells.fTime)  fTime[i]      = cells.fTime[i];
@@ -74,6 +76,7 @@ AliAODCaloCells& AliAODCaloCells::operator=(const AliAODCaloCells& source)
     
     if(fNCells != source.fNCells) 
     {
+      delete [] fHGLG ;
       delete [] fCellNumber;
       delete [] fAmplitude;
       delete [] fTime;
@@ -82,6 +85,7 @@ AliAODCaloCells& AliAODCaloCells::operator=(const AliAODCaloCells& source)
 
       fNCells     = source.fNCells;
       
+      fHGLG       = new Bool_t[fNCells] ;
       fCellNumber = new Short_t[fNCells];
       fAmplitude  = new Double32_t[fNCells];
       fTime       = new Double32_t[fNCells];
@@ -89,6 +93,7 @@ AliAODCaloCells& AliAODCaloCells::operator=(const AliAODCaloCells& source)
       fEFraction  = new Double32_t[fNCells];
     }
     
+    memcpy(fCellNumber,source.fHGLG,fNCells*sizeof(Bool_t));
     memcpy(fCellNumber,source.fCellNumber, fNCells*sizeof(Short_t));
     memcpy(fAmplitude, source.fAmplitude,  fNCells*sizeof(Double32_t));
     if(source.fTime      && fTime)      memcpy(fTime,      source.fTime,      fNCells*sizeof(Double32_t));
@@ -181,6 +186,7 @@ void AliAODCaloCells::CreateContainer(Short_t nCells)
 
   fNCells = nCells;
 
+  fHGLG       = new Bool_t[fNCells];
   fCellNumber = new Short_t[fNCells];
   fAmplitude  = new Double32_t[fNCells];
   fTime       = new Double32_t[fNCells];
@@ -190,6 +196,7 @@ void AliAODCaloCells::CreateContainer(Short_t nCells)
   // set to zero
   for(int i = 0;i<fNCells;++i)
   {
+    fHGLG[i]=kFALSE ;
     fAmplitude [i] =  0.; 
     fCellNumber[i] = -1 ; 
     fEFraction [i] =  0.;
@@ -202,6 +209,10 @@ void AliAODCaloCells::CreateContainer(Short_t nCells)
 void AliAODCaloCells::DeleteContainer()
 {
   // deletes allocated memory
+  if(fHGLG){
+    delete[] fHGLG;
+    fHGLG = 0 ;
+  }
 
   if (fCellNumber)
   {
@@ -246,6 +257,7 @@ void AliAODCaloCells::Sort()
   Int_t *idxArray = new Int_t[fNCells];
   TMath::Sort(fNCells,fCellNumber,idxArray,kFALSE);
   
+  Bool_t     *newHGLG      = new Bool_t[fNCells];
   Short_t    *newIndex     = new Short_t[fNCells];
   Double32_t *newAmplitude = new Double32_t[fNCells];
   
@@ -258,6 +270,7 @@ void AliAODCaloCells::Sort()
   
   for (Int_t i=0; i < fNCells; i++) 
   {
+    newHGLG[i]      = fHGLG[idxArray[i]];
     newIndex[i]     = fCellNumber[idxArray[i]];
     newAmplitude[i] = fAmplitude [idxArray[i]];
     if(fTime)      newTime[i]      = fTime     [idxArray[i]];
@@ -265,12 +278,14 @@ void AliAODCaloCells::Sort()
     if(fEFraction) newEFraction[i] = fEFraction[idxArray[i]];  
   }
   
+  delete [] fHGLG;
   delete [] fCellNumber;
   delete [] fAmplitude;
   delete [] fTime;
   delete [] fMCLabel;
   delete [] fEFraction;
 
+  fHGLG = newHGLG;
   fCellNumber = newIndex;
   fAmplitude  = newAmplitude;
   if(fTime)      fTime       = newTime;
@@ -284,12 +299,13 @@ void AliAODCaloCells::Sort()
 
 //________________________________________________________________________________________
 Bool_t AliAODCaloCells::SetCell(Short_t pos,     Short_t cellNumber, Double32_t amplitude, 
-                                Double32_t time, Int_t mclabel,    Double32_t efrac)
+                                Double32_t time, Int_t mclabel,    Double32_t efrac, Bool_t isHG)
 {
   // Sets a cell at the given position
 
   if (pos>=0 && pos < fNCells) 
   {
+    fHGLG[pos]=isHG ;
     fCellNumber[pos] = cellNumber;
     fAmplitude[pos]  = amplitude;
     
index 740b9cf7909afee3d845ca922de0415562cea7b6..0d64ba7b19220fd20dc88a82cb664dfcdc7881b3 100644 (file)
@@ -31,16 +31,18 @@ class AliAODCaloCells : public AliVCaloCells
   void            Sort();
   
   inline Bool_t   GetCell(Short_t pos, Short_t &cellNumber, Double_t &amplitude,  Double_t &time, Int_t &mclabel,      Double_t &efrac) const ;
-  Bool_t          SetCell(Short_t pos, Short_t  cellNumber, Double_t  amplitude,  Double_t  time, Int_t  mclabel = -1, Double_t  efrac = 0.)  ;
+  Bool_t          SetCell(Short_t pos, Short_t  cellNumber, Double_t  amplitude, Double_t  time, Int_t  mclabel = -1, Double_t  efrac = 0., Bool_t isHG=kFALSE);
   
   Short_t         GetNumberOfCells() const  { return fNCells ; }
   void            SetNumberOfCells(Int_t n) { fNCells = n    ; }
   
   inline Double_t GetCellAmplitude(Short_t cellNumber);
+  inline Bool_t   GetCellHighGain(Short_t cellNumber);  //is this cell High Gain
   inline Short_t  GetCellPosition(Short_t cellNumber);
   inline Double_t GetCellTime(Short_t cellNumber);
   
   inline Double_t GetAmplitude(Short_t pos) const;
+  inline Bool_t   GetHighGain(Short_t pos) const;
   inline Short_t  GetCellNumber(Short_t pos) const;
   inline Double_t GetTime(Short_t pos) const;
   
@@ -63,6 +65,7 @@ class AliAODCaloCells : public AliVCaloCells
  protected:
   
   Int_t       fNCells;       // Number of cells
+  Bool_t     *fHGLG;         //[fNCells] if sell HG or LG
   Short_t    *fCellNumber;   //[fNCells] array of cell numbers
   Double32_t *fAmplitude;    //[fNCells][0.,0.,16] array with cell amplitudes (= energy!)
   Double32_t *fTime;         //[fNCells][0.,0.,16] array with cell times
@@ -111,6 +114,20 @@ Double_t AliAODCaloCells::GetCellAmplitude(Short_t cellNumber)
     return 0.;
   }
 }
+Bool_t AliAODCaloCells::GetCellHighGain(Short_t cellNumber)
+{ 
+  if (!fIsSorted) {
+    Sort();
+    fIsSorted=kTRUE;
+  }
+
+  Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
+  if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber ) {
+    return fHGLG[pos];
+  } else {
+    return 0.;
+  }
+}
 
 Double_t AliAODCaloCells::GetCellTime(Short_t cellNumber)
 { 
@@ -137,6 +154,15 @@ Double_t AliAODCaloCells::GetAmplitude(Short_t pos) const
     return 0.;
   }
 }
+Bool_t AliAODCaloCells::GetHighGain(Short_t pos) const 
+{ 
+  if (pos>=0 && pos<fNCells) {
+    return fHGLG[pos];
+  } else {
+    return 0.;
+  }
+}
+
 
 Double_t AliAODCaloCells::GetTime(Short_t pos) const 
 { 
index f9978610f25b0d8aff83b5787028bf2ff4798b0c..6c514cad1f728f2a802379aa02622d890342aca5 100644 (file)
@@ -27,15 +27,15 @@ ClassImp(AliESDCaloCells)
 
 //_____________________________________________________
 AliESDCaloCells::AliESDCaloCells() : 
-  AliVCaloCells(), fNCells(0), fCellNumber(0), 
-  fAmplitude(0), fTime(0), fEFraction(0), fMCLabel(0),
+  AliVCaloCells(), fNCells(0), fHGLG(0),fCellNumber(0), 
+  fAmplitude(0), fTime(0), fEFraction(0), fMCLabel(0), 
   fIsSorted(kTRUE), fType(kUndef)
 {
   // default constructor
 }
 //______________________________________________________________________________________
  AliESDCaloCells::AliESDCaloCells(const char* name, const char* title, VCells_t ttype) : 
-   AliVCaloCells(name, title), fNCells(0), fCellNumber(0), 
+   AliVCaloCells(name, title), fNCells(0),  fHGLG(0),fCellNumber(0), 
    fAmplitude(0),  fTime(0), fEFraction(0), fMCLabel(0),
    fIsSorted(kTRUE), fType(ttype)
 {
@@ -44,12 +44,12 @@ AliESDCaloCells::AliESDCaloCells() :
 
 //__________________________________________________________
 AliESDCaloCells::AliESDCaloCells(const AliESDCaloCells& c) : 
-  AliVCaloCells(c), fNCells(c.fNCells),  fCellNumber(0), 
+  AliVCaloCells(c), fNCells(c.fNCells),  fHGLG(0), fCellNumber(0), 
   fAmplitude(0), fTime(0), fEFraction(0), fMCLabel(0),
   fIsSorted(c.fIsSorted), fType(c.fType)
 {
   // copy constructor
-
+  fHGLG       = new Bool_t[fNCells] ;
   fCellNumber = new Short_t[fNCells];
   fAmplitude  = new Double32_t[fNCells];
   fTime       = new Double32_t[fNCells];
@@ -58,6 +58,7 @@ AliESDCaloCells::AliESDCaloCells(const AliESDCaloCells& c) :
 
   for(Int_t i = 0; i < fNCells; i++)
   {
+    fHGLG[i]          = c.fHGLG[i];     
     fCellNumber[i]    = c.fCellNumber[i];
     fAmplitude[i]     = c.fAmplitude[i];
     fTime[i]          = c.fTime[i];
@@ -77,6 +78,7 @@ AliESDCaloCells & AliESDCaloCells::operator =(const AliESDCaloCells& source)
     
     if(fNCells != source.fNCells) 
     {
+      delete [] fHGLG ;
       delete [] fCellNumber;
       delete [] fAmplitude;
       delete [] fTime;
@@ -85,6 +87,7 @@ AliESDCaloCells & AliESDCaloCells::operator =(const AliESDCaloCells& source)
       
       fNCells = source.fNCells;
       
+      fHGLG       = new Bool_t[fNCells] ;
       fCellNumber = new Short_t[fNCells];
       fAmplitude  = new Double32_t[fNCells];
       fTime       = new Double32_t[fNCells];
@@ -92,6 +95,7 @@ AliESDCaloCells & AliESDCaloCells::operator =(const AliESDCaloCells& source)
       fEFraction  = new Double32_t[fNCells];
     }
     
+    memcpy(fCellNumber,source.fHGLG,fNCells*sizeof(Bool_t));
     memcpy(fCellNumber,source.fCellNumber,fNCells*sizeof(Short_t));
     memcpy(fAmplitude, source.fAmplitude, fNCells*sizeof(Double32_t));
     memcpy(fTime,      source.fTime,      fNCells*sizeof(Double32_t));
@@ -182,6 +186,7 @@ void AliESDCaloCells::CreateContainer(Short_t nCells)
 
   fNCells = nCells;
 
+  fHGLG       = new Bool_t[fNCells];
   fCellNumber = new Short_t[fNCells];
   fAmplitude  = new Double32_t[fNCells];
   fTime       = new Double32_t[fNCells];
@@ -191,6 +196,7 @@ void AliESDCaloCells::CreateContainer(Short_t nCells)
   // set to zero
   for(int i = 0;i<fNCells;++i)
   {
+    fHGLG[i]=kFALSE ;
     fAmplitude [i] =  0.; 
     fCellNumber[i] = -1 ; 
     fEFraction [i] =  0.;
@@ -203,7 +209,11 @@ void AliESDCaloCells::CreateContainer(Short_t nCells)
 void AliESDCaloCells::DeleteContainer()
 {
   // deletes allocated memory
-
+  if(fHGLG){
+    delete[] fHGLG;
+    fHGLG = 0 ;
+  }
+  
   if (fCellNumber)
   {
     delete[] fCellNumber;
@@ -247,6 +257,7 @@ void AliESDCaloCells::Sort()
   Int_t *idxArray = new Int_t[fNCells];
   TMath::Sort(fNCells,fCellNumber,idxArray,kFALSE);
   
+  Bool_t     *newHGLG      = new Bool_t[fNCells];
   Short_t    *newIndex     = new Short_t[fNCells];
   Double32_t *newAmplitude = new Double32_t[fNCells];
   Double32_t *newTime      = new Double32_t[fNCells];
@@ -258,6 +269,7 @@ void AliESDCaloCells::Sort()
     
   for (Int_t i=0; i < fNCells; i++) 
   {
+    newHGLG[i]      = fHGLG[idxArray[i]];
     newIndex[i]     = fCellNumber[idxArray[i]];
     newAmplitude[i] = fAmplitude [idxArray[i]];
     newTime[i]      = fTime      [idxArray[i]];
@@ -265,12 +277,14 @@ void AliESDCaloCells::Sort()
     if(fEFraction) newEFraction[i] = fEFraction[idxArray[i]];
   }
   
+  delete [] fHGLG;
   delete [] fCellNumber;
   delete [] fAmplitude;
   delete [] fTime;
   delete [] fMCLabel;
   delete [] fEFraction;
 
+  fHGLG = newHGLG;
   fCellNumber = newIndex;
   fAmplitude  = newAmplitude;
   fTime       = newTime;
@@ -284,12 +298,13 @@ void AliESDCaloCells::Sort()
 
 //________________________________________________________________________________________
 Bool_t AliESDCaloCells::SetCell(Short_t pos,     Short_t cellNumber, Double32_t amplitude,  
-                                Double32_t time, Int_t mclabel,    Double32_t efrac)
+                                Double32_t time, Int_t mclabel,    Double32_t efrac, Bool_t isHG)
 {
   // Sets a cell at the given position
 
   if (pos>=0 && pos < fNCells) 
   {
+    fHGLG[pos]=isHG ;
     fCellNumber[pos] = cellNumber;
     fAmplitude[pos]  = amplitude;
     fTime[pos]       = time;
index 79e60ff249622317e39da80cfe0bd1d56a4d7a56..b8fd7950182a0138d35e9631776218442560abce 100644 (file)
@@ -39,17 +39,19 @@ class AliESDCaloCells : public AliVCaloCells
   void            SetType(Char_t t){ fType = t                   ; }
   
   inline Bool_t   GetCell(Short_t pos, Short_t &cellNumber, Double_t &amplitude, Double_t &time, Int_t &mclabel,      Double_t &efrac) const;
-  Bool_t          SetCell(Short_t pos, Short_t  cellNumber, Double_t  amplitude, Double_t  time, Int_t  mclabel = -1, Double_t  efrac = 0.);
+  Bool_t          SetCell(Short_t pos, Short_t  cellNumber, Double_t  amplitude, Double_t  time, Int_t  mclabel = -1, Double_t  efrac = 0., Bool_t isHG=kFALSE);
   
   Short_t         GetNumberOfCells() const  { return fNCells ; }
   void            SetNumberOfCells(Int_t n) { fNCells = n    ; }
   
   
   inline Double_t GetCellAmplitude(Short_t cellNumber);
+  inline Bool_t   GetCellHighGain(Short_t cellNumber);  //is this cell High Gain
   inline Short_t  GetCellPosition(Short_t cellNumber);
   inline Double_t GetCellTime(Short_t cellNumber);
   
   inline Double_t GetAmplitude(Short_t pos) const;
+  inline Bool_t   GetHighGain(Short_t pos) const;
   inline Double_t GetTime(Short_t pos) const;
   inline Short_t  GetCellNumber(Short_t pos) const;
 
@@ -66,6 +68,7 @@ class AliESDCaloCells : public AliVCaloCells
  protected:
   
   Int_t       fNCells;       // Number of cells
+  Bool_t     *fHGLG;         //[fNCells] if sell HG or LG
   Short_t    *fCellNumber;   //[fNCells] array of cell numbers
   Double32_t *fAmplitude;    //[fNCells][0.,0.,16] array with cell amplitudes (= energy!)
   Double32_t *fTime;         //[fNCells][0.,0.,16] array with cell times
@@ -115,6 +118,21 @@ Double_t AliESDCaloCells::GetCellAmplitude(Short_t cellNumber)
   }
 }
 
+Bool_t AliESDCaloCells::GetCellHighGain(Short_t cellNumber)
+{ 
+  if (!fIsSorted) {
+    Sort();
+    fIsSorted=kTRUE;
+  }
+
+  Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
+  if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber ) {
+    return fHGLG[pos];
+  } else {
+    return 0.;
+  }
+}
+
 Double_t AliESDCaloCells::GetCellTime(Short_t cellNumber)
 { 
   if (!fIsSorted) {
@@ -138,6 +156,14 @@ Double_t AliESDCaloCells::GetAmplitude(Short_t pos) const
     return 0.;
   }
 }
+Bool_t AliESDCaloCells::GetHighGain(Short_t pos) const 
+{ 
+  if (pos>=0 && pos<fNCells) {
+    return fHGLG[pos];
+  } else {
+    return 0.;
+  }
+}
 
 Double_t AliESDCaloCells::GetTime(Short_t pos) const 
 { 
index f1c69f95de8e6b544bbff3ca042d73a9c1135dad..318a47b9aacc5e212ec66b84660cabdd05882399 100644 (file)
@@ -39,12 +39,13 @@ class AliVCaloCells : public TNamed
   virtual void     Sort()                          = 0;
   
   virtual Bool_t   GetCell(Short_t pos, Short_t &cellNumber, Double_t &amplitude, Double_t &time, Int_t &mclabel,    Double_t  &efrac) const = 0;
-  virtual Bool_t   SetCell(Short_t pos, Short_t  cellNumber, Double_t  amplitude, Double_t  time, Int_t  mclabel=-1, Double_t   efrac=0)     = 0;
+  virtual Bool_t   SetCell(Short_t pos, Short_t  cellNumber, Double_t  amplitude, Double_t  time, Int_t  mclabel=-1, Double_t   efrac=0, Bool_t isHG=kTRUE)     = 0;
   
   virtual Short_t  GetNumberOfCells() const              = 0;
   virtual void     SetNumberOfCells(Int_t n)             = 0;
   
   virtual Double_t GetCellAmplitude(Short_t cellNumber)  = 0;
+  virtual Bool_t   GetCellHighGain(Short_t cellNumber)   = 0;
   virtual Double_t GetCellTime(Short_t cellNumber)       = 0;
   virtual Short_t  GetCellPosition(Short_t cellNumber)   = 0;