]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFGeometry.cxx
Compilation on Windoiws/Cygwin
[u/mrichter/AliRoot.git] / TOF / AliTOFGeometry.cxx
index 68f8ff400222769be28e8d414f02d16c9afbbfc4..77a4479759b81c1fe54ad793f2e5da5dabe349ca 100644 (file)
 
 /*
 $Log$
+Revision 1.20.1  2007/05/19 decaro
+         Added the following methods:
+             GetVolumeIndices(Int_t index, Int_t *det), to get
+          the volume indices (sector, plate, strip, padz, padx,
+          stored respectively in det[0], det[1], det[2], det[3], det[4])
+          from the calibration channel index;
+             NStrip(Int_t nPlate), to get the strips number
+          per each kind of TOF module.
+
+Revision 1.20  2007/10/08 17:52:55  decaro
+hole region in front of PHOS detector: update of sectors' numbers
+
+Revision 1.19  2007/10/04 14:05:09  zampolli
+AliTOFGeometryV5 becoming AliTOFGeometry
+
 Revision 1.18  2007/02/19 18:55:26  decaro
 Added getter methods for volume path (for Event Display)
 
@@ -100,10 +115,14 @@ Revision 0.01  2003/12/04 S.Arcelli
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "TGeoManager.h"
-#include "AliTOFGeometry.h"
+//#include "TGeoMatrix.h"
+#include "TMath.h"
+
 #include "AliLog.h"
 #include "AliConst.h"
 
+#include "AliTOFGeometry.h"
+
 extern TGeoManager *gGeoManager;
 
 ClassImp(AliTOFGeometry)
@@ -113,9 +132,9 @@ const Float_t AliTOFGeometry::fgkZlenB    = 146.5;    // length (cm) of the B mo
 const Float_t AliTOFGeometry::fgkZlenC    = 170.45;   // length (cm) of the C module
 const Float_t AliTOFGeometry::fgkMaxhZtof = 370.6;    // Max half z-size of TOF (cm)
 
-const Float_t AliTOFGeometry::fgkxTOF     = 371.-0.01;// Inner radius of the TOF for Reconstruction (cm)
-const Float_t AliTOFGeometry::fgkRmin     = 370.-0.01;// Inner radius of the TOF (cm)
-const Float_t AliTOFGeometry::fgkRmax     = 399.-0.01;// Outer radius of the TOF (cm)
+const Float_t AliTOFGeometry::fgkxTOF     = 372.00;// Inner radius of the TOF for Reconstruction (cm)
+const Float_t AliTOFGeometry::fgkRmin     = 371.00;// Inner radius of the TOF (cm)
+const Float_t AliTOFGeometry::fgkRmax     = 400.05;// Outer radius of the TOF (cm)
 
 const Int_t AliTOFGeometry::fgkTimeDiff   = 25000;  // Min signal separation (ps)
 const Float_t AliTOFGeometry::fgkXPad     = 2.5;    // Pad size in the x direction (cm)
@@ -183,7 +202,7 @@ const Float_t AliTOFGeometry::fgkDistances[kNPlates][kMaxNstrip]= {
   };
 //_____________________________________________________________________________
 AliTOFGeometry::AliTOFGeometry():
-  fHoles(0)
+  fHoles(1)
 {
   //
   // AliTOFGeometry default constructor
@@ -450,7 +469,7 @@ void AliTOFGeometry::GetVolumePath(Int_t *ind, Char_t *path ) {
   if( iplate==4) icopy=istrip+NStripC()+2*NStripB()+NStripA(); 
   icopy++;
   sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy);
-  if(fHoles && (sector==11 || sector==12)){
+  if(fHoles && (sector==13 || sector==14 || sector==15)){
     if(iplate<2)  sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
     if(iplate>2)  sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
   }
@@ -496,7 +515,7 @@ void AliTOFGeometry::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_
   if(plate==4) icopy=strip+NStripC()+2*NStripB()+NStripA(); 
   icopy++;
   sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy);
-  if(fHoles && (sector==11 || sector==12)) {
+  if(fHoles && (sector==13 || sector==14 || sector==15)){
     if(plate<2)  sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
     if(plate>2)  sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
   }
@@ -1802,6 +1821,70 @@ Int_t AliTOFGeometry::GetIndex(Int_t *detId)
                ipadx;
   return idet;
 }
+//_____________________________________________________________________________
+
+void AliTOFGeometry::GetVolumeIndices(Int_t index, Int_t *detId)
+{
+  //
+  // Retrieve volume indices from the calibration channel index 
+  //
+
+  detId[0] = index/NpadXStrip()/NStripXSector();
+
+  Int_t dummyStripPerModule = 
+    ( index - ( NStripXSector()*NpadXStrip()*detId[0]) ) / NpadXStrip();
+  if (dummyStripPerModule<kNStripC) {
+    detId[1] = 0;
+    detId[2] = dummyStripPerModule;
+  }
+  else if (dummyStripPerModule>=kNStripC && dummyStripPerModule<kNStripC+kNStripB) {
+    detId[1] = 1;
+    detId[2] = dummyStripPerModule-kNStripC;
+  }
+  else if (dummyStripPerModule>=kNStripC+kNStripB && dummyStripPerModule<kNStripC+kNStripB+kNStripA) {
+    detId[1] = 2;
+    detId[2] = dummyStripPerModule-kNStripC-kNStripB;
+  }
+  else if (dummyStripPerModule>=kNStripC+kNStripB+kNStripA && dummyStripPerModule<kNStripC+kNStripB+kNStripA+kNStripB) {
+    detId[1] = 3;
+    detId[2] = dummyStripPerModule-kNStripC-kNStripB-kNStripA;
+  }
+  else if (dummyStripPerModule>=kNStripC+kNStripB+kNStripA+kNStripB && dummyStripPerModule<NStripXSector()) {
+    detId[1] = 4;
+    detId[2] = dummyStripPerModule-kNStripC-kNStripB-kNStripA-kNStripB;
+  }
+
+  Int_t padPerStrip = ( index - ( NStripXSector()*NpadXStrip()*detId[0]) ) - dummyStripPerModule*NpadXStrip();
+
+  detId[3] = padPerStrip / kNpadX;
+  detId[4] = padPerStrip - detId[3]*kNpadX;
+
+}
+//_____________________________________________________________________________
+
+Int_t AliTOFGeometry::NStrip(Int_t nPlate)
+{
+  //
+  // Returns the strips number for the plate number 'nPlate'
+  //
 
+  Int_t nStrips = kNStripC;
+
+  switch(nPlate) {
+  case 2:
+    nStrips = kNStripA;
+    break;
+  case 1:
+  case 3:
+    nStrips = kNStripB;
+    break;
+  case 0:
+  case 4:
+  default:
+    nStrips = kNStripC;
+    break;
+  }
 
+  return nStrips;
 
+}