]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFGeometry.cxx
Changes for bug #70680: AliROOT Coverity DELETE_ARRAY checker fix
[u/mrichter/AliRoot.git] / TOF / AliTOFGeometry.cxx
index 4819483af49d3dbee125253b13131f72ff3fcc8a..e558af41aa176949c8a42ab012614143248ae31d 100644 (file)
@@ -149,6 +149,10 @@ const Float_t AliTOFGeometry::fgkPhiSec= 20;//sector Phi width (deg)
 
 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)
@@ -325,7 +329,7 @@ void AliTOFGeometry::DetToStripRF(Int_t nPadX, Int_t nPadZ, Float_t &x,  Float_t
 
 }
 //_____________________________________________________________________________
-Float_t AliTOFGeometry::DistanceToPadPar(Int_t *det, Float_t *pos, Float_t *dist3d) const
+Float_t AliTOFGeometry::DistanceToPadPar(Int_t *det, const Float_t * const pos, Float_t *dist3d) const
 {
 //
 // Returns distance of  space point with coor pos (x,y,z) (cm) wrt 
@@ -388,7 +392,7 @@ Float_t AliTOFGeometry::DistanceToPadPar(Int_t *det, Float_t *pos, Float_t *dist
 
 }
 //_____________________________________________________________________________
-Bool_t AliTOFGeometry::IsInsideThePadPar(Int_t *det, Float_t *pos) const
+Bool_t AliTOFGeometry::IsInsideThePadPar(Int_t *det, const Float_t * const pos) const
 {
 //
 // Returns true if space point with coor pos (x,y,z) (cm) falls 
@@ -459,7 +463,7 @@ Bool_t AliTOFGeometry::IsInsideThePadPar(Int_t *det, Float_t *pos) const
 
 }
 //_____________________________________________________________________________
-Bool_t AliTOFGeometry::IsInsideThePad(TGeoHMatrix mat, Float_t *pos, Float_t *dist3d) const
+Bool_t AliTOFGeometry::IsInsideThePad(TGeoHMatrix mat, const Float_t * const pos, Float_t *dist3d) const
 {
   //
   // Returns true if space point with coor pos (x,y,z) [cm] falls inside
@@ -517,7 +521,7 @@ Bool_t AliTOFGeometry::IsInsideThePad(TGeoHMatrix mat, Float_t *pos, Float_t *di
 
 }
 //_____________________________________________________________________________
-void AliTOFGeometry::GetVolumePath(Int_t *ind, Char_t *path ) {
+void AliTOFGeometry::GetVolumePath(const Int_t * const ind, Char_t *path ) {
   //--------------------------------------------------------------------
   // This function returns the colume path of a given pad 
   //--------------------------------------------------------------------
@@ -617,7 +621,7 @@ void AliTOFGeometry::GetPos(Int_t *det, Float_t *pos)
   pos[2]=tr[2];
 }
 //_____________________________________________________________________________
-Int_t AliTOFGeometry::GetPlate(Float_t *pos) const
+Int_t AliTOFGeometry::GetPlate(const Float_t * const pos) const
 {
   //
   // Returns the Plate index 
@@ -713,7 +717,7 @@ Int_t AliTOFGeometry::GetPlate(Float_t *pos) const
 }
 
 //_____________________________________________________________________________
-Int_t AliTOFGeometry::GetSector(Float_t *pos) const
+Int_t AliTOFGeometry::GetSector(const Float_t * const pos) const
 {
   //
   // Returns the Sector index 
@@ -741,7 +745,7 @@ Int_t AliTOFGeometry::GetSector(Float_t *pos) const
 
 }
 //_____________________________________________________________________________
-Int_t AliTOFGeometry::GetStrip(Float_t *pos) const
+Int_t AliTOFGeometry::GetStrip(const Float_t * const pos) const
 {
   //
   // Returns the Strip index 
@@ -875,7 +879,7 @@ Int_t AliTOFGeometry::GetStrip(Float_t *pos) const
   
 }
 //_____________________________________________________________________________
-Int_t AliTOFGeometry::GetPadZ(Float_t *pos) const
+Int_t AliTOFGeometry::GetPadZ(const Float_t * const pos) const
 {
   //
   // Returns the Pad index along Z 
@@ -968,7 +972,7 @@ Int_t AliTOFGeometry::GetPadZ(Float_t *pos) const
 
 }
 //_____________________________________________________________________________
-Int_t AliTOFGeometry::GetPadX(Float_t *pos) const
+Int_t AliTOFGeometry::GetPadX(const Float_t * const pos) const
 {
   //
   // Returns the Pad index along X 
@@ -1061,7 +1065,7 @@ Int_t AliTOFGeometry::GetPadX(Float_t *pos) const
 
 }
 //_____________________________________________________________________________
-Float_t AliTOFGeometry::GetX(Int_t *det) const
+Float_t AliTOFGeometry::GetX(const Int_t * const det) const
 {
   //
   // Returns X coordinate (cm)
@@ -1172,7 +1176,7 @@ Float_t AliTOFGeometry::GetX(Int_t *det) const
 
 }
 //_____________________________________________________________________________
-Float_t AliTOFGeometry::GetY(Int_t *det) const
+Float_t AliTOFGeometry::GetY(const Int_t * const det) const
 {
   //
   // Returns Y coordinate (cm)
@@ -1285,7 +1289,7 @@ Float_t AliTOFGeometry::GetY(Int_t *det) const
 }
 
 //_____________________________________________________________________________
-Float_t AliTOFGeometry::GetZ(Int_t *det) const
+Float_t AliTOFGeometry::GetZ(const Int_t * const det) const
 {
   //
   // Returns Z coordinate (cm)
@@ -1441,13 +1445,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(Float_t *pos)
+Float_t AliTOFGeometry::GetPadDx(const Float_t * const pos)
 {
   //
   // Returns the x coordinate in the Pad reference frame
@@ -1548,7 +1552,7 @@ Float_t AliTOFGeometry::GetPadDx(Float_t *pos)
 
 }
 //_____________________________________________________________________________
-Float_t AliTOFGeometry::GetPadDy(Float_t *pos)
+Float_t AliTOFGeometry::GetPadDy(const Float_t * const pos)
 {
   //
   // Returns the y coordinate in the Pad reference frame
@@ -1649,7 +1653,7 @@ Float_t AliTOFGeometry::GetPadDy(Float_t *pos)
 
 }
 //_____________________________________________________________________________
-Float_t AliTOFGeometry::GetPadDz(Float_t *pos)
+Float_t AliTOFGeometry::GetPadDz(const Float_t * const pos)
 {
   //
   // Returns the z coordinate in the Pad reference frame
@@ -1800,7 +1804,7 @@ void AliTOFGeometry::Rotation(Float_t *xyz, Double_t rotationAngles[6]) const
 void AliTOFGeometry::InverseRotation(Float_t *xyz, Double_t rotationAngles[6]) const
 {
   //
-  //
+  // Rotates the vector xyz acordint to the rotationAngles
   //
 
   Int_t ii=0;
@@ -1831,7 +1835,7 @@ void AliTOFGeometry::InverseRotation(Float_t *xyz, Double_t rotationAngles[6]) c
 }
 //_____________________________________________________________________________
 
-Int_t AliTOFGeometry::GetIndex(Int_t *detId)
+Int_t AliTOFGeometry::GetIndex(const Int_t * const detId)
 {
   //Retrieve calibration channel index 
   Int_t isector = detId[0];
@@ -1968,6 +1972,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)
 {
   //
@@ -2150,3 +2190,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(const 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();
+
+}