#ifndef ALIESDCALOCELLS_H #define ALIESDCALOCELLS_H /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ /* $Id$ */ /* $Log $ */ //------------------------------------------------------------------------- // ESD class to store calorimeter cell data // Clone of AliAODCaloCells made by Markus Oldenburg, CERN // Author: Gustavo Conesa Balbastre INFN-LNF // //------------------------------------------------------------------------- #include #include class AliESDCaloCells : public TNamed { public: enum ESDCells_t {kUndef = -1, kPHOSCell, kEMCALCell}; AliESDCaloCells(); AliESDCaloCells(const char* name, const char* title, ESDCells_t ttype=kUndef); AliESDCaloCells(const AliESDCaloCells & cells); AliESDCaloCells & operator=(const AliESDCaloCells& source); virtual ~AliESDCaloCells(); Bool_t IsEMCAL() const {return (fType == kEMCALCell);} Bool_t IsPHOS() const {return (fType == kPHOSCell);} Char_t GetType() const { return fType;} void SetType(ESDCells_t ttype) { fType=ttype; } void CreateContainer(Short_t nCells); void DeleteContainer(); void Sort(); Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time); Short_t GetNumberOfCells() const { return fNCells; } void SetNumberOfCells(Int_t n) { fNCells = n ; } inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t &time) const; inline Double_t GetCellAmplitude(Short_t cellNumber); inline Double_t GetCellTime(Short_t cellNumber); inline Double_t GetAmplitude(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 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 fIsSorted; //! true if cell arrays are sorted by index Char_t fType; // Cell type ClassDef(AliESDCaloCells, 1); }; Bool_t AliESDCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t & time) const { if (pos>=0 && pos=0 && pos < fNCells && fCellNumber[pos] == cellNumber ) { return fAmplitude[pos]; } else { Warning("GetCellAmplitude","Wrong cell array index %d", pos); return 0.; } } Double_t AliESDCaloCells::GetCellTime(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 fTime[pos]; } else { Warning("GetCellTime","Wrong cell array index %d", pos); return 0.; } } Double_t AliESDCaloCells::GetAmplitude(Short_t pos) const { if (pos>=0 && pos=0 && pos=0 && pos