1 #ifndef ALIESDCALOCELLS_H
2 #define ALIESDCALOCELLS_H
3 /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
8 //-------------------------------------------------------------------------
9 // ESD class to store calorimeter cell data
10 // Clone of AliAODCaloCells made by Markus Oldenburg, CERN
11 // Author: Gustavo Conesa Balbastre INFN-LNF
13 //-------------------------------------------------------------------------
19 class AliESDCaloCells : public TNamed
23 enum ESDCells_t {kUndef = -1,
28 AliESDCaloCells(const char* name, const char* title, ESDCells_t ttype=kUndef);
29 AliESDCaloCells(const AliESDCaloCells & cells);
30 AliESDCaloCells & operator=(const AliESDCaloCells& source);
31 virtual ~AliESDCaloCells();
33 Bool_t IsEMCAL() const {return (fType == kEMCALCell);}
34 Bool_t IsPHOS() const {return (fType == kPHOSCell);}
35 Char_t GetType() const { return fType;}
36 void SetType(ESDCells_t ttype) { fType=ttype; }
38 void CreateContainer(Short_t nCells);
39 void DeleteContainer();
42 Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time);
44 Short_t GetNumberOfCells() const { return fNCells; }
45 void SetNumberOfCells(Int_t n) { fNCells = n ; }
46 inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t &time) const;
47 inline Double_t GetCellAmplitude(Short_t cellNumber);
48 inline Double_t GetCellTime(Short_t cellNumber);
49 inline Double_t GetAmplitude(Short_t pos) const;
50 inline Double_t GetTime(Short_t pos) const;
51 inline Short_t GetCellNumber(Short_t pos) const;
55 Int_t fNCells; // Number of cells
56 Short_t *fCellNumber; //[fNCells] array of cell numbers
57 Double32_t *fAmplitude; //[fNCells][0.,0.,16] array with cell amplitudes (= energy!)
58 Double32_t *fTime; //[fNCells][0.,0.,16] array with cell times
59 Bool_t fIsSorted; //! true if cell arrays are sorted by index
60 Char_t fType; // Cell type
62 ClassDef(AliESDCaloCells, 1);
66 Bool_t AliESDCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t & time) const
68 if (pos>=0 && pos<fNCells) {
69 cellNumber = fCellNumber[pos];
70 amplitude = fAmplitude[pos];
74 Error("GetCell","Invalid cell array index %d", pos);
80 Double_t AliESDCaloCells::GetCellAmplitude(Short_t cellNumber)
87 Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
88 if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber ) {
89 return fAmplitude[pos];
91 Warning("GetCellAmplitude","Wrong cell array index %d", pos);
96 Double_t AliESDCaloCells::GetCellTime(Short_t cellNumber)
103 Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
104 if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber) {
107 Warning("GetCellTime","Wrong cell array index %d", pos);
112 Double_t AliESDCaloCells::GetAmplitude(Short_t pos) const
114 if (pos>=0 && pos<fNCells) {
115 return fAmplitude[pos];
117 Error("GetAmplitude","Invalid cell array index %d", pos);
122 Double_t AliESDCaloCells::GetTime(Short_t pos) const
124 if (pos>=0 && pos<fNCells) {
127 Error("GetTime","Invalid cell array index %d", pos);
132 Short_t AliESDCaloCells::GetCellNumber(Short_t pos) const
134 if (pos>=0 && pos<fNCells) {
135 return fCellNumber[pos];
137 Error("GetCellNumber","Invalid cell array index %d", pos);