]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliAODCaloCells.h
LUTs mapping symnames and original global matrices removed from AliGeomManager, which...
[u/mrichter/AliRoot.git] / STEER / AliAODCaloCells.h
CommitLineData
8d122774 1/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
3
4/* $Id$ */
5
6//-------------------------------------------------------------------------
7// AOD class to store calorimeter cell data
8// Author: Markus Oldenburg, CERN
9//-------------------------------------------------------------------------
10
11#ifndef ALIAODCELLS_H
12#define ALIAODCELLS_H
13
14#include <TNamed.h>
15#include <TMath.h>
16
17class AliAODCaloCells : public TNamed
18{
19 public:
e649177a 20 enum AODCells_t {kUndef = -1,
8d122774 21 kEMCAL,
22 kPHOS};
23
24 AliAODCaloCells();
e649177a 25 AliAODCaloCells(const char* name, const char* title, AODCells_t ttype=kUndef);
5c1dc41f 26 AliAODCaloCells(const AliAODCaloCells& cells);
27 AliAODCaloCells& operator=(const AliAODCaloCells& cells);
8d122774 28
29 virtual ~AliAODCaloCells();
30
31 void CreateContainer(Short_t nCells);
32 void DeleteContainer();
33 void Sort();
34
35 Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude);
36
37 Short_t GetNumberOfCells() const { return fNCells; }
38 inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &amplitude) 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;
42
43 Char_t GetType() const { return fType;}
e649177a 44 void SetType(AODCells_t ttype) { fType=ttype; }
8d122774 45
46 protected:
47 Int_t fNCells; // Number of cells
48 Short_t *fCellNumber; //[fNCells] array of cell numbers
e649177a 49 Double32_t *fAmplitude; //[fNCells][0.,0.,16] array with cell amplitudes (= energy!)
8d122774 50 Bool_t fIsSorted; //! true if cell arrays are sorted by index
51 Char_t fType; // Cell type
52
8d122774 53
54 ClassDef(AliAODCaloCells, 1);
55};
56
57
58Bool_t AliAODCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &amplitude) const
59{
60 if (pos>=0 && pos<fNCells) {
61 cellNumber = fCellNumber[pos];
62 amplitude = fAmplitude[pos];
63 return kTRUE;
64 } else {
37792174 65 Warning("GetCell","Invalid cell array index %d", pos);
8d122774 66 return kFALSE;
67 }
68}
69
70
71Double_t AliAODCaloCells::GetCellAmplitude(Short_t cellNumber)
72{
73 if (!fIsSorted) {
74 Sort();
75 fIsSorted=kTRUE;
76 }
77
78 Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
37792174 79 if (pos>=0 && fCellNumber[pos] == cellNumber) {
8d122774 80 return fAmplitude[pos];
81 } else {
37792174 82 Warning("GetCellAmplitude","Wrong cell array index %d", pos);
8d122774 83 return 0.;
84 }
85}
86
87
88Double_t AliAODCaloCells::GetAmplitude(Short_t pos) const
89{
90 if (pos>=0 && pos<fNCells) {
91 return fAmplitude[pos];
92 } else {
37792174 93 Warning("GetAmplitude","Invalid cell array index %d", pos);
8d122774 94 return 0.;
95 }
96}
97
98
99Short_t AliAODCaloCells::GetCellNumber(Short_t pos) const
100{
101 if (pos>=0 && pos<fNCells) {
102 return fCellNumber[pos];
103 } else {
37792174 104 Warning("GetCellNumber","Invalid cell array index %d", pos);
8d122774 105 return fNCells;
106 }
107}
108
109
110#endif