]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSegmentationTriggerY.cxx
Implementing of new function to check for holes (M.Ivanov)
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationTriggerY.cxx
index b8ad1db17bc84a4378e1b399c39b55e5497ca599..bee410846c81b7e0561b10873b8825e25935ffbe 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.2  2000/06/15 07:58:48  morsch
-Code from MUON-dev joined
-
-Revision 1.1.2.1  2000/06/09 21:51:58  morsch
-Code from AliMUONSegResTriggerY.cxx
-
-*/
-
-
-/*
-Old Log:
-Revision 1.1.2.4  2000/05/05 10:17:04  morsch
-Y strip numerotation changed (CP)
-
-Revision 1.1.2.3  2000/04/26 12:33:40  morsch
-Minor changes in some methods (CP)
-
-Revision 1.1.2.2  2000/02/20 07:49:50  morsch
-Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
-
-Revision 1.1.2.1  2000/02/17 14:34:57  morsch
-Draft version from P. Crochet
-
-*/
+/* $Id$ */
 
 #include "AliMUONSegmentationTriggerY.h"
 #include "AliMUONTriggerConstants.h"
@@ -46,15 +21,18 @@ Draft version from P. Crochet
 #include "TRandom.h"
 #include "TArc.h"
 #include "AliMUONChamber.h"
-#include <iostream.h> 
+#include "AliMUON.h"
+#include "AliRun.h"
+#include <Riostream.h> 
 ClassImp(AliMUONSegmentationTriggerY)
 
 //------------------------------------------------------------------
-void AliMUONSegmentationTriggerY::Init(AliMUONChamber* Chamber)
+void AliMUONSegmentationTriggerY::Init(Int_t chamber)
 {
 // intialize Y segmentation 
-  cout << "Initialize Trigger Chamber Geometry Y " << "\n";    
-  AliMUONSegmentationTrigger::Init(Chamber);
+  AliMUON *pMUON  = (AliMUON *) gAlice->GetModule("MUON");
+  if(pMUON->GetDebug()>1) printf("%s: Initialize Trigger Chamber Geometry Y\n",ClassName());
+  AliMUONSegmentationTrigger::Init(chamber);
     
 // calculate x & y position of Y strips
   Int_t nModule=AliMUONTriggerConstants::Nmodule();  
@@ -79,7 +57,8 @@ void AliMUONSegmentationTriggerY::Init(AliMUONChamber* Chamber)
 }
 
 //------------------------------------------------------------------
