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 //-------------------------------------------------------------------------
14 #include <AliVCaloCells.h>
17 class AliAODCaloCells : public AliVCaloCells
21 AliAODCaloCells(const char* name, const char* title, VCells_t ttype=kUndef);
22 AliAODCaloCells(const AliAODCaloCells& cells);
23 AliAODCaloCells& operator=(const AliAODCaloCells& cells);
25 virtual ~AliAODCaloCells();
27 void CreateContainer(Short_t nCells);
28 void DeleteContainer();
31 Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time = -1);
33 Short_t GetNumberOfCells() const { return fNCells; }
34 void SetNumberOfCells(Int_t n) { fNCells = n ; }
35 inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t &time) const;
36 inline Double_t GetCellAmplitude(Short_t cellNumber);
37 inline Short_t GetCellPosition(Short_t cellNumber);
38 inline Double_t GetAmplitude(Short_t pos) const;
39 Double_t GetCellTime(Short_t /*cellNumber*/) {return -1;}
40 inline Short_t GetCellNumber(Short_t pos) const;
41 Double_t GetTime(Short_t /*pos*/) const {return -1;}
42 Bool_t IsEMCAL() const {return (fType == kEMCALCell);}
43 Bool_t IsPHOS() const {return (fType == kPHOSCell);}
44 Char_t GetType() const { return fType;}
45 void SetType(Char_t ttype) { fType=ttype; }
49 Int_t fNCells; // Number of cells
50 Short_t *fCellNumber; //[fNCells] array of cell numbers
51 Double32_t *fAmplitude; //[fNCells][0.,0.,16] array with cell amplitudes (= energy!)
52 Bool_t fIsSorted; //! true if cell arrays are sorted by index
53 Char_t fType; // Cell type
56 ClassDef(AliAODCaloCells, 2);
60 Bool_t AliAODCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t& /*time*/) const
62 if (pos>=0 && pos<fNCells) {
63 cellNumber = fCellNumber[pos];
64 amplitude = fAmplitude[pos];
67 Warning("GetCell","Invalid cell array index %d", pos);
73 Double_t AliAODCaloCells::GetCellAmplitude(Short_t cellNumber)
80 Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
81 if (pos>=0 && fCellNumber[pos] == cellNumber) {
82 return fAmplitude[pos];
89 Double_t AliAODCaloCells::GetAmplitude(Short_t pos) const
91 if (pos>=0 && pos<fNCells) {
92 return fAmplitude[pos];
94 Warning("GetAmplitude","Invalid cell array index %d", pos);
100 Short_t AliAODCaloCells::GetCellNumber(Short_t pos) const
102 if (pos>=0 && pos<fNCells) {
103 return fCellNumber[pos];
105 Warning("GetCellNumber","Invalid cell array index %d", pos);
110 Short_t AliAODCaloCells::GetCellPosition(Short_t cellNumber)
117 Int_t nabove, nbelow, middle;
120 nabove = fNCells + 1;
122 while (nabove - nbelow > 1) {
123 middle = (nabove + nbelow) / 2;
124 if (cellNumber == fCellNumber[middle-1]) {
128 if (cellNumber < fCellNumber[middle-1]) nabove = middle;
129 else nbelow = middle;