+//-----------------BENDING-----------------------------------------
+// Returns list of 10 next neighbours for given X strip (ix, iy)
+// neighbour number 4 in the list -
+// neighbour number 3 in the list |
+// neighbour number 2 in the list |_ Upper part
+// neighbour number 1 in the list |
+// neighbour number 0 in the list -
+// X strip (ix, iy)
+// neighbour number 5 in the list -
+// neighbour number 6 in the list | _ Lower part
+// neighbour number 7 in the list |
+// neighbour number 8 in the list |
+// neighbour number 9 in the list -
+
+//-----------------NON-BENDING-------------------------------------
+// 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
+
+ Int_t absiX = TMath::Abs(iX);
+ Int_t modNum = ModuleColNum(absiX); // from 0 to 6
+ Int_t nStrip = fNstrip[modNum];
+
+ if (fBending) {
+ Int_t iCandidateUp, iCandidateDo;
+ Int_t j;
+
+ *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;
+ iCandidateUp = iY + (i + 1);
+ iCandidateDo = iY - (i + 1);
+ if (iCandidateUp < nStrip) {
+ Xlist[i] = iX;
+ Ylist[i] = iCandidateUp;
+ }
+ if (iCandidateDo >= 0) {
+ Xlist[j] = iX;
+ Ylist[j] = iCandidateDo;
+ }
+ }
+ } // iY < nStrip
+
+ } else { // non-bending
+
+ Int_t iCandidateLeft, iCandidateRight;
+ Int_t iNewCandidateRight=0;
+ Int_t iNewCandidateLeft=0;
+// first strip number on the right of the left module
+ if ( modNum!=0 && absiX!=52 )
+ iNewCandidateLeft = fNstrip[modNum-1]-1;
+ Int_t j;
+
+ *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 (modNum!=6) { // 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<10; i++) {
+ if (Xlist[i]!=0) Xlist[i]=-Xlist[i];
+ }
+ }
+
+ } // iY < nStrip
+ } // non-bending
+
+// for (Int_t i=0; i<10; i++) {
+// printf("AliMUONTriggerSegmentation LOC fBending i ix iy = %i %i %i %i \n",fBending,i,Xlist[i],Ylist[i]);
+// }