]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALCellInfo.cxx
remove dummy implmentation of PbinTrd1
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCellInfo.cxx
CommitLineData
46b250ae 1/**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
dfa8c64c 16/* History of cvs commits:
17 *
18* $Log$
19* Revision 1.2 2007/10/16 14:36:39 pavlinov
20* fixed code violation (almost)
21*
22* Revision 1.1 2007/09/12 11:19:24 pavlinov
23* added pi0 calibration, linearity, shower profile
24*
25*/
46b250ae 26
27// Aug 1, 2007 - cells information in one place
28#include "AliEMCALCellInfo.h"
29#include "AliEMCALGeometry.h"
30
31#include <TObjArray.h>
32
b217491f 33ClassImp(AliEMCALCellIndexes)
46b250ae 34
6f377f0c 35// ------------------------------------------------------------------------------
b217491f 36AliEMCALCellIndexes::AliEMCALCellIndexes() : fAbsId(-1), fNSupMod(-1), fNModule(-1), fNIphi(-1),
37fNIeta(-1), fIPhi(-1), fIEta(-1), fIPhim(-1), fIEtam(-1)
46b250ae 38{
39}
40
6f377f0c 41
46b250ae 42ClassImp(AliEMCALCellInfo)
46b250ae 43
6f377f0c 44// ------------------------------------------------------------------------------
46b250ae 45AliEMCALCellInfo::AliEMCALCellInfo() : TNamed("",""), fTable(0), fCurrentInd(0)
46{
6f377f0c 47 //default constructor
48}
49
50// ------------------------------------------------------------------------------
51AliEMCALCellInfo::AliEMCALCellInfo(const AliEMCALCellInfo& info)
52 : TNamed(info.GetName(),info.GetTitle()),
53 fTable(info.fTable), fCurrentInd(info.fCurrentInd)
54{
55 //copy constructor
46b250ae 56}
57
6f377f0c 58// ------------------------------------------------------------------------------
46b250ae 59AliEMCALCellInfo::AliEMCALCellInfo(const char* name, const Int_t nrow) : TNamed(name,"table of cell information") , fTable(0), fCurrentInd(0)
60{
61 fTable = new TObjArray(nrow);
62}
63
6f377f0c 64// ------------------------------------------------------------------------------
b217491f 65void AliEMCALCellInfo::AddAt(AliEMCALCellIndexes* r)
46b250ae 66{
b217491f 67 (*fTable)[fCurrentInd] = new AliEMCALCellIndexes(*r);
46b250ae 68 fCurrentInd++;
69}
70
6f377f0c 71// ------------------------------------------------------------------------------
46b250ae 72AliEMCALCellInfo::~AliEMCALCellInfo()
73{
74 if(fTable) {
75 fTable->Delete();
76 delete fTable;
77 }
78}
79
6f377f0c 80// ------------------------------------------------------------------------------
b217491f 81AliEMCALCellIndexes* AliEMCALCellInfo::GetTable(Int_t i) const
46b250ae 82{
b217491f 83 // Oct 16, 2007
84 return (AliEMCALCellIndexes*)fTable->At(i);
46b250ae 85}
86
6f377f0c 87// ------------------------------------------------------------------------------
46b250ae 88void AliEMCALCellInfo::PrintTable(int ind1, int ind2) const
89{
b217491f 90 // Oct 16, 2007
46b250ae 91 printf(" %s : %s : #rows %i \n", GetName(), GetTitle(), fTable->GetSize());
92 if(ind1==-1 && ind2==-1) return;
b217491f 93 printf(" fAbsId fNSupMod fNModule fNIphi fNIeta fIPhi fIEta fIPhim fIEtam\n");
46b250ae 94 if(ind1 < 0) ind1 = 0;
95 if(ind2 >= fTable->GetSize()) ind2 = fTable->GetSize();
96 for(int i=ind1; i<ind2; i++) {
b217491f 97 AliEMCALCellIndexes* r = GetTable(i);
46b250ae 98 if(r==0) break;
99 printf(" %5.5i %2.2i %3.3i %1.1i %1.1i %2.2i %2.2i %2.2i %2.2i\n",
b217491f 100 r->fAbsId, r->fNSupMod, r->fNModule, r->fNIphi, r->fNIeta, r->fIPhi, r->fIEta, r->fIPhim,r->fIEtam);
46b250ae 101 }
102}
103
6f377f0c 104// ------------------------------------------------------------------------------
46b250ae 105AliEMCALCellInfo *AliEMCALCellInfo::GetTableForGeometry(const char* geoName)
106{
b217491f 107 // Oct 16, 2007
46b250ae 108 if(geoName==0) return 0;
109 AliEMCALGeometry *g=AliEMCALGeometry::GetInstance(geoName);
110 return GetTableForGeometry(g);
111}
112
6f377f0c 113// ------------------------------------------------------------------------------
46b250ae 114AliEMCALCellInfo *AliEMCALCellInfo::GetTableForGeometry(AliEMCALGeometry *g)
115{
b217491f 116 // Oct 16, 2007
46b250ae 117 if(g==0) return 0;
118 AliEMCALCellInfo *t = new AliEMCALCellInfo("CellInfo",g->GetNCells());
119
120 for(Int_t absid=0; absid<g->GetNCells(); absid++){
b217491f 121 AliEMCALCellIndexes r;
122 r.fAbsId = absid;
46b250ae 123
b217491f 124 g->GetCellIndex(r.fAbsId, r.fNSupMod, r.fNModule, r.fNIphi, r.fNIeta);
125 g->GetCellPhiEtaIndexInSModule(r.fNSupMod,r.fNModule,r.fNIphi,r.fNIeta, r.fIPhi,r.fIEta);
126 g->GetModulePhiEtaIndexInSModule(r.fNSupMod,r.fNModule, r.fIPhim, r.fIEtam);
46b250ae 127
128 t->AddAt(&r);
129 }
130 return t;
131}