]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RICH/AliRICHSegmentationV1.cxx
Fixes to coding conventions violations
[u/mrichter/AliRoot.git] / RICH / AliRICHSegmentationV1.cxx
index 9d8d124297476b139d2202920d3bb457c9eb3106..40ff35516d609c82d2fe9e3a150ef9d9e3af69e0 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-  $Log$
-  Revision 1.1  2000/06/12 15:34:28  jbarbosa
-  Cleaned up version.
-
-*/
+/* $Id$ */
 
 #include "AliRICHSegmentationV1.h"
 
-
-//--------------------------------------------------------
 ClassImp(AliRICHSegmentationV1)
 
-//________________________________________________________________________________
 AliRICHSegmentationV1::AliRICHSegmentationV1()
 { 
 
 // Default constructor for AliRICHSegmantionV1 (with dead zones)
 
-  fNpx=160;
-  fNpy=144;
-  //fNpx=80;
-  //fNpy=48;
-  fSector=-1;
+   fNpx=144;      // number of pads along X direction 
+   fNpy=160;      // number of pads along Y direction 
+   fDeadZone=3.0; // space between CsI photocathods in cm
+   fDpx=0.84;     // pad width in cm
+   fDpy=0.80;     // pad heights in cm
+   fWireD=0.84/2;       
+   fSector=-1;
+   Init(0);       // ??? remove 0
 }
 
-//________________________________________________________________________________
-AliRICHSegmentationV1::~AliRICHSegmentationV1()
-{ 
-// Destructor
+void AliRICHSegmentationV1::Init(Int_t /*id*/)
+{//Recalculates all the values after some of them have been changed
+    
+   Float_t csi_length = fNpy*fDpy + fDeadZone;
+   Float_t csi_width = fNpx*fDpx + 2*fDeadZone;
 
+   fPadPlane_Width = (csi_width - 2*fDeadZone)/3;
+   fPadPlane_Length = (csi_length - fDeadZone)/2;
 }
 
-
 // calculate sector from x-y coordinates
 
 Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y)
 {
 
 // Calculate in which sector is the hit
-
+  
   fSector=-1;
   
-  if (x<-1.3)
+  //old numerical definition
+
+  /*if (x<-fDeadZone/2)
     {
       if (y>22.75)
        {
@@ -74,7 +73,7 @@ Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y)
            fSector=4;
        }
     }
-  else if (x>1.3)
+  else if (x>fDeadZone/2)
     {
       if (y>22.75)
        {
@@ -91,7 +90,47 @@ Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y)
          if (y>(-63.1))
            fSector=5;
        }
+    }*/
+
+  //Parametrized definition
+
+  if (y<-fDeadZone/2)
+    {
+      if (x> fPadPlane_Width/2 +fDeadZone)
+       {
+         if ( x<fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)
+           fSector=0;
+       }
+      if (x< fPadPlane_Width/2)
+       {
+         if (x> -( fPadPlane_Width/2))
+           fSector=2;
+       }
+      if (x< -( fPadPlane_Width/2 +fDeadZone))
+       {
+         if (x> -( fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width))
+           fSector=4;
+       }
     }
+  else if (y>fDeadZone/2)
+    {
+      if (x> fPadPlane_Width/2 +fDeadZone)
+       {
+         if (x< fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width)
+           fSector=1;
+       }
+      if (x< fPadPlane_Width/2)
+       {
+         if (x> -( fPadPlane_Width/2))
+           fSector=3;
+       }
+      if (x< -( fPadPlane_Width/2 +fDeadZone))
+       {
+         if (x> -( fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width))
+           fSector=5;
+       }
+    }
+
   
   //if (fSector==2)
     //printf("x:%f, y:%f, sector:%d\n",x,y,fSector);
@@ -100,49 +139,52 @@ Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y)
 }
 
 
