]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDgeometry.cxx
Adding renormalisation of the combinatotial bgk for peripheral events
[u/mrichter/AliRoot.git] / TRD / AliTRDgeometry.cxx
index 6c22fb54bedac2d772946f476cc087c58ff6141b..8be270a573f8fdc735c30e9713167630dd4c4bce 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.22  2002/11/21 22:38:47  alibrary
-Removing AliMC and AliMCProcess
-
-Revision 1.21  2002/11/21 16:09:44  cblume
-Change fgkRpadW to 1.0 cm for new pad plane
-
-Revision 1.20  2002/10/31 17:45:35  cblume
-New chamber geometry
-
-Revision 1.19  2002/10/14 14:57:43  hristov
-Merging the VirtualMC branch to the main development branch (HEAD)
-
-Revision 1.15.6.2  2002/07/24 10:09:30  alibrary
-Updating VirtualMC
-
-Revision 1.15.6.1  2002/06/10 15:28:58  hristov
-Merged with v3-08-02
-
-Revision 1.17  2002/04/05 13:20:12  cblume
-Remove const for CreateGeometry
-
-Revision 1.16  2002/03/28 14:59:07  cblume
-Coding conventions
-
-Revision 1.18  2002/06/12 09:54:35  cblume
-Update of tracking code provided by Sergei
-
-Revision 1.17  2002/04/05 13:20:12  cblume
-Remove const for CreateGeometry
-
-Revision 1.16  2002/03/28 14:59:07  cblume
-Coding conventions
-
-Revision 1.15  2002/02/11 14:21:16  cblume
-Update of the geometry. Get rid of MANY
-
-Revision 1.14  2001/11/06 17:19:41  cblume
-Add detailed geometry and simple simulator
-
-Revision 1.13  2001/08/02 08:30:45  cblume
-Fix positions of cooling material
-
-Revision 1.12  2001/05/21 16:45:47  hristov
-Last minute changes (C.Blume)
-
-Revision 1.11  2001/05/11 07:56:12  hristov
-Consistent declarations needed on Alpha
-
-Revision 1.10  2001/05/07 08:08:05  cblume
-Update of TRD code
-
-Revision 1.9  2001/03/27 12:48:33  cblume
-Correct for volume overlaps
-
-Revision 1.8  2001/03/13 09:30:35  cblume
-Update of digitization. Moved digit branch definition to AliTRD
-
-Revision 1.7  2001/02/14 18:22:26  cblume
-Change in the geometry of the padplane
-
-Revision 1.6  2000/11/01 14:53:20  cblume
-Merge with TRD-develop
-
-Revision 1.1.4.7  2000/10/16 01:16:53  cblume
-Changed timebin 0 to be the one closest to the readout
-
-Revision 1.1.4.6  2000/10/15 23:35:57  cblume
-Include geometry constants as static member
-
-Revision 1.1.4.5  2000/10/06 16:49:46  cblume
-Made Getters const
-
-Revision 1.1.4.4  2000/10/04 16:34:58  cblume
-Replace include files by forward declarations
-
-Revision 1.1.4.3  2000/09/22 14:43:40  cblume
-Allow the pad/timebin-dimensions to be changed after initialization
-
-Revision 1.1.4.2  2000/09/18 13:37:01  cblume
-Minor coding corrections
-
-Revision 1.5  2000/10/02 21:28:19  fca
-Removal of useless dependecies via forward declarations
-
-Revision 1.4  2000/06/08 18:32:58  cblume
-Make code compliant to coding conventions
-
-Revision 1.3  2000/06/07 16:25:37  cblume
-Try to remove compiler warnings on Sun and HP
-
-Revision 1.2  2000/05/08 16:17:27  cblume
-Merge TRD-develop
-
-Revision 1.1.4.1  2000/05/08 14:45:55  cblume
-Bug fix in RotateBack(). Geometry update
-
-Revision 1.4  2000/06/08 18:32:58  cblume
-Make code compliant to coding conventions
-
-Revision 1.3  2000/06/07 16:25:37  cblume
-Try to remove compiler warnings on Sun and HP
-
-Revision 1.2  2000/05/08 16:17:27  cblume
-Merge TRD-develop
-
-Revision 1.1.4.1  2000/05/08 14:45:55  cblume
-Bug fix in RotateBack(). Geometry update
-
-Revision 1.1  2000/02/28 19:00:44  cblume
-Add new TRD classes
-
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -405,6 +292,84 @@ Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
 
 }
 
