]>
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$ | |
70479d0e | 18 | Revision 1.8 2001/05/16 14:57:17 alibrary |
19 | New files for folders and Stack | |
20 | ||
9e1a0ddb | 21 | Revision 1.7 2001/01/26 21:25:48 morsch |
22 | Empty default constructors and. | |
23 | ||
e9e4cdf2 | 24 | Revision 1.6 2000/12/21 22:12:41 morsch |
25 | Clean-up of coding rule violations, | |
26 | ||
de05461e | 27 | Revision 1.5 2000/10/26 19:32:04 morsch |
28 | Problem with iteration over y-pads for 2nd cathode corrected. | |
29 | ||
d4ee3c3e | 30 | Revision 1.4 2000/10/25 19:56:55 morsch |
31 | Handle correctly slats with less than 3 segmentation zones. | |
32 | ||
f30dea32 | 33 | Revision 1.3 2000/10/22 16:56:33 morsch |
34 | - Store chamber number as slat id. | |
35 | ||
de2f6d11 | 36 | Revision 1.2 2000/10/18 11:42:06 morsch |
37 | - AliMUONRawCluster contains z-position. | |
38 | - Some clean-up of useless print statements during initialisations. | |
39 | ||
3e1872ed | 40 | Revision 1.1 2000/10/06 08:59:03 morsch |
41 | Segmentation classes for bending and non bending plane slat modules (A. de Falco, A. Morsch) | |
42 | ||
4c503756 | 43 | */ |
44 | ||
45 | ///////////////////////////////////////////////////// | |
46 | // Segmentation classes for slat modules // | |
47 | // to be used with AluMUONSegmentationSlat // | |
48 | ///////////////////////////////////////////////////// | |
49 | ||
50 | ||
51 | #include "AliMUONSegmentationSlatModuleN.h" | |
52 | #include <TMath.h> | |
70479d0e | 53 | #include <Riostream.h> |
4c503756 | 54 | |
55 | #include "AliMUONSegmentationV01.h" | |
56 | ||
57 | //___________________________________________ | |
58 | ClassImp(AliMUONSegmentationSlatModuleN) | |
59 | ||
60 | AliMUONSegmentationSlatModuleN::AliMUONSegmentationSlatModuleN() | |
61 | { | |
62 | // Default constructor | |
63 | } | |
64 | ||
e9e4cdf2 | 65 | AliMUONSegmentationSlatModuleN::AliMUONSegmentationSlatModuleN(Int_t nsec) |
66 | : AliMUONSegmentationSlatModule(nsec) | |
67 | { | |
68 | // Non default constructor | |
69 | } | |
70 | ||
4c503756 | 71 | |
72 | Float_t AliMUONSegmentationSlatModuleN::Dpx(Int_t isec) const | |
73 | { | |
74 | // | |
75 | // Returns x-pad size for given sector isec | |
76 | return fDpx; | |
77 | } | |
78 | ||
79 | Float_t AliMUONSegmentationSlatModuleN::Dpy(Int_t isec) const | |
80 | { | |
81 | // | |
82 | // Returns y-pad size for given sector isec | |
83 | return (*fDpxD)[isec]; | |
84 | } | |
85 | ||
86 | ||
87 | void AliMUONSegmentationSlatModuleN:: | |
88 | GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy) | |
89 | { | |
90 | // Returns pad coordinates (ix,iy) for given real coordinates (x,y) | |
91 | // | |
92 | ix = Int_t(x/fDpx)+1; | |
93 | if (ix > fNpx) ix= fNpx; | |
94 | // | |
95 | // Find sector isec | |
96 | Int_t isec=-1; | |
97 | for (Int_t i = fNsec-1; i > 0; i--) { | |
98 | if (x >= fCx[i-1]) { | |
99 | isec=i; | |
f30dea32 | 100 | if (fCx[isec] == fCx[isec-1] && isec > 1) isec--; |
4c503756 | 101 | break; |
102 | } | |
103 | } | |
104 | // | |
105 | // | |
f30dea32 | 106 | |
4c503756 | 107 | if (isec == -1) { |
108 | ix = 0; | |
109 | iy = 0; | |
110 | } else { | |
111 | iy = Int_t(y/(*fDpxD)[isec])+1; | |
112 | } | |
113 | } | |
114 | ||
115 | void AliMUONSegmentationSlatModuleN:: | |
116 | GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) | |
117 | { | |
118 | // Returns real coordinates (x,y) for given pad coordinates (ix,iy) | |
119 | // | |
120 | x = Float_t(ix*fDpx)-fDpx/2.; | |
121 | // | |
122 | // Find sector isec | |
123 | Int_t isec=Sector(ix,iy); | |
124 | if (isec == -1) printf("\n gtpadc2 Warning isec !\n"); | |
125 | y = iy*(*fDpxD)[isec]-(*fDpxD)[isec]/2.; | |
126 | } | |
127 | ||
128 | ||
129 | void AliMUONSegmentationSlatModuleN::NextPad() | |
130 | { | |
131 | // Stepper for the iteration over pads | |
132 | // | |
133 | Float_t xc,yc; | |
134 | Int_t ixc; | |
135 | // step up | |
136 | if ((fY + Dpy(fSector)) < fYmax) { | |
137 | fIy++; | |
138 | GetPadC(fIx,fIy,fX,fY); | |
139 | // step right | |
140 | } else if (fIx != fIxmax) { | |
141 | fIx++; | |
142 | // get y-position of next row (yc), xc not used here | |
143 | GetPadC(fIx,fIy,xc,yc); | |
144 | // get x-pad coordiante for 1 pad in row (fIx) | |
145 | GetPadI(xc,fYmin,ixc,fIy); | |
146 | GetPadC(fIx,fIy,fX,fY); | |
147 | fSector=Sector(fIx,fIy); | |
148 | } else { | |
149 | fIx=fIy=-1; | |
150 | } | |
151 | ||
152 | if (fIy > fNpyS[fSector]) printf("\n this pad %f %f %d %d \n",fX,fY,fIx,fIy); | |
153 | GetPadC(fIx, fIy, xc, yc); | |
d4ee3c3e | 154 | // printf("\n Next Pad (n)%d %d %f %f %d %f %d ", fIx,fIy,fX,fY,fSector, fYmax, fIxmax); |
4c503756 | 155 | } |
156 | ||
157 | Int_t AliMUONSegmentationSlatModuleN::MorePads() | |
de05461e | 158 | { |
4c503756 | 159 | // Stopping condition for the iterator over pads |
160 | // | |
161 | // | |
162 | // Are there more pads in the integration region | |
de05461e | 163 | |
d4ee3c3e | 164 | if (fIy == -1) { |
4c503756 | 165 | return 0; |
166 | } else { | |
167 | return 1; | |
168 | } | |
169 | } | |
170 | ||
171 | void AliMUONSegmentationSlatModuleN:: | |
172 | Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]) | |
173 | { | |
4c503756 | 174 | // Returns list of next neighbours for given Pad (iX, iY) |
175 | // | |
176 | // | |
177 | Int_t i=0; | |
178 | Float_t x,y; | |
179 | Int_t ix,iy,isec1,isec2; | |
180 | Float_t kEpsil= 0.001; | |
181 | ||
182 | // | |
183 | // step up | |
184 | Int_t isec=Sector(iX, iY); | |
185 | ||
186 | if (iY+1 <= fNpyS[isec]) { | |
187 | Xlist[i]=iX; | |
188 | Ylist[i++]=iY+1; | |
189 | } | |
190 | // | |
191 | // step down | |
192 | if (iY-1 > 0) { | |
193 | Xlist[i]=iX; | |
194 | Ylist[i++]=iY-1; | |
195 | } | |
196 | // | |
197 | // | |
198 | // step right | |
199 | ||
200 | if (iX+1 <= fNpx) { | |
201 | ||
202 | ||
203 | GetPadC(iX, iY, x, y); | |
204 | GetPadI(x+fDpx, y, ix, iy); | |
205 | Xlist[i]=iX+1; | |
206 | Ylist[i++]=iy; | |
207 | } | |
208 | // | |
209 | // step left | |
210 | if (iX-1 > 0) { | |
211 | isec1=Sector(iX, iY); | |
212 | isec2=Sector(iX-1, iY); | |
213 | if (isec1==isec2) { | |
214 | Xlist[i]=iX-1; | |
215 | Ylist[i++]=iY; | |
216 | } else { | |
217 | GetPadC(iX, iY, x, y); | |
218 | GetPadI(x-fDpx, y+kEpsil, ix, iy); | |
219 | if (ix != -1) { | |
220 | Xlist[i]=iX-1; | |
221 | Ylist[i++]=iy; | |
222 | } | |
223 | GetPadI(x-fDpx, y-kEpsil, ix, iy); | |
224 | if (ix != -1) { | |
225 | Xlist[i]=iX-1; | |
226 | Ylist[i++]=iy; | |
227 | } | |
228 | } | |
229 | } | |
230 | *Nlist=i; | |
231 | } | |
232 | ||
233 | ||
234 | void AliMUONSegmentationSlatModuleN::Init(Int_t chamber) | |
235 | { | |
4c503756 | 236 | // |
237 | // Fill the arrays fCx (x-contour) for each sector | |
238 | // These arrays help in converting from real to pad co-ordinates and | |
239 | // vice versa | |
240 | // | |
241 | // Segmentation is defined by rectangular modules approximating | |
242 | // concentric circles as shown below | |
243 | // | |
244 | // PCB module size in cm | |
de05461e | 245 | |
9e1a0ddb | 246 | // printf("\n Initialise Segmentation SlatModuleN \n"); |
de05461e | 247 | |
248 | ||
4c503756 | 249 | fDxPCB=40; |
250 | fDyPCB=40; | |
251 | // | |
252 | // number of pad rows per PCB | |
253 | // | |
254 | fNpxPCB = Int_t(fDxPCB/fDpx) ; | |
255 | // | |
256 | // Calculate padsize along y | |
257 | (*fDpxD)[fNsec-1]=fDpy; | |
258 | if (fNsec > 1) { | |
259 | for (Int_t i=fNsec-2; i>=0; i--){ | |
260 | (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i]; | |
4c503756 | 261 | } |
262 | } | |
263 | // | |
264 | // fill the arrays defining the pad segmentation boundaries | |
265 | // | |
266 | // | |
267 | // Loop over sectors (isec=0 is the dead space surounding the beam pipe) | |
268 | ||
269 | for (Int_t isec=0; isec<4; isec++) { | |
270 | if (isec==0) { | |
271 | fCx[0] = 0; | |
272 | fNpxS[0] = 0; | |
273 | fNpyS[0] = 0; | |
274 | } else { | |
275 | fNpxS[isec] = fNpxS[isec-1] + fPcbBoards[isec]*fNpxPCB; | |
276 | fNpyS[isec] = Int_t(fDyPCB/fDpy)*(*fNDiv)[isec]; | |
4c503756 | 277 | fCx[isec] = fCx[isec-1] + fPcbBoards[isec]*fDxPCB; |
278 | fNpx += fPcbBoards[isec] * fNpxPCB; | |
279 | } | |
280 | } // sectors | |
281 | ||
282 | fNpx=fNpxS[3]; | |
283 | fNpy=Int_t(fDyPCB/fDpy)*(*fNDiv)[1]; | |
de2f6d11 | 284 | // |
285 | fId = chamber; | |
286 | ||
4c503756 | 287 | } |
288 | ||
289 | ||
290 | ||
291 | ||
292 | ||
293 | ||
294 | ||
295 | ||
296 | ||
297 | ||
298 | ||
299 |