]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliAODCaloCells.h
New steering class ro run QA stand alone
[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:
20 enum AODTwrs_t {kUndef = -1,
21 kEMCAL,
22 kPHOS};
23
24 AliAODCaloCells();
25 AliAODCaloCells(const char* name, const char* title, AODTwrs_t ttype=kUndef);
26
27 virtual ~AliAODCaloCells();
28
29 void CreateContainer(Short_t nCells);
30 void DeleteContainer();
31 void Sort();
32
33 Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude);
34
35 Short_t GetNumberOfCells() const { return fNCells; }
36 inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &amplitude) const;
37 inline Double_t GetCellAmplitude(Short_t cellNumber);
38 inline Double_t GetAmplitude(Short_t pos) const;
39 inline Short_t GetCellNumber(Short_t pos) const;
40
41 Char_t GetType() const { return fType;}
42 void SetType(AODTwrs_t ttype) { fType=ttype; }
43
44 protected:
45 Int_t fNCells; // Number of cells
46 Short_t *fCellNumber; //[fNCells] array of cell numbers
47 Double32_t *fAmplitude; //[fNCells][0.,600.,16] array with cell amplitudes (= energy!)
48 Bool_t fIsSorted; //! true if cell arrays are sorted by index
49 Char_t fType; // Cell type
50
51 private:
52 AliAODCaloCells(const AliAODCaloCells& tow);
53 AliAODCaloCells& operator=(const AliAODCaloCells& tow);
54
55 ClassDef(AliAODCaloCells, 1);
56};
57
58
59Bool_t AliAODCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &amplitude) const
60{
61 if (pos>=0 && pos<fNCells) {
62 cellNumber = fCellNumber[pos];
63 amplitude = fAmplitude[pos];
64 return kTRUE;
65 } else {
66 Error("GetCell","Invalid cell array index %d", pos);
67 return kFALSE;
68 }
69}
70
71
72Double_t AliAODCaloCells::GetCellAmplitude(Short_t cellNumber)
73{
74 if (!fIsSorted) {
75 Sort();
76 fIsSorted=kTRUE;
77 }
78
79 Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber);
80 if (pos>=0 && pos == cellNumber) {
81 return fAmplitude[pos];
82 } else {
83 Error("GetCellAmplitude","Wrong cell array index %d", pos);
84 return 0.;
85 }
86}
87
88
89Double_t AliAODCaloCells::GetAmplitude(Short_t pos) const
90{
91 if (pos>=0 && pos<fNCells) {
92 return fAmplitude[pos];
93 } else {
94 Error("GetAmplitude","Invalid cell array index %d", pos);
95 return 0.;
96 }
97}
98
99
100Short_t AliAODCaloCells::GetCellNumber(Short_t pos) const
101{
102 if (pos>=0 && pos<fNCells) {
103 return fCellNumber[pos];
104 } else {
105 Error("GetCellNumber","Invalid cell array index %d", pos);
106 return fNCells;
107 }
108}
109
110
111#endif