+
+
+//_____________________________________________________________________________
+Bool_t AliTRDgeometry::Global2Local(Int_t mode, Float_t *local, Float_t *global, Int_t* index,  AliTRDparameter *par) const
+{
+  //
+  // Converts local pad-coordinates (row,col,time) into 
+  // global ALICE reference frame coordinates (x,y,z)
+  //
+  //index[0]=plane number
+  //index[1]=chamber number
+  //index[2]=sector number
+  //
+  // mode=0  - local coordinate in y, z,             x - rotated global   
+  // mode=2  - local coordinate in pad, and pad row, x - rotated global
+  //
+  if (!par) {
+    Error("Local2Global","No parameter defined\n");
+    return kFALSE;
+  }
+  
+  //Int_t    idet    = GetDetector(iplan,icham,isect); // Detector number
+  Int_t    idet      = GetDetector(index[0],index[1],index[2]); // Detector number
+  Rotate(idet,global,local);
+  if (mode==0) return kTRUE;
+  //
+  //  Float_t  row0      = par->GetRow0(iplan,icham,isect);
+  //Float_t  col0      = par->GetCol0(iplan);
+  //Float_t  time0     = par->GetTime0(iplan);
+  //
+  // mode 1 to be implemented later
+  // calculate (x,y,z) position in time bin pad row pad
+  //
+  //rot[0] = time0 - (timeSlice - par->GetTimeBefore()) 
+  //       * par->GetTimeBinSize();
+  //rot[1] = col0  + padCol                    
+  //       * par->GetColPadSize(iplan);
+  //rot[2] = row0  + padRow                    
+  //       * par->GetRowPadSize(iplan,icham,isect);
+
+  return kTRUE;
+
+}
+
+//___________________________________________________________________
+Bool_t   AliTRDgeometry::Global2Detector(Float_t global[3], Int_t index[3], AliTRDparameter *par)
+{
+  //  
+  //
+  //input = global position
+  //output =index
+  //index[0]=plane number
+  //index[1]=chamber number
+  //index[2]=sector number
+  Float_t fi;
+  //
+  fi = TMath::ATan2(global[1],global[0]);
+  if (fi<0) fi += 2*TMath::Pi();
+  index[2] = Int_t(TMath::Nint((fi - GetAlpha()/2.)/GetAlpha()));
+  //
+  //
+  Float_t locx = global[0] * fRotA11[index[2]] + global[1] * fRotA12[index[2]];  
+  index[0] = 0;
+  Float_t max = locx-par->GetTime0(0);
+  for (Int_t iplane=1; iplane<fgkNplan;iplane++){
+    Float_t dist = TMath::Abs(locx-par->GetTime0(iplane));
+    if (dist < max){
+      index[0] = iplane;
+      max = dist;
+    }
+  }
+  Float_t theta = TMath::ATan2(global[2],locx);
+  index[1] = TMath::Nint(float(fgkNcham)*theta/(0.25*TMath::Pi()));
+  return kTRUE;
+
+}
+
+
 //_____________________________________________________________________________
 Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) const
 {
@@ -444,7 +409,7 @@ Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) const
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDgeometry::GetDetectorSec(const Int_t p, const Int_t c) const
+Int_t AliTRDgeometry::GetDetectorSec(Int_t p, Int_t c) const
 {
   //
   // Convert plane / chamber into detector number for one single sector
@@ -455,7 +420,7 @@ Int_t AliTRDgeometry::GetDetectorSec(const Int_t p, const Int_t c) const
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDgeometry::GetDetector(const Int_t p, const Int_t c, const Int_t s) const
+Int_t AliTRDgeometry::GetDetector(Int_t p, Int_t c, Int_t s) const
 {
   //
   // Convert plane / chamber / sector into detector number
@@ -466,7 +431,7 @@ Int_t AliTRDgeometry::GetDetector(const Int_t p, const Int_t c, const Int_t s) c
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDgeometry::GetPlane(const Int_t d) const
+Int_t AliTRDgeometry::GetPlane(Int_t d) const
 {
   //
   // Reconstruct the plane number from the detector number
@@ -477,7 +442,7 @@ Int_t AliTRDgeometry::GetPlane(const Int_t d) const
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDgeometry::GetChamber(const Int_t d) const
+Int_t AliTRDgeometry::GetChamber(Int_t d) const
 {
   //
   // Reconstruct the chamber number from the detector number
@@ -488,7 +453,7 @@ Int_t AliTRDgeometry::GetChamber(const Int_t d) const
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDgeometry::GetSector(const Int_t d) const
+Int_t AliTRDgeometry::GetSector(Int_t d) const
 {
   //
   // Reconstruct the sector number from the detector number