]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFGeometry.cxx
Adding analysis task for equalizing the VZERO signals in 2010 p-p data (David)
[u/mrichter/AliRoot.git] / TOF / AliTOFGeometry.cxx
index 5dfd0b7b57b3b69d6499622884ee3b78d9a33d44..a06c401c15451415b2aac11961bb0265b95b35a0 100644 (file)
@@ -147,10 +147,15 @@ const Float_t AliTOFGeometry::fgkSigmaForTail2= 0.5;//Sig2 for simulation of TDC
 
 const Float_t AliTOFGeometry::fgkPhiSec= 20;//sector Phi width (deg)
 
+Bool_t  AliTOFGeometry::fgHoles  = 1;//logical for geometry version (w/wo holes)
+
 const Float_t AliTOFGeometry::fgkTdcBin = 24.4;     // time-of-flight bin width [ps]
 const Float_t AliTOFGeometry::fgkToTBin = 48.8;     // time-over-threshold bin width [ps]
 const Float_t AliTOFGeometry::fgkBunchCrossingBin = fgkTdcBin * 1024; // bunch-crossing bin width [ps]
 
+const Float_t AliTOFGeometry::fgkSlewTOTMin = 10.; // min TOT for slewing correction [ns]
+const Float_t AliTOFGeometry::fgkSlewTOTMax = 16.; // max TOT for slewing correction [ns]
+
 const Float_t AliTOFGeometry::fgkDeadTime = 25E+03;        // Single channel dead time (ps)
 const Float_t AliTOFGeometry::fgkMatchingWindow = fgkTdcBin*TMath::Power(2,13); // Matching window  (ps)
 
@@ -252,8 +257,7 @@ const Float_t AliTOFGeometry::fgkDistances[kNPlates][kMaxNstrip] = {
   };
 */
 //_____________________________________________________________________________
