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 //-------------------------------------------------------------------------
16 #include <AliVCaloCells.h>
19 class AliESDCaloCells : public AliVCaloCells
24 AliESDCaloCells(const char* name, const char* title, VCells_t ttype=kUndef);
25 AliESDCaloCells(const AliESDCaloCells & cells);
26 AliESDCaloCells & operator=(const AliESDCaloCells& source);
27 virtual ~AliESDCaloCells();
28 virtual void Copy(TObject &obj) const;
29 virtual AliVCaloCells * CopyCaloCells(Bool_t all) const;
32 Bool_t IsEMCAL() const { return (fType == kEMCALCell);}
33 Bool_t IsPHOS() const { return (fType == kPHOSCell) ;}
34 Char_t GetType() const { return fType;}
35 void SetType(Char_t ttype) { fType = ttype; }
37 void CreateContainer(Short_t nCells);
38 void DeleteContainer();
41 Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time);
43 Short_t GetNumberOfCells() const { return fNCells; }
44 void SetNumberOfCells(Int_t n) { fNCells = n ; }
45 inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t &time) const;
46 inline Double_t GetCellAmplitude(Short_t cellNumber);
47 inline Double_t GetCellTime(Short_t cellNumber);
48 inline Double_t GetAmplitude(Short_t pos) const;
49 inline Double_t GetTime(Short_t pos) const;
50 inline Short_t GetCellNumber(Short_t pos) const;
53 Int_t fNCells; // Number of cells
54 Short_t *fCellNumber; //[fNCells] array of cell numbers
55 Double32_t *fAmplitude; //[fNCells][0.,0.,16] array with cell amplitudes (= energy!)
56 Double32_t *fTime; //[fNCells][0.,0.,16] array with cell times
57 Bool_t fIsSorted; //! true if cell arrays are sorted by index
58 Char_t fType; // Cell type
60 ClassDef(AliESDCaloCells, 2);
64 Bool_t AliESDCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t & time) const
66 if (pos>=0 && pos<fNCells) {
67 cellNumber = fCellNumber[pos];
68 amplitude = fAmplitude[pos];
72 Error("GetCell","Invalid cell array index %d", pos);
78 Double_t AliESDCaloCells::GetCellAmplitude(Short_t cellNumber)
85 Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
86 if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber ) {
87 return fAmplitude[pos];
89 Warning("GetCellAmplitude","Wrong cell array index %d", pos);
94 Double_t AliESDCaloCells::GetCellTime(Short_t cellNumber)
101 Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
102 if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber) {
105 Warning("GetCellTime","Wrong cell array index %d", pos);
110 Double_t AliESDCaloCells::GetAmplitude(Short_t pos) const
112 if (pos>=0 && pos<fNCells) {
113 return fAmplitude[pos];
115 Error("GetAmplitude","Invalid cell array index %d", pos);
120 Double_t AliESDCaloCells::GetTime(Short_t pos) const
122 if (pos>=0 && pos<fNCells) {
125 Error("GetTime","Invalid cell array index %d", pos);
130 Short_t AliESDCaloCells::GetCellNumber(Short_t pos) const
132 if (pos>=0 && pos<fNCells) {
133 return fCellNumber[pos];
135 Error("GetCellNumber","Invalid cell array index %d", pos);