]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALGeometry.cxx
from Per Thomas: files for generation of PeakFinder OCDB object
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALGeometry.cxx
index a3f0d1fa139c5701f74d506e9e6fcea90cbfe81d..c8471e8a8caf015a460a56eab32547c6f2e4f449 100644 (file)
 //   EMCAL_COMPLETE (geometry for expected complete detector)
 //      = equivalent to SHISH_77_TRD1_2X2_FINAL_110DEG scTh=0.176 pbTh=0.144
 //          in old notation
+//   EMCAL_FIRSTYEARV1 - geometry for December 2009 to December 2010 run period; 
+//                fixed bug for positions of modules inside SM
+//                (first module has tilt 0.75 degree);
+//                the sizes updated with last information from production
+//                drawing (end of October 2010). 
+//      
+//   EMCAL_COMPLETEV1: Same fixes as FIRSTYEAR and 10 SM instead of 10+2 half SM
+//
 //   EMCAL_WSUC (Wayne State test stand)
 //      = no definite equivalent in old notation, was only used by
 //          Aleksei, but kept for testing purposes
@@ -45,7 +53,7 @@
 //*-- Author: Sahal Yacoob (LBL / UCT)
 //     and  : Yves Schutz (SUBATECH)
 //     and  : Jennifer Klay (LBL)
-//     and  : Aleksei Pavlinov (WSU) 
+//     and  : Alexei Pavlinov (WSU) 
 //
 
 //--- Root header files ---
 // // --- EMCAL headers
 #include "AliEMCALGeometry.h"
 #include "AliEMCALShishKebabTrd1Module.h"
-#include "AliEMCALRecPoint.h"
+//#include "AliEMCALRecPoint.h"
 //#include "AliEMCALHistoUtilities.h"
 
 ClassImp(AliEMCALGeometry)
 
 // these initialisations are needed for a singleton
 AliEMCALGeometry  *AliEMCALGeometry::fgGeom      = 0;
-const Char_t*      AliEMCALGeometry::fgkDefaultGeometryName = "EMCAL_COMPLETE";
+const Char_t*      AliEMCALGeometry::fgkDefaultGeometryName = "EMCAL_COMPLETEV1";
 //
 // Usage: 
 //        You can create the AliEMCALGeometry object independently from anything.
@@ -164,124 +172,153 @@ Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t distEff, Doub
   // Shift index taking into account the difference between standard SM 
   // and SM of half size in phi direction
   const  Int_t kphiIndexShift = fCentersOfCellsPhiDir.GetSize()/4; // Nov 22, 2006; was 6 for cas 2X2
-  static Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta;
-  static Int_t iphim, ietam;
+  static Int_t nSupMod=0, nModule=-1, nIphi=-1, nIeta=-1, iphi=-1, ieta=-1;
+  static Int_t iphim=-1, ietam=-1;
   static AliEMCALShishKebabTrd1Module *mod = 0;
   static TVector2 v;
   if(!CheckAbsCellId(absId)) return kFALSE;
-
+  
   GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
   GetModulePhiEtaIndexInSModule(nSupMod, nModule, iphim, ietam);
   GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi, ieta); 
-  mod = GetShishKebabModule(ietam);
-  mod->GetPositionAtCenterCellLine(nIeta, distEff, v); 
-  xr = v.Y() - fParSM[0];
-  zr = v.X() - fParSM[2];
-
-  if(nSupMod<10) {
-    yr = fCentersOfCellsPhiDir.At(iphi);
-  } else {
-    yr = fCentersOfCellsPhiDir.At(iphi + kphiIndexShift);
+  
+  //Get eta position. Careful with ALICE conventions (increase index decrease eta)     
+  if(nSupMod%2 == 0) {             
+    ietam = (fCentersOfCellsEtaDir.GetSize()/2-1)-ietam;// 47-ietam, revert the ordering on A side in order to keep convention.
+    if(nIeta == 0) nIeta = 1;
+    else          nIeta = 0;
   }
-  AliDebug(1,Form("absId %i nSupMod %i iphi %i ieta %i xr %f yr %f zr %f ",absId,nSupMod,iphi,ieta,xr,yr,zr));
-
-  return kTRUE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Int_t maxAbsId, Double_t distEff, Double_t &xr, Double_t &yr, Double_t &zr) const
-{
-  // Jul 31, 2007 - taking into account position of shower max and apply coor2.
-  // Look to see what the relative
-  // position inside a given cell is
-  // for a recpoint.
-  // In:
-  // absId     - cell is as in Geant,     0<= absId   < fNCells;
-  // maxAbsId  - abs id of cell with highest energy
-  // e         - cluster energy
-  // OUT:
-  // xr,yr,zr - x,y,z coordinates of cell with absId inside SM 
-
-  // Shift index taking into account the difference between standard SM 
-  // and SM of half size in phi direction
-  const  Int_t kphiIndexShift = fCentersOfCellsPhiDir.GetSize()/4; // Nov 22, 2006; was 6 for cas 2X2
-  static Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta;
-  static Int_t iphim, ietam;
-  static AliEMCALShishKebabTrd1Module *mod = 0;
-  static TVector2 v;
-
-  static Int_t nSupModM, nModuleM, nIphiM, nIetaM, iphiM, ietaM;
-  static Int_t iphimM, ietamM, maxAbsIdCopy=-1;
-  static AliEMCALShishKebabTrd1Module *modM = 0;
-  static Double_t distCorr;
-
-  if(!CheckAbsCellId(absId)) return kFALSE;
-
-  GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
-  GetModulePhiEtaIndexInSModule(nSupMod, nModule, iphim, ietam);
-  GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi, ieta); 
   mod = GetShishKebabModule(ietam);
