1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
20 /////////////////////////////////////////////////////
21 // Segmentation classes for slat modules //
22 // to be used with AluMUONSegmentationSlat //
23 /////////////////////////////////////////////////////
26 #include "AliMUONSegmentationSlatModuleN.h"
30 #include "AliMUONSegmentationV01.h"
32 //___________________________________________
33 ClassImp(AliMUONSegmentationSlatModuleN)
35 AliMUONSegmentationSlatModuleN::AliMUONSegmentationSlatModuleN()
37 // Default constructor
41 Float_t AliMUONSegmentationSlatModuleN::Dpx(Int_t isec) const
44 // Returns x-pad size for given sector isec
48 Float_t AliMUONSegmentationSlatModuleN::Dpy(Int_t isec) const
51 // Returns y-pad size for given sector isec
52 return (*fDpxD)[isec];
56 void AliMUONSegmentationSlatModuleN::
57 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
59 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
62 if (ix > fNpx) ix= fNpx;
66 for (Int_t i = fNsec-1; i > 0; i--) {
78 iy = Int_t(y/(*fDpxD)[isec])+1;
82 void AliMUONSegmentationSlatModuleN::
83 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
85 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
87 x = Float_t(ix*fDpx)-fDpx/2.;
90 Int_t isec=Sector(ix,iy);
91 if (isec == -1) printf("\n gtpadc2 Warning isec !\n");
92 y = iy*(*fDpxD)[isec]-(*fDpxD)[isec]/2.;
96 void AliMUONSegmentationSlatModuleN::NextPad()
98 // Stepper for the iteration over pads
103 if ((fY + Dpy(fSector)) < fYmax) {
105 GetPadC(fIx,fIy,fX,fY);
107 } else if (fIx != fIxmax) {
109 // get y-position of next row (yc), xc not used here
110 GetPadC(fIx,fIy,xc,yc);
111 // get x-pad coordiante for 1 pad in row (fIx)
112 GetPadI(xc,fYmin,ixc,fIy);
113 GetPadC(fIx,fIy,fX,fY);
114 fSector=Sector(fIx,fIy);
119 if (fIy > fNpyS[fSector]) printf("\n this pad %f %f %d %d \n",fX,fY,fIx,fIy);
120 GetPadC(fIx, fIy, xc, yc);
121 // printf("\n Next Pad (n)%d %d %f %f %d", fIx,fIy,fX,fY,fSector);
124 Int_t AliMUONSegmentationSlatModuleN::MorePads()
125 // Stopping condition for the iterator over pads
128 // Are there more pads in the integration region
130 if ((fY >= fYmax && fIx >= fIxmax) || fIy == -1) {
137 void AliMUONSegmentationSlatModuleN::
138 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
142 // Returns list of next neighbours for given Pad (iX, iY)
147 Int_t ix,iy,isec1,isec2;
148 Float_t kEpsil= 0.001;
152 Int_t isec=Sector(iX, iY);
154 if (iY+1 <= fNpyS[isec]) {
171 GetPadC(iX, iY, x, y);
172 GetPadI(x+fDpx, y, ix, iy);
179 isec1=Sector(iX, iY);
180 isec2=Sector(iX-1, iY);
185 GetPadC(iX, iY, x, y);
186 GetPadI(x-fDpx, y+kEpsil, ix, iy);
191 GetPadI(x-fDpx, y-kEpsil, ix, iy);
202 void AliMUONSegmentationSlatModuleN::Init(Int_t chamber)
204 printf("\n Initialise segmentation SlatModuleN \n");
206 // Fill the arrays fCx (x-contour) for each sector
207 // These arrays help in converting from real to pad co-ordinates and
210 // Segmentation is defined by rectangular modules approximating
211 // concentric circles as shown below
213 // PCB module size in cm
217 // number of pad rows per PCB
219 fNpxPCB = Int_t(fDxPCB/fDpx) ;
221 // Calculate padsize along y
222 (*fDpxD)[fNsec-1]=fDpy;
224 for (Int_t i=fNsec-2; i>=0; i--){
225 (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i];
226 printf("\n test ---dx %d %f \n",i,(*fDpxD)[i]);
230 // fill the arrays defining the pad segmentation boundaries
233 // Loop over sectors (isec=0 is the dead space surounding the beam pipe)
235 for (Int_t isec=0; isec<4; isec++) {
241 fNpxS[isec] = fNpxS[isec-1] + fPcbBoards[isec]*fNpxPCB;
242 fNpyS[isec] = Int_t(fDyPCB/fDpy)*(*fNDiv)[isec];
244 printf("\n %d %d ",isec, fNpxS[isec]);
246 fCx[isec] = fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
247 fNpx += fPcbBoards[isec] * fNpxPCB;
252 fNpy=Int_t(fDyPCB/fDpy)*(*fNDiv)[1];