]> git.uio.no Git - u/mrichter/AliRoot.git/blob - JETAN/AliJetDummyGeo.cxx
Using float precission for mean field components (Marian)
[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   delete [] fMatrixOfSM;
226 }
227
228 //------------------------------------------------------------------------------------
229 void AliJetDummyGeo::EtaPhiFromIndex(Int_t absId, Float_t& eta, Float_t& phi)
230 {
231   // Nov 16, 2006- float to double
232   // version for TRD1 only
233   static TVector3 vglob;
234   GetGlobal(absId, vglob);
235   eta = vglob.Eta();
236   phi = vglob.Phi();
237
238 }
239
240 //------------------------------------------------------------------------------------
241 void AliJetDummyGeo::GetGlobal(const Double_t *loc, Double_t *glob, int ind) const
242 {
243   // Figure out the global numbering of a given supermodule from the
244   // local numbering
245   // Alice numbering - Jun 03,2006
246   //  if(fMatrixOfSM[0] == 0) GetTransformationForSM();
247
248   if(ind>=0 && ind < GetNumberOfSuperModules()) {
249     fMatrixOfSM[ind]->LocalToMaster(loc, glob);
250   }
251 }
252
253 //------------------------------------------------------------------------------------
254 void AliJetDummyGeo::GetGlobal(Int_t absId , double glob[3]) const
255
256   // Alice numbering scheme - Jun 03, 2006
257   static Int_t nSupMod, nModule, nIphi, nIeta;
258   static double loc[3];
259
260   glob[0]=glob[1]=glob[2]=0.0; // bad case
261   if(RelPosCellInSModule(absId, loc)) {
262     GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
263     fMatrixOfSM[nSupMod]->LocalToMaster(loc, glob);
264   }
265 }
266
267 //------------------------------------------------------------------------------------
268 void AliJetDummyGeo::GetGlobal(Int_t absId , TVector3 &vglob) const
269
270   // Alice numbering scheme - Jun 03, 2006
271   static Double_t glob[3];
272
273   GetGlobal(absId, glob);
274   vglob.SetXYZ(glob[0], glob[1], glob[2]);
275
276 }
277
278 //------------------------------------------------------------------------------------
279 Bool_t AliJetDummyGeo::RelPosCellInSModule(Int_t absId, Double_t loc[3]) const
280 {
281   // Alice numbering scheme - Jun 03, 2006
282   loc[0] = loc[1] = loc[2]=0.0;
283   if(RelPosCellInSModule(absId, loc[0],loc[1],loc[2])) {
284     return kTRUE;
285   }
286   return kFALSE;
287 }
288
289 //------------------------------------------------------------------------------------
290 Bool_t AliJetDummyGeo::RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) const
291 {
292   // Look to see what the relative position inside a given cell is
293   // for a recpoint.
294   // Alice numbering scheme - Jun 08, 2006
295   // In:
296   // absId   - cell is as in Geant,     0<= absId   < fNCells;
297   // OUT:
298   // xr,yr,zr - x,y,z coordinates of cell with absId inside SM 
299
300   // Shift index taking into account the difference between standard SM 
301   // and SM of half size in phi direction
302   const Int_t kPhiIndexShift = fCentersOfCellsPhiDir.GetSize()/4; // Nov 22, 2006; was 6 for cas 2X2
303   static Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta;
304   if(!CheckAbsCellId(absId)) return kFALSE;
305
306   GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
307   GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi, ieta); 
308  
309   xr = fCentersOfCellsXDir.At(ieta);
310   zr = fCentersOfCellsEtaDir.At(ieta);
311
312   if(nSupMod<10) {
313     yr = fCentersOfCellsPhiDir.At(iphi);
314   } else {
315     yr = fCentersOfCellsPhiDir.At(iphi + kPhiIndexShift);
316   }
317
318   return kTRUE;
319 }
320
321 //------------------------------------------------------------------------------------
322 Bool_t  AliJetDummyGeo::CheckAbsCellId(Int_t absId) const
323
324   // May 31, 2006; only trd1 now
325   if(absId<0 || absId >= fNCells) return kFALSE;
326   else                            return kTRUE;
327 }
328
329 //------------------------------------------------------------------------------------
330 Bool_t AliJetDummyGeo::GetCellIndex(Int_t absId,Int_t &nSupMod,Int_t &nModule,Int_t &nIphi,Int_t &nIeta) const
331
332   // 21-sep-04; 19-oct-05;
333   // May 31, 2006; ALICE numbering scheme:
334   // 
335   // In:
336   // absId   - cell is as in Geant,     0<= absId   < fNCells;
337   // Out:
338   // nSupMod - super module(SM) number, 0<= nSupMod < fNumberOfSuperModules;
339   // nModule  - module number in SM,    0<= nModule  < fNCellsInSupMod/fNCellsInSupMod or(/2) for tow last SM (10th and 11th);
340   // nIphi   - cell number in phi driection inside module; 0<= nIphi < fNPHIdiv; 
341   // nIeta   - cell number in eta driection inside module; 0<= nIeta < fNETAdiv; 
342   // 
343   static Int_t tmp=0, sm10=0;
344   if(!CheckAbsCellId(absId)) return kFALSE;
345
346   sm10 = fNCellsInSupMod*10;
347   if(absId >= sm10) { // 110 degree case; last two supermodules  
348     nSupMod = (absId-sm10) / (fNCellsInSupMod/2) + 10;
349     tmp     = (absId-sm10) % (fNCellsInSupMod/2);
350   } else {
351     nSupMod = absId / fNCellsInSupMod;
352     tmp     = absId % fNCellsInSupMod;
353   }
354
355   nModule  = tmp / fNCellsInModule;
356   tmp     = tmp % fNCellsInModule;
357   nIphi   = tmp / fNPHIdiv;
358   nIeta   = tmp % fNPHIdiv;
359
360   return kTRUE;
361 }
362
363 //------------------------------------------------------------------------------------
364 void AliJetDummyGeo::GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta, int &iphi, int &ieta) const
365
366   // 
367   // Added nSupMod; Nov 25, 05
368   // Alice numbering scheme  - Jun 01,2006 
369   // IN:
370   // nSupMod - super module(SM) number, 0<= nSupMod < fNumberOfSuperModules;
371   // nModule  - module number in SM,     0<= nModule  < fNCellsInSupMod/fNCellsInSupMod or(/2) for tow last SM (10th and 11th);
372   // nIphi   - cell number in phi driection inside module; 0<= nIphi < fNPHIdiv; 
373   // nIeta   - cell number in eta driection inside module; 0<= nIeta < fNETAdiv; 
374   // 
375  // OUT:
376   // ieta, iphi - indexes of cell(tower) in two dimensional grid of SM
377   // ieta - have to change from 0 to (fNZ*fNETAdiv-1)
378   // iphi - have to change from 0 to (fNPhi*fNPHIdiv-1 or fNPhi*fNPHIdiv/2-1)
379   //
380   static Int_t iphim, ietam;
381
382   GetModulePhiEtaIndexInSModule(nSupMod,nModule, iphim, ietam); 
383   //  ieta  = ietam*fNETAdiv + (1-nIeta); // x(module) = -z(SM) 
384   ieta  = ietam*fNETAdiv + (fNETAdiv - 1 - nIeta); // x(module) = -z(SM) 
385   iphi  = iphim*fNPHIdiv + nIphi;     // y(module) =  y(SM) 
386
387 }
388
389
390 //------------------------------------------------------------------------------------
391 void AliJetDummyGeo::GetModulePhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule,  int &iphim, int &ietam) const
392
393   // added nSupMod; - 19-oct-05 !
394   // Alice numbering scheme        - Jun 01,2006 
395   // ietam, iphi - indexes of module in two dimensional grid of SM
396   // ietam - have to change from 0 to fNZ-1
397   // iphim - have to change from 0 to nphi-1 (fNPhi-1 or fNPhi/2-1)
398   static Int_t nphi;
399
400   if(nSupMod>=10) nphi = fNPhi/2;
401   else            nphi = fNPhi;
402
403   ietam = nModule/nphi;
404   iphim = nModule%nphi;
405 }
406
407 //------------------------------------------------------------------------------------
408 Bool_t AliJetDummyGeo::GetAbsCellIdFromEtaPhi(Double_t eta, Double_t phi, Int_t &absId) const
409 {
410   // Nov 17,2006
411   // stay here - phi problem as usual 
412   static Int_t nSupMod, i, ieta, iphi, etaShift, nphi;
413   static Double_t absEta=0.0, d=0.0, dmin=0.0, phiLoc;
414   absId = nSupMod = - 1;
415   if(SuperModuleNumberFromEtaPhi(eta, phi, nSupMod)) {
416     // phi index first
417     phi    = TVector2::Phi_0_2pi(phi);
418     phiLoc = phi - fPhiCentersOfSM[nSupMod/2];
419     nphi   = fPhiCentersOfCells.GetSize();
420     if(nSupMod>=10) {
421       phiLoc = phi - 190.*TMath::DegToRad();
422       nphi /= 2;
423     }
424
425     dmin   = TMath::Abs(fPhiCentersOfCells[0]-phiLoc);
426     iphi   = 0;
427     for(i=1; i<nphi; i++) {
428       d = TMath::Abs(fPhiCentersOfCells[i] - phiLoc);
429       if(d < dmin) {
430         dmin = d;
431         iphi = i;
432       }
433     }
434     // odd SM are turned with respect of even SM - reverse indexes
435
436     // eta index
437     absEta   = TMath::Abs(eta);
438     etaShift = iphi*fCentersOfCellsEtaDir.GetSize();
439     dmin     = TMath::Abs(fEtaCentersOfCells[etaShift]-absEta);
440     ieta     = 0;
441     for(i=1; i<fCentersOfCellsEtaDir.GetSize(); i++) {
442       d = TMath::Abs(fEtaCentersOfCells[i+etaShift] - absEta);
443       if(d < dmin) {
444         dmin = d;
445         ieta = i;
446       }
447     }
448
449     if(eta<0) iphi = (nphi-1) - iphi;
450     absId = GetAbsCellIdFromCellIndexes(nSupMod, iphi, ieta);
451
452     return kTRUE;
453   }
454   return kFALSE;
455 }
456
457 //------------------------------------------------------------------------------------
458 Bool_t AliJetDummyGeo::SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi, Int_t &nSupMod) const
459
460   // Return false if phi belongs a phi cracks between SM
461  
462   static Int_t i;
463
464   if(TMath::Abs(eta) > fEtaMaxOfTRD1) return kFALSE;
465
466   phi = TVector2::Phi_0_2pi(phi); // move phi to (0,2pi) boundaries
467   for(i=0; i<6; i++) {
468     if(phi>=fPhiBoundariesOfSM[2*i] && phi<=fPhiBoundariesOfSM[2*i+1]) {
469       nSupMod = 2*i;
470       if(eta < 0.0) nSupMod++;
471       return kTRUE;
472     }
473   }
474   return kFALSE;
475 }
476
477 //------------------------------------------------------------------------------------
478 Int_t  AliJetDummyGeo::GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const
479 {
480   // Transition from super module number(nSupMod) and cell indexes (ieta,iphi) to absId
481   static Int_t ietam, iphim, nModule;
482   static Int_t nIeta, nIphi; // cell indexes in module
483
484   GetModuleIndexesFromCellIndexesInSModule(nSupMod, iphi, ieta, ietam, iphim, nModule);
485
486   nIeta = ieta%fNETAdiv;
487   nIeta = fNETAdiv - 1 - nIeta;
488   nIphi = iphi%fNPHIdiv;
489
490   return GetAbsCellId(nSupMod, nModule, nIphi, nIeta);
491 }
492
493 //------------------------------------------------------------------------------------
494 void  AliJetDummyGeo::GetModuleIndexesFromCellIndexesInSModule(Int_t nSupMod, Int_t iphi, Int_t ieta, 
495                         Int_t &iphim, Int_t &ietam, Int_t &nModule) const
496 {
497   // Transition from cell indexes (ieta,iphi) to module indexes (ietam,iphim, nModule)
498   static Int_t nphi;
499   nphi  = GetNumberOfModuleInPhiDirection(nSupMod);  
500
501   ietam  = ieta/fNETAdiv;
502   iphim  = iphi/fNPHIdiv;
503   nModule = ietam * nphi + iphim; 
504 }
505
506 //------------------------------------------------------------------------------------
507 Int_t AliJetDummyGeo::GetAbsCellId(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta) const
508
509   // 27-aug-04; 
510   // corr. 21-sep-04; 
511   //       13-oct-05; 110 degree case
512   // May 31, 2006; ALICE numbering scheme:
513   // 0 <= nSupMod < fNumberOfSuperModules
514   // 0 <= nModule  < fNPHI * fNZ ( fNPHI * fNZ/2 for fKey110DEG=1)
515   // 0 <= nIphi   < fNPHIdiv
516   // 0 <= nIeta   < fNETAdiv
517   // 0 <= absid   < fNCells
518   static Int_t id=0; // have to change from 0 to fNCells-1
519   if(nSupMod >= 10) { // 110 degree case; last two supermodules
520     id  = fNCellsInSupMod*10 + (fNCellsInSupMod/2)*(nSupMod-10);
521   } else {
522     id  = fNCellsInSupMod*nSupMod;
523   }
524   id += fNCellsInModule *nModule;
525   id += fNPHIdiv *nIphi;
526   id += nIeta;
527   if(id<0 || id >= fNCells) {
528     id = -TMath::Abs(id); // if negative something wrong
529   }
530   return id;
531 }
532
533 //------------------------------------------------------------------------------------
534 Bool_t AliJetDummyGeo::GetPhiBoundariesOfSMGap(Int_t nPhiSec, Double_t &phiMin, Double_t &phiMax) const
535 {
536   // 0<= nPhiSec <=4; phi in rad
537   // 0;  gap boundaries between  0th&2th  | 1th&3th SM
538   // 1;  gap boundaries between  2th&4th  | 3th&5th SM
539   // 2;  gap boundaries between  4th&6th  | 5th&7th SM
540   // 3;  gap boundaries between  6th&8th  | 7th&9th SM
541   // 4;  gap boundaries between  8th&10th | 9th&11th SM
542   if(nPhiSec<0 || nPhiSec >4) return kFALSE; 
543   phiMin = fPhiBoundariesOfSM[2*nPhiSec+1];
544   phiMax = fPhiBoundariesOfSM[2*nPhiSec+2];
545   return kTRUE; 
546 }
547
548 //------------------------------------------------------------------------------------
549 void  AliJetDummyGeo::GetTransformationForSM()
550 {
551   // Uses the geometry manager to load the transformation matrix
552   // for the supermodules
553   // Unused after 19 Jan, 2007 - keep for compatibility; 
554
555   return;
556   static Bool_t transInit=kFALSE;
557   if(transInit) return;
558
559   int i=0;
560   if(gGeoManager == 0) {
561     Info("CreateTransformationForSM() "," Load geometry : TGeoManager::Import()");
562     assert(0);
563   }
564
565   TGeoNode *tn = gGeoManager->GetTopNode();
566   TGeoNode *node=0, *xen1 = 0;
567   for(i=0; i<tn->GetNdaughters(); i++) {
568     node = tn->GetDaughter(i);
569     TString ns(node->GetName());
570     if(ns.Contains(GetNameOfEMCALEnvelope())) {
571       xen1 = node;
572       break;
573     }
574   }
575
576   if(!xen1) {
577     Info("CreateTransformationForSM() "," geometry has not EMCAL envelope with name %s", 
578     GetNameOfEMCALEnvelope());
579     assert(0);
580   }
581   printf(" i %i : EMCAL Envelope is %s : #SM %i \n", i, xen1->GetName(), xen1->GetNdaughters());
582   for(i=0; i<xen1->GetNdaughters(); i++) {
583     TGeoNodeMatrix *sm = (TGeoNodeMatrix*)xen1->GetDaughter(i);
584     fMatrixOfSM[i] = sm->GetMatrix();
585   }
586   printf("transInit %d: ", transInit);
587   transInit = kTRUE;
588 }
589