]> git.uio.no Git - u/mrichter/AliRoot.git/blame - JETAN/AliJetDummyGeo.cxx
- Use UnitArray to store track and emcal information.
[u/mrichter/AliRoot.git] / JETAN / AliJetDummyGeo.cxx
CommitLineData
5ad5f558 1/**************************************************************************
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 **************************************************************************/
ee7de0dd 15
16//
17// Temporarily added to define part of the EMCal geometry
18// necessary for the jet finder
19//
20
21#include <assert.h>
22
23// --- Root header files ---
24#include <TVector3.h>
25#include <TGeoManager.h>
26#include <TGeoMatrix.h>
27#include <TGeoNode.h>
28
29// --- AliRoot header files ---
5ad5f558 30#include "AliJetDummyGeo.h"
31
32ClassImp(AliJetDummyGeo)
ee7de0dd 33
34AliJetDummyGeo::AliJetDummyGeo():
35 TObject(),
36 fArm1PhiMin(80.0),
37 fArm1PhiMax(200.0),
38 fArm1EtaMin(-0.7),
39 fArm1EtaMax(+0.7),
40 fNumberOfSuperModules(12),
41 fSteelFrontThick(0.0),
42 fIPDistance(428.0),
43 fZLength(),
44 fPhiGapForSM(2.),
45 fNPhi(12),
46 fNZ(24),
47 fPhiModuleSize(12.26 - fPhiGapForSM / Float_t(fNPhi)),
48 fEtaModuleSize(fPhiModuleSize),
49 fNPHIdiv(2),
50 fNETAdiv(2),
51 fNECLayers(77),
52 fECScintThick(0.16),
53 fECPbRadThickness(0.16),
54 fSampling(12.327),
55 fTrd1Angle(1.5),
56 fNCellsInModule(fNPHIdiv*fNETAdiv),
57 fNCellsInSupMod(fNCellsInModule*fNPhi*fNZ),
58 fNCells(fNCellsInSupMod*fNumberOfSuperModules-fNCellsInSupMod),
59 fLongModuleSize(fNECLayers*(fECScintThick + fECPbRadThickness)),
60 f2Trd1Dx2(fEtaModuleSize + 2.*fLongModuleSize*TMath::Tan(fTrd1Angle*TMath::DegToRad()/2.)),
61 fShellThickness(TMath::Sqrt(fLongModuleSize*fLongModuleSize + f2Trd1Dx2*f2Trd1Dx2)+fSteelFrontThick),
62 fEtaMaxOfTRD1(0.67064) // Value extracted from ShishKebab
63{
64 // Constructor
65 // Local coordinates
66 fParSM[0] = GetShellThickness()/2.;
67 fParSM[1] = GetPhiModuleSize() * GetNPhi()/2.;
68 fParSM[2] = 350./2.;
69
70 fZLength = 2.*ZFromEtaR(fIPDistance+fShellThickness,fArm1EtaMax); // Z coverage
71 fEnvelop[0] = fIPDistance; // mother volume inner radius
72 fEnvelop[1] = fIPDistance + fShellThickness; // mother volume outer r.
73 fEnvelop[2] = 1.00001*fZLength; // add some padding for mother volume.
74
75 // SM phi boundaries - (0,1),(2,3) .. (10,11) - has the same boundaries; Nov 7, 2006
76 fPhiBoundariesOfSM.Set(fNumberOfSuperModules);
77 fPhiCentersOfSM.Set(fNumberOfSuperModules/2);
78 fPhiBoundariesOfSM[0] = TMath::PiOver2() - TMath::ATan2(fParSM[1] , fIPDistance); // 1th and 2th modules)
79 fPhiBoundariesOfSM[1] = TMath::PiOver2() + TMath::ATan2(fParSM[1] , fIPDistance);
80 fPhiCentersOfSM[0] = TMath::PiOver2();
81 for(int i=1; i<=4; i++) { // from 2th ro 9th
82 fPhiBoundariesOfSM[2*i] = fPhiBoundariesOfSM[0] + 20.*TMath::DegToRad()*i;
83 fPhiBoundariesOfSM[2*i+1] = fPhiBoundariesOfSM[1] + 20.*TMath::DegToRad()*i;
84 fPhiCentersOfSM[i] = fPhiCentersOfSM[0] + 20.*TMath::DegToRad()*i;
85 }
86 fPhiBoundariesOfSM[11] = 190.*TMath::DegToRad();
87 fPhiBoundariesOfSM[10] = fPhiBoundariesOfSM[11] - TMath::ATan2((fParSM[1]) , fIPDistance);
88 fPhiCentersOfSM[5] = (fPhiBoundariesOfSM[10]+fPhiBoundariesOfSM[11])/2.;
89
90 // for(int i=0; i<fNumberOfSuperModules; i++) fMatrixOfSM[i] = 0;
91
92 fCentersOfCellsEtaDir.Set(fNZ*fNETAdiv);
93 fCentersOfCellsXDir.Set(fNZ*fNETAdiv);
94 fCentersOfCellsPhiDir.Set(fNPhi*fNPHIdiv);
95 fEtaCentersOfCells.Set(fNZ*fNETAdiv*fNPhi*fNPHIdiv);
96 fPhiCentersOfCells.Set(fNPhi*fNPHIdiv);
97
98 int nphism = GetNumberOfSuperModules()/2;
99 double dphi = (GetArm1PhiMax() - GetArm1PhiMin())/nphism;
100 double rpos = (GetEnvelop(0) + GetEnvelop(1))/2.;
101 double phi, phiRad, xpos, ypos, zpos;
102 for(int i=0; i<nphism; i++){
103 phi = GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 90, 110, 130, 150, 170, 190
104 phiRad = phi*TMath::Pi()/180.;
105 xpos = rpos * TMath::Cos(phiRad);
106 ypos = rpos * TMath::Sin(phiRad);
107 zpos = fParSM[2];
108 if(i==5) {
109 xpos += (fParSM[1]/2. * TMath::Sin(phiRad));
110 ypos -= (fParSM[1]/2. * TMath::Cos(phiRad));
111 }
112 // pozitive z
113 int ind = 2*i;
114 TGeoRotation *geoRot0 = new TGeoRotation("geoRot0", 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
115 fMatrixOfSM[ind] = new TGeoCombiTrans(Form("EmcalSM%2.2i",ind),
116 xpos,ypos, zpos, geoRot0);
117 // negaive z
118 ind++;
119 double phiy = 90. + phi + 180.;
120 if(phiy>=360.) phiy -= 360.;
121 TGeoRotation *geoRot1 = new TGeoRotation("geoRot1", 90.0, phi, 90.0, phiy, 180.0, 0.0);
122 fMatrixOfSM[ind] = new TGeoCombiTrans(Form("EmcalSM%2.2i",ind),
123 xpos,ypos,-zpos, geoRot1);
124 } // for
125
126}
127
128AliJetDummyGeo::AliJetDummyGeo(const AliJetDummyGeo& geom):
129 TObject(),
130 fArm1PhiMin(geom.fArm1PhiMin),
131 fArm1PhiMax(geom.fArm1PhiMax),
132 fArm1EtaMin(geom.fArm1EtaMin),
133 fArm1EtaMax(geom.fArm1EtaMax),
134 fNumberOfSuperModules(geom.fNumberOfSuperModules),
135 fSteelFrontThick(geom.fSteelFrontThick),
136 fIPDistance(geom.fIPDistance),
137 fPhiGapForSM(geom.fPhiGapForSM),
138 fNPhi(geom.fNPhi),
139 fNZ(geom.fNZ),
140 fPhiModuleSize(geom.fPhiModuleSize),
141 fEtaModuleSize(geom.fEtaModuleSize),
142 fNPHIdiv(geom.fNPHIdiv),
143 fNETAdiv(geom.fNETAdiv),
144 fNECLayers(geom.fNECLayers),
145 fECScintThick(geom.fECScintThick),
146 fECPbRadThickness(geom.fECPbRadThickness),
147 fSampling(geom.fSampling),
148 fTrd1Angle(geom.fTrd1Angle),
149 fNCellsInModule(geom.fNCellsInModule),
150 fNCellsInSupMod(geom.fNCellsInSupMod),
151 fNCells(geom.fNCells),
152 fLongModuleSize(geom.fLongModuleSize),
153 f2Trd1Dx2(geom.f2Trd1Dx2),
154 fShellThickness(geom.fShellThickness),
155 fEtaMaxOfTRD1(geom.fEtaMaxOfTRD1)
156{
157 // Constructor
158 // Local coordinates
159 fParSM[0] = GetShellThickness()/2.;
160 fParSM[1] = GetPhiModuleSize() * GetNPhi()/2.;
161 fParSM[2] = 350./2.;
162
163 // SM phi boundaries - (0,1),(2,3) .. (10,11) - has the same boundaries; Nov 7, 2006
164 fPhiBoundariesOfSM.Set(fNumberOfSuperModules);
165 fPhiCentersOfSM.Set(fNumberOfSuperModules/2);
166 fPhiBoundariesOfSM[0] = TMath::PiOver2() - TMath::ATan2(fParSM[1] , fIPDistance); // 1th and 2th modules)
167 fPhiBoundariesOfSM[1] = TMath::PiOver2() + TMath::ATan2(fParSM[1] , fIPDistance);
168 fPhiCentersOfSM[0] = TMath::PiOver2();
169 for(int i=1; i<=4; i++) { // from 2th ro 9th
170 fPhiBoundariesOfSM[2*i] = fPhiBoundariesOfSM[0] + 20.*TMath::DegToRad()*i;
171 fPhiBoundariesOfSM[2*i+1] = fPhiBoundariesOfSM[1] + 20.*TMath::DegToRad()*i;
172 fPhiCentersOfSM[i] = fPhiCentersOfSM[0] + 20.*TMath::DegToRad()*i;
173 }
174 fPhiBoundariesOfSM[11] = 190.*TMath::DegToRad();
175 fPhiBoundariesOfSM[10] = fPhiBoundariesOfSM[11] - TMath::ATan2((fParSM[1]) , fIPDistance);
176 fPhiCentersOfSM[5] = (fPhiBoundariesOfSM[10]+fPhiBoundariesOfSM[11])/2.;
177
178 // for(int i=0; i<fNumberOfSuperModules; i++) fMatrixOfSM[i] = 0;
179
180 fCentersOfCellsEtaDir.Set(fNZ*fNETAdiv);
181 fCentersOfCellsXDir.Set(fNZ*fNETAdiv);
182 fCentersOfCellsPhiDir.Set(fNPhi*fNPHIdiv);
183 fEtaCentersOfCells.Set(fNZ*fNETAdiv*fNPhi*fNPHIdiv);
184 fPhiCentersOfCells.Set(fNPhi*fNPHIdiv);
185
186 int nphism = GetNumberOfSuperModules()/2;
187 double dphi = (GetArm1PhiMax() - GetArm1PhiMin())/nphism;
188 double rpos = (GetEnvelop(0) + GetEnvelop(1))/2.;
189 double phi, phiRad, xpos, ypos, zpos;
190 for(int i=0; i<nphism; i++){
191 phi = GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 90, 110, 130, 150, 170, 190
192 phiRad = phi*TMath::Pi()/180.;
193 xpos = rpos * TMath::Cos(phiRad);
194 ypos = rpos * TMath::Sin(phiRad);
195 zpos = fParSM[2];
196 if(i==5) {
197 xpos += (fParSM[1]/2. * TMath::Sin(phiRad));
198 ypos -= (fParSM[1]/2. * TMath::Cos(phiRad));
199 }
200 // pozitive z
201 int ind = 2*i;
202 TGeoRotation *geoRot0 = new TGeoRotation("geoRot0", 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
203 fMatrixOfSM[ind] = new TGeoCombiTrans(Form("EmcalSM%2.2i",ind),
204 xpos,ypos, zpos, geoRot0);
205 // negaive z
206 ind++;
207 double phiy = 90. + phi + 180.;
208 if(phiy>=360.) phiy -= 360.;
209 TGeoRotation *geoRot1 = new TGeoRotation("geoRot1", 90.0, phi, 90.0, phiy, 180.0, 0.0);
210 fMatrixOfSM[ind] = new TGeoCombiTrans(Form("EmcalSM%2.2i",ind),
211 xpos,ypos,-zpos, geoRot1);
212
213 delete geoRot0;
214 delete geoRot1;
215
216 } // for
217
218}
219
220AliJetDummyGeo::~AliJetDummyGeo()
221{
222 // Destructor
223 delete [] fMatrixOfSM;
224}
225
226//------------------------------------------------------------------------------------
227void AliJetDummyGeo::EtaPhiFromIndex(Int_t absId, Float_t& eta, Float_t& phi)
228{
229 // Nov 16, 2006- float to double
230 // version for TRD1 only
231 static TVector3 vglob;
232 GetGlobal(absId, vglob);
233 eta = vglob.Eta();
234 phi = vglob.Phi();
235
236}
237
238//------------------------------------------------------------------------------------
239void AliJetDummyGeo::GetGlobal(const Double_t *loc, Double_t *glob, int ind) const
240{
241 // Figure out the global numbering of a given supermodule from the
242 // local numbering
243 // Alice numbering - Jun 03,2006
244 // if(fMatrixOfSM[0] == 0) GetTransformationForSM();
245
246 if(ind>=0 && ind < GetNumberOfSuperModules()) {
247 fMatrixOfSM[ind]->LocalToMaster(loc, glob);
248 }
249}
250
251//------------------------------------------------------------------------------------
252void AliJetDummyGeo::GetGlobal(Int_t absId , double glob[3]) const
253{
254 // Alice numbering scheme - Jun 03, 2006
255 static Int_t nSupMod, nModule, nIphi, nIeta;
256 static double loc[3];
257
258 glob[0]=glob[1]=glob[2]=0.0; // bad case
259 if(RelPosCellInSModule(absId, loc)) {
260 GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
261 fMatrixOfSM[nSupMod]->LocalToMaster(loc, glob);
262 }
263}
264
265//------------------------------------------------------------------------------------
266void AliJetDummyGeo::GetGlobal(Int_t absId , TVector3 &vglob) const
267{
268 // Alice numbering scheme - Jun 03, 2006
269 static Double_t glob[3];
270
271 GetGlobal(absId, glob);
272 vglob.SetXYZ(glob[0], glob[1], glob[2]);
273
274}
275
276//------------------------------------------------------------------------------------
277Bool_t AliJetDummyGeo::RelPosCellInSModule(Int_t absId, Double_t loc[3]) const
278{
279 // Alice numbering scheme - Jun 03, 2006
280 loc[0] = loc[1] = loc[2]=0.0;
281 if(RelPosCellInSModule(absId, loc[0],loc[1],loc[2])) {
282 return kTRUE;
283 }
284 return kFALSE;
285}
286
287//------------------------------------------------------------------------------------
288Bool_t AliJetDummyGeo::RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) const
289{
290 // Look to see what the relative position inside a given cell is
291 // for a recpoint.
292 // Alice numbering scheme - Jun 08, 2006
293 // In:
294 // absId - cell is as in Geant, 0<= absId < fNCells;
295 // OUT:
296 // xr,yr,zr - x,y,z coordinates of cell with absId inside SM
297
298 // Shift index taking into account the difference between standard SM
299 // and SM of half size in phi direction
300 const Int_t phiIndexShift = fCentersOfCellsPhiDir.GetSize()/4; // Nov 22, 2006; was 6 for cas 2X2
301 static Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta;
302 if(!CheckAbsCellId(absId)) return kFALSE;
303
304 GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
305 GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi, ieta);
306
307 xr = fCentersOfCellsXDir.At(ieta);
308 zr = fCentersOfCellsEtaDir.At(ieta);
309
310 if(nSupMod<10) {
311 yr = fCentersOfCellsPhiDir.At(iphi);
312 } else {
313 yr = fCentersOfCellsPhiDir.At(iphi + phiIndexShift);
314 }
315
316 return kTRUE;
317}
318
319//------------------------------------------------------------------------------------
320Bool_t AliJetDummyGeo::CheckAbsCellId(Int_t absId) const
321{
322 // May 31, 2006; only trd1 now
323 if(absId<0 || absId >= fNCells) return kFALSE;
324 else return kTRUE;
325}
326
327//------------------------------------------------------------------------------------
328Bool_t AliJetDummyGeo::GetCellIndex(Int_t absId,Int_t &nSupMod,Int_t &nModule,Int_t &nIphi,Int_t &nIeta) const
329{
330 // 21-sep-04; 19-oct-05;
331 // May 31, 2006; ALICE numbering scheme:
332 //
333 // In:
334 // absId - cell is as in Geant, 0<= absId < fNCells;
335 // Out:
336 // nSupMod - super module(SM) number, 0<= nSupMod < fNumberOfSuperModules;
337 // nModule - module number in SM, 0<= nModule < fNCellsInSupMod/fNCellsInSupMod or(/2) for tow last SM (10th and 11th);
338 // nIphi - cell number in phi driection inside module; 0<= nIphi < fNPHIdiv;
339 // nIeta - cell number in eta driection inside module; 0<= nIeta < fNETAdiv;
340 //
341 static Int_t tmp=0, sm10=0;
342 if(!CheckAbsCellId(absId)) return kFALSE;
343
344 sm10 = fNCellsInSupMod*10;
345 if(absId >= sm10) { // 110 degree case; last two supermodules
346 nSupMod = (absId-sm10) / (fNCellsInSupMod/2) + 10;
347 tmp = (absId-sm10) % (fNCellsInSupMod/2);
348 } else {
349 nSupMod = absId / fNCellsInSupMod;
350 tmp = absId % fNCellsInSupMod;
351 }
352
353 nModule = tmp / fNCellsInModule;
354 tmp = tmp % fNCellsInModule;
355 nIphi = tmp / fNPHIdiv;
356 nIeta = tmp % fNPHIdiv;
357
358 return kTRUE;
359}
360
361//------------------------------------------------------------------------------------
362void AliJetDummyGeo::GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta, int &iphi, int &ieta) const
363{
364 //
365 // Added nSupMod; Nov 25, 05
366 // Alice numbering scheme - Jun 01,2006
367 // IN:
368 // nSupMod - super module(SM) number, 0<= nSupMod < fNumberOfSuperModules;
369 // nModule - module number in SM, 0<= nModule < fNCellsInSupMod/fNCellsInSupMod or(/2) for tow last SM (10th and 11th);
370 // nIphi - cell number in phi driection inside module; 0<= nIphi < fNPHIdiv;
371 // nIeta - cell number in eta driection inside module; 0<= nIeta < fNETAdiv;
372 //
373 // OUT:
374 // ieta, iphi - indexes of cell(tower) in two dimensional grid of SM
375 // ieta - have to change from 0 to (fNZ*fNETAdiv-1)
376 // iphi - have to change from 0 to (fNPhi*fNPHIdiv-1 or fNPhi*fNPHIdiv/2-1)
377 //
378 static Int_t iphim, ietam;
379
380 GetModulePhiEtaIndexInSModule(nSupMod,nModule, iphim, ietam);
381 // ieta = ietam*fNETAdiv + (1-nIeta); // x(module) = -z(SM)
382 ieta = ietam*fNETAdiv + (fNETAdiv - 1 - nIeta); // x(module) = -z(SM)
383 iphi = iphim*fNPHIdiv + nIphi; // y(module) = y(SM)
384
385}
386
387
388//------------------------------------------------------------------------------------
389void AliJetDummyGeo::GetModulePhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, int &iphim, int &ietam) const
390{
391 // added nSupMod; - 19-oct-05 !
392 // Alice numbering scheme - Jun 01,2006
393 // ietam, iphi - indexes of module in two dimensional grid of SM
394 // ietam - have to change from 0 to fNZ-1
395 // iphim - have to change from 0 to nphi-1 (fNPhi-1 or fNPhi/2-1)
396 static Int_t nphi;
397
398 if(nSupMod>=10) nphi = fNPhi/2;
399 else nphi = fNPhi;
400
401 ietam = nModule/nphi;
402 iphim = nModule%nphi;
403}
404
405//------------------------------------------------------------------------------------
406Bool_t AliJetDummyGeo::GetAbsCellIdFromEtaPhi(Double_t eta, Double_t phi, Int_t &absId) const
407{
408 // Nov 17,2006
409 // stay here - phi problem as usual
410 static Int_t nSupMod, i, ieta, iphi, etaShift, nphi;
411 static Double_t absEta=0.0, d=0.0, dmin=0.0, phiLoc;
412 absId = nSupMod = - 1;
413 if(SuperModuleNumberFromEtaPhi(eta, phi, nSupMod)) {
414 // phi index first
415 phi = TVector2::Phi_0_2pi(phi);
416 phiLoc = phi - fPhiCentersOfSM[nSupMod/2];
417 nphi = fPhiCentersOfCells.GetSize();
418 if(nSupMod>=10) {
419 phiLoc = phi - 190.*TMath::DegToRad();
420 nphi /= 2;
421 }
422
423 dmin = TMath::Abs(fPhiCentersOfCells[0]-phiLoc);
424 iphi = 0;
425 for(i=1; i<nphi; i++) {
426 d = TMath::Abs(fPhiCentersOfCells[i] - phiLoc);
427 if(d < dmin) {
428 dmin = d;
429 iphi = i;
430 }
431 }
432 // odd SM are turned with respect of even SM - reverse indexes
433
434 // eta index
435 absEta = TMath::Abs(eta);
436 etaShift = iphi*fCentersOfCellsEtaDir.GetSize();
437 dmin = TMath::Abs(fEtaCentersOfCells[etaShift]-absEta);
438 ieta = 0;
439 for(i=1; i<fCentersOfCellsEtaDir.GetSize(); i++) {
440 d = TMath::Abs(fEtaCentersOfCells[i+etaShift] - absEta);
441 if(d < dmin) {
442 dmin = d;
443 ieta = i;
444 }
445 }
446
447 if(eta<0) iphi = (nphi-1) - iphi;
448 absId = GetAbsCellIdFromCellIndexes(nSupMod, iphi, ieta);
449
450 return kTRUE;
451 }
452 return kFALSE;
453}
454
455//------------------------------------------------------------------------------------
456Bool_t AliJetDummyGeo::SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi, Int_t &nSupMod) const
457{
458 // Return false if phi belongs a phi cracks between SM
459
460 static Int_t i;
461
462 if(TMath::Abs(eta) > fEtaMaxOfTRD1) return kFALSE;
463
464 phi = TVector2::Phi_0_2pi(phi); // move phi to (0,2pi) boundaries
465 for(i=0; i<6; i++) {
466 if(phi>=fPhiBoundariesOfSM[2*i] && phi<=fPhiBoundariesOfSM[2*i+1]) {
467 nSupMod = 2*i;
468 if(eta < 0.0) nSupMod++;
469 return kTRUE;
470 }
471 }
472 return kFALSE;
473}
474
475//------------------------------------------------------------------------------------
476Int_t AliJetDummyGeo::GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const
477{
478 // Transition from super module number(nSupMod) and cell indexes (ieta,iphi) to absId
479 static Int_t ietam, iphim, nModule;
480 static Int_t nIeta, nIphi; // cell indexes in module
481
482 GetModuleIndexesFromCellIndexesInSModule(nSupMod, iphi, ieta, ietam, iphim, nModule);
483
484 nIeta = ieta%fNETAdiv;
485 nIeta = fNETAdiv - 1 - nIeta;
486 nIphi = iphi%fNPHIdiv;
487
488 return GetAbsCellId(nSupMod, nModule, nIphi, nIeta);
489}
490
491//------------------------------------------------------------------------------------
492void AliJetDummyGeo::GetModuleIndexesFromCellIndexesInSModule(Int_t nSupMod, Int_t iphi, Int_t ieta,
493 Int_t &iphim, Int_t &ietam, Int_t &nModule) const
494{
495 // Transition from cell indexes (ieta,iphi) to module indexes (ietam,iphim, nModule)
496 static Int_t nphi;
497 nphi = GetNumberOfModuleInPhiDirection(nSupMod);
498
499 ietam = ieta/fNETAdiv;
500 iphim = iphi/fNPHIdiv;
501 nModule = ietam * nphi + iphim;
502}
503
504//------------------------------------------------------------------------------------
505Int_t AliJetDummyGeo::GetAbsCellId(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta) const
506{
507 // 27-aug-04;
508 // corr. 21-sep-04;
509 // 13-oct-05; 110 degree case
510 // May 31, 2006; ALICE numbering scheme:
511 // 0 <= nSupMod < fNumberOfSuperModules
512 // 0 <= nModule < fNPHI * fNZ ( fNPHI * fNZ/2 for fKey110DEG=1)
513 // 0 <= nIphi < fNPHIdiv
514 // 0 <= nIeta < fNETAdiv
515 // 0 <= absid < fNCells
516 static Int_t id=0; // have to change from 0 to fNCells-1
517 if(nSupMod >= 10) { // 110 degree case; last two supermodules
518 id = fNCellsInSupMod*10 + (fNCellsInSupMod/2)*(nSupMod-10);
519 } else {
520 id = fNCellsInSupMod*nSupMod;
521 }
522 id += fNCellsInModule *nModule;
523 id += fNPHIdiv *nIphi;
524 id += nIeta;
525 if(id<0 || id >= fNCells) {
526 id = -TMath::Abs(id); // if negative something wrong
527 }
528 return id;
529}
530
531//------------------------------------------------------------------------------------
532Bool_t AliJetDummyGeo::GetPhiBoundariesOfSMGap(Int_t nPhiSec, Double_t &phiMin, Double_t &phiMax) const
533{
534 // 0<= nPhiSec <=4; phi in rad
535 // 0; gap boundaries between 0th&2th | 1th&3th SM
536 // 1; gap boundaries between 2th&4th | 3th&5th SM
537 // 2; gap boundaries between 4th&6th | 5th&7th SM
538 // 3; gap boundaries between 6th&8th | 7th&9th SM
539 // 4; gap boundaries between 8th&10th | 9th&11th SM
540 if(nPhiSec<0 || nPhiSec >4) return kFALSE;
541 phiMin = fPhiBoundariesOfSM[2*nPhiSec+1];
542 phiMax = fPhiBoundariesOfSM[2*nPhiSec+2];
543 return kTRUE;
544}
545
546//------------------------------------------------------------------------------------
547void AliJetDummyGeo::GetTransformationForSM()
548{
549 // Uses the geometry manager to load the transformation matrix
550 // for the supermodules
551 // Unused after 19 Jan, 2007 - keep for compatibility;
552
553 return;
554 static Bool_t transInit=kFALSE;
555 if(transInit) return;
556
557 int i=0;
558 if(gGeoManager == 0) {
559 Info("CreateTransformationForSM() "," Load geometry : TGeoManager::Import()");
560 assert(0);
561 }
562
563 TGeoNode *tn = gGeoManager->GetTopNode();
564 TGeoNode *node=0, *xen1 = 0;
565 for(i=0; i<tn->GetNdaughters(); i++) {
566 node = tn->GetDaughter(i);
567 TString ns(node->GetName());
568 if(ns.Contains(GetNameOfEMCALEnvelope())) {
569 xen1 = node;
570 break;
571 }
572 }
573
574 if(!xen1) {
575 Info("CreateTransformationForSM() "," geometry has not EMCAL envelope with name %s",
576 GetNameOfEMCALEnvelope());
577 assert(0);
578 }
579 printf(" i %i : EMCAL Envelope is %s : #SM %i \n", i, xen1->GetName(), xen1->GetNdaughters());
580 for(i=0; i<xen1->GetNdaughters(); i++) {
581 TGeoNodeMatrix *sm = (TGeoNodeMatrix*)xen1->GetDaughter(i);
582 fMatrixOfSM[i] = sm->GetMatrix();
583 }
584 printf("transInit %d: ", transInit);
585 transInit = kTRUE;
586}
587