-
-  if(absId != maxAbsId) {
-    distCorr = 0.;
-    if(maxAbsIdCopy != maxAbsId) {
-      GetCellIndex(maxAbsId, nSupModM, nModuleM, nIphiM, nIetaM);
-      GetModulePhiEtaIndexInSModule(nSupModM, nModuleM, iphimM, ietamM);
-      GetCellPhiEtaIndexInSModule(nSupModM,nModuleM,nIphiM,nIetaM, iphiM, ietaM); 
-      modM = GetShishKebabModule(ietamM); // do I need this ?
-      maxAbsIdCopy = maxAbsId;
-    }
-
-    if(ietamM !=0) {
-      distCorr = fEMCGeometry->GetEtaModuleSize()*(ietam-ietamM)/TMath::Tan(modM->GetTheta()); // Stay here
-      //printf(" distCorr %f | dist %f | ietam %i -> etamM %i\n", distCorr, dist, ietam, ietamM);  
-    }
-    // distEff += distCorr;
-  }
-  // Bad resolution in this case, strong bias vs phi
-  // distEff = 0.0; 
-  mod->GetPositionAtCenterCellLine(nIeta, distEff, v); // Stay here
+  mod ->GetPositionAtCenterCellLine(nIeta, distEff, v); 
   xr = v.Y() - fParSM[0];
   zr = v.X() - fParSM[2];
-
-  if(nSupMod<10) {
-    yr = fCentersOfCellsPhiDir.At(iphi);
+  
+  //Get phi position. Careful with ALICE conventions (increase index increase phi)
+  Int_t iphi2 = iphi;
+  if(nSupMod<10) { 
+    if(nSupMod%2 != 0) 
+      iphi2 = (fCentersOfCellsPhiDir.GetSize()-1)-iphi;// 23-iphi, revert the ordering on C side in order to keep convention.
+    yr = fCentersOfCellsPhiDir.At(iphi2);
+    
   } else {
-    yr = fCentersOfCellsPhiDir.At(iphi + kphiIndexShift);
+    if(nSupMod%2 != 0) 
+      iphi2 = (fCentersOfCellsPhiDir.GetSize()/2-1)-iphi;// 11-iphi, revert the ordering on C side in order to keep convention.
+    yr = fCentersOfCellsPhiDir.At(iphi2 + kphiIndexShift);
   }
+  
   AliDebug(1,Form("absId %i nSupMod %i iphi %i ieta %i xr %f yr %f zr %f ",absId,nSupMod,iphi,ieta,xr,yr,zr));
-
+  
   return kTRUE;
 }
 
