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