1 /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
6 //-------------------------------------------------------------------------
7 // AOD class to store calorimeter cell data
8 // Author: Markus Oldenburg, CERN
9 //-------------------------------------------------------------------------
17 class AliAODCaloCells : public TNamed
20 enum AODCells_t {kUndef = -1,
25 AliAODCaloCells(const char* name, const char* title, AODCells_t ttype=kUndef);
26 AliAODCaloCells(const AliAODCaloCells& cells);
27 AliAODCaloCells& operator=(const AliAODCaloCells& cells);
29 virtual ~AliAODCaloCells();
31 void CreateContainer(Short_t nCells);
32 void DeleteContainer();
35 Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude);
37 Short_t GetNumberOfCells() const { return fNCells; }
38 inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude) const;
39 inline Double_t GetCellAmplitude(Short_t cellNumber);
40 inline Double_t GetAmplitude(Short_t pos) const;
41 inline Short_t GetCellNumber(Short_t pos) const;
43 Char_t GetType() const { return fType;}
44 void SetType(AODCells_t ttype) { fType=ttype; }
47 Int_t fNCells; // Number of cells
48 Short_t *fCellNumber; //[fNCells] array of cell numbers
49 Double32_t *fAmplitude; //[fNCells][0.,0.,16] array with cell amplitudes (= energy!)
50 Bool_t fIsSorted; //! true if cell arrays are sorted by index
51 Char_t fType; // Cell type
54 ClassDef(AliAODCaloCells, 1);
58 Bool_t AliAODCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude) const
60 if (pos>=0 && pos<fNCells) {
61 cellNumber = fCellNumber[pos];
62 amplitude = fAmplitude[pos];
65 Warning("GetCell","Invalid cell array index %d", pos);
71 Double_t AliAODCaloCells::GetCellAmplitude(Short_t cellNumber)
78 Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
79 if (pos>=0 && fCellNumber[pos] == cellNumber) {
80 return fAmplitude[pos];
82 Warning("GetCellAmplitude","Wrong cell array index %d", pos);
88 Double_t AliAODCaloCells::GetAmplitude(Short_t pos) const
90 if (pos>=0 && pos<fNCells) {
91 return fAmplitude[pos];
93 Warning("GetAmplitude","Invalid cell array index %d", pos);
99 Short_t AliAODCaloCells::GetCellNumber(Short_t pos) const
101 if (pos>=0 && pos<fNCells) {
102 return fCellNumber[pos];
104 Warning("GetCellNumber","Invalid cell array index %d", pos);