]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RICH/AliRICHSegmentationV1.cxx
Major upgrade of AliRoot code
[u/mrichter/AliRoot.git] / RICH / AliRICHSegmentationV1.cxx
index 9d8d124297476b139d2202920d3bb457c9eb3106..b12507e1ea1cedc02788b18ba61b74b4a069f17a 100644 (file)
 
 /*
   $Log$
+  Revision 1.5  2001/01/22 21:37:39  jbarbosa
+  Added parametrised definiton sectors
+
+  Revision 1.4  2001/01/22 21:35:39  jbarbosa
+  Added deadzone size to data members
+
+  Revision 1.3  2000/10/03 21:44:09  morsch
+  Use AliSegmentation and AliHit abstract base classes.
+
+  Revision 1.2  2000/10/02 15:48:55  jbarbosa
+  Fixed coding conventions.
+
   Revision 1.1  2000/06/12 15:34:28  jbarbosa
   Cleaned up version.
 
@@ -36,6 +48,7 @@ AliRICHSegmentationV1::AliRICHSegmentationV1()
   fNpy=144;
   //fNpx=80;
   //fNpy=48;
+  fDeadZone=2.6;
   fSector=-1;
 }
 
@@ -49,14 +62,16 @@ AliRICHSegmentationV1::~AliRICHSegmentationV1()
 
 // calculate sector from x-y coordinates
 
-Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y)
+Int_t AliRICHSegmentationV1::Sector(Float_t y, Float_t x)
 {
 
 // 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 +89,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,6 +106,55 @@ Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y)
          if (y>(-63.1))
            fSector=5;
        }
+    }*/
+
+  
+  // parametrised definition
+
+  Float_t csi_length = fNpx*fDpx + fDeadZone;
+  Float_t csi_width = fNpy*fDpy + 2*fDeadZone;
+
+  fPadPlane_Width = (csi_width - 2*fDeadZone)/3;
+  fPadPlane_Length = (csi_length - fDeadZone)/2;
+
+  //printf("\n\n\n\n\n\n  csi      w: %f l:%f          \n\n\n\n\n\n\n\n",  csi_width,csi_length); 
+  //printf("\n\n\n\n\n\n  padplane w: %f l:%f wr: %f   \n\n\n\n\n\n\n\n",  fPadPlane_Width,fPadPlane_Length,63.1-22.75); 
+
+  if (x<-fDeadZone/2)
+    {
+      if (y> fPadPlane_Width/2 +fDeadZone)
+       {
+         if ( y<fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)
+           fSector=0;
+       }
+      if (y< fPadPlane_Width/2)
+       {
+         if (y> -( fPadPlane_Width/2))
+           fSector=2;
+       }
+      if (y< -( fPadPlane_Width/2 +fDeadZone))
+       {
+         if (y> -( fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width))
+           fSector=4;
+       }
+    }
+  else if (x>fDeadZone/2)
+    {
+      if (y> fPadPlane_Width/2 +fDeadZone)
+       {
+         if (y< fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width)
+           fSector=0;
+       }
+      if (y< fPadPlane_Width/2)
+       {
+         if (y> -( fPadPlane_Width/2))
+           fSector=2;
+       }
+      if (y< -( fPadPlane_Width/2 +fDeadZone))
+       {
+         if (y> -( fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width))
+           fSector=4;
+       }
     }
   
   //if (fSector==2)
@@ -100,7 +164,7 @@ 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)
 //
