1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 // Aug 1, 2007 - cells information in one place
19 #include "AliEMCALCellInfo.h"
20 #include "AliEMCALGeometry.h"
22 #include <TObjArray.h>
26 cellInfo::cellInfo() : absId(-1), nSupMod(-1), nModule(-1), nIphi(-1),
27 nIeta(-1), iPhi(-1), iEta(-1), iPhim(-1), iEtam(-1)
31 ClassImp(AliEMCALCellInfo)
32 // ------------------------------------------------------------------------------
34 AliEMCALCellInfo::AliEMCALCellInfo() : TNamed("",""), fTable(0), fCurrentInd(0)
38 AliEMCALCellInfo::AliEMCALCellInfo(const char* name, const Int_t nrow) : TNamed(name,"table of cell information") , fTable(0), fCurrentInd(0)
40 fTable = new TObjArray(nrow);
43 void AliEMCALCellInfo::AddAt(cellInfo* r)
45 (*fTable)[fCurrentInd] = new cellInfo(*r);
49 AliEMCALCellInfo::~AliEMCALCellInfo()
57 cellInfo* AliEMCALCellInfo::GetTable(Int_t i) const
59 return (cellInfo*)fTable->At(i);
62 void AliEMCALCellInfo::PrintTable(int ind1, int ind2) const
64 printf(" %s : %s : #rows %i \n", GetName(), GetTitle(), fTable->GetSize());
65 if(ind1==-1 && ind2==-1) return;
66 printf(" absId nSupMod nModule nIphi nIeta iPhi iEta iPhim iEtam\n");
67 if(ind1 < 0) ind1 = 0;
68 if(ind2 >= fTable->GetSize()) ind2 = fTable->GetSize();
69 for(int i=ind1; i<ind2; i++) {
70 cellInfo* r = GetTable(i);
72 printf(" %5.5i %2.2i %3.3i %1.1i %1.1i %2.2i %2.2i %2.2i %2.2i\n",
73 r->absId, r->nSupMod, r->nModule, r->nIphi, r->nIeta, r->iPhi, r->iEta, r->iPhim,r->iEtam);
78 AliEMCALCellInfo *AliEMCALCellInfo::GetTableForGeometry(const char* geoName)
80 if(geoName==0) return 0;
81 AliEMCALGeometry *g=AliEMCALGeometry::GetInstance(geoName);
82 return GetTableForGeometry(g);
85 AliEMCALCellInfo *AliEMCALCellInfo::GetTableForGeometry(AliEMCALGeometry *g)
88 AliEMCALCellInfo *t = new AliEMCALCellInfo("CellInfo",g->GetNCells());
90 for(Int_t absid=0; absid<g->GetNCells(); absid++){
94 g->GetCellIndex(r.absId, r.nSupMod, r.nModule, r.nIphi, r.nIeta);
95 g->GetCellPhiEtaIndexInSModule(r.nSupMod,r.nModule,r.nIphi,r.nIeta, r.iPhi,r.iEta);
96 g->GetModulePhiEtaIndexInSModule(r.nSupMod,r.nModule, r.iPhim, r.iEtam);