]>
Commit | Line | Data |
---|---|---|
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 | ||
b217491f | 16 | /* $Log$ |
17 | /* Revision 1.1 2007/09/12 11:19:24 pavlinov | |
18 | /* added pi0 calibration, linearity, shower profile | |
19 | /* */ | |
46b250ae | 20 | |
21 | // Aug 1, 2007 - cells information in one place | |
22 | #include "AliEMCALCellInfo.h" | |
23 | #include "AliEMCALGeometry.h" | |
24 | ||
25 | #include <TObjArray.h> | |
26 | ||
b217491f | 27 | ClassImp(AliEMCALCellIndexes) |
46b250ae | 28 | |
b217491f | 29 | AliEMCALCellIndexes::AliEMCALCellIndexes() : fAbsId(-1), fNSupMod(-1), fNModule(-1), fNIphi(-1), |
30 | fNIeta(-1), fIPhi(-1), fIEta(-1), fIPhim(-1), fIEtam(-1) | |
46b250ae | 31 | { |
32 | } | |
33 | ||
34 | ClassImp(AliEMCALCellInfo) | |
35 | // ------------------------------------------------------------------------------ | |
36 | ||
37 | AliEMCALCellInfo::AliEMCALCellInfo() : TNamed("",""), fTable(0), fCurrentInd(0) | |
38 | { | |
39 | } | |
40 | ||
41 | AliEMCALCellInfo::AliEMCALCellInfo(const char* name, const Int_t nrow) : TNamed(name,"table of cell information") , fTable(0), fCurrentInd(0) | |
42 | { | |
43 | fTable = new TObjArray(nrow); | |
44 | } | |
45 | ||
b217491f | 46 | void AliEMCALCellInfo::AddAt(AliEMCALCellIndexes* r) |
46b250ae | 47 | { |
b217491f | 48 | (*fTable)[fCurrentInd] = new AliEMCALCellIndexes(*r); |
46b250ae | 49 | fCurrentInd++; |
50 | } | |
51 | ||
52 | AliEMCALCellInfo::~AliEMCALCellInfo() | |
53 | { | |
54 | if(fTable) { | |
55 | fTable->Delete(); | |
56 | delete fTable; | |
57 | } | |
58 | } | |
59 | ||
b217491f | 60 | AliEMCALCellIndexes* AliEMCALCellInfo::GetTable(Int_t i) const |
46b250ae | 61 | { |
b217491f | 62 | // Oct 16, 2007 |
63 | return (AliEMCALCellIndexes*)fTable->At(i); | |
46b250ae | 64 | } |
65 | ||
66 | void AliEMCALCellInfo::PrintTable(int ind1, int ind2) const | |
67 | { | |
b217491f | 68 | // Oct 16, 2007 |
46b250ae | 69 | printf(" %s : %s : #rows %i \n", GetName(), GetTitle(), fTable->GetSize()); |
70 | if(ind1==-1 && ind2==-1) return; | |
b217491f | 71 | printf(" fAbsId fNSupMod fNModule fNIphi fNIeta fIPhi fIEta fIPhim fIEtam\n"); |
46b250ae | 72 | if(ind1 < 0) ind1 = 0; |
73 | if(ind2 >= fTable->GetSize()) ind2 = fTable->GetSize(); | |
74 | for(int i=ind1; i<ind2; i++) { | |
b217491f | 75 | AliEMCALCellIndexes* r = GetTable(i); |
46b250ae | 76 | if(r==0) break; |
77 | printf(" %5.5i %2.2i %3.3i %1.1i %1.1i %2.2i %2.2i %2.2i %2.2i\n", | |
b217491f | 78 | r->fAbsId, r->fNSupMod, r->fNModule, r->fNIphi, r->fNIeta, r->fIPhi, r->fIEta, r->fIPhim,r->fIEtam); |
46b250ae | 79 | } |
80 | } | |
81 | ||
82 | ||
83 | AliEMCALCellInfo *AliEMCALCellInfo::GetTableForGeometry(const char* geoName) | |
84 | { | |
b217491f | 85 | // Oct 16, 2007 |
46b250ae | 86 | if(geoName==0) return 0; |
87 | AliEMCALGeometry *g=AliEMCALGeometry::GetInstance(geoName); | |
88 | return GetTableForGeometry(g); | |
89 | } | |
90 | ||
91 | AliEMCALCellInfo *AliEMCALCellInfo::GetTableForGeometry(AliEMCALGeometry *g) | |
92 | { | |
b217491f | 93 | // Oct 16, 2007 |
46b250ae | 94 | if(g==0) return 0; |
95 | AliEMCALCellInfo *t = new AliEMCALCellInfo("CellInfo",g->GetNCells()); | |
96 | ||
97 | for(Int_t absid=0; absid<g->GetNCells(); absid++){ | |
b217491f | 98 | AliEMCALCellIndexes r; |
99 | r.fAbsId = absid; | |
46b250ae | 100 | |
b217491f | 101 | g->GetCellIndex(r.fAbsId, r.fNSupMod, r.fNModule, r.fNIphi, r.fNIeta); |
102 | g->GetCellPhiEtaIndexInSModule(r.fNSupMod,r.fNModule,r.fNIphi,r.fNIeta, r.fIPhi,r.fIEta); | |
103 | g->GetModulePhiEtaIndexInSModule(r.fNSupMod,r.fNModule, r.fIPhim, r.fIEtam); | |
46b250ae | 104 | |
105 | t->AddAt(&r); | |
106 | } | |
107 | return t; | |
108 | } |