+}
+
+//________________________________________________________________________________________________
+void AliEMCALGeometry::GetGlobal(const TVector3 &vloc, TVector3 &vglob, int ind) const
+{
+ //Figure out the global numbering
+ //of a given supermodule from the
+ //local numbering given a 3-vector location
+
+ static Double_t tglob[3], tloc[3];
+ vloc.GetXYZ(tloc);
+ GetGlobal(tloc, tglob, ind);
+ vglob.SetXYZ(tglob[0], tglob[1], tglob[2]);
+}
+
+//________________________________________________________________________________________________
+void AliEMCALGeometry::GetGlobal(Int_t absId , double glob[3]) const
+{
+ // Alice numbering scheme - Jun 03, 2006
+ static Int_t nSupMod=-1, nModule=-1, nIphi=-1, nIeta=-1;
+ static double loc[3];
+
+ glob[0]=glob[1]=glob[2]=0.0; // bad case
+ if(RelPosCellInSModule(absId, loc)) {
+ GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
+ const TGeoHMatrix* m = GetMatrixForSuperModule(nSupMod);
+ if(m) {
+ m->LocalToMaster(loc, glob);
+ } else {
+ AliFatal("Geo matrixes are not loaded \n") ;
+ }
+ }
+}
+
+//___________________________________________________________________
+void AliEMCALGeometry::GetGlobal(Int_t absId , TVector3 &vglob) const
+{
+ // Alice numbering scheme - Jun 03, 2006
+ static Double_t glob[3];
+
+ GetGlobal(absId, glob);
+ vglob.SetXYZ(glob[0], glob[1], glob[2]);
+}
+
+//______________________________________________________________________
+void AliEMCALGeometry::PrintCellIndexes(Int_t absId, int pri, const char *tit) const
+{
+ // Service methods
+ Int_t nSupMod, nModule, nIphi, nIeta;
+ Int_t iphi, ieta;
+ TVector3 vg;
+
+ GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
+ printf(" %s | absId : %i -> nSupMod %i nModule %i nIphi %i nIeta %i \n", tit, absId, nSupMod, nModule, nIphi, nIeta);
+ if(pri>0) {
+ GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi,ieta);
+ printf(" local SM index : iphi %i : ieta %i \n", iphi,ieta);
+ GetGlobal(absId, vg);
+ printf(" vglob : mag %7.2f : perp %7.2f : z %7.2f : eta %6.4f : phi %6.4f(%6.2f) \n",
+ vg.Mag(), vg.Perp(), vg.Z(), vg.Eta(), vg.Phi(), vg.Phi()*TMath::RadToDeg());
+ }
+}
+
+void AliEMCALGeometry::PrintLocalTrd1(Int_t pri) const
+{
+ // For comparing with numbers from drawing
+ for(Int_t i=0; i<GetShishKebabTrd1Modules()->GetSize(); i++){
+ printf(" %s | ", GetShishKebabModule(i)->GetName());
+ if(i==0 && pri<1) GetShishKebabModule(i)->PrintShish(1);
+ else GetShishKebabModule(i)->PrintShish(pri);
+ }
+}
+
+//________________________________________________________________________________________________
+void AliEMCALGeometry::EtaPhiFromIndex(Int_t absId,Double_t &eta,Double_t &phi) const
+{
+ // Nov 16, 2006- float to double
+ // version for TRD1 only
+ static TVector3 vglob;
+ GetGlobal(absId, vglob);
+ eta = vglob.Eta();
+ phi = vglob.Phi();
+}
+
+//________________________________________________________________________________________________
+void AliEMCALGeometry::EtaPhiFromIndex(Int_t absId,Float_t &eta,Float_t &phi) const
+{
+ // Nov 16,2006 - should be discard in future
+ static TVector3 vglob;
+ GetGlobal(absId, vglob);
+ eta = float(vglob.Eta());
+ phi = float(vglob.Phi());
+}
+
+//
+// == Shish-kebab cases ==
+//
+//________________________________________________________________________________________________
+Int_t AliEMCALGeometry::GetAbsCellId(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta) const
+{
+ // 27-aug-04;
+ // corr. 21-sep-04;
+ // 13-oct-05; 110 degree case
+ // May 31, 2006; ALICE numbering scheme:
+ // 0 <= nSupMod < fNumberOfSuperModules
+ // 0 <= nModule < fNPHI * fNZ ( fNPHI * fNZ/2 for fKey110DEG=1)
+ // 0 <= nIphi < fNPHIdiv
+ // 0 <= nIeta < fNETAdiv
+ // 0 <= absid < fNCells
+ static Int_t id=0; // have to change from 0 to fNCells-1
+ if(fKey110DEG == 1 && nSupMod >= 10 && !fGeoName.Contains("12SMV1")) { // 110 degree case; last two supermodules halfsupermodules
+ id = fNCellsInSupMod*10 + (fNCellsInSupMod/2)*(nSupMod-10);
+ } else if(fKey110DEG == 1 && nSupMod >= 10 && fGeoName.Contains("12SMV1")) { // 110 degree case; last two supermodules 1/3 supermodules
+ id = fNCellsInSupMod*10 + (fNCellsInSupMod/3)*(nSupMod-10);
+ } else {
+ id = fNCellsInSupMod*nSupMod;
+ }
+ id += fNCellsInModule *nModule;
+ id += fNPHIdiv *nIphi;
+ id += nIeta;
+ if(id<0 || id >= fNCells) {
+// printf(" wrong numerations !!\n");
+// printf(" id %6i(will be force to -1)\n", id);
+// printf(" fNCells %6i\n", fNCells);
+// printf(" nSupMod %6i\n", nSupMod);
+// printf(" nModule %6i\n", nModule);
+// printf(" nIphi %6i\n", nIphi);
+// printf(" nIeta %6i\n", nIeta);
+ id = -TMath::Abs(id); // if negative something wrong
+ }
+ return id;
+}
+
+//________________________________________________________________________________________________
+void AliEMCALGeometry::GetModuleIndexesFromCellIndexesInSModule(Int_t nSupMod, Int_t iphi, Int_t ieta,
+ Int_t &iphim, Int_t &ietam, Int_t &nModule) const
+{
+ // Transition from cell indexes (ieta,iphi) to module indexes (ietam,iphim, nModule)
+ static Int_t nphi=-1;
+ nphi = GetNumberOfModuleInPhiDirection(nSupMod);
+
+ ietam = ieta/fNETAdiv;
+ iphim = iphi/fNPHIdiv;
+ nModule = ietam * nphi + iphim;
+}
+
+//________________________________________________________________________________________________
+Int_t AliEMCALGeometry::GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const
+{
+ // Transition from super module number(nSupMod) and cell indexes (ieta,iphi) to absId
+
+ // Check if the indeces correspond to existing SM or tower indeces
+ if(iphi < 0 || iphi >= AliEMCALGeoParams::fgkEMCALRows ||
+ ieta < 0 || ieta >= AliEMCALGeoParams::fgkEMCALCols ||
+ nSupMod < 0 || nSupMod >= GetNumberOfSuperModules() )
+ {
+ AliDebug(1,Form("Wrong cell indexes : SM %d, column (eta) %d, row (phi) %d", nSupMod,ieta,iphi));
+ return -1 ;
+ }
+
+ static Int_t ietam=-1, iphim=-1, nModule=-1;
+ static Int_t nIeta=-1, nIphi=-1; // cell indexes in module
+
+ GetModuleIndexesFromCellIndexesInSModule(nSupMod, iphi, ieta, ietam, iphim, nModule);
+
+ nIeta = ieta%fNETAdiv;
+ nIeta = fNETAdiv - 1 - nIeta;
+ nIphi = iphi%fNPHIdiv;
+
+ return GetAbsCellId(nSupMod, nModule, nIphi, nIeta);
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALGeometry::SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi, Int_t &nSupMod) const
+{
+ // Return false if phi belongs a phi cracks between SM