]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New transformation function (M.Ivanov)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 21 Oct 2003 12:53:10 +0000 (12:53 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 21 Oct 2003 12:53:10 +0000 (12:53 +0000)
TRD/AliTRDgeometry.cxx
TRD/AliTRDgeometry.h

index 6c22fb54bedac2d772946f476cc087c58ff6141b..286c13e7904172345ce2e2d15ad2798c2d625015 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.24  2003/09/18 09:06:07  cblume
+Geometry update, Removal of compiler warnings
+
 Revision 1.22  2002/11/21 22:38:47  alibrary
 Removing AliMC and AliMCProcess
 
@@ -405,6 +408,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
 {
index 7c72b9e92e1c3d663637d6ed19a9114f697d7798..b08ca1f786f0c421f9e780c72cfe8b7dce49c4bd 100644 (file)
@@ -30,6 +30,10 @@ class AliTRDgeometry : public AliGeometry {
   virtual Bool_t   Impact(const TParticle* ) const { return kTRUE; };
   virtual Bool_t   Local2Global(Int_t d, Float_t *local, Float_t *global, AliTRDparameter *par) const;
   virtual Bool_t   Local2Global(Int_t p, Int_t c, Int_t s, Float_t *local, Float_t *global, AliTRDparameter *par) const;
+
+  virtual Bool_t   Global2Local(Int_t mode, Float_t *local, Float_t *global, Int_t* index,  AliTRDparameter *par) const;
+  virtual Bool_t   Global2Detector(Float_t global[3], Int_t index[3],  AliTRDparameter *par);
+
   virtual Bool_t   Rotate(Int_t d, Float_t *pos, Float_t *rot) const;
   virtual Bool_t   RotateBack(Int_t d, Float_t *rot, Float_t *pos) const;
 
@@ -81,7 +85,7 @@ class AliTRDgeometry : public AliGeometry {
   static  Double_t GetAlpha()  { return 2 * 3.14159265358979323846 / fgkNsect; }; 
 
  protected:
-
   static const Int_t   fgkNsect;                            // Number of sectors in the full detector (18)
   static const Int_t   fgkNplan;                            // Number of planes of the TRD (6)
   static const Int_t   fgkNcham;                            // Number of chambers in z-direction (5)