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