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 **************************************************************************/
18 /////////////////////////////////////////////////////
19 // Segmentation classes for slat modules //
20 // to be used with AluMUONSegmentationSlat //
21 /////////////////////////////////////////////////////
27 #include "AliMUONSegmentationSlatModuleN.h"
29 //___________________________________________
30 ClassImp(AliMUONSegmentationSlatModuleN)
32 AliMUONSegmentationSlatModuleN::AliMUONSegmentationSlatModuleN()
33 : AliMUONSegmentationSlatModule()
35 // Default constructor
38 AliMUONSegmentationSlatModuleN::AliMUONSegmentationSlatModuleN(Int_t nsec)
39 : AliMUONSegmentationSlatModule(nsec)
41 // Non default constructor
45 Float_t AliMUONSegmentationSlatModuleN::Dpx(Int_t /*isec*/) const
48 // Returns x-pad size for given sector isec
52 Float_t AliMUONSegmentationSlatModuleN::Dpy(Int_t isec) const
55 // Returns y-pad size for given sector isec
56 return (*fDpxD)[isec];
60 void AliMUONSegmentationSlatModuleN::
61 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
63 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
66 if (ix > fNpx) ix= fNpx;
70 for (Int_t i = fNsec-1; i > 0; i--) {
73 if (fCx[isec] == fCx[isec-1] && isec > 1) isec--;
84 iy = Int_t(y/(*fDpxD)[isec])+1;
88 void AliMUONSegmentationSlatModuleN::
89 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
91 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
93 x = Float_t(ix*fDpx)-fDpx/2.;
96 Int_t isec=Sector(ix,iy);
97 if (isec == -1) printf("\n gtpadc2 Warning isec !\n");
98 y = iy*(*fDpxD)[isec]-(*fDpxD)[isec]/2.;
102 void AliMUONSegmentationSlatModuleN::NextPad()
104 // Stepper for the iteration over pads
109 if ((fY + Dpy(fSector)) < fYmax) {
111 GetPadC(fIx,fIy,fX,fY);
113 } else if (fIx != fIxmax) {
115 // get y-position of next row (yc), xc not used here
116 GetPadC(fIx,fIy,xc,yc);
117 // get x-pad coordiante for 1 pad in row (fIx)
118 GetPadI(xc,fYmin,ixc,fIy);
119 GetPadC(fIx,fIy,fX,fY);
120 fSector=Sector(fIx,fIy);
125 if (fIy > fNpyS[fSector]) printf("\n this pad %f %f %d %d \n",fX,fY,fIx,fIy);
126 GetPadC(fIx, fIy, xc, yc);
127 // printf("\n Next Pad (n)%d %d %f %f %d %f %d ", fIx,fIy,fX,fY,fSector, fYmax, fIxmax);
130 Int_t AliMUONSegmentationSlatModuleN::MorePads()
132 // Stopping condition for the iterator over pads
135 // Are there more pads in the integration region
144 void AliMUONSegmentationSlatModuleN::
145 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
147 // Returns list of next neighbours for given Pad (iX, iY)
152 Int_t ix,iy,isec1,isec2;
153 Float_t kEpsil= 0.001;
157 Int_t isec=Sector(iX, iY);
159 if (iY+1 <= fNpyS[isec]) {
176 GetPadC(iX, iY, x, y);
177 GetPadI(x+fDpx, y, ix, iy);
184 isec1=Sector(iX, iY);
185 isec2=Sector(iX-1, iY);
190 GetPadC(iX, iY, x, y);
191 GetPadI(x-fDpx, y+kEpsil, ix, iy);
196 GetPadI(x-fDpx, y-kEpsil, ix, iy);
207 void AliMUONSegmentationSlatModuleN::Init(Int_t chamber)
210 // Fill the arrays fCx (x-contour) for each sector
211 // These arrays help in converting from real to pad co-ordinates and
214 // Segmentation is defined by rectangular modules approximating
215 // concentric circles as shown below
217 // PCB module size in cm
219 // printf("\n Initialise Segmentation SlatModuleN \n");
225 // number of pad rows per PCB
227 fNpxPCB = Int_t(fDxPCB/fDpx) ;
229 // Calculate padsize along y
230 (*fDpxD)[fNsec-1]=fDpy;
232 for (Int_t i=fNsec-2; i>=0; i--){
233 (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i];
237 // fill the arrays defining the pad segmentation boundaries
240 // Loop over sectors (isec=0 is the dead space surounding the beam pipe)
242 for (Int_t isec=0; isec<4; isec++) {
248 fNpxS[isec] = fNpxS[isec-1] + fPcbBoards[isec]*fNpxPCB;
249 fNpyS[isec] = Int_t(fDyPCB/fDpy)*(*fNDiv)[isec];
250 fCx[isec] = fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
251 fNpx += fPcbBoards[isec] * fNpxPCB;
256 fNpy=Int_t(fDyPCB/fDpy)*(*fNDiv)[1];