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();
32 virtual void Copy(TObject &obj) const;
34 Bool_t IsEMCAL() const {return (fType == kEMCALCell);}
35 Bool_t IsPHOS() const {return (fType == kPHOSCell);}
36 Char_t GetType() const { return fType;}
37 void SetType(ESDCells_t ttype) { fType=ttype; }
39 void CreateContainer(Short_t nCells);
40 void DeleteContainer();
43 Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time);
45 Short_t GetNumberOfCells() const { return fNCells; }
46 void SetNumberOfCells(Int_t n) { fNCells = n ; }
47 inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t &time) const;
48 inline Double_t GetCellAmplitude(Short_t cellNumber);
49 inline Double_t GetCellTime(Short_t cellNumber);
50 inline Double_t GetAmplitude(Short_t pos) const;
51 inline Double_t GetTime(Short_t pos) const;
52 inline Short_t GetCellNumber(Short_t pos) const;
56 Int_t fNCells; // Number of cells
57 Short_t *fCellNumber; //[fNCells] array of cell numbers
58 Double32_t *fAmplitude; //[fNCells][0.,0.,16] array with cell amplitudes (= energy!)
59 Double32_t *fTime; //[fNCells][0.,0.,16] array with cell times
60 Bool_t fIsSorted; //! true if cell arrays are sorted by index
61 Char_t fType; // Cell type
63 ClassDef(AliESDCaloCells, 1);
67 Bool_t AliESDCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t & time) const
69 if (pos>=0 && pos<fNCells) {
70 cellNumber = fCellNumber[pos];
71 amplitude = fAmplitude[pos];
75 Error("GetCell","Invalid cell array index %d", pos);
81 Double_t AliESDCaloCells::GetCellAmplitude(Short_t cellNumber)
88 Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
89 if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber ) {
90 return fAmplitude[pos];
92 Warning("GetCellAmplitude","Wrong cell array index %d", pos);
97 Double_t AliESDCaloCells::GetCellTime(Short_t cellNumber)
104 Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
105 if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber) {
108 Warning("GetCellTime","Wrong cell array index %d", pos);
113 Double_t AliESDCaloCells::GetAmplitude(Short_t pos) const
115 if (pos>=0 && pos<fNCells) {
116 return fAmplitude[pos];
118 Error("GetAmplitude","Invalid cell array index %d", pos);
123 Double_t AliESDCaloCells::GetTime(Short_t pos) const
125 if (pos>=0 && pos<fNCells) {
128 Error("GetTime","Invalid cell array index %d", pos);
133 Short_t AliESDCaloCells::GetCellNumber(Short_t pos) const
135 if (pos>=0 && pos<fNCells) {
136 return fCellNumber[pos];
138 Error("GetCellNumber","Invalid cell array index %d", pos);