@@ -115,33 +179,33 @@ void AliRICHSegmentationV1::GetPadIxy(Float_t x, Float_t y, Int_t &ix, Int_t &iy
     {
       //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);
+      iy = (y>0)? iy = Int_t (y/fDpy+fDeadZone) : iy = Int_t (y/fDpy+fDeadZone)-1;
+      ix = (x>0)? ix = Int_t (x/fDpx-fDeadZone/2) : ix = Int_t (x/fDpx-fDeadZone/2)-1;
     }
   if (sector==1)
     {
-      ix = Int_t (x/fDpx-1.3);
-      iy = Int_t (y/fDpy-2.6);
+      iy = (y>0)? iy = Int_t (y/fDpy+fDeadZone) : iy = Int_t (y/fDpy+fDeadZone)-1;
+      ix = (x>0)? ix = Int_t (x/fDpx+fDeadZone/2) : ix = Int_t (x/fDpx+fDeadZone/2)-1;
     }
   if (sector==2)
     {
-      ix = Int_t (x/fDpx+1.3);
-      iy = Int_t (y/fDpy);
+      iy = (y>0)? iy = Int_t (y/fDpy) : iy = Int_t (y/fDpy)-1;
+      ix = (x>0)? ix = Int_t (x/fDpx-fDeadZone/2) : ix = Int_t (x/fDpx-fDeadZone/2)-1;
     }
   if (sector==3)
     {
-      ix = Int_t (x/fDpx-1.3);
-      iy = Int_t (y/fDpy);
+      iy = (y>0)? iy = Int_t (y/fDpy) : iy = Int_t (y/fDpy)-1;
+      ix = (x>0)? ix = Int_t (x/fDpx+fDeadZone/2) : ix = Int_t (x/fDpx+fDeadZone/2)-1;
     }
   if (sector==4)
     {
-      ix = Int_t (x/fDpx+1.3);
-      iy = Int_t (y/fDpy+2.6);
+      iy = (y>0)? iy = Int_t (y/fDpy-fDeadZone) : iy = Int_t (y/fDpy-fDeadZone)-1;
+      ix = (x>0)? ix = Int_t (x/fDpx-fDeadZone/2) : ix = Int_t (x/fDpx-fDeadZone/2)-1;
     }
   if (sector==5)
     {
-      ix = Int_t (x/fDpx-1.3);
-      iy = Int_t (y/fDpy+2.6);
+      iy = (y>0)? iy = Int_t (y/fDpy-fDeadZone) : iy = Int_t (y/fDpy-fDeadZone)-1;
+      ix = (x>0)? ix = Int_t (x/fDpx+fDeadZone/2) : ix = Int_t (x/fDpx+fDeadZone/2)-1;
     }
   
   //ix = Int_t (x/fDpx);
@@ -163,7 +227,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 +236,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,40 +273,81 @@ GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
          if (iy>-72)
            sector=5;
        }
-    }
+    }*/
   
+  //  parametrised definition
+
+  
+  Float_t padplane_width = fNpy/3;
+  
+  if (iy<=0)
+    {
+      if (ix <= fNpy/2)
+       {
+         if (ix > fNpy/2 - padplane_width)
+           sector=0;
+       }
+      if (ix<= padplane_width/2)
+       {
+         if (ix > -(padplane_width/2))
+           sector=2;
+       }
+      if (ix <= -(padplane_width/2))
+       {
+         if (ix > -(fNpy/2))
+           sector=4;
+       }
+    }
+  if (iy>0)
+    {
+      if (ix <= fNpy/2)
+       {
+         if (ix > fNpy/2 - padplane_width)
+           sector=0;
+       }
+      if (ix<= padplane_width/2)
+       {
+         if (ix > -(padplane_width/2))
+           sector=2;
+       }
+      if (ix <= -(padplane_width/2))
+       {
+         if (ix > -(fNpy/2))
+           sector=4;
+       }
+    }
 
   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;
+      y = Float_t(iy*fDpy)-fDpy/2-fDeadZone;
+      x = Float_t(ix*fDpx)-fDpx/2+fDeadZone/2;
     }
   if (sector==1)
     {
-      x = Float_t(ix*fDpx)-fDpx/2.+1.3;
-      y = Float_t(iy*fDpy)-fDpy/2.+2.6;
+      y = Float_t(iy*fDpy)-fDpy/2-fDeadZone;
+      x = Float_t(ix*fDpx)-fDpx/2-fDeadZone/2;
     }
   if (sector==2)
     {
-      x = Float_t(ix*fDpx)-fDpx/2.-1.3;
-      y = Float_t(iy*fDpy)-fDpy/2.;
+      y = Float_t(iy*fDpy)-fDpy/2;
+      x = Float_t(ix*fDpx)-fDpx/2+fDeadZone/2;
     }
   if (sector==3)
     {
-      x = Float_t(ix*fDpx)-fDpx/2.+1.3;
-      y = Float_t(iy*fDpy)-fDpy/2.;
+      y = Float_t(iy*fDpy)-fDpy/2;
+      x = Float_t(ix*fDpx)-fDpx/2-fDeadZone/2;
     }
   if (sector==4)
     {
-      x = Float_t(ix*fDpx)-fDpx/2.-1.3;
-      y = Float_t(iy*fDpy)-fDpy/2.-2.6;
+      y = Float_t(iy*fDpy)-fDpy/2+fDeadZone;
+      x = Float_t(ix*fDpx)-fDpx/2+fDeadZone/2;
     }
   if (sector==5)
     {
-      x = Float_t(ix*fDpx)-fDpx/2.+1.3;
-      y = Float_t(iy*fDpy)-fDpy/2.-2.6;
+      y = Float_t(iy*fDpy)-fDpy/2+fDeadZone;
+      x = Float_t(ix*fDpx)-fDpx/2-fDeadZone/2;
     }
   
   //if (sector==2)
@@ -269,3 +376,9 @@ IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
   y1=fYhit-fY-fDpy/2.;
   y2=y1+fDpy;
 }
+
+
+
+
+
+