-void AliMUONSegmentationTriggerY::GetPadIxy(Float_t x,Float_t y,Int_t &ix,Int_t &iy){
+void AliMUONSegmentationTriggerY::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy) 
+{
 //  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
 //  x,y = real coordinates; ix = module number , iy = strip number
 
@@ -99,7 +78,8 @@ void AliMUONSegmentationTriggerY::GetPadIxy(Float_t x,Float_t y,Int_t &ix,Int_t
 }
 
 //------------------------------------------------------------------
-void AliMUONSegmentationTriggerY::GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y){
+void AliMUONSegmentationTriggerY::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
+{
 //  Returns real coordinates (x,y) for given pad coordinates (ix,iy)
 //  ix = module number , iy = strip number;  x,y = center of strip
   x = 0.;    
@@ -124,42 +104,60 @@ void AliMUONSegmentationTriggerY::SetPadSize(Float_t p1, Float_t p2)
 
 //------------------------------------------------------------------
 void AliMUONSegmentationTriggerY::
-Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[2], Int_t Ylist[2]){
-// Returns list of next neighbours for given Pad (ix, iy)  
-  Int_t absiX=TMath::Abs(iX); 
-  *Nlist = 0;
+Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]){
+// Returns list of 10 next neighbours for given Y strip (ix, iy)  
+// neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list
+//                  \_______/                    \_______/
+//                    left                         right  
+// Note : should not be used to return a list of neighbours larger than 16 !
+
+  Int_t absiX = TMath::Abs(iX); 
+  Int_t numModule = ModuleNumber(absiX);   // module number Id.
+  Int_t nStrip = AliMUONTriggerConstants::NstripY(numModule); //numb of strips
+  Int_t iCandidateLeft, iCandidateRight;
+  Int_t iNewCandidateRight=0; 
+  Int_t iNewCandidateLeft=0;
+// first strip number on the right of the left module  
+  if ( (absiX-(Int_t(absiX/10))*10)!=1 && absiX!=52 ) 
+    iNewCandidateLeft = 
+      AliMUONTriggerConstants::NstripY(ModuleNumber(absiX-1))-1;
+  Int_t j;
   
-  if (absiX!=0) {                         
-    Int_t numModule=ModuleNumber(absiX);
-    
-    if (iY==AliMUONTriggerConstants::NstripY(numModule)-1) { // strip right 
-      if (absiX%10!=7) {
-       *Nlist=1;
-       Xlist[0]=absiX+1;
-       Ylist[0]=0;
-      } 
-    } else {
-      *Nlist=1;
-      Xlist[0]=absiX;
-      Ylist[0]=iY+1;
-    }
-    
-    if (iY==0) {                                            // strip left 
-      if (absiX%10!=1&&absiX!=52) {
-       *Nlist=*Nlist+1;
-       Xlist[*Nlist-1]=absiX-1;
-       Ylist[*Nlist-1]=AliMUONTriggerConstants::NstripY(numModule-1)-1;
-      } 
-    } else {
-      *Nlist=*Nlist+1;
-      Xlist[*Nlist-1]=absiX;
-      Ylist[*Nlist-1]=iY-1;
+  *Nlist = 10;
+  for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
+
+  if (iY < nStrip) {
+
+    for (Int_t i=0; i<5; i++) {
+      j = i + 5;
+      iCandidateRight = iY + (i + 1);
+      iCandidateLeft  = iY - (i + 1);
+      if (iCandidateRight < nStrip) { // strip in same module  
+       Xlist[i] = absiX;
+       Ylist[i] = iCandidateRight;  
+      } else if ((absiX+1)%10!=8) {   // need to scan the module on the right
+       Xlist[i] = absiX+1;
+       Ylist[i] = iNewCandidateRight;  
+       iNewCandidateRight++;
+      }
+      
+      if (iCandidateLeft >=0 ) { // strip in same module
+       Xlist[j] = absiX;
+       Ylist[j] = iCandidateLeft;  
+      } else if ( iNewCandidateLeft !=0) {
+       Xlist[j] = absiX-1;
+       Ylist[j] = iNewCandidateLeft;  
+       iNewCandidateLeft--;
+      }
     }
     
     if (iX<0) {                                  // left side of chamber 
-      for (Int_t i=0; i<*Nlist; i++) {Xlist[i]=-Xlist[i];}
+      for (Int_t i=0; i<10; i++) { 
+       if (Xlist[i]!=0) Xlist[i]=-Xlist[i]; 
+      }
     }
-  }     
+    
+  } // iY < nStrip    
 }
 
 //------------------------------------------------------------------   
@@ -167,25 +165,27 @@ void AliMUONSegmentationTriggerY::SetPad(Int_t ix, Int_t iy)
 {
   // Sets virtual pad coordinates, needed for evaluating pad response 
   // outside the tracking program 
-  GetPadCxy(ix,iy,fx,fy);
-  GetPadIxy(fx,fy,fix,fiy);
+  GetPadC(ix,iy,fX,fY);
+  GetPadI(fX,fY,fIx,fIy);
   fSector=Sector(ix,iy);    
 }
 
 //------------------------------------------------------------------   
-Int_t AliMUONSegmentationTriggerY::ISector()
+Int_t AliMUONSegmentationTriggerY::ISector() 
 { return fSector;}
 
 //------------------------------------------------------------------   
+
 Int_t AliMUONSegmentationTriggerY::Ix()
-{ return fix;}
+{ return fIx;}
 
 //------------------------------------------------------------------   
+
 Int_t AliMUONSegmentationTriggerY::Iy()
-{ return fiy;}
+{ return fIy;}
 
 //------------------------------------------------------------------
-Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec)
+Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec) const
 { 
 // returns x size of y strips for sector isec
   if (isec==1) {
@@ -202,7 +202,7 @@ Float_t AliMUONSegmentationTriggerY::Dpx(Int_t isec)
 }
 
 //------------------------------------------------------------------
-Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec)
+Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec) const
 { 
 // returns y size of y strips for sector isec
   if (isec==1) {
@@ -218,18 +218,26 @@ Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec)
   } else {
     return 0.;
   }
-
+}
+//------------------------------------------------------------------   
+void AliMUONSegmentationTriggerY::GetPadI(Float_t x, Float_t y, Float_t /*z*/, Int_t &ix, Int_t &iy) 
+{
+  GetPadI(x, y, ix, iy);
 }
 
 //------------------------------------------------------------------   
 void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit)
 { 
 // set hits during diintegration
-    AliMUONSegmentationTrigger::SetHit(xhit,yhit);
+  AliMUONSegmentationTrigger::SetHit(xhit,yhit);
+}
+//------------------------------------------------------------------   
+void AliMUONSegmentationTriggerY::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
+{
+  SetHit(xhit, yhit);
 }
-
 //------------------------------------------------------------------   
-Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t iy)
+Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t /*iy*/)
 {
 // Returns sector number for given module
 // 
@@ -251,17 +259,26 @@ Int_t AliMUONSegmentationTriggerY::Sector(Int_t ix, Int_t iy)
 
 //------------------------------------------------------------------   
 void AliMUONSegmentationTriggerY::
-IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& width
+IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4
 { 
 // returns quantities needed to evaluate neighbour strip response
   Int_t ix,iy;
   Float_t xstrip,ystrip;
-  GetPadIxy(fxhit,fyhit,ix,iy);  
-  GetPadCxy(ix,iy,xstrip,ystrip);  
-  x1=fxhit;        // hit x position
+  GetPadI(fXhit,fYhit,ix,iy);  
+  GetPadC(ix,iy,xstrip,ystrip);  
+  x1=fXhit;        // hit x position
   x2=xstrip;       // x coordinate of the main strip
-  x3=fx;           // current strip real x coordinate  
-  width=StripSizeY(ix);   // width of the main strip 
+  x3=fX;           // current strip real x coordinate  
+  //  width=StripSizeY(ix);   // width of the main strip 
+
+  // find the position of the 2 borders of the current strip
+  Float_t xmin = fXofysmin[ModuleNumber(fIx)][fIy];
+  Float_t xmax = fXofysmax[ModuleNumber(fIx)][fIy];
+
+  // dist. between the hit and the closest border of the current strip
+  x4 = (TMath::Abs(xmax-x1) > TMath::Abs(xmin-x1)) ? 
+    TMath::Abs(xmin-x1):TMath::Abs(xmax-x1);    
+
 }