-AliTOFGeometry::AliTOFGeometry():
-  fHoles(1)
+AliTOFGeometry::AliTOFGeometry()
 {
   //
   // AliTOFGeometry default constructor
@@ -273,7 +277,7 @@ void AliTOFGeometry::ImportGeometry(){
   TGeoManager::Import("geometry.root");
 }
 //_____________________________________________________________________________
-void AliTOFGeometry::GetPosPar(Int_t *det, Float_t *pos) const
+void AliTOFGeometry::GetPosPar(Int_t *det, Float_t *pos)
 {
 //
 // Returns space point coor (x,y,z) (cm)  for Detector 
@@ -286,7 +290,7 @@ void AliTOFGeometry::GetPosPar(Int_t *det, Float_t *pos) const
   
 }
 //_____________________________________________________________________________
-void AliTOFGeometry::GetDetID( Float_t *pos, Int_t *det) const
+void AliTOFGeometry::GetDetID( Float_t *pos, Int_t *det)
 {
  //
  // Returns Detector Indices (iSect,iPlate,iStrip,iPadX,iPadZ) 
@@ -326,7 +330,7 @@ void AliTOFGeometry::DetToStripRF(Int_t nPadX, Int_t nPadZ, Float_t &x,  Float_t
 
 }
 //_____________________________________________________________________________
-Float_t AliTOFGeometry::DistanceToPadPar(Int_t *det, const Float_t * const pos, Float_t *dist3d) const
+Float_t AliTOFGeometry::DistanceToPadPar(Int_t *det, const Float_t * pos, Float_t *dist3d)
 {
 //
 // Returns distance of  space point with coor pos (x,y,z) (cm) wrt 
@@ -389,7 +393,7 @@ Float_t AliTOFGeometry::DistanceToPadPar(Int_t *det, const Float_t * const pos,
 
 }
 //_____________________________________________________________________________
-Bool_t AliTOFGeometry::IsInsideThePadPar(Int_t *det, const Float_t * const pos) const
+Bool_t AliTOFGeometry::IsInsideThePadPar(Int_t *det, const Float_t * pos)
 {
 //
 // Returns true if space point with coor pos (x,y,z) (cm) falls 
@@ -460,7 +464,7 @@ Bool_t AliTOFGeometry::IsInsideThePadPar(Int_t *det, const Float_t * const pos)
 
 }
 //_____________________________________________________________________________
-Bool_t AliTOFGeometry::IsInsideThePad(TGeoHMatrix mat, const Float_t * const pos, Float_t *dist3d) const
+Bool_t AliTOFGeometry::IsInsideThePad(TGeoHMatrix *mat, const Float_t * pos, Float_t *dist3d)
 {
   //
   // Returns true if space point with coor pos (x,y,z) [cm] falls inside
@@ -480,7 +484,7 @@ Bool_t AliTOFGeometry::IsInsideThePad(TGeoHMatrix mat, const Float_t * const pos
   // from ALICE global reference system
   // towards TOF pad reference system
   Double_t posl[3] = {0., 0., 0.};
-  mat.MasterToLocal(posg,posl);
+  mat->MasterToLocal(posg,posl);
 
   Float_t xr = posl[0];
   Float_t yr = posl[1];
@@ -502,7 +506,7 @@ Bool_t AliTOFGeometry::IsInsideThePad(TGeoHMatrix mat, const Float_t * const pos
     Double_t padg[3] = {0., 0., 0.};
     // from TOF pad local reference system
     // towards ALICE global reference system
-    TGeoHMatrix inverse = mat.Inverse();
+    TGeoHMatrix inverse = mat->Inverse();
     inverse.MasterToLocal(padl,padg);
 
     // returns the 3d distance
@@ -518,19 +522,22 @@ Bool_t AliTOFGeometry::IsInsideThePad(TGeoHMatrix mat, const Float_t * const pos
 
 }
 //_____________________________________________________________________________
-void AliTOFGeometry::GetVolumePath(const Int_t * const ind, Char_t *path ) {
+void AliTOFGeometry::GetVolumePath(const Int_t * ind, Char_t *path ) {
   //--------------------------------------------------------------------
   // This function returns the colume path of a given pad 
   //--------------------------------------------------------------------
   Int_t sector = ind[0];
-  Char_t  string1[100];
-  Char_t  string2[100];
-  Char_t  string3[100];
+
+  const Int_t kSize = 100;
+
+  Char_t  string1[kSize];
+  Char_t  string2[kSize];
+  Char_t  string3[kSize];
   
   Int_t icopy=-1;
   icopy=sector;
  
-  sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
+  snprintf(string1,kSize,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
   
   Int_t iplate=ind[1];
   Int_t istrip=ind[2];
@@ -540,16 +547,16 @@ void AliTOFGeometry::GetVolumePath(const Int_t * const ind, Char_t *path ) {
   if( iplate==3) icopy=istrip+NStripC()+NStripB()+NStripA(); 
   if( iplate==4) icopy=istrip+NStripC()+2*NStripB()+NStripA(); 
   icopy++;
-  sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy);
-  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);
+  snprintf(string2,kSize,"FTOA_0/FLTA_0/FSTR_%i",icopy);
+  if(fgHoles && (sector==13 || sector==14 || sector==15)){
+    if(iplate<2)  snprintf(string2,kSize,"FTOB_0/FLTB_0/FSTR_%i",icopy);
+    if(iplate>2)  snprintf(string2,kSize,"FTOC_0/FLTC_0/FSTR_%i",icopy);
   }
  
   Int_t padz = ind[3]+1; 
   Int_t padx = ind[4]+1;
-  sprintf(string3,"FPCB_1/FSEN_1/FSEZ_%i/FPAD_%i",padz,padx);
-  sprintf(path,"%s/%s/%s",string1,string2,string3); 
+  snprintf(string3,kSize,"FPCB_1/FSEN_1/FSEZ_%i/FPAD_%i",padz,padx);
+  snprintf(path,2*kSize,"%s/%s/%s",string1,string2,string3); 
 
 }
 //_____________________________________________________________________________
@@ -558,12 +565,14 @@ void AliTOFGeometry::GetVolumePath(Int_t sector, Char_t *path ){
   // This function returns the colume path of a given sector 
   //--------------------------------------------------------------------
 
-  Char_t string[100];
+  const Int_t kSize = 100;
+
+  Char_t string[kSize];
 
   Int_t icopy = sector;
 
-  sprintf(string,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
-  sprintf(path,"%s",string);
+  snprintf(string,kSize,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
+  snprintf(path,2*kSize,"%s",string);
 
 }
 //_____________________________________________________________________________
@@ -572,13 +581,15 @@ void AliTOFGeometry::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_
   // This function returns the colume path of a given strip 
   //--------------------------------------------------------------------
 
-  Char_t string1[100];
-  Char_t string2[100];
-  Char_t string3[100];
+  const Int_t kSize = 100;
+
+  Char_t string1[kSize];
+  Char_t string2[kSize];
+  Char_t string3[kSize];
   
   Int_t icopy = sector;
 
-  sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
+  snprintf(string1,kSize,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
   
   if(plate==0) icopy=strip; 
   if(plate==1) icopy=strip+NStripC(); 
@@ -586,14 +597,14 @@ void AliTOFGeometry::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_
   if(plate==3) icopy=strip+NStripC()+NStripB()+NStripA(); 
   if(plate==4) icopy=strip+NStripC()+2*NStripB()+NStripA(); 
   icopy++;
-  sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy);
-  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);
+  snprintf(string2,kSize,"FTOA_0/FLTA_0/FSTR_%i",icopy);
+  if(fgHoles && (sector==13 || sector==14 || sector==15)){
+    if(plate<2)  snprintf(string2,kSize,"FTOB_0/FLTB_0/FSTR_%i",icopy);
+    if(plate>2)  snprintf(string2,kSize,"FTOC_0/FLTC_0/FSTR_%i",icopy);
   }
 
-  sprintf(string3,"FPCB_1/FSEN_1");
-  sprintf(path,"%s/%s/%s",string1,string2,string3); 
+  snprintf(string3,kSize,"FPCB_1/FSEN_1");
+  snprintf(path,2*kSize,"%s/%s/%s",string1,string2,string3); 
 
 }
 //_____________________________________________________________________________
@@ -603,8 +614,8 @@ void AliTOFGeometry::GetPos(Int_t *det, Float_t *pos)
 // Returns space point coor (x,y,z) (cm)  for Detector 
 // Indices  (iSect,iPlate,iStrip,iPadX,iPadZ) 
 //
-  Char_t path[100];
-  GetVolumePath(det,path );
+  Char_t path[200];
+  GetVolumePath(det,path);
   if (!gGeoManager) {
     printf("ERROR: no TGeo\n");
   }
@@ -618,7 +629,7 @@ void AliTOFGeometry::GetPos(Int_t *det, Float_t *pos)
   pos[2]=tr[2];
 }
 //_____________________________________________________________________________
-Int_t AliTOFGeometry::GetPlate(const Float_t * const pos) const
+Int_t AliTOFGeometry::GetPlate(const Float_t * pos)
 {
   //
   // Returns the Plate index 
@@ -714,7 +725,7 @@ Int_t AliTOFGeometry::GetPlate(const Float_t * const pos) const
 }
 
 //_____________________________________________________________________________
-Int_t AliTOFGeometry::GetSector(const Float_t * const pos) const
+Int_t AliTOFGeometry::GetSector(const Float_t * pos)
 {
   //
   // Returns the Sector index 
@@ -742,7 +753,7 @@ Int_t AliTOFGeometry::GetSector(const Float_t * const pos) const
 
 }
 //_____________________________________________________________________________
-Int_t AliTOFGeometry::GetStrip(const Float_t * const pos) const
+Int_t AliTOFGeometry::GetStrip(const Float_t * pos)
 {
   //
   // Returns the Strip index 
@@ -761,8 +772,8 @@ Int_t AliTOFGeometry::GetStrip(const Float_t * const pos) const
    
   Float_t posLocal[3];
   for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
-  AliDebug(1,Form("  posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ",
-                 posLocal[0],posLocal[1],posLocal[2]));
+//   AliDebug(1,Form("  posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ",
+//               posLocal[0],posLocal[1],posLocal[2]));
 
   Int_t isector = GetSector(posLocal);
   if(isector == -1){
@@ -795,13 +806,13 @@ Int_t AliTOFGeometry::GetStrip(const Float_t * const pos) const
      90., (isector+0.5)*fgkPhiSec
     };
   Rotation(posLocal,angles);
-  AliDebug(1,Form("  posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ",
-                 posLocal[0],posLocal[1],posLocal[2]));
+  //  AliDebug(1,Form("  posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ",
+  //             posLocal[0],posLocal[1],posLocal[2]));
 
   Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
   Translation(posLocal,step);
-  AliDebug(1,Form("  posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ",
-                 posLocal[0],posLocal[1],posLocal[2]));
+  //  AliDebug(1,Form("  posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ",
+  //             posLocal[0],posLocal[1],posLocal[2]));
 
   // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
   angles[0] = 90.;
@@ -812,8 +823,8 @@ Int_t AliTOFGeometry::GetStrip(const Float_t * const pos) const
   angles[5] =270.;
 
   Rotation(posLocal,angles);
-  AliDebug(1,Form("  posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ",
-                 posLocal[0],posLocal[1],posLocal[2]));
+  //  AliDebug(1,Form("  posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ",
+  //             posLocal[0],posLocal[1],posLocal[2]));
 
   // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
   Int_t totStrip=0;
@@ -851,8 +862,8 @@ Int_t AliTOFGeometry::GetStrip(const Float_t * const pos) const
       angles[5] = 270.;
     }
     Rotation(posLoc2,angles);
-    AliDebug(1,Form(" strip %2d:  posLoc2[0] = %f, posLoc2[1] = %f, posLoc2[2] = %f ",
-                   istrip, posLoc2[0],posLoc2[1],posLoc2[2]));
+    //    AliDebug(1,Form(" strip %2d:  posLoc2[0] = %f, posLoc2[1] = %f, posLoc2[2] = %f ",
+    //             istrip, posLoc2[0],posLoc2[1],posLoc2[2]));
 
     if ((TMath::Abs(posLoc2[0])<=klstripx*0.5) &&
        (TMath::Abs(posLoc2[1])<=khstripy*0.5) &&
@@ -860,15 +871,15 @@ Int_t AliTOFGeometry::GetStrip(const Float_t * const pos) const
       iStrip = istrip;
       totStrip++;
       for (Int_t jj=0; jj<3; jj++) posLocal[jj]=posLoc2[jj];
-      AliDebug(2,Form(" posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ",
-                     posLocal[0],posLocal[1],posLocal[2]));
+      //      AliDebug(2,Form(" posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ",
+      //                     posLocal[0],posLocal[1],posLocal[2]));
 
-      AliDebug(2,Form(" GetAngles(%1i,%2i) = %f, pos[0] = %f, pos[1] = %f, pos[2] = %f",
-                     iplate, istrip, GetAngles(iplate,istrip), pos[0], pos[1], pos[2]));
+      //      AliDebug(2,Form(" GetAngles(%1i,%2i) = %f, pos[0] = %f, pos[1] = %f, pos[2] = %f",
+      //                     iplate, istrip, GetAngles(iplate,istrip), pos[0], pos[1], pos[2]));
       break;
     }
 
-    if (totStrip>1) AliInfo(Form("total strip number found %2i",totStrip));
+    //    if (totStrip>1) AliInfo(Form("total strip number found %2i",totStrip));
 
   }
 
@@ -876,7 +887,7 @@ Int_t AliTOFGeometry::GetStrip(const Float_t * const pos) const
   
 }
 //_____________________________________________________________________________
-Int_t AliTOFGeometry::GetPadZ(const Float_t * const pos) const
+Int_t AliTOFGeometry::GetPadZ(const Float_t * pos)
 {
   //
   // Returns the Pad index along Z 
@@ -969,7 +980,7 @@ Int_t AliTOFGeometry::GetPadZ(const Float_t * const pos) const
 
 }
 //_____________________________________________________________________________
-Int_t AliTOFGeometry::GetPadX(const Float_t * const pos) const
+Int_t AliTOFGeometry::GetPadX(const Float_t * pos)
 {
   //
   // Returns the Pad index along X 
@@ -1062,7 +1073,7 @@ Int_t AliTOFGeometry::GetPadX(const Float_t * const pos) const
 
 }
 //_____________________________________________________________________________
-Float_t AliTOFGeometry::GetX(const Int_t * const det) const
+Float_t AliTOFGeometry::GetX(const Int_t * det)
 {
   //
   // Returns X coordinate (cm)
@@ -1109,7 +1120,7 @@ Float_t AliTOFGeometry::GetX(const Int_t * const det) const
   Translation(posLocal,step);
 
   // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
-  Double_t angles[6];
+  Double_t angles[6] = {0.,0.,0.,0.,0.,0.};
   if      (GetAngles(iplate,istrip) >0.) {
     angles[0] = 90.;
     angles[1] =  0.;
@@ -1173,7 +1184,7 @@ Float_t AliTOFGeometry::GetX(const Int_t * const det) const
 
 }
 //_____________________________________________________________________________
-Float_t AliTOFGeometry::GetY(const Int_t * const det) const
+Float_t AliTOFGeometry::GetY(const Int_t * det)
 {
   //
   // Returns Y coordinate (cm)
@@ -1221,7 +1232,7 @@ Float_t AliTOFGeometry::GetY(const Int_t * const det) const
 
   // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
 
-  Double_t angles[6];
+  Double_t angles[6] = {0.,0.,0.,0.,0.,0.};
   if      (GetAngles(iplate,istrip) >0.) {
     angles[0] = 90.;
     angles[1] =  0.;
@@ -1286,7 +1297,7 @@ Float_t AliTOFGeometry::GetY(const Int_t * const det) const
 }
 
 //_____________________________________________________________________________
-Float_t AliTOFGeometry::GetZ(const Int_t * const det) const
+Float_t AliTOFGeometry::GetZ(const Int_t * det)
 {
   //
   // Returns Z coordinate (cm)
@@ -1318,7 +1329,7 @@ Float_t AliTOFGeometry::GetZ(const Int_t * const det) const
   Translation(posLocal,step);
 
   // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
-  Double_t angles[6];
+  Double_t angles[6] = {0.,0.,0.,0.,0.,0.};
   if      (GetAngles(iplate,istrip) >0.) {
     angles[0] = 90.;
     angles[1] =  0.;
@@ -1383,7 +1394,7 @@ Float_t AliTOFGeometry::GetZ(const Int_t * const det) const
 }
 //_____________________________________________________________________________
 
-void AliTOFGeometry::DetToSectorRF(Int_t vol[5], Double_t **coord)
+void AliTOFGeometry::DetToSectorRF(Int_t vol[5], Double_t coord[4][3])
 {
   //
   // Returns the local coordinates (x, y, z) in sector reference frame
@@ -1393,7 +1404,7 @@ void AliTOFGeometry::DetToSectorRF(Int_t vol[5], Double_t **coord)
   if (!gGeoManager) printf("ERROR: no TGeo\n");
 
   // ALICE -> TOF Sector
-  Char_t path1[100]="";
+  Char_t path1[200];
   GetVolumePath(vol[0],path1);
   gGeoManager->cd(path1);
   TGeoHMatrix aliceToSector;
@@ -1403,7 +1414,7 @@ void AliTOFGeometry::DetToSectorRF(Int_t vol[5], Double_t **coord)
   //TGeoHMatrix sectorToALICE = aliceToSector.Inverse();
 
   // ALICE -> TOF Pad
-  Char_t path2[100]="";
+  Char_t path2[200];
   GetVolumePath(vol,path2);
   gGeoManager->cd(path2);
   TGeoHMatrix aliceToPad;
@@ -1442,13 +1453,13 @@ void AliTOFGeometry::DetToSectorRF(Int_t vol[5], Double_t **coord)
 
   for (Int_t jj=0; jj<4; jj++) padToSector.MasterToLocal(&cornerPad[jj][0], &coord[jj][0]);
 
-  delete cornerPad;
+  delete [] cornerPad;
 
   //sectorToPad.LocalToMaster(cornerPad, coord);
 
 }
 //_____________________________________________________________________________
-Float_t AliTOFGeometry::GetPadDx(const Float_t * const pos)
+Float_t AliTOFGeometry::GetPadDx(const Float_t * pos)
 {
   //
   // Returns the x coordinate in the Pad reference frame
@@ -1549,7 +1560,7 @@ Float_t AliTOFGeometry::GetPadDx(const Float_t * const pos)
 
 }
 //_____________________________________________________________________________
-Float_t AliTOFGeometry::GetPadDy(const Float_t * const pos)
+Float_t AliTOFGeometry::GetPadDy(const Float_t * pos)
 {
   //
   // Returns the y coordinate in the Pad reference frame
@@ -1650,7 +1661,7 @@ Float_t AliTOFGeometry::GetPadDy(const Float_t * const pos)
 
 }
 //_____________________________________________________________________________
-Float_t AliTOFGeometry::GetPadDz(const Float_t * const pos)
+Float_t AliTOFGeometry::GetPadDz(const Float_t * pos)
 {
   //
   // Returns the z coordinate in the Pad reference frame
@@ -1752,7 +1763,7 @@ Float_t AliTOFGeometry::GetPadDz(const Float_t * const pos)
 }
 //_____________________________________________________________________________
 
-void AliTOFGeometry::Translation(Float_t *xyz, Float_t translationVector[3]) const
+void AliTOFGeometry::Translation(Float_t *xyz, Float_t translationVector[3])
 {
   //
   // Return the vector xyz translated by translationVector vector
@@ -1768,7 +1779,7 @@ void AliTOFGeometry::Translation(Float_t *xyz, Float_t translationVector[3]) con
 }
 //_____________________________________________________________________________
 
-void AliTOFGeometry::Rotation(Float_t *xyz, Double_t rotationAngles[6]) const
+void AliTOFGeometry::Rotation(Float_t *xyz, Double_t rotationAngles[6])
 {
   //
   // Return the vector xyz rotated according to the rotationAngles angles
@@ -1798,7 +1809,7 @@ void AliTOFGeometry::Rotation(Float_t *xyz, Double_t rotationAngles[6]) const
 
 }
 //_____________________________________________________________________________
-void AliTOFGeometry::InverseRotation(Float_t *xyz, Double_t rotationAngles[6]) const
+void AliTOFGeometry::InverseRotation(Float_t *xyz, Double_t rotationAngles[6])
 {
   //
   // Rotates the vector xyz acordint to the rotationAngles
@@ -1832,7 +1843,7 @@ void AliTOFGeometry::InverseRotation(Float_t *xyz, Double_t rotationAngles[6]) c
 }
 //_____________________________________________________________________________
 
-Int_t AliTOFGeometry::GetIndex(const Int_t * const detId)
+Int_t AliTOFGeometry::GetIndex(const Int_t * detId)
 {
   //Retrieve calibration channel index 
   Int_t isector = detId[0];
@@ -1930,7 +1941,7 @@ Int_t AliTOFGeometry::NStrip(Int_t nPlate)
 }
 //-------------------------------------------------------------------------
 
-UShort_t AliTOFGeometry::GetAliSensVolIndex(Int_t isector, Int_t iplate, Int_t istrip) const
+UShort_t AliTOFGeometry::GetAliSensVolIndex(Int_t isector, Int_t iplate, Int_t istrip)
 {
   //
   // Get the index of the TOF alignable volume in the AliGeomManager order.
@@ -1969,6 +1980,42 @@ Int_t AliTOFGeometry::GetStripNumber(Int_t isector, Int_t iplate, Int_t istrip)
 }
 //-------------------------------------------------------------------------
 
+void AliTOFGeometry::GetStripAndModule(Int_t iStripPerSM, Int_t &iplate, Int_t &istrip)
+{
+  //
+  // Convert the serial number of the TOF strip number iStripPerSM [0,90]
+  // in module number iplate [0,4] and strip number istrip [0,14/18].
+  //
+
+  if (iStripPerSM<0 || iStripPerSM>=kNStripC+kNStripB+kNStripA+kNStripB+kNStripC) {
+    iplate = -1;
+    istrip = -1;
+  }
+  else if (iStripPerSM<kNStripC) {
+    iplate = 0;
+    istrip = iStripPerSM;
+  }
+  else if (iStripPerSM>=kNStripC && iStripPerSM<kNStripC+kNStripB) {
+    iplate = 1;
+    istrip = iStripPerSM-kNStripC;
+  }
+  else if (iStripPerSM>=kNStripC+kNStripB && iStripPerSM<kNStripC+kNStripB+kNStripA) {
+    iplate = 2;
+    istrip = iStripPerSM-kNStripC-kNStripB;
+  }
+  else if (iStripPerSM>=kNStripC+kNStripB+kNStripA && iStripPerSM<kNStripC+kNStripB+kNStripA+kNStripB) {
+    iplate = 3;
+    istrip = iStripPerSM-kNStripC-kNStripB-kNStripA;
+  }
+  else if (iStripPerSM>=kNStripC+kNStripB+kNStripA+kNStripB && iStripPerSM<kNStripC+kNStripB+kNStripA+kNStripB+kNStripC) {
+    iplate = 4;
+    istrip = iStripPerSM-kNStripC-kNStripB-kNStripA-kNStripB;
+  }
+
+
+}
+//-------------------------------------------------------------------------
+
 Int_t AliTOFGeometry::GetStripNumberPerSM(Int_t iplate, Int_t istrip)
 {
   //
@@ -2090,7 +2137,7 @@ void AliTOFGeometry::PadRF2TrackingRF(Float_t *ctrackPos, Float_t *differenceT)
   l2t.MasterToLocal(padCentreL,padCentreT);
 
 
-  Char_t path[100];
+  Char_t path[200];
   // pad centre coordinates in its ref. frame
   Double_t padCentreL2[3] = {0., 0., 0.};
   // pad centre coordinates in the ALICE global ref. frame
@@ -2102,7 +2149,7 @@ void AliTOFGeometry::PadRF2TrackingRF(Float_t *ctrackPos, Float_t *differenceT)
   l2g.MasterToLocal(padCentreL2,padCentreG);
 
 
-  Char_t path2[100];
+  Char_t path2[200];
   // strip centre coordinates in its ref. frame
   Double_t stripCentreL[3] = {0., 0., 0.};
   // strip centre coordinates in the ALICE global ref. frame
@@ -2151,3 +2198,13 @@ void AliTOFGeometry::PadRF2TrackingRF(Float_t *ctrackPos, Float_t *differenceT)
   for (Int_t ii=0; ii<3; ii++) differenceT[ii] = (Float_t)(posT[ii]-padCentreT[ii]);
 
 }
+//-------------------------------------------------------------------------
+
+Int_t AliTOFGeometry::GetTOFsupermodule(Int_t index)
+{
+  // Return the TOF supermodule where TOF channel index is located
+
+  if (index<0 || index>=NPadXSector()*NSectors()) return -1;
+  else return index/NpadXStrip()/NStripXSector();
+
+}