]>
Commit | Line | Data |
---|---|---|
4c503756 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
88cb7938 | 16 | /* $Id$ */ |
4c503756 | 17 | |
18 | ///////////////////////////////////////////////////// | |
19 | // Segmentation classes for slat modules // | |
20 | // to be used with AluMUONSegmentationSlat // | |
21 | ///////////////////////////////////////////////////// | |
22 | ||
23 | ||
30178c30 | 24 | #include <TArrayI.h> |
25 | #include <TArrayF.h> | |
4c503756 | 26 | |
30178c30 | 27 | #include "AliMUONSegmentationSlatModuleN.h" |
4c503756 | 28 | |
29 | //___________________________________________ | |
30 | ClassImp(AliMUONSegmentationSlatModuleN) | |
31 | ||
32 | AliMUONSegmentationSlatModuleN::AliMUONSegmentationSlatModuleN() | |
30178c30 | 33 | : AliMUONSegmentationSlatModule() |
4c503756 | 34 | { |
35 | // Default constructor | |
36 | } | |
37 | ||
e9e4cdf2 | 38 | AliMUONSegmentationSlatModuleN::AliMUONSegmentationSlatModuleN(Int_t nsec) |
39 | : AliMUONSegmentationSlatModule(nsec) | |
40 | { | |
41 | // Non default constructor | |
42 | } | |
43 | ||
4c503756 | 44 | |
ce3f5e87 | 45 | Float_t AliMUONSegmentationSlatModuleN::Dpx(Int_t /*isec*/) const |
4c503756 | 46 | { |
47 | // | |
48 | // Returns x-pad size for given sector isec | |
49 | return fDpx; | |
50 | } | |
51 | ||
52 | Float_t AliMUONSegmentationSlatModuleN::Dpy(Int_t isec) const | |
53 | { | |
54 | // | |
55 | // Returns y-pad size for given sector isec | |
56 | return (*fDpxD)[isec]; | |
57 | } | |
58 | ||
59 | ||
60 | void AliMUONSegmentationSlatModuleN:: | |
61 | GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy) | |
62 | { | |
63 | // Returns pad coordinates (ix,iy) for given real coordinates (x,y) | |
64 | // | |
65 | ix = Int_t(x/fDpx)+1; | |
66 | if (ix > fNpx) ix= fNpx; | |
67 | // | |
68 | // Find sector isec | |
69 | Int_t isec=-1; | |
70 | for (Int_t i = fNsec-1; i > 0; i--) { | |
71 | if (x >= fCx[i-1]) { | |
72 | isec=i; | |
f30dea32 | 73 | if (fCx[isec] == fCx[isec-1] && isec > 1) isec--; |
4c503756 | 74 | break; |
75 | } | |
76 | } | |
77 | // | |
78 | // | |
f30dea32 | 79 | |
4c503756 | 80 | if (isec == -1) { |
81 | ix = 0; | |
82 | iy = 0; | |
83 | } else { | |
84 | iy = Int_t(y/(*fDpxD)[isec])+1; | |
85 | } | |
86 | } | |
87 | ||
88 | void AliMUONSegmentationSlatModuleN:: | |
89 | GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) | |
90 | { | |
91 | // Returns real coordinates (x,y) for given pad coordinates (ix,iy) | |
92 | // | |
93 | x = Float_t(ix*fDpx)-fDpx/2.; | |
94 | // | |
95 | // Find sector isec | |
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.; | |
99 | } | |
100 | ||
101 | ||
102 | void AliMUONSegmentationSlatModuleN::NextPad() | |
103 | { | |
104 | // Stepper for the iteration over pads | |
105 | // | |
106 | Float_t xc,yc; | |
107 | Int_t ixc; | |
108 | // step up | |
109 | if ((fY + Dpy(fSector)) < fYmax) { | |
110 | fIy++; | |
111 | GetPadC(fIx,fIy,fX,fY); | |
112 | // step right | |
113 | } else if (fIx != fIxmax) { | |
114 | fIx++; | |
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); | |
121 | } else { | |
122 | fIx=fIy=-1; | |
123 | } | |
124 | ||
125 | if (fIy > fNpyS[fSector]) printf("\n this pad %f %f %d %d \n",fX,fY,fIx,fIy); | |
126 | GetPadC(fIx, fIy, xc, yc); | |
d4ee3c3e | 127 | // printf("\n Next Pad (n)%d %d %f %f %d %f %d ", fIx,fIy,fX,fY,fSector, fYmax, fIxmax); |
4c503756 | 128 | } |
129 | ||
130 | Int_t AliMUONSegmentationSlatModuleN::MorePads() | |
de05461e | 131 | { |
4c503756 | 132 | // Stopping condition for the iterator over pads |
133 | // | |
134 | // | |
135 | // Are there more pads in the integration region | |
de05461e | 136 | |
d4ee3c3e | 137 | if (fIy == -1) { |
4c503756 | 138 | return 0; |
139 | } else { | |
140 | return 1; | |
141 | } | |
142 | } | |
143 | ||
144 | void AliMUONSegmentationSlatModuleN:: | |
145 | Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]) | |
146 | { | |
4c503756 | 147 | // Returns list of next neighbours for given Pad (iX, iY) |
148 | // | |
149 | // | |
150 | Int_t i=0; | |
151 | Float_t x,y; | |
152 | Int_t ix,iy,isec1,isec2; | |
153 | Float_t kEpsil= 0.001; | |
154 | ||
155 | // | |
156 | // step up | |
157 | Int_t isec=Sector(iX, iY); | |
158 | ||
159 | if (iY+1 <= fNpyS[isec]) { | |
160 | Xlist[i]=iX; | |
161 | Ylist[i++]=iY+1; | |
162 | } | |
163 | // | |
164 | // step down | |
165 | if (iY-1 > 0) { | |
166 | Xlist[i]=iX; | |
167 | Ylist[i++]=iY-1; | |
168 | } | |
169 | // | |
170 | // | |
171 | // step right | |
172 | ||
173 | if (iX+1 <= fNpx) { | |
174 | ||
175 | ||
176 | GetPadC(iX, iY, x, y); | |
177 | GetPadI(x+fDpx, y, ix, iy); | |
178 | Xlist[i]=iX+1; | |
179 | Ylist[i++]=iy; | |
180 | } | |
181 | // | |
182 | // step left | |
183 | if (iX-1 > 0) { | |
184 | isec1=Sector(iX, iY); | |
185 | isec2=Sector(iX-1, iY); | |
186 | if (isec1==isec2) { | |
187 | Xlist[i]=iX-1; | |
188 | Ylist[i++]=iY; | |
189 | } else { | |
190 | GetPadC(iX, iY, x, y); | |
191 | GetPadI(x-fDpx, y+kEpsil, ix, iy); | |
192 | if (ix != -1) { | |
193 | Xlist[i]=iX-1; | |
194 | Ylist[i++]=iy; | |
195 | } | |
196 | GetPadI(x-fDpx, y-kEpsil, ix, iy); | |
197 | if (ix != -1) { | |
198 | Xlist[i]=iX-1; | |
199 | Ylist[i++]=iy; | |
200 | } | |
201 | } | |
202 | } | |
203 | *Nlist=i; | |
204 | } | |
205 | ||
206 | ||
207 | void AliMUONSegmentationSlatModuleN::Init(Int_t chamber) | |
208 | { | |
4c503756 | 209 | // |
210 | // Fill the arrays fCx (x-contour) for each sector | |
211 | // These arrays help in converting from real to pad co-ordinates and | |
212 | // vice versa | |
213 | // | |
214 | // Segmentation is defined by rectangular modules approximating | |
215 | // concentric circles as shown below | |
216 | // | |
217 | // PCB module size in cm | |
de05461e | 218 | |
9e1a0ddb | 219 | // printf("\n Initialise Segmentation SlatModuleN \n"); |
de05461e | 220 | |
221 | ||
4c503756 | 222 | fDxPCB=40; |
223 | fDyPCB=40; | |
224 | // | |
225 | // number of pad rows per PCB | |
226 | // | |
227 | fNpxPCB = Int_t(fDxPCB/fDpx) ; | |
228 | // | |
229 | // Calculate padsize along y | |
230 | (*fDpxD)[fNsec-1]=fDpy; | |
231 | if (fNsec > 1) { | |
232 | for (Int_t i=fNsec-2; i>=0; i--){ | |
233 | (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i]; | |
4c503756 | 234 | } |
235 | } | |
236 | // | |
237 | // fill the arrays defining the pad segmentation boundaries | |
238 | // | |
239 | // | |
240 | // Loop over sectors (isec=0 is the dead space surounding the beam pipe) | |
241 | ||
242 | for (Int_t isec=0; isec<4; isec++) { | |
243 | if (isec==0) { | |
244 | fCx[0] = 0; | |
245 | fNpxS[0] = 0; | |
246 | fNpyS[0] = 0; | |
247 | } else { | |
248 | fNpxS[isec] = fNpxS[isec-1] + fPcbBoards[isec]*fNpxPCB; | |
249 | fNpyS[isec] = Int_t(fDyPCB/fDpy)*(*fNDiv)[isec]; | |
4c503756 | 250 | fCx[isec] = fCx[isec-1] + fPcbBoards[isec]*fDxPCB; |
251 | fNpx += fPcbBoards[isec] * fNpxPCB; | |
252 | } | |
253 | } // sectors | |
254 | ||
255 | fNpx=fNpxS[3]; | |
256 | fNpy=Int_t(fDyPCB/fDpy)*(*fNDiv)[1]; | |
de2f6d11 | 257 | // |
258 | fId = chamber; | |
259 | ||
4c503756 | 260 | } |
261 | ||
262 | ||
263 | ||
264 | ||
265 | ||
266 | ||
267 | ||
268 | ||
269 | ||
270 | ||
271 | ||
272 |