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