]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSegmentationTriggerY.cxx
Code revision:
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationTriggerY.cxx
index b8b820fbff4df2aa5502c4025a26d3827a45f8ed..92e8e8a36cc010a8679232c24b4596c80e9f4fae 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.6  2000/10/02 16:58:29  egangler
-Cleaning of the code :
--> coding conventions
--> void Streamers
--> some useless includes removed or replaced by "class" statement
+/* $Id$ */
 
-Revision 1.5  2000/07/03 11:54:57  morsch
-AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
-The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
-
-Revision 1.4  2000/06/29 12:34:09  morsch
-AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
-it usable with any other geometry class. The link to the object to which it belongs is
-established via an index. This assumes that there exists a global geometry manager
-from which the pointer to the parent object can be obtained (in our case gAlice).
-
-Revision 1.3  2000/06/26 10:01:26  pcrochet
-global variables removed
-
-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
-
-*/
+#include <TMath.h>
 
 #include "AliMUONSegmentationTriggerY.h"
 #include "AliMUONTriggerConstants.h"
-#include "TMath.h"
-#include "TRandom.h"
-#include "TArc.h"
-#include "AliMUONChamber.h"
-#include <iostream.h> 
+#include "AliMUON.h"
+#include "AliRun.h"
+
 ClassImp(AliMUONSegmentationTriggerY)
 
+//------------------------------------------------------------------
+AliMUONSegmentationTriggerY::AliMUONSegmentationTriggerY()
+  : AliMUONSegmentationTrigger()
+{
+// Constructor
+}
+
 //------------------------------------------------------------------
 void AliMUONSegmentationTriggerY::Init(Int_t chamber)
 {
 // intialize Y segmentation 
-  cout << "Initialize Trigger Chamber Geometry Y " << "\n";    
+  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
@@ -145,43 +109,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    
 }
 
 //------------------------------------------------------------------   
@@ -242,18 +223,26 @@ Float_t AliMUONSegmentationTriggerY::Dpy(Int_t isec) const
   } 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
 // 
@@ -275,7 +264,7 @@ 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;
@@ -285,7 +274,16 @@ IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& width)
   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 
+  //  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);    
+
 }