+//Not in use, comment for the moment
+//________________________________________________________________________________________________
+//Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Int_t maxAbsId, Double_t distEff, Double_t &xr, Double_t &yr, Double_t &zr) const
+//{
+//  // Jul 31, 2007 - taking into account position of shower max and apply coor2.
+//  // Look to see what the relative
+//  // position inside a given cell is
+//  // for a recpoint.
+//  // In:
+//  // absId     - cell is as in Geant,     0<= absId   < fNCells;
+//  // maxAbsId  - abs id of cell with highest energy
+//  // e         - cluster energy
+//  // OUT:
+//  // xr,yr,zr - x,y,z coordinates of cell with absId inside SM 
+//  
+//  // Shift index taking into account the difference between standard SM 
+//  // and SM of half size in phi direction
+//  const  Int_t kphiIndexShift = fCentersOfCellsPhiDir.GetSize()/4; // Nov 22, 2006; was 6 for cas 2X2
+//  static Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta;
+//  static Int_t iphim, ietam;
+//  static AliEMCALShishKebabTrd1Module *mod = 0;
+//  static TVector2 v;
+//
+//  static Int_t nSupModM, nModuleM, nIphiM, nIetaM, iphiM, ietaM;
+//  static Int_t iphimM, ietamM, maxAbsIdCopy=-1;
+//  static AliEMCALShishKebabTrd1Module *modM = 0;
+//  static Double_t distCorr;
+//
+//  if(!CheckAbsCellId(absId)) return kFALSE;
+//  
+//  GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
+//  GetModulePhiEtaIndexInSModule(nSupMod, nModule, iphim, ietam);
+//  GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi, ieta); 
+//  
+//  //Get eta position. Careful with ALICE conventions (increase index decrease eta)   
+//  if(nSupMod%2 == 0) {             
+//    ietam = (fCentersOfCellsEtaDir.GetSize()/2-1)-ietam;// 23-ietam, revert the ordering on A side in order to keep convention.
+//    if(nIeta == 0) nIeta = 1;
+//    else                nIeta = 0;
+//  }
+//  
+//  mod = GetShishKebabModule(ietam);
+//  
+//  if(absId != maxAbsId) {
+//    distCorr = 0.;
+//    if(maxAbsIdCopy != maxAbsId) {
+//      GetCellIndex(maxAbsId, nSupModM, nModuleM, nIphiM, nIetaM);
+//      GetModulePhiEtaIndexInSModule(nSupModM, nModuleM, iphimM, ietamM);
+//      GetCellPhiEtaIndexInSModule(nSupModM,nModuleM,nIphiM,nIetaM, iphiM, ietaM); 
+//      //Careful with ALICE conventions (increase index decrease eta) 
+//      if(nSupModM%2 == 0) {             
+//     ietamM = (fCentersOfCellsEtaDir.GetSize()/2-1)-ietamM;// 47-ietam, revert the ordering on A side in order to keep convention.
+//      }
+//      
+//      modM = GetShishKebabModule(ietamM); // do I need this ?
+//      maxAbsIdCopy = maxAbsId;
+//    }
+//    
+//    if(ietamM !=0) {
+//      distCorr = fEMCGeometry->GetEtaModuleSize()*(ietam-ietamM)/TMath::Tan(modM->GetTheta()); // Stay here
+//      //printf(" distCorr %f | dist %f | ietam %i -> etamM %i\n", distCorr, dist, ietam, ietamM);  
+//    }
+//    // distEff += distCorr;
+//  }
+//  // Bad resolution in this case, strong bias vs phi
+//  // distEff = 0.0; 
+//  mod->GetPositionAtCenterCellLine(nIeta, distEff, v); // Stay here
+//  xr = v.Y() - fParSM[0];
+//  zr = v.X() - fParSM[2];
+//  
+//  //Get phi position. Careful with ALICE conventions (increase index increase phi)
+//  Int_t iphi2 = iphi;
+//  if(nSupMod<10) { 
+//    if(nSupMod%2 != 0) 
+//      iphi2 = (fCentersOfCellsPhiDir.GetSize()-1)-iphi;// 23-iphi, revert the ordering on C side in order to keep convention.
+//    yr = fCentersOfCellsPhiDir.At(iphi2);
+//    
+//  } else {
+//    if(nSupMod%2 != 0) 
+//      iphi2 = (fCentersOfCellsPhiDir.GetSize()/2-1)-iphi;// 11-iphi, revert the ordering on C side in order to keep convention.
+//    yr = fCentersOfCellsPhiDir.At(iphi2 + kphiIndexShift);
+//  }
+//  AliDebug(1,Form("absId %i nSupMod %i iphi %i ieta %i xr %f yr %f zr %f ",absId,nSupMod,iphi,ieta,xr,yr,zr));
+//  
+//  return kTRUE;
+//}
+//
 
 //
 // == Shish-kebab cases ==
 //
 
-
-//____________________________________________________________________________
-void AliEMCALGeometry::GetGlobal(const AliRecPoint* /*rp*/, TVector3& /* vglob */) const
-{
-  AliFatal(Form("Please use GetGlobalEMCAL(recPoint,gpos) instead of GetGlobal!"));
-}
-
-//_________________________________________________________________________________
-void AliEMCALGeometry::GetGlobalEMCAL(const AliEMCALRecPoint *rp, TVector3 &vglob) const
-{
-  // Figure out the global numbering
-  // of a given supermodule from the
-  // local numbering for RecPoints
-
-  static TVector3 vloc;
-  static Int_t nSupMod, nModule, nIphi, nIeta;
-
-  const AliEMCALRecPoint *rpTmp = rp;
-  const AliEMCALRecPoint *rpEmc = rpTmp;
-
-  GetCellIndex(rpEmc->GetAbsId(0), nSupMod, nModule, nIphi, nIeta);
-  rpTmp->GetLocalPosition(vloc);
-  GetGlobal(vloc, vglob, nSupMod);
-}
+//
+////_________________________________________________________________________________
+//void AliEMCALGeometry::GetGlobalEMCAL(const AliEMCALRecPoint *rp, TVector3 &vglob) const
+//{
+//  // Figure out the global numbering
+//  // of a given supermodule from the
+//  // local numbering for RecPoints
+//
+//  static TVector3 vloc;
+//  static Int_t nSupMod, nModule, nIphi, nIeta;
+//
+//  const AliEMCALRecPoint *rpTmp = rp;
+//  const AliEMCALRecPoint *rpEmc = rpTmp;
+//
+//  GetCellIndex(rpEmc->GetAbsId(0), nSupMod, nModule, nIphi, nIeta);
+//  rpTmp->GetLocalPosition(vloc);
+//  GetGlobal(vloc, vglob, nSupMod);
+//}