]>
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 | ||
16 | /* | |
17 | $Log$ | |
de2f6d11 | 18 | Revision 1.2 2000/10/18 11:42:06 morsch |
19 | - AliMUONRawCluster contains z-position. | |
20 | - Some clean-up of useless print statements during initialisations. | |
21 | ||
3e1872ed | 22 | Revision 1.1 2000/10/06 08:59:03 morsch |
23 | Segmentation classes for bending and non bending plane slat modules (A. de Falco, A. Morsch) | |
24 | ||
4c503756 | 25 | */ |
26 | ||
27 | ///////////////////////////////////////////////////// | |
28 | // Segmentation classes for slat modules // | |
29 | // to be used with AluMUONSegmentationSlat // | |
30 | ///////////////////////////////////////////////////// | |
31 | ||
32 | ||
33 | #include "AliMUONSegmentationSlatModule.h" | |
34 | #include <TMath.h> | |
35 | #include <iostream.h> | |
36 | ||
37 | #include "AliMUONSegmentationV01.h" | |
38 | ||
39 | //___________________________________________ | |
40 | ClassImp(AliMUONSegmentationSlatModule) | |
41 | ||
42 | AliMUONSegmentationSlatModule::AliMUONSegmentationSlatModule() | |
43 | { | |
44 | // Default constructor | |
45 | fNsec=4; | |
46 | fNDiv = new TArrayI(fNsec); | |
47 | fDpxD = new TArrayF(fNsec); | |
48 | (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0; | |
49 | (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0; | |
50 | } | |
51 | ||
52 | void AliMUONSegmentationSlatModule::SetPcbBoards(Int_t n[4]) | |
53 | { | |
54 | // | |
55 | // Set Pcb Board segmentation zones | |
56 | for (Int_t i=0; i<4; i++) fPcbBoards[i]=n[i]; | |
57 | } | |
58 | ||
59 | ||
60 | void AliMUONSegmentationSlatModule::SetPadDivision(Int_t ndiv[4]) | |
61 | { | |
62 | // | |
63 | // Defines the pad size perp. to the anode wire (y) for different sectors. | |
64 | // Pad sizes are defined as integral fractions ndiv of a basis pad size | |
65 | // fDpx | |
66 | // | |
67 | for (Int_t i=0; i<4; i++) { | |
68 | (*fNDiv)[i]=ndiv[i]; | |
69 | } | |
70 | ndiv[0]=ndiv[1]; | |
71 | } | |
72 | ||
73 | Float_t AliMUONSegmentationSlatModule::Dpx(Int_t isec) const | |
74 | { | |
75 | // Return x-strip width | |
76 | return (*fDpxD)[isec]; | |
77 | } | |
78 | ||
79 | ||
80 | Float_t AliMUONSegmentationSlatModule::Dpy(Int_t isec) const | |
81 | { | |
82 | // Return y-strip width | |
83 | ||
84 | return fDpy; | |
85 | } | |
86 | ||
87 | ||
88 | void AliMUONSegmentationSlatModule:: | |
89 | GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy) | |
90 | { | |
91 | // Returns pad coordinates (ix,iy) for given real coordinates (x,y) | |
92 | // | |
93 | iy = Int_t(y/fDpy)+1; | |
94 | if (iy > fNpy) iy= fNpy; | |
95 | // | |
96 | // Find sector isec | |
97 | ||
98 | Int_t isec=-1; | |
99 | for (Int_t i=fNsec-1; i > 0; i--) { | |
100 | if (x >= fCx[i-1]) { | |
101 | isec=i; | |
102 | break; | |
103 | } | |
104 | } | |
105 | ||
106 | if (isec>0) { | |
107 | ix= Int_t((x-fCx[isec-1])/(*fDpxD)[isec]) | |
108 | +fNpxS[isec-1]+1; | |
109 | } else if (isec == 0) { | |
110 | ix= Int_t(x/(*fDpxD)[isec])+1; | |
111 | } else { | |
112 | ix=0; | |
113 | iy=0; | |
114 | } | |
115 | } | |
116 | ||
117 | void AliMUONSegmentationSlatModule:: | |
118 | GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) | |
119 | { | |
120 | // Returns real coordinates (x,y) for given pad coordinates (ix,iy) | |
121 | // | |
122 | y = Float_t(iy*fDpy)-fDpy/2.; | |
123 | // | |
124 | // Find sector isec | |
125 | Int_t isec=AliMUONSegmentationSlatModule::Sector(ix,iy); | |
de2f6d11 | 126 | if (isec == -1) printf("\n PadC %d %d %d %d \n ", isec, fId, ix, iy); |
4c503756 | 127 | // |
128 | if (isec>0) { | |
129 | x = fCx[isec-1]+(ix-fNpxS[isec-1])*(*fDpxD)[isec]; | |
130 | x = x-(*fDpxD)[isec]/2; | |
131 | } else { | |
132 | x=y=0; | |
133 | } | |
134 | } | |
135 | ||
136 | void AliMUONSegmentationSlatModule:: | |
137 | SetPad(Int_t ix, Int_t iy) | |
138 | { | |
139 | // | |
140 | // Sets virtual pad coordinates, needed for evaluating pad response | |
141 | // outside the tracking program | |
142 | GetPadC(ix,iy,fX,fY); | |
143 | fSector=Sector(ix,iy); | |
144 | } | |
145 | ||
146 | void AliMUONSegmentationSlatModule:: | |
147 | SetHit(Float_t x, Float_t y) | |
148 | { | |
149 | fXhit = x; | |
150 | fYhit = y; | |
151 | ||
152 | if (x < 0) fXhit = 0; | |
153 | if (y < 0) fYhit = 0; | |
154 | ||
155 | if (x >= fCx[fNsec-1]) fXhit = fCx[fNsec-1]; | |
156 | if (y >= fDyPCB) fYhit = fDyPCB; | |
157 | ||
158 | ||
159 | } | |
160 | ||
161 | ||
162 | void AliMUONSegmentationSlatModule:: | |
163 | FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy) | |
164 | { | |
165 | // Initialises iteration over pads for charge distribution algorithm | |
166 | // | |
167 | // | |
168 | // Find the wire position (center of charge distribution) | |
169 | Float_t x0a=GetAnod(xhit); | |
170 | fXhit=x0a; | |
171 | fYhit=yhit; | |
172 | // | |
173 | // and take fNsigma*sigma around this center | |
174 | Float_t x01=x0a - dx; | |
175 | Float_t x02=x0a + dx; | |
176 | Float_t y01=yhit - dy; | |
177 | Float_t y02=yhit + dy; | |
178 | ||
179 | if (x01 < 0) x01 = 0; | |
180 | if (y01 < 0) y01 = 0; | |
181 | ||
182 | Int_t isec=-1; | |
183 | for (Int_t i=fNsec-1; i > 0; i--) { | |
184 | if (x02 >= fCx[i-1]) { | |
185 | isec=i; | |
186 | break; | |
187 | } | |
188 | } | |
189 | ||
190 | if (x02 >= fCx[fNsec-1]) x02 = fCx[fNsec-1]; | |
191 | if (y02 >= fDyPCB) y02 = fDyPCB; | |
192 | // | |
193 | // find the pads over which the charge distributes | |
194 | GetPadI(x01,y01,fIxmin,fIymin); | |
195 | GetPadI(x02,y02,fIxmax,fIymax); | |
196 | if (fIxmax > fNpx) fIxmax=fNpx; | |
197 | if (fIymax > fNpyS[isec]) fIymax = fNpyS[isec]; | |
198 | fXmin=x01; | |
199 | fXmax=x02; | |
200 | fYmin=y01; | |
201 | fYmax=y02; | |
202 | ||
203 | // | |
204 | // Set current pad to lower left corner | |
205 | if (fIxmax < fIxmin) fIxmax=fIxmin; | |
206 | if (fIymax < fIymin) fIymax=fIymin; | |
207 | fIx=fIxmin; | |
208 | fIy=fIymin; | |
209 | ||
210 | GetPadC(fIx,fIy,fX,fY); | |
211 | fSector=Sector(fIx,fIy); | |
212 | // printf("\n \n First Pad: %d %d %f %f %d %d %d %f" , | |
213 | // fIxmin, fIxmax, fXmin, fXmax, fNpx, fId, isec, Dpy(isec)); | |
214 | // printf("\n \n First Pad: %d %d %f %f %d %d %d %f", | |
215 | // fIymin, fIymax, fYmin, fYmax, fNpy, fId, isec, Dpy(isec)); | |
216 | } | |
217 | ||
218 | void AliMUONSegmentationSlatModule::NextPad() | |
219 | { | |
220 | // Stepper for the iteration over pads | |
221 | // | |
222 | // Step to next pad in the integration region | |
223 | // step from left to right | |
224 | if (fIx != fIxmax) { | |
225 | fIx++; | |
226 | GetPadC(fIx,fIy,fX,fY); | |
227 | fSector=Sector(fIx,fIy); | |
228 | // step up | |
229 | } else if (fIy != fIymax) { | |
230 | fIx=fIxmin; | |
231 | fIy++; | |
232 | GetPadC(fIx,fIy,fX,fY); | |
233 | fSector=Sector(fIx,fIy); | |
234 | ||
235 | } else { | |
236 | fIx=-1; | |
237 | fIy=-1; | |
238 | } | |
239 | // printf("\n Next Pad %d %d %f %f %d %d %d %d %d ", | |
240 | } | |
241 | ||
242 | ||
243 | Int_t AliMUONSegmentationSlatModule::MorePads() | |
244 | // Stopping condition for the iterator over pads | |
245 | // | |
246 | // Are there more pads in the integration region | |
247 | { | |
248 | ||
249 | return (fIx != -1 || fIy != -1); | |
250 | } | |
251 | ||
252 | ||
253 | Int_t AliMUONSegmentationSlatModule::Sector(Int_t ix, Int_t iy) | |
254 | { | |
255 | // | |
256 | // Determine segmentation zone from pad coordinates | |
257 | // | |
258 | Int_t isec=-1; | |
259 | for (Int_t i=0; i < fNsec; i++) { | |
260 | if (ix <= fNpxS[i]) { | |
261 | isec=i; | |
262 | break; | |
263 | } | |
264 | } | |
265 | if (isec == -1) printf("\n Sector: Attention isec ! %d %d %d %d \n", | |
266 | fId, ix, iy,fNpxS[3]); | |
267 | ||
268 | return isec; | |
269 | ||
270 | } | |
271 | ||
272 | void AliMUONSegmentationSlatModule:: | |
273 | IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2) | |
274 | { | |
275 | // Returns integration limits for current pad | |
276 | // | |
277 | ||
278 | x1=fXhit-fX-Dpx(fSector)/2.; | |
279 | x2=x1+Dpx(fSector); | |
280 | y1=fYhit-fY-Dpy(fSector)/2.; | |
281 | y2=y1+Dpy(fSector); | |
282 | // printf("\n Integration Limits %f %f %f %f %d %f", x1, x2, y1, y2, fSector, Dpx(fSector)); | |
283 | ||
284 | } | |
285 | ||
286 | void AliMUONSegmentationSlatModule:: | |
287 | Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]) | |
288 | { | |
289 | // Returns list of next neighbours for given Pad (iX, iY) | |
290 | // | |
291 | // | |
292 | Int_t i=0; | |
293 | // | |
294 | // step right | |
295 | if (iX+1 <= fNpx) { | |
296 | Xlist[i]=iX+1; | |
297 | Ylist[i++]=iY; | |
298 | } | |
299 | // | |
300 | // step left | |
301 | if (iX-1 > 0) { | |
302 | Xlist[i]=iX-1; | |
303 | Ylist[i++]=iY; | |
304 | } | |
305 | ||
306 | // | |
307 | // step up | |
308 | if (iY+1 <= fNpy) { | |
309 | Xlist[i]=iX; | |
310 | Ylist[i++]=iY+1; | |
311 | } | |
312 | // | |
313 | // step down | |
314 | if (iY-1 > 0) { | |
315 | Xlist[i]=iX; | |
316 | Ylist[i++]=iY-1; | |
317 | } | |
318 | ||
319 | *Nlist=i; | |
320 | } | |
321 | ||
322 | ||
323 | void AliMUONSegmentationSlatModule::Init(Int_t chamber) | |
324 | { | |
3e1872ed | 325 | printf("\n Initialise Segmentation SlatModule \n"); |
4c503756 | 326 | // |
327 | // Fill the arrays fCx (x-contour) and fNpxS (ix-contour) for each sector | |
328 | // These arrays help in converting from real to pad co-ordinates and | |
329 | // vice versa | |
330 | // | |
331 | // Segmentation is defined by rectangular modules approximating | |
332 | // concentric circles as shown below | |
333 | // | |
334 | // PCB module size in cm | |
335 | fDxPCB=40; | |
336 | fDyPCB=40; | |
337 | // | |
338 | // number of pad rows per PCB | |
339 | // | |
340 | Int_t nPyPCB=Int_t(fDyPCB/fDpy); | |
341 | // | |
342 | // maximum number of pad rows | |
343 | fNpy=nPyPCB; | |
344 | // | |
345 | // Calculate padsize along x | |
346 | (*fDpxD)[fNsec-1]=fDpx; | |
347 | if (fNsec > 1) { | |
348 | for (Int_t i=fNsec-2; i>=0; i--){ | |
349 | (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i]; | |
4c503756 | 350 | } |
351 | } | |
352 | // | |
353 | // fill the arrays defining the pad segmentation boundaries | |
354 | // | |
355 | // | |
356 | // Loop over sectors (isec=0 is the dead space surounding the beam pipe) | |
357 | for (Int_t isec=0; isec<4; isec++) { | |
358 | if (isec==0) { | |
359 | fNpxS[0] = 0; | |
360 | fNpyS[0] = 0; | |
361 | fCx[0] = 0; | |
362 | } else { | |
363 | fNpxS[isec]=fNpxS[isec-1] + fPcbBoards[isec]*Int_t(fDxPCB/(*fDpxD)[isec]); | |
364 | fNpyS[isec]=fNpy; | |
365 | fCx[isec]=fCx[isec-1] + fPcbBoards[isec]*fDxPCB; | |
366 | } | |
367 | } // sectors | |
368 | // maximum number of pad rows | |
369 | fNpy=nPyPCB; | |
370 | fNpx=fNpxS[3]; | |
de2f6d11 | 371 | // |
372 | fId = chamber; | |
373 | ||
4c503756 | 374 | } |
375 | ||
376 | ||
377 | ||
378 | ||
379 | ||
380 | ||
381 | ||
382 | ||
383 | ||
384 | ||
385 | ||
386 |