//_______________________________________________________
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)
{
//_____________________________________________________________________________________
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)
{
//________________________________________________________________
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];
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];
if(fNCells != source.fNCells)
{
+ delete [] fHGLG ;
delete [] fCellNumber;
delete [] fAmplitude;
delete [] fTime;
fNCells = source.fNCells;
+ fHGLG = new Bool_t[fNCells] ;
fCellNumber = new Short_t[fNCells];
fAmplitude = new Double32_t[fNCells];
fTime = new Double32_t[fNCells];
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));
fNCells = nCells;
+ fHGLG = new Bool_t[fNCells];
fCellNumber = new Short_t[fNCells];
fAmplitude = new Double32_t[fNCells];
fTime = new Double32_t[fNCells];
// set to zero
for(int i = 0;i<fNCells;++i)
{
+ fHGLG[i]=kFALSE ;
fAmplitude [i] = 0.;
fCellNumber[i] = -1 ;
fEFraction [i] = 0.;
void AliAODCaloCells::DeleteContainer()
{
// deletes allocated memory
+ if(fHGLG){
+ delete[] fHGLG;
+ fHGLG = 0 ;
+ }
if (fCellNumber)
{
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];
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]];
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;
//________________________________________________________________________________________
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;
void Sort();
inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, 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;
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
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)
{
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
{
//_____________________________________________________
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)
{
//__________________________________________________________
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];
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];
if(fNCells != source.fNCells)
{
+ delete [] fHGLG ;
delete [] fCellNumber;
delete [] fAmplitude;
delete [] fTime;
fNCells = source.fNCells;
+ fHGLG = new Bool_t[fNCells] ;
fCellNumber = new Short_t[fNCells];
fAmplitude = new Double32_t[fNCells];
fTime = new Double32_t[fNCells];
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));
fNCells = nCells;
+ fHGLG = new Bool_t[fNCells];
fCellNumber = new Short_t[fNCells];
fAmplitude = new Double32_t[fNCells];
fTime = new Double32_t[fNCells];
// set to zero
for(int i = 0;i<fNCells;++i)
{
+ fHGLG[i]=kFALSE ;
fAmplitude [i] = 0.;
fCellNumber[i] = -1 ;
fEFraction [i] = 0.;
void AliESDCaloCells::DeleteContainer()
{
// deletes allocated memory
-
+ if(fHGLG){
+ delete[] fHGLG;
+ fHGLG = 0 ;
+ }
+
if (fCellNumber)
{
delete[] fCellNumber;
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];
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]];
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;
//________________________________________________________________________________________
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;
void SetType(Char_t t){ fType = t ; }
inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, 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;
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
}
}
+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) {
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
{
virtual void Sort() = 0;
virtual Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, 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;