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