]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALGeometry.cxx
Event type and timestamp from the raw event header is now stored in the ESD (M.Ivanov)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALGeometry.cxx
CommitLineData
e5a93224 1/**************************************************************************
2012850d 2 * Copyright(c) 1998-1999, 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/* $Id$*/
17
18//_________________________________________________________________________
19// Geometry class for EMCAL : singleton
b13bbe81 20// EMCAL consists of layers of scintillator and lead
ffa6d63b 21// Places the the Barrel Geometry of The EMCAL at Midrapidity
d87bd045 22// between 80 and 180(or 190) degrees of Phi and
ffa6d63b 23// -0.7 to 0.7 in eta
24// Number of Modules and Layers may be controlled by
25// the name of the instance defined
b13bbe81 26//*-- Author: Sahal Yacoob (LBL / UCT)
27// and : Yves Schutz (SUBATECH)
28// and : Jennifer Klay (LBL)
1963b290 29// SHASHLYK : Aleksei Pavlinov (WSU)
c63c3c5d 30// SuperModules -> module(or tower) -> cell
2012850d 31
2012850d 32// --- AliRoot header files ---
1ceeec56 33#include <assert.h>
e52475ed 34#include "Riostream.h"
35
ca8f5bd0 36#include <TMath.h>
116cbefd 37#include <TVector3.h>
dc7da436 38 //#include <TArrayD.h>
c63c3c5d 39#include <TObjArray.h>
e52475ed 40#include <TGeoManager.h>
41#include <TGeoNode.h>
42#include <TGeoMatrix.h>
f0377b23 43#include <TMatrixD.h>
d434833b 44#include <TObjString.h>
f0377b23 45#include <TClonesArray.h>
173558f2 46
ca8f5bd0 47// -- ALICE Headers.
d64c959b 48//#include "AliConst.h"
e5a93224 49#include "AliLog.h"
173558f2 50
ca8f5bd0 51// --- EMCAL headers
52#include "AliEMCALGeometry.h"
e52475ed 53#include "AliEMCALShishKebabTrd1Module.h"
e52475ed 54#include "AliEMCALRecPoint.h"
f0377b23 55#include "AliEMCALDigit.h"
d434833b 56#include "AliEMCALHistoUtilities.h"
2012850d 57
925e6570 58ClassImp(AliEMCALGeometry)
2012850d 59
d434833b 60// these initialisations are needed for a singleton
61AliEMCALGeometry *AliEMCALGeometry::fgGeom = 0;
62Bool_t AliEMCALGeometry::fgInit = kFALSE;
d434833b 63
dc7da436 64
9cff4509 65AliEMCALGeometry::AliEMCALGeometry()
66 : AliGeometry(),
67 fGeoName(0),fArrayOpts(0),fAlFrontThick(0.),fECPbRadThickness(0.),fECScintThick(0.),
68 fNECLayers(0),fArm1PhiMin(0.),fArm1PhiMax(0.),fArm1EtaMin(0.),fArm1EtaMax(0.),fIPDistance(0.),
69 fShellThickness(0.),fZLength(0.),fGap2Active(0.),fNZ(0),fNPhi(0),fSampling(0.),fNumberOfSuperModules(0),
70 fSteelFrontThick(0.),fFrontSteelStrip(0.),fLateralSteelStrip(0.),fPassiveScintThick(0.),fPhiModuleSize(0.),
71 fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fLongModuleSize(0.),fNPhiSuperModule(0),fNPHIdiv(0),fNETAdiv(0),
72 fNCells(0),fNCellsInSupMod(0),fNCellsInTower(0),fNTRU(0),fNTRUEta(0),fNTRUPhi(0),fTrd1Angle(0.),f2Trd1Dx2(0.),
73 fPhiGapForSM(0.),fKey110DEG(0),fTrd2AngleY(0.),f2Trd2Dy2(0.),fEmptySpace(0.),fTubsR(0.),fTubsTurnAngle(0.),fEtaCentersOfCells(0),
74 fXCentersOfCells(0),fPhiCentersOfCells(0),fShishKebabTrd1Modules(),fNAdditionalOpts(0)
dc7da436 75{
76 // default ctor only for internal usage (singleton)
77 // must be kept public for root persistency purposes, but should never be called by the outside world
78 // CreateListOfTrd1Modules();
79 AliDebug(2, "AliEMCALGeometry : default ctor ");
80}
81//______________________________________________________________________
9cff4509 82AliEMCALGeometry::AliEMCALGeometry(const Text_t* name, const Text_t* title)
83 : AliGeometry(name, title),
84 fGeoName(0),fArrayOpts(0),fAlFrontThick(0.),fECPbRadThickness(0.),fECScintThick(0.),
85 fNECLayers(0),fArm1PhiMin(0.),fArm1PhiMax(0.),fArm1EtaMin(0.),fArm1EtaMax(0.),fIPDistance(0.),
86 fShellThickness(0.),fZLength(0.),fGap2Active(0.),fNZ(0),fNPhi(0),fSampling(0.),fNumberOfSuperModules(0),
87 fSteelFrontThick(0.),fFrontSteelStrip(0.),fLateralSteelStrip(0.),fPassiveScintThick(0.),fPhiModuleSize(0.),
88 fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fLongModuleSize(0.),fNPhiSuperModule(0),fNPHIdiv(0),fNETAdiv(0),
89 fNCells(0),fNCellsInSupMod(0),fNCellsInTower(0),fNTRU(0),fNTRUEta(0),fNTRUPhi(0),fTrd1Angle(0.),f2Trd1Dx2(0.),
90 fPhiGapForSM(0.),fKey110DEG(0),fTrd2AngleY(0.),f2Trd2Dy2(0.),fEmptySpace(0.),fTubsR(0.),fTubsTurnAngle(0.),fEtaCentersOfCells(0),
91 fXCentersOfCells(0),fPhiCentersOfCells(0),fShishKebabTrd1Modules(),fNAdditionalOpts(0)
92{
93 // ctor only for internal usage (singleton)
dc7da436 94 AliDebug(2, Form("AliEMCALGeometry(%s,%s) ", name,title));
95 Init();
96 CreateListOfTrd1Modules();
97}
0a4cb131 98//______________________________________________________________________
9cff4509 99AliEMCALGeometry::AliEMCALGeometry(const AliEMCALGeometry& geom)
100 : AliGeometry(geom),
101 fGeoName(geom.fGeoName),
102 fArrayOpts(geom.fArrayOpts),
103 fAlFrontThick(geom.fAlFrontThick),
104 fECPbRadThickness(geom.fECPbRadThickness),
105 fECScintThick(geom.fECScintThick),
106 fNECLayers(geom.fNECLayers),
107 fArm1PhiMin(geom.fArm1PhiMin),
108 fArm1PhiMax(geom.fArm1PhiMax),
109 fArm1EtaMin(geom.fArm1EtaMin),
110 fArm1EtaMax(geom.fArm1EtaMax),
111 fIPDistance(geom.fIPDistance),
112 fShellThickness(geom.fShellThickness),
113 fZLength(geom.fZLength),
114 fGap2Active(geom.fGap2Active),
115 fNZ(geom.fNZ),
116 fNPhi(geom.fNPhi),
117 fSampling(geom.fSampling),
118 fNumberOfSuperModules(geom.fNumberOfSuperModules),
119 fSteelFrontThick(geom.fSteelFrontThick),
120 fFrontSteelStrip(geom.fFrontSteelStrip),
121 fLateralSteelStrip(geom.fLateralSteelStrip),
122 fPassiveScintThick(geom.fPassiveScintThick),
123 fPhiModuleSize(geom.fPhiModuleSize),
124 fEtaModuleSize(geom.fEtaModuleSize),
125 fPhiTileSize(geom.fPhiTileSize),
126 fEtaTileSize(geom.fEtaTileSize),
127 fLongModuleSize(geom.fLongModuleSize),
128 fNPhiSuperModule(geom.fNPhiSuperModule),
129 fNPHIdiv(geom.fNPHIdiv),
130 fNETAdiv(geom.fNETAdiv),
131 fNCells(geom.fNCells),
132 fNCellsInSupMod(geom.fNCellsInSupMod),
133 fNCellsInTower(geom.fNCellsInTower),
134 fNTRU(geom.fNTRU),
135 fNTRUEta(geom.fNTRUEta),
136 fNTRUPhi(geom.fNTRUPhi),
137 fTrd1Angle(geom.fTrd1Angle),
138 f2Trd1Dx2(geom.f2Trd1Dx2),
139 fPhiGapForSM(geom.fPhiGapForSM),
140 fKey110DEG(geom.fKey110DEG),
141 fTrd2AngleY(geom.fTrd2AngleY),
142 f2Trd2Dy2(geom.f2Trd2Dy2),
143 fEmptySpace(geom.fEmptySpace),
144 fTubsR(geom.fTubsR),
145 fTubsTurnAngle(geom.fTubsTurnAngle),
146 fEtaCentersOfCells(geom.fEtaCentersOfCells),
147 fXCentersOfCells(geom.fXCentersOfCells),
148 fPhiCentersOfCells(geom.fPhiCentersOfCells),
149 fShishKebabTrd1Modules(geom.fShishKebabTrd1Modules),
150 fNAdditionalOpts(geom.fNAdditionalOpts)
151{
0a4cb131 152 //copy ctor
0a4cb131 153}
154
b13bbe81 155//______________________________________________________________________
156AliEMCALGeometry::~AliEMCALGeometry(void){
157 // dtor
2012850d 158}
395c7ba2 159//______________________________________________________________________
160void AliEMCALGeometry::Init(void){
161 // Initializes the EMCAL parameters
fdebddeb 162 // naming convention : GUV_WX_N_ gives the composition of a tower
395c7ba2 163 // WX inform about the composition of the EM calorimeter section:
fdebddeb 164 // thickness in mm of Pb radiator (W) and of scintillator (X), and number of scintillator layers (N)
165 // New geometry: EMCAL_55_25
1963b290 166 // 24-aug-04 for shish-kebab
167 // SHISH_25 or SHISH_62
c63c3c5d 168 // 11-oct-05 - correction for pre final design
169 // Feb 06,2006 - decrease the weight of EMCAL
fc575e27 170
b44d5aa4 171 fAdditionalOpts[0] = "nl="; // number of sampling layers (fNECLayers)
172 fAdditionalOpts[1] = "pbTh="; // cm, Thickness of the Pb (fECPbRadThick)
173 fAdditionalOpts[2] = "scTh="; // cm, Thickness of the Sc (fECScintThick)
174 fAdditionalOpts[3] = "latSS="; // cm, Thickness of lateral steel strip (fLateralSteelStrip)
fc575e27 175
176 fNAdditionalOpts = sizeof(fAdditionalOpts) / sizeof(char*);
177
fdebddeb 178 fgInit = kFALSE; // Assume failed until proven otherwise.
fc575e27 179 fGeoName = GetName();
180 fGeoName.ToUpper();
d87bd045 181 fKey110DEG = 0;
fc575e27 182 if(fGeoName.Contains("110DEG")) fKey110DEG = 1; // for GetAbsCellId
e52475ed 183 fShishKebabTrd1Modules = 0;
184 fTrd2AngleY = f2Trd2Dy2 = fEmptySpace = fTubsR = fTubsTurnAngle = 0;
1963b290 185
186 fNZ = 114; // granularity along Z (eta)
187 fNPhi = 168; // granularity in phi (azimuth)
188 fArm1PhiMin = 60.0; // degrees, Starting EMCAL Phi position
189 fArm1PhiMax = 180.0; // degrees, Ending EMCAL Phi position
190 fArm1EtaMin = -0.7; // pseudorapidity, Starting EMCAL Eta position
191 fArm1EtaMax = +0.7; // pseudorapidity, Ending EMCAL Eta position
192 fIPDistance = 454.0; // cm, Radial distance to inner surface of EMCAL
905263da 193 fPhiGapForSM = 0.; // cm, only for final TRD1 geometry
e52475ed 194 for(int i=0; i<12; i++) fMatrixOfSM[i] = 0;
1963b290 195
196 // geometry
fc575e27 197 if(fGeoName.Contains("SHISH")){ // Only shahslyk now
905263da 198 // 7-sep-05; integration issue
199 fArm1PhiMin = 80.0; // 60 -> 80
c01485dd 200 fArm1PhiMax = 180.0; // 180 -> 190
905263da 201
202 fNumberOfSuperModules = 10; // 12 = 6 * 2 (6 in phi, 2 in Z);
1963b290 203 fSteelFrontThick = 2.54; // 9-sep-04
204 fIPDistance = 460.0;
205 fFrontSteelStrip = fPassiveScintThick = 0.0; // 13-may-05
206 fLateralSteelStrip = 0.025; // before MAY 2005
207 fPhiModuleSize = fEtaModuleSize = 11.4;
208 fPhiTileSize = fEtaTileSize = 5.52; // (11.4-5.52*2)/2. = 0.18 cm (wall thickness)
209 fNPhi = 14;
210 fNZ = 30;
211 fAlFrontThick = fGap2Active = 0;
212 fNPHIdiv = fNETAdiv = 2;
213
214 fNECLayers = 62;
215 fECScintThick = fECPbRadThickness = 0.2;
216 fSampling = 1.; // 30-aug-04 - should be calculated
fc575e27 217 if(fGeoName.Contains("TWIST")) { // all about EMCAL module
1963b290 218 fNZ = 27; // 16-sep-04
fc575e27 219 } else if(fGeoName.Contains("TRD")) {
1963b290 220 fIPDistance = 428.0; // 11-may-05
221 fSteelFrontThick = 0.0; // 3.17 -> 0.0; 28-mar-05 : no stell plate
222 fNPhi = 12;
223 fSampling = 12.327;
224 fPhiModuleSize = fEtaModuleSize = 12.26;
225 fNZ = 26; // 11-oct-04
226 fTrd1Angle = 1.3; // in degree
227// 18-nov-04; 1./0.08112=12.327
228// http://pdsfweb01.nersc.gov/~pavlinov/ALICE/SHISHKEBAB/RES/linearityAndResolutionForTRD1.html
fc575e27 229 if(fGeoName.Contains("TRD1")) { // 30-jan-05
1963b290 230 // for final design
905263da 231 fPhiGapForSM = 2.; // cm, only for final TRD1 geometry
fc575e27 232 if(fGeoName.Contains("MAY05") || fGeoName.Contains("WSUC") || fGeoName.Contains("FINAL")){
1963b290 233 fNumberOfSuperModules = 12; // 20-may-05
fc575e27 234 if(fGeoName.Contains("WSUC")) fNumberOfSuperModules = 1; // 27-may-05
1963b290 235 fNECLayers = 77; // (13-may-05 from V.Petrov)
236 fPhiModuleSize = 12.5; // 20-may-05 - rectangular shape
237 fEtaModuleSize = 11.9;
238 fECScintThick = fECPbRadThickness = 0.16;// (13-may-05 from V.Petrov)
239 fFrontSteelStrip = 0.025;// 0.025cm = 0.25mm (13-may-05 from V.Petrov)
240 fLateralSteelStrip = 0.01; // 0.01cm = 0.1mm (13-may-05 from V.Petrov) - was 0.025
241 fPassiveScintThick = 0.8; // 0.8cm = 8mm (13-may-05 from V.Petrov)
242 fNZ = 24;
243 fTrd1Angle = 1.5; // 1.3 or 1.5
905263da 244
fc575e27 245 if(fGeoName.Contains("FINAL")) { // 9-sep-05
905263da 246 fNumberOfSuperModules = 10;
fc575e27 247 if(fGeoName.Contains("110DEG")) {
d87bd045 248 fNumberOfSuperModules = 12;// last two modules have size 10 degree in phi (180<phi<190)
249 fArm1PhiMax = 200.0; // for XEN1 and turn angle of super modules
250 }
905263da 251 fPhiModuleSize = 12.26 - fPhiGapForSM / Float_t(fNPhi); // first assumption
252 fEtaModuleSize = fPhiModuleSize;
fc575e27 253 if(fGeoName.Contains("HUGE")) fNECLayers *= 3; // 28-oct-05 for analysing leakage
905263da 254 }
1963b290 255 }
fc575e27 256 } else if(fGeoName.Contains("TRD2")) { // 30-jan-05
1963b290 257 fSteelFrontThick = 0.0; // 11-mar-05
258 fIPDistance+= fSteelFrontThick; // 1-feb-05 - compensate absence of steel plate
259 fTrd1Angle = 1.64; // 1.3->1.64
260 fTrd2AngleY = fTrd1Angle; // symmetric case now
261 fEmptySpace = 0.2; // 2 mm
262 fTubsR = fIPDistance; // 31-jan-05 - as for Fred case
263
264 fPhiModuleSize = fTubsR*2.*TMath::Tan(fTrd2AngleY*TMath::DegToRad()/2.);
265 fPhiModuleSize -= fEmptySpace/2.; // 11-mar-05
266 fEtaModuleSize = fPhiModuleSize; // 20-may-05
267 fTubsTurnAngle = 3.;
268 }
269 fNPHIdiv = fNETAdiv = 2; // 13-oct-04 - division again
fc575e27 270 if(fGeoName.Contains("3X3")) { // 23-nov-04
1963b290 271 fNPHIdiv = fNETAdiv = 3;
fc575e27 272 } else if(fGeoName.Contains("4X4")) {
1963b290 273 fNPHIdiv = fNETAdiv = 4;
274 }
275 }
fc575e27 276 if(fGeoName.Contains("25")){
1963b290 277 fNECLayers = 25;
278 fECScintThick = fECPbRadThickness = 0.5;
279 }
fc575e27 280 if(fGeoName.Contains("WSUC")){ // 18-may-05 - about common structure
1963b290 281 fShellThickness = 30.; // should be change
282 fNPhi = fNZ = 4;
283 }
c63c3c5d 284
fc575e27 285 CheckAdditionalOptions();
25b033cf 286 DefineSamplingFraction();
c63c3c5d 287
31b39a2e 288 fPhiTileSize = fPhiModuleSize/2. - fLateralSteelStrip; // 13-may-05
289 fEtaTileSize = fEtaModuleSize/2. - fLateralSteelStrip; // 13-may-05
290
1963b290 291 // constant for transition absid <--> indexes
292 fNCellsInTower = fNPHIdiv*fNETAdiv;
293 fNCellsInSupMod = fNCellsInTower*fNPhi*fNZ;
294 fNCells = fNCellsInSupMod*fNumberOfSuperModules;
fc575e27 295 if(fGeoName.Contains("110DEG")) fNCells -= fNCellsInSupMod;
1963b290 296
297 fLongModuleSize = fNECLayers*(fECScintThick + fECPbRadThickness);
fc575e27 298 if(fGeoName.Contains("MAY05")) fLongModuleSize += (fFrontSteelStrip + fPassiveScintThick);
1963b290 299
300 // 30-sep-04
fc575e27 301 if(fGeoName.Contains("TRD")) {
1963b290 302 f2Trd1Dx2 = fEtaModuleSize + 2.*fLongModuleSize*TMath::Tan(fTrd1Angle*TMath::DegToRad()/2.);
fc575e27 303 if(fGeoName.Contains("TRD2")) { // 27-jan-05
1963b290 304 f2Trd2Dy2 = fPhiModuleSize + 2.*fLongModuleSize*TMath::Tan(fTrd2AngleY*TMath::DegToRad()/2.);
305 }
306 }
fc575e27 307 } else Fatal("Init", "%s is an undefined geometry!", fGeoName.Data()) ;
fdebddeb 308
1963b290 309 fNPhiSuperModule = fNumberOfSuperModules/2;
310 if(fNPhiSuperModule<1) fNPhiSuperModule = 1;
fdebddeb 311 //There is always one more scintillator than radiator layer because of the first block of aluminium
312 fShellThickness = fAlFrontThick + fGap2Active + fNECLayers*GetECScintThick()+(fNECLayers-1)*GetECPbRadThick();
fc575e27 313 if(fGeoName.Contains("SHISH")) {
1963b290 314 fShellThickness = fSteelFrontThick + fLongModuleSize;
fc575e27 315 if(fGeoName.Contains("TWIST")) { // 13-sep-04
1963b290 316 fShellThickness = TMath::Sqrt(fLongModuleSize*fLongModuleSize + fPhiModuleSize*fEtaModuleSize);
317 fShellThickness += fSteelFrontThick;
fc575e27 318 } else if(fGeoName.Contains("TRD")) { // 1-oct-04
1963b290 319 fShellThickness = TMath::Sqrt(fLongModuleSize*fLongModuleSize + f2Trd1Dx2*f2Trd1Dx2);
320 fShellThickness += fSteelFrontThick;
e52475ed 321 // Local coordinates
322 fParSM[0] = GetShellThickness()/2.;
323 fParSM[1] = GetPhiModuleSize() * GetNPhi()/2.;
324 fParSM[2] = 350./2.;
1963b290 325 }
326 }
fdebddeb 327
395c7ba2 328 fZLength = 2.*ZFromEtaR(fIPDistance+fShellThickness,fArm1EtaMax); // Z coverage
329 fEnvelop[0] = fIPDistance; // mother volume inner radius
330 fEnvelop[1] = fIPDistance + fShellThickness; // mother volume outer r.
331 fEnvelop[2] = 1.00001*fZLength; // add some padding for mother volume.
9cff4509 332
333 fNumberOfSuperModules = 12;
d434833b 334
395c7ba2 335 fgInit = kTRUE;
336
e5a93224 337 if (AliDebugLevel()>=2) {
fc575e27 338 printf("Init: geometry of EMCAL named %s is as follows:\n", fGeoName.Data());
e52475ed 339 printf( " ECAL : %d x (%f cm Pb, %f cm Sc) \n",
340 GetNECLayers(), GetECPbRadThick(), GetECScintThick() ) ;
341 printf(" fSampling %5.2f \n", fSampling );
fc575e27 342 if(fGeoName.Contains("SHISH")){
1963b290 343 printf(" fIPDistance %6.3f cm \n", fIPDistance);
344 if(fSteelFrontThick>0.)
345 printf(" fSteelFrontThick %6.3f cm \n", fSteelFrontThick);
346 printf(" fNPhi %i | fNZ %i \n", fNPhi, fNZ);
d87bd045 347 printf(" fNCellsInTower %i : fNCellsInSupMod %i : fNCells %i\n",fNCellsInTower, fNCellsInSupMod, fNCells);
fc575e27 348 if(fGeoName.Contains("MAY05")){
1963b290 349 printf(" fFrontSteelStrip %6.4f cm (thickness of front steel strip)\n",
350 fFrontSteelStrip);
351 printf(" fLateralSteelStrip %6.4f cm (thickness of lateral steel strip)\n",
352 fLateralSteelStrip);
353 printf(" fPassiveScintThick %6.4f cm (thickness of front passive Sc tile)\n",
354 fPassiveScintThick);
355 }
c63c3c5d 356 printf(" X:Y module size %6.3f , %6.3f cm \n", fPhiModuleSize, fEtaModuleSize);
357 printf(" X:Y tile size %6.3f , %6.3f cm \n", fPhiTileSize, fEtaTileSize);
358 printf(" #of sampling layers %i(fNECLayers) \n", fNECLayers);
359 printf(" fLongModuleSize %6.3f cm \n", fLongModuleSize);
1963b290 360 printf(" #supermodule in phi direction %i \n", fNPhiSuperModule );
361 }
fc575e27 362 if(fGeoName.Contains("TRD")) {
1963b290 363 printf(" fTrd1Angle %7.4f\n", fTrd1Angle);
364 printf(" f2Trd1Dx2 %7.4f\n", f2Trd1Dx2);
fc575e27 365 if(fGeoName.Contains("TRD2")) {
1963b290 366 printf(" fTrd2AngleY %7.4f\n", fTrd2AngleY);
367 printf(" f2Trd2Dy2 %7.4f\n", f2Trd2Dy2);
905263da 368 printf(" fTubsR %7.2f cm\n", fTubsR);
1963b290 369 printf(" fTubsTurnAngle %7.4f\n", fTubsTurnAngle);
905263da 370 printf(" fEmptySpace %7.4f cm\n", fEmptySpace);
fc575e27 371 } else if(fGeoName.Contains("TRD1") && fGeoName.Contains("FINAL")){
e52475ed 372 printf("SM dimensions(TRD1) : dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
373 fParSM[0],fParSM[1],fParSM[2]);
905263da 374 printf(" fPhiGapForSM %7.4f cm \n", fPhiGapForSM);
fc575e27 375 if(fGeoName.Contains("110DEG"))printf(" Last two modules have size 10 degree in phi (180<phi<190)\n");
1963b290 376 }
377 }
88cb7938 378 printf("Granularity: %d in eta and %d in phi\n", GetNZ(), GetNPhi()) ;
1963b290 379 printf("Layout: phi = (%7.1f, %7.1f), eta = (%5.2f, %5.2f), IP = %7.2f\n",
380 GetArm1PhiMin(), GetArm1PhiMax(),GetArm1EtaMin(), GetArm1EtaMax(), GetIPDistance() );
88cb7938 381 }
f0377b23 382 //TRU parameters. These parameters values are not the final ones.
383 fNTRU = 3 ;
384 fNTRUEta = 3 ;
385 fNTRUPhi = 1 ;
2012850d 386}
173558f2 387
c63c3c5d 388//______________________________________________________________________
389
fc575e27 390void AliEMCALGeometry::CheckAdditionalOptions()
391{
392 // Feb 06,2006
393 //Additional options that
394 //can be used to select
395 //the specific geometry of
396 //EMCAL to run
397
c63c3c5d 398 fArrayOpts = new TObjArray;
fc575e27 399 Int_t nopt = AliEMCALHistoUtilities::ParseString(fGeoName, *fArrayOpts);
c63c3c5d 400 if(nopt==1) { // no aditional option(s)
401 fArrayOpts->Delete();
402 delete fArrayOpts;
403 fArrayOpts = 0;
404 return;
405 }
406 for(Int_t i=1; i<nopt; i++){
407 TObjString *o = (TObjString*)fArrayOpts->At(i);
408
409 TString addOpt = o->String();
410 Int_t indj=-1;
fc575e27 411 for(Int_t j=0; j<fNAdditionalOpts; j++) {
412 TString opt = fAdditionalOpts[j];
c63c3c5d 413 if(addOpt.Contains(opt,TString::kIgnoreCase)) {
414 indj = j;
415 break;
416 }
417 }
418 if(indj<0) {
e5a93224 419 AliDebug(2,Form("<E> option |%s| unavailable : ** look to the file AliEMCALGeometry.h **\n",
420 addOpt.Data()));
c63c3c5d 421 assert(0);
422 } else {
e5a93224 423 AliDebug(2,Form("<I> option |%s| is valid : number %i : |%s|\n",
424 addOpt.Data(), indj, fAdditionalOpts[indj]));
c63c3c5d 425 if (addOpt.Contains("NL=",TString::kIgnoreCase)) {// number of sampling layers
426 sscanf(addOpt.Data(),"NL=%i", &fNECLayers);
e5a93224 427 AliDebug(2,Form(" fNECLayers %i (new) \n", fNECLayers));
b44d5aa4 428 } else if(addOpt.Contains("PBTH=",TString::kIgnoreCase)) {//Thickness of the Pb(fECPbRadThicknes)
c63c3c5d 429 sscanf(addOpt.Data(),"PBTH=%f", &fECPbRadThickness);
b44d5aa4 430 } else if(addOpt.Contains("SCTH=",TString::kIgnoreCase)) {//Thickness of the Sc(fECScintThick)
c63c3c5d 431 sscanf(addOpt.Data(),"SCTH=%f", &fECScintThick);
b44d5aa4 432 } else if(addOpt.Contains("LATSS=",TString::kIgnoreCase)) {// Thickness of lateral steel strip (fLateralSteelStrip)
433 sscanf(addOpt.Data(),"LATSS=%f", &fLateralSteelStrip);
434 AliDebug(2,Form(" fLateralSteelStrip %f (new) \n", fLateralSteelStrip));
c63c3c5d 435 }
436 }
437 }
438}
439
25b033cf 440void AliEMCALGeometry::DefineSamplingFraction()
441{
442 // Jun 05,2006
443 // Look http://rhic.physics.wayne.edu/~pavlinov/ALICE/SHISHKEBAB/RES/linearityAndResolutionForTRD1.html
444 // Keep for compatibilty
445 //
446 if(fNECLayers == 69) { // 10% layer reduction
447 fSampling = 12.55;
448 } else if(fNECLayers == 61) { // 20% layer reduction
449 fSampling = 12.80;
450 } else if(fNECLayers == 77) {
451 if (fECScintThick>0.175 && fECScintThick<0.177) { // 10% Pb thicknes reduction
452 fSampling = 10.5; // fECScintThick = 0.176, fECPbRadThickness=0.144;
453 } else if(fECScintThick>0.191 && fECScintThick<0.193) { // 20% Pb thicknes reduction
454 fSampling = 8.93; // fECScintThick = 0.192, fECPbRadThickness=0.128;
455 }
456 }
457}
458
f0377b23 459//____________________________________________________________________________
356fd0a9 460void AliEMCALGeometry::FillTRU(const TClonesArray * digits, TClonesArray * ampmatrix, TClonesArray * timeRmatrix) {
f0377b23 461
462
356fd0a9 463// Orders digits ampitudes list in fNTRU TRUs (384 cells) per supermodule.
464// Each TRU is a TMatrixD, and they are kept in TClonesArrays. The number of
465// TRU in phi is fNTRUPhi, and the number of TRU in eta is fNTRUEta.
466// Last 2 modules are half size in Phi, I considered that the number of TRU
467// is maintained for the last modules but decision not taken. If different,
468// then this must be changed.
469
f0377b23 470
471 //Check data members
472
473 if(fNTRUEta*fNTRUPhi != fNTRU)
474 Error("FillTRU"," Wrong number of TRUS per Eta or Phi");
475
356fd0a9 476 //Initilize and declare variables
f0377b23 477 //List of TRU matrices initialized to 0.
356fd0a9 478 Int_t nCellsPhi = fNPhi*2/fNTRUPhi;
479 Int_t nCellsPhi2 = fNPhi/fNTRUPhi; //HalfSize modules
480 Int_t nCellsEta = fNZ*2/fNTRUEta;
f0377b23 481 Int_t id = -1;
482 Float_t amp = -1;
356fd0a9 483 Float_t timeR = -1;
f0377b23 484 Int_t iSupMod = -1;
485 Int_t nTower = -1;
486 Int_t nIphi = -1;
487 Int_t nIeta = -1;
488 Int_t iphi = -1;
489 Int_t ieta = -1;
356fd0a9 490
491 //List of TRU matrices initialized to 0.
492 for(Int_t k = 0; k < fNTRU*fNumberOfSuperModules; k++){
493 TMatrixD * amptrus = new TMatrixD(nCellsPhi,nCellsEta) ;
494 TMatrixD * timeRtrus = new TMatrixD(nCellsPhi,nCellsEta) ;
495 for(Int_t i = 0; i < nCellsPhi; i++){
496 for(Int_t j = 0; j < nCellsEta; j++){
497 (*amptrus)(i,j) = 0.0;
498 (*timeRtrus)(i,j) = 0.0;
499 }
500 }
501 new((*ampmatrix)[k]) TMatrixD(*amptrus) ;
502 new((*timeRmatrix)[k]) TMatrixD(*timeRtrus) ;
503 }
504
505 AliEMCALDigit * dig ;
f0377b23 506
507 //Digits loop to fill TRU matrices with amplitudes.
f0377b23 508 for(Int_t idig = 0 ; idig < digits->GetEntriesFast() ; idig++){
509
510 dig = dynamic_cast<AliEMCALDigit *>(digits->At(idig)) ;
356fd0a9 511 amp = dig->GetAmp() ; // Energy of the digit (arbitrary units)
512 id = dig->GetId() ; // Id label of the cell
513 timeR = dig->GetTimeR() ; // Earliest time of the digit
f0377b23 514
515 //Get eta and phi cell position in supermodule
516 Bool_t bCell = GetCellIndex(id, iSupMod, nTower, nIphi, nIeta) ;
517 if(!bCell)
518 Error("FillTRU","Wrong cell id number") ;
519
520 GetCellPhiEtaIndexInSModule(iSupMod,nTower,nIphi, nIeta,iphi,ieta);
521
522 //Check to which TRU in the supermodule belongs the cell.
523 //Supermodules are divided in a TRU matrix of dimension
524 //(fNTRUPhi,fNTRUEta).
525 //Each TRU is a cell matrix of dimension (nCellsPhi,nCellsEta)
526
527 //First calculate the row and column in the supermodule
528 //of the TRU to which the cell belongs.
33d0b833 529 Int_t col = ieta/nCellsEta;
530 Int_t row = iphi/nCellsPhi;
531 if(iSupMod > 9)
532 row = iphi/nCellsPhi2;
356fd0a9 533 //Calculate label number of the TRU
33d0b833 534 Int_t itru = row + col*fNTRUPhi + iSupMod*fNTRU ;
f0377b23 535
536 //Fill TRU matrix with cell values
356fd0a9 537 TMatrixD * amptrus = dynamic_cast<TMatrixD *>(ampmatrix->At(itru)) ;
538 TMatrixD * timeRtrus = dynamic_cast<TMatrixD *>(timeRmatrix->At(itru)) ;
f0377b23 539
356fd0a9 540 //Calculate row and column of the cell inside the TRU with number itru
33d0b833 541 Int_t irow = iphi - row * nCellsPhi;
542 if(iSupMod > 9)
543 irow = iphi - row * nCellsPhi2;
544 Int_t icol = ieta - col * nCellsEta;
f0377b23 545
356fd0a9 546 (*amptrus)(irow,icol) = amp ;
547 (*timeRtrus)(irow,icol) = timeR ;
f0377b23 548
549 }
f0377b23 550}
551
356fd0a9 552//______________________________________________________________________
553void AliEMCALGeometry::GetCellPhiEtaIndexInSModuleFromTRUIndex(const Int_t itru, const Int_t iphitru, const Int_t ietatru, Int_t &iphiSM, Int_t &ietaSM) const
554{
555
33d0b833 556 // This method transforms the (eta,phi) index of cells in a
356fd0a9 557 // TRU matrix into Super Module (eta,phi) index.
558
33d0b833 559 // Calculate in which row and column where the TRU are
356fd0a9 560 // ordered in the SM
561
33d0b833 562 Int_t col = itru/ fNTRUPhi ;
563 Int_t row = itru - col*fNTRUPhi ;
356fd0a9 564
565 //Calculate the (eta,phi) index in SM
566 Int_t nCellsPhi = fNPhi*2/fNTRUPhi;
567 Int_t nCellsEta = fNZ*2/fNTRUEta;
568
33d0b833 569 iphiSM = nCellsPhi*row + iphitru ;
570 ietaSM = nCellsEta*col + ietatru ;
356fd0a9 571}
f0377b23 572
b13bbe81 573//______________________________________________________________________
574AliEMCALGeometry * AliEMCALGeometry::GetInstance(){
05a92d59 575 // Returns the pointer of the unique instance
576
e52475ed 577 AliEMCALGeometry * rv = static_cast<AliEMCALGeometry *>( fgGeom );
578 return rv;
2012850d 579}
173558f2 580
b13bbe81 581//______________________________________________________________________
582AliEMCALGeometry* AliEMCALGeometry::GetInstance(const Text_t* name,
583 const Text_t* title){
584 // Returns the pointer of the unique instance
585
586 AliEMCALGeometry * rv = 0;
587 if ( fgGeom == 0 ) {
588 if ( strcmp(name,"") == 0 ) rv = 0;
e5a93224 589 else {
b13bbe81 590 fgGeom = new AliEMCALGeometry(name, title);
591 if ( fgInit ) rv = (AliEMCALGeometry * ) fgGeom;
592 else {
593 rv = 0;
594 delete fgGeom;
595 fgGeom = 0;
596 } // end if fgInit
597 } // end if strcmp(name,"")
598 }else{
e5a93224 599 if ( strcmp(fgGeom->GetName(), name) != 0) {
600 printf("\ncurrent geometry is %s : ", fgGeom->GetName());
601 printf(" you cannot call %s ", name);
b13bbe81 602 }else{
9859bfc0 603 rv = (AliEMCALGeometry *) fgGeom;
e52475ed 604 } // end
b13bbe81 605 } // end if fgGeom
606 return rv;
2012850d 607}
173558f2 608
ab37d09c 609Bool_t AliEMCALGeometry::IsInEMCAL(Double_t x, Double_t y, Double_t z) const {
dc7da436 610 // Checks whether point is inside the EMCal volume, used in AliEMCALv*.cxx
ab37d09c 611 //
612 // Code uses cylindrical approximation made of inner radius (for speed)
613 //
614 // Points behind EMCAl, i.e. R > outer radius, but eta, phi in acceptance
615 // are considered to inside
616
617 Double_t r=sqrt(x*x+y*y);
618
619 if ( r > fEnvelop[0] ) {
620 Double_t theta;
621 theta = TMath::ATan2(r,z);
622 Double_t eta;
623 if(theta == 0)
624 eta = 9999;
625 else
626 eta = -TMath::Log(TMath::Tan(theta/2.));
627 if (eta < fArm1EtaMin || eta > fArm1EtaMax)
628 return 0;
629
630 Double_t phi = TMath::ATan2(y,x) * 180./TMath::Pi();
631 if (phi > fArm1PhiMin && phi < fArm1PhiMax)
632 return 1;
633 }
634 return 0;
635}
c63c3c5d 636// ==
1963b290 637
638//
639// == Shish-kebab cases ==
640//
e52475ed 641Int_t AliEMCALGeometry::GetAbsCellId(Int_t nSupMod, Int_t nTower, Int_t nIphi, Int_t nIeta) const
dc7da436 642{
643 // 27-aug-04;
d87bd045 644 // corr. 21-sep-04;
645 // 13-oct-05; 110 degree case
dc7da436 646 // May 31, 2006; ALICE numbering scheme:
647 // 0 <= nSupMod < fNumberOfSuperModules
648 // 0 <= nTower < fNPHI * fNZ ( fNPHI * fNZ/2 for fKey110DEG=1)
649 // 0 <= nIphi < fNPHIdiv
650 // 0 <= nIeta < fNETAdiv
651 // 0 <= absid < fNCells
652 static Int_t id=0; // have to change from 0 to fNCells-1
653 if(fKey110DEG == 1 && nSupMod >= 10) { // 110 degree case; last two supermodules
654 id = fNCellsInSupMod*10 + (fNCellsInSupMod/2)*(nSupMod-10);
d87bd045 655 } else {
dc7da436 656 id = fNCellsInSupMod*nSupMod;
d87bd045 657 }
dc7da436 658 id += fNCellsInTower *nTower;
659 id += fNPHIdiv *nIphi;
1963b290 660 id += nIeta;
dc7da436 661 if(id<0 || id >= fNCells) {
500aeccc 662// printf(" wrong numerations !!\n");
663// printf(" id %6i(will be force to -1)\n", id);
664// printf(" fNCells %6i\n", fNCells);
665// printf(" nSupMod %6i\n", nSupMod);
666// printf(" nTower %6i\n", nTower);
667// printf(" nIphi %6i\n", nIphi);
668// printf(" nIeta %6i\n", nIeta);
dc7da436 669 id = -TMath::Abs(id); // if negative something wrong
1963b290 670 }
671 return id;
672}
673
dc7da436 674Bool_t AliEMCALGeometry::CheckAbsCellId(Int_t absId) const
fc575e27 675{
dc7da436 676 // May 31, 2006; only trd1 now
677 if(absId<0 || absId >= fNCells) return kFALSE;
678 else return kTRUE;
1963b290 679}
680
e52475ed 681Bool_t AliEMCALGeometry::GetCellIndex(Int_t absId,Int_t &nSupMod,Int_t &nTower,Int_t &nIphi,Int_t &nIeta) const
fc575e27 682{
dc7da436 683 // 21-sep-04; 19-oct-05;
684 // May 31, 2006; ALICE numbering scheme:
d87bd045 685 static Int_t tmp=0, sm10=0;
dc7da436 686 if(!CheckAbsCellId(absId)) return kFALSE;
687
d87bd045 688 sm10 = fNCellsInSupMod*10;
dc7da436 689 if(fKey110DEG == 1 && absId >= sm10) { // 110 degree case; last two supermodules
690 nSupMod = (absId-sm10) / (fNCellsInSupMod/2) + 10;
691 tmp = (absId-sm10) % (fNCellsInSupMod/2);
d87bd045 692 } else {
dc7da436 693 nSupMod = absId / fNCellsInSupMod;
694 tmp = absId % fNCellsInSupMod;
d87bd045 695 }
1963b290 696
dc7da436 697 nTower = tmp / fNCellsInTower;
1963b290 698 tmp = tmp % fNCellsInTower;
dc7da436 699 nIphi = tmp / fNPHIdiv;
700 nIeta = tmp % fNPHIdiv;
1963b290 701
702 return kTRUE;
703}
704
dc7da436 705void AliEMCALGeometry::GetModulePhiEtaIndexInSModule(Int_t nSupMod, Int_t nTower, int &iphim, int &ietam) const
fc575e27 706{
dc7da436 707 // added nSupMod; have to check - 19-oct-05 !
708 // Alice numbering scheme - Jun 01,2006
d87bd045 709 static Int_t nphi;
710
dc7da436 711 if(fKey110DEG == 1 && nSupMod>=10) nphi = fNPhi/2;
d87bd045 712 else nphi = fNPhi;
713
dc7da436 714 ietam = nTower/nphi; // have to change from 0 to fNZ-1
715 iphim = nTower%nphi; // have to change from 0 to fNPhi-1
d87bd045 716}
717
eb0b1051 718void AliEMCALGeometry::GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nTower, Int_t nIphi, Int_t nIeta,
e52475ed 719int &iphi, int &ieta) const
fc575e27 720{
721 // added nSupMod; Nov 25, 05
dc7da436 722 // Alice numbering scheme - Jun 01,2006
723 static Int_t iphim, ietam;
724
725 GetModulePhiEtaIndexInSModule(nSupMod,nTower, iphim, ietam);
726 // have to change from 0 to (fNZ*fNETAdiv-1)
727 ieta = ietam*fNETAdiv + (1-nIeta); // x(module) = -z(SM)
728 // iphi - have to change from 0 to (fNPhi*fNPHIdiv-1)
729 iphi = iphim*fNPHIdiv + nIphi; // y(module) = y(SM)
1963b290 730}
e52475ed 731
732Int_t AliEMCALGeometry::GetSuperModuleNumber(Int_t absId) const
733{
fc575e27 734 //return the number of the
735 //supermodule given the absolute
736 //ALICE numbering
737
e52475ed 738 static Int_t nSupMod, nTower, nIphi, nIeta;
739 GetCellIndex(absId, nSupMod, nTower, nIphi, nIeta);
740 return nSupMod;
741}
742
743// Methods for AliEMCALRecPoint - Feb 19, 2006
14e75ea7 744Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) const
e52475ed 745{
1933eff2 746 // Look to see what the relative
747 // position inside a given cell is
748 // for a recpoint.
749 // Alice numbering scheme - Jun 08, 2006
fc575e27 750
e52475ed 751 static Int_t nSupMod, nTower, nIphi, nIeta, iphi, ieta;
1933eff2 752 static Int_t phiIndexShift=6;
e52475ed 753 if(!CheckAbsCellId(absId)) return kFALSE;
754
755 GetCellIndex(absId, nSupMod, nTower, nIphi, nIeta);
756 GetCellPhiEtaIndexInSModule(nSupMod,nTower,nIphi,nIeta, iphi, ieta);
757
dc7da436 758 xr = fXCentersOfCells.At(ieta);
759 zr = fEtaCentersOfCells.At(ieta);
e52475ed 760
1933eff2 761 if(nSupMod<10) {
762 yr = fPhiCentersOfCells.At(iphi);
763 } else {
764 yr = fPhiCentersOfCells.At(iphi + phiIndexShift);
18eb623b 765 // cout<<" absId "<<absId<<" nSupMod "<<nSupMod << " iphi "<<iphi<<" ieta "<<ieta;
766 // cout<< " xr " << xr << " yr " << yr << " zr " << zr <<endl;
1933eff2 767 }
e52475ed 768
e52475ed 769 return kTRUE;
770}
771
14e75ea7 772Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t loc[3]) const
773{
774 // Alice numbering scheme - Jun 03, 2006
775 loc[0] = loc[1] = loc[2]=0.0;
776 if(RelPosCellInSModule(absId, loc[0],loc[1],loc[2])) {
777 return kTRUE;
778 }
779 return kFALSE;
780}
781
782Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, TVector3 &vloc) const
783{
784 static Double_t loc[3];
785 if(RelPosCellInSModule(absId,loc)) {
786 vloc.SetXYZ(loc[0], loc[1], loc[2]);
787 return kTRUE;
788 } else {
789 vloc.SetXYZ(0,0,0);
790 return kFALSE;
791 }
792 // Alice numbering scheme - Jun 03, 2006
793}
794
e52475ed 795void AliEMCALGeometry::CreateListOfTrd1Modules()
796{
fc575e27 797 //Generate the list of Trd1 modules
798 //which will make up the EMCAL
799 //geometry
800
e5a93224 801 AliDebug(2,Form(" AliEMCALGeometry::CreateListOfTrd1Modules() started "));
802
e52475ed 803 AliEMCALShishKebabTrd1Module *mod=0, *mTmp=0; // current module
804 if(fShishKebabTrd1Modules == 0) {
805 fShishKebabTrd1Modules = new TList;
806 for(int iz=0; iz< GetNZ(); iz++) {
807 if(iz==0) {
808 mod = new AliEMCALShishKebabTrd1Module(TMath::Pi()/2.,this);
809 } else {
810 mTmp = new AliEMCALShishKebabTrd1Module(*mod);
811 mod = mTmp;
812 }
813 fShishKebabTrd1Modules->Add(mod);
814 }
815 } else {
e5a93224 816 AliDebug(2,Form(" Already exits : "));
e52475ed 817 }
e5a93224 818 AliDebug(2,Form(" fShishKebabTrd1Modules has %i modules \n",
819 fShishKebabTrd1Modules->GetSize()));
e52475ed 820 // Feb 20,2006;
dc7da436 821 // Jun 01, 2006 - ALICE numbering scheme
e52475ed 822 // define grid for cells in eta(z) and x directions in local coordinates system of SM
dc7da436 823 // fEtaCentersOfCells = new TArrayD(fNZ *fNETAdiv);
824 // fXCentersOfCells = new TArrayD(fNZ *fNETAdiv);
825 fEtaCentersOfCells.Set(fNZ *fNETAdiv);
826 fXCentersOfCells.Set(fNZ *fNETAdiv);
827 AliDebug(2,Form(" Cells grid in eta directions : size %i\n", fEtaCentersOfCells.GetSize()));
e52475ed 828 Int_t iphi=0, ieta=0, nTower=0;
829 Double_t xr, zr;
830 for(Int_t it=0; it<fNZ; it++) { // array index
831 AliEMCALShishKebabTrd1Module *trd1 = GetShishKebabModule(it);
dc7da436 832 nTower = fNPhi*it;
e52475ed 833 for(Int_t ic=0; ic<fNETAdiv; ic++) { // array index
dc7da436 834 trd1->GetCenterOfCellInLocalCoordinateofSM(ic, xr, zr);
835 GetCellPhiEtaIndexInSModule(0, nTower, 0, ic, iphi, ieta); // don't depend from phi - ieta in action
836 fXCentersOfCells.AddAt(float(xr) - fParSM[0],ieta);
837 fEtaCentersOfCells.AddAt(float(zr) - fParSM[2],ieta);
e52475ed 838 }
839 }
dc7da436 840 for(Int_t i=0; i<fEtaCentersOfCells.GetSize(); i++) {
e5a93224 841 AliDebug(2,Form(" ind %2.2i : z %8.3f : x %8.3f", i+1,
dc7da436 842 fEtaCentersOfCells.At(i),fXCentersOfCells.At(i)));
e52475ed 843 }
e5a93224 844
e52475ed 845 // define grid for cells in phi(y) direction in local coordinates system of SM
dc7da436 846 // fPhiCentersOfCells = new TArrayD(fNPhi*fNPHIdiv);
847 fPhiCentersOfCells.Set(fNPhi*fNPHIdiv);
848 AliDebug(2,Form(" Cells grid in phi directions : size %i\n", fPhiCentersOfCells.GetSize()));
e52475ed 849 Int_t ind=0;
850 for(Int_t it=0; it<fNPhi; it++) { // array index
851 Float_t ytLeftCenterModule = -fParSM[1] + fPhiModuleSize*(2*it+1)/2; // module
852 for(Int_t ic=0; ic<fNPHIdiv; ic++) { // array index
853 Float_t ytLeftCenterCell = ytLeftCenterModule + fPhiTileSize *(2*ic-1)/2.; // tower(cell)
dc7da436 854 fPhiCentersOfCells.AddAt(ytLeftCenterCell,ind);
855 AliDebug(2,Form(" ind %2.2i : y %8.3f ", ind, fPhiCentersOfCells.At(ind)));
e5a93224 856 ind++;
e52475ed 857 }
858 }
e52475ed 859}
860
861void AliEMCALGeometry::GetTransformationForSM()
862{
fc575e27 863 //Uses the geometry manager to
864 //load the transformation matrix
865 //for the supermodules
866
e52475ed 867 static Bool_t transInit=kFALSE;
868 if(transInit) return;
869
870 int i=0;
871 if(gGeoManager == 0) {
872 Info("CreateTransformationForSM() "," Load geometry : TGeoManager::Import()");
873 assert(0);
874 }
875 TGeoNode *tn = gGeoManager->GetTopNode();
fc575e27 876 TGeoNode *node=0, *xen1 = 0;
e52475ed 877 for(i=0; i<tn->GetNdaughters(); i++) {
878 node = tn->GetDaughter(i);
879 TString ns(node->GetName());
880 if(ns.Contains(GetNameOfEMCALEnvelope())) {
fc575e27 881 xen1 = node;
e52475ed 882 break;
883 }
884 }
fc575e27 885 if(!xen1) {
e52475ed 886 Info("CreateTransformationForSM() "," geometry has not EMCAL envelope with name %s",
887 GetNameOfEMCALEnvelope());
888 assert(0);
889 }
fc575e27 890 printf(" i %i : EMCAL Envelope is %s : #SM %i \n", i, xen1->GetName(), xen1->GetNdaughters());
891 for(i=0; i<xen1->GetNdaughters(); i++) {
892 TGeoNodeMatrix *sm = (TGeoNodeMatrix*)xen1->GetDaughter(i);
e52475ed 893 fMatrixOfSM[i] = sm->GetMatrix();
64942713 894 //Compiler doesn't like this syntax...
895 // printf(" %i : matrix %x \n", i, fMatrixOfSM[i]);
e52475ed 896 }
897 transInit = kTRUE;
898}
899
14e75ea7 900void AliEMCALGeometry::GetGlobal(const Double_t *loc, Double_t *glob, int ind) const
e52475ed 901{
14e75ea7 902 // Figure out the global numbering
903 // of a given supermodule from the
904 // local numbering
905 // Alice numbering - Jun 03,2006
e52475ed 906 // if(fMatrixOfSM[0] == 0) GetTransformationForSM();
14e75ea7 907
e52475ed 908 if(ind>=0 && ind < GetNumberOfSuperModules()) {
909 fMatrixOfSM[ind]->LocalToMaster(loc, glob);
910 }
911}
912
25b033cf 913void AliEMCALGeometry::GetGlobal(const TVector3 &vloc, TVector3 &vglob, int ind) const
914{
915 //Figure out the global numbering
916 //of a given supermodule from the
917 //local numbering given a 3-vector location
918
919 static Double_t tglob[3], tloc[3];
920 vloc.GetXYZ(tloc);
921 GetGlobal(tloc, tglob, ind);
922 vglob.SetXYZ(tglob[0], tglob[1], tglob[2]);
923}
924
14e75ea7 925void AliEMCALGeometry::GetGlobal(Int_t absId , double glob[3]) const
926{
927 // Alice numbering scheme - Jun 03, 2006
928 static Int_t nSupMod, nModule, nIphi, nIeta;
929 static double loc[3];
930
931 glob[0]=glob[1]=glob[2]=0.0; // bad case
932 if(RelPosCellInSModule(absId, loc)) {
933 GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
934 fMatrixOfSM[nSupMod]->LocalToMaster(loc, glob);
935 }
e52475ed 936}
937
14e75ea7 938void AliEMCALGeometry::GetGlobal(Int_t absId , TVector3 &vglob) const
939{
940 // Alice numbering scheme - Jun 03, 2006
941 static Double_t glob[3];
942
943 GetGlobal(absId, glob);
944 vglob.SetXYZ(glob[0], glob[1], glob[2]);
945
946}
947
e52475ed 948void AliEMCALGeometry::GetGlobal(const AliRecPoint *rp, TVector3 &vglob) const
949{
664bfd66 950 // Figure out the global numbering
951 // of a given supermodule from the
952 // local numbering for RecPoints
fc575e27 953
e52475ed 954 static TVector3 vloc;
14e75ea7 955 static Int_t nSupMod, nModule, nIphi, nIeta;
e52475ed 956
957 AliRecPoint *rpTmp = (AliRecPoint*)rp; // const_cast ??
958 if(!rpTmp) return;
959 AliEMCALRecPoint *rpEmc = (AliEMCALRecPoint*)rpTmp;
960
14e75ea7 961 GetCellIndex(rpEmc->GetAbsId(0), nSupMod, nModule, nIphi, nIeta);
e52475ed 962 rpTmp->GetLocalPosition(vloc);
963 GetGlobal(vloc, vglob, nSupMod);
964}
965
664bfd66 966void AliEMCALGeometry::EtaPhiFromIndex(Int_t absId,Float_t &eta,Float_t &phi) const
967{
968 // Jun 03, 2006 - version for TRD1
969 static TVector3 vglob;
970 GetGlobal(absId, vglob);
971 eta = vglob.Eta();
972 phi = vglob.Phi();
973}
974
fc575e27 975AliEMCALShishKebabTrd1Module* AliEMCALGeometry::GetShishKebabModule(Int_t neta=0)
976{
977 //This method was too long to be
978 //included in the header file - the
979 //rule checker complained about it's
980 //length, so we move it here. It returns the
981 //shishkebabmodule at a given eta index point.
982
983 static AliEMCALShishKebabTrd1Module* trd1=0;
984 if(fShishKebabTrd1Modules && neta>=0 && neta<fShishKebabTrd1Modules->GetSize()) {
985 trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabTrd1Modules->At(neta);
986 } else trd1 = 0;
987 return trd1;
988}