-void AliRICHSegmentationV1::GetPadIxy(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
+void AliRICHSegmentationV1::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
 {
 //  returns pad coordinates (ix,iy) for given real coordinates (x,y)
 //
 // Please check origin of pad numbering !!!
 
+  ix=9999; //PH Fake values which should not be returned
+  iy=9999;
+
   Int_t sector=Sector(x,y);
 
   //printf("Sector: %d\n",sector);
 
-
   if (sector==0)
     {
       //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
       //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
-      ix = Int_t (x/fDpx+1.3);
-      iy = Int_t (y/fDpy-2.6);
+      ix = Int_t ((x-fDeadZone)/fDpx);
+      iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
     }
   if (sector==1)
     {
-      ix = Int_t (x/fDpx-1.3);
-      iy = Int_t (y/fDpy-2.6);
+      ix = Int_t ((x-fDeadZone)/fDpx);
+      iy = Int_t ((y-fDeadZone/2)/fDpy);
     }
   if (sector==2)
     {
-      ix = Int_t (x/fDpx+1.3);
-      iy = Int_t (y/fDpy);
+      ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
+      iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
     }
   if (sector==3)
     {
-      ix = Int_t (x/fDpx-1.3);
-      iy = Int_t (y/fDpy);
+      ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
+      iy = Int_t ((y-fDeadZone/2)/fDpy);
     }
   if (sector==4)
     {
-      ix = Int_t (x/fDpx+1.3);
-      iy = Int_t (y/fDpy+2.6);
+      ix = Int_t ((x+fDeadZone)/fDpx)-1;
+      iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
     }
   if (sector==5)
     {
-      ix = Int_t (x/fDpx-1.3);
-      iy = Int_t (y/fDpy+2.6);
+      ix = Int_t ((x+fDeadZone)/fDpx)-1;
+      iy = Int_t ((y-fDeadZone/2)/fDpy);
     }
+
   
   //ix = Int_t (x/fDpx);
   //iy = Int_t (y/fDpy);
@@ -163,7 +205,7 @@ void AliRICHSegmentationV1::GetPadIxy(Float_t x, Float_t y, Int_t &ix, Int_t &iy
 }
 
 void AliRICHSegmentationV1::
-GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
+GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
 {
 //  returns real coordinates (x,y) for given pad coordinates (ix,iy)
 //
@@ -172,7 +214,9 @@ GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
 
   Int_t sector=-1;
 
-  if (ix<=0)
+ // old numerical definition
+
+ /*if (ix<=0)
     {
       if (iy<=72)
        {
@@ -207,41 +251,82 @@ GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
          if (iy>-72)
            sector=5;
        }
-    }
+    }*/
   
+  //  parametrised definition
+
+  Float_t padplane_width = fNpx/3;
+  
+  if (iy<0)
+    {
+      if (ix < fNpx/2)
+       {
+         if (ix >= padplane_width/2)
+           sector=0;
+       }
+      if (ix< padplane_width/2)
+       {
+         if (ix >= -(padplane_width/2))
+           sector=2;
+       }
+      if (ix >= -(fNpx/2))
+       {
+         if (ix < -(padplane_width/2))
+           sector=4;
+       }
+    }
+  if (iy>=0)
+    {
+      if (ix < fNpx/2)
+       {
+         if (ix >= padplane_width/2)
+           sector=1;
+       }
+      if (ix< padplane_width/2)
+       {
+         if (ix >= -(padplane_width/2))
+           sector=3;
+       }
+      if (ix >= -(fNpx/2))
+       {
+         if (ix < -(padplane_width/2))
+           sector=5;
+       }
+    }
 
   if (sector==0)
     {
       //x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
       //y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
-      x = Float_t(ix*fDpx)-fDpx/2.-1.3;
-      y = Float_t(iy*fDpy)-fDpy/2.+2.6;
+      x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
+      y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
     }
   if (sector==1)
     {
-      x = Float_t(ix*fDpx)-fDpx/2.+1.3;
-      y = Float_t(iy*fDpy)-fDpy/2.+2.6;
+      x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
+      y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
     }
   if (sector==2)
     {
-      x = Float_t(ix*fDpx)-fDpx/2.-1.3;
-      y = Float_t(iy*fDpy)-fDpy/2.;
+      x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2;
+      y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
     }
   if (sector==3)
     {
-      x = Float_t(ix*fDpx)-fDpx/2.+1.3;
-      y = Float_t(iy*fDpy)-fDpy/2.;
+      x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2;
+      y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
     }
   if (sector==4)
     {
-      x = Float_t(ix*fDpx)-fDpx/2.-1.3;
-      y = Float_t(iy*fDpy)-fDpy/2.-2.6;
+      x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
+      y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
     }
   if (sector==5)
     {
-      x = Float_t(ix*fDpx)-fDpx/2.+1.3;
-      y = Float_t(iy*fDpy)-fDpy/2.-2.6;
+      x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
+      y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
     }
   
   //if (sector==2)
     //printf("fSector:%d x:%f y:%f\n",fSector,x,y);
@@ -269,3 +354,9 @@ IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
   y1=fYhit-fY-fDpy/2.;
   y2=y1+fDpy;
 }
+
+
+
+
+
+